cpython
cpython copied to clipboard
Incorrect error message for `yield from`
Bug report
Bug description:
% ./python.exe -c 'yield x'
File "<string>", line 1
SyntaxError: 'yield' outside function
% ./python.exe -c 'yield from x'
File "<string>", line 1
SyntaxError: 'yield' outside function
% ./python.exe -c 'async def f(): yield from x'
File "<string>", line 1
SyntaxError: 'yield from' inside async function
The middle one should also say "yield from".
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
- gh-121680
- gh-121722
- gh-121768
- gh-121769