Commits

Philip Jenvey committed 7ca938c

fix preserving the exception state between generator yields for the 3rd time

Comments (0)

Files changed (2)

pypy/interpreter/pyopcode.py

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

pypy/interpreter/test/test_generator.py

                 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