lib: rename INVALID_OBJECT status to UNKNOWN_OBJECT
[babeltrace.git] / src / bindings / python / bt2 / bt2 / native_bt_component_class.i
index ed939937e6cade034a4665ff1b2c0adb82f45460..90fc4abae8f1b5a18e9d51d58fda453c18cf889d 100644 (file)
@@ -97,9 +97,7 @@ static PyObject *py_mod_bt2_exc_error_type = NULL;
 static PyObject *py_mod_bt2_exc_memory_error = NULL;
 static PyObject *py_mod_bt2_exc_try_again_type = NULL;
 static PyObject *py_mod_bt2_exc_stop_type = NULL;
-static PyObject *py_mod_bt2_exc_msg_iter_canceled_type = NULL;
-static PyObject *py_mod_bt2_exc_invalid_object_type = NULL;
-static PyObject *py_mod_bt2_exc_invalid_params_type = NULL;
+static PyObject *py_mod_bt2_exc_unknown_object_type = NULL;
 
 static
 void bt_bt2_cc_init_from_bt2(void)
@@ -126,12 +124,9 @@ void bt_bt2_cc_init_from_bt2(void)
        py_mod_bt2_exc_stop_type =
                PyObject_GetAttrString(py_mod_bt2, "Stop");
        BT_ASSERT(py_mod_bt2_exc_stop_type);
-       py_mod_bt2_exc_invalid_object_type =
-               PyObject_GetAttrString(py_mod_bt2, "InvalidObject");
-       BT_ASSERT(py_mod_bt2_exc_invalid_object_type);
-       py_mod_bt2_exc_invalid_params_type =
-               PyObject_GetAttrString(py_mod_bt2, "InvalidParams");
-       BT_ASSERT(py_mod_bt2_exc_invalid_params_type);
+       py_mod_bt2_exc_unknown_object_type =
+               PyObject_GetAttrString(py_mod_bt2, "UnknownObject");
+       BT_ASSERT(py_mod_bt2_exc_unknown_object_type);
 }
 
 static
@@ -154,9 +149,7 @@ void bt_bt2_cc_exit_handler(void)
        Py_XDECREF(py_mod_bt2_exc_error_type);
        Py_XDECREF(py_mod_bt2_exc_try_again_type);
        Py_XDECREF(py_mod_bt2_exc_stop_type);
-       Py_XDECREF(py_mod_bt2_exc_msg_iter_canceled_type);
-       Py_XDECREF(py_mod_bt2_exc_invalid_object_type);
-       Py_XDECREF(py_mod_bt2_exc_invalid_params_type);
+       Py_XDECREF(py_mod_bt2_exc_unknown_object_type);
 }
 
 
@@ -395,11 +388,8 @@ int py_exc_to_status(bt_self_component_class *self_component_class,
                        py_mod_bt2_exc_stop_type)) {
                status = __BT_FUNC_STATUS_END;
        } else if (PyErr_GivenExceptionMatches(exc,
-                       py_mod_bt2_exc_invalid_object_type)) {
-               status = __BT_FUNC_STATUS_INVALID_OBJECT;
-       } else if (PyErr_GivenExceptionMatches(exc,
-                       py_mod_bt2_exc_invalid_params_type)) {
-               status = __BT_FUNC_STATUS_INVALID_PARAMS;
+                       py_mod_bt2_exc_unknown_object_type)) {
+               status = __BT_FUNC_STATUS_UNKNOWN_OBJECT;
        } else {
                /* Unknown exception: convert to general error */
                log_exception_and_maybe_append_error(BT_LOG_WARNING, true,
@@ -583,19 +573,19 @@ void component_class_finalize(bt_self_component *self_component)
        PyObject *py_comp = bt_self_component_get_data(self_component);
        BT_ASSERT(py_comp);
 
-       /* Call user's _finalize() method */
+       /* Call user's _user_finalize() method */
        PyObject *py_method_result = PyObject_CallMethod(py_comp,
-               "_finalize", NULL);
+               "_user_finalize", NULL);
 
        if (PyErr_Occurred()) {
-               BT_LOGW("User component's _finalize() method raised an exception: ignoring:");
+               BT_LOGW("User component's _user_finalize() method raised an exception: ignoring:");
                logw_exception();
        }
 
        /*
-        * Ignore any exception raised by the _finalize() method because
-        * it won't change anything at this point: the component is
-        * being destroyed anyway.
+        * Ignore any exception raised by the _user_finalize() method
+        * because it won't change anything at this point: the component
+        * is being destroyed anyway.
         */
        PyErr_Clear();
        Py_XDECREF(py_method_result);
@@ -991,15 +981,15 @@ component_class_message_iterator_init(
         *
         *     py_iter.__init__(self_output_port)
         *
-         * through the _init_for_native helper static method.
+        * 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).
         */
-        py_component_port_output_ptr = SWIG_NewPointerObj(
-               SWIG_as_voidptr(self_component_port_output),
+       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) {
                const char *err = "Failed to create a SWIG pointer object.";
@@ -1094,19 +1084,19 @@ void component_class_message_iterator_finalize(
 
        BT_ASSERT(py_message_iter);
 
-       /* Call user's _finalize() method */
+       /* Call user's _user_finalize() method */
        py_method_result = PyObject_CallMethod(py_message_iter,
-               "_finalize", NULL);
+               "_user_finalize", NULL);
 
        if (PyErr_Occurred()) {
-               BT_LOGW("User's _finalize() method raised an exception: ignoring:");
+               BT_LOGW("User's _user_finalize() method raised an exception: ignoring:");
                logw_exception();
        }
 
        /*
-        * Ignore any exception raised by the _finalize() method because
-        * it won't change anything at this point: the component is
-        * being destroyed anyway.
+        * Ignore any exception raised by the _user_finalize() method
+        * because it won't change anything at this point: the component
+        * is being destroyed anyway.
         */
        PyErr_Clear();
        Py_XDECREF(py_method_result);
@@ -1163,11 +1153,11 @@ component_class_sink_consume(bt_self_component_sink *self_component_sink)
 
        BT_ASSERT(py_comp);
        py_method_result = PyObject_CallMethod(py_comp,
-               "_consume", NULL);
+               "_user_consume", NULL);
        status = py_exc_to_status_component(self_component);
        if (!py_method_result && status == __BT_FUNC_STATUS_OK) {
                /* Pretty sure this should never happen, but just in case */
-               BT_LOGE("User's _consume() method failed without raising an exception: "
+               BT_LOGE("User's _user_consume() method failed without raising an exception: "
                        "status=%d", status);
                status = __BT_FUNC_STATUS_ERROR;
        }
This page took 0.026473 seconds and 4 git commands to generate.