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 with useless-super-delegation for keyword args with dict defaults #3773

Closed
filip-zyzniewski opened this issue Aug 10, 2020 · 1 comment · Fixed by #3778
Closed
Assignees

Comments

@filip-zyzniewski
Copy link

Problem similar to #2022 .

Steps to reproduce

(I know, mutable default is a bad idea)

# uselesssuper.py
class MyBase:
    def method(self, *, arg={}):
        self.x = arg

class MyChild(MyBase):
    def method(self, *, arg={'foo': 'bar'}):
        super().method(arg=arg)

myobj = MyChild()
myobj.method()
print(myobj.x)

Current behavior

$ python3 uselesssuperdict.py 
{'foo': 'bar'}
$ pylint uselesssuperdict.py --disable=all --enable=useless-super-delegation
************* Module uselesssuperdict
uselesssuperdict.py:7:4: W0235: Useless super delegation in method 'method' (useless-super-delegation)

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

$ 

Expected behavior

No issue

pylint --version output

$ pylint --version
pylint 2.5.3
astroid 2.4.2
Python 3.8.5 (default, Jul 21 2020, 10:42:08) 
[Clang 11.0.0 (clang-1100.0.33.17)]
$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants