[pypy-commit] pypy framestate: extract method ctx.has_exc_handler()

rlamy noreply at buildbot.pypy.org
Fri Dec 5 17:45:05 CET 2014


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: framestate
Changeset: r74837:1488ee7e209b
Date: 2014-12-05 15:23 +0000
http://bitbucket.org/pypy/pypy/changeset/1488ee7e209b/

Log:	extract method ctx.has_exc_handler()

diff --git a/rpython/flowspace/flowcontext.py b/rpython/flowspace/flowcontext.py
--- a/rpython/flowspace/flowcontext.py
+++ b/rpython/flowspace/flowcontext.py
@@ -334,12 +334,13 @@
         """
         if not exceptions:
             return
-        if not any(isinstance(block, (ExceptBlock, FinallyBlock))
-                for block in self.blockstack):
-            # The implicit exception wouldn't be caught and would later get
-            # removed, so don't bother creating it.
-            return
-        self.recorder.guessexception(self, *exceptions)
+        # Implicit exceptions are ignored unless they are caught explicitly
+        if self.has_exc_handler():
+            self.recorder.guessexception(self, *exceptions)
+
+    def has_exc_handler(self):
+        return any(isinstance(block, (ExceptBlock, FinallyBlock))
+                for block in self.blockstack)
 
     def build_flow(self):
         graph = self.graph


More information about the pypy-commit mailing list