From f6d3e88ba5b2dab1720281885c99cdf3ce2844bc Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sat, 14 Aug 2021 19:24:10 -0400 Subject: fix: missing exceptions through with statements in 3.10 aren't considered missing branches. #1205 --- coverage/parser.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'coverage/parser.py') diff --git a/coverage/parser.py b/coverage/parser.py index 8d4e9ffb..8792d0ac 100644 --- a/coverage/parser.py +++ b/coverage/parser.py @@ -556,14 +556,14 @@ class WithBlock(BlockBase): # that need to go through the with-statement while exiting. self.break_from = set() self.continue_from = set() - self.raise_from = set() self.return_from = set() - def _process_exits(self, exits, add_arc, from_set): + def _process_exits(self, exits, add_arc, from_set=None): """Helper to process the four kinds of exits.""" for xit in exits: add_arc(xit.lineno, self.start, xit.cause) - from_set.update(exits) + if from_set is not None: + from_set.update(exits) return True def process_break_exits(self, exits, add_arc): @@ -573,7 +573,7 @@ class WithBlock(BlockBase): return self._process_exits(exits, add_arc, self.continue_from) def process_raise_exits(self, exits, add_arc): - return self._process_exits(exits, add_arc, self.raise_from) + return self._process_exits(exits, add_arc) def process_return_exits(self, exits, add_arc): return self._process_exits(exits, add_arc, self.return_from) @@ -1232,10 +1232,6 @@ class AstArcAnalyzer: self.process_continue_exits( self._combine_finally_starts(with_block.continue_from, with_exit) ) - if with_block.raise_from: - self.process_raise_exits( - self._combine_finally_starts(with_block.raise_from, with_exit) - ) if with_block.return_from: self.process_return_exits( self._combine_finally_starts(with_block.return_from, with_exit) -- cgit v1.2.1