Commit graph

15241 commits

Author SHA1 Message Date
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
Miss Islington (bot)
7e389260aa
[3.14] gh-145743: Fix inconsistency after calling Struct.__init__() with invalid format (GH-145744) (GH-145763)
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:55:58 +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
Ramin Farajpour Cami
7c624d4f31
[3.14] gh-145623: Fix crashes on uninitialized struct.Struct objects (gh-145624) (GH-145630) 2026-03-09 17:41:39 +01:00
Miss Islington (bot)
0e423f1c26
[3.14] gh-145376: Fix refleak in queuemodule.c out-of-memory path (GH-145543) (#145622)
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:51 +05:30
Miss Islington (bot)
c23dd527e0
[3.14] gh-145376: Fix crashes in md5module.c and hmacmodule.c (GH-145422) (#145610)
gh-145376: Fix crashes in `md5module.c` and `hmacmodule.c` (GH-145422)

Fix a possible NULL pointer dereference in `md5module.c` and a double-free in `hmacmodule.c`.
Those crashes only occur in error paths taken when the interpreter fails to allocate memory.
(cherry picked from commit c1d7768321)

Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
2026-03-06 21:06:32 +00:00
Sam Gross
7b9508f4b0
[3.14] gh-144513: Skip critical section locking during stop-the-world (gh-144524) (#145570) 2026-03-06 12:00:17 -05:00
Miss Islington (bot)
f42692838c
[3.14] gh-145301: Fix double-free in hashlib and hmac module initialization (GH-145321) (#145523)
gh-145301: Fix double-free in hashlib and hmac module initialization (GH-145321)
(cherry picked from commit 6acaf659ef)


gh-145301: Fix double-free in hashlib and hmac initialization

Co-authored-by: krylosov-aa <krylosov.andrew@gmail.com>
2026-03-05 04:13:02 +00:00
Miss Islington (bot)
3c99c16231
[3.14] gh-144475: Fix reference management in partial_repr (GH-145362) (GH-145470)
(cherry picked from commit 671a953dd6)

Co-authored-by: bkap123 <97006829+bkap123@users.noreply.github.com>
2026-03-03 16:40:23 +01:00
Miss Islington (bot)
96c9394c8a
[3.14] gh-142781: Fix type confusion in zoneinfo weak cache (GH-142925) (GH-145419)
(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:48:05 +01:00
Miss Islington (bot)
504436870b
[3.14] gh-145335: Fix crash when passing -1 as fd in os.pathconf (GH-145390) (#145433)
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:33:47 +00:00
Miss Islington (bot)
86c846735b
[3.14] Fix unlikely potential reference leak in _locale._getdefaultlocale (GH-145250) (GH-145302)
It occurs in a code which perhaps never executed.
(cherry picked from commit 6ea84b2726)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-02-27 08:31:11 +00:00
Miss Islington (bot)
bc6a7a2b0c
[3.14] gh-142787: Handle empty sqlite3 blob slices (GH-142824) (#145297)
(cherry picked from commit 06b0920f12)

Co-authored-by: A.Ibrahim <abdulrasheedibrahim47@gmail.com>
2026-02-27 01:12:51 +01:00
Pablo Galindo Salgado
ded533b1fa
[3.14] gh-144316: Fix missing exception in _remote_debugging with debug=False (GH-144442) (#145280) 2026-02-26 22:39:48 +00:00
Stan Ulbrych
0701ce636c
[3.14] gh-88091: Fix unicodedata.decomposition() for Hangul Syllables (GH-144993) (GH-145189)
(cherry picked from commit 56c4f10d6e)
2026-02-25 00:27:09 +02:00
Miss Islington (bot)
35a7a6767e
[3.14] _struct.c: Fix UB from integer overflow in prepare_s (GH-145158) (#145162)
`_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:18:32 +00:00
Sam Gross
bbb0f2d880
[3.14] gh-144777: Fix data races in IncrementalNewlineDecoder (gh-144971) (#145143) 2026-02-23 15:25:03 +00:00
Bénédikt Tran
1decc7ee20
[3.14] gh-142516: fix reference leaks in ssl.SSLContext objects (GH-143685) (#145075)
* [3.14] gh-142516: fix reference leaks in `ssl.SSLContext` objects (GH-143685)
(cherry picked from commit 3a2a686cc4)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

* fix backport
2026-02-21 13:31:23 -08:00
Bénédikt Tran
dcf96d0ed6
[3.14] gh-143698: correctly check scheduler and setpgroup values for os.posix_spawn[p] (GH-143699) (#145073)
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:04:31 +01:00
Miss Islington (bot)
07dbda5a57
[3.14] gh-144809: Make deque copy atomic in free-threaded build (gh-144966) (#145053)
(cherry picked from commit 70da972f97)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2026-02-20 15:47:46 -05:00
Serhiy Storchaka
a3b6be9317
[3.14] gh-140652: Fix a crash in _interpchannels.list_all() after closing a channel (GH-143743) (GH-144954)
(cherry picked from commit 3f50432e31)
2026-02-18 13:29:34 +00:00
Miss Islington (bot)
907958c4ba
[3.14] gh-144601: Avoid sharing exception objects raised in a PyInit function across multiple interpreters (GH-144602) (GH-144633)
gh-144601: Avoid sharing exception objects raised in a `PyInit` function across multiple interpreters (GH-144602)
(cherry picked from commit fd6b639a49)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2026-02-16 10:37:46 -05:00
Serhiy Storchaka
bcabbd02f6
[3.14] gh-80667: Fix lookup for Tangut ideographs in unicodedata (GH-144789) (GH-144871)
(cherry picked from commit 8b7b5a9946)

Co-authored-by: Pierre Le Marre <dev@wismill.eu>
2026-02-16 14:25:43 +02:00
Miss Islington (bot)
53b8e64150
[3.14] gh-144833: Fix use-after-free in SSL module when SSL_new() fails (GH-144843) (#144858)
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:10:23 +00:00
Miss Islington (bot)
5b0c1f780f
[3.14] gh-143637: Fix re-entrant mutation of ancillary data in socket.sendmsg() (GH-143892) (#144786)
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-14 17:07:32 +00:00
Zachary Ware
c7ceb75ada
[3.14] gh-144551: Update CI to use latest OpenSSL versions (GH-144794) (#144799)
[3.14] gh-144551: Update CI to use latest OpenSSL versions

Also update _ssl_data_35.h to include an added symbol from 3.5.5.

(cherry picked from commit b933ef9261)
2026-02-13 22:31:27 +02:00
Miss Islington (bot)
ac9e9e2c8f
[3.14] gh-80667: Fix case-sensitivity of some Unicode literal escapes (GH-107281) (GH-144753)
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:22:05 +00:00
Serhiy Storchaka
4d3e8c1c85
[3.14] gh-84424: Use numeric_changed for UCD.numeric (GH-19457) (GH-144731)
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:38:27 +00:00
Miss Islington (bot)
befa954efe
[3.14] gh-144629: Add test for the PyFunction_GetAnnotations() function (GH-144630) (#144670)
gh-144629: Add test for the PyFunction_GetAnnotations() function (GH-144630)
(cherry picked from commit cc81707e40)

Co-authored-by: Nybblista <170842536+nybblista@users.noreply.github.com>
2026-02-10 15:05:25 +00:00
Bartosz Sławecki
616e611844
[3.14] gh-144563: Fix remote debugging with duplicate libpython mappings from ctypes (GH-144595) (#144655) 2026-02-10 14:31:49 +00:00
Miss Islington (bot)
13b3dd0622
[3.14] gh-143543: Fix re-entrant use-after-free in itertools.groupby (GH-143738) (GH-144626)
(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:10 +01:00
Miss Islington (bot)
2e3f0146f2
[3.14] gh-144363: Update bundled libexpat to 2.7.4 (GH-144365) (GH-144499)
(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>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2026-02-09 14:21:54 +01:00
Miss Islington (bot)
f4239df276
[3.14] gh-140414: add fastpath for current running loop in asyncio.all_tasks (GH-140542) (#144494)
* gh-140414: add fastpath for current running loop in `asyncio.all_tasks` (GH-140542)

Optimize `asyncio.all_tasks()` for the common case where the event loop is running in the current thread by avoiding stop-the-world pauses and locking.

This optimization is already present for `asyncio.current_task()` so we do the same for `asyncio.all_tasks()`.
(cherry picked from commit 95e5d59630)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-02-06 08:48:06 +05:30
Miss Islington (bot)
72ec166846
[3.14] gh-142555: Fix null pointer dereference in array.__setitem__ via re-entrant __index__ (GH-142713) (#144396)
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-03 11:38:50 +01:00
Miss Islington (bot)
343679ee6a
[3.14] gh-144380: Fix incorrect type check in buffered_iternext() (GH-144381) (#144389)
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:30:34 +00:00
Miss Islington (bot)
237467f474
[3.14] gh-144100: Fix crash for POINTER(str) used in ctypes argtypes (GH-144108) (#144244)
gh-144100: Fix crash for POINTER(str) used in ctypes argtypes (GH-144108)
(cherry picked from commit 8f459255eb)

Co-authored-by: VanshAgarwal24036 <148854295+VanshAgarwal24036@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-01-26 12:53:20 +00:00
Stan Ulbrych
fbc81558a4
[3.14] gh-144023: Prevent follow_symlinks from being allowed with an fd of 0 (GH-144022) (#144151)
[3.14] 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:53:02 +00:00
Miss Islington (bot)
1cfb4192fe
[3.14] Update struct.__doc__: _Bool available unconditionally (GH-143716) (#144070)
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:33:28 +00:00
Miss Islington (bot)
6219497fd9
[3.14] gh-143674: Document F/D complex format characters in struct module (GH-143675) (#143918)
gh-143674: Document F/D complex format characters in struct module (GH-143675)

Add documentation for the F (complex from two floats) and D (complex
from two doubles) format characters in the struct module docstring.
These format characters were implemented but not documented.
(cherry picked from commit 3e93225798)

Co-authored-by: Muneeb Ullah <moneebullah25@gmail.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2026-01-16 17:38:08 +00:00
Sam Gross
0042384bd5
[3.14] gh-143880: Fix data race in functools.partial in free threading build (#143882)
gh-143880: Fix data race in `functools.partial` in free threading build

The assignment to `pto->vectorcall` isn't thread-safe in the free
threading build. Note that this is already fixed in the main branch.
2026-01-16 22:25:40 +05:30
Miss Islington (bot)
4a191f9e70
[3.14] gh-143249: Fix buffer leak when overlapped operation fails to start on windows (GH-143250) (#143795)
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:57:54 +00:00
Miss Islington (bot)
7a066ad020
[3.14] gh-143196: Fix crash in non-standard use of internal JSON encoder object (GH-143618) (GH-143748)
The internal encoder object returned by undocumented function
json.encoder.c_make_encoder() (aka _json.make_encoder()) crashed
when it was called with non-zero second argument.
(cherry picked from commit c559135c93)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-01-12 18:50:40 +00:00
Miss Islington (bot)
78ea9eb340 [3.14] gh-143544: Fix possible use-after-free in the JSON decoder when JSONDecodeError disappears during raising it (GH-143561) (#143733)
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:06:24 +00:00
Miss Islington (bot)
8f85adc151
[3.14] gh-78724: Raise RuntimeError's when calling methods on non-ready Struct()'s (GH-143643) (GH-143695)
(cherry picked from commit 515ae4078d)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2026-01-12 14:45:07 +02:00
Miss Islington (bot)
73d44452a2
[3.14] gh-142881: Fix concurrent and reentrant call of atexit.unregister() (GH-142901) (GH-143721)
(cherry picked from commit dbd10a6c29)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-01-12 11:44:12 +02:00
Serhiy Storchaka
115b27d2bb
[3.14] gh-143638: Forbid cuncurrent use of the Pickler and Unpickler objects in C implementation (GH-143664) (GH-143686)
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:37:00 +00:00
Miss Islington (bot)
0e2ed4b0e1
[3.14] gh-143191: Use _PyOS_MIN_STACK_SIZE in _thread.stack_size() (GH-143601) (#143611)
gh-143191: Use _PyOS_MIN_STACK_SIZE in _thread.stack_size() (GH-143601)

The stack size must be at least _PyOS_MIN_STACK_SIZE+SYSTEM_PAGE_SIZE
bytes.
(cherry picked from commit ba10100c39)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-01-09 15:34:39 +00:00
Miss Islington (bot)
f264f103d4
[3.14] gh-143378: Fix use-after-free when BytesIO is concurrently mutated during write operations (GH-143408) (GH-143599)
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-09 12:16:51 +00:00
Miss Islington (bot)
a299c1b185
[3.14] gh-143429: Use compile-time NaN encoding detection for test_struct (GH-143432) (#143595)
gh-143429: Use compile-time NaN encoding detection for test_struct (GH-143432)
(cherry picked from commit dcdb23f9db)

Co-authored-by: Henry Chen <chenx97@aosc.io>
2026-01-09 12:32:49 +01:00
Miss Islington (bot)
fcd9500c53
[3.14] gh-142991: socketmodule: fixed getsockaddrlen() for PF_DIVERT socket (GH-142993) (#143481)
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-07 14:20:07 +00:00