mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #24400: Merge 3.5
This commit is contained in:
commit
6edc2f7549
29 changed files with 1014 additions and 378 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue