Preflight functools.partial keyword index allocations
Fixes #921.
functools.partial builds a keyword-name index once it has more than eight bound keywords. Previously, building that index copied every name without checking the configured memory budget. Nine large names under a 12 MiB limit could terminate the worker instead of returning a sandbox MemoryError.
Preflight the index's name copies and table allocation before building it, including spare buckets, rounding and control bytes, and check new-name/table growth while merging. If the preflight rejects a merge, release the arguments that have not been transferred yet. This keeps the existing indexed merge behavior when memory is available. Document the preflight in the resource-limit guide and limitations page.
Validation: the new subprocess regression fails on the original code and passes with the fix, including a 32 MiB successful control and a memory-model-checks worker build. All 67 pool integration tests and four Monty/CPython functools.partial data tests pass. Nightly formatting, Markdown formatting and targeted Clippy checks pass. The repository-wide make lint-rs is blocked on an unchanged stable_heap.rs warning from local Clippy 1.96; the targeted Clippy runs excluded that and other unchanged baseline warnings.
AI assistance disclosure: OpenAI Codex helped prepare the implementation, regression test and this description.
Summary by cubic
Preflights functools.partial's keyword-name index allocations so an oversized index raises a sandbox MemoryError instead of terminating the worker at the hard memory limit.
- Counts name-copy bytes and table space (spare buckets, power-of-two rounding and control bytes) before the first allocation, and checks the same growth when a merge adds a new name.
- Releases incoming arguments not yet transferred when a preflight rejects a merge.
- Adds a subprocess regression test that fails on the original code, passing under a 12 MiB budget and a 32 MiB control, and documents the preflight in both resource-limit docs.