[pypy-commit] pypy default: Test and fix (the code in module/pypyjit was already doing that correctly)

arigo noreply at buildbot.pypy.org
Thu Aug 7 20:45:12 CEST 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r72713:380497b41b43
Date: 2014-08-07 20:44 +0200
http://bitbucket.org/pypy/pypy/changeset/380497b41b43/

Log:	Test and fix (the code in module/pypyjit was already doing that
	correctly)

diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py
--- a/pypy/interpreter/pyopcode.py
+++ b/pypy/interpreter/pyopcode.py
@@ -61,6 +61,7 @@
             while True:
                 next_instr = self.handle_bytecode(co_code, next_instr, ec)
         except ExitFrame:
+            self.last_exception = None
             return self.popvalue()
 
     def handle_bytecode(self, co_code, next_instr, ec):
diff --git a/pypy/interpreter/test/test_generator.py b/pypy/interpreter/test/test_generator.py
--- a/pypy/interpreter/test/test_generator.py
+++ b/pypy/interpreter/test/test_generator.py
@@ -280,6 +280,20 @@
             raise StopIteration
         assert tuple(f()) == (1,)
 
+    def test_exception_is_cleared_by_yield(self):
+        def f():
+            try:
+                foobar
+            except NameError:
+                yield 5
+                raise    # should raise "no active exception to re-raise"
+        gen = f()
+        gen.next()  # --> 5
+        try:
+            gen.next()
+        except TypeError:
+            pass
+
 
 def test_should_not_inline(space):
     from pypy.interpreter.generator import should_not_inline


More information about the pypy-commit mailing list