Skip to content

[partially defined] fix a false-negative with variable defined in a skipped branch - #14221

Merged
JukkaL merged 1 commit into
python:masterfrom
ilinum:partial/nested-return-fix
Nov 30, 2022
Merged

JukkaL merged 1 commit into
python:masterfrom
ilinum:partial/nested-return-fix

Conversation

@ilinum

@ilinum ilinum commented Nov 29, 2022

Copy link
Copy Markdown
Collaborator

The goal of partially-defined check is to detect variables that could be undefined but semantic analyzer doesn't detect them as undefined. In this case, a variable was defined in a branch that returns, so semantic analyzer considered it defined when it was not.

I've discovered this when testing support for try/except statements (#14114).

@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@JukkaL JukkaL left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JukkaL
JukkaL merged commit d3427c1 into python:master Nov 30, 2022
@ilinum
ilinum deleted the partial/nested-return-fix branch January 23, 2023 15:34
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.

2 participants