Issue #15110: Also hide importlib frames when importing a builtin module fails.
This commit is contained in:
parent
9ed37433c4
commit
ae7b8f07c1
|
@ -490,12 +490,16 @@ class BuiltinImporter:
|
|||
"""Load a built-in module."""
|
||||
is_reload = fullname in sys.modules
|
||||
try:
|
||||
return _imp.init_builtin(fullname)
|
||||
return cls._exec_module(fullname)
|
||||
except:
|
||||
if not is_reload and fullname in sys.modules:
|
||||
del sys.modules[fullname]
|
||||
raise
|
||||
|
||||
@classmethod
|
||||
def _exec_module(cls, fullname):
|
||||
return _imp.init_builtin(fullname)
|
||||
|
||||
@classmethod
|
||||
@_requires_builtin
|
||||
def get_code(cls, fullname):
|
||||
|
|
5471
Python/importlib.h
5471
Python/importlib.h
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue