[pypy-commit] pypy py3k: a failing test and the corresponding fix. We want to make sure that the exception state is cleared when the blocks are unrolled because of a break
antocuni
noreply at buildbot.pypy.org
Fri Sep 21 18:41:19 CEST 2012
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: py3k
Changeset: r57455:5f0417506726
Date: 2012-09-21 18:40 +0200
http://bitbucket.org/pypy/pypy/changeset/5f0417506726/
Log: a failing test and the corresponding fix. We want to make sure that
the exception state is cleared when the blocks are unrolled because
of a break
diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py
--- a/pypy/interpreter/pyopcode.py
+++ b/pypy/interpreter/pyopcode.py
@@ -1315,7 +1315,7 @@
def handle(self, frame, unroller):
assert False # never called
- def cleanup(self, frame):
+ def cleanupstack(self, frame):
frame.dropvaluesuntil(self.valuestackdepth+1)
w_last_exception = frame.popvalue()
if not isinstance(w_last_exception, W_OperationError):
@@ -1323,7 +1323,7 @@
frame.space.str_w(w_last_exception))
raise BytecodeCorruption(msg)
frame.last_exception = w_last_exception.operr
- FrameBlock.cleanup(self, frame)
+ FrameBlock.cleanupstack(self, frame)
class ExceptBlock(FrameBlock):
diff --git a/pypy/interpreter/test/test_raise.py b/pypy/interpreter/test/test_raise.py
--- a/pypy/interpreter/test/test_raise.py
+++ b/pypy/interpreter/test/test_raise.py
@@ -295,3 +295,12 @@
raise ValueError
except ValueError as e:
continue
+
+ def test_clear_last_exception_on_break(self):
+ import sys
+ for i in [0]:
+ try:
+ raise ValueError
+ except ValueError:
+ break
+ assert sys.exc_info() == (None, None, None)
More information about the pypy-commit
mailing list