X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=bindings%2Fpython%2Fbt2%2Fbt2%2F__init__.py.in;fp=bindings%2Fpython%2Fbt2%2Fbt2%2F__init__.py.in;h=dffc7f21f92d9ea831056df0027ea1fb289ee4c5;hb=0b03f63ebcb84ec3f7c215aec65ddf93674bf7fc;hp=487addebc12ffa0c5f78d3f5fb80bd1cb1f5f423;hpb=0f8db238f24eb6cb2c560dc12d39d2f468b67e7e;p=babeltrace.git diff --git a/bindings/python/bt2/bt2/__init__.py.in b/bindings/python/bt2/bt2/__init__.py.in index 487addeb..dffc7f21 100644 --- a/bindings/python/bt2/bt2/__init__.py.in +++ b/bindings/python/bt2/bt2/__init__.py.in @@ -151,14 +151,18 @@ class _ListenerHandle: self._obj = obj -import bt2.native_bt as _native_bt -import atexit - -atexit.register(_native_bt.py3_cc_exit_handler) -version = (_native_bt.version_get_major(), _native_bt.version_get_minor(), - _native_bt.version_get_patch(), _native_bt.version_get_extra()) -_native_bt.py3_cc_init_from_bt2() -del _native_bt +def _init_and_register_exit(): + import bt2.native_bt as _native_bt + import atexit + + atexit.register(_native_bt.py3_cc_exit_handler) + version = (_native_bt.version_get_major(), _native_bt.version_get_minor(), + _native_bt.version_get_patch(), _native_bt.version_get_extra()) + _native_bt.py3_cc_init_from_bt2() + + +_init_and_register_exit() + try: del native_bt