-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-121657: Display correct error message for yield from outside of a … #121680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
@@ -2247,6 +2247,11 @@ def printsolution(self, x): | |||
... | |||
SyntaxError: 'yield' outside function | |||
|
|||
>>> yield from [1,2] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do it in a seperate PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added another test as requested in #121722
…e-121657.wgOYLw.rst Co-authored-by: Bénédikt Tran <[email protected]>
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 <[email protected]> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Bénédikt Tran <[email protected]>
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 <[email protected]>
Display correct error message for yield from outside of a function
yield from
#121657