Skip to content

gh-136267: Use the target configuration in build-details.json - #161529

Merged
itamaro merged 1 commit into
python:mainfrom
itamaro:gh-136267-target-build-details
Nov 18, 2026
Merged

itamaro merged 1 commit into
python:mainfrom
itamaro:gh-136267-target-build-details

Conversation

@itamaro

@itamaro itamaro commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

With --with-build-python, generate-build-details.py runs on an interpreter other than the one being built. abi.flags, suffixes.extensions, abi.stable_abi_suffix and supports_isolated_interpreters came from sys and importlib, so they described the build interpreter. This reads them from sysconfig instead. The suffix list is rebuilt the way dynload_shlib.c builds it, and a test checks the result against importlib.machinery.EXTENSION_SUFFIXES on native builds.

Also sets abi.extension_suffix and abi.stable_abi_suffix for static libpython builds. PEP 739 requires them whenever extension modules are supported; they were only emitted with a shared libpython (rust-cross/manylinux-cross#165).

Tested with ./configure --disable-gil --with-build-python=<GIL-enabled debug python> && make build-details.json: the file now has ["t"] and the free-threaded suffix list instead of the build interpreter's ["d"] and its list.

Written with assistance from Claude Fable 5.1

With --with-build-python, generate-build-details.py runs on a different
interpreter than the one being built. abi.flags, suffixes.extensions,
abi.stable_abi_suffix and supports_isolated_interpreters came from sys and
importlib, so they described the build interpreter. Read them from
sysconfig instead. The extension suffix list is rebuilt the same way
Python/dynload_shlib.c builds it; a test checks that the result matches
importlib.machinery.EXTENSION_SUFFIXES on native builds.

Also set abi.extension_suffix and abi.stable_abi_suffix for static
libpython builds. They were only set with a shared libpython, but
extension modules work either way and PEP 739 requires them.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@itamaro
itamaro requested a review from brettcannon November 7, 2026 04:33
@itamaro itamaro added build The build process and cross-build needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes labels Nov 7, 2026
@itamaro
itamaro marked this pull request as ready for review November 7, 2026 06:07
@itamaro
itamaro requested a review from FFY00 as a code owner November 7, 2026 06:07
@itamaro
itamaro merged commit fb9330b into python:main Nov 18, 2026
74 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @itamaro for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Nov 18, 2026

Copy link
Copy Markdown

GH-162239 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Nov 18, 2026
@bedevere-app

bedevere-app Bot commented Nov 18, 2026

Copy link
Copy Markdown

GH-162240 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Nov 18, 2026
itamaro added a commit that referenced this pull request Nov 18, 2026
…H-161529) (#162239)

gh-136267: Use the target configuration in build-details.json (GH-161529)

With --with-build-python, generate-build-details.py runs on a different
interpreter than the one being built. abi.flags, suffixes.extensions,
abi.stable_abi_suffix and supports_isolated_interpreters came from sys and
importlib, so they described the build interpreter. Read them from
sysconfig instead. The extension suffix list is rebuilt the same way
Python/dynload_shlib.c builds it; a test checks that the result matches
importlib.machinery.EXTENSION_SUFFIXES on native builds.

Also set abi.extension_suffix and abi.stable_abi_suffix for static
libpython builds. They were only set with a shared libpython, but
extension modules work either way and PEP 739 requires them.
(cherry picked from commit fb9330b)

Co-authored-by: Itamar Oren <itamarost@gmail.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
itamaro added a commit that referenced this pull request Nov 18, 2026
…H-161529) (#162240)

With --with-build-python, generate-build-details.py runs on a different
interpreter than the one being built. abi.flags, suffixes.extensions,
abi.stable_abi_suffix and supports_isolated_interpreters came from sys and
importlib, so they described the build interpreter. Read them from
sysconfig instead. The extension suffix list is rebuilt the same way
Python/dynload_shlib.c builds it; a test checks that the result matches
importlib.machinery.EXTENSION_SUFFIXES on native builds.

Also set abi.extension_suffix and abi.stable_abi_suffix for static
libpython builds. They were only set with a shared libpython, but
extension modules work either way and PEP 739 requires them.
(cherry picked from commit fb9330b)

Co-authored-by: Itamar Oren <itamarost@gmail.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants