[Python-checkins] cpython: Issue #15110: Also hide importlib frames when importing a builtin module fails.

amaury.forgeotdarc python-checkins at python.org
Sun Jul 8 20:59:31 CEST 2012


http://hg.python.org/cpython/rev/37e68da59047
changeset:   78009:37e68da59047
user:        Amaury Forgeot d'Arc <amauryfa at gmail.com>
date:        Sun Jul 08 20:52:38 2012 +0200
summary:
  Issue #15110: Also hide importlib frames when importing a builtin module fails.

files:
  Lib/importlib/_bootstrap.py |     6 +-
  Python/importlib.h          |  5485 +++++++++++-----------
  2 files changed, 2755 insertions(+), 2736 deletions(-)


diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -490,13 +490,17 @@
         """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."""
diff --git a/Python/importlib.h b/Python/importlib.h
--- a/Python/importlib.h
+++ b/Python/importlib.h
[stripped]

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list