Skip to content

Commit

Permalink
fix: make checking for generators with try blocks cheaper
Browse files Browse the repository at this point in the history
  • Loading branch information
rhyn0 committed May 11, 2024
1 parent b89e7df commit 3bd7132
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pylint/checkers/base/function_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def check_handles_generator_exceptions(try_node: nodes.Try) -> bool:
try_with_yield_nodes = [
try_node
for try_node in node.nodes_of_class(nodes.Try)
if list(try_node.nodes_of_class(nodes.Yield))
if any(try_node.nodes_of_class(nodes.Yield))
]
if not try_with_yield_nodes:
# no try blocks at all, so checks after this line do not apply
Expand Down

0 comments on commit 3bd7132

Please sign in to comment.