Commit graph

33054 commits

Author SHA1 Message Date
Miss Islington (bot)
4dfcdbe22c
[3.13] gh-148157: Check for _PyPegen_add_type_comment_to_arg fail in _PyPegen_name_default_pair (GH-148158) (#148163)
(cherry picked from commit 1795fccfbc)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-04-06 12:13:32 +00:00
Malcolm Smith
3ea97a26b6
[3.13] gh-146541: Allow building the Android testbed for 32-bit targets (GH-146542) (#148107)
Allows building the Android testbed for 32-bit targets, adding the target triplets
`arm-linux-androideabi` and `i686-linux-android`.
(cherry picked from commit 848bbe9ff2)

Co-authored-by: Robert Kirkman <31490854+robertkirkman@users.noreply.github.com>
2026-04-06 07:47:01 +08:00
Miss Islington (bot)
df89a705d0
[3.13] gh-145883: Fix two heap-buffer-overflows in _zoneinfo (GH-145885) (#148086)
(cherry picked from commit fe9befc1ca)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-04-04 17:14:19 +01:00
Łukasz Langa
89bfb8e5ed
[3.13] gh-143930: Tweak the exception message and increase test coverage (GH-146476) (GH-148045)
(cherry picked from commit 3681d47a44)
2026-04-03 19:45:02 +02:00
Miss Islington (bot)
2a00d94fb2
[3.13] gh-143394: Skip pyrepl test_no_newline() basic REPL if readline is missing (GH-147973) (#148006)
gh-143394: Skip pyrepl test_no_newline() basic REPL if readline is missing (GH-147973)
(cherry picked from commit 97babb8ef7)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-04-03 12:35:26 +00:00
Victor Stinner
01af34a364
[3.13] gh-143050: Correct PyLong_FromString() to use _PyLong_Negate() (#145901) (#147437)
The long_from_string_base() might return a small integer, when the
_pylong.py is used to do conversion.  Hence, we must be careful here to
not smash it "small int" bit by using the _PyLong_FlipSign().

Co-authored-by: Victor Stinner <vstinner@python.org>
(cherry picked from commit db5936c5b8)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2026-03-31 17:06:38 +02:00
Miss Islington (bot)
52bc5c26a7
[3.13] gh-146615: Fix crash in __get__() for METH_METHOD descriptors with invalid type argument (GH-146634) (GH-146648)
(cherry picked from commit 72d29ea363)

Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
2026-03-31 09:22:59 +00:00
AN Long
c09ccd9c42
[3.13] gh-146250: Fix memory leak in re-initialization of SyntaxError (GH-146251) (#146519)
* [3.13] gh-146250: Fix memory leak in re-initialization of `SyntaxError` (GH-146251)
(cherry picked from commit 0de4e08a59)

Co-authored-by: Brij Kapadia <97006829+bkap123@users.noreply.github.com>

* Minimize the changes

* Minimize the changes

* Minimize the changes

---------

Co-authored-by: Brij Kapadia <97006829+bkap123@users.noreply.github.com>
2026-03-30 21:36:52 +05:30
Miss Islington (bot)
6fdf084644
[3.13] gh-146090: fix memory management of internal sqlite3 callback contexts (GH-146569) (#146596)
gh-146090: fix memory management of internal `sqlite3` callback contexts (GH-146569)
(cherry picked from commit aa6680775d)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-03-29 15:14:58 +02:00
Bénédikt Tran
59f33e82ff
[3.13] gh-146080: fix a crash in SNI callbacks when the SSL object is gone (GH-146573) (#146598)
(cherry picked from commit 24db78c532)
2026-03-29 13:07:15 +00:00
Malcolm Smith
793812b104
[3.13] gh-145616: Detect Android sysconfig ABI correctly on 32-bit ARM Android on 64-bit ARM kernel (GH-145617) (#146539)
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-28 08:25:35 +01:00
Miss Islington (bot)
78b8716af6
[3.13] gh-146310: Fix ensurepip to treat empty WHEEL_PKG_DIR as unset (GH-146357) (#146535)
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:10:44 +00:00
Victor Stinner
04fe383602
[3.13] gh-146480: Add tests on _PyErr_SetKeyError() (#146486) (#146512)
gh-146480: Add tests on _PyErr_SetKeyError() (#146486)

(cherry picked from commit d4153a9f76)
2026-03-27 14:09:46 +01:00
Miss Islington (bot)
9ee6b67ee9
[3.13] gh-146059: Cleanup pickle fast_save_enter() test (GH-146481) (#146510)
gh-146059: Cleanup pickle fast_save_enter() test (GH-146481)

Remove {"key": data}, it's not required to reproduce the bug.
Simplify also deep_nested_struct(): remove the seed parameter.
Fix a typo in a comment.
(cherry picked from commit 0c7a75aeef)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-27 10:49:57 +00:00
Miss Islington (bot)
de1644cd40
[3.13] gh-146059: Call fast_save_leave() in pickle save_frozenset() (GH-146173) (#146474)
gh-146059: Call fast_save_leave() in pickle save_frozenset() (GH-146173)

Add more pickle tests: test also nested structures.
(cherry picked from commit 5c0dcb3e0d)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-27 08:47:53 +00:00
Brian Schubert
f4f598a28a
[3.13] gh-138891: fix star-unpack in get_annotations (GH-138951) (#146491)
(cherry picked from commit c6be6e4537)

Co-authored-by: Christoph Walcher <christoph-wa@gmx.de>
2026-03-26 21:39:27 +00:00
Victor Stinner
921515f603
[3.13] gh-145633: Fix struct.pack('f') on s390x (#146422) (#146461)
gh-145633: Fix struct.pack('f') on s390x (#146422)

Use PyFloat_Pack4() to raise OverflowError.
Add more tests on packing/unpacking floats.


(cherry picked from commit 8de70b31c5)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2026-03-26 11:45:10 +00:00
Brij Kapadia
4e372077c5
[3.13] gh-144475: Fix reference management in partial_repr (GH-145362) (#145882)
(cherry picked from commit 671a953dd6)
2026-03-24 02:30:45 +01:00
Miss Islington (bot)
0d82ce82f1
[3.13] gh-146202: Create tmp_dir in regrtest worker (GH-146347) (#146350)
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:10:25 +00:00
Miss Islington (bot)
1f9958f909
[3.13] gh-145264: Do not ignore excess Base64 data after the first padded quad (GH-145267) (GH-146326) (GH-146348)
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)
(cherry picked from commit e31c551216)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-03-24 00:52:20 +01:00
Sergey Miryanov
eda53e6cf1
[3.13] GH-91636: Clear weakrefs created by finalizers. (GH-136401) (GH-144214)
Weakrefs to unreachable garbage that are created during running of
finalizers need to be cleared.  This avoids exposing objects that
have `tp_clear` called on them to Python-level code.
(cherry picked from commit b6b99bf7f1)

Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
2026-03-24 00:50:41 +01:00
Miss Islington (bot)
43fe06b96f
[3.13] gh-143930: Reject leading dashes in webbrowser URLs (GH-146215)
(cherry picked from commit 82a24a4442)

Co-authored-by: Seth Michael Larson <seth@python.org>
2026-03-24 00:17:50 +01:00
Serhiy Storchaka
3a14b7faec
[3.13] gh-145144: Add more tests for UserList, UserDict, etc (GH-145145) (GH-146296)
(cherry picked from commit 161329cde2)
2026-03-22 18:06:01 +02:00
Miss Islington (bot)
0aa9153cf7
[3.13] gh-143959: Fix test_datetime if _datetime is unavailable (GH-145248) (GH-146289)
(cherry picked from commit 97c725cd39)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-03-22 14:39:08 +00:00
Serhiy Storchaka
fab82679d3
[3.13] gh-146056: Fix repr() for lists containing NULLs (GH-146129) (GH-146155) (GH-146271)
(cherry picked from commit 0f2246b155)
(cherry picked from commit 796513306f)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-22 08:06:17 +00:00
AN Long
d513f9ef8f
[3.13] gh-129849: Add tests for Py_tp_bases (GH-143208) (#146226)
(cherry picked from commit 6f8867a676)
2026-03-21 15:22:45 +05:30
Miss Islington (bot)
450e9eaf73
[3.13] gh-146076: Fix crash when a ZoneInfo subclass is missing a _weak_cache (GH-146082) (GH-146115)
(cherry picked from commit 3b06d68d8a)

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

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-03-18 13:46:50 +01:00
Miss Islington (bot)
ae99fe3a33
[3.13] gh-141707: Skip TarInfo DIRTYPE normalization during GNU long name handling (GH-145818)
(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:43 +01:00
Sam Gross
5a13df1ec8
[3.13] gh-135329: Remove flaky test_repl_eio test (gh-145932) (#146029)
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)
2026-03-16 16:11:56 +00:00
Miss Islington (bot)
d16ecc6c36
[3.13] gh-145599, CVE 2026-3644: Reject control characters in http.cookies.Morsel.update() (GH-145600) (#146024)
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:05:13 +00:00
Miss Islington (bot)
196edfb06a
[3.13] gh-145986: Avoid unbound C recursion in conv_content_model in pyexpat.c (CVE 2026-4224) (GH-145987) (#145996)
* 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>

* Remvoe `skip_if_unlimited_stack_size` decorator

* Remove more decorators not on this branch

---------

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-16 14:39:27 +05:30
Miss Islington (bot)
1d6e037b62
[3.13] gh-145376: Fix GC tracking in structseq.__replace__ (GH-145820) (#145924)
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:24 +05:30
Miss Islington (bot)
2070401411
[3.13] gh-140814: Fix freeze_support() setting start method as side effect (GH-144608) (#146009)
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:13:21 +00:00
Gregory P. Smith
102cd61763
[3.13] gh-145990: sort --help-env first section by name (others and xoptions already sorted) (GH-146003)
* sort `--help-env` sections by environment variable name
  Only needed in the first section, in 3.13 the second section was already sorted.
* regression test for --help-env & --help-xoptions sort order

Manual backport of GH-145997
2026-03-15 22:35:53 +00:00
Miss Islington (bot)
c7330465fa
[3.13] Bump mypy to 1.19.1 (GH-145956) (#145972)
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:11:29 +00:00
Bénédikt Tran
cd2e47135c
[3.13] gh-143636: fix a crash when calling `__replace__ on invalid SimpleNamespace` instances (GH-143655) (#145940)
[3.13] gh-143636: fix a crash when calling ``__replace__`` on invalid `SimpleNamespace` instances (GH-143655)

(cherry picked from commit 97968564b6)
2026-03-14 11:00:56 +00:00
Stan Ulbrych
0b4f4c77f9
[3.13] gh-145783: Propagate errors raised in NEW_TYPE_COMMENT (GH-145784) (#145927) 2026-03-13 18:07:45 +00:00
Łukasz Langa
3ae8cc8310
[3.13] gh-140131: Fix REPL cursor position on Windows when module completion suggestion line hits console width (GH-140333) (GH-145872)
(cherry picked from commit e13f6dccd7)

Co-authored-by: Tan Long <tanloong@foxmail.com>
2026-03-12 18:15:17 +01:00
Miss Islington (bot)
e98936171b
[3.13] gh-140594: Fix an out of bounds read when feeding NUL byte to PyOS_StdioReadline() (GH-140910) (#145853)
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:21:43 +00:00
Miss Islington (bot)
cef423cbe2
[3.13] gh-145492: Fix defaultdict __repr__ infinite recursion (GH-145659) (GH-145746)
(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:43 +01:00
Łukasz Langa
881cc06bac
[3.13] gh-139933: correctly suggest attributes for classes with a custom __dir__ (GH-139950) (GH-145827) (GH-145833)
(cherry picked from commit 4722202a1a)
(cherry picked from commit 0a80015ac2)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-03-11 22:02:01 +01:00
Miss Islington (bot)
97804d80b0
[3.13] gh-145607: Ensure BIG_DATA has two compressed blocks in test_bz2 (GH-145730) (#145734)
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:08:06 -07:00
Stan Ulbrych
37e9d846ff
[3.13] Fix integer overflow for formats "s" and "p" in the struct module (GH-145750) (GH-145777)
(cherry picked from commit 4d0dce0c8d)
2026-03-10 17:44:10 +00:00
Miss Islington (bot)
f349433df0
[3.13] gh-144173: fix flaky test_complex.test_truediv() (GH-144355) (#145767)
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:05:07 +00:00
Miss Islington (bot)
b5082d89cc
[3.13] gh-145743: Fix inconsistency after calling Struct.__init__() with invalid format (GH-145744) (GH-145764)
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:52:27 +00:00
Petr Viktorin
26326a0b4f
[3.13] gh-145548: Don't use VMADDR_CID_LOCAL from socket (GH-145735)
VMADDR_CID_LOCAL was added to `socekt` in 3.14. The test needs a
local constant in setUp(), as in clientSetUp().
2026-03-10 16:01:52 +01:00
Miss Islington (bot)
cba8d1258a
[3.13] gh-145541: Fix InvalidStateError in BaseSubprocessTransport._call_connection_lost() (GH-145554) (#145677)
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:21 +05:30
Miss Islington (bot)
321daaba4e
[3.13] gh-145701: Fix __classdict__ & __conditional_annotations__ in class-scope inlined comprehensions (GH-145702) (#145711)
* gh-145701: Fix `__classdict__` & `__conditional_annotations__` in class-scope inlined comprehensions (GH-145702)
(cherry picked from commit 63eaaf9599)

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

* Add `:oss-fuzz:` macro support

Backports part of 255e79fa95.

---------

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-03-09 14:44:31 -07:00
Ramin Farajpour Cami
b2894626aa
[3.13] gh-145623: Fix crashes on uninitialized struct.Struct objects (gh-145624) (GH-145631) 2026-03-09 17:41:45 +01:00