Skip to content

Commit

Permalink
Add comments for deferred imports with links to rationale.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Mar 21, 2024
1 parent 5d01d0c commit 0dc96f1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions Lib/importlib/metadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ def metadata(self) -> _meta.PackageMetadata:
The returned object will have keys that name the various bits of
metadata. See PEP 566 for details.
"""
# deferred for performance (python/cpython#109829)
from . import _adapters

opt_text = (
Expand Down
2 changes: 2 additions & 0 deletions Lib/importlib/resources/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ def from_package(package: types.ModuleType):
Return a Traversable object for the given package.
"""
# deferred for performance (python/cpython#109829)
from ._adapters import wrap_spec

spec = wrap_spec(package)
reader = spec.loader.get_resource_reader(spec.name)
return reader.files()
Expand Down

0 comments on commit 0dc96f1

Please sign in to comment.