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 positive for signature-differs when collecting all arguments #3737

Closed
GergelyKalmar opened this issue Jul 12, 2020 · 6 comments · Fixed by #3988
Closed

False positive for signature-differs when collecting all arguments #3737

GergelyKalmar opened this issue Jul 12, 2020 · 6 comments · Fixed by #3988
Labels

Comments

@GergelyKalmar
Copy link
Contributor

This is a very similar bug to #1553. The main difference is that in this case we set a default value to one of the parameters in the function that we override in the subclass (see elit=None).

Steps to reproduce

Create a file lorem.py as follows:

class Ipsum:
    def dolor(self, elit=None):
        pass


class LoremIpsum(Ipsum):
    def dolor(self, *args, **kwargs):
        super().dolor(*args, **kwargs)

Note that this is a particularly common pattern in Django, for example when overriding the save method of models (see an example in the official documentation).

Current behavior

Run pylint on the file (pylint lorem.py):

...
lorem.py:7:4: W0222: Signature differs from overridden 'dolor' method (signature-differs)

Expected behavior

There is no error reported.

pylint --version output

pylint 2.5.3
astroid 2.4.2
Python 3.8.2 (default, Apr 27 2020, 15:53:34) 
[GCC 9.3.0]
@tgree
Copy link

tgree commented Aug 14, 2020

+1

I hit this today as well; this is a very common idiom and shouldn't trigger a warning.

@GergelyKalmar
Copy link
Contributor Author

I've prepared a small PR that fixes this issue: #3988

@abbra
Copy link

abbra commented Feb 4, 2021

When do you plan to release new pylint? Right now pylint from pypi and also from Fedora 33 are both erroring with this issue. This blocks FreeIPA CI...

stanislavlevin added a commit to stanislavlevin/freeipa that referenced this issue Feb 18, 2021
@krzysieqq
Copy link

Any news when this fix will be merged to master?

@GergelyKalmar
Copy link
Contributor Author

The fix has been already merged some time ago: #3988

In fact, this fix should already be included in pylint 2.7.0+ as far as I remember.

@krzysieqq
Copy link

My bad I had 2.6 version, after upgrade everything works, thanks :)!

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

Successfully merging a pull request may close this issue.

5 participants