[pypy-commit] pypy default: Test and fix

arigo noreply at buildbot.pypy.org
Thu Apr 9 14:52:52 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r76760:f57c8be4e18c
Date: 2015-04-09 14:52 +0200
http://bitbucket.org/pypy/pypy/changeset/f57c8be4e18c/

Log:	Test and fix

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
@@ -608,7 +608,6 @@
     ops.YIELD_VALUE: 0,
     ops.BUILD_CLASS: -2,
     ops.BUILD_MAP: 1,
-    ops.BUILD_SET: 1,
     ops.COMPARE_OP: -1,
 
     ops.LOOKUP_METHOD: 1,
@@ -663,6 +662,9 @@
 def _compute_BUILD_LIST(arg):
     return 1 - arg
 
+def _compute_BUILD_SET(arg):
+    return 1 - arg
+
 def _compute_MAKE_CLOSURE(arg):
     return -arg - 1
 
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
@@ -812,6 +812,13 @@
         code = compile_with_astcompiler(source, 'exec', self.space)
         assert code.co_stacksize == 3
 
+    def test_stackeffect_bug6(self):
+        source = """if 1:
+        {1}; {1}; {1}; {1}; {1}; {1}; {1}
+        """
+        code = compile_with_astcompiler(source, 'exec', self.space)
+        assert code.co_stacksize == 1
+
     def test_lambda(self):
         yield self.st, "y = lambda x: x", "y(4)", 4
 


More information about the pypy-commit mailing list