diff options
author | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2012-07-08 18:52:38 (GMT) |
---|---|---|
committer | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2012-07-08 18:52:38 (GMT) |
commit | ae7b8f07c15c32f7779cdd4aacc777e7dd447601 (patch) | |
tree | 3f69c6b09db14d3245d2ecd25376c78a92b6b0f1 /Lib | |
parent | 9ed37433c4db71076f554eb7c9343b6381ba32e1 (diff) | |
download | cpython-ae7b8f07c15c32f7779cdd4aacc777e7dd447601.zip cpython-ae7b8f07c15c32f7779cdd4aacc777e7dd447601.tar.gz cpython-ae7b8f07c15c32f7779cdd4aacc777e7dd447601.tar.bz2 |
Issue #15110: Also hide importlib frames when importing a builtin module fails.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/importlib/_bootstrap.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index 0666168..112db4e 100644 --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -490,13 +490,17 @@ 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): """Return None as built-in modules do not have code objects.""" |