Commit graph

15218 commits

Author SHA1 Message Date
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
Semyon Moroz
8b72c3d561
[3.14] gh-143331: Schedule to remove format "N" for Decimal (GH-143372) (#143476)
(cherry picked from commit dd750b3485)
2026-01-06 15:58:29 +02:00
Miss Islington (bot)
623dbafc9d
[3.14] gh-143309: fix UAF in os.execve when the environment is concurrently mutated (GH-143314) (#143398)
gh-143309: fix UAF in `os.execve` when the environment is concurrently mutated (GH-143314)
(cherry picked from commit 9609574e7f)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-01-03 22:31:45 +00:00
Miss Islington (bot)
c99d87db1f
[3.14] gh-143308: fix UAF when PickleBuffer is concurrently mutated in a callback (GH-143312) (#143396)
gh-143308: fix UAF when PickleBuffer is concurrently mutated in a callback (GH-143312)
(cherry picked from commit 6c53af18f6)

---------------

Co-authored-by: Aaron Wieczorek <aaronw@fastmail.com>
Co-authored-by: Aaron Wieczorek <woz@Aarons-MacBook-Pro.local>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-01-03 22:27:35 +00:00
Miss Islington (bot)
8beec4a2e4
[3.14] gh-143310: fix crash in Tcl object conversion with concurrent mutations (GH-143321) (#143343)
gh-143310: fix crash in Tcl object conversion with concurrent mutations (GH-143321)
(cherry picked from commit 9712dc1d9e)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-01-02 10:17:13 +00:00
Bénédikt Tran
048edac8be
[3.14] gh-142830: prevent some crashes when mutating sqlite3 callbacks (GH-143245) (#143322)
(cherry picked from commit 7f6c16a956)
2026-01-01 11:24:21 +00:00
Miss Islington (bot)
7ff87fa8e1
[3.14] gh-143200: fix UAFs in Element.__{set,get}item__ when the element is concurrently mutated (GH-143226) (#143273)
gh-143200: fix UAFs in `Element.__{set,get}item__` when the element is concurrently mutated (GH-143226)
(cherry picked from commit b6b0e14b3d)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-12-29 17:57:54 +00:00
Miss Islington (bot)
723ed8c507
[3.14] gh-143164: Fix incorrect error message for ctypes bitfield overflow (GH-143165) (GH-143176)
(cherry picked from commit b9a4806430)

Signed-off-by: Yongtao Huang <yongtaoh2022@gmail.com>
Co-authored-by: Yongtao Huang <yongtaoh2022@gmail.com>
2025-12-25 17:34:02 +00:00
Miss Islington (bot)
88a4d0d34b
[3.14] gh-143145: Fix possible reference leak in ctypes _build_result() (GH-143131) (GH-143169)
The result tuple was leaked if __ctypes_from_outparam__() failed for any item.
(cherry picked from commit 579c5b496b)

Signed-off-by: Yongtao Huang <yongtaoh2022@gmail.com>
Co-authored-by: Yongtao Huang <yongtaoh2022@gmail.com>
2025-12-25 19:09:53 +02:00
Miss Islington (bot)
240ee20770
[3.14] gh-143004: Fix possible use-after-free in collections.Counter.update() (GH-143044) (GH-143166)
This happened when the Counter was mutated when incrementing
the value for an existing key.
(cherry picked from commit 86d904588e)

Co-authored-by: kaushal trivedi <155625932+Kaushalt2004@users.noreply.github.com>
2025-12-25 13:41:10 +02:00
Miss Islington (bot)
aee8c217bd
[3.14] gh-122431: Correct the non-negative error message in readline.append_history_file (GH-143075) (GH-143090)
gh-122431: Correct the non-negative error message in `readline.append_history_file` (GH-143075)

"positive" -> "non-negative", since zero is included.
(cherry picked from commit a273bc99d2)

Co-authored-by: Zheng Yu <dataisland@outlook.com>
2025-12-23 05:01:41 +00:00
Miss Islington (bot)
586047a8d8
[3.14] gh-143012: use Py_ssize_t cast for PyBytes_FromStringAndSize (GH-143013) (#143014)
gh-143012: use `Py_ssize_t` cast for `PyBytes_FromStringAndSize` (GH-143013)
(cherry picked from commit 5989095dfd)

Co-authored-by: AZero13 <gfunni234@gmail.com>
2025-12-20 08:02:44 +00:00
Miss Islington (bot)
8c92d665ee
[3.14] gh-112127: Fix possible use-after-free in atexit.unregister() (GH-114092) (#142878)
gh-112127: Fix possible use-after-free in atexit.unregister() (GH-114092)
(cherry picked from commit 2b466c47c3)

Co-authored-by: Benjamin Johnson <ben332004@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-12-17 21:36:12 +05:30
Miss Islington (bot)
897e2b46fb
[3.14] gh-142783: Fix possible use after free in zoneinfo module (GH-142790) (GH-142862)
(cherry picked from commit 8307a14d0e)

Co-authored-by: wangxiaolei <fatelei@gmail.com>
2025-12-17 09:23:59 +00:00
Miss Islington (bot)
d089cad656
[3.14] gh-142495: Make defaultdict keep existed value when racing with __missing__ (GH-142668) (GH-142832)
(cherry picked from commit a043407510)

Co-authored-by: Edward Xu <xuxiangad@gmail.com>
2025-12-16 15:31:05 +00:00
Miss Islington (bot)
c31ea74970
[3.14] gh-142595: Amend be5e0dcded (fix NULL pointer dereference) (GH-142775) (#142788)
gh-142595: Amend be5e0dcded (fix NULL pointer dereference) (GH-142775)
(cherry picked from commit 15a9762500)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-12-16 15:42:43 +05:30
Cody Maloney
58da2a9d94
[3.14] gh-142594: fix by property calls io.TextIOWrapper.detach (GH-142706) (GH-142755)
(cherry picked from commit 1d3854a19a)

Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Co-authored-by: yihong <zouzou0208@gmail.com>
2025-12-16 10:55:25 +01:00
Miss Islington (bot)
575174ee78
[3.14] gh-142595: add type check for namedtuple call during decimal initialization (GH-142608) (GH-142623)
(cherry picked from commit be5e0dcded)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-12-15 15:03:57 +01:00
Neil Schemenauer
27f27a68b3
[3.14] gh-142531: Fix free-threaded GC performance regression (gh-142562) (gh-142617)
If there are many untracked tuples, the GC will run too often, resulting
in poor performance.  The fix is to include untracked tuples in the
"long lived" object count. The number of frozen objects is also now
included since the free-threaded GC must scan those too.
(cherry picked from commit e38967ed60)
2025-12-12 14:30:20 -08:00
Sam Gross
12d2b95adf
[3.14] gh-142589: Fix PyUnstable_Object_IsUniqueReferencedTemporary (gh-142593) (#142597)
PyUnstable_Object_IsUniqueReferencedTemporary wasn't handling tagged
ints on the evaluation stack properly.
(cherry picked from commit a26c831bc4)
2025-12-11 20:08:45 +00:00
Petr Viktorin
e09c4deb25
[3.14] gh-123241: Don't modify ref count during visitation (GH-142232) (#142567)
(cherry picked from commit da8199f884)

Co-authored-by: Dino Viehland <dinoviehland@meta.com>
2025-12-11 10:51:11 -08:00
Miss Islington (bot)
fc40e7dc52
[3.14] Fix os.posix_spawn() error handling (GH-142532) (#142582)
Fix os.posix_spawn() error handling (GH-142532)

Consistently use `goto exit;` in `py_posix_spawn()`.
(cherry picked from commit 8cfa351560)

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
2025-12-11 17:32:11 +00:00
Miss Islington (bot)
7218be0199
[3.14] gh-142556: fix crash when a task gets re-registered during finalization in asyncio (GH-142565) (#142566)
gh-142556: fix crash when a task gets re-registered during finalization in `asyncio` (GH-142565)
(cherry picked from commit 42d2bedb87)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-12-11 10:00:44 +00:00
Miss Islington (bot)
94012d65c9
[3.14] gh-116738: Statically initialize special constants in cmath module (gh-142161) (gh-142261)
The initialization during `mod_exec` wasn't thread-safe with multiple interpreters.
(cherry picked from commit 2dac9e6016)

Co-authored-by: Alper <alperyoney@fb.com>
2025-12-04 14:51:55 +00:00