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`.
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.
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>
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>
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.
`--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.
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>
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.
--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.
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.
* 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>
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>
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>
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.
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.
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>
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>
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>
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.
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.
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>
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>
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>
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>
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>