diff --git a/Lib/importlib/machinery.py b/Lib/importlib/machinery.py index 023f77d750fd2bc..b22e538862299ff 100644 --- a/Lib/importlib/machinery.py +++ b/Lib/importlib/machinery.py @@ -1,5 +1,9 @@ """The machinery of importlib: finders, loaders, hooks, etc.""" +lazy import warnings + + +# Public API from ._bootstrap import ModuleSpec from ._bootstrap import BuiltinImporter from ._bootstrap import FrozenImporter @@ -33,8 +37,6 @@ def all_suffixes(): def __getattr__(name): - import warnings - if name == 'DEBUG_BYTECODE_SUFFIXES': warnings.warn('importlib.machinery.DEBUG_BYTECODE_SUFFIXES is ' 'deprecated; use importlib.machinery.BYTECODE_SUFFIXES ' diff --git a/Lib/importlib/util.py b/Lib/importlib/util.py index 2b564e9b52e0cb2..52861e378c65e0e 100644 --- a/Lib/importlib/util.py +++ b/Lib/importlib/util.py @@ -1,19 +1,24 @@ """Utility code for constructing importers, etc.""" + +from ._bootstrap import _resolve_name +from ._bootstrap import _find_spec + +import sys +import types + +lazy import _imp + + +# Public API from ._abc import Loader from ._bootstrap import module_from_spec -from ._bootstrap import _resolve_name from ._bootstrap import spec_from_loader -from ._bootstrap import _find_spec from ._bootstrap_external import MAGIC_NUMBER from ._bootstrap_external import cache_from_source from ._bootstrap_external import decode_source from ._bootstrap_external import source_from_cache from ._bootstrap_external import spec_from_file_location -import _imp -import sys -import types - def source_hash(source_bytes): "Return the hash of *source_bytes* as used in hash-based pyc files."