From f44c355297030ce2da35155d0ca0f6e19a0a8c5f Mon Sep 17 00:00:00 2001 From: Ahmed Semih Ozmekik Date: Tue, 10 Nov 2026 09:31:01 +0300 Subject: [PATCH 1/4] gh-161364: Mark Setup.bootstrap's modules with a *bootstrap* line The rule of a Makefile from before gh-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. --- .../Build/2026-11-10-12-00-00.gh-issue-161364.Z4xcfP.rst | 4 ++++ Modules/Setup.bootstrap.in | 5 +++++ Modules/makesetup | 3 ++- 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Build/2026-11-10-12-00-00.gh-issue-161364.Z4xcfP.rst diff --git a/Misc/NEWS.d/next/Build/2026-11-10-12-00-00.gh-issue-161364.Z4xcfP.rst b/Misc/NEWS.d/next/Build/2026-11-10-12-00-00.gh-issue-161364.Z4xcfP.rst new file mode 100644 index 000000000000000..e7c274ed978a48e --- /dev/null +++ b/Misc/NEWS.d/next/Build/2026-11-10-12-00-00.gh-issue-161364.Z4xcfP.rst @@ -0,0 +1,4 @@ +Fix ``Programs/_freeze_module`` failing to link with undefined symbols after +the Makefile is regenerated by the rule of a Makefile from before +:gh:`160689`, for example after ``git pull`` or when switching a build +directory from 3.15. diff --git a/Modules/Setup.bootstrap.in b/Modules/Setup.bootstrap.in index 65a1fefe72e92ec..be3d4cbe7c1e496 100644 --- a/Modules/Setup.bootstrap.in +++ b/Modules/Setup.bootstrap.in @@ -1,5 +1,10 @@ # -*- makefile -*- +# 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* + # --- # Built-in modules required to get a functioning interpreter; # cannot be built as shared! diff --git a/Modules/makesetup b/Modules/makesetup index 932c0952e4781da..4b2d4fad02e10b4 100755 --- a/Modules/makesetup +++ b/Modules/makesetup @@ -19,7 +19,8 @@ set -e # The Setup file following a -b option holds the *bootstrap* modules: # the static modules that the build helper programs (_freeze_module, # _bootstrap_python) are linked with. They are also regular modules of -# the final build. +# the final build. A *bootstrap* line in a Setup file does the same for +# the rest of that file. # Setup files after a -n option are used for their variables, modules # and libraries but not for their .o files. # From 754589c84e261afb2a2863777e92c25c26820da8 Mon Sep 17 00:00:00 2001 From: Ahmed Semih Ozmekik Date: Tue, 10 Nov 2026 09:38:43 +0300 Subject: [PATCH 2/4] Skip the *bootstrap* line in check_extension_modules.py --- Tools/build/check_extension_modules.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/build/check_extension_modules.py b/Tools/build/check_extension_modules.py index c619a9a0c1c5a1b..e907442b61ea22f 100644 --- a/Tools/build/check_extension_modules.py +++ b/Tools/build/check_extension_modules.py @@ -421,7 +421,7 @@ def parse_setup_file(self, setup_file: pathlib.Path) -> Iterable[ModuleInfo]: state = ModuleState.BUILTIN case ["*disabled*"]: state = ModuleState.DISABLED - case ["*noconfig*"]: + case ["*noconfig*"] | ["*bootstrap*"]: continue case [*items]: if state == ModuleState.DISABLED: From 8f344ce07cb07a47b56682a433989c71dae4eaf0 Mon Sep 17 00:00:00 2001 From: Ahmed Semih Ozmekik Date: Tue, 10 Nov 2026 10:42:36 +0300 Subject: [PATCH 3/4] Re-run CI (a Windows arm64 free-threading test run timed out) From be93705dee76e7ce32d6091f5cd1c4637204b880 Mon Sep 17 00:00:00 2001 From: Ahmed Semih Ozmekik Date: Tue, 10 Nov 2026 20:26:17 +0300 Subject: [PATCH 4/4] Apply the comment wording from review and drop the NEWS entry --- .../Build/2026-11-10-12-00-00.gh-issue-161364.Z4xcfP.rst | 4 ---- Modules/Setup.bootstrap.in | 5 ++--- 2 files changed, 2 insertions(+), 7 deletions(-) delete mode 100644 Misc/NEWS.d/next/Build/2026-11-10-12-00-00.gh-issue-161364.Z4xcfP.rst diff --git a/Misc/NEWS.d/next/Build/2026-11-10-12-00-00.gh-issue-161364.Z4xcfP.rst b/Misc/NEWS.d/next/Build/2026-11-10-12-00-00.gh-issue-161364.Z4xcfP.rst deleted file mode 100644 index e7c274ed978a48e..000000000000000 --- a/Misc/NEWS.d/next/Build/2026-11-10-12-00-00.gh-issue-161364.Z4xcfP.rst +++ /dev/null @@ -1,4 +0,0 @@ -Fix ``Programs/_freeze_module`` failing to link with undefined symbols after -the Makefile is regenerated by the rule of a Makefile from before -:gh:`160689`, for example after ``git pull`` or when switching a build -directory from 3.15. diff --git a/Modules/Setup.bootstrap.in b/Modules/Setup.bootstrap.in index be3d4cbe7c1e496..1d1de43fd8f05b4 100644 --- a/Modules/Setup.bootstrap.in +++ b/Modules/Setup.bootstrap.in @@ -1,8 +1,7 @@ # -*- makefile -*- -# 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). +# Mark bootstrap modules explicitly so older Makefile recipes work +# without passing -b to makesetup (gh-161364). *bootstrap* # ---