Commit graph

128935 commits

Author SHA1 Message Date
Miss Islington (bot)
5fa025aebe
[3.14] gh-69223: Document that add_argument() returns an Action object (GH-145538) (#145595)
Co-authored-by: Andrew Barnes <bortstheboat@gmail.com>
2026-03-15 14:08:21 +00:00
Miss Islington (bot)
54fd6766d2
[3.14] Bump mypy to 1.19.1 (GH-145956) (#145971)
Bump mypy to 1.19.1 (GH-145956)
(cherry picked from commit e167e06f8c)

Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
2026-03-15 10:16:05 +00:00
Miss Islington (bot)
331ac071ef
[3.14] gh-141004: Document PyDTrace* (GH-141856) (GH-145959)
gh-141004: Document `PyDTrace*` (GH-141856)
(cherry picked from commit 1dfe99ae3b)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2026-03-15 03:04:49 +00:00
Miss Islington (bot)
1749b3c686
[3.14] gh-143636: fix a crash when calling `__replace__ on invalid SimpleNamespace` instances (GH-143655) (#145938)
gh-143636: fix a crash when calling ``__replace__`` on invalid `SimpleNamespace` instances (GH-143655)
(cherry picked from commit 97968564b6)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-03-14 10:35:41 +00:00
Miss Islington (bot)
ef757268e0
[3.14] Docs: fix missing period in Doc/library/stdtypes.rst (GH-145935) (#145936)
Docs: fix missing period in `Doc/library/stdtypes.rst` (GH-145935)
(cherry picked from commit 51e8acf8de)

Co-authored-by: Connor Gibson <connor@nextdoortech.net>
2026-03-14 09:26:32 +00:00
Stan Ulbrych
87fac9b8ee
[3.14] gh-145783: Propagate errors raised in NEW_TYPE_COMMENT (GH-145784) (#145926) 2026-03-13 18:08:04 +00:00
Thomas Kowalski
c3ea6c291e
[3.14] gh-145713: make bytearray.resize thread-safe on free-threading (#145714) (#145799)
gh-145713: make bytearray.resize thread-safe on free-threading (#145714)


(cherry picked from commit c3955e049f)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-03-13 20:34:24 +05:30
Miss Islington (bot)
7e4dc65ad8
[3.14] gh-142518: Document thread-safety guarantees of set objects (GH-145225) (#145915)
(cherry picked from commit 79b91e7c50)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2026-03-13 13:59:17 +00:00
Miss Islington (bot)
d9c26676b2
[3.14] gh-145792: Fix incorrect alloca allocation size in traceback.c (GH-145814) (#145909)
gh-145792: Fix incorrect alloca allocation size in traceback.c (GH-145814)
(cherry picked from commit 59d97683c1)

Co-authored-by: VanshAgarwal24036 <148854295+VanshAgarwal24036@users.noreply.github.com>
2026-03-13 12:45:18 +00:00
bkap123
485699216f
[3.14] gh-145446: Add critical section in functools module for PyDict_Next (GH-145487) (GH-145879)
(cherry picked from commit 17eb0354ff)
2026-03-13 13:21:04 +01:00
Miss Islington (bot)
b5e5013378
[3.14] Docs: except with multiple exceptions parentheses not required (GH-145848) (#145904)
Docs: except with multiple exceptions parentheses not required (GH-145848)

As of PEP 758 the except statement doesn't require parentheses anymore for exception tuples.
(cherry picked from commit 6d1e9ceed3)


See: https://peps.python.org/pep-0758/

Co-authored-by: Maurizio Sambati <duilio@users.noreply.github.com>
2026-03-13 06:12:02 -04:00
bkap123
2af2a38302
[3.14] gh-145036: Fix data race for list capacity in free-threading (GH-145365) (#145881)
(cherry picked from commit 9e0802330c)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-03-12 22:06:12 -04:00
Miss Islington (bot)
8c0a190dd3
[3.14] gh-145801: Use gcc -fprofile-update=atomic for PGO builds (GH-145802) (#145892)
gh-145801: Use gcc -fprofile-update=atomic for PGO builds (GH-145802)

When Python build is optimized with GCC using PGO, use
-fprofile-update=atomic option to use atomic operations when updating
profile information. This option reduces the risk of gcov Data Files
(.gcda) corruption which can cause random GCC crashes.
(cherry picked from commit 08a018ebe0)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-12 23:13:13 +00:00
Miss Islington (bot)
cedff2d617
[3.14] gh-145685: Improve scaling of type attribute lookups (gh-145774) (#145874)
Avoid locking in the PyType_Lookup cache-miss path if the type's
tp_version_tag is already valid.

(cherry picked from commit cd52172831)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2026-03-12 14:33:05 -04:00
Miss Islington (bot)
6669b20514
[3.14] gh-140131: Fix REPL cursor position on Windows when module completion suggestion line hits console width (GH-140333) (GH-145871)
(cherry picked from commit e13f6dccd7)

Co-authored-by: Tan Long <tanloong@foxmail.com>
2026-03-12 18:15:05 +01:00
Miss Islington (bot)
f9589cb1b2
[3.14] gh-145254: Add thread safety annotation in docs (GH-145255) (#145862)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2026-03-12 15:36:58 +02:00
Sergey Miryanov
705e3ea9d1
[3.14] GH-91636: Clear weakrefs created by finalizers. (GH-136401) (#144444)
Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
2026-03-12 14:10:29 +02:00
Miss Islington (bot)
295f21498e
[3.14] gh-140594: Fix an out of bounds read when feeding NUL byte to PyOS_StdioReadline() (GH-140910) (#145852)
gh-140594: Fix an out of bounds read when feeding NUL byte to PyOS_StdioReadline() (GH-140910)
(cherry picked from commit 86a0756234)

Co-authored-by: Shamil <ashm.tech@proton.me>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-12 11:24:20 +00:00
Miss Islington (bot)
59be951e15
[3.14] gh-145492: Fix defaultdict __repr__ infinite recursion (GH-145659) (GH-145747)
(cherry picked from commit 2d35f9bc1c)

Includes test fix-up from GH-145788
(cherry picked from commit aa4240ebea)

Co-authored-by: Thomas Kowalski <thom.kowa@gmail.com>
Co-authored-by: Matt Van Horn <mvanhorn@users.noreply.github.com>
2026-03-12 10:45:31 +01:00
Serhiy Storchaka
a778fd6004
[3.14] gh-145736: Fix Tkinter tests for Tk 8.7, 9.0 and 9.1 (GH-145738) (GH-145841)
(cherry picked from commit 77d6d5d8fc)
2026-03-12 02:41:14 +02:00
Łukasz Langa
0a80015ac2
[3.14] gh-139933: correctly suggest attributes for classes with a custom __dir__ (GH-139950) (GH-145827)
(cherry picked from commit 4722202a1a)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-03-11 16:11:38 +01:00
Miss Islington (bot)
717ebd7a36
[3.14] gh-142518: Improve mimalloc allocator docs (GH-145224) (#145823)
(cherry picked from commit 7a1da4575b)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2026-03-11 15:28:11 +01:00
Miss Islington (bot)
f688a4bafd
[3.14] gh-99875: Document rounding mode for old-style formatting (GH-126382) (#145811)
gh-99875: Document rounding mode for old-style formatting (GH-126382)
(cherry picked from commit ce1abaf9b8)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2026-03-11 13:31:44 +00:00
Miss Islington (bot)
ca8ca6bb0f
[3.14] gh-145591: Move slicing note to __getitem__ (GH-145606) (GH-145760)
(cherry picked from commit 2114da976c)

Co-authored-by: Ali Towaiji <145403626+Towaiji@users.noreply.github.com>
2026-03-11 13:58:03 +01:00
Miss Islington (bot)
6080c86609
[3.14] Warn that overriding __builtins__ for eval is not a security mechanism (GH-145773) (GH-145808)
(cherry picked from commit eb9ae65e5b)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
2026-03-11 13:43:19 +01:00
Sam Gross
6d28aaf24d
[3.14] gh-145685: Avoid contention on TYPE_LOCK in super() lookups (gh-145775) (#145804)
(cherry picked from commit bdf6de8c3f)
2026-03-11 11:50:13 +00:00
Miss Islington (bot)
f4d53321a7
[3.14] gh-101100: Fix sphinx reference warnings around I/O (GH-139592) (#145794)
Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2026-03-11 08:08:09 +00:00
Miss Islington (bot)
e765696ca0
[3.14] gh-145607: Ensure BIG_DATA has two compressed blocks in test_bz2 (GH-145730) (#145733)
gh-145607: Ensure BIG_DATA has two compressed blocks in test_bz2 (GH-145730)
(cherry picked from commit 19676e5fc2)

Co-authored-by: Emma Smith <emma@emmatyping.dev>
2026-03-10 21:07:38 -07:00
Miss Islington (bot)
e5d8d80bdf
[3.14] gh-145219: Cache Emscripten build dependencies, add install-emscripten (GH-145664) (#145790)
Modifies the Emscripten build script to allow for caching of dependencies, and
for automated installation of new EMSDK versions.
(cherry picked from commit ebb150e76a)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2026-03-11 00:50:36 +00:00
Miss Islington (bot)
79051f8a07
[3.14] gh-142763: Fix race in ZoneInfo cache eviction (gh-144978) (#145781)
The cache may be cleared between the evaluation of the if statement and the
call to popitem.

(cherry picked from commit 665c1db94f)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2026-03-10 19:39:40 +00:00
Miss Islington (bot)
e7bc1526ca
[3.14] gh-145685: Update find_name_in_mro() to return a _PyStackRef (gh-145693) (#145769)
(cherry picked from commit f26eca7732)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2026-03-10 15:25:46 -04:00
Miss Islington (bot)
e12cc26616
[3.14] gh-145010: Fix Python.h compilation with -masm=intel (GH-145011) (#145776)
(cherry picked from commit 9c1c71066e)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2026-03-10 18:07:17 +00:00
Miss Islington (bot)
e9f3664a51
[3.14] Fix integer overflow for formats "s" and "p" in the struct module (GH-145750) (GH-145772)
(cherry picked from commit 4d0dce0c8d)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-03-10 17:26:01 +00:00
Miss Islington (bot)
0af35f5a85
[3.14] gh-144173: fix flaky test_complex.test_truediv() (GH-144355) (#145766)
gh-144173: fix flaky test_complex.test_truediv() (GH-144355)

Previously, component-wise relative error bound was tested.  However,
such bound can't exist already for complex multiplication as one can be
used to perform subtraction of floating-point numbers, e.g. x and y for
z0=1+1j and z1=x+yj.

```pycon
>>> x, y = 1e-9+1j, 1+1j
>>> a = x*y*y.conjugate()/2;a
(1.0000000272292198e-09+1j)
>>> b = x*(y*y.conjugate()/2);b
(1e-09+1j)
>>> b == x
True
>>> (a.real-b.real)/math.ulp(b.real)
131672427.0
```
(cherry picked from commit c4333a1270)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2026-03-10 17:08:00 +00:00
Miss Islington (bot)
7e389260aa
[3.14] gh-145743: Fix inconsistency after calling Struct.__init__() with invalid format (GH-145744) (GH-145763)
Only set the format attribute after successful (re-)initialization.
(cherry picked from commit 3f33bf83e8)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-03-10 16:55:58 +00:00
Stan Ulbrych
6d9221c7d1
[3.14] gh-145376: Fix various reference leaks (GH-145377) (GH-145712)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2026-03-10 16:31:02 +01:00
Miss Islington (bot)
05b074cf81
[3.14] Docs: Improve the C API documentation involving threads (GH-145520) (GH-145757)
Docs: Improve the C API documentation involving threads (GH-145520)
(cherry picked from commit 7990313afa)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-03-10 15:03:28 +00:00
Miss Islington (bot)
387abcce91
[3.14] gh-106318: Add examples for str.isspace() docs (GH-145399) (#145752)
Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
2026-03-10 14:25:46 +00:00
Miss Islington (bot)
50eafe77ef
[3.14] Docs: Update programming FAQ (GH-144573) (#145695)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Savannah Ostrowski <savannah@python.org>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <stan@ulbrych.org>
2026-03-10 16:17:11 +02:00
Sam Gross
54024655ae
[3.14] gh-145685: Stop the world when updating MRO of existing types (gh-145707) (#145715)
We already have a stop-the-world pause elsewhere in this code path
(type_set_bases) and this makes will make it easier to avoid contention
on the TYPE_LOCK when looking up names in the MRO hierarchy.

Also use deferred reference counting for non-immortal MROs.
(cherry picked from commit 0b65c88c2a)
2026-03-10 09:31:52 -04:00
Miss Islington (bot)
a5ed66df8a
[3.14] gh-142651: use NonCallableMock._lock for thread safety of call_count (GH-142922) (#145739)
gh-142651: use `NonCallableMock._lock` for thread safety of `call_count` (GH-142922)
(cherry picked from commit 728e4a075e)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-03-10 12:39:45 +00:00
Hugo van Kemenade
ed2df30f40
[3.14] gh-140715: Improve class reference links on datetime.rst (GH-123980) (#145388)
Co-authored-by: edson duarte <eduarte.uatach@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-03-10 13:38:20 +02:00
Hugo van Kemenade
bd26ed307d
[3.14] gh-140681: Freeze pre-commit hooks and update zizmor links (GH-140682) (#145536)
Co-authored-by: Xianpeng Shen <xianpeng.shen@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-03-10 13:37:46 +02:00
Petr Viktorin
30bcdcd379
[3.14] Document that PyType_GetModule returns a borrowed ref (GH-145612) (GH-145682)
(cherry picked from commit 44855458a4)
2026-03-10 10:06:08 +01:00
Miss Islington (bot)
5b25aab02d
[3.14] gh-145541: Fix InvalidStateError in BaseSubprocessTransport._call_connection_lost() (GH-145554) (#145676)
gh-145541: Fix `InvalidStateError` in `BaseSubprocessTransport._call_connection_lost()` (GH-145554)
(cherry picked from commit 1564e231aa)

Co-authored-by: Daan De Meyer <daan.j.demeyer@gmail.com>
2026-03-10 10:11:31 +05:30
Miss Islington (bot)
6c6acb36ba
[3.14] Remove the distutils-sig@python.org email in 'Installing Python Modules' (GH-145613) (#145708)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-03-09 22:16:23 +00:00
Miss Islington (bot)
0db2beee6b
[3.14] gh-145701: Fix __classdict__ & __conditional_annotations__ in class-scope inlined comprehensions (GH-145702) (#145710)
(cherry picked from commit 63eaaf9599)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>

* Add `:oss-fuzz:` supports

Backports part of 255e79fa95.

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-03-09 20:26:52 +00:00
Miss Islington (bot)
ba1ea3a85a
[3.14] gh-145615: Fix mimalloc page leak in the free-threaded build (gh-145626) (#145691)
Fix three issues that caused mimalloc pages to be leaked until the
owning thread exited:

1. In _PyMem_mi_page_maybe_free(), move pages out of the full queue
   when relying on QSBR to defer freeing the page. Pages in the full
   queue are never searched by mi_page_queue_find_free_ex(), so a page
   left there is unusable for allocations.

2. Move _PyMem_mi_page_clear_qsbr() from _mi_page_free_collect() to
   _mi_page_thread_free_collect() where it only fires when all blocks
   on the page are free (used == 0). The previous placement was too
   broad: it cleared QSBR state whenever local_free was non-NULL, but
   _mi_page_free_collect() is called from non-allocation paths (e.g.,
   page visiting in mi_heap_visit_blocks) where the page is not being
   reused.

3. In _PyMem_mi_page_maybe_free(), use the page's heap tld to find the
   correct thread state for QSBR list insertion instead of
   PyThreadState_GET(). During stop-the-world pauses, the function may
   process pages belonging to other threads, so the current thread
   state is not necessarily the owner of the page.

(cherry picked from commit d76df75f51)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2026-03-09 14:17:57 -04:00
Ramin Farajpour Cami
7c624d4f31
[3.14] gh-145623: Fix crashes on uninitialized struct.Struct objects (gh-145624) (GH-145630) 2026-03-09 17:41:39 +01:00
Miss Islington (bot)
38440549db
[3.14] gh-141617: clarify concurrent.futures.ThreadPoolExecutor deadlock example (GH-141620) (#145686)
gh-141617: clarify `concurrent.futures.ThreadPoolExecutor` deadlock example (GH-141620)

---------
(cherry picked from commit 171133aa84)

Co-authored-by: Yashraj <yashrajpala8@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-03-09 16:36:00 +00:00