diff Python/compile.c @ 75714:72556ff86828

perform yield from delegation by repeating YIELD_FROM opcode (closes #14230) This allows generators that are using yield from to be seen by debuggers. It also kills the f_yieldfrom field on frame objects. Patch mostly from Mark Shannon with a few tweaks by me.
author Benjamin Peterson <benjamin@python.org>
date Thu, 15 Mar 2012 15:37:39 -0500
parents e1177b9167ce
children 22844ddce57b
line wrap: on
line diff
--- a/Python/compile.c	Thu Mar 15 13:28:27 2012 -0700
+++ b/Python/compile.c	Thu Mar 15 15:37:39 2012 -0500
@@ -840,9 +840,9 @@
         case IMPORT_STAR:
             return -1;
         case YIELD_VALUE:
+            return 0;
         case YIELD_FROM:
-            return 0;
-
+            return -1;
         case POP_BLOCK:
             return 0;
         case POP_EXCEPT:
@@ -3323,6 +3323,8 @@
             ADDOP_O(c, LOAD_CONST, Py_None, consts);
         }
         if (e->kind == YieldFrom_kind) {
+            ADDOP(c, GET_ITER);
+            ADDOP_O(c, LOAD_CONST, Py_None, consts);
             ADDOP(c, YIELD_FROM);
         }
         else {