mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Issue #14657: The frozen instance of importlib used for bootstrap is now also the module imported as importlib._bootstrap.
This commit is contained in:
parent
7636b19366
commit
48114b952b
3 changed files with 38 additions and 10 deletions
|
@ -1,19 +1,26 @@
|
|||
"""A pure Python implementation of import."""
|
||||
__all__ = ['__import__', 'import_module', 'invalidate_caches']
|
||||
|
||||
from . import _bootstrap
|
||||
|
||||
|
||||
# To simplify imports in test code
|
||||
_w_long = _bootstrap._w_long
|
||||
_r_long = _bootstrap._r_long
|
||||
|
||||
|
||||
# Bootstrap help #####################################################
|
||||
import imp
|
||||
import sys
|
||||
|
||||
_bootstrap._setup(sys, imp)
|
||||
try:
|
||||
_bootstrap = sys.modules['_frozen_importlib']
|
||||
except ImportError:
|
||||
from . import _bootstrap
|
||||
_bootstrap._setup(sys, imp)
|
||||
else:
|
||||
# importlib._bootstrap is the built-in import, ensure we don't create
|
||||
# a second copy of the module.
|
||||
_bootstrap.__name__ = 'importlib._bootstrap'
|
||||
_bootstrap.__package__ = 'importlib'
|
||||
_bootstrap.__file__ = __file__.replace('__init__.py', '_bootstrap.py')
|
||||
sys.modules['importlib._bootstrap'] = _bootstrap
|
||||
|
||||
# To simplify imports in test code
|
||||
_w_long = _bootstrap._w_long
|
||||
_r_long = _bootstrap._r_long
|
||||
|
||||
|
||||
# Public API #########################################################
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue