Commit graph

128953 commits

Author SHA1 Message Date
Sam Gross
b3c2ef5f31
[3.14] gh-134043: use stackrefs for dict lookup in _PyObject_GetMethodStackRef (GH-136412) (#146077)
(cherry picked from commit cbe6ebe15b)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-03-17 16:59:26 -04:00
Serhiy Storchaka
a005f323b7
[3.14] gh-144545: Improve handling of default values in Argument Clinic (GH-146016) (GH-146052)
* Add the c_init_default attribute which is used to initialize the C variable
  if the default is not explicitly provided.
* Add the c_default_init() method which is used to derive c_default from
  default if c_default is not explicitly provided.
* Explicit c_default and py_default are now almost always have precedence
  over the generated value.
* Add support for bytes literals as default values.
* Improve support for str literals as default values (support non-ASCII
  and non-printable characters and special characters like backslash or quotes).
* Fix support for str and bytes literals containing trigraphs, "/*" and "*/".
* Improve support for default values in converters "char" and "int(accept={str})".
* Converter "int(accept={str})" now requires 1-character string instead of
  integer as default value.
* Add support for non-None default values in converter "Py_buffer": NULL,
  str and bytes literals.
* Improve error handling for invalid default values.
* Rename Null to NullType for consistency.
(cherry picked from commit 99e2c5eccd)
2026-03-17 10:55:15 +00:00
Miss Islington (bot)
7ad3093d76
[3.14] gh-141707: Skip TarInfo DIRTYPE normalization during GNU long name handling (GH-145819)
(cherry picked from commit 42d754e34c)

Co-authored-by: Seth Michael Larson <seth@python.org>
Co-authored-by: Eashwar Ranganathan <eashwar@eashwar.com>
2026-03-17 10:51:19 +01:00
Miss Islington (bot)
4601007395
[3.14] Docs: a brief note in the sets tutorial about order (GH-145984) (#146049)
Docs: a brief note in the sets tutorial about order (GH-145984)
(cherry picked from commit 4f5e79805e)


Docs: a brief note in the sets tut about order

Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
2026-03-17 05:18:11 -04:00
Miss Islington (bot)
f06961e044
[3.14] gh-145176 Move Emscripten files into Platforms/emscripten (GH-145806) (#146043)
Moves Emscripten build files into Platforms/emscripten.
(cherry picked from commit 1b118353bb)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2026-03-17 10:17:47 +08:00
Miss Islington (bot)
0548f41053
[3.14] gh-144984: Fix crash in Expat's ExternalEntityParserCreate error paths (GH-144992) (#146019)
gh-144984: Fix crash in Expat's `ExternalEntityParserCreate` error paths (GH-144992)
(cherry picked from commit e6b9a14069)

Co-authored-by: Ramin Farajpour Cami <ramin.blackhat@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-03-17 01:49:39 +01:00
Miss Islington (bot)
e050831bd9
[3.14] Docs: remove unmatched parenthesis for asyncio.TaskGroup note (GH-146035) (#146037)
Docs: remove unmatched parenthesis for `asyncio.TaskGroup` note (GH-146035)
(cherry picked from commit 4e96282ee4)

Co-authored-by: trag1c <dev@jakubr.me>
2026-03-16 21:59:31 +01:00
Miss Islington (bot)
9743d88334
[3.14] gh-135329: Remove flaky test_repl_eio test (gh-145932) (#146028)
The test doesn't actually test any pyrepl code (it runs Python with -S)
and has a race condition that causes intermittent timeouts on CI.
(cherry picked from commit e18abc6a1f)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2026-03-16 11:42:47 -04:00
Miss Islington (bot)
62ceb396fc
[3.14] gh-145599, CVE 2026-3644: Reject control characters in http.cookies.Morsel.update() (GH-145600) (#146023)
gh-145599, CVE 2026-3644: Reject control characters in `http.cookies.Morsel.update()` (GH-145600)

Reject control characters in `http.cookies.Morsel.update()` and `http.cookies.BaseCookie.js_output`.
(cherry picked from commit 57e88c1cf9)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Victor Stinner <victor.stinner@gmail.com>
2026-03-16 14:13:19 +00:00
Miss Islington (bot)
8bc3aa9ac3
[3.14] gh-145649: Fix man page text wrapping for -X option (GH-145656) (#146015)
gh-145649: Fix man page text wrapping for -X option (GH-145656)

Replace hardcoded space indentation with proper troff macros
(.TP, .RS/.RE, .IP) for -X sub-options so text wraps correctly
at any terminal width.
(cherry picked from commit 36b5284f04)

Co-authored-by: Matt Van Horn <mvanhorn@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 11:01:28 +00:00
Miss Islington (bot)
cccd9dd3e4
[3.14] gh-145376: Fix GC tracking in structseq.__replace__ (GH-145820) (#145922)
gh-145376: Fix GC tracking in `structseq.__replace__` (GH-145820)
(cherry picked from commit 00a25859a9)

Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
2026-03-16 14:38:15 +05:30
Miss Islington (bot)
88e52acf90
[3.14] Docs: fix a form error and a grammatical error in float.rst (GH-140989) (#146012)
Docs: fix a form error and a grammatical error in float.rst (GH-140989)
(cherry picked from commit 70397fd103)

Co-authored-by: RayXu <xu_ruihong2009@163.com>
2026-03-16 14:38:00 +05:30
Miss Islington (bot)
a1f2fefc32
[3.14] gh-144986: Fix memory leak in atexit.register() (GH-144987) (#145020)
gh-144986: Fix memory leak in atexit.register() (GH-144987)
(cherry picked from commit 50c14719fb)

Co-authored-by: Shamil <ashm.tech@proton.me>
2026-03-16 13:56:05 +05:30
Miss Islington (bot)
a887eae459
[3.14] gh-140814: Fix freeze_support() setting start method as side effect (GH-144608) (#146008)
gh-140814: Fix freeze_support() setting start method as side effect (GH-144608)

freeze_support() called get_start_method() without allow_none=True,
which locked in the default start method context. This caused a
subsequent set_start_method() call to raise "context has already been
set". Use allow_none=True and accept None as a matching value, since
spawn.freeze_support() independently detects spawned child processes.

Test that freeze_support() does not lock in the default start method,
which would prevent a subsequent set_start_method() call.
(cherry picked from commit ee5318025b)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-03-16 06:17:34 +00:00
Gregory P. Smith
b8cb83703f
[3.14] gh-145990: sort --help-env sections by environment variable name (GH-146001)
* sort --help-env alphabetically by name.
* add a sorting regression test in test_help_env.

manual backport of GH-145997
2026-03-15 22:55:08 +00:00
Gregory P. Smith
36805f6e44
[3.14] gh-145990: Sort python --help-xoptions by option name (GH-145993)
* Sort --help-xoptions alphabetically by name.
* add a sorting regression test in test_help_xoptions

manual backport of GH-145991
2026-03-15 15:17:07 -07:00
Miss Islington (bot)
e0a8a6da90
[3.14] gh-145986: Avoid unbound C recursion in conv_content_model in pyexpat.c (CVE 2026-4224) (GH-145987) (#145995)
gh-145986: Avoid unbound C recursion in `conv_content_model` in `pyexpat.c` (CVE 2026-4224) (GH-145987)

Fix C stack overflow (CVE-2026-4224) when an Expat parser
with a registered `ElementDeclHandler` parses inline DTD
containing deeply nested content model.

---------
(cherry picked from commit eb0e8be3a7)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-03-15 22:13:58 +00:00
Miss Islington (bot)
64e2acbc8e
[3.14] gh-142518: Document thread-safety guarantees of bytearray objects (GH-145226) (#145982)
(cherry picked from commit 2f4e4ec2e7)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2026-03-15 16:03:32 +01:00
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