Commit graph

31662 commits

Author SHA1 Message Date
Miss Islington (bot)
b4a0c8defe
[3.14] gh-146310: Fix ensurepip to treat empty WHEEL_PKG_DIR as unset (GH-146357) (#146534)
gh-146310: Fix ensurepip to treat empty WHEEL_PKG_DIR as unset (GH-146357)

Path('') resolves to CWD, so an empty WHEEL_PKG_DIR string caused
ensurepip to search the current working directory for wheel files.
Add a truthiness check to treat empty strings the same as None.
(cherry picked from commit 73cc1fd4f4)

Co-authored-by: Imgyu Kim <kimimgo@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-27 21:13:17 +00:00
Miss Islington (bot)
70affe0dc7
[3.14] gh-145616: Detect Android sysconfig ABI correctly on 32-bit ARM Android on 64-bit ARM kernel (GH-145617) (#146464)
gh-145616: Detect Android sysconfig ABI correctly on 32-bit ARM Android on 64-bit ARM kernel (GH-145617)

When Python is running on 32-bit ARM Android on a 64-bit ARM kernel, `os.uname().machine` is `armv8l`. Such devices run the same userspace code as `armv7l` devices, so apply the same `armeabi_v7a` Android ABI to them, which works.
(cherry picked from commit 3a2b81e919)

Co-authored-by: Robert Kirkman <31490854+robertkirkman@users.noreply.github.com>
2026-03-27 20:43:23 +01:00
Miss Islington (bot)
74c21aec82
[3.14] gh-146498: Ensure binary content is correctly processed in multi-arch iOS XCframeworks (GH-146499) (#146502)
Ensure that multi-arch libpython dylibs aren't copied into the app, and the
standard lib is always found for framework post-processing.
(cherry picked from commit 5684b3a04c)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2026-03-27 02:16:52 +00:00
Miss Islington (bot)
6a5354ef65
[3.14] gh-146446: Miscellaneous improvements to iOS XCframework build script (GH-146447) (#146496)
Modifies the iOS build script so that the clean target is more selective about
what is cleaned, the test target has a valid fallback value for ci mode, and the
cross-build directory can be customised.
(cherry picked from commit ca6dfa0f31)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2026-03-27 06:18:16 +08:00
Miss Islington (bot)
8a25840a2a
[3.14] gh-145633: Fix struct.pack('f') on s390x (GH-146422) (#146460)
gh-145633: Fix struct.pack('f') on s390x (GH-146422)

Use PyFloat_Pack4() to raise OverflowError.
Add more tests on packing/unpacking floats.
(cherry picked from commit 8de70b31c5)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2026-03-26 11:38:42 +00:00
Sam Gross
f2b5131d1a
[3.14] gh-146041: Avoid lock in sys.intern() for already interned strings (gh-146072) (#146390)
Fix free-threading scaling bottleneck in sys.intern and `PyObject_SetAttr` by
avoiding the interpreter-wide lock when the string is already interned and
immortalized.

(cherry picked from commit 60093096ba)
2026-03-24 21:42:19 -04:00
Pablo Galindo Salgado
58c5eda24c
[3.14] gh-146308: Fix error handling issues in _remote_debugging module (GH-146309) (#146398)
(cherry picked from commit ae6adc9079)
2026-03-25 01:05:47 +00:00
Miss Islington (bot)
ad273f76b2
[3.14] gh-146202: Create tmp_dir in regrtest worker (GH-146347) (#146349)
gh-146202: Create tmp_dir in regrtest worker (GH-146347)

Create tmp_dir in libregrtest.worker since the directory can be
different than the --tempdir directory.
(cherry picked from commit bcff99cb3f)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-24 00:13:09 +00:00
Serhiy Storchaka
e31c551216
[3.14] gh-145264: Do not ignore excess Base64 data after the first padded quad (GH-145267) (GH-146326)
Base64 decoder (see binascii.a2b_base64(), base64.b64decode(), etc)
no longer ignores excess data after the first padded quad in non-strict
(default) mode.  Instead, in conformance with RFC 4648, it ignores the
pad character, "=", if it is present before the end of the encoded data.
(cherry picked from commit 4561f6418a)
2026-03-24 00:20:26 +01:00
Miss Islington (bot)
9669a912a0
[3.14] gh-143930: Reject leading dashes in webbrowser URLs (GH-146214)
(cherry picked from commit 82a24a4442)

Co-authored-by: Seth Michael Larson <seth@python.org>
2026-03-24 00:16:27 +01:00
dr-carlos
dd4ea46917
[3.14] gh-141732: Fix ExceptionGroup repr changing when original exception sequence is mutated (GH-141736) (GH-144445)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2026-03-23 23:31:32 +01:00
Miss Islington (bot)
69a37be21c
[3.14] gh-146245: Fix reference and buffer leaks via audit hook in socket module (GH-146248) (GH-146274)
(cherry picked from commit c30fae4bea)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2026-03-22 11:55:13 +00:00
Serhiy Storchaka
796513306f
[3.14] gh-146056: Fix repr() for lists and tuples containing NULLs (GH-146129) (GH-146155)
(cherry picked from commit 0f2246b155)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-22 09:25:02 +02:00
Sam Gross
73e74eeb2f
[3.14] gh-146227: Fix wrong type in _Py_atomic_load_uint16 in pyatomic_std.h (gh-146229) (#146232)
Also fix a few related issues in the pyatomic headers:

* Fix _Py_atomic_store_uint_release in pyatomic_msc.h to use __stlr32
  on ARM64 instead of a plain volatile store (which is only relaxed on
  ARM64).

* Add missing _Py_atomic_store_uint_release to pyatomic_gcc.h.

* Fix pseudo-code comment for _Py_atomic_store_ptr_release in
  pyatomic.h.

(cherry picked from commit 1eff27f2c0)
2026-03-20 20:08:20 +00:00
Victor Stinner
6e73225c32
[3.14] gh-146196: Fix Undefined Behavior in _PyUnicodeWriter_WriteASCIIString() (#146201) (#146220)
gh-146196: Fix Undefined Behavior in _PyUnicodeWriter_WriteASCIIString() (#146201)

Avoid calling memcpy(data + writer->pos, NULL, 0)
which has an undefined behavior.


(cherry picked from commit cd10a2e65c)

Co-authored-by: Shamil <ashm.tech@proton.me>
2026-03-20 16:26:18 +00:00
Miss Islington (bot)
7ba9580f00
[3.14] gh-145754: Update signature retrieval in unittest.mock to use forwardref annotation format (GH-145756) (#146191)
gh-145754: Update signature retrieval in unittest.mock to use forwardref annotation format (GH-145756)
(cherry picked from commit d357a7dbf3)

Co-authored-by: Matthias Schoettle <git@mattsch.com>
2026-03-20 03:06:03 +00:00
Sam Gross
fa3143a1d2
[3.14] gh-145779: Improve classmethod/staticmethod scaling in free-threaded build (gh-145826) (#146088)
Add special cases for classmethod and staticmethod descriptors in
_PyObject_GetMethodStackRef() to avoid calling tp_descr_get, which
avoids reference count contention on the bound method and underlying
callable. This improves scaling when calling classmethods and
staticmethods from multiple threads.

Also refactor method_vectorcall in classobject.c into a new
_PyObject_VectorcallPrepend() helper so that it can be used by
PyObject_VectorcallMethod as well.

(cherry picked from commit e0f7c1097e)
2026-03-19 10:49:12 -04:00
Victor Stinner
7f29c1d0da
[3.14] gh-146092: Fix error handling in _BINARY_OP_ADD_FLOAT opcode (#146119)
Fix error handling in _PyFloat_FromDouble_ConsumeInputs() used by
_BINARY_OP_ADD_FLOAT, _BINARY_OP_SUBTRACT_FLOAT and
_BINARY_OP_MULTIPLY_FLOAT opcodes. PyStackRef_FromPyObjectSteal()
must not be called with a NULL pointer.

Fix also _BINARY_OP_INPLACE_ADD_UNICODE opcode.
2026-03-19 12:14:33 +01:00
Miss Islington (bot)
19cbcc0f85
[3.14] gh-142183: Cache one datachunk per tstate to prevent alloc/dealloc thrashing (GH-145789) (#145828)
Cache one datachunk per tstate to prevent alloc/dealloc thrashing when repeatedly hitting the same call depth at exactly the wrong boundary.

Move new _ts member to the end to not mess up remote debuggers' ideas of the
struct's layout. (The struct is only created by the runtime, and the new
field only used by the runtime, so it should be safe.)

(cherry picked from commit 706fd4ec08)
Co-authored-by: T. Wouters <thomas@python.org>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2026-03-18 16:47:36 +01:00
Miss Islington (bot)
6980b94c3a
[3.14] gh-146076: Fix crash when a ZoneInfo subclass is missing a _weak_cache (GH-146082) (GH-146116)
(cherry picked from commit 3b06d68d8a)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-03-18 15:23:46 +00:00
Miss Islington (bot)
c9900734fa
[3.14] gh-146054: Limit the growth of encodings.search_function cache (GH-146055) (GH-146067)
(cherry picked from commit 9d7621b75b)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-03-18 13:47:13 +01: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)
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)
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)
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)
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
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)
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
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
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
Ł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)
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)
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
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)
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)
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