Commit graph

9777 commits

Author SHA1 Message Date
Miss Islington (bot)
192ae9b86d
[3.14] gh-138372: Fix SyntaxWarning for erroneous t-string subscription (GH-138375) (#138392)
gh-138372: Fix SyntaxWarning for erroneous t-string subscription (GH-138375)
(cherry picked from commit 5493b46462)

Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
2025-09-02 17:39:08 +00:00
Miss Islington (bot)
6d30edbae2
[3.14] gh-137576: Fix for Basic REPL showing incorrect code in tracebacks with PYTHONSTARTUP (GH-137625) (#137771)
Co-authored-by: adam j hartz <hz@mit.edu>
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2025-08-27 18:28:20 +03:00
Peter Bierma
8b3f9ae2ca
[3.14] gh-137883: Check the recursion limit for specialized keyword argument calls (GH-137887) (#137945)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-08-25 19:19:39 +03:00
Kumar Aditya
d619015ecd
[3.14] gh-137384: fix crash when accessing warnings state late in runtime shutdown (GH-138027) (#138065) 2025-08-22 17:27:49 +03:00
Miss Islington (bot)
cf5c170c1b
[3.14] gh-137728 gh-137762: Fix bugs in the JIT with many local variables (GH-137764) (#137999)
Co-authored-by: Ken Jin <kenjin@python.org>
2025-08-21 17:00:05 +03:00
Miss Islington (bot)
7c0e6378c1
[3.14] GH-137573: mark _PyOptimizer_Optimize as no inline (GH-137731) (#137751)
Co-authored-by: Sachin Shah <39803835+inventshah@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-08-14 11:51:33 +03:00
Ned Deily
2392232ec4
[3.14] GH-134291: Support older macOS deployment targets for JIT builds (GH-137211) (#137701)
Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
2025-08-13 13:37:01 +03:00
Miss Islington (bot)
4ebd928b00
[3.14] gh-137400: Fix a crash when disabling profiling across all threads (gh-137471) (#137648)
Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-08-12 17:29:57 +03:00
Miss Islington (bot)
4dda1768be
[3.14] gh-135228: When @dataclass(slots=True) replaces a dataclass, make the original class collectible (take 2) (GH-137047) (#137666)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-08-12 17:17:26 +03:00
Irit Katriel
0ccf244a19
[3.14] gh-137288: Fix bug where boolean expressions are not associated with the correct exception handler (GH-137310). (#137427)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-08-12 12:56:37 +03:00
Miss Islington (bot)
1878fe814a
[3.14] gh-131338: Disable computed stack limit checks on non-glibc linux (GH-134336) (#137175)
Co-authored-by: R. David Murray <rdmurray@bitdance.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-08-10 16:55:29 +03:00
Miss Islington (bot)
f17d77f112
[3.14] gh-137308: Replace a single docstring with pass in -OO mode (GH-137318) (#137322)
Co-authored-by: sobolevn <mail@sobolevn.me>
2025-08-08 18:04:10 +03:00
Miss Islington (bot)
909a534cb2
[3.14] gh-136870: fix data races in instrumentation of bytecode (GH-136994) (#137082)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Zachary Ware <zach@python.org>
2025-07-28 22:39:44 +03:00
Serhiy Storchaka
805daa2edb
[3.14] Revert "gh-112068: C API: Add support of nullable arguments in PyArg_Parse (GH-121303)" (GH-136991) (#137006) 2025-07-22 19:16:31 +03:00
Łukasz Langa
591019e1f2
[3.14] gh-124621: Emscripten: Support pyrepl in browser (GH-136931) (GH-136988)
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 c933a6bb32)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Éric <merwok@netwok.org>
2025-07-22 15:04:11 +02:00
Miss Islington (bot)
4f1f648c3b
[3.14] gh-136251: Improvements to WASM demo REPL (GH-136252) (GH-136977)
(cherry picked from commit d1d526afe7)

Co-authored-by: adam j hartz <adam@smatz.net>
Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-07-22 13:25:35 +02:00
Miss Islington (bot)
d118bc061b
[3.14] gh-124621: Emscripten: Add support for async input devices (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 7ae4749d06)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-07-22 11:51:02 +02:00
Hugo van Kemenade
8e43b130f7
[3.14] gh-134009: Expose PyMutex_IsLocked in the public C API (gh-134365) (#136971)
Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-07-22 12:48:08 +03:00
Miss Islington (bot)
11f510167c
[3.14] gh-133296: Publicly expose critical section API that accepts PyMutex (gh-135899) (#136969)
Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-07-22 12:44:59 +03:00
Miss Islington (bot)
ecd97caaf5
[3.14] gh-136421: Load _datetime static types during interpreter 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 a10960699a)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-07-21 19:23:05 -04:00
Miss Islington (bot)
718fc5b139
[3.14] gh-136870: fix data race in PyThreadState_Clear on 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 f183996eb7)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-07-21 21:01:14 +00:00
Lysandros Nikolaou
af8d1f56f5
[3.14] gh-132661: Disallow Template/str concatenation after PEP 750 spec update (#135996) (#136901)
Co-authored-by: Dave Peck <davepeck@gmail.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
2025-07-21 17:34:54 +02:00
Miss Islington (bot)
a69472e242
[3.14] gh-134411: assert PyLong_FromLong(x) != NULL when x is known to 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 cf19b6435d)

Co-authored-by: Sergey Muraviov <smurav@mail.ru>
2025-07-21 09:23:33 +00:00
Miss Islington (bot)
4eee754091
[3.14] gh-127146: Emscripten: Make os.umask() actually work (GH-136706) (#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 12e52cad71)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-07-16 16:12:36 +00:00
Miss Islington (bot)
cdf98c3b7e
[3.14] gh-127146: Report uid in Emscripten + node as native uid (GH-136509) (#136699)
Corrects the handling of getuid on emscripten, which was consistently reporting as 0.
(cherry picked from commit e81c4e84b3)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-07-16 06:50:51 +02:00
Miss Islington (bot)
e03db7317f
[3.14] gh-136517: Print uncollectable objects if DEBUG_UNCOLLECTABLE mode was set (GH-136518) (#136522)
gh-136517: Print uncollectable objects if DEBUG_UNCOLLECTABLE mode was set (GH-136518)
(cherry picked from commit c560df9658)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
2025-07-11 15:20:05 +01:00
Miss Islington (bot)
5535482d2a
[3.14] gh-136541: Fix several problems of perf trampolines in x86_64 and 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 236f733d8f)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2025-07-11 14:06:19 +00:00
Miss Islington (bot)
9a79c5128f
[3.14] gh-91048: Revert the memory cache removal for remote debugging (GH-136440) (#136443)
gh-91048: Revert the memory cache removal for remote debugging (GH-136440)
(cherry picked from commit 77d25e5b16)


gh-91048: Reintroduce the memory cache for remote debugging

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2025-07-09 02:21:56 +01:00
Miss Islington (bot)
6a2a2906f8
[3.14] GH-133136: Revise QSBR to reduce excess memory held (gh-135473) (#135912)
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 113de8545f)

Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-07-08 10:58:01 -07:00
Miss Islington (bot)
cdeaa64214
[3.14] gh-102567: Add missing newline to --help-all (GH-136391) (GH-136403)
gh-102567: Add missing newline to `--help-all` (GH-136391)
(cherry picked from commit fbef0c1d6a)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-07-08 06:24:08 +00:00
Miss Islington (bot)
22fad16ebc
[3.14] gh-109700: fix interpreter finalization while handling memory error (GH-136342) (#136352)
gh-109700: fix interpreter finalization while handling memory error (GH-136342)
(cherry picked from commit 0c3e3da195)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-07-07 07:40:13 +00:00
Miss Islington (bot)
8ba024ddf5
[3.14] gh-134280: Disable constant folding for ~ with a boolean argument (GH-134982) (GH-136185)
This moves the deprecation warning from compile time to run time.
(cherry picked from commit 86c3316183)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-07-02 11:28:09 +03:00
Miss Islington (bot)
f152d60b68
[3.14] gh-130396: Move PYOS_LOG2_STACK_MARGIN to internal headers (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 28940e8e48)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-07-01 13:44:32 +00:00
Miss Islington (bot)
ce65956177
[3.14] gh-136053: Check error for TYPE_SLICE in marshal.c (GH-136054) (GH-136092)
Fix a possible crash when deserializing a large marshal data
(at least several GiBs) containing a slice.
(cherry picked from commit 30ba03ea8e)

Co-authored-by: Akshat Gupta <akshat.gupta24@gmail.com>
2025-06-29 07:36:04 +00:00
Pablo Galindo Salgado
c66b54f361
[3.14] gh-91048: Fix external inspection multi-threaded performance (GH-136005) (#136080)
(cherry picked from commit 5334732f9c)
2025-06-28 19:12:54 +01:00
Miss Islington (bot)
80fc62f8af
[3.14] gh-135871: Fix needless spinning in _PyMutex_LockTimed with zero 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 cbfaf41caf)

Co-authored-by: Joseph Tibbertsma <josephtibbertsma@gmail.com>
2025-06-25 17:07:07 +00:00
Petr Viktorin
a345fed896
[3.14] gh-135755: Move SPECIAL_ constants to a private header (GH-135922) (GH-135926)
Macros without a `Py`/`_Py` prefix should not be defined in public headers.
(cherry picked from commit 1b1ae82fab)
2025-06-25 13:36:46 +02:00
Miss Islington (bot)
090a42b5eb
[3.14] gh-135855: Raise TypeError When Passing Non-dict Object to _interpreters.set___main___attrs (gh-135900)
(cherry picked from commit 4e6f0d116, AKA gh-135856)

Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
2025-06-24 19:19:31 +00:00
Miss Islington (bot)
fa62dfe888
[3.14] gh-135645: Added supports_isolated_interpreters to sys.implementation (GH-135667) (#135786)
gh-135645: Added `supports_isolated_interpreters` to `sys.implementation` (GH-135667)
(cherry picked from commit 8ca1e4d846)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2025-06-21 08:21:50 +00:00
Ken Jin
60fc42c169
[3.14] gh-135608: Add a null check for attribute promotion to fix a JIT 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>
2025-06-20 15:24:25 +08:00
Miss Islington (bot)
0370cb42da
gh-135543: Emit sys.remote_exec audit event when sys.remote_exec is called (GH-135544)
(cherry picked from commit 1ddfe59320)

Co-authored-by: Nadeshiko Manju <me@manjusaka.me>
2025-06-19 20:51:06 +00:00
Miss Islington (bot)
bc8ed42176
[3.14] gh-133485: Use interpreters.Interpreter in InterpreterPoolExecutor (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>
2025-06-19 00:23:12 +00:00
Miss Islington (bot)
2c29ee835a
[3.14] gh-132775: Fix Interpreter.call() __main__ Visibility (gh-135638)
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>
2025-06-17 20:24:08 +00:00
Miss Islington (bot)
c1735c5b4e
[3.14] gh-132815: Add support for JUMP_BACKWARD in specialization stats (GH-135606) (#135612)
gh-132815: Add support for JUMP_BACKWARD in specialization stats (GH-135606)
(cherry picked from commit a9e66a7c50)

Co-authored-by: PuQing <me@puqing.work>
2025-06-17 12:38:22 +00:00
Miss Islington (bot)
2b1c0a76dc
[3.14] gh-135443: Sometimes Fall Back to __main__.__dict__ For Globals (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>
2025-06-16 23:59:30 +00:00
Miss Islington (bot)
d62b73a9d8
[3.14] gh-128627: Emscripten: Add missing semicolon in ios detection code (GH-135590) (#135592)
(cherry picked from commit 68b7e1a667)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-06-16 23:41:46 +00:00
Miss Islington (bot)
027f58473c
[3.14] gh-135513: Fix unused variable warning in crossinterp.c (GH-135514) (#135577)
gh-135513: Fix unused variable warning in `crossinterp.c` (GH-135514)
(cherry picked from commit 4c15505071)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-06-16 16:37:26 +00:00
Miss Islington (bot)
941011374a
[3.14] gh-119132: Remove "experimental" tag from the CPython free-threading. (gh-135550) (gh-135565)
---------
(cherry picked from commit f079979599)

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>
2025-06-16 14:58:14 +00:00
Mikhail Efimov
2ef78a85e4
[3.14] GH-135171: Revert async generator expressions behavior (#135352) 2025-06-16 17:45:42 +03:00
Miss Islington (bot)
0fe5463877
[3.14] gh-132775: Clean Up Cross-Interpreter Error Handling (gh-135492)
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>
2025-06-14 02:08:25 +00:00