-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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: calling super on bases base class is shown as error #2903
Comments
@Bergiu At line 17 you are supposed to pass |
But I want it to start at B, so that I get the |
Can you reopen the issue @PCManticore, or am I getting something wrong? |
What is the difference between lines 15 and 17? Why is 15 ok and 17 bad? |
the method is called in line 17. |
No sorry I mean from the perspective of pylint. If 17 is flagged then 15 should be too. I was trying to do the same thing you were and I couldn't understand why pylint considered this bad code. It works as I intend but I have been having trouble finding why its considered bad practice |
Yes |
Came across this while making a project which has the same structure as your code and can't understand why it's considered a bad-super-call. Isn't that the use of super? |
Re-opening this because we found ourselves that it is probably better to do consider this a false positive. If anybody feels like implementing this I think we would be more than happy to review and put this in one of the next releases! For reference see the small discussion in: |
For reference and testing: class Parent:
def __init__(self):
print("Parent")
class Child(Parent):
def __init__(self):
print("Child")
super().__init__()
class GrandChild(Child):
def __init__(self):
print("Grandchild")
super(Child, self).__init__() # should not emit 'bad-super-call'!
GrandChild() |
For reference: discussion about future usefulness of check: pylint-dev/astroid#1217 (comment) |
Steps to reproduce
pylint test.py
Current behavior
Executing the code works, but a false positive error is shown.
E1003: Bad first argument 'B' given to super() (bad-super-call)
Expected behavior
Pylint shouldn't show this error.
pylint --version output
The text was updated successfully, but these errors were encountered: