You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Only the first lazy submodule will appear in a package shared by two lazy submodules.
la = lazy_import.lazy_module('package.a')
lb = lazy_import.lazy_module('package.b')
import package
'a' in type(package)._lazy_import_submodules
'b' not in type(package)._lazy_import_submodules
This is because when a cached lazy package is found (https://github.com/mnmelo/lazy_import/blob/master/lazy_import/__init__.py#L378), we don't update the reference of _LazyModule to the cached module and hence the module from the last iteration of the loop has it's _lazy_import_submodules attribute updated. Thus resulting in the following:
'b' in type(lb)._lazy_import_submodules
After a package is loaded, references to lazy modules are lost, resulting in:
la = lazy_import.lazy_module('package.a')
import package
package.a == la
from package import a !!!! fails !!!!
The issue is that prior to reloading the module, we clean all lazy sub-module attributes and LazyModule class attributes. We then try to restore those attributes, but we rely on a class attribute which has been removed. Thus no sub-modules are found and the lazy state isn't restored.
The text was updated successfully, but these errors were encountered:
Two issues I am seeing in Python 2.7:
This is because when a cached lazy package is found (https://github.com/mnmelo/lazy_import/blob/master/lazy_import/__init__.py#L378), we don't update the reference of _LazyModule to the cached module and hence the module from the last iteration of the loop has it's
_lazy_import_submodules
attribute updated. Thus resulting in the following:This problem is rooted here: https://github.com/mnmelo/lazy_import/blob/master/lazy_import/__init__.py#L689
The issue is that prior to reloading the module, we clean all lazy sub-module attributes and LazyModule class attributes. We then try to restore those attributes, but we rely on a class attribute which has been removed. Thus no sub-modules are found and the lazy state isn't restored.
The text was updated successfully, but these errors were encountered: