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>
This commit is contained in:
Gregor 2024-07-13 17:14:39 +02:00 committed by GitHub
parent f4d6e45c1e
commit 178e44de8f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 1 deletions

View file

@ -2247,6 +2247,11 @@ Traceback (most recent call last):
...
SyntaxError: 'yield' outside function
>>> yield from [1,2]
Traceback (most recent call last):
...
SyntaxError: 'yield from' outside function
>>> def f(): x = yield = y
Traceback (most recent call last):
...