gh-121657: Display correct error message for yield from outside of a …#121680
gh-121657: Display correct error message for yield from outside of a …#121680encukou merged 3 commits intopython:mainfrom
Conversation
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Misc/NEWS.d/next/Core and Builtins/2024-07-13-12-27-31.gh-issue-121657.wgOYLw.rst
Outdated
Show resolved
Hide resolved
| ... | ||
| SyntaxError: 'yield' outside function | ||
|
|
||
| >>> yield from [1,2] |
There was a problem hiding this comment.
Maybe add a test with lambda as well since they are "almost like" functions (but not from a compiler PoV).
There was a problem hiding this comment.
I'll do it in a seperate PR
There was a problem hiding this comment.
I added another test as requested in #121722
…e-121657.wgOYLw.rst Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
|
Thanks @gege-hoho for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
|
Thanks @gege-hoho for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12. |
|
Sorry, @gege-hoho and @encukou, I could not cleanly backport this to |
|
Sorry, @gege-hoho and @encukou, I could not cleanly backport this to |
…outside of a function (pythonGH-121680) (cherry picked from commit 178e44d) Co-authored-by: Gregor <36135323+gege-hoho@users.noreply.github.com> 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>
|
GH-121768 is a backport of this pull request to the 3.13 branch. |
|
GH-121769 is a backport of this pull request to the 3.12 branch. |
… of a function (pythonGH-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>
Display correct error message for yield from outside of a function
yield from#121657