mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
Publish lazy imported packages on parent
This commit is contained in:
parent
781eedb9d4
commit
9be59ecebd
8 changed files with 248 additions and 1 deletions
|
|
@ -1359,6 +1359,12 @@ def _find_and_load_unlocked(name, import_):
|
|||
except AttributeError:
|
||||
msg = f"Cannot set an attribute on {parent!r} for child module {child!r}"
|
||||
_warnings.warn(msg, ImportWarning)
|
||||
# Set attributes to lazy submodules on the module.
|
||||
try:
|
||||
_imp._set_lazy_attributes(module, name)
|
||||
except Exception as e:
|
||||
msg = f"Cannot set lazy attributes on {name!r}: {e!r}"
|
||||
_warnings.warn(msg, ImportWarning)
|
||||
return module
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue