]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
3 days agogh-89520: Load extension settings and keybindings from user config (GH-28713)
CoolCat467 [Sun, 12 Apr 2026 04:44:33 +0000 (23:44 -0500)] 
gh-89520: Load extension settings and keybindings from user config (GH-28713)

Extension keybindings defined in ~/.idlerc/config-extensions.cfg were silently ignored because GetExtensionKeys, __GetRawExtensionKeys, and GetExtensionBindings only checked default config. Fix these to check user config as well, and update the extensions config dialog to handle user-only extensions correctly.

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
3 days agogh-100305: Deemphasize that `ast.literal_eval` is safe in `eval` documentation (...
Ram Vikram Singh [Sun, 12 Apr 2026 03:07:42 +0000 (08:37 +0530)] 
gh-100305: Deemphasize that `ast.literal_eval` is safe in `eval` documentation (#100326)

Co-authored-by: Éric <merwok@netwok.org>
3 days agogh-147965: Add shutdown() to multiprocessing.Queue excluded methods (GH-147970)
WYSIATI [Sun, 12 Apr 2026 00:46:06 +0000 (08:46 +0800)] 
gh-147965: Add shutdown() to multiprocessing.Queue excluded methods (GH-147970)

The multiprocessing.Queue documentation states it implements all
methods of queue.Queue except task_done() and join(). Since
queue.Queue.shutdown() was added in Python 3.13,
multiprocessing.Queue also does not implement it. Update the docs
to include shutdown() in the list of excluded methods.

3 days agogh-97032: avoid test_squeezer crash on macOS buildbots (gh-115508) (GH-148141)
Neil Schemenauer [Sun, 12 Apr 2026 00:43:04 +0000 (17:43 -0700)] 
gh-97032: avoid test_squeezer crash on macOS buildbots (gh-115508) (GH-148141)

gh-97032: avoid test_squeezer crash on macOS buildbots (#115508)

avoid test_squeezer crash on macOS buildbots

Co-authored-by: Ned Deily <nad@python.org>
3 days agogh-148208: Fix recursion depth leak in `PyObject_Print` (GH-148209)
Wulian233 [Sun, 12 Apr 2026 00:26:18 +0000 (08:26 +0800)] 
gh-148208: Fix recursion depth leak in `PyObject_Print` (GH-148209)

3 days agogh-142831: Fix use-after-free in json encoder during re-entrant mutation (gh-142851)
Shamil [Sun, 12 Apr 2026 00:14:50 +0000 (03:14 +0300)] 
gh-142831: Fix use-after-free in json encoder during re-entrant mutation (gh-142851)

Hold strong references to borrowed items unconditionally (not only in
free-threading builds) in _encoder_iterate_mapping_lock_held and
_encoder_iterate_fast_seq_lock_held.  User callbacks invoked during
encoding can mutate or clear the underlying container, invalidating
borrowed references.

The dict iteration path was already fixed by gh-145244.

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
3 days agogh-146287: Fix signed/unsigned mismatch in _hashlib_hmac_digest_size (GH-148407)
Gregory P. Smith [Sun, 12 Apr 2026 00:02:56 +0000 (17:02 -0700)] 
gh-146287: Fix signed/unsigned mismatch in _hashlib_hmac_digest_size (GH-148407)

* gh-146287: use signed type for HMAC digest size to prevent unsigned wrapping

Change _hashlib_hmac_digest_size() return type from unsigned int to int
so that a hypothetical negative return from EVP_MD_size() is not
silently wrapped to a large positive value. Add an explicit check for
negative digest_size in the legacy OpenSSL path, and use SystemError
(not ValueError) since these conditions indicate internal invariant
violations. Also add debug-build asserts to EVP_get_block_size and
EVP_get_digest_size documenting that the hash context is always
initialized.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
3 days agotests: use errno.EBADF instead of hardcoded number in _close_file() (GH-148345)
Artem Yarulin [Sun, 12 Apr 2026 00:01:18 +0000 (03:01 +0300)] 
tests: use errno.EBADF instead of hardcoded number in _close_file() (GH-148345)

test_interpreters: use errno.EBADF instead of hardcoded number in _close_file()

Replace the hardcoded `9` check in `Lib/test/test_interpreters/utils.py` with `errno.EBADF`.

Using `errno.EBADF` makes the helper portable across platforms with different errno numbering while preserving the intended behavior.

3 days agogh-145244: Fix use-after-free on borrowed dict key in json encoder (GH-145245)
Ramin Farajpour Cami [Sat, 11 Apr 2026 22:26:36 +0000 (01:56 +0330)] 
gh-145244: Fix use-after-free on borrowed dict key in json encoder (GH-145245)

In encoder_encode_key_value(), key is a borrowed reference from
PyDict_Next(). If the default callback mutates or clears the dict,
key becomes a dangling pointer. The error path then calls
_PyErr_FormatNote("%R", key) on freed memory.

Fix by holding strong references to key and value unconditionally
during encoding, not just in the free-threading build.

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
3 days agogh-127012: `Traversable.read_text` now allows/solicits an `errors` parameter. (#148401)
Jason R. Coombs [Sat, 11 Apr 2026 22:25:20 +0000 (18:25 -0400)] 
gh-127012: `Traversable.read_text` now allows/solicits an `errors` parameter. (#148401)

Applies changes from importlib_resources 6.5.2.

3 days agogh-145105: Fix crash in csv.reader with re-entrant iterator (GH-145106)
Ramin Farajpour Cami [Sat, 11 Apr 2026 22:18:02 +0000 (01:48 +0330)] 
gh-145105: Fix crash in csv.reader with re-entrant iterator (GH-145106)

When a custom iterator calls next() on the same csv.reader from
within __next__, the inner iteration sets self->fields to NULL.
The outer iteration then crashes in parse_save_field() by passing
NULL to PyList_Append.

Add a guard after PyIter_Next() to detect that fields was set to
NULL by a re-entrant call, and raise csv.Error instead of crashing.

3 days agogh-145200: Fix EVP_MAC_CTX leak in hashlib HMAC on init failure (GH-145201)
Ramin Farajpour Cami [Sat, 11 Apr 2026 22:10:43 +0000 (01:40 +0330)] 
gh-145200: Fix EVP_MAC_CTX leak in hashlib HMAC on init failure (GH-145201)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
3 days agogh-146302: make Py_IsInitialized() thread-safe and reflect true init completion ...
Gregory P. Smith [Sat, 11 Apr 2026 21:54:23 +0000 (14:54 -0700)] 
gh-146302: make Py_IsInitialized() thread-safe and reflect true init completion (GH-146303)

## Summary

- Move the `runtime->initialized = 1` store from before `site.py` import to the end of `init_interp_main()`, so `Py_IsInitialized()` only returns true after initialization has fully completed
- Access `initialized` and `core_initialized` through new inline accessors using acquire/release atomics, to also protect from data race undefined behavior
- `PySys_AddAuditHook()` now uses the accessor, so with the flag move it correctly skips audit hook invocation during all init phases (matching the documented "after runtime initialization" behavior) ... We could argue that running these earlier would be good even if the intent was never explicitly expressed, but that'd be its own issue.

## Motivation

`Py_IsInitialized()` returned 1 while `Py_InitializeEx()` was still running — specifically, before `site.py` had been imported. See https://github.com/PyO3/pyo3/issues/5900 where a second thread could acquire the GIL and start executing Python with an incomplete `sys.path` because `site.py` hadn't finished.

The flag was also a plain `int` with no atomic operations, making concurrent reads a C-standard data race, though unlikely to manifest.

## Regression test:

The added test properly fails on `main` with `ERROR: Py_IsInitialized() was true during site import`.

---

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3 days agogh-94523: IDLE: Detect file if modified and prompt the user to refresh (GH-145625)
Shixian Li [Sat, 11 Apr 2026 21:36:59 +0000 (05:36 +0800)] 
gh-94523: IDLE: Detect file if modified and prompt the user to refresh (GH-145625)

3 days agogh-146264: Use static HACL deps for static module builds (GH-146265)
Ihar Hrachyshka [Sat, 11 Apr 2026 21:31:10 +0000 (17:31 -0400)] 
gh-146264: Use static HACL deps for static module builds (GH-146265)

3 days agogh-116738: Align bz2 unused_data getter to lzma implementation (GH-144351)
Alper [Sat, 11 Apr 2026 21:13:51 +0000 (14:13 -0700)] 
gh-116738: Align bz2 unused_data getter to lzma implementation (GH-144351)

Align bz2 unused_data getter to lzma

4 days agogh-137855: Improve import time of dataclasses by lazy importing `re` and `copy`...
Daniel Hollas [Sat, 11 Apr 2026 21:05:24 +0000 (22:05 +0100)] 
gh-137855: Improve import time of dataclasses by lazy importing  `re` and `copy` modules (#148379)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
4 days agogh-131798: do not watch immutable types in JIT (#148383)
Kumar Aditya [Sat, 11 Apr 2026 15:43:53 +0000 (21:13 +0530)] 
gh-131798: do not watch immutable types in JIT (#148383)

4 days agoDefault GHA permissions to `contents: read` (#148346)
Hugo van Kemenade [Sat, 11 Apr 2026 15:37:12 +0000 (18:37 +0300)] 
Default GHA permissions to `contents: read` (#148346)

4 days agogh-148320: document that `import sys.monitoring` raises `ModuleNotFoundError` (#148365)
Jonathan Dung [Sat, 11 Apr 2026 15:22:48 +0000 (23:22 +0800)] 
gh-148320: document that `import sys.monitoring` raises `ModuleNotFoundError` (#148365)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
4 days agogh-148374: Fix a bug in `_Py_uop_sym_get_type` (GH-148375)
Sacul [Sat, 11 Apr 2026 15:03:13 +0000 (23:03 +0800)] 
gh-148374: Fix a bug in `_Py_uop_sym_get_type` (GH-148375)

4 days agogh-131798: Add `_IS_NONE` to the JIT optimizer (GH-148369)
Wulian233 [Sat, 11 Apr 2026 15:02:46 +0000 (23:02 +0800)] 
gh-131798: Add `_IS_NONE` to the JIT optimizer (GH-148369)

4 days agogh-148276: Optimize object creation and method calls in the JIT by resolving __init__...
Pieter Eendebak [Sat, 11 Apr 2026 14:22:42 +0000 (16:22 +0200)] 
gh-148276: Optimize object creation and method calls in the JIT by resolving __init__ at trace optimization time (GH-148277)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Ken Jin <kenjin4096@gmail.com>
4 days agogh-148171: Convert `CALL_BUILTIN_CLASS` to leave arguments on the stack (gh-148381)
Donghee Na [Sat, 11 Apr 2026 14:01:25 +0000 (23:01 +0900)] 
gh-148171: Convert `CALL_BUILTIN_CLASS` to leave arguments on the stack (gh-148381)

4 days agogh-148211: decompose `_POP_TWO/_POP_CALL(_ONE/_TWO)` in JIT (GH-148377)
Neko Asakura [Sat, 11 Apr 2026 12:46:56 +0000 (08:46 -0400)] 
gh-148211: decompose `_POP_TWO/_POP_CALL(_ONE/_TWO)` in JIT (GH-148377)

4 days agogh-148211: decompose `[_POP_TWO/_INSERT_2]_LOAD_CONST_INLINE_BORROW` in JIT (GH-148357)
Neko Asakura [Sat, 11 Apr 2026 10:27:51 +0000 (06:27 -0400)] 
gh-148211: decompose `[_POP_TWO/_INSERT_2]_LOAD_CONST_INLINE_BORROW` in JIT (GH-148357)

4 days agoFix format string mismatch for `uint64_t` in `_remote_debugging/threads.c` (#148360) 148367/head
Stan Ulbrych [Sat, 11 Apr 2026 08:10:02 +0000 (09:10 +0100)] 
Fix format string mismatch for `uint64_t` in `_remote_debugging/threads.c` (#148360)

4 days agogh-148171: Convert variadic argument opcodes to leave their arguments on the stack...
Sacul [Sat, 11 Apr 2026 05:27:24 +0000 (13:27 +0800)] 
gh-148171: Convert variadic argument opcodes to leave their arguments on the stack (`CALL_BUILTIN_FAST_WITH_KEYWORDS`) (#148366)

4 days agogh-148171: convert more variadic uops to leave input on stack in JIT (#148361)
Kumar Aditya [Sat, 11 Apr 2026 04:59:38 +0000 (10:29 +0530)] 
gh-148171: convert more variadic uops to leave input on stack in JIT (#148361)

5 days agogh-142518: add thread safety docs for set C-APIs (#146562)
Kumar Aditya [Fri, 10 Apr 2026 19:33:24 +0000 (01:03 +0530)] 
gh-142518: add thread safety docs for set C-APIs (#146562)

Co-authored-by: Victor Stinner <vstinner@python.org>
5 days agogh-139038: Credit more people for JIT in 3.15 (GH-148359)
Ken Jin [Fri, 10 Apr 2026 18:59:18 +0000 (02:59 +0800)] 
gh-139038: Credit more people for JIT in 3.15 (GH-148359)

5 days agogh-142518: annotate dict C-APIs for thread safety (#145875)
Lysandros Nikolaou [Fri, 10 Apr 2026 18:41:12 +0000 (20:41 +0200)] 
gh-142518: annotate dict C-APIs for thread safety (#145875)

5 days agogh-131798: split `_CALL_BUILTIN_CLASS` to smaller uops (#148094)
Kumar Aditya [Fri, 10 Apr 2026 17:28:20 +0000 (22:58 +0530)] 
gh-131798: split `_CALL_BUILTIN_CLASS` to smaller uops (#148094)

5 days agogh-148284: Block inlining of gigantic functions in ceval.c for clang 22 (GH-148334)
Ken Jin [Fri, 10 Apr 2026 16:52:23 +0000 (00:52 +0800)] 
gh-148284: Block inlining of gigantic functions in ceval.c for clang 22 (GH-148334)

Co-authored-by: Victor Stinner <vstinner@python.org>
5 days agogh-148337: Document `importlib.resources` security model (#148340)
Stan Ulbrych [Fri, 10 Apr 2026 16:02:22 +0000 (17:02 +0100)] 
gh-148337: Document `importlib.resources` security model (#148340)

5 days agoRemove dead links to `pkg_resources` in `importlib` docs (#148344)
Stan Ulbrych [Fri, 10 Apr 2026 16:02:00 +0000 (17:02 +0100)] 
Remove dead links to `pkg_resources` in `importlib` docs (#148344)

5 days agoFix mixed line endings with pre-commit (#148336)
Hugo van Kemenade [Fri, 10 Apr 2026 15:33:11 +0000 (18:33 +0300)] 
Fix mixed line endings with pre-commit (#148336)

Co-authored-by: Zachary Ware <zachary.ware@gmail.com>
5 days agogh-146211: Reject CR/LF in HTTP tunnel request headers (#146212)
Seth Larson [Fri, 10 Apr 2026 15:21:42 +0000 (10:21 -0500)] 
gh-146211: Reject CR/LF in HTTP tunnel request headers (#146212)

Co-authored-by: Illia Volochii <illia.volochii@gmail.com>
5 days agogh-148171: Convert CALL_BUILTIN_FAST to leave inputs on the stack for refcount elimin...
Ken Jin [Fri, 10 Apr 2026 15:11:18 +0000 (23:11 +0800)] 
gh-148171: Convert CALL_BUILTIN_FAST to leave inputs on the stack for refcount elimination in JIT (GH-148172)

5 days agogh-148211: decompose `[_POP_CALL_X/_SHUFFLE_2]_LOAD_CONST_INLINE_BORROW` in JIT ...
Neko Asakura [Fri, 10 Apr 2026 13:57:01 +0000 (21:57 +0800)] 
gh-148211: decompose `[_POP_CALL_X/_SHUFFLE_2]_LOAD_CONST_INLINE_BORROW` in JIT (GH-148313)

5 days agogh-148037: remove critical section from `PyCode_Addr2Line` (#148103)
Kumar Aditya [Fri, 10 Apr 2026 12:28:17 +0000 (17:58 +0530)] 
gh-148037: remove critical section from `PyCode_Addr2Line` (#148103)

6 days agogh-145831: email.quoprimime: `decode()` leaves stray `\r` when `eol='\r\n'` (#145832)
Stefan Zetzsche [Thu, 9 Apr 2026 20:21:49 +0000 (21:21 +0100)] 
gh-145831: email.quoprimime: `decode()` leaves stray `\r` when `eol='\r\n'` (#145832)

decoded[:-1] only strips one character, leaving a stray \r when eol
is two characters. Fix: decoded[:-len(eol)].

6 days agogh-148211: decompose `_INSERT_1_LOAD_CONST_INLINE(_BORROW)` in JIT (GH-148283)
Neko Asakura [Thu, 9 Apr 2026 16:45:39 +0000 (00:45 +0800)] 
gh-148211: decompose `_INSERT_1_LOAD_CONST_INLINE(_BORROW)` in JIT (GH-148283)

6 days agogh-148254: Use singular "sec" in timeit verbose output (#148290)
gaweng [Thu, 9 Apr 2026 14:37:19 +0000 (16:37 +0200)] 
gh-148254: Use singular "sec" in timeit verbose output (#148290)

6 days agogh-134584 : Optimize and eliminate redundant ref-counting for `MAKE_FUNCTION` in...
Sacul [Thu, 9 Apr 2026 14:22:53 +0000 (22:22 +0800)] 
gh-134584 : Optimize and eliminate redundant ref-counting for  `MAKE_FUNCTION` in the JIT (GH-144963)

6 days agogh-148091: clarify asyncio.Future.cancel(msg) behaviour (#148248)
Manoj K M [Thu, 9 Apr 2026 14:11:31 +0000 (19:41 +0530)] 
gh-148091: clarify asyncio.Future.cancel(msg) behaviour (#148248)

6 days agogh-106318: Add example for str.swapcase() method (#144575)
Adorilson Bezerra [Thu, 9 Apr 2026 13:33:31 +0000 (14:33 +0100)] 
gh-106318: Add example for str.swapcase() method (#144575)

6 days agogh-148274: properly handle result from `PyObject_VisitManagedDict` (#148275)
Max Bachmann [Thu, 9 Apr 2026 13:20:50 +0000 (15:20 +0200)] 
gh-148274: properly handle result from `PyObject_VisitManagedDict` (#148275)

6 days agogh-148250: Mention str subclasses in PyUnicodeWriter_WriteStr() doc (#148251)
Victor Stinner [Thu, 9 Apr 2026 11:53:10 +0000 (13:53 +0200)] 
gh-148250: Mention str subclasses in PyUnicodeWriter_WriteStr() doc (#148251)

6 days agogh-148241: Fix json serialization for str subclasses (#148249)
Victor Stinner [Thu, 9 Apr 2026 11:50:44 +0000 (13:50 +0200)] 
gh-148241: Fix json serialization for str subclasses (#148249)

Fix json serialization: no longer call str(obj) on str subclasses.

Replace PyUnicodeWriter_WriteStr() with PyUnicodeWriter_WriteASCII()
and private _PyUnicodeWriter_WriteStr().

6 days agogh-146646: Document that glob functions suppress OSError (#147996)
WYSIATI [Thu, 9 Apr 2026 10:44:24 +0000 (18:44 +0800)] 
gh-146646: Document that glob functions suppress OSError (#147996)

6 days agogh-148286: Fail when new UB is found by CI UBSan (#148168)
Stan Ulbrych [Thu, 9 Apr 2026 09:30:53 +0000 (10:30 +0100)] 
gh-148286: Fail when new UB is found by CI UBSan (#148168)

6 days agogh-131798: fold super method lookups in JIT (#148231)
Kumar Aditya [Thu, 9 Apr 2026 07:55:01 +0000 (13:25 +0530)] 
gh-131798: fold super method lookups in JIT (#148231)

6 days agoUpdate and expand the 'Fuzz Tests for CPython' README (#148270)
Stan Ulbrych [Thu, 9 Apr 2026 07:52:30 +0000 (08:52 +0100)] 
Update and expand the 'Fuzz Tests for CPython' README (#148270)

6 days agogh-148211: refactor bool to explicit uops in JIT (GH-148258)
Neko Asakura [Thu, 9 Apr 2026 05:20:31 +0000 (13:20 +0800)] 
gh-148211: refactor bool to explicit uops in JIT (GH-148258)

6 days agogh-148225: Validate profiling.sampling replay input (#148243)
Pablo Galindo Salgado [Wed, 8 Apr 2026 23:34:46 +0000 (00:34 +0100)] 
gh-148225: Validate profiling.sampling replay input (#148243)

6 days agogh-148105: _pyrepl: switch console refresh to structured rendered screens (#146584)
Pablo Galindo Salgado [Wed, 8 Apr 2026 22:42:26 +0000 (23:42 +0100)] 
gh-148105: _pyrepl: switch console refresh to structured rendered screens (#146584)

6 days agogh-70039: smtplib: store the server name in ._host in .connect() (#115259)
nmartensen [Wed, 8 Apr 2026 21:46:25 +0000 (23:46 +0200)] 
gh-70039: smtplib: store the server name in ._host in .connect() (#115259)

Original patch by gigaplastik, extended with a few more tests.

Addresses gh-70039 and bpo-25852: failure of starttls if connect is called explicitly.

7 days agogh-148257: move wave whatsnew to correct section (#148262)
Michiel W. Beijen [Wed, 8 Apr 2026 17:53:33 +0000 (19:53 +0200)] 
gh-148257: move wave whatsnew to correct section (#148262)

7 days agoMinor edit: Four space indent in example (#148264)
Raymond Hettinger [Wed, 8 Apr 2026 17:48:54 +0000 (12:48 -0500)] 
Minor edit: Four space indent in example (#148264)

7 days agoGH-115802: Remove no-plt for Linux AArch64 (#148238)
Diego Russo [Wed, 8 Apr 2026 15:34:04 +0000 (16:34 +0100)] 
GH-115802: Remove no-plt for Linux AArch64 (#148238)

7 days agogh-148210: fix incorrect `_BINARY_OP_SUBSCR_DICT` JIT optimization (GH-148213)
Kumar Aditya [Wed, 8 Apr 2026 15:23:20 +0000 (20:53 +0530)] 
gh-148210: fix incorrect `_BINARY_OP_SUBSCR_DICT` JIT optimization  (GH-148213)

7 days agogh-145866: Convert `_CALL_METHOD_DESCRIPTOR_NOARGS` to leave its inputs on the stack...
Sacul [Wed, 8 Apr 2026 15:21:37 +0000 (23:21 +0800)] 
gh-145866: Convert `_CALL_METHOD_DESCRIPTOR_NOARGS` to leave its inputs on the stack to be cleaned up by _POP_TOP (GH-148227)

7 days agogh-148211: decompose `_POP_TOP_LOAD_CONST_INLINE(_BORROW)` in JIT (GH-148230)
Neko Asakura [Wed, 8 Apr 2026 15:20:31 +0000 (23:20 +0800)] 
gh-148211: decompose `_POP_TOP_LOAD_CONST_INLINE(_BORROW)` in JIT (GH-148230)

7 days agogh-37883: Safely skip test_resource file size tests when limits are strict (GH-145579)
Shrey Naithani [Wed, 8 Apr 2026 14:06:05 +0000 (19:36 +0530)] 
gh-37883: Safely skip test_resource file size tests when limits are strict (GH-145579)

7 days agogh-146609: Add colour to `timeit` CLI output (#146610)
Hugo van Kemenade [Wed, 8 Apr 2026 13:18:53 +0000 (16:18 +0300)] 
gh-146609: Add colour to `timeit` CLI output (#146610)

Co-authored-by: Stan Ulbrych <stan@python.org>
7 days agogh-146292: Add colour to `http.server` logs (GH-146293)
Hugo van Kemenade [Wed, 8 Apr 2026 12:10:05 +0000 (15:10 +0300)] 
gh-146292: Add colour to `http.server` logs (GH-146293)

Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
7 days agogh-148235: remove duplicate uops `_LOAD_CONST_UNDER_INLINE(_BORROW)` in JIT (GH-148236)
Neko Asakura [Wed, 8 Apr 2026 08:22:59 +0000 (16:22 +0800)] 
gh-148235: remove duplicate uops `_LOAD_CONST_UNDER_INLINE(_BORROW)` in JIT (GH-148236)

7 days agogh-145921: Add "_DuringGC" functions for tp_traverse (GH-145925)
Petr Viktorin [Wed, 8 Apr 2026 07:15:11 +0000 (09:15 +0200)] 
gh-145921: Add "_DuringGC" functions for tp_traverse (GH-145925)

There are newly documented restrictions on tp_traverse:

    The traversal function must not have any side effects.
    It must not modify the reference counts of any Python
    objects nor create or destroy any Python objects.

* Add several functions that are guaranteed side-effect-free,
  with a _DuringGC suffix.
* Use these in ctypes
* Consolidate tp_traverse docs in gcsupport.rst, moving unique
  content from typeobj.rst there

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
7 days agogh-146458: Fix REPL height and width tracking on resize (#146459)
Gabriel Volles Marinho [Tue, 7 Apr 2026 21:09:11 +0000 (18:09 -0300)] 
gh-146458: Fix REPL height and width tracking on resize (#146459)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
8 days agogh-145846: Fix memory leak in _lsprof clearEntries() context chain (#145847)
Ramin Farajpour Cami [Tue, 7 Apr 2026 20:56:19 +0000 (00:26 +0330)] 
gh-145846: Fix memory leak in _lsprof clearEntries() context chain (#145847)

clearEntries() only freed the top currentProfilerContext but did not
walk the previous linked list. When clear() is called during active
profiling with nested calls, all contexts except the top one were
leaked. Fix by iterating the entire linked list, matching the existing
freelistProfilerContext cleanup pattern.

Co-authored-by: Victor Stinner <vstinner@python.org>
8 days agogh-142518: add thread safety annotations for tuple C-API (#148012)
Kumar Aditya [Tue, 7 Apr 2026 20:25:44 +0000 (01:55 +0530)] 
gh-142518: add thread safety annotations for tuple C-API (#148012)

8 days agoMerge branch 'main' of https://github.com/python/cpython
Hugo van Kemenade [Tue, 7 Apr 2026 17:34:01 +0000 (20:34 +0300)] 
Merge branch 'main' of https://github.com/python/cpython

8 days agoPost 3.15.0a8
Hugo van Kemenade [Tue, 7 Apr 2026 17:32:33 +0000 (20:32 +0300)] 
Post 3.15.0a8

8 days agogh-95004: specialize access to enums and fix scaling on free-threading (#148184)
Kumar Aditya [Tue, 7 Apr 2026 16:13:50 +0000 (21:43 +0530)] 
gh-95004: specialize access to enums and fix scaling on free-threading (#148184)

Co-authored-by: Ken Jin <kenjin4096@gmail.com>
8 days agogh-146333: Fix quadratic regex backtracking in configparser option parsing (GH-146399)
Joshua Swanson [Tue, 7 Apr 2026 14:10:34 +0000 (16:10 +0200)] 
gh-146333: Fix quadratic regex backtracking in configparser option parsing (GH-146399)

Use negative lookahead in option regex to prevent backtracking, and to avoid changing logic outside the regexes (since people could use the regex directly).

8 days agogh-148014: Accept a function name in -X presite option (#148015)
Victor Stinner [Tue, 7 Apr 2026 14:05:39 +0000 (16:05 +0200)] 
gh-148014: Accept a function name in -X presite option (#148015)

8 days agogh-146547: Use lazy imports in ctypes (GH-146548)
Jonathan Dung [Tue, 7 Apr 2026 13:26:53 +0000 (21:26 +0800)] 
gh-146547: Use lazy imports in ctypes (GH-146548)

8 days agogh-130273: Fix traceback color output with unicode characters (GH-142529)
grayjk [Tue, 7 Apr 2026 13:05:23 +0000 (09:05 -0400)] 
gh-130273: Fix traceback color output with unicode characters (GH-142529)

Account for the display width of Unicode characters so that colors and underlining in traceback output is correct.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Victor Stinner <vstinner@python.org>
8 days agoPython 3.15.0a8 v3.15.0a8
Hugo van Kemenade [Tue, 7 Apr 2026 11:20:51 +0000 (14:20 +0300)] 
Python 3.15.0a8

8 days agogh-146121: Clarify security model of pkgutil.getdata; revert checks (GH-148197)
Petr Viktorin [Tue, 7 Apr 2026 09:39:50 +0000 (11:39 +0200)] 
gh-146121: Clarify security model of pkgutil.getdata; revert checks (GH-148197)

This reverts commit bcdf231946b1da8bdfbab4c05539bb0cc964a1c7,
and clarifies get_data's security model.

Co-authored-by: Stan Ulbrych <stan@python.org>
8 days agoGH-145762: Fix test_ci_fuzz_stdlib for source archive builds (#145778)
Chris Eibl [Tue, 7 Apr 2026 09:02:15 +0000 (11:02 +0200)] 
GH-145762: Fix test_ci_fuzz_stdlib for source archive builds (#145778)

Co-authored-by: Stan Ulbrych <stan@ulbrych.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
8 days agogh-101178: Fix UB in `binascii.b2a_ascii85` (#148166)
Stan Ulbrych [Tue, 7 Apr 2026 07:44:03 +0000 (08:44 +0100)] 
gh-101178: Fix UB in `binascii.b2a_ascii85` (#148166)

8 days agogh-146636: abi3t: Define Py_GIL_DISABLED but do not use it (GH-148142)
Petr Viktorin [Tue, 7 Apr 2026 07:06:17 +0000 (09:06 +0200)] 
gh-146636: abi3t: Define Py_GIL_DISABLED but do not use it (GH-148142)

When compiling for abi3t, define Py_GIL_DISABLED, so that users who
check it to enable additional locking aren't broken.

But also avoid using Py_GIL_DISABLED in Python headers themselves
-- abi3 and abi3t ought to be the same except
the _Py_OPAQUE_PYOBJECT differences.

A check for this is coming in a later PR.
It will require rewriting some preprocessor conditions, some of these
changes are included in this PR.
For _Py_IsOwnedByCurrentThread & supporting functions
I opted to move them to a cpython/ header, as they're rather self-contained.

8 days agogh-144503: Pass sys.argv to forkserver as real argv elements (GH-148194)
Gregory P. Smith [Tue, 7 Apr 2026 05:41:02 +0000 (22:41 -0700)] 
gh-144503: Pass sys.argv to forkserver as real argv elements (GH-148194)

Avoid embedding the parent's sys.argv into the forkserver -c command
string via repr().  When sys.argv is large (e.g. thousands of file
paths from a pre-commit hook), the resulting single argument could
exceed the OS per-argument length limit (MAX_ARG_STRLEN on Linux,
typically 128 KiB), causing posix_spawn to fail and the parent to
observe a BrokenPipeError.

Instead, append the argv entries as separate command-line arguments
after -c; the forkserver child reads them back as sys.argv[1:].  This
cannot exceed any limit the parent itself did not already satisfy.

Regression introduced by gh-143706 / 298d5440eb8.

8 days agoGH-146128: Remove the buggy AArch64 "33rx" relocation (#146263)
Brandt Bucher [Tue, 7 Apr 2026 04:52:59 +0000 (21:52 -0700)] 
GH-146128: Remove the buggy AArch64 "33rx" relocation (#146263)

8 days agogh-112632: Add optional keyword-only argument `expand` to `pprint` (#136964)
Semyon Moroz [Tue, 7 Apr 2026 04:42:54 +0000 (08:42 +0400)] 
gh-112632: Add optional keyword-only argument `expand` to `pprint` (#136964)

Co-authored-by: stodoran <stefan.todoran@uipath.com>
Co-authored-by: StefanTodoran <stefan.alex4@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>
8 days agoNote out-of-date obmalloc comments (#148149)
Tim Peters [Tue, 7 Apr 2026 04:08:47 +0000 (23:08 -0500)] 
Note out-of-date obmalloc comments (#148149)

Vladimir's original overviews, from 1998, are still good, but going
on 30 years later details have changed. Note that, but rather try
to keep up with moving targets in a different file, point to
sys._debugmallocstats() as the sure way to discover precise current
details.

No code changes, just added a block comment.

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
8 days agogh-145844: Update WASI SDK from 30 to 32 (#145859)
Mazin Sharaf [Mon, 6 Apr 2026 23:48:38 +0000 (09:48 +1000)] 
gh-145844: Update WASI SDK from 30 to 32 (#145859)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Brett Cannon <brett@python.org>
8 days agogh-73613: clarify padding= docs in for base64 & binascii modules (GH-148183)
Gregory P. Smith [Mon, 6 Apr 2026 23:45:13 +0000 (16:45 -0700)] 
gh-73613: clarify padding= docs in for base64 & binascii modules (GH-148183)

Based on mayeut's comment in https://github.com/python/cpython/pull/147974#discussion_r3038498019.

8 days agogh-148110: Resolve lazy import filter names for relative imports (#148111)
Pablo Galindo Salgado [Mon, 6 Apr 2026 21:29:02 +0000 (22:29 +0100)] 
gh-148110: Resolve lazy import filter names for relative imports (#148111)

9 days agogh-137586: Open external osascript program with absolute path (GH-137584)
Fionn [Mon, 6 Apr 2026 16:42:10 +0000 (00:42 +0800)] 
gh-137586: Open external osascript program with absolute path (GH-137584)

Open web browser with absolute path

On macOS, web browsers are opened via popen calling osascript. However,
if a user has a colliding osascript executable earlier in their PATH,
this may fail or cause unwanted behaviour.

Depending on one's environment or level of paranoia, this may be considered a security vulnerability.

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
9 days agogh-148072: Cache pickle.dumps/loads per interpreter in XIData (GH-148125)
Junya Fukuda [Mon, 6 Apr 2026 15:37:02 +0000 (00:37 +0900)] 
gh-148072: Cache pickle.dumps/loads per interpreter in XIData (GH-148125)

Store references to pickle.dumps and pickle.loads in _PyXI_state_t
so they are looked up only once per interpreter lifetime, avoiding
repeated PyImport_ImportModuleAttrString calls on every cross-interpreter
data transfer via pickle fallback.

Benchmarks show 1.7x-3.3x speedup for InterpreterPoolExecutor
when transferring mutable types (list, dict) through XIData.

9 days agogh-130472: Remove readline-only hacks from PyREPL completions (#148161)
Pablo Galindo Salgado [Mon, 6 Apr 2026 14:57:25 +0000 (15:57 +0100)] 
gh-130472: Remove readline-only hacks from PyREPL completions (#148161)

PyREPL was still carrying over two readline-specific tricks from the
fancy completer: a synthetic CSI prefix to influence sorting and a fake
blank completion entry to suppress readline's prefix insertion. Those
workarounds are not appropriate in PyREPL because the reader already
owns completion ordering and menu rendering, so the fake entries leaked
into the UI as real terminal attributes and empty menu cells.

Sort completion candidates in ReadlineAlikeReader by their visible text
with stripcolor(), and let the fancy completer return only real matches.
That keeps colored completions stable without emitting bogus escape
sequences, removes the empty completion slot, and adds regression tests
for both the low-level completer output and the reader integration.

9 days agogh-140279: Stale workflow needs 'actions: write' to update its own cache (#148165)
Hugo van Kemenade [Mon, 6 Apr 2026 13:07:15 +0000 (16:07 +0300)] 
gh-140279: Stale workflow needs 'actions: write' to update its own cache (#148165)

9 days agogh-100239: Propagate type info through _BINARY_OP_EXTEND in tier 2 (GH-148146)
Pieter Eendebak [Mon, 6 Apr 2026 12:52:42 +0000 (14:52 +0200)] 
gh-100239: Propagate type info through _BINARY_OP_EXTEND in tier 2 (GH-148146)

9 days agoAdd Stan to docs config reviewers (#148164)
Stan Ulbrych [Mon, 6 Apr 2026 12:47:44 +0000 (13:47 +0100)] 
Add Stan to docs config reviewers (#148164)

9 days agogh-148119: Refactor `get_type_attr_as_size` to improve error handling in `structseq...
Wulian233 [Mon, 6 Apr 2026 12:11:30 +0000 (20:11 +0800)] 
gh-148119: Refactor `get_type_attr_as_size` to improve error handling in `structseq.c` (#148120)

9 days ago gh-148157: Check for `_PyPegen_add_type_comment_to_arg` fail in `_PyPegen_name_defau...
Stan Ulbrych [Mon, 6 Apr 2026 11:56:36 +0000 (12:56 +0100)] 
 gh-148157: Check for `_PyPegen_add_type_comment_to_arg` fail in `_PyPegen_name_default_pair` (#148158)

9 days agoDocs: Update "Installing Python modules" (#146249)
Hugo van Kemenade [Mon, 6 Apr 2026 11:21:59 +0000 (14:21 +0300)] 
Docs: Update "Installing Python modules" (#146249)