[pypy-svn] rev 2224 - pypy/trunk/src/pypy/translator/test
arigo at codespeak.net
arigo at codespeak.net
Wed Nov 19 17:46:43 CET 2003
Author: arigo
Date: Wed Nov 19 17:46:42 2003
New Revision: 2224
Modified:
pypy/trunk/src/pypy/translator/test/snippet.py
Log:
Another example. (We should directly use all these examples in
objspace.flow.test.test_objspace.)
Modified: pypy/trunk/src/pypy/translator/test/snippet.py
==============================================================================
--- pypy/trunk/src/pypy/translator/test/snippet.py (original)
+++ pypy/trunk/src/pypy/translator/test/snippet.py Wed Nov 19 17:46:42 2003
@@ -211,3 +211,43 @@
return 'yes'
else:
return 'no'
+
+def break_continue(x):
+ result = []
+ i = 0
+ while 1:
+ i = i + 1
+ try:
+ if i&1:
+ continue
+ if i >= x:
+ break
+ finally:
+ result.append(i)
+ i = i + 1
+ return result
+
+def reverse_3(lst):
+ try:
+ a, b, c = lst
+ except:
+ return 0, 0, 0
+ return c, b, a
+
+def finallys(lst):
+ x = 1
+ try:
+ x = 2
+ try:
+ x = 3
+ a, = lst
+ x = 4
+ except KeyError:
+ return 5
+ except ValueError:
+ return 6
+ b, = lst
+ x = 7
+ finally:
+ x = 8
+ return x
More information about the Pypy-commit
mailing list