Commit graph

130955 commits

Author SHA1 Message Date
CoolCat467
208195dff4
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>
2026-04-12 04:44:33 +00:00
Ram Vikram Singh
b3b0cef0c2
gh-100305: Deemphasize that ast.literal_eval is safe in eval documentation (#100326)
Co-authored-by: Éric <merwok@netwok.org>
2026-04-12 03:07:42 +00:00
WYSIATI
22290ed011
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.
2026-04-11 17:46:06 -07:00
Neil Schemenauer
b216d7b0be
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>
2026-04-11 17:43:04 -07:00
Wulian233
e2fa10e04d
gh-148208: Fix recursion depth leak in PyObject_Print (GH-148209) 2026-04-11 17:26:18 -07:00
Shamil
235fa7244a
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>
2026-04-12 00:14:50 +00:00
Gregory P. Smith
d761f539bd
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>
2026-04-12 00:02:56 +00:00
Artem Yarulin
cef334fd4c
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.
2026-04-11 17:01:18 -07:00
Ramin Farajpour Cami
8a466fa3d9
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>
2026-04-11 22:26:36 +00:00
Jason R. Coombs
daa2578dc0
gh-127012: Traversable.read_text now allows/solicits an errors parameter. (#148401)
Applies changes from importlib_resources 6.5.2.
2026-04-11 22:25:20 +00:00
Ramin Farajpour Cami
20994b1809
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.
2026-04-11 15:18:02 -07:00
Ramin Farajpour Cami
c29d75610b
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>
2026-04-11 15:10:43 -07:00
Gregory P. Smith
64afa947f4
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>
2026-04-11 21:54:23 +00:00
Shixian Li
6e2272d0b1
gh-94523: IDLE: Detect file if modified and prompt the user to refresh (GH-145625) 2026-04-11 14:36:59 -07:00
Ihar Hrachyshka
f445d2e866
gh-146264: Use static HACL deps for static module builds (GH-146265) 2026-04-11 14:31:10 -07:00
Alper
afbe1373ac
gh-116738: Align bz2 unused_data getter to lzma implementation (GH-144351)
Align bz2 unused_data getter to lzma
2026-04-11 14:13:51 -07:00
Daniel Hollas
dd2735d177
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>
2026-04-11 21:05:24 +00:00
Kumar Aditya
ba1e1c192b
gh-131798: do not watch immutable types in JIT (#148383) 2026-04-11 15:43:53 +00:00
Hugo van Kemenade
9c9df8ac8c
Default GHA permissions to contents: read (#148346) 2026-04-11 18:37:12 +03:00
Jonathan Dung
d7c9f1877c
gh-148320: document that import sys.monitoring raises ModuleNotFoundError (#148365)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-04-11 17:22:48 +02:00
Sacul
83f33dccf2
gh-148374: Fix a bug in _Py_uop_sym_get_type (GH-148375) 2026-04-11 23:03:13 +08:00
Wulian233
a059e85866
gh-131798: Add _IS_NONE to the JIT optimizer (GH-148369) 2026-04-11 23:02:46 +08:00
Pieter Eendebak
1c89817f51
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>
2026-04-11 22:22:42 +08:00
Donghee Na
a71b043356
gh-148171: Convert CALL_BUILTIN_CLASS to leave arguments on the stack (gh-148381) 2026-04-11 23:01:25 +09:00
Neko Asakura
9831dea3bf
gh-148211: decompose _POP_TWO/_POP_CALL(_ONE/_TWO) in JIT (GH-148377) 2026-04-11 20:46:56 +08:00
Neko Asakura
72006a71b2
gh-148211: decompose [_POP_TWO/_INSERT_2]_LOAD_CONST_INLINE_BORROW in JIT (GH-148357) 2026-04-11 18:27:51 +08:00
Stan Ulbrych
639f218f9c
Fix format string mismatch for uint64_t in _remote_debugging/threads.c (#148360) 2026-04-11 09:10:02 +01:00
Sacul
e872c19922
gh-148171: Convert variadic argument opcodes to leave their arguments on the stack (CALL_BUILTIN_FAST_WITH_KEYWORDS) (#148366) 2026-04-11 13:27:24 +08:00
Kumar Aditya
2b439da972
gh-148171: convert more variadic uops to leave input on stack in JIT (#148361) 2026-04-11 10:29:38 +05:30
Kumar Aditya
dd88e77fad
gh-142518: add thread safety docs for set C-APIs (#146562)
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-04-10 19:33:24 +00:00
Ken Jin
c4d95124b1
gh-139038: Credit more people for JIT in 3.15 (GH-148359) 2026-04-11 02:59:18 +08:00
Lysandros Nikolaou
15d10a8243
gh-142518: annotate dict C-APIs for thread safety (#145875) 2026-04-10 18:41:12 +00:00
Kumar Aditya
8f17140fc1
gh-131798: split _CALL_BUILTIN_CLASS to smaller uops (#148094) 2026-04-10 17:28:20 +00:00
Ken Jin
e007631e99
gh-148284: Block inlining of gigantic functions in ceval.c for clang 22 (GH-148334)
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-04-11 00:52:23 +08:00
Stan Ulbrych
70b86e7829
gh-148337: Document importlib.resources security model (#148340) 2026-04-10 17:02:22 +01:00
Stan Ulbrych
1b691564a7
Remove dead links to pkg_resources in importlib docs (#148344) 2026-04-10 17:02:00 +01:00
Hugo van Kemenade
fc5df4d723
Fix mixed line endings with pre-commit (#148336)
Co-authored-by: Zachary Ware <zachary.ware@gmail.com>
2026-04-10 18:33:11 +03:00
Seth Larson
05ed7ce7ae
gh-146211: Reject CR/LF in HTTP tunnel request headers (#146212)
Co-authored-by: Illia Volochii <illia.volochii@gmail.com>
2026-04-10 15:21:42 +00:00
Ken Jin
266247c9a6
gh-148171: Convert CALL_BUILTIN_FAST to leave inputs on the stack for refcount elimination in JIT (GH-148172) 2026-04-10 23:11:18 +08:00
Neko Asakura
aea0b91d65
gh-148211: decompose [_POP_CALL_X/_SHUFFLE_2]_LOAD_CONST_INLINE_BORROW in JIT (GH-148313) 2026-04-10 21:57:01 +08:00
Kumar Aditya
d3b7b93cbb
gh-148037: remove critical section from PyCode_Addr2Line (#148103) 2026-04-10 17:58:17 +05:30
Stefan Zetzsche
1a0edb1fa8
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)].
2026-04-09 16:21:49 -04:00
Neko Asakura
0f49232664
gh-148211: decompose _INSERT_1_LOAD_CONST_INLINE(_BORROW) in JIT (GH-148283) 2026-04-10 00:45:39 +08:00
gaweng
d8c5658156
gh-148254: Use singular "sec" in timeit verbose output (#148290) 2026-04-09 17:37:19 +03:00
Sacul
38d3aef375
gh-134584 : Optimize and eliminate redundant ref-counting for MAKE_FUNCTION in the JIT (GH-144963) 2026-04-09 22:22:53 +08:00
Manoj K M
2acb8d9257
gh-148091: clarify asyncio.Future.cancel(msg) behaviour (#148248) 2026-04-09 19:41:31 +05:30
Adorilson Bezerra
d11e9ff8ca
gh-106318: Add example for str.swapcase() method (#144575) 2026-04-09 16:33:31 +03:00
Max Bachmann
ee2775cfae
gh-148274: properly handle result from PyObject_VisitManagedDict (#148275) 2026-04-09 18:50:50 +05:30
Victor Stinner
8c524503cd
gh-148250: Mention str subclasses in PyUnicodeWriter_WriteStr() doc (#148251) 2026-04-09 13:53:10 +02:00
Victor Stinner
b7e1d51e6b
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().
2026-04-09 13:50:44 +02:00