bpo-42403: Simplify importlib external bootstrap (GH-23397)

Simplify the importlib external bootstrap code:
importlib._bootstrap_external now uses regular imports to import
builtin modules. When it is imported, the builtin __import__()
function is already fully working and so can be used to import
builtin modules like sys.
This commit is contained in:
Victor Stinner 2020-11-19 13:43:43 +01:00 committed by GitHub
parent 7d9d25dbed
commit 3390347aa0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 4516 additions and 4559 deletions

View file

@ -22,8 +22,15 @@ work. One should use importlib as the public-facing version of this module.
# Bootstrap-related code ######################################################
# Modules injected manually by _setup()
_thread = None
_warnings = None
_weakref = None
# Import done by _install_external_importers()
_bootstrap_external = None
def _wrap(new, old):
"""Simple substitute for functools.update_wrapper."""
for replace in ['__module__', '__name__', '__qualname__', '__doc__']: