summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/Python/compile.c b/Python/compile.c
index cbc23aa..1977c3a 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -1064,6 +1064,8 @@ PyCompile_OpcodeStackEffect(int opcode, int oparg)
return 0;
case GET_ANEXT:
return 1;
+ case GET_YIELD_FROM_ITER:
+ return 0;
default:
return PY_INVALID_STACK_EFFECT;
}
@@ -1751,12 +1753,8 @@ compiler_function(struct compiler *c, stmt_ty s, int is_async)
Py_DECREF(qualname);
Py_DECREF(co);
- if (is_async) {
+ if (is_async)
co->co_flags |= CO_COROUTINE;
- /* An async function is always a generator, even
- if there is no 'yield' expressions in it. */
- co->co_flags |= CO_GENERATOR;
- }
/* decorators */
for (i = 0; i < asdl_seq_LEN(decos); i++) {
@@ -3850,7 +3848,7 @@ compiler_visit_expr(struct compiler *c, expr_ty e)
return compiler_error(c, "'yield from' inside async function");
VISIT(c, expr, e->v.YieldFrom.value);
- ADDOP(c, GET_ITER);
+ ADDOP(c, GET_YIELD_FROM_ITER);
ADDOP_O(c, LOAD_CONST, Py_None, consts);
ADDOP(c, YIELD_FROM);
break;