[pypy-commit] pypy py3.5: Need to remove frames from both importlib._bootstrap and

arigo pypy.commits at gmail.com
Tue Jan 3 13:43:25 EST 2017


Author: Armin Rigo <arigo at tunes.org>
Branch: py3.5
Changeset: r89346:05c795ec40f6
Date: 2017-01-03 19:42 +0100
http://bitbucket.org/pypy/pypy/changeset/05c795ec40f6/

Log:	Need to remove frames from both importlib._bootstrap and
	importlib._bootstrap_external

diff --git a/pypy/interpreter/error.py b/pypy/interpreter/error.py
--- a/pypy/interpreter/error.py
+++ b/pypy/interpreter/error.py
@@ -327,11 +327,11 @@
         """Set the current traceback."""
         self._application_traceback = traceback
 
-    def remove_traceback_module_frames(self, module_name):
+    def remove_traceback_module_frames(self, *module_names):
         from pypy.interpreter.pytraceback import PyTraceback
         tb = self._application_traceback
         while tb is not None and isinstance(tb, PyTraceback):
-            if tb.frame.pycode.co_filename != module_name:
+            if tb.frame.pycode.co_filename not in module_names:
                 break
             tb = tb.next
         self._application_traceback = tb
diff --git a/pypy/module/_frozen_importlib/interp_import.py b/pypy/module/_frozen_importlib/interp_import.py
--- a/pypy/module/_frozen_importlib/interp_import.py
+++ b/pypy/module/_frozen_importlib/interp_import.py
@@ -15,7 +15,9 @@
         return space.call_args(
             space.fromcache(FrozenCache).w_frozen_import, __args__)
     except OperationError as e:
-        e.remove_traceback_module_frames('<frozen importlib._bootstrap>')
+        e.remove_traceback_module_frames(
+              '<frozen importlib._bootstrap>',
+              '<frozen importlib._bootstrap_external>')
         raise
 import_with_frames_removed = interp2app(import_with_frames_removed,
                                         app_name='__import__')


More information about the pypy-commit mailing list