Skip to content

Commit 371fcc5

Browse files
authored
fix: set fixed paths_list in TreeMatcher init (#2130)
My CI pipeline has encountered this error: ``` .venv/lib/python3.11/site-packages/coverage/inorout.py:354: in should_trace self.set_matchers_depending_on_syspath() .venv/lib/python3.11/site-packages/coverage/inorout.py:308: in set_matchers_depending_on_syspath self.third_match = TreeMatcher(self.third_paths, "third", "Third-party lib", self._debug) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .venv/lib/python3.11/site-packages/coverage/files.py:266: in __init_ for p in paths: E RuntimeError: Set changed size during iteration ``` This seems like a very similar situation to #1733 which was fixed by something similar: 08fc997.
1 parent 8df0d5f commit 371fcc5

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

coverage/files.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,11 @@ def __init__(
260260
caption: str = "",
261261
debug: DebugFn = None,
262262
) -> None:
263-
self.original_paths = human_sorted(paths)
263+
paths_list = list(paths)
264+
self.original_paths = human_sorted(paths_list)
264265
super().__init__(self.original_paths, name=name, caption=caption, debug=debug)
265266
self.paths = []
266-
for p in paths:
267+
for p in paths_list:
267268
ap = abs_file(p)
268269
if ap != p and debug:
269270
debug(f" Normalized {p!r} to {ap!r}")

0 commit comments

Comments
 (0)