Skip to content

Commit 87fb10c

Browse files
committed
code review
1 parent 0163b4f commit 87fb10c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

pylint/checkers/base/basic_error_checker.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def _has_abstract_methods(node: nodes.ClassDef) -> bool:
7878
return len(utils.unimplemented_abstract_methods(node)) > 0
7979

8080

81-
def _new_correctly_implemented(node: nodes.ClassDef) -> bool:
81+
def _new_instantiates_super(node: nodes.ClassDef) -> bool:
8282
"""Check if node implements `__new__`.
8383
8484
If `__new__` is implemented, check if it calls `super().__new__(cls)`.
@@ -87,8 +87,6 @@ def _new_correctly_implemented(node: nodes.ClassDef) -> bool:
8787
return False
8888

8989
new = next(node.igetattr("__new__"))
90-
if not isinstance(new, astroid.UnboundMethod):
91-
return False
9290

9391
calls = new.nodes_of_class(
9492
nodes.Call, skip_klass=(nodes.FunctionDef, nodes.ClassDef)
@@ -498,7 +496,7 @@ def _check_inferred_class_is_abstract(
498496
return
499497

500498
if metaclass.qname() in ABC_METACLASSES:
501-
if _new_correctly_implemented(inferred):
499+
if _new_instantiates_super(inferred):
502500
# A class that implements `__new__` without calling `super().__new__(cls)`
503501
# should not emit the message.
504502
return

0 commit comments

Comments
 (0)