Commit graph

14561 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
Miss Islington (bot)
2bb1ac2162
[3.13] gh-144837: Improve documentation for more collection methods (GH-144841) (GH-146484)
Use uniform standard signature syntax in the tutorial and in
the array and collections modules documentation.
(cherry picked from commit 17070f41d4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-03-26 19:52:07 +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
Miss Islington (bot)
5a4959b92c
[3.13] Fix unlikely potential reference leak in _locale._getdefaultlocale (GH-145250) (GH-145303)
It occurs in a code which perhaps never executed.
(cherry picked from commit 6ea84b2726)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-03-24 02:18:19 +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)
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
Miss Islington (bot)
2f1e341b28
[3.13] gh-146245: Fix reference and buffer leaks via audit hook in socket module (GH-146248) (GH-146275)
(cherry picked from commit c30fae4bea)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2026-03-22 11:51:54 +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)
cfd7f94c12
[3.13] gh-146092: Raise MemoryError on allocation failure in _zoneinfo (GH-146165) (#146224)
gh-146092: Raise MemoryError on allocation failure in _zoneinfo (GH-146165)
(cherry picked from commit 6450b1d142)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-20 16:40:55 +00:00
Miss Islington (bot)
c7d7e1c1a0
[3.13] gh-146093: Fix csv _set_str(): check if PyUnicode_DecodeASCII() failed (GH-146113) (#146131)
gh-146093: Fix csv _set_str(): check if PyUnicode_DecodeASCII() failed (GH-146113)

The function can fail on a memory allocation failure.

Bug reported by devdanzin.
(cherry picked from commit 724c7c8146)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-18 17:45:47 +00:00
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)
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
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
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
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)
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
krylosov-aa
ba0d1b7dee
[3.13] gh-145301: Fix double-free in hashlib initialization (GH-145321) (GH-145532)
(cherry picked from commit 6acaf659ef)
2026-03-10 14:59:37 +01: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)
1a73d5a35c
[3.13] gh-145376: Fix refleak in queuemodule.c out-of-memory path (GH-145543) (#145621)
gh-145376: Fix refleak in `queuemodule.c` out-of-memory path (GH-145543)
(cherry picked from commit 0aeaaafac4)

Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
2026-03-08 13:32:39 +05:30
Pieter Eendebak
ae7206eb3b
[3.13] gh-145376: Fix crashes in md5module.c (GH-145422) (#145611)
* gh-145376: Fix crashes in md5module.c

Fix a possible NULL pointer dereference in `md5module.c`.
This can only occur in error paths taken when the interpreter fails to allocate memory.

(cherry-picked from c1d7768321)

* 📜🤖 Added by blurb_it.

* Update Modules/md5module.c

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2026-03-06 22:24:20 +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
Miss Islington (bot)
fb340275c4
[3.13] gh-143880: Fix data race in functools.partial in free threading build (GH-143882) (#145435)
Co-authored-by: Sam Gross <colesbury@gmail.com>
2026-03-02 21:31:46 +00:00
Miss Islington (bot)
d305326458
[3.13] gh-145335: Fix crash when passing -1 as fd in os.pathconf (GH-145390) (#145432)
gh-145335: Fix crash when passing -1 as fd in os.pathconf (GH-145390)
(cherry picked from commit 5c3a47b94a)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2026-03-02 18:32:29 +00:00
Miss Islington (bot)
cd3e9b3fd2
[3.13] gh-142787: Handle empty sqlite3 blob slices (GH-142824) (#145298)
(cherry picked from commit 06b0920f12)

Co-authored-by: A.Ibrahim <abdulrasheedibrahim47@gmail.com>
2026-02-27 01:13:08 +01:00
Stan Ulbrych
e418e3351f
[3.13] gh-88091: Fix unicodedata.decomposition() for Hangul Syllables (GH-144993) (GH-145190)
(cherry picked from commit 56c4f10d6e)
2026-02-25 00:27:40 +02:00
Miss Islington (bot)
dd355045f6
[3.13] _struct.c: Fix UB from integer overflow in prepare_s (GH-145158) (#145163)
`_struct.c`: Fix UB from integer overflow in `prepare_s` (GH-145158)

Avoid possible undefined behaviour from signed overflow in `struct` module

As discovered via oss-fuzz.
(cherry picked from commit fd0400585e)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-02-24 01:16:45 +00:00
Bénédikt Tran
0038b58ac9
[3.13] gh-143698: correctly check scheduler and setpgroup values for os.posix_spawn[p] (GH-143699) (#145074)
* [3.13] gh-143698: correctly check `scheduler` and `setpgroup` values for `os.posix_spawn[p]` (GH-143699)

Fix an issue where passing invalid arguments to `os.posix_spawn[p]` functions
raised a SystemError instead of a TypeError, and allow to explicitly use `None`
for `scheduler` and `setpgroup` as specified in the docs.

(cherry picked from commit 347fc438cf)
2026-02-21 16:05:57 +01:00
Serhiy Storchaka
e54507374b
[3.13] gh-140652: Fix a crash in _interpchannels.list_all() after clo…sing a channel (GH-143743) (GH-144953)
(cherry picked from commit 3f50432e31)
2026-02-18 14:18:39 +00:00
Peter Bierma
9314ec23a6
[3.13] gh-144601: Avoid sharing exception objects raised in a PyInit function across multiple interpreters (GH-144602) (GH-144880)
(cherry picked from commit fd6b639a49)
2026-02-16 16:05:55 +00:00
Miss Islington (bot)
ba0bab40f7
[3.13] gh-80667: Fix lookup for Tangut ideographs in unicodedata (GH-144789) (GH-144871) (GH-144875)
(cherry picked from commit 8b7b5a9946)
(cherry picked from commit bcabbd02f6)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Pierre Le Marre <dev@wismill.eu>
2026-02-16 15:02:01 +00:00
Miss Islington (bot)
37f818caef
[3.13] gh-144833: Fix use-after-free in SSL module when SSL_new() fails (GH-144843) (#144859)
gh-144833: Fix use-after-free in SSL module when SSL_new() fails (GH-144843)

In newPySSLSocket(), when SSL_new() returns NULL, Py_DECREF(self)
was called before _setSSLError(get_state_ctx(self), ...), causing
a use-after-free. Additionally, get_state_ctx() was called with
self (PySSLSocket*) instead of sslctx (PySSLContext*), which is
a type confusion bug.

Fix by calling _setSSLError() before Py_DECREF() and using
sslctx instead of self for get_state_ctx().
(cherry picked from commit c91638ca06)

Co-authored-by: Ramin Farajpour Cami <ramin.blackhat@gmail.com>
2026-02-16 03:09:58 +00:00
Miss Islington (bot)
309bacdb4a
[3.13] gh-143637: Fix re-entrant mutation of ancillary data in socket.sendmsg() (GH-143892) (#144785)
gh-143637: Fix re-entrant mutation of ancillary data in socket.sendmsg() (GH-143892)
(cherry picked from commit 82b92e3cd1)

Co-authored-by: Priyanshu Singh <priyanshu2282@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-02-13 15:58:59 +00:00
Serhiy Storchaka
2f354107f3
[3.13] gh-80667: Fix case-sensitivity of some Unicode literal escapes (GH-107281) (GH-144754)
Lookup for CJK ideograms and Hangul syllables is now case-insensitive,
as is the case for other character names.
(cherry picked from commit e66f4a5a9c)

Co-authored-by: James <snoopjedi@gmail.com>
2026-02-12 17:18:48 +00:00
Serhiy Storchaka
009583fc6f
[3.13] gh-84424: Use numeric_changed for UCD.numeric (GH-19457) (GH-144732)
This was causing ucd_3_2_0.numeric() to pick up only decimal
changes between Unicode 3.2.0 and the current version.
(cherry picked from commit 3e0322ff16)

Co-authored-by: William Meehan <wmeehan@fb.com>
2026-02-12 08:35:09 +00:00
Miss Islington (bot)
d177460b43
[3.13] gh-143543: Fix re-entrant use-after-free in itertools.groupby (GH-143738) (GH-144627)
(cherry picked from commit a91b5c3fb5)

Co-authored-by: VanshAgarwal24036 <148854295+VanshAgarwal24036@users.noreply.github.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2026-02-10 14:01:23 +01:00
Miss Islington (bot)
7fbdec4180
[3.13] gh-144363: Update bundled libexpat to 2.7.4 (GH-144365) (GH-144500)
(cherry picked from commit d5cb9f6a9b)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2026-02-10 13:59:12 +01:00
Petr Viktorin
bad4bc4603
[3.13] gh-131261: generate_sbom.py: Exclude the refresh script from SBOM (GH-131359) (GH-144625)
- generate_sbom.py: Exclude the refresh script from SBOM
- Modules/expat/refresh.sh: Expand the list of manual steps

(cherry picked from commit 51d309988b)
2026-02-10 10:49:00 +01:00
Miss Islington (bot)
b74e3a4c05
[3.13] gh-142555: Fix null pointer dereference in array.__setitem__ via re-entrant __index__ (GH-142713) (#144397)
gh-142555: Fix null pointer dereference in array.__setitem__ via re-entrant __index__ (GH-142713)
(cherry picked from commit 39f16a93ef)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2026-02-02 21:06:59 +01:00
Miss Islington (bot)
51fccc6059
[3.13] gh-144380: Fix incorrect type check in buffered_iternext() (GH-144381) (#144390)
gh-144380: Fix incorrect type check in `buffered_iternext()` (GH-144381)
(cherry picked from commit 40d07cad38)

Co-authored-by: Ruiyang Ke <me@ry.ke>
2026-02-02 10:29:16 +00:00
Victor Stinner
3df9e31142
[3.13] gh-144100: Fix crash for POINTER(str) used in ctypes argtypes (#144108) (#144245)
gh-144100: Fix crash for POINTER(str) used in ctypes argtypes (#144108)


(cherry picked from commit 8f459255eb)

Co-authored-by: VanshAgarwal24036 <148854295+VanshAgarwal24036@users.noreply.github.com>
2026-01-27 12:59:55 +01:00
Stan Ulbrych
837b88fd9f
[3.13] gh-144023: Prevent follow_symlinks from being allowed with an fd of 0 (GH-144022) (#144152)
[3.13] gh-144023: Prevent follow_symlinks from being allowed with an fd of 0 (GH-144022)

The check was (fd > 0), should be (fd >= 0).
(cherry picked from commit fa44efa0ef)

Co-authored-by: AZero13 <gfunni234@gmail.com>
2026-01-22 15:52:49 +00:00
Miss Islington (bot)
640ef9931e
[3.13] Update struct.__doc__: _Bool available unconditionally (GH-143716) (#144071)
Update struct.__doc__: _Bool available unconditionally (GH-143716)

This amends commit a9296e7f3b.
(cherry picked from commit 31c81ab0a2)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2026-01-20 12:32:45 +00:00
Miss Islington (bot)
be602fcde6
[3.13] gh-143249: Fix buffer leak when overlapped operation fails to start on windows (GH-143250) (#143796)
gh-143249: Fix buffer leak when overlapped operation fails to start on windows (GH-143250)
(cherry picked from commit 103a384bfd)

Co-authored-by: Yongtao Huang <yongtaoh2022@gmail.com>
2026-01-13 13:53:41 +00:00
Miss Islington (bot)
8b7ebbb432
[3.13] gh-143544: Fix possible use-after-free in the JSON decoder when JSONDecodeError disappears during raising it (GH-143561) (#143734)
gh-143544: Fix possible use-after-free in the JSON decoder when JSONDecodeError disappears during raising it (GH-143561)
(cherry picked from commit c315748060)

Co-authored-by: VanshAgarwal24036 <148854295+VanshAgarwal24036@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-01-12 16:02:23 +00:00
Sergey B Kirpichev
8fd4435cd9
[3.13] gh-78724: Raise RuntimeError's when calling methods on non-ready Struct()'s (GH-143643) (GH-143714)
(cherry picked from commit 515ae4078d)
2026-01-12 14:45:52 +02:00
Serhiy Storchaka
1822f59dc7
[3.13] gh-142881: Fix concurrent and reentrant call of atexit.unregister() (GH-142901) (GH-143722)
(cherry picked from commit dbd10a6c29)
2026-01-12 10:05:09 +00:00
Serhiy Storchaka
dcc6117628
[3.13] gh-143378: Fix use-after-free when BytesIO is concurrently mutated during write operations (GH-143408) (GH-143600)
PyObject_GetBuffer() can execute user code (e.g. via __buffer__), which may
close or otherwise mutate a BytesIO object while write() or writelines()
is in progress. This could invalidate the internal buffer and lead to a
use-after-free.

Ensure that PyObject_GetBuffer() is called before validation checks.
(cherry picked from commit 6d54b6ac7d)

Co-authored-by: zhong <60600792+superboy-zjc@users.noreply.github.com>
2026-01-12 10:37:28 +02:00
Serhiy Storchaka
e319262c4e
[3.13] gh-143638: Forbid cuncurrent use of the Pickler and Unpickler objects in C implementation (GH-143664) (GH-143687)
Previously, this could cause crash or data corruption, now concurrent calls
of methods of the same object raise RuntimeError.
(cherry picked from commit d1282efb2b)
2026-01-11 12:34:36 +00:00
Victor Stinner
43e495d6f4
[3.13] gh-142991: Fix socketmodule.c build: remove _Py_FALLTHROUGH (#143514)
Fix commit 7f936694db backport which
uses _Py_FALLTHROUGH: this macro only exists in Python 3.14 and
newer.
2026-01-07 14:17:06 +00:00
Miss Islington (bot)
7f936694db
[3.13] gh-142991: socketmodule: fixed getsockaddrlen() for PF_DIVERT socket (GH-142993) (#143482)
gh-142991: socketmodule: fixed getsockaddrlen() for PF_DIVERT socket (GH-142993)
(cherry picked from commit 05406b221d)

Co-authored-by: Gleb Smirnoff <glebius@FreeBSD.org>
2026-01-06 16:48:03 +00:00