Commit graph

128564 commits

Author SHA1 Message Date
Miss Islington (bot)
fd9db61a25
[3.14] gh-142557: fix UAF in bytearray.__mod__ when object is mutated while formatting %-style arguments (GH-143213) (#143227)
gh-142557: fix UAF in `bytearray.__mod__` when object is mutated while formatting `%`-style arguments (GH-143213)
(cherry picked from commit 61ee04834b)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-12-27 15:23:08 +00:00
Miss Islington (bot)
bbe9ed95d4
[3.14] gh-142664: fix PyObject_Hash invokation post GH-143217 (GH-143223) (#143224)
gh-142664: fix `PyObject_Hash` invokation post GH-143217 (GH-143223)
(cherry picked from commit 84fcdbd86e)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-12-27 14:55:45 +00:00
Miss Islington (bot)
93029e45b7
[3.14] gh-143195: fix UAF in {bytearray,memoryview}.hex(sep) via re-entrant sep.__len__ (GH-143209) (#143219)
gh-143195: fix UAF in `{bytearray,memoryview}.hex(sep)` via re-entrant `sep.__len__` (GH-143209)
(cherry picked from commit 9976c2b634)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-12-27 13:57:41 +00:00
Miss Islington (bot)
cb8b96ed25
[3.14] gh-142664: fix UAF in memoryview.__hash__ via re-entrant data's __hash__ (GH-143217) (#143221)
gh-142664: fix UAF in `memoryview.__hash__` via re-entrant data's `__hash__` (GH-143217)
(cherry picked from commit 00e24b80e0)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-12-27 13:37:32 +00:00
Miss Islington (bot)
bae4cd6608
[3.14] no-issue: Fix override value in os.rst (gh-123522) (gh-143211) 2025-12-27 10:53:40 +00:00
Miss Islington (bot)
9316e4bb7e
[3.14] Fix typos in docs (GH-143193) (#143207)
Fix typos in docs (GH-143193)
(cherry picked from commit 57d569942c)

Co-authored-by: SYan212 <syan235711@gmail.com>
2025-12-27 07:58:01 +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)
8a61b71eee
[3.14] gh-142975: During GC, mark frozen objects with a merged zero refcount for destruction (GH-143156) (GH-143175)
gh-142975: During GC, mark frozen objects with a merged zero refcount for destruction (GH-143156)
(cherry picked from commit 8611f74e08)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-12-25 12:00:42 -05:00
Miss Islington (bot)
02282e5479
[3.14] gh-140717: Add exc_text to LogRecord attributes table (GH-140718) (GH-143152)
Co-authored-by: Tom Kuson <mail@tjkuson.me>
2025-12-25 12:41:42 +00: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)
bac24eed2a
[3.14] Move News for gh-142560 to Core and Builtins (GH-143154) (GH-143155)
(cherry picked from commit 305aff0a66)

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
2025-12-24 21:33:12 +02:00
Miss Islington (bot)
73c40bb8ba
[3.14] gh-143135: Fix sys.flags.inspect when PYTHONINSPECT=0 (GH-143136) (GH-143153)
(cherry picked from commit 3509fa5a12)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-12-24 18:23:41 +00:00
Miss Islington (bot)
6809811036
[3.14] Correctly fold unknown-8bit originating from encoded words. (GH-142517) (#143146)
The unknown-8bit trick was designed to deal with unknown bytes in an
ASCII message, and it works fine for that.  However, I also tried to
extend it to handle bytes that can't be decoded using the charset
specified in an encoded word, and there it fails because there can be
other non-ASCII characters that were *successfully* decoded.  The fix is
simple: do the unknown-8bit encoding using the utf-8 codec.  This is
especially appropriate since anyone trying to do recovery on an unknown
byte string will probably attempt utf-8 first.
(cherry picked from commit 1e17ccd030)

Co-authored-by: R. David Murray <rdmurray@bitdance.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-12-24 13:20:05 -05:00
Sam Gross
b921374c78
[3.14] gh-143121: Skip test that leak threads under TSan (gh-143125) (#143141)
(cherry picked from commit 4ee6929d60)
2025-12-24 13:31:05 +00:00
Miss Islington (bot)
41f4687867
[3.14] gh-142145: Avoid timing measurements in quadratic behavior test (gh-143105) (#143139)
Count the number of Element attribute accesses as a proxy for work done.
With double the amount of work, a ratio of 2.0 indicates linear scaling
and 4.0 quadratic scaling. Use 3.2 as an intermediate threshold.
(cherry picked from commit 57937a8e5e)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-12-24 13:25:43 +00:00
Miss Islington (bot)
64461f1ca5
[3.14] gh-109263: Start process from spawn context in multiprocessing no longer have side effect (GH-135813) (#143115)
gh-109263: Start process from spawn context in multiprocessing no longer have side effect (GH-135813)
(cherry picked from commit c2202a7e66)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2025-12-24 03:04:46 +00:00
Hugo van Kemenade
e6b11c8861
[3.14] Update pre-commit with zizmor and Ruff fixes (GH-143095) (#143102) 2025-12-23 16:51:54 +00:00
Miss Islington (bot)
a007e951ef
[3.14] gh-84232: Fix pydoc docs.python.org link generation (GH-139995) (#143098)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Éric <merwok@netwok.org>
2025-12-23 18:26:49 +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)
e25083abee
[3.14] gh-89152: Note truth testing exception in stdtypes.rst (GH-137640) (#143081)
gh-89152: Note truth testing exception in `stdtypes.rst` (GH-137640)
(cherry picked from commit 3c0888b25b)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-12-22 19:42:24 +00:00
Miss Islington (bot)
33c9ebe437
[3.14] gh-143010: Prevent a TOCTOU issue by only calling open once (GH-143011) (#143080)
gh-143010: Prevent a TOCTOU issue by only calling open once (GH-143011)

RDM: per  AZero13's research the 'x' option did not exist when this code was written,  This
modernization can thus drop the fd trick in _create_carefully and just use open with 'x' to achieve the same goal more securely.
(cherry picked from commit a88d1b8dab)

Co-authored-by: AZero13 <gfunni234@gmail.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
2025-12-22 13:14:59 -05:00
Miss Islington (bot)
98f6db7e82
[3.14] gh-143057: avoid locking in tracemalloc C-APIs when it is not enabled (GH-143065) (#143071)
gh-143057: avoid locking in `tracemalloc` C-APIs when it is not enabled (GH-143065)
(cherry picked from commit e728b006de)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-12-22 16:04:24 +00:00
Miss Islington (bot)
6a3b861cb2
[3.14] gh-143046: Make asyncio REPL respect the -q flag (quiet mode) (GH-143047) (#143060)
gh-143046: Make asyncio REPL respect the `-q` flag (quiet mode) (GH-143047)
(cherry picked from commit 6213a512bf)

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
2025-12-22 13:48:16 +05:30
Miss Islington (bot)
4646ddc309
[3.14] gh-79986: Add parsing for References/In-Reply-To email headers (GH-137201) (#142573)
gh-79986: Add parsing for References/In-Reply-To email headers (GH-137201)

This is a followup to 46d88a1131 (GH-13397),
which added parsing for Message-ID. Similar handling is needed for the
other two identification headers.
(cherry picked from commit 79aa43a979)

Co-authored-by: elenril <anton@khirnov.net>
2025-12-21 14:35:24 -05:00
Miss Islington (bot)
362d11e545
[3.14] gh-70647: Better promote how to safely parse yearless dates in datetime. (GH-116179) (#143037)
gh-70647: Better promote how to safely parse yearless dates in datetime. (GH-116179)

* gh-70647: Better promote how to safely parse yearless dates in datetime.

Every four years people encounter this because it just isn't obvious.
This moves the footnote up to a note with a code example.

We'd love to change the default year value for datetime but doing
that could have other consequences for existing code.  This documented
workaround *always* works.

* doctest code within note is bad, dedent.

* Update to match the error message.

* remove no longer referenced footnote

* ignore the warning in the doctest

* use Petr's suggestion for the docs to hide the warning processing

* cover date.strptime (3.14) as well
(cherry picked from commit b8d3fddba6)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2025-12-21 06:52:55 +00:00
Miss Islington (bot)
27648a1818
[3.14] gh-142145: relax the no-longer-quadratic test timing (GH-143030) (#143031)
gh-142145: relax the no-longer-quadratic test timing (GH-143030)

* gh-142145: relax the no-longer-quadratic test timing

* require cpu resource
(cherry picked from commit 8d2d7bb2e7)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2025-12-21 00:25:25 +00:00
Miss Islington (bot)
4424d1b38f
[3.14] gh-142754: Ensure that Element & Attr instances have the ownerDocument attribute (GH-142794) (#142818)
gh-142754: Ensure that Element & Attr instances have the ownerDocument attribute (GH-142794)
(cherry picked from commit 1cc7551b3f)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-12-20 15:56:47 -08: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
stratakis
dcbde6b792
[3.14] gh-142776: Ensure fp file descriptor is closed on all code paths in import.c (GH-142777) (#142988)
gh-142776: Ensure fp file descriptor is closed on all code paths in import.c (GH-142777)

(cherry picked from commit 6a4f10325d)
2025-12-20 12:49:23 +05:30
Miss Islington (bot)
dbc7fd61d8
[3.14] gh-142560: prevent use-after-free in search-like methods by exporting buffer in bytearray (GH-142938) (#142983)
gh-142560: prevent use-after-free in search-like methods by exporting buffer in bytearray (GH-142938)
(cherry picked from commit 220f0b1077)

Co-authored-by: wangxiaolei <fatelei@gmail.com>
2025-12-19 16:58:24 +00:00
Miss Islington (bot)
b46ce52a53
[3.14] gh-142527: Docs: Clarify that random.seed() discards the sign of an integer input (GH-142483) (#142970)
gh-142527: Docs: Clarify that random.seed() discards the sign of an integer input (GH-142483)

If *a* is an integer, the sign of *a* is discarded in the C source code. Clarify this behavior to prevent foot guns, where a common use case might naively assume that flipping the sign will produce different sequences (e.g. for a train/test split of a synthetic data generator in machine learning).
(cherry picked from commit 610aabfef2)

Co-authored-by: Andrej <andrej.karpathy@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-12-19 08:34:54 +00:00
Miss Islington (bot)
e48fb94d8c
[3.14] gh-118342: [Enum] update docs (GH-137290) (GH-142953)
gh-118342: [Enum] update docs (GH-137290)

(cherry picked from commit e79c39101a)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-12-18 11:18:46 -08:00
Miss Islington (bot)
f1288d353f
[3.14] gh-142681: Move NormalizationTest-3.2.0.txt to more safe place. (GH-142935) (GH-142944)
(cherry picked from commit 4a8ecbad80)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-12-18 18:34:05 +01:00
Miss Islington (bot)
f02231b8a0
[3.14] gh-142784: make the asyncio REPL call loop.close() at exit (GH-142785) (#142933)
gh-142784: make the asyncio REPL call `loop.close()` at exit (GH-142785)
(cherry picked from commit ddfc155d3a)

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
2025-12-18 19:25:50 +05:30
Miss Islington (bot)
693d8a1a10
[3.14] gh-137063: Document that ast node types replaced by Constant are no longer available (GH-137064) (GH-142930)
(cherry picked from commit fc80096a07)

Co-authored-by: James <snoopjedi@gmail.com>
2025-12-18 13:24:54 +01:00
Miss Islington (bot)
7134b407dc
[3.14] GH-100964: Fix reference cycle in exhausted generator frames (GH-141112) (#142902)
GH-100964: Fix reference cycle in exhausted generator frames (GH-141112)
(cherry picked from commit 92243dc62c)

Co-authored-by: Savannah Ostrowski <savannah@python.org>
2025-12-17 19:48:18 +00:00
Miss Islington (bot)
25a94708e5
[3.14] gh-142766: Clear frame when generator.close() is called (gh-142838) (#142899)
(cherry picked from commit 25397f9541)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-12-17 18:33:15 +00:00
Miss Islington (bot)
338bdb2415
[3.14] gh-142873: Do not check for PyContextVar_CheckExact twice in PyContextVar_Set (GH-142874) (#142893)
gh-142873: Do not check for `PyContextVar_CheckExact` twice in `PyContextVar_Set` (GH-142874)
(cherry picked from commit e61a447d0e)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-12-17 18:28:37 +00:00
Miss Islington (bot)
547e38cf3a
[3.14] gh-142876: remove reference to thread in documentation of asyncio.Queue.shutdown (GH-142888) (#142891)
gh-142876: remove reference to thread in documentation of `asyncio.Queue.shutdown` (GH-142888)
(cherry picked from commit 77c8e6a2b8)

Co-authored-by: Damian Birchler <damian@damianbirchler.net>
2025-12-17 22:23:27 +05:30
Miss Islington (bot)
ad6396ece5
[3.14] decimal docs: specification link and examples (GH-128698) (#142804)
decimal docs: specification link and examples (GH-128698)
(cherry picked from commit 2450be607c)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: RUANG (James Roy) <longjinyii@outlook.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-12-17 21:42:23 +05:30
Stan Ulbrych
8a2ea9196d
[3.14] typo fixes in docs (GH-142683) (#142839)
(cherry picked from commit 39ecb17103)

Co-authored-by: SYan212 <syan235711@gmail.com>
2025-12-17 21:41:54 +05:30
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)
06137178b0
[3.14] gh-142836: Avoid /proc fd pipes on Solaris (GH-142853) (#142854)
gh-142836: Avoid /proc fd pipes on Solaris (GH-142853)
(cherry picked from commit c35b812e77)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2025-12-17 08:20:34 -05:00
Miss Islington (bot)
eb1284eb26
[3.14] gh-142859: Add Tools/check-c-api-docs to mypy check (GH-142860) (#142871)
gh-142859: Add `Tools/check-c-api-docs` to mypy check (GH-142860)
(cherry picked from commit 248eb3efb3)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-12-17 11:50:22 +00:00
Miss Islington (bot)
ce23b70ea6
[3.14] gh-140374: Add glossary entries related to multithreading (GH-140375) (#142868)
---------
(cherry picked from commit 1e9a0ee682)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Daniele Parmeggiani <8658291+dpdani@users.noreply.github.com>
2025-12-17 12:17:46 +01:00
Miss Islington (bot)
f2d6f57178
[3.14] gh-139320: Cover exception chaining in the docs of contextmanager.__exit__ (GH-140169) (GH-142792)
(cherry picked from commit a44509ea87)

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
2025-12-17 11:28:42 +01:00
Miss Islington (bot)
57b37a9ca9
[3.14] gh-139743: Avoid print twice verbose version for sqlite tests (GH-142850) (GH-142865)
(cherry picked from commit 454485e564)

Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Co-authored-by: yihong <zouzou0208@gmail.com>
2025-12-17 10:10:46 +00:00
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)
4feba4db2c
[3.14] gh-142752: add more thread safety tests for mock (GH-142791) (#142856)
gh-142752: add more thread safety tests for mock (GH-142791)
(cherry picked from commit 4fd006e712)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-12-17 08:14:20 +00:00