bt2: remove unused imports
[babeltrace.git] / src / bindings / python / bt2 / bt2 / component.py
index a057019aa379c37cb7af3f471b2fe46cb070a146..d7e5f09e013139c88637f0d6b599c14d5bddd557 100644 (file)
@@ -27,11 +27,9 @@ from bt2 import value as bt2_value
 from bt2 import trace_class as bt2_trace_class
 from bt2 import clock_class as bt2_clock_class
 from bt2 import query_executor as bt2_query_executor
-import traceback
 from bt2 import port as bt2_port
 import sys
 import bt2
-import os
 
 
 # This class wraps a component class pointer. This component class could
@@ -508,7 +506,7 @@ class _UserComponentType(type):
 
         cls._bt_cc_ptr = cc_ptr
 
-    def _bt_init_from_native(cls, comp_ptr, params_ptr):
+    def _bt_init_from_native(cls, comp_ptr, params_ptr, obj):
         # create instance, not user-initialized yet
         self = cls.__new__(cls)
 
@@ -521,7 +519,7 @@ class _UserComponentType(type):
         else:
             params = None
 
-        self.__init__(params)
+        self.__init__(params, obj)
         return self
 
     def __call__(cls, *args, **kwargs):
@@ -573,7 +571,7 @@ class _UserComponentType(type):
     def addr(cls):
         return int(cls._bt_cc_ptr)
 
-    def _bt_query_from_native(cls, priv_query_exec_ptr, obj, params_ptr):
+    def _bt_query_from_native(cls, priv_query_exec_ptr, object, params_ptr, method_obj):
         # this can raise, in which case the native call to
         # bt_component_class_query() returns NULL
         if params_ptr is not None:
@@ -585,7 +583,7 @@ class _UserComponentType(type):
 
         try:
             # this can raise, but the native side checks the exception
-            results = cls._user_query(priv_query_exec, obj, params)
+            results = cls._user_query(priv_query_exec, object, params, method_obj)
         finally:
             # the private query executor is a private view on the query
             # executor; it's not a shared object (the library does not
@@ -607,7 +605,7 @@ class _UserComponentType(type):
         bt2_value._Value._get_ref(results_ptr)
         return int(results_ptr)
 
-    def _user_query(cls, priv_query_executor, obj, params):
+    def _user_query(cls, priv_query_executor, object, params, method_obj):
         raise bt2.UnknownObject
 
     def _bt_component_class_ptr(self):
@@ -617,6 +615,7 @@ class _UserComponentType(type):
         if hasattr(cls, '_bt_cc_ptr'):
             cc_ptr = cls._bt_as_component_class_ptr(cls._bt_cc_ptr)
             native_bt.component_class_put_ref(cc_ptr)
+            native_bt.bt2_unregister_cc_ptr_to_py_cls(cc_ptr)
 
 
 # Subclasses must provide these methods or property:
@@ -658,7 +657,7 @@ class _UserComponent(metaclass=_UserComponentType):
     def addr(self):
         return int(self._bt_ptr)
 
-    def __init__(self, params=None):
+    def __init__(self, params=None, obj=None):
         pass
 
     def _user_finalize(self):
@@ -871,7 +870,7 @@ class _UserSinkComponent(_UserComponent, _SinkComponent):
         )
 
         if msg_iter_ptr is None:
-            raise bt2.CreationError('cannot create message iterator object')
+            raise bt2._MemoryError('cannot create message iterator object')
 
         return bt2_message_iterator._UserComponentInputPortMessageIterator(msg_iter_ptr)
 
This page took 0.025211 seconds and 4 git commands to generate.