Python bindings: work around Python 3.5 behaviour change
[babeltrace.git] / bindings / python / python-complements.c
index 35ca33dcc40a422a838944719e97f9b94b28b083..a962b804618df05dc8ff6d1ceb7bc46bb9037d94 100644 (file)
@@ -31,6 +31,8 @@
 #include <babeltrace/ctf-ir/event-types.h>
 #include <babeltrace/ctf-ir/event.h>
 #include <babeltrace/ctf-ir/clock-internal.h>
+#include <babeltrace/iterator.h>
+#include <glib.h>
 
 /* List-related functions
    ----------------------------------------------------
@@ -386,3 +388,14 @@ int _bt_python_ctf_clock_set_uuid_index(struct bt_ctf_clock *clock,
 end:
        return ret;
 }
+
+/*
+ * 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.025526 seconds and 4 git commands to generate.