Author: Manuel Jacob <[email protected]>
Branch: py3k
Changeset: r77729:6e13803a221c
Date: 2015-05-31 20:48 +0200
http://bitbucket.org/pypy/pypy/changeset/6e13803a221c/

Log:    Fix two previously added tests by making the stack depth computation
        more conservative (but still slightly incorrect).

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
@@ -423,11 +423,11 @@
                       jump_op == ops.SETUP_EXCEPT or
                       jump_op == ops.SETUP_WITH):
                     if jump_op == ops.SETUP_FINALLY:
-                        target_depth += 3
+                        target_depth += 4
                     elif jump_op == ops.SETUP_EXCEPT:
                         target_depth += 4
                     elif jump_op == ops.SETUP_WITH:
-                        target_depth += 2
+                        target_depth += 3
                     if target_depth > self._max_depth:
                         self._max_depth = target_depth
                 elif (jump_op == ops.JUMP_IF_TRUE_OR_POP or
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
@@ -841,7 +841,7 @@
         finally: pass
         """
         code = compile_with_astcompiler(source, 'exec', self.space)
-        assert code.co_stacksize == 3
+        assert code.co_stacksize == 4
 
     def test_stackeffect_bug4(self):
         source = """if 1:
@@ -853,7 +853,7 @@
         with a: pass
         """
         code = compile_with_astcompiler(source, 'exec', self.space)
-        assert code.co_stacksize == 4
+        assert code.co_stacksize == 5
 
     def test_stackeffect_bug5(self):
         source = """if 1:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to