test: consolidate GIL subprocess runs (#6212)
* test: batch GIL subprocess checks while preserving first-use coverage
Run all 17 basic cases in three subprocess batches: the child's main
thread, eight sequential workers per case, and eight parallel workers
per case. Keep two isolated cross-module initialization cases in each
mode to exercise first use with the GIL held and released. Later cases
in a batch intentionally share interpreter state.
Remove the separate one-worker parametrization, which is covered by
the first sequential worker. Each case still creates fresh workers;
there is no persistent thread pool. Keep the factory-construction
regression and subprocess-harness checks separate.
Track the current case in shared memory so failures identify it without
printing progress on successful runs. Allow another execution interval
when a batch advances to a new case, retaining at least ten seconds for
each case rather than imposing a ten-second budget on the whole batch.
A deadlock can take one additional interval to detect.
This reduces child processes from 71 to 12. A serial CPython 3.14.4 run
of test_gil_scoped.py took 3.97 seconds, down from 18.74 seconds before
consolidation, including the new worker-exception regression tests.
* test: use a pipe for GIL subprocess progress
The shared ctypes progress counter can raise FileExistsError before
starting a child process on Windows PyPy (pypy/pypy#3488). Replace it
with a one-way pipe carrying the current case index.
Keep the progress callback in the parent, drain pending messages for
failure diagnostics, and retain the last index after EOF. Close both
endpoints after subprocess cleanup. This preserves the batched cases
and their progress-aware execution allowance.
Add a regression that makes multiprocessing.Value raise the same error
and verifies that a subprocess batch still succeeds. The regression
fails against the previous helper.
1 file changed