[pypy-commit] pypy framestate: Add failing test for the case where 'break' is hidden away inside a handler

rlamy noreply at buildbot.pypy.org
Fri Feb 13 14:27:30 CET 2015


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: framestate
Changeset: r75854:7f1ca2ab5456
Date: 2015-02-13 12:51 +0000
http://bitbucket.org/pypy/pypy/changeset/7f1ca2ab5456/

Log:	Add failing test for the case where 'break' is hidden away inside a
	handler

diff --git a/rpython/flowspace/test/test_objspace.py b/rpython/flowspace/test/test_objspace.py
--- a/rpython/flowspace/test/test_objspace.py
+++ b/rpython/flowspace/test/test_objspace.py
@@ -206,6 +206,22 @@
     def test_break_continue(self):
         x = self.codetest(self.break_continue)
 
+    def test_break_from_handler(self):
+        def f(x):
+            while True:
+                try:
+                    x()
+                except TypeError:
+                    if x:
+                        raise
+                    break
+        assert f(0) is None
+        graph = self.codetest(f)
+        simplify_graph(graph)
+        entrymap = mkentrymap(graph)
+        links = entrymap[graph.returnblock]
+        assert len(links) == 1
+
     #__________________________________________________________
     def unpack_tuple(lst):
         a, b, c = lst


More information about the pypy-commit mailing list