Fix bug #409 with temps and sequence unpacking.
authorRobert Bradshaw <robertwb@math.washington.edu>
Thu, 15 Oct 2009 05:06:59 +0000 (22:06 -0700)
committerRobert Bradshaw <robertwb@math.washington.edu>
Thu, 15 Oct 2009 05:06:59 +0000 (22:06 -0700)
Cython/Compiler/ExprNodes.py
Cython/Compiler/Parsing.py
tests/run/temp_alloc_T409.pyx [new file with mode: 0644]

index 62e969741c38e0fee8ae482760a5c482910dbb2f..b16c9e8d7028dcd862847b611141c3e965f1cfa4 100644 (file)
@@ -412,7 +412,7 @@ class ExprNode(Node):
 
     def allocate_temp_result(self, code):
         if self.temp_code:
-            raise RuntimeError("Temp allocated multiple times")
+            raise RuntimeError("Temp allocated multiple times in %r: %r" % (self.__class__.__name__, self.pos))
         type = self.type
         if not type.is_void:
             if type.is_pyobject:
index 175a7e71810b6a011389ef3e6e0ab8f64c725a1f..c42a419ebb9ebd3df0477f8ebc951a48889b94da 100644 (file)
@@ -924,7 +924,7 @@ def flatten_parallel_assignments(input, output):
     #  individual elements.  This transformation is applied
     #  recursively, so that nested structures get matched as well.
     rhs = input[-1]
-    if not rhs.is_sequence_constructor:
+    if not rhs.is_sequence_constructor or not sum(lhs.is_sequence_constructor for lhs in input[:-1]):
         output.append(input)
         return
 
diff --git a/tests/run/temp_alloc_T409.pyx b/tests/run/temp_alloc_T409.pyx
new file mode 100644 (file)
index 0000000..d792723
--- /dev/null
@@ -0,0 +1,11 @@
+__doc__ = """
+    >>> foo()
+    ([0, 0], [0, 0])
+"""
+
+# Extracted from sage/plot/plot3d/index_face_set.pyx:502
+# Turns out to be a bug in implementation of PEP 3132 (Extended Iterable Unpacking)
+
+def foo():
+    a = b = [0,0]
+    return a, b