mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
Fix tracking of imported modules
__import__(name, ..., fromlist, ...) always returns the top-level package if `import x.y.z` is used (here `x`), and the module given by `name` if `from x.y.z import a` is used, here `x.y.z`. Differentiating between these two cases can be done by looking at the `fromlist` argument. By not tracking modules correctly, plugin unloading/reloading was broken if a module hierarchy within a plugin was used and `from` was not exclusively used.
This commit is contained in:
parent
bc1bfd3406
commit
19592dc8d7
@ -664,7 +664,7 @@ def _import(name, globals={}, locals={}, fromlist=[], level=None):
|
||||
mod = _builtin_import(name, globals, locals, fromlist, level)
|
||||
|
||||
if mod and '__file__' in mod.__dict__:
|
||||
module_name = mod.__name__
|
||||
module_name = mod.__name__ if fromlist else name
|
||||
package_name = module_name.split('.')[0]
|
||||
# check whether the module belongs to one of our plugins
|
||||
if package_name in available_plugins:
|
||||
|
Loading…
x
Reference in New Issue
Block a user