Skip to content
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

used-before-assignment with := in dict node #8125

Closed
cdce8p opened this issue Jan 28, 2023 · 0 comments · Fixed by #8176
Closed

used-before-assignment with := in dict node #8125

cdce8p opened this issue Jan 28, 2023 · 0 comments · Fixed by #8176
Labels
Assignment expression Related to the walrus operator / assignment expression C: used-before-assignment Issues related to 'used-before-assignment' check False Positive 🦟 A message is emitted but nothing is wrong with the code python 3.8
Milestone

Comments

@cdce8p
Copy link
Member

cdce8p commented Jan 28, 2023

Bug description

#4828 (comment)

def func(): ...
y = {
    0: x if (x := func()) else "",
}

Configuration

No response

Command used

pylint test.py

Pylint output

test.py:3:7: E0601: Using variable 'x' before assignment (used-before-assignment)

Expected behavior

No error

Pylint version

pylint 2.16.0b1
astroid 2.14.0-dev0
Python 3.11.1

OS / Environment

No response

Additional dependencies

No response

@cdce8p cdce8p added python 3.8 Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling False Positive 🦟 A message is emitted but nothing is wrong with the code Assignment expression Related to the walrus operator / assignment expression C: used-before-assignment Issues related to 'used-before-assignment' check and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Jan 28, 2023
@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.16.2 milestone Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Assignment expression Related to the walrus operator / assignment expression C: used-before-assignment Issues related to 'used-before-assignment' check False Positive 🦟 A message is emitted but nothing is wrong with the code python 3.8
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants