Issue #15110: Also hide importlib frames when importing a builtin module fails.

This commit is contained in:
Amaury Forgeot d'Arc 2012-07-08 20:52:38 +02:00
parent 9ed37433c4
commit ae7b8f07c1
2 changed files with 2748 additions and 2729 deletions

View File

@ -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):

File diff suppressed because it is too large Load Diff