Skip to content

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

Merged
merged 3 commits into from
Jul 13, 2024

Conversation

gege-hoho
Copy link
Contributor

@gege-hoho gege-hoho commented Jul 13, 2024

Display correct error message for yield from outside of a function

@ghost
Copy link

ghost commented Jul 13, 2024

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app
Copy link

bedevere-app bot commented Jul 13, 2024

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 skip news label instead.

@@ -2247,6 +2247,11 @@ def printsolution(self, x):
...
SyntaxError: 'yield' outside function

>>> yield from [1,2]
Copy link
Member

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).

Copy link
Contributor Author

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

Copy link
Contributor Author

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

@encukou encukou merged commit 178e44d into python:main Jul 13, 2024
36 checks passed
@encukou encukou added needs backport to 3.12 only security fixes needs backport to 3.13 bugs and security fixes labels Jul 13, 2024
@miss-islington-app
Copy link

Thanks @gege-hoho for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Thanks @gege-hoho for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry, @gege-hoho and @encukou, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 178e44de8f023be7a5dc400044ab61983b191f24 3.13

@miss-islington-app
Copy link

Sorry, @gege-hoho and @encukou, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 178e44de8f023be7a5dc400044ab61983b191f24 3.12

Eclips4 pushed a commit to Eclips4/cpython that referenced this pull request Jul 14, 2024
…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]>
@bedevere-app
Copy link

bedevere-app bot commented Jul 14, 2024

GH-121768 is a backport of this pull request to the 3.13 branch.

@bedevere-app
Copy link

bedevere-app bot commented Jul 14, 2024

GH-121769 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Jul 14, 2024
estyxx pushed a commit to estyxx/cpython that referenced this pull request Jul 17, 2024
… 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants