Commits

Armin Rigo  committed 380497b

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

  • Participants
  • Parent commits 4b48239

Comments (0)

Files changed (2)

File pypy/interpreter/pyopcode.py

             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):

File pypy/interpreter/test/test_generator.py

             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