summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGregor <36135323+gege-hoho@users.noreply.github.com>2024-07-13 15:14:39 (GMT)
committerGitHub <noreply@github.com>2024-07-13 15:14:39 (GMT)
commit178e44de8f023be7a5dc400044ab61983b191f24 (patch)
treed93cf6c5d9d3eb7ab7102a691b5cf313b0bd16c5 /Python
parentf4d6e45c1e7161878b36ef9e876ca3e44b80a97d (diff)
downloadcpython-178e44de8f023be7a5dc400044ab61983b191f24.zip
cpython-178e44de8f023be7a5dc400044ab61983b191f24.tar.gz
cpython-178e44de8f023be7a5dc400044ab61983b191f24.tar.bz2
gh-121657: Display correct error message for yield from outside of a function (GH-121680)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Diffstat (limited to 'Python')
-rw-r--r--Python/compile.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 4190b14..ca64b5c 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -6119,7 +6119,7 @@ compiler_visit_expr(struct compiler *c, expr_ty e)
break;
case YieldFrom_kind:
if (!_PyST_IsFunctionLike(SYMTABLE_ENTRY(c))) {
- 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");