2 * python-plugin-provider.c
4 * Babeltrace Python plugin provider
6 * Copyright 2017 Philippe Proulx <pproulx@efficios.com>
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 #define BT_LOG_TAG "LIB/PLUGIN-PY"
29 #include "lib/logging.h"
30 #include "common/macros.h"
31 #include "compat/compiler.h"
32 #include <babeltrace2/plugin/plugin-const.h>
33 #include "lib/plugin/plugin.h"
34 #include <babeltrace2/graph/component-class.h>
35 #include <babeltrace2/current-thread.h>
36 #include "lib/graph/component-class.h"
37 #include "py-common/py-common.h"
44 #define PYTHON_PLUGIN_FILE_PREFIX "bt_plugin_"
45 #define PYTHON_PLUGIN_FILE_PREFIX_LEN (sizeof(PYTHON_PLUGIN_FILE_PREFIX) - 1)
46 #define PYTHON_PLUGIN_FILE_EXT ".py"
47 #define PYTHON_PLUGIN_FILE_EXT_LEN (sizeof(PYTHON_PLUGIN_FILE_EXT) - 1)
50 /* init_python() not called yet */
51 PYTHON_STATE_NOT_INITED
,
53 /* init_python() called once with success */
54 PYTHON_STATE_FULLY_INITIALIZED
,
56 /* init_python() called once without success */
57 PYTHON_STATE_CANNOT_INITIALIZE
,
60 * init_python() called, but environment variable asks the
61 * Python interpreter not to be loaded.
63 PYTHON_STATE_WONT_INITIALIZE
,
64 } python_state
= PYTHON_STATE_NOT_INITED
;
66 static PyObject
*py_try_load_plugin_module_func
= NULL
;
67 static bool python_was_initialized_by_us
;
70 void append_python_traceback_error_cause(void)
74 if (Py_IsInitialized() && PyErr_Occurred()) {
75 exc
= bt_py_common_format_exception(BT_LOG_OUTPUT_LEVEL
);
77 BT_LOGE_STR("Failed to format Python exception.");
81 (void) BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_UNKNOWN(
82 "Babeltrace library", "%s", exc
->str
);
87 g_string_free(exc
, TRUE
);
92 void log_python_traceback(int log_level
)
96 if (Py_IsInitialized() && PyErr_Occurred()) {
97 exc
= bt_py_common_format_exception(BT_LOG_OUTPUT_LEVEL
);
99 BT_LOGE_STR("Failed to format Python exception.");
103 BT_LOG_WRITE(log_level
, BT_LOG_TAG
,
104 "Exception occured: Python traceback:\n%s", exc
->str
);
109 g_string_free(exc
, TRUE
);
114 void pyerr_clear(void)
116 if (Py_IsInitialized()) {
122 int init_python(void)
124 int ret
= BT_FUNC_STATUS_OK
;
125 PyObject
*py_bt2_py_plugin_mod
= NULL
;
126 const char *dis_python_env
;
128 sig_t old_sigint
= signal(SIGINT
, SIG_DFL
);
131 switch (python_state
) {
132 case PYTHON_STATE_NOT_INITED
:
134 case PYTHON_STATE_FULLY_INITIALIZED
:
136 case PYTHON_STATE_WONT_INITIALIZE
:
137 ret
= BT_FUNC_STATUS_NOT_FOUND
;
139 case PYTHON_STATE_CANNOT_INITIALIZE
:
140 ret
= BT_FUNC_STATUS_ERROR
;
147 * User can disable Python plugin support with the
148 * BABELTRACE_DISABLE_PYTHON_PLUGINS environment variable set to
151 dis_python_env
= getenv("BABELTRACE_DISABLE_PYTHON_PLUGINS");
152 if (dis_python_env
&& strcmp(dis_python_env
, "1") == 0) {
153 BT_LOGI_STR("Python plugin support is disabled because `BABELTRACE_DISABLE_PYTHON_PLUGINS=1`.");
154 python_state
= PYTHON_STATE_WONT_INITIALIZE
;
155 ret
= BT_FUNC_STATUS_NOT_FOUND
;
159 if (!Py_IsInitialized()) {
160 BT_LOGI_STR("Python interpreter is not initialized: initializing Python interpreter.");
162 python_was_initialized_by_us
= true;
163 BT_LOGI("Initialized Python interpreter: version=\"%s\"",
166 BT_LOGI("Python interpreter is already initialized: version=\"%s\"",
170 py_bt2_py_plugin_mod
= PyImport_ImportModule("bt2.py_plugin");
171 if (!py_bt2_py_plugin_mod
) {
172 append_python_traceback_error_cause();
173 BT_LIB_LOGW_APPEND_CAUSE(
174 "Cannot import `bt2.py_plugin` Python module: "
175 "Python plugin support is disabled.");
176 python_state
= PYTHON_STATE_CANNOT_INITIALIZE
;
177 ret
= BT_FUNC_STATUS_ERROR
;
181 py_try_load_plugin_module_func
=
182 PyObject_GetAttrString(py_bt2_py_plugin_mod
, "_try_load_plugin_module");
183 if (!py_try_load_plugin_module_func
) {
184 append_python_traceback_error_cause();
185 BT_LIB_LOGW_APPEND_CAUSE(
186 "Cannot get `_try_load_plugin_module` attribute from `bt2.py_plugin` Python module: "
187 "Python plugin support is disabled.");
188 python_state
= PYTHON_STATE_CANNOT_INITIALIZE
;
189 ret
= BT_FUNC_STATUS_ERROR
;
193 python_state
= PYTHON_STATE_FULLY_INITIALIZED
;
197 if (old_sigint
!= SIG_ERR
) {
198 (void) signal(SIGINT
, old_sigint
);
202 log_python_traceback(ret
== BT_FUNC_STATUS_ERROR
?
203 BT_LOG_WARN
: BT_LOG_INFO
);
205 Py_XDECREF(py_bt2_py_plugin_mod
);
209 __attribute__((destructor
)) static
210 void fini_python(void) {
211 if (Py_IsInitialized() && python_was_initialized_by_us
) {
212 if (py_try_load_plugin_module_func
) {
213 Py_DECREF(py_try_load_plugin_module_func
);
214 py_try_load_plugin_module_func
= NULL
;
218 BT_LOGI_STR("Finalized Python interpreter.");
221 python_state
= PYTHON_STATE_NOT_INITED
;
225 int bt_plugin_from_python_plugin_info(PyObject
*plugin_info
,
226 bool fail_on_load_error
, bt_plugin
**plugin_out
)
228 int status
= BT_FUNC_STATUS_OK
;
229 PyObject
*py_name
= NULL
;
230 PyObject
*py_author
= NULL
;
231 PyObject
*py_description
= NULL
;
232 PyObject
*py_license
= NULL
;
233 PyObject
*py_version
= NULL
;
234 PyObject
*py_comp_class_addrs
= NULL
;
235 const char *name
= NULL
;
236 const char *author
= NULL
;
237 const char *description
= NULL
;
238 const char *license
= NULL
;
239 unsigned int major
= 0, minor
= 0, patch
= 0;
240 const char *version_extra
= NULL
;
242 BT_ASSERT(plugin_out
);
244 BT_ASSERT(plugin_info
);
245 BT_ASSERT(python_state
== PYTHON_STATE_FULLY_INITIALIZED
);
246 py_name
= PyObject_GetAttrString(plugin_info
, "name");
248 if (fail_on_load_error
) {
249 append_python_traceback_error_cause();
250 BT_LIB_LOGW_APPEND_CAUSE(
251 "Cannot find `name` attribute in Python plugin info object: "
252 "py-plugin-info-addr=%p", plugin_info
);
253 status
= BT_FUNC_STATUS_LOADING_ERROR
;
256 "Cannot find `name` attribute in Python plugin info object: "
257 "py-plugin-info-addr=%p", plugin_info
);
258 status
= BT_FUNC_STATUS_NOT_FOUND
;
264 py_author
= PyObject_GetAttrString(plugin_info
, "author");
266 if (fail_on_load_error
) {
267 append_python_traceback_error_cause();
268 BT_LIB_LOGW_APPEND_CAUSE(
269 "Cannot find `author` attribute in Python plugin info object: "
270 "py-plugin-info-addr=%p", plugin_info
);
271 status
= BT_FUNC_STATUS_LOADING_ERROR
;
274 "Cannot find `author` attribute in Python plugin info object: "
275 "py-plugin-info-addr=%p", plugin_info
);
276 status
= BT_FUNC_STATUS_NOT_FOUND
;
282 py_description
= PyObject_GetAttrString(plugin_info
, "description");
283 if (!py_description
) {
284 if (fail_on_load_error
) {
285 append_python_traceback_error_cause();
286 BT_LIB_LOGW_APPEND_CAUSE(
287 "Cannot find `description` attribute in Python plugin info object: "
288 "py-plugin-info-addr=%p", plugin_info
);
289 status
= BT_FUNC_STATUS_LOADING_ERROR
;
292 "Cannot find `description` attribute in Python plugin info object: "
293 "py-plugin-info-addr=%p", plugin_info
);
294 status
= BT_FUNC_STATUS_NOT_FOUND
;
300 py_license
= PyObject_GetAttrString(plugin_info
, "license");
302 if (fail_on_load_error
) {
303 append_python_traceback_error_cause();
304 BT_LIB_LOGW_APPEND_CAUSE(
305 "Cannot find `license` attribute in Python plugin info object: "
306 "py-plugin-info-addr=%p", plugin_info
);
307 status
= BT_FUNC_STATUS_LOADING_ERROR
;
310 "Cannot find `license` attribute in Python plugin info object: "
311 "py-plugin-info-addr=%p", plugin_info
);
312 status
= BT_FUNC_STATUS_NOT_FOUND
;
318 py_version
= PyObject_GetAttrString(plugin_info
, "version");
320 if (fail_on_load_error
) {
321 append_python_traceback_error_cause();
322 BT_LIB_LOGW_APPEND_CAUSE(
323 "Cannot find `version` attribute in Python plugin info object: "
324 "py-plugin-info-addr=%p", plugin_info
);
325 status
= BT_FUNC_STATUS_LOADING_ERROR
;
328 "Cannot find `version` attribute in Python plugin info object: "
329 "py-plugin-info-addr=%p", plugin_info
);
330 status
= BT_FUNC_STATUS_NOT_FOUND
;
336 py_comp_class_addrs
= PyObject_GetAttrString(plugin_info
,
338 if (!py_comp_class_addrs
) {
339 if (fail_on_load_error
) {
340 append_python_traceback_error_cause();
341 BT_LIB_LOGW_APPEND_CAUSE(
342 "Cannot find `comp_class_addrs` attribute in Python plugin info object: "
343 "py-plugin-info-addr=%p", plugin_info
);
344 status
= BT_FUNC_STATUS_LOADING_ERROR
;
347 "Cannot find `comp_class_addrs` attribute in Python plugin info object: "
348 "py-plugin-info-addr=%p", plugin_info
);
349 status
= BT_FUNC_STATUS_NOT_FOUND
;
355 if (PyUnicode_Check(py_name
)) {
356 name
= PyUnicode_AsUTF8(py_name
);
358 if (fail_on_load_error
) {
359 append_python_traceback_error_cause();
360 BT_LIB_LOGW_APPEND_CAUSE(
361 "Cannot decode Python plugin name string: "
362 "py-plugin-info-addr=%p", plugin_info
);
363 status
= BT_FUNC_STATUS_LOADING_ERROR
;
366 "Cannot decode Python plugin name string: "
367 "py-plugin-info-addr=%p", plugin_info
);
368 status
= BT_FUNC_STATUS_NOT_FOUND
;
374 /* Plugin name is mandatory */
375 if (fail_on_load_error
) {
376 append_python_traceback_error_cause();
377 BT_LIB_LOGW_APPEND_CAUSE(
378 "Plugin name is not a string: "
379 "py-plugin-info-addr=%p", plugin_info
);
380 status
= BT_FUNC_STATUS_LOADING_ERROR
;
383 "Plugin name is not a string: "
384 "py-plugin-info-addr=%p", plugin_info
);
385 status
= BT_FUNC_STATUS_NOT_FOUND
;
391 if (PyUnicode_Check(py_author
)) {
392 author
= PyUnicode_AsUTF8(py_author
);
394 if (fail_on_load_error
) {
395 append_python_traceback_error_cause();
396 BT_LIB_LOGW_APPEND_CAUSE(
397 "Cannot decode Python plugin author string: "
398 "py-plugin-info-addr=%p", plugin_info
);
399 status
= BT_FUNC_STATUS_LOADING_ERROR
;
402 "Cannot decode Python plugin author string: "
403 "py-plugin-info-addr=%p", plugin_info
);
404 status
= BT_FUNC_STATUS_NOT_FOUND
;
411 if (PyUnicode_Check(py_description
)) {
412 description
= PyUnicode_AsUTF8(py_description
);
414 if (fail_on_load_error
) {
415 append_python_traceback_error_cause();
416 BT_LIB_LOGW_APPEND_CAUSE(
417 "Cannot decode Python plugin description string: "
418 "py-plugin-info-addr=%p", plugin_info
);
419 status
= BT_FUNC_STATUS_LOADING_ERROR
;
422 "Cannot decode Python plugin description string: "
423 "py-plugin-info-addr=%p", plugin_info
);
424 status
= BT_FUNC_STATUS_NOT_FOUND
;
431 if (PyUnicode_Check(py_license
)) {
432 license
= PyUnicode_AsUTF8(py_license
);
434 if (fail_on_load_error
) {
435 append_python_traceback_error_cause();
436 BT_LIB_LOGW_APPEND_CAUSE(
437 "Cannot decode Python plugin license string: "
438 "py-plugin-info-addr=%p", plugin_info
);
439 status
= BT_FUNC_STATUS_LOADING_ERROR
;
442 "Cannot decode Python plugin license string: "
443 "py-plugin-info-addr=%p", plugin_info
);
444 status
= BT_FUNC_STATUS_NOT_FOUND
;
451 if (PyTuple_Check(py_version
)) {
452 if (PyTuple_Size(py_version
) >= 3) {
453 PyObject
*py_major
= PyTuple_GetItem(py_version
, 0);
454 PyObject
*py_minor
= PyTuple_GetItem(py_version
, 1);
455 PyObject
*py_patch
= PyTuple_GetItem(py_version
, 2);
461 if (PyLong_Check(py_major
)) {
462 major
= PyLong_AsUnsignedLong(py_major
);
465 if (PyLong_Check(py_minor
)) {
466 minor
= PyLong_AsUnsignedLong(py_minor
);
469 if (PyLong_Check(py_patch
)) {
470 patch
= PyLong_AsUnsignedLong(py_patch
);
473 if (PyErr_Occurred()) {
474 /* Overflow error, most probably */
475 if (fail_on_load_error
) {
476 append_python_traceback_error_cause();
477 BT_LIB_LOGW_APPEND_CAUSE(
478 "Invalid Python plugin version format: "
479 "py-plugin-info-addr=%p", plugin_info
);
480 status
= BT_FUNC_STATUS_LOADING_ERROR
;
483 "Invalid Python plugin version format: "
484 "py-plugin-info-addr=%p", plugin_info
);
485 status
= BT_FUNC_STATUS_NOT_FOUND
;
492 if (PyTuple_Size(py_version
) >= 4) {
493 PyObject
*py_extra
= PyTuple_GetItem(py_version
, 3);
497 if (PyUnicode_Check(py_extra
)) {
498 version_extra
= PyUnicode_AsUTF8(py_extra
);
499 if (!version_extra
) {
500 if (fail_on_load_error
) {
501 append_python_traceback_error_cause();
502 BT_LIB_LOGW_APPEND_CAUSE(
503 "Cannot decode Python plugin version's extra string: "
504 "py-plugin-info-addr=%p", plugin_info
);
505 status
= BT_FUNC_STATUS_LOADING_ERROR
;
508 "Cannot decode Python plugin version's extra string: "
509 "py-plugin-info-addr=%p", plugin_info
);
510 status
= BT_FUNC_STATUS_NOT_FOUND
;
519 *plugin_out
= bt_plugin_create_empty(BT_PLUGIN_TYPE_PYTHON
);
521 BT_LIB_LOGE_APPEND_CAUSE("Cannot create empty plugin object.");
522 status
= BT_FUNC_STATUS_MEMORY_ERROR
;
526 bt_plugin_set_name(*plugin_out
, name
);
529 bt_plugin_set_description(*plugin_out
, description
);
533 bt_plugin_set_author(*plugin_out
, author
);
537 bt_plugin_set_license(*plugin_out
, license
);
540 bt_plugin_set_version(*plugin_out
, major
, minor
, patch
, version_extra
);
542 if (PyList_Check(py_comp_class_addrs
)) {
545 for (i
= 0; i
< PyList_Size(py_comp_class_addrs
); i
++) {
546 bt_component_class
*comp_class
;
547 PyObject
*py_comp_class_addr
;
550 PyList_GetItem(py_comp_class_addrs
, i
);
551 BT_ASSERT(py_comp_class_addr
);
552 if (PyLong_Check(py_comp_class_addr
)) {
553 comp_class
= PyLong_AsVoidPtr(py_comp_class_addr
);
555 if (fail_on_load_error
) {
556 append_python_traceback_error_cause();
557 BT_LIB_LOGW_APPEND_CAUSE(
558 "Component class address is not an integer in Python plugin info object: "
559 "py-plugin-info-addr=%p, index=%zu",
561 status
= BT_FUNC_STATUS_LOADING_ERROR
;
564 "Component class address is not an integer in Python plugin info object: "
565 "py-plugin-info-addr=%p, index=%zu",
567 status
= BT_FUNC_STATUS_NOT_FOUND
;
573 status
= bt_plugin_add_component_class(*plugin_out
,
576 BT_LIB_LOGE_APPEND_CAUSE(
577 "Cannot add component class to plugin: "
578 "py-plugin-info-addr=%p, "
579 "plugin-addr=%p, plugin-name=\"%s\", "
580 "comp-class-addr=%p, "
581 "comp-class-name=\"%s\", "
582 "comp-class-type=%s",
583 plugin_info
, *plugin_out
,
584 bt_plugin_get_name(*plugin_out
),
586 bt_component_class_get_name(comp_class
),
587 bt_component_class_type_string(
588 bt_component_class_get_type(comp_class
)));
597 BT_ASSERT(status
!= BT_FUNC_STATUS_OK
);
598 log_python_traceback(fail_on_load_error
? BT_LOG_WARN
: BT_LOG_INFO
);
600 BT_OBJECT_PUT_REF_AND_RESET(*plugin_out
);
604 Py_XDECREF(py_author
);
605 Py_XDECREF(py_description
);
606 Py_XDECREF(py_license
);
607 Py_XDECREF(py_version
);
608 Py_XDECREF(py_comp_class_addrs
);
613 int bt_plugin_python_create_all_from_file(const char *path
,
614 bool fail_on_load_error
, struct bt_plugin_set
**plugin_set_out
)
616 bt_plugin
*plugin
= NULL
;
617 PyObject
*py_plugin_info
= NULL
;
618 gchar
*basename
= NULL
;
620 int status
= BT_FUNC_STATUS_OK
;
624 if (python_state
== PYTHON_STATE_CANNOT_INITIALIZE
) {
626 * We do not even care about the rest of the function
627 * here because we already know Python cannot be fully
630 BT_LIB_LOGE_APPEND_CAUSE(
631 "Python interpreter could not be initialized previously.");
632 status
= BT_FUNC_STATUS_ERROR
;
634 } else if (python_state
== PYTHON_STATE_WONT_INITIALIZE
) {
636 * This is not an error: the environment requires that
637 * Python plugins are disabled, so it's simply not
640 BT_LOGI_STR("Python plugin support was disabled previously because `BABELTRACE_DISABLE_PYTHON_PLUGINS=1`.");
641 status
= BT_FUNC_STATUS_NOT_FOUND
;
645 BT_LOGI("Trying to create all Python plugins from file: path=\"%s\"",
647 path_len
= strlen(path
);
649 /* File name ends with `.py` */
650 if (strncmp(path
+ path_len
- PYTHON_PLUGIN_FILE_EXT_LEN
,
651 PYTHON_PLUGIN_FILE_EXT
,
652 PYTHON_PLUGIN_FILE_EXT_LEN
) != 0) {
653 BT_LOGI("Skipping non-Python file: path=\"%s\"", path
);
654 status
= BT_FUNC_STATUS_NOT_FOUND
;
658 /* File name starts with `bt_plugin_` */
659 basename
= g_path_get_basename(path
);
661 BT_LIB_LOGE_APPEND_CAUSE(
662 "Cannot get path's basename: path=\"%s\"", path
);
663 status
= BT_FUNC_STATUS_ERROR
;
667 if (strncmp(basename
, PYTHON_PLUGIN_FILE_PREFIX
,
668 PYTHON_PLUGIN_FILE_PREFIX_LEN
) != 0) {
669 BT_LOGI("Skipping Python file not starting with `%s`: "
670 "path=\"%s\"", PYTHON_PLUGIN_FILE_PREFIX
, path
);
671 status
= BT_FUNC_STATUS_NOT_FOUND
;
676 * Initialize Python now.
678 * This is not done in the library contructor because the
679 * interpreter is somewhat slow to initialize. If you don't
680 * have any potential Python plugins, you don't need to endure
681 * this waiting time everytime you load the library.
683 status
= init_python();
684 if (status
!= BT_FUNC_STATUS_OK
) {
685 /* init_python() logs and append errors */
690 * Call bt2.py_plugin._try_load_plugin_module() with this path
691 * to get plugin info if the plugin is loadable and complete.
692 * This function returns None when there's an error, but just in
693 * case we also manually clear the last Python error state.
695 BT_LOGD_STR("Getting Python plugin info object from Python module.");
696 py_plugin_info
= PyObject_CallFunction(py_try_load_plugin_module_func
,
698 if (!py_plugin_info
|| py_plugin_info
== Py_None
) {
699 if (fail_on_load_error
) {
700 append_python_traceback_error_cause();
701 BT_LIB_LOGW_APPEND_CAUSE(
702 "Cannot load Python plugin: path=\"%s\"", path
);
703 status
= BT_FUNC_STATUS_LOADING_ERROR
;
706 "Cannot load Python plugin: path=\"%s\"", path
);
707 status
= BT_FUNC_STATUS_NOT_FOUND
;
714 * Get bt_plugin from plugin info object.
717 status
= bt_plugin_from_python_plugin_info(py_plugin_info
,
718 fail_on_load_error
, &plugin
);
721 * bt_plugin_from_python_plugin_info() handles
722 * `fail_on_load_error`, so this is a "real" error.
724 BT_LIB_LOGW_APPEND_CAUSE(
725 "Cannot create plugin object from Python plugin info object: "
726 "path=\"%s\", py-plugin-info-addr=%p",
727 path
, py_plugin_info
);
730 } else if (status
== BT_FUNC_STATUS_NOT_FOUND
) {
735 BT_ASSERT(status
== BT_FUNC_STATUS_OK
);
737 bt_plugin_set_path(plugin
, path
);
738 *plugin_set_out
= bt_plugin_set_create();
739 if (!*plugin_set_out
) {
740 BT_LIB_LOGE_APPEND_CAUSE("Cannot create empty plugin set.");
741 status
= BT_FUNC_STATUS_MEMORY_ERROR
;
745 bt_plugin_set_add_plugin(*plugin_set_out
, plugin
);
746 BT_LOGD("Created all Python plugins from file: path=\"%s\", "
747 "plugin-addr=%p, plugin-name=\"%s\"",
748 path
, plugin
, bt_plugin_get_name(plugin
));
752 BT_ASSERT(status
!= BT_FUNC_STATUS_OK
);
753 log_python_traceback(fail_on_load_error
? BT_LOG_WARN
: BT_LOG_INFO
);
755 BT_OBJECT_PUT_REF_AND_RESET(*plugin_set_out
);
758 bt_plugin_put_ref(plugin
);
759 Py_XDECREF(py_plugin_info
);