From 18f6aadc1f5a484e97f94aa54267ff2a0c95e237 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Thu, 13 Aug 2026 17:30:13 +0300 Subject: [PATCH] gh-109817: Do not copy all test cases into the worker process With --single-process-per-case, tests and case_groups contain all test cases of the whole run. Copying them for every test case was slow and could produce a too long command line. The worker needs neither. --- Lib/test/libregrtest/runtests.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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)