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 false positive for named expressions in a not-first position in container #8252

Closed
jacobtylerwalls opened this issue Feb 10, 2023 · 0 comments · Fixed by #8253
Labels
C: used-before-assignment Issues related to 'used-before-assignment' check False Positive 🦟 A message is emitted but nothing is wrong with the code
Milestone

Comments

@jacobtylerwalls
Copy link
Member

jacobtylerwalls commented Feb 10, 2023

This raises used-before-assignment:

def expression_in_ternary_operator_inside_container_later_position():
    """Named expression follows unrelated item in container"""
    return [23, val3 if (val3 := 'something') else 'anything']

The check for BaseContainer should also check all elements. I can handle that in another PR.

Originally posted by @jacobtylerwalls in #8176 (review)

@jacobtylerwalls jacobtylerwalls added False Positive 🦟 A message is emitted but nothing is wrong with the code C: used-before-assignment Issues related to 'used-before-assignment' check labels Feb 10, 2023
@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.16.2 milestone Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: used-before-assignment Issues related to 'used-before-assignment' check False Positive 🦟 A message is emitted but nothing is wrong with the code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants