Author: Philip Jenvey <[email protected]>
Branch: py3k
Changeset: r72822:7ca938cad6ed
Date: 2014-08-15 18:01 -0700
http://bitbucket.org/pypy/pypy/changeset/7ca938cad6ed/
Log: fix preserving the exception state between generator yields for the
3rd time
diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py
--- a/pypy/interpreter/pyopcode.py
+++ b/pypy/interpreter/pyopcode.py
@@ -63,6 +63,8 @@
try:
while True:
next_instr = self.handle_bytecode(co_code, next_instr, ec)
+ except Yield:
+ return self.popvalue()
except ExitFrame:
self.last_exception = None
return self.popvalue()
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
@@ -307,12 +307,12 @@
foobar
except NameError:
yield 5
- raise # should raise "no active exception to re-raise"
+ raise
gen = f()
next(gen) # --> 5
try:
next(gen)
- except TypeError:
+ except NameError:
pass
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit