mirror of
https://github.com/python/cpython.git
synced 2025-08-23 18:24:46 +00:00
[3.12] gh-121657: Display correct error message for yield from outsid… (GH-121769)
(cherry picked from commit 178e44de8f
)
Co-authored-by: Gregor <36135323+gege-hoho@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This commit is contained in:
parent
d870f4130b
commit
b455a5a55c
3 changed files with 8 additions and 1 deletions
|
@ -6117,7 +6117,7 @@ compiler_visit_expr1(struct compiler *c, expr_ty e)
|
|||
break;
|
||||
case YieldFrom_kind:
|
||||
if (!_PyST_IsFunctionLike(c->u->u_ste)) {
|
||||
return compiler_error(c, loc, "'yield' outside function");
|
||||
return compiler_error(c, loc, "'yield from' outside function");
|
||||
}
|
||||
if (c->u->u_scope_type == COMPILER_SCOPE_ASYNC_FUNCTION) {
|
||||
return compiler_error(c, loc, "'yield from' inside async function");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue