Skip to content

Reset to previous statement when leaving return in semanal #19642

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

Conversation

sterliakov
Copy link
Collaborator

@sterliakov sterliakov commented Aug 11, 2025

Unlike other statements, return can be found in lambdas, and so is not immediately followed by another statement to check or EOF. We need to restore the previous value to continue checking it.

Fixes #19632

Copy link
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@sterliakov sterliakov changed the title Reset to previous statement when leaving a return expr in semanal Reset to previous statement when leaving return in semanal Aug 12, 2025
@ilevkivskyi ilevkivskyi merged commit cb77a9b into python:master Aug 14, 2025
20 checks passed
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.

name-defined is whitespace-dependent
2 participants