pool_workers: handle jobs=None without TypeError when MAX_PROCESS_WORKERS is set #2330
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!2330
Loading…
Reference in a new issue
No description provided.
Delete branch "ubiq-pool-workers-none-jobs"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull request successfully merged and closed
Fixes a
TypeErrorintools/pool_workers.py:process_workers(jobs)whenjobs is NoneandMAX_PROCESS_WORKERSis set (Windows):ProcessPoolExecutor(max_workers=None)andmultiprocessing.Pool(None)acceptNoneto meanos.cpu_count(). Previously,process_workers(None)calledmin(None, 61)on Windows and raisedTypeError.jobs is None, returnNoneifMAX_PROCESS_WORKERS is None, otherwisemin(os.cpu_count() or 1, MAX_PROCESS_WORKERS).ProcessWorkersTest.test_none_jobs_respects_platform_limitintests/test_pool_workers.py.Verification
python3 -I -m py_compile tools/pool_workers.py tests/test_pool_workers.pypassedpython3 -I tests/test_pool_workers.py -vpassed (12 tests, 2 Windows-only skipped)TypeError(exit 1) against unmodifiedubiq/mainpython3 -I scripts/check_no_game_data.py tools/pool_workers.py tests/test_pool_workers.pycleanClaimed in the coordination issue as: TOOLS-POOL-WORKERS-NONE-JOBS (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7193958665)
AI-assisted: yes (Gemini)
Tested commit 850780469 on Windows 11 (build 26300.9974) with Python 3.12. I ran py -3.12 -I tests/test_pool_workers.py -v from the PR worktree.
All 12 tests passed in 1.689 seconds, with 0 skipped and exit code 0. test_none_jobs_respects_platform_limit passed, and both Windows-only tests ran successfully: test_world_build_run_jobs and test_world_lights_paths_scan.
I ran the tests locally. AI-assisted setup and reporting.
Approving 850780469.
process_workers(None)on Windows used to callmin(None, 61)and raiseTypeError; it now returnsmin(os.cpu_count() or 1, 61), the count a pool givenNonewould pick, capped as before, andNonewhere there is no cap.Merged onto
maind1dff7949together with #2403, #2410, #2299, #2297 and #2286 (no conflicts), on Linux with Python 3.13.tests/test_pool_workers.py: 10 passed, 2 skipped (main: 9). AI-assisted (Claude Code, Claude Opus 5.5).#2330 | head
850780469df3702fd3ecfdac2c053d18919c6240|python3 -I tests/test_pool_workers.py -v,py -3.12 -I tests/test_pool_workers.py -v| red: Linux 12 run, 1 error, 2 skips / Windows 12 run, 1 error | green: Linux 10 passed, 2 skipped / Windows 12 passed | Baseline exception → passThe new jobs=None case raised TypeError on main. I repeated the full file on native Windows so both platform-specific process-pool cases ran.
Pinned main
33db04a7010e81c40a7a6a15624525aa0c4a3a58, merged into this PR head. Ubuntu 26.04.1 (WSL2), Python 3.14.4 and Windows 11 Pro, Python 3.12.10. Full suite: not run. AI-assisted: OpenAI Codex. Batch claim.Merged, thank you @narekshaghoyandev!
What it does: pool_workers: handle jobs=None without TypeError when MAX_PROCESS_WORKERS is set
How it was checked: sodove tested this PR at head
850780469on main33db04a70: the PR's own test fails on main and passes with this PR merged in (his result is linked from the batch summary in #1608). We then re-ran the same test locally on Windows 11 and got the same verdict: on main, red (1 error); with the PR, green (12 OK).CI: the red jobs on this PR fail the same way on main, or on the older main it was built on (the
cs_dpp_cmp.asmtranslator fixture, since fixed on main, and the Windows runner's Visual Studio setup), so none comes from this change.Merged one by one with 20 other PRs of the same reviewed batch, pinned to the tested head.
AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.