bt2: py_plugin.py: cache `_PluginInfo` objects
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 12 Aug 2019 19:46:05 +0000 (15:46 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 4 Sep 2019 15:58:21 +0000 (11:58 -0400)
commit0c5cab917ae981febcf854ead11942e3410fa123
tree0d9e78d30ba5d4ecb8de9d75704e08e1279d9d38
parenta044251358cc2c1e94f52d12e2fbe99b17b0768c
bt2: py_plugin.py: cache `_PluginInfo` objects

This patch makes _try_load_plugin_module() cache the `_PluginInfo`
objects it creates. The cache, `_plugin_infos`, maps a Python plugin
absolute path to a `_PluginInfo` object.

This avoids loading the Python module twice, which can create problems,
for example destroying component classes earlier than expected when the
new module replaces the old one in `sys.modules`.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I55397a1d5e65de1f6495dccc23e1134bd1127631
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1887
Tested-by: jenkins <jenkins@lttng.org>
src/bindings/python/bt2/bt2/py_plugin.py
This page took 0.025723 seconds and 4 git commands to generate.