Pylint: False positive: calling super on bases base class is shown as error

Created on 4 May 2019  路  8Comments  路  Source: PyCQA/pylint

Steps to reproduce

  1. Make an empty folder and create the file test.py with this content:
    image
  2. 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

pylint 2.3.1 astroid 2.2.5 Python 3.7.3 (default, Mar 26 2019, 21:43:19) [GCC 8.2.1 20181127]

invalid

All 8 comments

@Bergiu At line 17 you are supposed to pass C to super(), notB. By passingByou basically ask a MRO navigation starting from B instead of C for finding thesomething` method.

But I want it to start at B, so that I get the something method from A.

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?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PCManticore picture PCManticore  路  3Comments

DGalt picture DGalt  路  3Comments

thanatos picture thanatos  路  3Comments

elirnm picture elirnm  路  3Comments

mrginglymus picture mrginglymus  路  3Comments