[Cython] Cython problem
Stefan Behnel
stefan_ml at behnel.de
Wed Feb 6 09:50:09 CET 2008
Hi,
Robert Bradshaw wrote:
> This is a really strange bug...
Here is a test case that gives me a compiler crash.
Stefan
# HG changeset patch
# User Stefan Behnel <scoder at users.berlios.de>
# Date 1202287648 -3600
# Node ID 543c702490e329817fa2b46cda97d054091c0e52
# Parent 36d9ecdab18b0a94fe8ce1c32f2d5a81a039df9b
test case for tuple unpacking of a list comprehension
diff -r 36d9ecdab18b -r 543c702490e3 tests/run/unpacklistcomp.pyx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/run/unpacklistcomp.pyx Wed Feb 06 09:47:28 2008 +0100
@@ -0,0 +1,31 @@
+__doc__ = """
+ >>> unpack_normal([1,2])
+ (1, 2)
+ >>> unpack_normal([1,2,3])
+ Traceback (most recent call last):
+ ValueError: too many values to unpack
+
+ >>> unpack_comp([1,2])
+ (1, 2)
+ >>> unpack_comp([1,2,3])
+ Traceback (most recent call last):
+ ValueError: too many values to unpack
+
+ >>> unpack_expr([1,2])
+ (1, 2)
+ >>> unpack_expr([1,2,3])
+ Traceback (most recent call last):
+ ValueError: too many values to unpack
+"""
+
+def unpack_normal(l):
+ a,b = l
+ return a,b
+
+def unpack_comp(l):
+ a,b = [ n for n in l ]
+ return a,b
+
+def unpack_expr(l):
+ a,b = [ n*n for n in l ]
+ return a,b
More information about the Cython-dev
mailing list