Skip to content

Commit

Permalink
Handle ambiguous inference
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtylerwalls committed Jul 15, 2024
1 parent 27ba1f8 commit 95b6e8b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pylint/checkers/refactoring/refactoring_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -2030,12 +2030,13 @@ def _is_node_return_ended(self, node: nodes.NodeNG) -> bool:
if isinstance(node, nodes.Return):
return True
if isinstance(node, nodes.Call):
try:
funcdef_node = node.func.inferred()[0]
if self._is_function_def_never_returning(funcdef_node):
return True
except astroid.InferenceError:
pass
return any(
(
isinstance(maybe_func, (nodes.FunctionDef, bases.BoundMethod))
and self._is_function_def_never_returning(maybe_func)
)
for maybe_func in utils.infer_all(node.func)
)
if isinstance(node, nodes.While):
# A while-loop is considered return-ended if it has a
# truthy test and no break statements
Expand Down

0 comments on commit 95b6e8b

Please sign in to comment.