-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Labels
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
class A(list):
def __contains__(self, item):
print("do some special checks")
return super().__contains__(item) # raises unnecessary-dunder-callConfiguration
No response
Command used
pylint a.pyPylint output
************* Module a
a.py:4: [C2801(unnecessary-dunder-call), A.__contains__] Unnecessarily calls dunder method __contains__. Use in keyword.Expected behavior
No message, since the example cannot be rewritten as return item in super():
TypeError: argument of type 'super' is not iterable
This wasn't happening for __init__ because it was allow-listed, but I think all dunder methods could be overridden in subclasses, so they all need to be made compatible with super().__...
Pylint version
pylint 2.14.0-dev0
astroid 2.12.0-dev0
Python 3.10.2 (v3.10.2:a58ebcc701, Jan 13 2022, 14:50:16) [Clang 13.0.0 (clang-1300.0.29.30)]OS / Environment
No response
Additional dependencies
No response
DanielNoord and cdce8p
Metadata
Metadata
Assignees
Labels
False Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the code