Author: Carl Friedrich Bolz <[email protected]>
Branch:
Changeset: r76575:04d55a9be4ce
Date: 2015-03-26 13:23 +0100
http://bitbucket.org/pypy/pypy/changeset/04d55a9be4ce/
Log: the stack effect in the bytecode compiler of UNPACK_SEQUENCE was
wrong (!)
diff --git a/pypy/interpreter/astcompiler/assemble.py
b/pypy/interpreter/astcompiler/assemble.py
--- a/pypy/interpreter/astcompiler/assemble.py
+++ b/pypy/interpreter/astcompiler/assemble.py
@@ -648,7 +648,7 @@
def _compute_UNPACK_SEQUENCE(arg):
- return arg + 1
+ return arg - 1
def _compute_DUP_TOPX(arg):
return arg
diff --git a/pypy/interpreter/astcompiler/test/test_compiler.py
b/pypy/interpreter/astcompiler/test/test_compiler.py
--- a/pypy/interpreter/astcompiler/test/test_compiler.py
+++ b/pypy/interpreter/astcompiler/test/test_compiler.py
@@ -759,6 +759,19 @@
"""
self.simple_test(source, 'l', [1, 2])
+ def test_unpack_wrong_stackeffect(self):
+ source = """if 1:
+ l = [1, 2]
+ a, b = l
+ a, b = l
+ a, b = l
+ a, b = l
+ a, b = l
+ a, b = l
+ """
+ code = compile_with_astcompiler(source, 'exec', self.space)
+ assert code.co_stacksize == 2
+
def test_lambda(self):
yield self.st, "y = lambda x: x", "y(4)", 4
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit