Python bindings: work around Python 3.5 behaviour change
[babeltrace.git] / bindings / python / python-complements.c
index 6f947bd04e331cb3675a3820b8166e6e2af18e5f..52465aa229a83495ea2c46cba7d4be5559291042 100644 (file)
@@ -21,6 +21,8 @@
 #include "python-complements.h"
 #include <babeltrace/ctf-writer/event-types-internal.h>
 #include <babeltrace/ctf-writer/event-fields-internal.h>
+#include <babeltrace/iterator.h>
+#include <glib.h>
 
 /* FILE functions
    ----------------------------------------------------
@@ -236,3 +238,14 @@ enum ctf_type_id _bt_python_get_field_type(const struct bt_ctf_field *field)
 end:
        return type_id;
 }
+
+/*
+ * Python 3.5 changes the StopIteration exception clearing behaviour which
+ * erroneously marks swig clean-up function as having failed. This explicit
+ * allocation function is intended as a work-around so SWIG doesn't manage
+ * the lifetime of a "temporary" object by itself.
+ */
+struct bt_iter_pos *_bt_python_create_iter_pos(void)
+{
+       return g_new0(struct bt_iter_pos, 1);
+}
This page took 0.022955 seconds and 4 git commands to generate.