File tree 1 file changed +2
-4
lines changed
1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ def _has_abstract_methods(node: nodes.ClassDef) -> bool:
78
78
return len (utils .unimplemented_abstract_methods (node )) > 0
79
79
80
80
81
- def _new_correctly_implemented (node : nodes .ClassDef ) -> bool :
81
+ def _new_instantiates_super (node : nodes .ClassDef ) -> bool :
82
82
"""Check if node implements `__new__`.
83
83
84
84
If `__new__` is implemented, check if it calls `super().__new__(cls)`.
@@ -87,8 +87,6 @@ def _new_correctly_implemented(node: nodes.ClassDef) -> bool:
87
87
return False
88
88
89
89
new = next (node .igetattr ("__new__" ))
90
- if not isinstance (new , astroid .UnboundMethod ):
91
- return False
92
90
93
91
calls = new .nodes_of_class (
94
92
nodes .Call , skip_klass = (nodes .FunctionDef , nodes .ClassDef )
@@ -498,7 +496,7 @@ def _check_inferred_class_is_abstract(
498
496
return
499
497
500
498
if metaclass .qname () in ABC_METACLASSES :
501
- if _new_correctly_implemented (inferred ):
499
+ if _new_instantiates_super (inferred ):
502
500
# A class that implements `__new__` without calling `super().__new__(cls)`
503
501
# should not emit the message.
504
502
return
You can’t perform that action at this time.
0 commit comments