Commit Graph

1664 Commits

Author SHA1 Message Date
Ken Jin bc0b94b30c
gh-132257: Remove -flto-partition=none for Linux LTO builds (GH-132258)
Change the default LTO flags on GCC to not pass -flto-partition=none, and allow parallelization of LTO. This has a multiple factor speedup for LTO build times on GCC, with no noticeable loss in performance.

On newer make and newer GCC, this passes the jobserver automatically to GCC (or more like GCC grabs it from the env vars).

On older make, this will have benign warnings about serial compilation. It's safe to ignore them.
2025-04-11 16:06:05 +08:00
Neil Schemenauer d687900f98
gh-128384: Use a context variable for warnings.catch_warnings (gh-130010)
Make `warnings.catch_warnings()` use a context variable for holding
the warning filtering state if the `sys.flags.context_aware_warnings`
flag is set to true.  This makes using the context manager thread-safe in
multi-threaded programs.

Add the `sys.flags.thread_inherit_context` flag.  If true, starting a new
thread with `threading.Thread` will use a copy of the context
from the caller of `Thread.start()`.

Both these flags are set to true by default for the free-threaded build
and false for the default build.

Move the Python implementation of warnings.py into _py_warnings.py.

Make _contextvars a builtin module.

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-04-09 16:18:54 -07:00
Adam Turner 231a50fa9a
gh-109599: Expose `CapsuleType` via the `_types` module (#131969) 2025-04-04 23:37:41 +01:00
Bénédikt Tran 0a97427ee5
gh-99108: Implement HACL* HMAC (#130157)
A new extension module, `_hmac`, now exposes the HACL* HMAC (formally verified) implementation.

The HACL* implementation is used as a fallback implementation when the OpenSSL implementation of HMAC
is not available or disabled. For now, only named hash algorithms are recognized and SIMD support provided
by HACL* for the BLAKE2 hash functions is not yet used.
2025-04-04 19:04:00 +02:00
Pablo Galindo Salgado 943cc1431e
gh-131591: Implement PEP 768 (#131937)
Co-authored-by: Ivona Stojanovic <stojanovic.i@hotmail.com>
Co-authored-by: Matt Wozniski <godlygeek@gmail.com>
2025-04-03 16:20:01 +01:00
Xavier G. b70d45ab22
gh-131268: Implement thread names on OpenBSD (#131528) 2025-03-21 11:12:35 +01:00
Victor Stinner aabab76c8a
gh-131268: Adjust _PYTHREAD_NAME_MAXLEN on BSD (#131345)
Adjust _PYTHREAD_NAME_MAXLEN constant on FreeBSD and NetBSD.
Initial patch by Xavier G.
2025-03-17 16:52:59 +00:00
Hood Chatham db1e5827c4
gh-127503: Improve tracebacks on Emscripten when there is a trap (#131158)
Modifies the behavior of the interpreter on crash under Emscripten:
1. No Python traceback shown on segfault/trap
2. The JavaScript source line is shown

The JavaScript source line is super long and completely unenlightening,
whereas the Python traceback is very helpful.
2025-03-13 08:28:15 +08:00
Mark Shannon 014223649c
GH-130396: Use computed stack limits on linux (GH-130398)
* Implement C recursion protection with limit pointers for Linux, MacOS and Windows

* Remove calls to PyOS_CheckStack

* Add stack protection to parser

* Make tests more robust to low stacks

* Improve error messages for stack overflow
2025-02-25 09:24:48 +00:00
Ken Jin aa28423201
Revert "gh-130048: Reintroduce full LTO as default on Clang (GH-130049)" (#130088)
This reverts commit 34c06ccc4c.
2025-02-13 17:27:19 +00:00
Ken Jin 34c06ccc4c
gh-130048: Reintroduce full LTO as default on Clang (GH-130049) 2025-02-13 22:06:00 +08:00
Ken Jin 1b27f36eb0
gh-129819: Allow tier2/JIT and tailcall (GH-129820) 2025-02-13 02:18:36 +08:00
Erlend E. Aasland 167cf3ace0
gh-115806: Don't mangle gdbm header dependency detection output (#129390)
Replace AC_CACHE_VAL/AC_CHECK_HEADER with a cleaner variant using
AC_CACHE_CHECK/AC_PREPROC_IFELSE.

The former would produce garbled output when config.cache was reused. It
also required directly manipulating GNU Autoconf cache variables.
2025-02-08 15:38:11 +01:00
Pieter Eendebak 43e0240213
gh-129737: Fix help message for tail calling interpreter configuration (GH-129754) 2025-02-07 08:47:13 +08:00
Ken Jin cb640b659e
gh-128563: A new tail-calling interpreter (GH-128718)
Co-authored-by: Garrett Gu <garrettgu777@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-02-06 23:21:57 +08:00
Michael Osipov e3eba8ce26
gh-129393: Make 'sys.platform' return "freebsd" only on FreeBSD (#129394)
Make 'sys.platform' return "freebsd" only on FreeBSD without major version.
2025-01-31 10:02:45 +01:00
Hood Chatham 960936fe90
gh-128627: Emscripten: Fix address calculation for wasm-gc trampoline (#128782)
Modifies the memory calculation to divide the entire memory address by 4, not just the base address.
2025-01-23 08:02:04 +08:00
Victor Stinner 81159fce36
gh-59705: Make PYTHREAD_NAME_MAXLEN macro private (#128945)
Rename PYTHREAD_NAME_MAXLEN to _PYTHREAD_NAME_MAXLEN.
2025-01-18 15:10:29 +00:00
Zanie Blue 6ecb620a0c
gh-90905: Allow cross-compilation on macOS (#128385) 2025-01-13 03:38:28 -05:00
Filipe Laíns 🇵🇸 95cd9c669c
GH-127970: find the runtime library when dladdr is available (#127972) 2025-01-08 12:03:21 +00:00
Erlend E. Aasland e08b28235a
gh-127614: Correctly check for ttyname_r() in configure (#128503)
PR #14868 replaced the ttyname() call with ttyname_r(), but the old
check remained.
2025-01-07 22:42:36 +01:00
Zanie Blue 24b147a19b
gh-128472: Add `-skip-funcs` to BOLT options to fix computed goto errors (gh-128511)
* Add `-skip-funcs` to BOLT options to fix computed goto errors

Co-authored-by: Gregory Szorc <gregory.szorc@gmail.com>

* NEWS

---------

Co-authored-by: Gregory Szorc <gregory.szorc@gmail.com>
2025-01-07 12:02:55 +09:00
Hood Chatham 61c1a2478e
gh-127146: Strip dash from Emscripten compiler version (#128557)
`emcc -dumpversion` will sometimes say e.g., `4.0.0-git` but in this case
uname does not include `-git` in the version string. Use cut to delete
everything after the dash.
2025-01-07 06:26:35 +08:00
Zanie Blue b60044b838
gh-128437: Add `BOLT_COMMON_FLAGS` with `-update-debug-sections` (gh-128455)
Add `BOLT_COMMON_FLAGS` with `-update-debug-sections`

Co-authored-by: Gregory Szorc <gregory.szorc@gmail.com>
2025-01-05 13:16:30 +09:00
Zanie Blue b75ed951d4
gh-128354: Consistently use LIBS over LDFLAGS in library build checks (#128359) 2025-01-03 21:51:06 +01:00
Zanie Blue 4974bbdb29
gh-128456: Use '-reorder-functions=cdsort' for BOLT builds (#128457)
'hfsort+' is deprecated in favor of 'cdsort'.
2025-01-03 20:49:50 +00:00
Erlend E. Aasland 8abd6cef68
gh-115765: Upgrade to GNU Autoconf 2.72 (#128411) 2025-01-03 11:37:54 +00:00
Zanie Blue bb2dfadb92
gh-128104: Remove `Py_STRFTIME_C99_SUPPORT`; require C99-compliant strftime (#128106) 2025-01-03 11:04:03 +01:00
Zanie Blue 81376fef76
gh-128321: Set LIBS instead of LDFLAGS when checking sqlite3 requirements (#128322)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2024-12-30 09:55:14 +01:00
Furkan Onder 492b224b99
gh-128279: Enhance the NetBSD compatibility for thread naming (#128280)
Enhance NetBSD compatibility for thread naming in _threadmodule.c.
2024-12-28 19:49:45 +01:00
Zanie Blue 9d3a8f4949
gh-100384: Error on `unguarded-availability` in macOS builds (#128155)
Generate a build error on ``unguarded-availability`` in portable macOS builds (i.e. using MACOSX_DEPLOYMENT_TARGET), preventing invalid use of symbols that are not available in older versions of the OS.
2024-12-22 11:01:45 -08:00
RUANG (James Roy) ea578fc6d3
gh-127688: Add `SCHED_DEADLINE` and `SCHED_NORMAL` constants to `os` module (GH-127689) 2024-12-19 14:51:21 +01:00
Hood Chatham b92f101d0f
gh-127146: Emscripten Include compiler version in _PYTHON_HOST_PLATFORM (#127992)
Modifies _PYTHON_HOST_PLATFORM to include the compiler version under
Emscripten. The Emscripten compiler version is the platform version
compatibility identifier.
2024-12-18 07:17:09 +08:00
Hood Chatham be07edf511
gh-127111: Emscripten Move link flags from `LDFLAGS_NODIST` to `LINKFORSHARED` (#127666)
Corrects the usage of linking flags to avoid compilation errors related to the
use of `-sEXPORTED_FUNCTIONS` when linking shared libraries.
2024-12-09 09:34:28 +08:00
Victor Stinner 67b18a18b6
gh-59705: Add _thread.set_name() function (#127338)
On Linux, threading.Thread now sets the thread name to the operating
system.

* configure now checks if pthread_getname_np()
  and pthread_setname_np() functions are available.
* Add PYTHREAD_NAME_MAXLEN macro.
* Add _thread._NAME_MAXLEN constant for test_threading.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-12-06 16:27:12 +00:00
Victor Stinner fcbe6ecdb6
gh-93312: Include <sys/pidfd.h> to get PIDFD_NONBLOCK (#127593) 2024-12-05 10:39:44 +01:00
Hood Chatham 87faf0a9c4
gh-127503: Emscripten make Python.sh function as proper Python CLI (#127506)
Modifies the python.sh script to work on macOS, and adapt to recent emscripten changes.
2024-12-05 08:44:50 +08:00
Hood Chatham 43634fc1fc
gh-127146: Emscripten: Skip segfaults in test suite (#127151)
Added skips for tests known to cause problems when running on Emscripten. 
These mostly relate to the limited stack depth on Emscripten.
2024-12-05 08:26:25 +08:00
Hood Chatham bfb0788bfc
gh-127111: Emscripten Make web example work again (#127113)
Moves the Emscripten web example into a standalone folder, and updates 
Makefile targets to build the web example. Instructions for usage have
also been added.
2024-12-03 07:30:24 +08:00
Filipe Laíns 🇵🇸 2950bc50af
GH-127429: fix sysconfig data generation on cross-builds (#127430) 2024-12-02 07:12:36 +00:00
Hood Chatham 1629d2ca56
gh-126898: Emscripten support: Use es6 modules (#126903)
Modify Emscripten support to use ES6 modules.
2024-11-21 15:10:46 +11:00
Hood Chatham 544b001b23
gh-126691: Remove --with-emscripten-target (#126787)
This unifies the code for nodejs and the code for the browser. After this
commit, the browser example doesn't work; this will be fixed in a
subsequent update.
2024-11-16 09:44:05 +08:00
Hood Chatham 142104ce78
gh-89640: Pull in update to float word order detection in autoconf-archive (#126747) 2024-11-13 21:57:33 +01:00
Hood Chatham 403410fa1b
gh-89640: Restore configure error message on failure to detect float word order (#126569)
Before #126387, if we didn't detect float word order we'd raise the following
configure error:

    Unknown float word ordering. You need to manually preset
    ax_cv_c_float_words_bigendian=no (or yes) according to your system.

This puts it back (except for ARM or WASM, which as hardcoded).
2024-11-08 11:57:17 +00:00
Brett Cannon bbe9b21d06
GH-123877: default to `wasm32-wasip1` instead of `wasm32-wasi` to be more specific (GH-126552)
Eventually wasm32-wasi will represent WASI 1.0, and so it's currently deprecated so it can be used for that eventual purpose. wasm32-wasip1 is also more specific to what version of WASI is currently supported.

---------

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-11-07 13:40:56 -08:00
Erlend E. Aasland a5b94d0660
gh-96398: Improve accuracy of compiler checks in configure.ac (#117815)
The following variables are now used in compiler checks:
- $ac_cv_gcc_compat is set to 'yes' for GCC compatible compilers
  (the C preprocessor defines the __GNUC__ macro)
- for compiler basename checks, use $CC_BASENAME
  (may contain platform triplets)
- for the rest, use $ac_cv_cc_name
  (does not contain platform triplets)
2024-11-07 10:49:58 +01:00
Brett Cannon 2a6b6b33df
GH-126458: disable SIMD for HACL under WASI (#126512)
Requires an extra `-msimd128` flag and the `*mmintrin.h` header files are exclusive to x86-family CPUs.
2024-11-06 14:33:46 -08:00
Erlend E. Aasland 532fc08102
gh-89640: Hardcode WASM float word ordering as little endian (#126387) 2024-11-04 21:48:09 +01:00
Bénédikt Tran 38a604fd90
gh-99108: Cleanup references to inexisting `Modules/_blake2`. (GH-126270)
* Remove references to `Modules/_blake2`.

* Remove `Modules/_blake2` entry from CODEOWNERS

The folder does not exist anymore.

* Remove `Modules/_blake2` entry from `Tools/c-analyzer/TODO`
2024-11-01 16:18:44 +00:00
Hood Chatham b3122aa613
gh-126178: NFC Separate Emscripten and WASI standard lib disables in configure (#126179)
Separate the Emscripten and WASI stdlib configuration in configure.
2024-10-31 08:51:11 +08:00