mirror of
https://github.com/python/cpython.git
synced 2025-09-18 22:50:26 +00:00
Issue #15110: Also hide importlib frames when importing a builtin module fails.
This commit is contained in:
parent
9ed37433c4
commit
ae7b8f07c1
2 changed files with 2748 additions and 2729 deletions
|
@ -490,12 +490,16 @@ class BuiltinImporter:
|
||||||
"""Load a built-in module."""
|
"""Load a built-in module."""
|
||||||
is_reload = fullname in sys.modules
|
is_reload = fullname in sys.modules
|
||||||
try:
|
try:
|
||||||
return _imp.init_builtin(fullname)
|
return cls._exec_module(fullname)
|
||||||
except:
|
except:
|
||||||
if not is_reload and fullname in sys.modules:
|
if not is_reload and fullname in sys.modules:
|
||||||
del sys.modules[fullname]
|
del sys.modules[fullname]
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def _exec_module(cls, fullname):
|
||||||
|
return _imp.init_builtin(fullname)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@_requires_builtin
|
@_requires_builtin
|
||||||
def get_code(cls, fullname):
|
def get_code(cls, fullname):
|
||||||
|
|
5471
Python/importlib.h
5471
Python/importlib.h
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue