Skip to content

Commit

Permalink
fix: get atomic copies of iterables when flushing data. #1733
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat committed Feb 23, 2024
1 parent 4e34571 commit de30a8f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions coverage/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,9 +513,12 @@ def flush_data(self) -> bool:
# these packed ints.
arc_data: Dict[str, List[TArc]] = {}
packed_data = cast(Dict[str, Set[int]], self.data)
for fname, packeds in packed_data.items():

# The list() here and in the inner loop are to get a clean copy
# even as tracers are continuing to add data.
for fname, packeds in list(packed_data.items()):
tuples = []
for packed in packeds:
for packed in list(packeds):
l1 = packed & 0xFFFFF
l2 = (packed & (0xFFFFF << 20)) >> 20
if packed & (1 << 40):
Expand Down

0 comments on commit de30a8f

Please sign in to comment.