bt2: py_plugin.py: cache `_PluginInfo` objects
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 12 Aug 2019 19:46:05 +0000 (15:46 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 12 Aug 2019 21:13:59 +0000 (17:13 -0400)
commit9105c4677c8d51bf8b4a19b9d4f428cf17ca5292
tree6265d780f67599fd7a1ddd6a92a5afa8c8c2ed29
parent57081273d1191fc79edc101af619fab96b72460d
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.025742 seconds and 4 git commands to generate.