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

Pylint doesn't see nonlocal usage of variable #5187

Closed
jbvsmo opened this issue Oct 19, 2021 · 1 comment · Fixed by #5906
Closed

Pylint doesn't see nonlocal usage of variable #5187

jbvsmo opened this issue Oct 19, 2021 · 1 comment · Fixed by #5906
Assignees
Labels
Milestone

Comments

@jbvsmo
Copy link

jbvsmo commented Oct 19, 2021

Basically similar to #2671

Bug description

def myfunction(function, arg1, arg2):
    """ lorem ipsum """

    def decorator():
        """ lorem ipsum """
        nonlocal arg2
        arg2 += 1

        return function(arg1, arg2)

    return decorator

Error:
W0613: Unused argument 'arg2' (unused-argument)

Configuration

No response

Command used

pylint src/lorem.py

Pylint output

************* Module lorem
src/lorem.py:3:31: W0613: Unused argument 'arg2' (unused-argument)

------------------------------------------------------------------
Your code has been rated at 8.33/10 (previous run: 8.33/10, +0.00)

Expected behavior

Detect nonlocal usage of arg2

Pylint version

pylint 2.11.1
astroid 2.8.2
Python 3.7.12 (default, Sep 10 2021, 17:03:41) [Clang 11.0.0 (clang-1100.0.33.17)]

OS / Environment

MacOS 10.14.6

Additional dependencies

No response

@jbvsmo jbvsmo added Bug 🪲 Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Oct 19, 2021
@cdce8p cdce8p added C: unused-argument Issues related to 'unused-argument' check and removed C: unused-argument Issues related to 'unused-argument' check labels Nov 17, 2021
@natgiordano
Copy link

Hi, I'd like to take a look at this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants