GeezerVison is showing github.com — [3.11] Fix Windows build regen with Python 3.15 as the host Python by ambv · Pull Request #160621 · python/cpython
Conversation
ambv
commented
Oct 24, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Every Windows CI build on the 3.11 branch currently fails in the Build CPython step, independently of the change under test (see e.g. the x64 job on #160572 and the branch push run for e4f63e65a93):
File "D:\a\cpython\cpython\Python\makeopcodetargets.py", line 27, in find_module
return SourceFileLoader(modname, modpath).load_module()
AttributeError: 'SourceFileLoader' object has no attribute 'load_module'. Did you mean '.exec_module' instead of '.load_module'?
Cause.
PCbuild/find_python.bat on 3.11 only probes py -3.10 and py -3.9. The windows-2022 runner image dropped Python 3.10 (the last passing run on Oct 1 still found it), so the script fell through to NuGet and installed the latest pythonx86 package, which is now 3.15.1. Python 3.15 removed Loader.load_module(), and Python/makeopcodetargets.py used it to import Lib/opcode.py. The regen target runs on every fresh checkout, so the build aborts before any test runs. 3.12 is unaffected only because its find_python.bat already probes py -3.13.
Fix.
Python/makeopcodetargets.py: load Lib/opcode.py via importlib.util.spec_from_file_location() + exec_module(); drop the dead imp fallback (as 3.12 did in Remove more deprecated importlib APIs from Python 3.12 #98040). Output verified byte-identical to the checked-in Python/opcode_targets.h under Python 3.9, 3.12 and 3.14 (with -W error).
PCbuild/find_python.bat: extend the py.exe search list to 3.14 3.13 3.12 3.11 3.10 3.9, so CI uses the runner's preinstalled Python instead of whatever NuGet considers latest. Every other script invoked by PCbuild/regen.targets already runs cleanly under 3.14 with -W error.
Infrastructure-only change, no user-visible behavior; skip news applies.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
The windows-2022 GitHub runner image no longer ships Python 3.10, so
PCbuild/find_python.bat fell through to NuGet and installed the latest
pythonx86 package, which is now 3.15.1. Python 3.15 removed
Loader.load_module(), which Python/makeopcodetargets.py used to import
Lib/opcode.py, so the _RegenOpcodes target failed and broke every
Windows CI build on this branch.
Load Lib/opcode.py through importlib.util instead, and extend the py.exe
search list in find_python.bat up to 3.14 so the build picks up the
runner's preinstalled Python rather than whatever NuGet considers latest.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
icanhasmath
pushed a commit
to ActiveState/cpython
that referenced
this pull request
Oct 27, 2026
…ython#160621)
The windows-2022 GitHub runner image no longer ships Python 3.10, so
PCbuild/find_python.bat fell through to NuGet and installed the latest
pythonx86 package, which is now 3.15.1. Python 3.15 removed
Loader.load_module(), which Python/makeopcodetargets.py used to import
Lib/opcode.py, so the _RegenOpcodes target failed and broke every
Windows CI build on this branch.
Load Lib/opcode.py through importlib.util instead, and extend the py.exe
search list in find_python.bat up to 3.14 so the build picks up the
runner's preinstalled Python rather than whatever NuGet considers latest.
Co-authored-by: Claude Fable 5.1 <[email protected]>
(cherry picked from commit 0fc0183)
3.10.22.x: 3.10's py.exe probe accepted 3.9 and 3.8; the new list keeps
3.8 as the floor and prefers 3.14 down to 3.9 first. Build tooling only;
needed so the Windows CI jobs build at all now that the runner falls
through to a Python 3.15 host.
icanhasmath
pushed a commit
to ActiveState/cpython
that referenced
this pull request
Oct 27, 2026
…ython#160621)
The windows-2022 GitHub runner image no longer ships Python 3.10, so
PCbuild/find_python.bat fell through to NuGet and installed the latest
pythonx86 package, which is now 3.15.1. Python 3.15 removed
Loader.load_module(), which Python/makeopcodetargets.py used to import
Lib/opcode.py, so the _RegenOpcodes target failed and broke every
Windows CI build on this branch.
Load Lib/opcode.py through importlib.util instead, and extend the py.exe
search list in find_python.bat up to 3.14 so the build picks up the
runner's preinstalled Python rather than whatever NuGet considers latest.
Co-authored-by: Claude Fable 5.1 <[email protected]>
(cherry picked from commit 0fc0183)
3.10.22.x: 3.10's py.exe probe accepted 3.9 and 3.8; the new list keeps
3.8 as the floor and prefers 3.14 down to 3.9 first. Build tooling only;
needed so the Windows CI jobs build at all now that the runner falls
through to a Python 3.15 host.
icanhasmath
pushed a commit
to ActiveState/cpython
that referenced
this pull request
Oct 28, 2026
…ython#160621)
The windows-2022 GitHub runner image no longer ships Python 3.10, so
PCbuild/find_python.bat fell through to NuGet and installed the latest
pythonx86 package, which is now 3.15.1. Python 3.15 removed
Loader.load_module(), which Python/makeopcodetargets.py used to import
Lib/opcode.py, so the _RegenOpcodes target failed and broke every
Windows CI build on this branch.
Load Lib/opcode.py through importlib.util instead, and extend the py.exe
search list in find_python.bat up to 3.14 so the build picks up the
runner's preinstalled Python rather than whatever NuGet considers latest.
Co-authored-by: Claude Fable 5.1 <[email protected]>
(cherry picked from commit 0fc0183)
3.10.22.x: 3.10's py.exe probe accepted 3.9 and 3.8; the new list keeps
3.8 as the floor and prefers 3.14 down to 3.9 first. Build tooling only;
needed so the Windows CI jobs build at all now that the runner falls
through to a Python 3.15 host.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|