-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
useless-super-delegation
when overriding Exception
to have different default argument
#7319
Comments
Thank you for opening the issue. I'm going to close as a duplicate of #7287 |
Perhaps this one should be treated separately/re-opened because the behaviour looks different to #7287. (venv310) Marks-MacBook-Air-2:programming markbyrne$ cat ex1.py
class CustomError(Exception):
def __init__(self, a="aa", b="bb", c="cc"):
super().__init__(a, b, c)
print(CustomError().args)
raise CustomError()
(venv310) Marks-MacBook-Air-2:programming markbyrne$ python ex1.py
('aa', 'bb', 'cc')
Traceback (most recent call last):
File "/Users/markbyrne/programming/ex1.py", line 7, in <module>
raise CustomError()
__main__.CustomError: ('aa', 'bb', 'cc') Let me know if any disagreement on re-opening! |
@mbyrnepr2 would you happen to have capacity to have a look if this depends on |
useless-super-delegation
when overriding Exception
to have different default argument
Sure! I should have time later in the day. However if you have an itch to look into it please feel free. |
(Sorry, I was just on a laptop where I didn't feel like cloning astroid to poke around.) I think this explains why builtins like I can pick it up. |
Fab @jacobtylerwalls! |
Bug description
Configuration
No response
Command used
Pylint output
Expected behavior
No error, because this is not a useless super delegation. The method signature is different. A default value has been introduced. (Also discussed in #839 from which the rule was introduced).
Pylint version
OS / Environment
macOS 12.4
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: