[pypy-commit] pypy py3.5-corowrapper: next fix

arigo pypy.commits at gmail.com
Fri Sep 16 13:12:43 EDT 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: py3.5-corowrapper
Changeset: r87146:70a2383edbd6
Date: 2016-09-16 19:12 +0200
http://bitbucket.org/pypy/pypy/changeset/70a2383edbd6/

Log:	next fix

diff --git a/pypy/interpreter/generator.py b/pypy/interpreter/generator.py
--- a/pypy/interpreter/generator.py
+++ b/pypy/interpreter/generator.py
@@ -151,7 +151,11 @@
         # interpretation.
         space = self.space
         if self.w_yielded_from is not None:
-            self.next_yield_from(frame, w_arg_or_err)
+            try:
+                self.next_yield_from(frame, w_arg_or_err)
+            except OperationError as operr:
+                ec = space.getexecutioncontext()
+                return frame.handle_operation_error(ec, operr)
             # Normal case: the call above raises Yield.
             # We reach this point if the iterable is exhausted.
             last_instr = jit.promote(frame.last_instr)
@@ -242,6 +246,8 @@
             tb = check_traceback(space, w_tb, msg)
 
         operr = OperationError(w_type, w_val, tb)
+        operr.normalize_exception(space)
+
         w_yf = self.w_yielded_from
         if (w_yf is not None and
                     operr.match(space, space.w_GeneratorExit)):
@@ -251,7 +257,6 @@
             except OperationError as e:
                 return self.send_error(e)
 
-        operr.normalize_exception(space)
         if tb is None:
             tb = space.getattr(operr.get_w_value(space),
                                space.wrap('__traceback__'))


More information about the pypy-commit mailing list