https://github.com/python/cpython/commit/dd1194e2fc2c08c36f4fe7ee71f7ab0b82c09570
commit: dd1194e2fc2c08c36f4fe7ee71f7ab0b82c09570
branch: main
author: Serhiy Storchaka <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2026-08-13T18:08:45+03:00
summary:

gh-109817: Do not copy all test cases into the worker process (GH-155713)

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.

files:
M Lib/test/libregrtest/runtests.py

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)
 

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to