Skip to content

gh-161364: Mark Setup.bootstrap's modules with a *bootstrap* line - #161734

Merged
itamaro merged 4 commits into
python:mainfrom
aozmekik:gh-161364-bootstrap-marker
Nov 10, 2026
Merged

itamaro merged 4 commits into
python:mainfrom
aozmekik:gh-161364-bootstrap-marker

Conversation

@aozmekik

@aozmekik aozmekik commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

When make finds the Makefile out of date, it regenerates it with the rule of the Makefile it has already loaded. If that Makefile is from before gh-160689 (after a git pull, or when an in-tree build is switched from 3.15), its rule calls makesetup without -b, so BOOTSTRAP_MODOBJS comes out empty and Programs/_freeze_module fails to link with the undefined PyErr_CheckSignals from the issue. The new Makefile is then newer than its inputs, so it stays broken until something regenerates it again, like touching Makefile.pre.in.

This adds a *bootstrap* line to Setup.bootstrap.in. makesetup already handles that line the same way as -b (-b just emits it), so the modules are marked as bootstrap modules whichever rule regenerates the Makefile. check_extension_modules.py skips the line like *noconfig*; without that, the module check reports a module named *bootstrap* that fails to import.

Tested by building in-tree at the parent of 0e35313 and at 3.15, then checking out this branch or main and running make:

  • main: _freeze_module fails to link, BOOTSTRAP_MODOBJS is empty, and a second make still fails
  • this branch: the build passes, BOOTSTRAP_MODOBJS has the modules, and a second make doesn't regenerate the Makefile

A fresh build checks the same 116 modules as main. The old rule still only moves config.c, so after such a switch a config_bootstrap.c is left in the build directory until the Makefile is regenerated by the new rule.

cc @itamaro since this comes from gh-160689.

The rule of a Makefile from before pythongh-160689 regenerates the Makefile by
calling makesetup without -b. That left BOOTSTRAP_MODOBJS empty, and
Programs/_freeze_module failed to link until the Makefile was regenerated
again. A *bootstrap* line in Setup.bootstrap.in marks the modules either
way.

@itamaro itamaro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, thanks for fixing it!

see one inline comments for inline comment wording nits. also I think this doesn't really need a NEWS entry, so if you're pushing a comment edit, consider also dropping the NEWS entry (unless you feel strongly it's needed :) )

Comment thread Modules/Setup.bootstrap.in Outdated
Comment on lines +3 to +6
# These are the bootstrap modules, which makesetup gets with -b. The line
# below says so as well, for the recipe of a Makefile from before -b
# existed, which passes this file without it (gh-161364).
*bootstrap*

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wording nits

Suggested change
# These are the bootstrap modules, which makesetup gets with -b. The line
# below says so as well, for the recipe of a Makefile from before -b
# existed, which passes this file without it (gh-161364).
*bootstrap*
# Mark bootstrap modules explicitly so older Makefile recipes work
# without passing -b to makesetup (gh-161364).
*bootstrap*

@bedevere-app

bedevere-app Bot commented Nov 10, 2026

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@itamaro itamaro added skip news build The build process and cross-build labels Nov 10, 2026
@aozmekik

Copy link
Copy Markdown
Contributor Author

Thanks! I took your wording and dropped the NEWS entry, so this will need the skip news label.

I have made the requested changes; please review again

@bedevere-app

bedevere-app Bot commented Nov 10, 2026

Copy link
Copy Markdown

Thanks for making the requested changes!

@itamaro: please review the changes made to this pull request.

@bedevere-app
bedevere-app Bot requested a review from itamaro November 10, 2026 17:27

@itamaro itamaro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the fix!

@itamaro
itamaro enabled auto-merge (squash) November 10, 2026 17:30
@itamaro
itamaro merged commit 44ff6c9 into python:main Nov 10, 2026
64 of 67 checks passed
orsenthil pushed a commit to orsenthil/cpython that referenced this pull request Nov 12, 2026
…line (python#161734)

An existing Makefile can regenerate itself using an older recipe that
invokes `makesetup` without `-b`. This leaves `BOOTSTRAP_MODOBJS`
empty and causes `Programs/_freeze_module` to fail to link.

Add a `*bootstrap*` marker to `Setup.bootstrap.in` so both old
and new recipes identify the bootstrap modules correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build The build process and cross-build skip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants