Commit graph

10074 commits

Author SHA1 Message Date
Miss Islington (bot)
93cb42fcb9
[3.13] gh-143200: fix UAFs in Element.__{set,get}item__ when the element is concurrently mutated (GH-143226) (#143274)
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 18:15:28 +00:00
Miss Islington (bot)
8cfe1ab887
[3.13] gh-142195: Fixed Popen.communicate indefinite loops (GH-143203) (#143256)
gh-142195: Fixed Popen.communicate indefinite loops (GH-143203)

Changed condition to evaluate if timeout is less than or equals to 0. This is needed for simulated time environments such as Shadow where the time will match exactly on the boundary.

---------
(cherry picked from commit fa9a4254e8)

Co-authored-by: Prithviraj Chaudhuri <p.chaudhuri1993@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2025-12-28 17:20:40 +00:00
Miss Islington (bot)
750c3efe82
[3.13] gh-143241: Fix infinite loop in zoneinfo._common.load_data (GH-143243) (#143252)
gh-143241: Fix infinite loop in `zoneinfo._common.load_data` (GH-143243)

Correctly reject truncated TZif files in `ZoneInfo.from_file`.

---------
(cherry picked from commit 3ca1f2a370)

Co-authored-by: Fatih Çelik <fcelik.ft@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-12-28 15:11:32 +00:00
Pablo Galindo Salgado
de34f6d404
[3.13] gh-143228: Fix UAF in perf trampoline during finalization (GH-143233) (#143248) 2025-12-28 14:32:16 +00:00
Bénédikt Tran
19fda670d6
[3.13] gh-142557: fix UAF in bytearray.__mod__ when object is mutated while formatting %-style arguments (GH-143213) (#143229)
(cherry picked from commit 61ee04834b)
2025-12-27 17:20:49 +00:00
Bénédikt Tran
4fcb1d9819
[3.13] gh-142664: fix UAF in memoryview.__hash__ via re-entrant data's __hash__ (GH-143217) (#143222)
(cherry picked from commit 00e24b80e0)
2025-12-27 13:43:11 +00:00
Bénédikt Tran
8aca2fd87c
[3.13] gh-143195: fix UAF in {bytearray,memoryview}.hex(sep) via re-entrant sep.__len__ (GH-143209) (#143220)
(cherry picked from commit 9976c2b634)
2025-12-27 12:58:42 +00:00
Miss Islington (bot)
5624bf9758
[3.13] gh-143145: Fix possible reference leak in ctypes _build_result() (GH-143131) (GH-143170)
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:39 +02:00
Miss Islington (bot)
4dd9d94619
[3.13] gh-143004: Fix possible use-after-free in collections.Counter.update() (GH-143044) (GH-143167)
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:24 +02:00
Stan Ulbrych
e132893cc7
[3.13] gh-143135: Fix sys.flags.inspect when PYTHONINSPECT=0 (GH-143136) (GH-143168)
(cherry picked from commit 3509fa5a12)
2025-12-25 12:57:20 +02:00
Cody Maloney
a9e068f0be
[3.13] gh-142560: prevent use-after-free in search-like methods by exporting buffer in bytearray (GH-142938) (GH-142986)
(cherry picked from commit 220f0b1077)

Co-authored-by: wangxiaolei <fatelei@gmail.com>
2025-12-24 19:13:47 +00:00
Miss Islington (bot)
88025560aa
[3.13] Correctly fold unknown-8bit originating from encoded words. (GH-142517) (#143147)
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:19:28 -05:00
Miss Islington (bot)
e20863f223
[3.13] gh-109263: Start process from spawn context in multiprocessing no longer have side effect (GH-135813) (#143116)
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:03:47 +00:00
Hugo van Kemenade
7dc6acc1e9
[3.13] gh-84232: Fix pydoc docs.python.org link generation (GH-139995) (#143099)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Éric <merwok@netwok.org>
2025-12-23 18:29:28 +02:00
Miss Islington (bot)
a9a8ca3e47
[3.13] gh-122431: Correct the non-negative error message in readline.append_history_file (GH-143075) (GH-143091)
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 04:59:43 +00:00
Miss Islington (bot)
a6cfdb5e9a
[3.13] gh-143010: Prevent a TOCTOU issue by only calling open once (GH-143011) (#143079)
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:13:53 -05:00
Miss Islington (bot)
96bc410fec
[3.13] gh-143046: Make asyncio REPL respect the -q flag (quiet mode) (GH-143047) (#143061)
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:28 +05:30
Miss Islington (bot)
c084a66568
[3.13] gh-79986: Add parsing for References/In-Reply-To email headers (GH-137201) (#142574)
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:36:23 -05:00
Miss Islington (bot)
86747f1a1a
[3.13] gh-142754: Ensure that Element & Attr instances have the ownerDocument attribute (GH-142794) (#142819)
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:59 -08:00
Mikhail Efimov
4504ff89d5
[3.13] gh-140373: Correctly emit PY_UNWIND event when generator is closed (GH-140767) (#140821) 2025-12-20 16:21:11 +02:00
Miro Hrončok
5d82520e38
[3.13] gh-141808: Don't remove the JIT stencils when building with PGO (GH-141809) (GH-142657) (#142955)
See: https://discuss.python.org/t/building-the-jit-with-pre-built-stencils/91838/12
(cherry picked from commit 8914148151)
(cherry picked from commit 73c80f69ba)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
2025-12-20 12:58:01 +01:00
stratakis
4b8c9f5a7b
[3.13] gh-142776: Ensure fp file descriptor is closed on all code paths in import.c (GH-142777) (#142989)
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:48:42 +05:30
Miss Islington (bot)
d6aa7e1d3d
[3.13] gh-142784: make the asyncio REPL call loop.close() at exit (GH-142785) (#142932)
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 22:34:03 +05:30
Savannah Ostrowski
8f7c4f1cef
[3.13] GH-100964: Fix reference cycle in exhausted generator frames (G… (#142904)
* [3.13] 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 20:04:53 +00:00
Sam Gross
db552ddb1e
[3.13] gh-142766: Clear frame when generator.close() is called (gh-142838) (#142900)
(cherry picked from commit 25397f9541)
2025-12-17 18:46:23 +00:00
Serhiy Storchaka
08d665d607
[3.13] gh-112127: Fix possible use-after-free in atexit.unregister() (GH-114092) (GH-142880)
(cherry picked from commit 2b466c47c3)

Co-authored-by: Benjamin Johnson <ben332004@gmail.com>
2025-12-17 17:15:21 +00:00
Miss Islington (bot)
7c2d9c9498
[3.13] gh-142836: Avoid /proc fd pipes on Solaris (GH-142853) (#142855)
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:28 -05:00
Miss Islington (bot)
88b8e63c54
[3.13] gh-142783: Fix possible use after free in zoneinfo module (GH-142790) (GH-142861)
(cherry picked from commit 8307a14d0e)

Co-authored-by: wangxiaolei <fatelei@gmail.com>
2025-12-17 09:21:20 +00:00
Serhiy Storchaka
9361207bc2
[3.13] gh-142495: Make defaultdict keep existed value when racing with __missing__ (GH-142668) (GH-142858)
(cherry picked from commit a043407510)

Co-authored-by: Edward Xu <xuxiangad@gmail.com>
2025-12-17 08:40:47 +00:00
Miss Islington (bot)
fb5474726c
[3.13] gh-142315: Don't pass the "real path" of Pdb script target to system functions (GH-142371) (#142498)
gh-142315: Don't pass the "real path" of Pdb script target to system functions (GH-142371

---------
(cherry picked from commit d716e3b2dd)

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2025-12-16 10:53:09 -05:00
Cody Maloney
affd2f2ff2
[3.13] gh-142594: fix by property calls io.TextIOWrapper.detach (GH-142706) (GH-142757)
(cherry picked from commit 1d3854a19a)

Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Co-authored-by: yihong <zouzou0208@gmail.com>
2025-12-16 10:55:35 +01:00
Bartosz Sławecki
3e45440382
[3.13] gh-142737: Handle lost io.open in _Py_FindSourceFile (GH-142747) (GH-142774)
(cherry picked from commit f277781bba)
2025-12-15 23:27:15 +00:00
Miss Islington (bot)
f66684969e
[3.13] gh-142595: add type check for namedtuple call during decimal initialization (GH-142608) (GH-142622)
(cherry picked from commit be5e0dcded)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-12-15 15:04:11 +01:00
Miss Islington (bot)
8ebda57bb1
[3.13] gh-142651: make Mock.call_count thread-safe (GH-142656) (#142744)
gh-142651: make `Mock.call_count` thread-safe (GH-142656)
(cherry picked from commit 850f95f6f6)

Co-authored-by: chaope <pengchaoandy@gmail.com>
2025-12-15 18:22:11 +05:30
Miss Islington (bot)
7957bfd1ac
[3.13] gh-90871: fix connection backlog offset in asyncio (gh-134392) (#142739)
gh-90871: fix connection backlog offset in asyncio (gh-134392)
(cherry picked from commit 109f7597d2)

Co-authored-by: Christian Harries <68507104+ChristianHrs@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-12-15 06:12:12 +00:00
Miss Islington (bot)
18bd88f899
[3.13] gh-127529: Correct asyncio's accept_connection behaviour for handling ConnectionAbortedError (GH-127532) (#142738)
gh-127529: Correct asyncio's `accept_connection` behaviour for handling `ConnectionAbortedError` (GH-127532)
(cherry picked from commit 830e10651b)

Co-authored-by: jb2170 <email@jb2170.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-12-15 05:44:52 +00:00
Serhiy Storchaka
cf4265345f
[3.13] gh-142461: Move misplaced NEWS entries to an appropriate section (GH-142464) (GH-142688) (#142702) 2025-12-14 12:55:15 +02:00
Bénédikt Tran
d209fd911e
[3.13] gh-142451: correctly copy HMAC attributes in HMAC.copy() (GH-142510) (#142701)
Partially cherry-picked from d3ef5ba34d
which ensures that the `block_size` attribute exists on the copy.
2025-12-14 09:36:26 +00:00
Bénédikt Tran
2249043874
[3.13] gh-142554: avoid divmod crashes due to bad _pylong.int_divmod (GH-142673) (#142697)
gh-142554: avoid `divmod` crashes due to bad `_pylong.int_divmod` (#142673)

(cherry picked from commit 4e4163676a)
2025-12-14 09:03:14 +00:00
Stan Ulbrych
9b24418867
[3.13] gh-142571: Check for errors before calling each syscall in PyUnstable_CopyPerfMapFile() (GH-142460) (#142602)
Co-authored-by: AZero13 <gfunni234@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2025-12-11 22:08:08 +00:00
Miss Islington (bot)
e96367da1f
[3.13] gh-142454: Make the JIT digest more deterministic by sorting the files in Tools/jit (GH-142455) (#142484)
gh-142454: Make the JIT digest more deterministic by sorting the files in Tools/jit (GH-142455)
(cherry picked from commit bcf90de8ba)

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
Co-authored-by: Ken Jin <kenjin4096@gmail.com>
2025-12-09 18:50:32 +00:00
Miss Islington (bot)
ab8ac4b760
[3.13] gh-138061: Exclude __pycache__ directory from the computed digest in the JIT stencils (GH-138131) (#142481)
Co-authored-by: alm <alonme@users.noreply.github.com>
2025-12-09 18:16:19 +00:00
Serhiy Storchaka
24036f55e4
[3.13] gh-112527: Fix help text for required options in argparse (GH-112528) (GH-142477)
For optional arguments with required=True, the ArgumentDefaultsHelpFormatter
would always add a " (default: None)" to the end of the help text.
Since that's a bit misleading, it is removed with this commit.
(cherry picked from commit 1adb17b1a2)

Co-authored-by: Fabian Henze <32638720+henzef@users.noreply.github.com>
2025-12-09 17:36:24 +00:00
Serhiy Storchaka
55e16b74fd
[3.13] gh-142282 Fix winreg.QueryValueEx() under race condition (GH-142283) (GH-142456)
(cherry picked from commit 3ec941b364)

Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com>
2025-12-09 16:46:24 +02:00
Miss Islington (bot)
b2fff0ea85
[3.13] gh-105836: Fix asyncio.run_coroutine_threadsafe leaving underlying cancelled asyncio task running (GH-141696) (#142359)
gh-105836: Fix `asyncio.run_coroutine_threadsafe` leaving underlying cancelled asyncio task running (GH-141696)
(cherry picked from commit 14715e3a64)

Co-authored-by: Kaisheng Xu <iaalmsimon@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-12-09 20:15:50 +05:30
Sam Gross
85f48038aa
[3.13] gh-142342: Fix m68k assembler operand constraints for %fpcr access (gh-142343) (#142459)
On m68k, an fmove instruction accessing %fpcr may only move from
or to a data register or a memory operand. The constraint "g" also
permits the use of address registers, which is invalid. The correct
constraint is "dm". Beginning with GCC 15, the register allocator
picks an address register in the code which causes SIGILL during
runtime.
(cherry picked from commit 02c085d48b)

Co-authored-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Co-authored-by: Michael Karcher <github@mkarcher.dialup.fu-berlin.de>
2025-12-09 14:13:35 +00:00
Miss Islington (bot)
b57d69588c
[3.13] gh-68552: fix defects policy (GH-138579) (#142367)
Co-authored-by: Ivo Bellin Salarin <nilleb@users.noreply.github.com>
Co-authored-by: Martin Panter <vadmium@users.noreply.github.com>
Co-authored-by: Ivo Bellin Salarin <ivo@nilleb.com>
2025-12-09 07:39:03 +00:00
dr-carlos
d768900ca4
[3.13] gh-141732: Fix ExceptionGroup repr changing when original exception sequence is mutated (GH-141736) (#142391)
* [3.13] gh-141732: Fix `ExceptionGroup` repr changing when original exception sequence is mutated (GH-141736)
(cherry picked from commit ff2577f56e)

Co-authored-by: dr-carlos <77367421+dr-carlos@users.noreply.github.com>
2025-12-08 18:46:55 +00:00
Miss Islington (bot)
90ca216cdc
[3.13] gh-142006: Fix HeaderWriteError in email.policy.default caused by extra newline (GH-142008) (#142362)
gh-142006: Fix HeaderWriteError in email.policy.default caused by extra newline (GH-142008)

RDM: This fixes a subtle folding error that showed up when a token exactly filled a line and was followed by whitespace and a token with no folding whitespace that was longer than a line.  In this particular circumstance the whitespace after the first token got pushed on to the next line, and then stolen to go in front of the next unfoldable token...leaving a completely empty line in the line buffer.  That line got turned in to a newline, which is RFC illegal, and the newish security check caught it.  The fix is to just delete that empty line from the buffer.
(cherry picked from commit 07eff899d8)

Co-authored-by: Paresh Joshi <rahulj9223@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2025-12-06 16:40:07 -05:00
Miss Islington (bot)
f28409cb8c
[3.13] GH-75949: Fix argparse dropping '|' in mutually exclusive groups on line wrap (GH-142312) (#142348) 2025-12-06 15:35:01 +00:00