Commit graph

125359 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
Miss Islington (bot)
b3a0d15e3b
[3.13] gh-142664: fix PyObject_Hash invokation post GH-143217 (GH-143223) (#143225)
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:53:13 +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)
833fbe9ea0
[3.13] no-issue: Fix override value in os.rst (gh-123522) (gh-143212) 2025-12-27 10:55:15 +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)
80f7d493bf
[3.13] gh-140717: Add exc_text to LogRecord attributes table (GH-140718) (GH-143151)
Co-authored-by: Tom Kuson <mail@tjkuson.me>
2025-12-25 12:41:24 +00: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
Sam Gross
86504f26bd
[3.13] gh-143121: Skip test that leak threads under TSan (gh-143125) (#143142)
(cherry picked from commit 4ee6929d60)
2025-12-24 13:29:13 +00:00
Miss Islington (bot)
e91c11449c
[3.13] gh-142145: Avoid timing measurements in quadratic behavior test (gh-143105) (#143140)
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:26:07 +00: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
c5852c27c1
[3.13] Update pre-commit with zizmor and Ruff fixes (GH-143095) (GH-143102) (#143113) 2025-12-23 21:28:00 +02: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)
931c4d6258
[3.13] gh-139743: Avoid print twice verbose version for sqlite tests (GH-142850) (GH-142866)
(cherry picked from commit 454485e564)

Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Co-authored-by: yihong <zouzou0208@gmail.com>
2025-12-22 11:12:34 +00: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
Gregory P. Smith
9b7a628632
[3.13] gh-70647: Better promote how to safely parse yearless dates in datetime. (GH-116179) (#143038)
* 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

* remove date.strptime mentions from 3.14
2025-12-21 07:03:24 +00:00
Gregory P. Smith
a696ba8b4d
[3.13] gh-142145: relax the no-longer-quadratic test timing (GH-143030) (#143032)
gh-142145: relax the no-longer-quadratic test timing (#143030)

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

* require cpu resource

(cherry picked from commit 8d2d7bb)
2025-12-21 00:22:07 +00: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
Miss Islington (bot)
98d97d76a8
[3.13] gh-143012: use Py_ssize_t cast for PyBytes_FromStringAndSize (GH-143013) (#143015)
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 07:59:55 +00: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)
ae3834c97e
[3.13] gh-142681: Move NormalizationTest-3.2.0.txt to more safe place. (GH-142935) (GH-142945)
(cherry picked from commit 4a8ecbad80)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-12-19 13:34:18 +01:00
Miss Islington (bot)
20c3015e85
[3.13] gh-142527: Docs: Clarify that random.seed() discards the sign of an integer input (GH-142483) (#142971)
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:35:34 +00:00
Miss Islington (bot)
b5a29553d9
[3.13] gh-118342: [Enum] update docs (GH-137290) (GH-142954)
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:19:00 -08:00
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)
5e1a9c8392
[3.13] gh-142873: Do not check for PyContextVar_CheckExact twice in PyContextVar_Set (GH-142874) (#142894)
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 17:04:39 +00:00
Miss Islington (bot)
42513a237f
[3.13] gh-142876: remove reference to thread in documentation of asyncio.Queue.shutdown (GH-142888) (#142892)
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 16:53:14 +00:00
Miss Islington (bot)
e5fd7373b8
[3.13] decimal docs: specification link and examples (GH-128698) (#142805)
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:35 +05:30
Miss Islington (bot)
53ca3b7b5c
[3.13] Fix os.posix_spawn() error handling (GH-142532) (#142581)
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-17 15:43:51 +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)
6990fbb289
[3.13] gh-142859: Add Tools/check-c-api-docs to mypy check (GH-142860) (#142870)
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:47:36 +00:00
Lysandros Nikolaou
90285941d8
[3.13] gh-140374: Add glossary entries related to multithreading (GH-140375) (#142869)
---------
(cherry picked from commit 1e9a0ee682)

Co-authored-by: Daniele Parmeggiani <8658291+dpdani@users.noreply.github.com>
2025-12-17 12:22:33 +01:00
Miss Islington (bot)
e4ca817155
[3.13] gh-139320: Cover exception chaining in the docs of contextmanager.__exit__ (GH-140169) (GH-142793)
(cherry picked from commit a44509ea87)

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
2025-12-17 11:28:37 +01: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)
e07cda302e
[3.13] gh-142752: add more thread safety tests for mock (GH-142791) (#142857)
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:09:59 +00:00