@@ -252,9 +252,12 @@ def _has_different_parameters_default_value(
252252 if is_same_fn is None :
253253 # If the default value comparison is unhandled, assume the value is different
254254 return True
255- if not is_same_fn (original_default , overridden_default ):
256- # Two args with same type but different values
257- return True
255+ try :
256+ if not is_same_fn (original_default , overridden_default ):
257+ # Two args with same type but different values
258+ return True
259+ except RecursionError :
260+ utils .warn_on_recursion_error ()
258261 return False
259262
260263
@@ -409,6 +412,9 @@ def _has_data_descriptor(cls: nodes.ClassDef, attr: str) -> bool:
409412 except astroid .InferenceError :
410413 # Can't infer, avoid emitting a false positive in this case.
411414 return True
415+ except RecursionError :
416+ utils .warn_on_recursion_error ()
417+ return True
412418 return False
413419
414420
@@ -435,6 +441,9 @@ def _called_in_methods(
435441 bound = next (call .func .infer ())
436442 except (astroid .InferenceError , StopIteration ):
437443 continue
444+ except RecursionError :
445+ utils .warn_on_recursion_error ()
446+ continue
438447 if not isinstance (bound , astroid .BoundMethod ):
439448 continue
440449 func_obj = bound ._proxied
@@ -466,6 +475,9 @@ def _is_attribute_property(name: str, klass: nodes.ClassDef) -> bool:
466475 inferred = next (attr .infer ())
467476 except astroid .InferenceError :
468477 continue
478+ except RecursionError :
479+ utils .warn_on_recursion_error ()
480+ continue
469481 if isinstance (inferred , nodes .FunctionDef ) and decorated_with_property (
470482 inferred
471483 ):
@@ -483,7 +495,11 @@ def _is_attribute_property(name: str, klass: nodes.ClassDef) -> bool:
483495def _has_same_layout_slots (
484496 slots : list [nodes .Const | None ], assigned_value : nodes .Name
485497) -> bool :
486- inferred = next (assigned_value .infer ())
498+ try :
499+ inferred = next (assigned_value .infer ())
500+ except RecursionError :
501+ utils .warn_on_recursion_error ()
502+ return False
487503 if isinstance (inferred , nodes .ClassDef ):
488504 other_slots = inferred .slots ()
489505 if all (
@@ -1278,6 +1294,9 @@ def visit_functiondef(self, node: nodes.FunctionDef) -> None:
12781294 inferred = next (inferred .infer_call_result (inferred ))
12791295 except astroid .InferenceError :
12801296 return
1297+ except RecursionError :
1298+ utils .warn_on_recursion_error ()
1299+ return
12811300 try :
12821301 if (
12831302 isinstance (inferred , (astroid .Instance , nodes .ClassDef ))
@@ -1513,6 +1532,9 @@ def _check_slots(self, node: nodes.ClassDef) -> None:
15131532 self ._check_slots_elt (elt , node )
15141533 except astroid .InferenceError :
15151534 continue
1535+ except RecursionError :
1536+ utils .warn_on_recursion_error ()
1537+ continue
15161538 self ._check_redefined_slots (node , slots , values )
15171539
15181540 def _check_redefined_slots (
@@ -2196,6 +2218,9 @@ def _check_init(self, node: nodes.FunctionDef, klass_node: nodes.ClassDef) -> No
21962218 )
21972219 except astroid .InferenceError :
21982220 continue
2221+ except RecursionError :
2222+ utils .warn_on_recursion_error ()
2223+ continue
21992224 for klass , method in not_called_yet .items ():
22002225 # Check if the init of the class that defines this init has already
22012226 # been called.
@@ -2350,4 +2375,7 @@ def _ancestors_to_call(
23502375 to_call [base_node ] = init_node
23512376 except astroid .InferenceError :
23522377 continue
2378+ except RecursionError :
2379+ utils .warn_on_recursion_error ()
2380+ continue
23532381 return to_call
0 commit comments