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

False-Negative - unexpected-keyword-arg - using decorator with keyword arguments #7946

Closed
pcharmoille opened this issue Dec 15, 2022 · 3 comments
Labels
Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling

Comments

@pcharmoille
Copy link

Bug description

def my_decorator(function):
    from functools import wraps

    @wraps(function)
    def wrapper(*args, **kwargs):
        return function(*args, **kwargs)

    return wrapper


@my_decorator
def a(c=0):
    pass


a(d=2)

Configuration

No response

Command used

pylint -E a.py

Pylint output

None

Expected behavior

************* Module test_pylint
E: 16, 0: Unexpected keyword argument 'd' in function call (unexpected-keyword-arg)

well reported on :

No config file found, using default configuration
pylint 1.9.5,
astroid 1.6.6
Python 2.7.18 (v2.7.18:8d21aa21f2, Apr 20 2020, 13:25:05) [MSC v.1500 64 bit (AMD64)]

Pylint version

pylint 2.15.8
astroid 2.12.13
Python 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)]

OS / Environment

windows amd 64b

Additional dependencies

No response

@pcharmoille pcharmoille added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Dec 15, 2022
@clavedeluna
Copy link
Contributor

I believe this is the same issue as #5784 but I'll let a maintainer close as a clone just to get another pair of eyes on it.

@Pierre-Sassoulas
Copy link
Member

Decorator can modify function signature in really complex way that pylint won't understand right now. We're favoring false negatives over false positives so it makes sense to not report in this case in the current state of what astroid can understand of decorators. I'm on mobile so I don't know what the issue we should close in favor of is.

@clavedeluna
Copy link
Contributor

Closing given @Pierre-Sassoulas 's comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling
Projects
None yet
Development

No branches or pull requests

3 participants