diff --git a/Lib/test/libregrtest/runtests.py b/Lib/test/libregrtest/runtests.py index fbb04b5b705ece..d86b082fb34a60 100644 --- a/Lib/test/libregrtest/runtests.py +++ b/Lib/test/libregrtest/runtests.py @@ -110,7 +110,10 @@ def copy(self, **override) -> 'RunTests': return RunTests(**state) def create_worker_runtests(self, **override) -> WorkerRunTests: - state = dataclasses.asdict(self) + # Drop the large fields *before* converting: asdict() copies them + # deeply, which is expensive when the whole run has many cases. + state = dataclasses.asdict( + dataclasses.replace(self, tests=(), case_groups=None)) state.update(override) return WorkerRunTests(**state)