Commit graph

54183 commits

Author SHA1 Message Date
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
Miss Islington (bot)
5d71935bb3
[3.13] Docs: replace all datetime imports with import datetime as dt (GH-145640) (#146259)
Docs: replace all `datetime` imports with `import datetime as dt` (GH-145640)
(cherry picked from commit 83360b5869)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-03-21 18:41:50 +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
Miss Islington (bot)
af1ad53163
[3.13] gh-142763: Fix race in ZoneInfo cache eviction (gh-144978) (#145782)
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:12:34 +00: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)
4e332464b4
[3.13] gh-142651: use NonCallableMock._lock for thread safety of call_count (GH-142922) (#145740)
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:34:37 +00: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
Miss Islington (bot)
16dbbe56f0
[3.13] gh-145548: Use VMADDR_CID_LOCAL in VSOCK socket tests (GH-145589) (#145594)
gh-145548: Use VMADDR_CID_LOCAL in VSOCK socket tests (GH-145589)

Prefer VMADDR_CID_LOCAL instead of VMADDR_CID_ANY for bind() in the
server. Skip the test if bind() fails with EADDRNOTAVAIL.

Log vsock CID in test.pythoninfo.
(cherry picked from commit 6c8c72f7fe)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-06 21:34:45 +01:00
Miss Islington (bot)
5db017755b
[3.13] gh-144370: Disallow usage of control characters in status in wsgiref.handlers for security (GH-144371) (#145585)
gh-144370: Disallow usage of control characters in status in wsgiref.handlers for security (GH-144371)

Disallow usage of control characters in status in wsgiref.handlers
to prevent HTTP header injections.
(cherry picked from commit d931725bc8)

Co-authored-by: Benedikt Johannes <benedikt.johannes.hofer@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-06 12:45:34 +00:00
Miss Islington (bot)
1c8fa3968b
[3.13] gh-122941: Fix test_launcher sporadic failures via py.ini isolation (GH-145090)
Adds _PYLAUNCHER_INIDIR as a private variable since the launcher is deprecated and not getting new features.
(cherry picked from commit 6cdbd7bc5d)

Co-authored-by: Itamar Oren <itamarost@gmail.com>
2026-03-06 10:22:19 +00:00
Miss Islington (bot)
cc2c276f22
[3.13] gh-145417: Do not preserve SELinux context when copying venv scripts (GH-145454) (#145550)
gh-145417: Do not preserve SELinux context when copying venv scripts (GH-145454)
(cherry picked from commit dbe0007ab2)

Co-authored-by: Shrey Naithani <shrey.naithani@shelllite.tech>
Co-authored-by: Miro Hrončok <miro@hroncok.cz>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-05 17:44:29 +00:00
Miss Islington (bot)
8fab30ed11
[3.13] gh-143304: Fix ctypes.CDLL to honor handle parameter on POSIX systems (GH-143318) (GH-145173)
The handle parameter was being ignored in the POSIX implementation
of CDLL._load_library(), causing it to always call _dlopen() even
when a valid handle was provided. This was a regression introduced
in recent refactoring.
(cherry picked from commit 27ded24348)

Co-authored-by: Arjit Singh Grover <143692910+Koolvansh07@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-03-05 15:34:49 +01:00
Miss Islington (bot)
482d6f8bdb
[3.13] gh-145506: Fixes CVE-2026-2297 by ensuring SourcelessFileLoader uses io.open_code (GH-145507)
(cherry picked from commit a51b1b512d)

Co-authored-by: Steve Dower <steve.dower@python.org>
2026-03-04 20:17:04 +00:00
Miss Islington (bot)
fb83592b56
[3.13] GH-144739: Skip test_pyexpat.MemoryProtectionTest based on expat compile-time version, not runtime (GH-144740) (GH-145494) (#145510)
[3.14] GH-144739: Skip test_pyexpat.MemoryProtectionTest based on expat compile-time version, not runtime (GH-144740) (GH-145494)

GH-144739: Skip test_pyexpat.MemoryProtectionTest based on expat compile-time version, not runtime (GH-144740)

(cherry picked from commit 45e9343d7e)
(cherry picked from commit bcc2dd8d30)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Miro Hrončok <miro@hroncok.cz>
2026-03-04 19:47:34 +00:00
Miss Islington (bot)
dbeb29aee3
[3.13] gh-142781: Fix type confusion in zoneinfo weak cache (GH-142925) (GH-145418)
(cherry picked from commit b611db491d)

Co-authored-by: zhong <60600792+superboy-zjc@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-03-03 12:47:57 +01:00
Stan Ulbrych
5577bd1298
[3.13] gh-144872: fix heap buffer overflow _PyTokenizer_ensure_utf8 (GH-144807) (#145441)
(cherry picked from commit 3fc945df22)

Co-authored-by: AdamKorcz <44787359+AdamKorcz@users.noreply.github.com>
2026-03-02 23:00:59 +00:00
Sam Gross
702d085783
[3.13] gh-130327: Always traverse managed dictionaries, even when inline values are available (GH-130469) (#145440)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2026-03-02 20:03:08 +00:00
Sam Gross
d567f451e1
[3.13] gh-130555: Fix use-after-free in dict.clear() with embedded values (gh-145268) (#145430) 2026-03-02 13:59:52 -05:00