Commit 7c0a9b7f authored by Armin Rigo's avatar Armin Rigo

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

parent 2edd9c1e
......@@ -61,6 +61,7 @@ class __extend__(pyframe.PyFrame):
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):
......
......@@ -280,6 +280,20 @@ res = f()
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment