Skip to content

Commit e781014

Browse files
authored
Merge pull request #7 from LazyImportsCabal/package-attributes
Clarify how package attributes are handled.
2 parents 2158ec8 + 78bb34e commit e781014

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

peps/pep-0810.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,12 @@ as it would have been if it had been imported eagerly, barring intervening
337337
changes to the import system (e.g. to ``sys.path``, ``sys.meta_path``,
338338
``sys.path_hooks`` or ``__import__``).
339339

340-
Reification still calls ``__import__`` to resolve the import. Once the module is
341-
reified, it's removed from ``sys.lazy_modules``.
340+
Reification still calls ``__import__`` to resolve the import. Once the
341+
module is reified, it's removed from ``sys.lazy_modules``. When a package is
342+
reified and submodules in the package were also previously lazily imported,
343+
those submodules are *not* automatically reified but they *are* added to the
344+
reified package's globals (unless the package already assigned something
345+
else to the name of the submodule).
342346

343347
If reification fails (e.g., due to an ``ImportError``), the exception is enhanced
344348
with chaining to show both where the lazy import was defined and where it was first

0 commit comments

Comments
 (0)