Another test for try-break.
authorRobert Bradshaw <robertwb@math.washington.edu>
Thu, 26 Feb 2009 07:48:44 +0000 (23:48 -0800)
committerRobert Bradshaw <robertwb@math.washington.edu>
Thu, 26 Feb 2009 07:48:44 +0000 (23:48 -0800)
tests/run/trybreak.pyx [new file with mode: 0644]

diff --git a/tests/run/trybreak.pyx b/tests/run/trybreak.pyx
new file mode 100644 (file)
index 0000000..bc4c715
--- /dev/null
@@ -0,0 +1,17 @@
+__doc__ = u"""
+>>> foo()
+'a'
+"""
+
+# Indirectly makes sure the cleanup happens correctly on breaking.
+def foo():
+    for x in "abc":
+        try:
+            x()
+        except:
+            break
+    for x in "abc":
+        try:
+            x()
+        except:
+            return x