Skip to content

Add message name-is-parameter-and-nonlocal #6882

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

Closed
mbyrnepr2 opened this issue Jun 6, 2022 · 5 comments
Closed

Add message name-is-parameter-and-nonlocal #6882

mbyrnepr2 opened this issue Jun 6, 2022 · 5 comments
Assignees
Labels
Checkers Related to a checker Enhancement ✨ Improvement to a component

Comments

@mbyrnepr2
Copy link
Member

Current problem

The following produces a SyntaxError:

def tomato(is_tasty: bool = True):
    nonlocal is_tasty
python example.py
  File "/Users/markbyrne/programming/example.py", line 2
    nonlocal is_tasty
    ^^^^^^^^^^^^^^^^^
SyntaxError: name 'is_tasty' is parameter and nonlocal

Desired solution

Create a new message in Pylint and emit it in this scenario indicating the error.

Additional context

No response

@mbyrnepr2 mbyrnepr2 added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Jun 6, 2022
@Pierre-Sassoulas Pierre-Sassoulas added Enhancement ✨ Improvement to a component Checkers Related to a checker and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Jun 6, 2022
@ramonsaraiva
Copy link
Contributor

I think I can take this one.

@mbyrnepr2 mbyrnepr2 assigned mbyrnepr2 and ramonsaraiva and unassigned mbyrnepr2 Oct 6, 2022
@mbyrnepr2
Copy link
Member Author

Great thank you@ @ramonsaraiva!
Feel free to ask questions!

@jacobtylerwalls
Copy link
Member

@ramonsaraiva Thanks for your work so far, we were able to discover pylint-dev/astroid#2213 thanks to you.

@mbyrnepr2 I'm going to suggest closing this issue and linked PR for the same reason as #8737 (comment), since we already emit nonlocal-without-binding. WDYT?

@mbyrnepr2
Copy link
Member Author

Makes sense @jacobtylerwalls. What about creating an issue for this one also? On mobile so can’t investigate that easily now.

@mbyrnepr2 mbyrnepr2 closed this as not planned Won't fix, can't repro, duplicate, stale Jun 19, 2023
@jacobtylerwalls
Copy link
Member

I think that's down stream of the arguments() fix. See:

https://github.com/pylint-dev/astroid/blob/eabc6435e08c7f01ccf5a3895c0535a3aad178bf/astroid/nodes/node_classes.py#L857-L858

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Checkers Related to a checker Enhancement ✨ Improvement to a component
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants