summaryrefslogtreecommitdiff
path: root/pylint/checkers/variables.py
diff options
context:
space:
mode:
Diffstat (limited to 'pylint/checkers/variables.py')
-rw-r--r--pylint/checkers/variables.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/pylint/checkers/variables.py b/pylint/checkers/variables.py
index f55b71264..79d9ded08 100644
--- a/pylint/checkers/variables.py
+++ b/pylint/checkers/variables.py
@@ -2602,6 +2602,16 @@ class VariablesChecker(BaseChecker):
argnames = node.argnames()
# Care about functions with unknown argument (builtins)
if name in argnames:
+ if node.name == "__new__":
+ is_init_def = False
+ # Look for the `__init__` method in all the methods of the same class.
+ for n in node.parent.get_children():
+ is_init_def = hasattr(n, "name") and (n.name == "__init__")
+ if is_init_def:
+ break
+ # Ignore unused arguments check for `__new__` if `__init__` is defined.
+ if is_init_def:
+ return
self._check_unused_arguments(name, node, stmt, argnames, nonlocal_names)
else:
if stmt.parent and isinstance(