-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Bug 🪲False Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the code
Milestone
Description
Bug description
"""Produces 'bad-super-call'."""
class ClassB:
"Dummy B."
def whoami(self):
"""Print Name"""
print("I am B")
class ClassC:
"Dummy C."
def whoami(self):
"""Print Name"""
print("hello? this is C.")
class ClassD(ClassB, ClassC):
"Dummy D."
def greet(self):
"""Print Name"""
super(ClassB, self).whoami()
d = ClassD()
d.greet()
d.whoami()
Configuration
`super(ClassB, self).whoami()`
Command used
pylint test.py
Pylint output
...
test.py:25:8: E1003: Bad first argument 'ClassB' given to super() (bad-super-call)
...
Expected behavior
Hi!
This is similar to #2903, but the major difference is multiple inheritance. I hope the example makes sense from a code design perspective (if not just imagine that classB and classC inherit from an ABC that has the whoami
method as an abstractmethod).
As far as I can tell, the flagged call to super is valid and the only way to actually call the whoami
function of ClassC
on ClassD
instances.
Of course, in this example, switching the order of inheritance would be a simple solution, but just assume that based on other (not included) methods, the inheritance order has to be this way.
Thanks
Pylint version
pylint 2.10.3-dev0
astroid 2.7.2
Python 3.9.6 (default, Jun 30 2021, 10:22:16)
[GCC 11.1.0]
OS / Environment
Linux 5.13.12-arch1-1 #1 SMP PREEMPT Wed, 18 Aug 2021 20:49:03 +0000 x86_64 GNU/Linux
Additional dependencies
No response
Metadata
Metadata
Assignees
Labels
Bug 🪲False Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the code