summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* [3.14] Revert "gh-112068: C API: Add support of nullable arguments in ↵Serhiy Storchaka2025-07-221-160/+87
| | | | PyArg_Parse (GH-121303)" (GH-136991) (#137006)
* [3.14] gh-124621: Emscripten: Support pyrepl in browser (GH-136931) (GH-136988)Łukasz Langa2025-07-221-9/+107
| | | | | | | | | | | | | | | | | | | Basic support for pyrepl in Emscripten. Limitations: * requires JSPI * no signal handling implemented As followup work, it would be nice to implement a webworker variant for when JSPI is not available and proper signal handling. Because it requires JSPI, it doesn't work in Safari. Firefox requires setting an experimental flag. All the Chromiums have full support since May. Until we make it work without JSPI, let's keep the original web_example around. (cherry picked from commit c933a6bb329bb97bc7e448388dad1b74f7ca4baa) Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: Éric <merwok@netwok.org>
* [3.14] gh-136251: Improvements to WASM demo REPL (GH-136252) (GH-136977)Miss Islington (bot)2025-07-221-1/+1
| | | | | | (cherry picked from commit d1d526afe7ce62c787b150652a2ba136cb949d74) Co-authored-by: adam j hartz <adam@smatz.net> Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
* [3.14] gh-124621: Emscripten: Add support for async input devices ↵Miss Islington (bot)2025-07-221-0/+182
| | | | | | | | | | | | | | | | | | | | | | | (GH-136822) (GH-136935) This is useful for implementing proper `input()`. It requires the JavaScript engine to support the wasm JSPI spec which is now stage 4. It is supported on Chrome since version 137 and on Firefox and node behind a flag. We override the `__wasi_fd_read()` syscall with our own variant that checks for a readAsync operation. If it has it, we use our own async variant of `fd_read()`, otherwise we use the original `fd_read()`. We also add a variant of `FS.createDevice()` called `FS.createAsyncInputDevice()`. Finally, if JSPI is available, we wrap the `main()` symbol with `WebAssembly.promising()` so that we can stack switch from `fd_read()`. If JSPI is not available, attempting to read from an AsyncInputDevice will raise an `OSError`. (cherry picked from commit 7ae4749d064bd49b0dd96172fee20c1f1678d9e9) Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
* [3.14] gh-134009: Expose `PyMutex_IsLocked` in the public C API (gh-134365) ↵Hugo van Kemenade2025-07-221-0/+8
| | | | | | (#136971) Co-authored-by: Sam Gross <colesbury@gmail.com>
* [3.14] gh-133296: Publicly expose critical section API that accepts PyMutex ↵Miss Islington (bot)2025-07-221-0/+18
| | | | | | | (gh-135899) (#136969) Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
* [3.14] gh-136421: Load `_datetime` static types during interpreter ↵Miss Islington (bot)2025-07-211-0/+5
| | | | | | | | | | initialization (GH-136583) (GH-136943) gh-136421: Load `_datetime` static types during interpreter initialization (GH-136583) `_datetime` is a special module, because it's the only non-builtin C extension that contains static types. As such, it would initialize static types in the module's execution function, which can run concurrently. Since static type initialization is not thread-safe, this caused crashes. This fixes it by moving the initialization of `_datetime`'s static types to interpreter startup (where all other static types are initialized), which is already properly protected through other locks. (cherry picked from commit a10960699a2b3e4e62896331c4f9cfd162ebf440) Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* [3.14] gh-136870: fix data race in `PyThreadState_Clear` on ↵Miss Islington (bot)2025-07-211-0/+9
| | | | | | | | | | `sys_tracing_threads` (GH-136951) (#136953) gh-136870: fix data race in `PyThreadState_Clear` on `sys_tracing_threads` (GH-136951) In free-threading, multiple threads can be cleared concurrently as such the modifications on `sys_tracing_threads` should be done while holding the profile lock, otherwise it can race with other threads setting up profiling. (cherry picked from commit f183996eb77fd2d5662c62667298c292c943ebf5) Co-authored-by: Kumar Aditya <kumaraditya@python.org>
* [3.14] gh-132661: Disallow `Template`/`str` concatenation after PEP 750 spec ↵Lysandros Nikolaou2025-07-212-92/+4
| | | | | | | update (#135996) (#136901) Co-authored-by: Dave Peck <davepeck@gmail.com> Co-authored-by: sobolevn <mail@sobolevn.me>
* [3.14] gh-134411: assert `PyLong_FromLong(x) != NULL` when `x` is known to ↵Miss Islington (bot)2025-07-211-0/+4
| | | | | | | | | | | be small (GH-134415) (#136910) gh-134411: assert `PyLong_FromLong(x) != NULL` when `x` is known to be small (GH-134415) Since `PyLong_From Long(PY_MONITORING_DEBUGGER_ID)` falls to `small_int` case and can't return `NULL`. Added `assert`s for extra confidence. https://github.com/python/cpython/issues/134411#issuecomment-2897653868 (cherry picked from commit cf19b6435d02dd7be11b84a44f4a8a9f1a935b15) Co-authored-by: Sergey Muraviov <smurav@mail.ru>
* [3.14] gh-127146: Emscripten: Make os.umask() actually work (GH-136706) ↵Miss Islington (bot)2025-07-161-1/+21
| | | | | | | | | (#136711) Provide a stub implementation of umask that is enough to get some tests passing. More work is needed upstream in Emscripten to make all umask tests to pass. (cherry picked from commit 12e52cad718723636a96042f9399634392285c44) Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
* [3.14] gh-127146: Report uid in Emscripten + node as native uid (GH-136509) ↵Miss Islington (bot)2025-07-161-0/+19
| | | | | | | | (#136699) Corrects the handling of getuid on emscripten, which was consistently reporting as 0. (cherry picked from commit e81c4e84b3a8688a367099e3adf9b2fcf914447f) Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
* [3.14] gh-136517: Print uncollectable objects if DEBUG_UNCOLLECTABLE mode ↵Miss Islington (bot)2025-07-111-1/+1
| | | | | | | | was set (GH-136518) (#136522) gh-136517: Print uncollectable objects if DEBUG_UNCOLLECTABLE mode was set (GH-136518) (cherry picked from commit c560df9658f1a24edea995fe6f9c84c55b37cfb3) Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
* [3.14] gh-136541: Fix several problems of perf trampolines in x86_64 and ↵Miss Islington (bot)2025-07-113-41/+144
| | | | | | | | | | | | | | | aarch64 (GH-136500) (#136544) gh-136541: Fix several problems of perf trampolines in x86_64 and aarch64 (GH-136500) This commit fixes the following problems: * The x86_64 trampolines are not preserving frame pointers * The hardcoded offsets to the code segment from the FDE only worked properly for x64_64 * The CIE data was not following conventions of aarch64 * The eh_frame for aarch64 was not fully correct (cherry picked from commit 236f733d8ffb3d587e1167fa0a0248c24512e7fd) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* [3.14] gh-91048: Revert the memory cache removal for remote debugging ↵Miss Islington (bot)2025-07-091-0/+78
| | | | | | | | | | | (GH-136440) (#136443) gh-91048: Revert the memory cache removal for remote debugging (GH-136440) (cherry picked from commit 77d25e5b169f7c306d3a6d9ca6777c0a0be80d8f) gh-91048: Reintroduce the memory cache for remote debugging Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* [3.14] GH-133136: Revise QSBR to reduce excess memory held (gh-135473) (#135912)Miss Islington (bot)2025-07-082-10/+6
| | | | | | | | | | | | | | | | | | | | The free threading build uses QSBR to delay the freeing of dictionary keys and list arrays when the objects are accessed by multiple threads in order to allow concurrent reads to proceed with holding the object lock. The requests are processed in batches to reduce execution overhead, but for large memory blocks this can lead to excess memory usage. Take into account the size of the memory block when deciding when to process QSBR requests. Also track the amount of memory being held by QSBR for mimalloc pages. Advance the write sequence if this memory exceeds a limit. Advancing the sequence will allow it to be freed more quickly. Process the held QSBR items from the "eval breaker", rather than from `_PyMem_FreeDelayed()`. This gives a higher chance that the global read sequence has advanced enough so that items can be freed. (cherry picked from commit 113de8545ffe74a4a1dddb9351fa1cbd3562b621) Co-authored-by: Neil Schemenauer <nas-github@arctrix.com> Co-authored-by: Sam Gross <colesbury@gmail.com>
* [3.14] gh-102567: Add missing newline to `--help-all` (GH-136391) (GH-136403)Miss Islington (bot)2025-07-081-1/+1
| | | | | | gh-102567: Add missing newline to `--help-all` (GH-136391) (cherry picked from commit fbef0c1d6a6540f5063138b861f79bdb2a935b0a) Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
* [3.14] gh-109700: fix interpreter finalization while handling memory error ↵Miss Islington (bot)2025-07-071-7/+7
| | | | | | | | (GH-136342) (#136352) gh-109700: fix interpreter finalization while handling memory error (GH-136342) (cherry picked from commit 0c3e3da19570424649c33c0c2c29dc12541935e7) Co-authored-by: Kumar Aditya <kumaraditya@python.org>
* [3.14] gh-134280: Disable constant folding for ~ with a boolean argument ↵Miss Islington (bot)2025-07-021-0/+4
| | | | | | | | (GH-134982) (GH-136185) This moves the deprecation warning from compile time to run time. (cherry picked from commit 86c3316183a79867e3c666d0830f897e16f0f339) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.14] gh-130396: Move PYOS_LOG2_STACK_MARGIN to internal headers ↵Miss Islington (bot)2025-07-011-7/+7
| | | | | | | | | | | | | (GH-135928) (#136173) gh-130396: Move PYOS_LOG2_STACK_MARGIN to internal headers (GH-135928) Move PYOS_LOG2_STACK_MARGIN, PYOS_STACK_MARGIN, PYOS_STACK_MARGIN_BYTES and PYOS_STACK_MARGIN_SHIFT macros to pycore_pythonrun.h internal header. Add underscore (_) prefix to the names to make them private. Rename _PYOS to _PyOS. (cherry picked from commit 28940e8e4884eb3444a8ea15a5634f76b154d7ed) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.14] gh-136053: Check error for TYPE_SLICE in marshal.c (GH-136054) ↵Miss Islington (bot)2025-06-291-0/+3
| | | | | | | | | (GH-136092) Fix a possible crash when deserializing a large marshal data (at least several GiBs) containing a slice. (cherry picked from commit 30ba03ea8ed98522b0500d6856b22727c88e818f) Co-authored-by: Akshat Gupta <akshat.gupta24@gmail.com>
* [3.14] gh-91048: Fix external inspection multi-threaded performance ↵Pablo Galindo Salgado2025-06-281-78/+0
| | | | | (GH-136005) (#136080) (cherry picked from commit 5334732f9c8a44722e4b339f4bb837b5b0226991)
* [3.14] gh-135871: Fix needless spinning in `_PyMutex_LockTimed` with zero ↵Miss Islington (bot)2025-06-251-1/+1
| | | | | | | | | timeout (gh-135872) (gh-135946) The free threading build could spin unnecessarily on `_Py_yield()` if the initial compare and swap failed. (cherry picked from commit cbfaf41caf135b8598a560854cd59e992a2ccfed) Co-authored-by: Joseph Tibbertsma <josephtibbertsma@gmail.com>
* [3.14] gh-135755: Move SPECIAL_ constants to a private header (GH-135922) ↵Petr Viktorin2025-06-252-1/+2
| | | | | | (GH-135926) Macros without a `Py`/`_Py` prefix should not be defined in public headers. (cherry picked from commit 1b1ae82fab0093924b8b89eb1c7eea11d7be7b18)
* [3.14] gh-135855: Raise TypeError When Passing Non-dict Object to ↵Miss Islington (bot)2025-06-241-0/+1
| | | | | | | `_interpreters.set___main___attrs` (gh-135900) (cherry picked from commit 4e6f0d116, AKA gh-135856) Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
* [3.14] gh-135645: Added `supports_isolated_interpreters` to ↵Miss Islington (bot)2025-06-211-0/+12
| | | | | | | | | `sys.implementation` (GH-135667) (#135786) gh-135645: Added `supports_isolated_interpreters` to `sys.implementation` (GH-135667) (cherry picked from commit 8ca1e4d846e868a20834cf442c48a3648b558bbe) Co-authored-by: sobolevn <mail@sobolevn.me> Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* [3.14] gh-135608: Add a null check for attribute promotion to fix a JIT ↵Ken Jin2025-06-203-2/+17
| | | | | | | crash (GH-135613) (#135739) gh-135608: Add a null check for attribute promotion to fix a JIT crash (GH-135613) Co-authored-by: devdanzin <74280297+devdanzin@users.noreply.github.com>
* gh-135543: Emit sys.remote_exec audit event when sys.remote_exec is called ↵Miss Islington (bot)2025-06-192-1/+6
| | | | | | | (GH-135544) (cherry picked from commit 1ddfe593200fec992d283a9b4d6ad2f1b535c018) Co-authored-by: Nadeshiko Manju <me@manjusaka.me>
* [3.14] gh-133485: Use interpreters.Interpreter in InterpreterPoolExecutor ↵Miss Islington (bot)2025-06-191-1/+3
| | | | | | | | | | (gh-135695) Most importantly, this resolves the issues with functions and types defined in __main__. It also expands the number of supported objects and simplifies the implementation. (cherry picked from commit 725da50520, AKA gh-133957) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* [3.14] gh-132775: Fix Interpreter.call() __main__ Visibility (gh-135638)Miss Islington (bot)2025-06-172-227/+218
| | | | | | | | | | As noted in the new tests, there are a few situations we must carefully accommodate for functions that get pickled during interp.call(). We do so by running the script from the main interpreter's __main__ module in a hidden module in the other interpreter. That hidden module is used as the function __globals__. (cherry picked from commit 269e19e0a7, AKA gh-135595) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* [3.14] gh-132815: Add support for JUMP_BACKWARD in specialization stats ↵Miss Islington (bot)2025-06-171-0/+1
| | | | | | | | (GH-135606) (#135612) gh-132815: Add support for JUMP_BACKWARD in specialization stats (GH-135606) (cherry picked from commit a9e66a7c506680263b39bc8c150ddc5e72213c45) Co-authored-by: PuQing <me@puqing.work>
* [3.14] gh-135443: Sometimes Fall Back to __main__.__dict__ For Globals ↵Miss Islington (bot)2025-06-164-64/+257
| | | | | | | | | | | | | | | | | | | | | | | (gh-135593) For several builtin functions, we now fall back to __main__.__dict__ for the globals when there is no current frame and _PyInterpreterState_IsRunningMain() returns true. This allows those functions to be run with Interpreter.call(). The affected builtins: * exec() * eval() * globals() * locals() * vars() * dir() We take a similar approach with "stateless" functions, which don't use any global variables. (cherry picked from commit a450a0ddec, AKA gh-135491) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* [3.14] gh-128627: Emscripten: Add missing semicolon in ios detection code ↵Miss Islington (bot)2025-06-161-1/+1
| | | | | | | (GH-135590) (#135592) (cherry picked from commit 68b7e1a6677d7a8fb47fbd28cb5d39a87217273c) Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
* [3.14] gh-135513: Fix unused variable warning in `crossinterp.c` (GH-135514) ↵Miss Islington (bot)2025-06-161-1/+7
| | | | | | | | (#135577) gh-135513: Fix unused variable warning in `crossinterp.c` (GH-135514) (cherry picked from commit 4c15505071498439407483004721d0369f110229) Co-authored-by: sobolevn <mail@sobolevn.me>
* [3.14] gh-119132: Remove "experimental" tag from the CPython free-threading. ↵Miss Islington (bot)2025-06-161-1/+1
| | | | | | | | | | | (gh-135550) (gh-135565) --------- (cherry picked from commit f0799795994bfd9ab0740c4d70ac54270991ba47) Co-authored-by: Donghee Na <donghee.na@python.org> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Peter Bierma <zintensitydev@gmail.com> Co-authored-by: T. Wouters <thomas@python.org>
* [3.14] GH-135171: Revert async generator expressions behavior (#135352)Mikhail Efimov2025-06-161-10/+21
|
* [3.14] gh-132775: Clean Up Cross-Interpreter Error Handling (gh-135492)Miss Islington (bot)2025-06-143-256/+451
| | | | | | | | | | | | | | In this refactor we: * move some code around * make a couple of typedefs opaque * decouple errors from session state * improve tracebacks for propagated exceptions This change helps simplify several upcoming changes. (cherry picked from commit c7f4a80079, AKA gh-135369) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* [3.14] gh-134939: Add the concurrent.interpreters Module (gh-135414)Eric Snow2025-06-121-3/+3
| | | | | | | | PEP-734 has been accepted (for 3.14). (FTR, I'm opposed to putting this under the concurrent package, but doing so is the SC condition under which the module can land in 3.14.) (cherry picked from commit 62143736b, AKA gh-133958)
* [3.14] gh-128627: Fix iPad detection in wasm-gc (GH-135388) (#135419)Miss Islington (bot)2025-06-121-1/+10
| | | | | | | On some iPad versions, Safari reports as "macOS". Modifies the GC trampoline detection to add a feature-based check to detect this case. (cherry picked from commit d4471297586335d8c24db8b2c030d32c94570344) Co-authored-by: Gyeongjae Choi <def6488@gmail.com>
* [3.14] gh-128605: Add branch protections for x86_64 in asm_trampoline.S ↵stratakis2025-06-102-0/+26
| | | | | | | | | | | | (#128606) (#135345) Apply Intel Control-flow Technology for x86-64 on asm_trampoline.S. Required for mitigation against return-oriented programming (ROP) and Call or Jump Oriented Programming (COP/JOP) attacks. Manual application is required for the assembly files. See also: https://sourceware.org/annobin/annobin.html/Test-cf-protection.html
* [3.14] Fix warnings `set but not used [-Wunused-but-set-variable]` in ↵Miss Islington (bot)2025-06-101-9/+0
| | | | | | | | remote_debug.h (GH-135290) (#135319) Fix warnings `set but not used [-Wunused-but-set-variable]` in remote_debug.h (GH-135290) (cherry picked from commit 49fc1f215aeb0f71445505191ccb65517b58a5aa) Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
* [3.14] Fix definition of `_Py_RemoteDebug_` symbols for static linking ↵Miss Islington (bot)2025-06-101-2/+12
| | | | | | | | (GH-135146) (#135318) Fix definition of `_Py_RemoteDebug_` symbols for static linking (GH-135146) (cherry picked from commit 2e1ad6eb26871a379e5d3aa626d6fc93eba72a86) Co-authored-by: Zanie Blue <contact@zanie.dev>
* [3.14] Heavily comment Python/perf_jit_trampoline.c to improve ↵Miss Islington (bot)2025-06-091-385/+1029
| | | | maintainability (GH-134527) (#135299)
* [3.14] gh-133968: Add PyUnicodeWriter_WriteASCII() function (#133973) (#134974)Victor Stinner2025-06-093-11/+11
| | | | | | | | | | | gh-133968: Add PyUnicodeWriter_WriteASCII() function (#133973) Replace most PyUnicodeWriter_WriteUTF8() calls with PyUnicodeWriter_WriteASCII(). (cherry picked from commit f49a07b531543dd8a42d90f5b1c89c0312fbf806) Co-authored-by: Peter Bierma <zintensitydev@gmail.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* [3.14] GH-135171: Fix generator expressions one last time (hopefully) ↵Mark Shannon2025-06-094-9/+62
| | | | | | | (GH-135225) * Add NULL check to FOR_ITER * Move GET_ITER back to genexpr creation
* [3.14] gh-134876: Add fallback for when process_vm_readv fails with ENOSYS ↵Miss Islington (bot)2025-06-072-0/+109
| | | | | | | | (GH-134878) (#135240) gh-134876: Add fallback for when process_vm_readv fails with ENOSYS (GH-134878) (cherry picked from commit ac9c3431cc5916a795c42b3e2b965233ceffe6f0) Co-authored-by: Daniel Golding <goldingd89@gmail.com>
* [3.14] gh-128605: Revert "Add branch protections for x86_64 in ↵Petr Viktorin2025-06-062-27/+0
| | | | | | asm_tr…ampoline.S (#128606) (#135077)" (GH-135175) This reverts commit 899cca6dbf76bf3e06a99f60a5f996ad6ba0761f, which broke buildbots.
* [3.14] gh-134889: Fix handling of a few opcodes when optimizing `LOAD_FAST` ↵mpage2025-06-051-0/+20
| | | | | | | (#134958) (#135187) We were incorrectly handling a few opcodes that leave their operands on the stack. Treat all of these conservatively; assume that they always leave operands on the stack. (cherry picked from commit 6b77af257c25d31f1f137e477cb23e63692ddf29)
* [3.14] gh-135099: Only wait on `_PyOS_SigintEvent()` in main thread ↵Miss Islington (bot)2025-06-041-6/+16
| | | | | | | | | | | | | | | | (GH-135100) (GH-135116) On Windows, the `_PyOS_SigintEvent()` event handle is used to interrupt the main thread when Ctrl-C is pressed. Previously, we also waited on the event from other threads, but ignored the result. However, this can race with interpreter shutdown because the main thread closes the handle in `_PySignal_Fini` and threads may still be running and using mutexes during interpreter shtudown. Only use `_PyOS_SigintEvent()` in the main thread in parking_lot.c, like we do in other places in the CPython codebase. (cherry picked from commit cc581f32bf5f15e9f2f89b830ec64ea25684d0cd) Co-authored-by: Sam Gross <colesbury@gmail.com>
* [3.14] gh-128605: Add branch protections for x86_64 in asm_trampoline.S ↵stratakis2025-06-032-0/+27
| | | | | | | | | | | | (#128606) (#135077) Apply Intel Control-flow Technology for x86-64 on asm_trampoline.S. Required for mitigation against return-oriented programming (ROP) and Call or Jump Oriented Programming (COP/JOP) attacks. Manual application is required for the assembly files. See also: https://sourceware.org/annobin/annobin.html/Test-cf-protection.html