From: Dag Sverre Seljebotn Date: Sat, 25 Apr 2009 18:58:37 +0000 (+0200) Subject: Fix tuple unpacking bug (related to old temps) X-Git-Tag: 0.11.2.rc1~10^2~36^2~13 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b61ff76eb20e75f2cabda9ca103904424c0ae41a;p=cython.git Fix tuple unpacking bug (related to old temps) --- diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 25f655a5..b8d41ec0 100644 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -3003,11 +3003,12 @@ class SequenceNode(NewTempExprNode): def allocate_target_temps(self, env, rhs): self.iterator.allocate_temps(env) - for arg, node in zip(self.args, self.coerced_unpacked_items): + for node in self.coerced_unpacked_items: node.allocate_temps(env) - arg.allocate_target_temps(env, None) #arg.release_target_temp(env) #node.release_temp(env) + for arg in self.args: + arg.allocate_target_temps(env, None) if rhs: rhs.release_temp(env) self.iterator.release_temp(env) diff --git a/tests/run/tupleunpack_Thmm.pyx b/tests/run/tupleunpack_Thmm.pyx new file mode 100644 index 00000000..87f24bb9 --- /dev/null +++ b/tests/run/tupleunpack_Thmm.pyx @@ -0,0 +1,25 @@ +""" +>>> func() +0 0 +0 +0 +1 1 +1 +1 +2 2 +2 +2 +>>> func2() +""" + +def g(): + return ((3, 2), 1, 0) + +def func2(): + (a, b), c, d = g() + +def func(): + for (a, b),c ,d in zip(zip(range(3), range(3)), range(3), range(3)): + print a, b + print c + print d