1855 Commits
Author SHA1 Message Date
Itamar Oren 0e35313484 gh-160689 : Link only the bootstrap modules into the build helper programs (#160537)
The build-helper programs (`Programs/_freeze_module` and `_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.vcxproj` does with `PC/config_minimal.c`, and lets "extra" builtin modules (from `Setup.local` or `MODULE_BUILDTYPE=static`) depend on frozen modules or `getpath`.
2026-10-26 15:09:33 -07:00
Pengyu Lee ea3a97f245 gh-157354: Honor --with-<name>-sanitizer=no and --without-<name>-sanitizer in configure (#157355) 2026-10-25 09:56:45 +00:00
Inada NaokiandEmma Smith b26fc41b5c Remove obsolete and unused configure macros (#159513)
Co-authored-by: Emma Smith <emma@emmatyping.dev>
2026-10-25 05:18:16 +00:00
Zanie Blue 39ea54a64b gh-160381: Show LLVM profile statistics after PGO training (#160373)
LLVM PGO builds merge the training profiles without showing the profile-count distribution or functions with the hottest basic blocks. Run `llvm-profdata show --detailed-summary --topn=500` after merging to make it easier to compare training workloads.

Addresses [astral-sh/python-build-standalone#1033](https://github.com/astral-sh/python-build-standalone/issues/1033) tracking upstreaming of this patch.
2026-10-23 09:50:54 -07:00
Russell Keith-Magee ef08833eec gh-131999: Add support for tvOS, visionOS and watchOS. (#159944)
Add support for tvOS, visionOS and watchOS. This is mostly configuration
updates and testbed projects to support deploying to the new platforms.

Also includes a mimalloc change to support arm64_32 that has been contributed 
upstream.
2026-10-23 08:36:57 -07:00
Zanie Blue c6661bdc7d gh-124948: Reject explicit Cortex-A53 workaround flags with BOLT (gh-160337) 2026-10-22 22:02:49 +00:00
Hood Chatham 6d803acbb1 gh-160161 Fix node_entry.mjs with newest versions of Emscripten (#160264)
Applies an upstream-recommended workaround to work around the
removal of ``FS.filesystems``.
2026-10-22 14:10:31 -07:00
d6b77c8686 gh-156780: Emscripten: support building CPython with static linking (#156781)
Adds the ability to build Emscripten statically, so that it can be linked in as
an embedded library. Includes a test of the embedding case.
---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2026-10-22 19:58:32 +00:00
Donghee Na 867e24fed3 gh-128884: Update BOLT optimization option to follow the latest version. (gh-160122) 2026-10-22 00:44:05 -07:00
Advit Arora 6839f8ce22 gh-155813: Stop overwriting LIBFFI_CFLAGS and LIBFFI_LIBS on macOS (#156486)
Ensures that a user-specified LIBFFI_CFLAGS and LIBFFI_LIBS is honored when
building on macOS.
2026-10-21 15:13:36 -07:00
Vasiliy KiryanovandStan Ulbrych b94fdb7261 gh-75382: Fail configure early if a sanitizer cannot be linked (#159496)
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-10-21 19:20:14 +00:00
Vasiliy Kiryanov 0d35e3be52 gh-54767: Respect --disable-loadable-sqlite-extensions in configure (GH-159728)
The option was enabled for every spelling, including =no and --disable-.
2026-10-21 16:05:02 +03:00
Serhiy StorchakaandClaude Opus 5 f37e82139a gh-143632: Fix the musl check for PR_SET_VMA_ANON_NAME (GH-159886)
The guard added by gh-143730 tested $ac_cv_libc, which is never set, so the
check always ran and the build could fail on the struct prctl_mm_map
redefinition it was meant to avoid.  Match on the host triplet instead.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-10-20 20:28:55 +03:00
Victor Stinner 71ba39dc05 gh-159603: Use pthread_attr_get_np() on FreeBSD (#159604)
Use pthread_attr_get_np() on FreeBSD to get the stack size (and guard
size) of the current thread.

Check if pthread_attr_get_np() function and <pthread_np.h> header are
available in configure.

Update test_json.test_recursion. On FreeBSD 16 with a default stack size of
512 MB, the json C implementation no longer raises RecursionError in
test_highly_nested_objects_encoding(). Reduce also max_depth from 5,000 to
2,000 so test_highly_nested_objects_encoding() of the Python implementation
only takes 1.6 seconds, instead of 12 seconds.
2026-10-19 20:54:27 -07:00
sendaoYan 637fb369c7 gh-159440: Pass --work-tree to the git commands used for the version tag (#159442)
`--git-dir` alone does not imply a work tree, so in an out-of-tree build
git checked the build directory, and every tracked file looked deleted:
`sys.version` always carried a spurious "-dirty" suffix.
2026-10-14 21:17:52 -07:00
32fd69bdea gh-153711: Test availability for dup3() and pipe2() on iOS (#155222)
Modifies the configure test for dup3 and pipe2 to allow for iOS. These symbols
exist, but are unlinkable on iOS 26.

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
Co-authored-by: Ned Deily <nad@python.org>
2026-10-14 11:36:44 +08:00
OOTS 4b0e334843 gh-157899: Add support for fds pointing to symlinks in os.readlink(). (GH-157915) 2026-10-13 16:26:22 +00:00
Hood Chatham 0ec3aee262 gh-129040: Use wasm-gc to handle pointer casts in wasi (GH-158617)
This makes it so that in wasi builds if `-DPY_CALL_TRAMPOLINE` is passed, a call trampoline adaptor is used to prevent traps when there is a call signature mismatch between a C slot handler and the signature that the interpreter uses to call it.

This requires Clang >= 22. PEP 11 specifies that builds of Python 3.15 use WASI SDK version 33 which includes clang 23.1.0, so this could be used with Python 3.15 WASI builds but not earlier ones.

It requires a WebAssembly runtime that supports wasm-gc. Wasmtime has supported wasm-gc since version 27.0 released November 25, 2024. Some other runtimes still don't support it, but for those runtimes people can use builds with the trampoline disabled.

This also removed the Emscripten trampoline support for JS runtimes with no wasm-gc support. This removes a lot of implementation complexity and allows WASI and Emscripten to share code. The main concern is that it drops support for some very old iPhones, but every iPhone model released since 2018 is compatible with versions of Safari that support wasm-gc.

Tests were added that define handlers with various wrong numbers of arguments. The tests also run on non-webassembly platforms since they should work there as well.
2026-10-09 22:25:44 +00:00
Lazizbek Ergashev 2423814eb6 gh-156895: Document CXX in ./configure --help output (#157046) 2026-10-08 17:12:09 +02:00
Vasiliy Kiryanov 2791c35cae gh-136872: Build pymalloc in sanitizer builds, but disable it by default (GH-157934)
--with-*address-sanitizer and --with-memory-sanitizer unconditionally
disabled pymalloc (even when --with-pymalloc was given explicitly).

Enable it, so that it's available with `PYTHONMALLOC=pymalloc`.
Disable it by default on the affected sanitizer builds.
2026-10-07 18:05:37 +02:00
Victor Stinner 6318730aee gh-158893: Make os.strerror() thread-safe (#158927)
Make os.strerror() thread-safe: use the reentrant strerror_r()
function if available.

* The configure script now checks if strerror_r() is supported.
* Add a stress test to test_free_threading.test_os (new module).
* Add a comment on decode_current_locale() assertion which fails if
  the input string is mutated.
* Add an assertion to _Py_DecodeLocale() to detect if the input
  string was mutated during the function call.
2026-10-06 23:02:13 +02:00
197607e865 gh-156049: Add support for building with HWAsan (#156721)
Co-authored-by: Florian Mayer <fmayer@google.com>
Co-authored-by: Anna <araslanova.anna.a@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-10-06 19:34:53 +01:00
Stan UlbrychandVictor Stinner b93fb19a6e Run a job that the test suite with MSan to the CI (#158625)
* Run the test suite with MSan in CI

* Additional fixes

* Add `_Py_MSAN_UNPOISON_STRING`

* Apply Victor's suggestions

Co-authored-by: Victor Stinner <victor.stinner@gmail.com>

* Apply Victor's suggestions

Co-authored-by: Victor Stinner <victor.stinner@gmail.com>

---------

Co-authored-by: Victor Stinner <victor.stinner@gmail.com>
2026-10-05 02:11:42 +01:00
Serhiy StorchakaandClaude Opus 5 89bfac6d43 gh-157480: Add structured version info for dbm.ndbm (GH-157484)
Add constants which provide information about the version of the
underlying library in use: GDBM_VERSION_INFO, gdbm_version_info and
gdbm_version if it is GDBM, or BDB_VERSION, bdb_version,
BDB_VERSION_INFO and bdb_version_info if it is Berkeley DB.

dbm.ndbm.library is now 'ndbm' instead of 'GNU gdbm' for a classic
NDBM library.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-29 13:20:28 +00:00
Serhiy StorchakaandClaude Opus 5.5 4abf0d4b3a gh-158078: Fix building curses with narrow ncurses (GH-158088)
Detect curses functions with a link check instead of a compile check,
since the header can declare a function that the library lacks, for
example term_attrs() in the narrow ncurses library.

Fix test_curses on the narrow build.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-27 19:03:15 +03:00
Victor Stinner 6f64920479 gh-157695: Fix acospi() detection in configure.ac (#157948)
Include <math.h> to check for acospi() and similar functions.
2026-09-22 22:17:16 +02:00
Victor Stinner a32139044a gh-157695: Rename HAVE_ACOSPI to _Py_HAVE_ACOSPI (#157858)
configure.ac: Add PY_CHECK_FUNC_PRIVATE() function, similar to
PY_CHECK_FUNC() but defines macro _Py_HAVE_xxx instead of HAVE_xxx.

Use PY_CHECK_FUNC_PRIVATE() for functions: acospi, asinpi, atanpi,
atan2pi, cospi, sinpi and tanpi. Update check_capi_macros_ignored.txt.
2026-09-22 06:00:28 +00:00
Victor Stinner 315ed1669a gh-157695: Rename HAVE_ICONV to _Py_HAVE_ICONV (#157821)
Update check_capi_macros_ignored.txt.
2026-09-22 07:28:48 +02:00
Hood Chatham 10e308c53c gh-145177: Update to Emscripten 6.0.10 (#157935)
Bump the Emscripten version, and drop the use of -sWASM_BIGINT because it's on
by default now and Emscripten has started warning that the setting is
deprecated.
2026-09-22 09:52:53 +08:00
Victor Stinner 1d0f1ad0aa gh-157695: Rename HAVE_FLOAT16 macro to _Py_HAVE_FLOAT16 (#157752) 2026-09-19 10:34:26 +02:00
Chris Eibl f5fff1a290 GH-156554: Update PY_SUPPORT_TIER according to PEP 11 (#156576) 2026-09-11 19:53:30 +02:00
Clément PéronandClaude Fable 5.1 d0b2e0735f gh-156780: Emscripten: drop the trampoline's dependence on exports (#157238)
The trampoline exports _PyRuntime's address itself and reuses a
placeholder's table slot, so libpython no longer needs
-sEXPORTED_FUNCTIONS=__PyRuntime or a growable function table.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-11 09:22:36 +08:00
Jonathan J. Helmus 4849a01020 gh-153400: Support os.getrandom() on old glibc versions (#155762)
Use the libc-provided SYS_getrandom syscall number when available,
falling back to the kernel-provided __NR_getrandom when necessary.
2026-09-10 22:58:27 +02:00
465b3b80f9 gh-156109: Allow static, non-framework iOS builds (#156110)
Allows a static build of iOS for users that want to build and embed a libPython
into an iOS binary. This configuration can't use shared modules or binary 
wheels, but it can be useful under some circumstances, so there's no reason to
explicitly exclude it.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2026-09-08 07:54:41 +00:00
adea841add gh-152936: Make privileged functions available on Android (#152977)
Expose the chroot, initgroups, setegid, seteuid, setgid, sethostname, setregid,
setresgid, setresuid, setreuid, and setuid functions on Android. Previously, 
these methods were excluded by an autoconf guard; they're now included with
a permission check to prevent issues invoking them as a non-root user.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Malcolm Smith <smith@chaquo.com>
2026-09-08 15:09:19 +08:00
cb54488523 gh-156439: Gate socket.if_{nametoindex, indextoname} on respective OS capability (#156708)
Co-authored-by: Stan Ulbrych <stan@python.org>
Co-authored-by: Malcolm Smith <smith@chaquo.com>
2026-09-03 20:49:40 +01:00
Sergey B Kirpichev 2271fbb369 gh-153740: Refine test for _Float16: check support from libm (#156815) 2026-09-02 17:21:22 +02:00
e7ef46acf6 gh-153740: Optimize PyFloat_Pack/Unpack2 using native _Float16 (#154796)
Co-authored-by: hpkfft.com <paul@hpkfft.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-09-01 15:16:56 +02:00
Stan UlbrychandEmma Smith 53d2e14a30 gh-156244: Update configure for RISC-V support (#156277)
Co-authored-by: Emma Smith <emma@emmatyping.dev>
2026-08-23 19:52:58 +00:00
Shamil f74cdf80a1 gh-155911: Fix curses detection with libraries in LIBS (GH-156130) 2026-08-22 11:33:48 +03:00
Clément Péron d856402e71 gh-156115: Use the simulator deployment-target flag for iOS simulator builds (#156116)
Ensures that CFLAGS and LDFLAGS use -mios-simulator-version-min, rather
than the device-based -mios-version-min. This only matters if the CFLAGS
and LDFLAGS are used in a bare call to clang without a -target; but that is
a legal usage, so it's worth catching.
2026-08-22 11:05:20 +08:00
Stan Ulbrych 5d91cf6487 gh-139314: Add support for linking against zlib-rs and libbzip2-rs (#155119) 2026-08-14 10:06:14 +01:00
Victor Stinner 1c9521f485 gh-153400: Use glibc functions instead of syscall() (#155518)
Use glibc functions instead of syscall(): pidfd_open(), pidfd_getfd()
and pidfd_send_signal() (glibc 2.36), gettid() and getdents64()
(glibc 2.30), and getrandom() (glibc 2.25).

Use unsigned int for os.getrandom() flags and
signal.pidfd_send_signal() flags.
2026-08-13 12:44:45 +02:00
Kurt Mosiejczuk 63bf95b959 bpo-46446: Like FreeBSD, MULTIARCH should not be passed on OpenBSD (GH-30721) 2026-08-10 13:45:22 +00:00
5918085bb6 GH-138800: Fix variable substitution in python3.pc for Android (#144776)
Clarifies the difference between LIBPYTHON, which is the library name,
and the flags needed to build modules, which also need the linking path.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Malcolm Smith <smith@chaquo.com>
2026-08-03 14:52:26 +08:00
Serhiy StorchakaandClaude Fable 5 bfc16a71cf gh-131565: Implement ctypes.util.dllist() in the _ctypes extension (GH-154255)
On NetBSD dl_iterate_phdr() reports only the link-map group of the calling
object.  Called through ctypes, the caller is libffi's closure trampoline,
which belongs to no object, so only the main executable was reported.
Calling dl_iterate_phdr() from the _ctypes extension module makes _ctypes
the caller and reports all loaded shared libraries.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-29 17:47:52 +03:00
Serhiy StorchakaandClaude Opus 4.8 8b048eb35e gh-154271: Enable socket ancillary data and forkserver on illumos (GH-154273)
illumos declares the socket ancillary-data API (CMSG_*, sendmsg(),
recvmsg()) only under _XOPEN_SOURCE >= 600.  __EXTENSIONS__ keeps the
other platform features.  This enables the forkserver start method.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-28 20:35:26 +03:00
7961bbf2bb gh-122931: Allow stable abi3 API extensions to include a multiarch tuple in the filename (GH-152461)
This permits stable ABI extensions for multiple architectures to be
co-installed into the same directory, without clashing with each other,
the same way (non-stable ABI) regular extensions can.

It is listed before the current platform-less suffixes since it's more
specific.

The platform is stored in a new pyconfig.h define & sysconfig
variable, SOABI_PLATFORM.
On some known architectures (FreeBSD, Windows), this
will be undefined/zero; these won't have the new tag (yet).

Add SOABI_PLATFORM & ALT_SOABI the info to
`make pythoninfo` as well.

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-07-27 15:05:40 +02:00
Serhiy StorchakaandClaude Opus 4.8 2db8ca79e0 gh-154070: Build the curses module wide by capability, not by name (GH-154071)
configure built the module wide (HAVE_NCURSESW) only for a backend named
ncursesw.  Probe for the wide API in the ncurses and auto backends too, so
a widec-built ncurses keeping the plain name (pkgsrc, macOS) is built wide.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-27 14:04:51 +03:00
Hood Chatham 119edb3ede gh-154465: Add configure flag to exclude emscripten_syscalls.c (#154466)
Pyodide doesn't want to include emscripten_syscalls.c in the build since it
links a different version of it. This adds a configure flag to drop it.
2026-07-22 14:06:00 +02:00