Repository navigation
Conversation
itamaro
force-pushed
the
build-helpers-bootstrap-only
branch
3 times, most recently
from
October 26, 2026 00:19
4ecc0a8 to
3af290e
Compare
…r programs
Programs/_freeze_module and _bootstrap_python were linked with
$(LIBRARY_OBJS_OMIT_FROZEN), i.e. every static module from all Setup
files (Setup.local, Setup.stdlib with MODULE_BUILDTYPE=static, ...).
That makes it impossible for a builtin module to depend on anything the
helpers produce: a frozen module header, Modules/getpath.o, or generated
sources. A Setup.local module including a header generated by
$(FREEZE_MODULE) is a dependency cycle ("Circular ... dependency
dropped"), and one referencing a getpath.o symbol fails to link, since
_freeze_module links Modules/getpath_noop.o instead. CPython itself
needed a workaround for the latter: a stub of
_Py_Get_Getpath_CodeObject() in getpath_noop.c for _testinternalcapi
in MODULE_BUILDTYPE=static builds.
Mirror what PCbuild/_freeze_module.vcxproj already does on Windows
(a fixed source list plus PC/config_minimal.c): link the helpers with
the core objects plus the modules of Modules/Setup.bootstrap only.
* makesetup: new "-b Setup" option marking a Setup file as the bootstrap
modules. Their objects and libraries are substituted for
_BOOTSTRAP_MODOBJS_ / _BOOTSTRAP_MODLIBS_, and a second table,
config_bootstrap.c, is generated with only those modules. A bootstrap
module overridden by an earlier rule (Setup.local) keeps the
overriding static module for the helpers too.
* Makefile.pre.in: BOOTSTRAP_LIBRARY_OBJS (core + Modules/config_bootstrap.o
+ $(BOOTSTRAP_MODOBJS)) replaces LIBRARY_OBJS_OMIT_FROZEN in the
_freeze_module and _bootstrap_python links. getbuildinfo gets a
separate object for the helpers, as its prerequisites include
$(MODOBJS).
* configure.ac / configure: pass -b Modules/Setup.bootstrap and move
config_bootstrap.c into Modules/ (configure hand-edited in sync).
* Tools/c-analyzer: whitelist _PyImport_Inittab in the generated
Modules/config_bootstrap.c, as for Modules/config.c.
The final libpython/python link is unchanged.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YD8kPnXaAMJZk2LvSHPXYA
itamaro
force-pushed
the
build-helpers-bootstrap-only
branch
from
October 26, 2026 00:25
3af290e to
ebc936d
Compare
itamaro
marked this pull request as ready for review
October 26, 2026 01:03
itamaro
requested review from
AA-Turner,
corona10,
emmatyping,
ericsnowcurrently and
erlend-aasland
as code owners
October 26, 2026 01:03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The build-helper programs (
Programs/_freeze_moduleand_bootstrap_python) don't need to link extension modules that they don't need.This PR makes sure the helper programs get only the modules they need to do their job, regardless of what the build configuration sets for the final built runtime and interpreter.
This follows the same pattern as what
PCbuild/_freeze_module.vcxprojdoes withPC/config_minimal.c, and lets "extra" builtin modules (fromSetup.localorMODULE_BUILDTYPE=static) depend on frozen modules orgetpath.Written with assistance from Claude Fable 5.1
_freeze_modulelinks every static module #160689