[Bugfix] The light/full stdlib preset filter is unreachable dead code — and produces an unbootable interpreter if revived #399
Labels
No labels
Alpha Release Requirement
Bugfix
Demo Target
Documentation
Major Feature
Minor Feature
priority:tier1-active
priority:tier2-foundation
priority:tier3-future
priority:tier4-deferred
Refactoring & Cleanup
system:animation
system:documentation
system:grid
system:input
system:performance
system:procgen
system:python-binding
system:rendering
system:ui-hierarchy
Tiny Feature
workflow:blocked
workflow:needs-benchmark
workflow:needs-documentation
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
john/McRogueFace#399
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Summary
tools/stdlib_modules.yaml+tools/package_stdlib.pydescribe a light/full split of the Python standard library. Neither preset is actually applied to any shipped package, and thefullpreset — the one CLAUDE.md advertises as "includes networking, async, debugging modules" — cannot even importasyncioif you do apply it.Found while gating the "the shipped interpreter can do sockets/asyncio from a background thread" guarantee (see the packaging test added alongside this issue).
1. The filter is never invoked
tools/package.shdefinescreate_stdlib_zip()(:91-103), which is the only caller ofpackage_stdlib.py. Nothing callscreate_stdlib_zip. Confirmed:Instead,
package_linux()copies the entire stdlib regardless of preset (tools/package.sh:296-301):package_windows()has the same shape (:177-195). Sopackage-linux-lightandpackage-linux-fullship byte-identical stdlibs; the only real filtering is the hardcodedrm -rflist right below (test/, idlelib/, tkinter/, ...). The documented ~25MB vs ~26MB split does not exist as a mechanism.2. The
fullpreset is broken if revivedMaterializing the
fullpreset's module list against__lib/Python/Liband booting the packaged engine against it:Two distinct gaps found so far:
contextvarsis in no category at all, so it is in neither preset.asyncioimports it unconditionally —fulltherefore cannot importasyncio, which is the single headline module the preset exists to provide._py_warningsis in no category. In CPython 3.14warnings.pydelegates to it, socoreitself is incomplete — every preset, light included, fails to importwarnings, and with itssl,asyncioand much of the stdlib.The
_py_warningscase in particular means the module lists were written against an older CPython and have never been validated against the 3.14 tree actually shipped. There are likely more; the list should be derived and checked, not hand-maintained.Why it matters
The categorization reads as a live contract — CLAUDE.md cites it, and a future edit "tidying up" the
network:/async:categories would look effective while changing nothing, or would silently break everything the day someone wires the filter up. Either way the failure surfaces far from the edit.Suggested resolution
Pick one and make it true:
create_stdlib_zip()and either droppackage_stdlib.py/stdlib_modules.yamlor clearly mark them unused. Document that all packages ship the full stdlib minus the hardcodedrm -rflist.package_linux()/package_windows(), fix the missing modules, and gate each preset with a boot test that imports a representative module set from the packaged artifact.Option 2 needs a real dependency-closure step (walk imports from the seed list) rather than a hand-written module list, or it will drift again.
Current state of the guarantee
make package-linux-fulldoes ship workingsocket,ssl,asyncioandselectorstoday — verified from the extracted artifact, resolving out of the package's ownlib/Python/Lib— but only because the preset is ignored and the whole stdlib is copied.tests/packaging/network_stdlib_packaged_test.pynow gates that outcome regardless of which resolution above is chosen.Related