bt2: Adapt test_message_iterator.py and make it pass
[babeltrace.git] / bindings / python / bt2 / bt2 / native_bt_component_class.i
index deca5a38682820183e3c457be26c359a74a3c777..1dfa0110886fa05a225e1d018155d11b67829142 100644 (file)
@@ -1340,6 +1340,7 @@ bt_py3_component_class_message_iterator_init(
        PyObject *py_comp_cls = NULL;
        PyObject *py_iter_cls = NULL;
        PyObject *py_iter_ptr = NULL;
        PyObject *py_comp_cls = NULL;
        PyObject *py_iter_cls = NULL;
        PyObject *py_iter_ptr = NULL;
+       PyObject *py_component_port_output_ptr = NULL;
        PyObject *py_init_method_result = NULL;
        PyObject *py_iter = NULL;
        PyObject *py_comp;
        PyObject *py_init_method_result = NULL;
        PyObject *py_iter = NULL;
        PyObject *py_comp;
@@ -1384,14 +1385,23 @@ bt_py3_component_class_message_iterator_init(
        /*
         * Initialize object:
         *
        /*
         * Initialize object:
         *
-        *     py_iter.__init__()
+        *     py_iter.__init__(self_output_port)
+        *
+         * through the _init_for_native helper static method.
         *
         * At this point, py_iter._ptr is set, so this initialization
         * function has access to self._component (which gives it the
         * user Python component object from which the iterator was
         * created).
         */
         *
         * At this point, py_iter._ptr is set, so this initialization
         * function has access to self._component (which gives it the
         * user Python component object from which the iterator was
         * created).
         */
-       py_init_method_result = PyObject_CallMethod(py_iter, "__init__", NULL);
+        py_component_port_output_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(self_component_port_output),
+               SWIGTYPE_p_bt_self_component_port_output, 0);
+       if (!py_component_port_output_ptr) {
+               BT_LOGE_STR("Failed to create a SWIG pointer object.");
+               goto error;
+       }
+
+       py_init_method_result = PyObject_CallMethod(py_iter, "_init_from_native", "O", py_component_port_output_ptr);
        if (!py_init_method_result) {
                BT_LOGE_STR("User's __init__() method failed.");
                bt2_py_loge_exception();
        if (!py_init_method_result) {
                BT_LOGE_STR("User's __init__() method failed.");
                bt2_py_loge_exception();
@@ -1441,6 +1451,7 @@ end:
        Py_XDECREF(py_comp_cls);
        Py_XDECREF(py_iter_cls);
        Py_XDECREF(py_iter_ptr);
        Py_XDECREF(py_comp_cls);
        Py_XDECREF(py_iter_cls);
        Py_XDECREF(py_iter_ptr);
+       Py_XDECREF(py_component_port_output_ptr);
        Py_XDECREF(py_init_method_result);
        Py_XDECREF(py_iter);
        return status;
        Py_XDECREF(py_init_method_result);
        Py_XDECREF(py_iter);
        return status;
This page took 0.023064 seconds and 4 git commands to generate.