[PR #2330] pool_workers: handle jobs=None without TypeError when MAX_PROCESS_WORKERS is set #2334

Open
opened 2026-11-26 21:20:52 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2330
Author: @narekshaghoyandev
Created: 11/26/2026
Status: 🔄 Open

Base: main ← Head: ubiq-pool-workers-none-jobs


📝 Commits (1)

  • 8507804 pool_workers: handle jobs=None without TypeError when MAX_PROCESS_WORKERS is set

📊 Changes

2 files changed (+12 additions, -0 deletions)

View changed files

📝 tests/test_pool_workers.py (+10 -0)
📝 tools/pool_workers.py (+2 -0)

📄 Description

Fixes a TypeError in tools/pool_workers.py:process_workers(jobs) when jobs is None and MAX_PROCESS_WORKERS is set (Windows):

  • ProcessPoolExecutor(max_workers=None) and multiprocessing.Pool(None) accept None to mean os.cpu_count(). Previously, process_workers(None) called min(None, 61) on Windows and raised TypeError.
  • When jobs is None, return None if MAX_PROCESS_WORKERS is None, otherwise min(os.cpu_count() or 1, MAX_PROCESS_WORKERS).
  • Added ProcessWorkersTest.test_none_jobs_respects_platform_limit in tests/test_pool_workers.py.

Verification

  • python3 -I -m py_compile tools/pool_workers.py tests/test_pool_workers.py passed
  • python3 -I tests/test_pool_workers.py -v passed (12 tests, 2 Windows-only skipped)
  • Negative control: new test failed with TypeError (exit 1) against unmodified ubiq/main
  • python3 -I scripts/check_no_game_data.py tools/pool_workers.py tests/test_pool_workers.py clean

Claimed in the coordination issue as: TOOLS-POOL-WORKERS-NONE-JOBS (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7193958665)
AI-assisted: yes (Gemini)


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/2330 **Author:** [@narekshaghoyandev](https://github.com/narekshaghoyandev) **Created:** 11/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `ubiq-pool-workers-none-jobs` --- ### 📝 Commits (1) - [`8507804`](https://github.com/ubiquitarianism/leonida/commit/850780469df3702fd3ecfdac2c053d18919c6240) pool_workers: handle jobs=None without TypeError when MAX_PROCESS_WORKERS is set ### 📊 Changes **2 files changed** (+12 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_pool_workers.py` (+10 -0) 📝 `tools/pool_workers.py` (+2 -0) </details> ### 📄 Description Fixes a `TypeError` in `tools/pool_workers.py:process_workers(jobs)` when `jobs is None` and `MAX_PROCESS_WORKERS` is set (Windows): - `ProcessPoolExecutor(max_workers=None)` and `multiprocessing.Pool(None)` accept `None` to mean `os.cpu_count()`. Previously, `process_workers(None)` called `min(None, 61)` on Windows and raised `TypeError`. - When `jobs is None`, return `None` if `MAX_PROCESS_WORKERS is None`, otherwise `min(os.cpu_count() or 1, MAX_PROCESS_WORKERS)`. - Added `ProcessWorkersTest.test_none_jobs_respects_platform_limit` in `tests/test_pool_workers.py`. ### Verification - `python3 -I -m py_compile tools/pool_workers.py tests/test_pool_workers.py` passed - `python3 -I tests/test_pool_workers.py -v` passed (12 tests, 2 Windows-only skipped) - Negative control: new test failed with `TypeError` (exit 1) against unmodified `ubiq/main` - `python3 -I scripts/check_no_game_data.py tools/pool_workers.py tests/test_pool_workers.py` clean Claimed in the coordination issue as: TOOLS-POOL-WORKERS-NONE-JOBS (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7193958665) AI-assisted: yes (Gemini) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#2334
No description provided.