Commit graph

30401 commits

Author SHA1 Message Date
sobolevn
aa5ad50597
[3.13] gh-143635: Fix crash in ga_repr_items_list (GH-143670) (#143852)
(cherry picked from commit bdba5f0db2)
2026-01-15 15:27:31 +00:00
Serhiy Storchaka
149ecbb9a9
[3.13] gh-142829: Fix use-after-free in Context.__eq__ via re-entrant ContextVar.set (GH-142905) (GH-143871)
(cherry picked from commit a4086d7f89)

Co-authored-by: A.Ibrahim <abdulrasheedibrahim47@gmail.com>
2026-01-15 15:00:44 +00:00
Serhiy Storchaka
5c028df404
[3.13] gh-141805: Fix crash after concurrent addition objects with the same hash to set (GH-143815) (GH-143853)
This happens when the set contained several elements with the same hash,
and then some of them were removed.
(cherry picked from commit b8e925b4f8)
2026-01-15 07:59:15 +00:00
Miss Islington (bot)
8c6d87693b
[3.13] gh-106287: Do not write objects after an unmarshalling error (GH-132715) (GH-143833)
Writing out an object may involve a slot lookup, which is not safe to do with
an exception raised. In debug mode an assertion failure will occur if this
happens.
(cherry picked from commit ce8f5f98c6)

Co-authored-by: Duane Griffin <duaneg@dghda.com>
2026-01-14 11:48:52 +00:00
Gregory P. Smith
480f48035b
[3.13] gh-143706: Fix sys.argv not set during multiprocessing forkserver __main__ preload (GH-143717) (#143821)
The forkserver was not passing sys.argv to its main() function, causing
sys.argv to be empty during `__main__` module import in child processes. This
fixes a non-obvious regression inadvertently introduced by the gh-126631 main
preloading fix.

(cherry picked from commit 298d5440eb)
2026-01-13 18:09:05 -08:00
Miss Islington (bot)
be602fcde6
[3.13] gh-143249: Fix buffer leak when overlapped operation fails to start on windows (GH-143250) (#143796)
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:53:41 +00:00
Inada Naoki
b739bd1d42
[3.13] gh-143189: fix insertdict() for non-Unicode key (GH-143285) (#143772) 2026-01-13 10:12:38 +00:00
Miss Islington (bot)
0612f5b882
[3.13] gh-142461: Move misplaced NEWS entries to an appropriate section (GH-143411) (GH-143745)
(cherry picked from commit 3d44f0ab65)

Co-authored-by: Aniket <148300120+Aniketsy@users.noreply.github.com>
2026-01-12 18:20:22 +00:00
Sergey B Kirpichev
8fd4435cd9
[3.13] gh-78724: Raise RuntimeError's when calling methods on non-ready Struct()'s (GH-143643) (GH-143714)
(cherry picked from commit 515ae4078d)
2026-01-12 14:45:52 +02:00
Serhiy Storchaka
1822f59dc7
[3.13] gh-142881: Fix concurrent and reentrant call of atexit.unregister() (GH-142901) (GH-143722)
(cherry picked from commit dbd10a6c29)
2026-01-12 10:05:09 +00:00
Miss Islington (bot)
8ec108378c
[3.13] gh-143346: Fix calculation of the line width for wrapped Base64 in plistlib (GH-143347) (GH-143720)
It was incorrect in case of mixed tabs and spaces in indentation.
(cherry picked from commit 5f28aa2f37)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-01-12 09:04:00 +00:00
Serhiy Storchaka
dcc6117628
[3.13] gh-143378: Fix use-after-free when BytesIO is concurrently mutated during write operations (GH-143408) (GH-143600)
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-12 10:37:28 +02:00
Serhiy Storchaka
e319262c4e
[3.13] gh-143638: Forbid cuncurrent use of the Pickler and Unpickler objects in C implementation (GH-143664) (GH-143687)
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:34:36 +00:00
Bénédikt Tran
733a5cf51c
[3.13] gh-143377: fix crashes in _interpreters.capture_exception (GH-143418) (#143653)
(cherry picked from commit ce6bae92da)
2026-01-10 13:59:14 +00:00
Serhiy Storchaka
618a42410f
[3.13] gh-143006: Fix and optimize mixed comparison of float and int (GH-143084) (GH-143624)
When comparing negative non-integer float and int with the same number
of bits in the integer part, __neg__() in the int subclass returning
not an int caused an assertion error.

Now the integer is no longer negated. Also, reduced the number of
temporary created Python objects.
(cherry picked from commit 66bca383bd)
2026-01-09 17:43:35 +00:00
Miss Islington (bot)
57c56b0fb1
[3.13] gh-143547: Fix PyErr_FormatUnraisable() fallback (GH-143557) (GH-143603) (#143612)
[3.14] gh-143547: Fix PyErr_FormatUnraisable() fallback (GH-143557) (GH-143603)

gh-143547: Fix PyErr_FormatUnraisable() fallback (GH-143557)

Hold a strong reference to 'hook' while calling the default
unraisable took to log hook failure.
(cherry picked from commit 1d0baf1ae4)


(cherry picked from commit 39a2bcf949)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-01-09 15:33:25 +00:00
Sam Gross
a4a33ff71d
[3.13] gh-142095: Use thread local frame info in py-bt and py-bt-full when available (gh-143371) (#143567)
In optimized and `-Og` builds, arguments and local variables are frequently
unavailable in gdb. This makes `py-bt` fail to print anything useful. Use the
`PyThreadState*` pointers `_Py_tss_gilstate` and `Py_tss_tstate` to find the
interpreter frame if we can't get the frame from the
`_PyEval_EvalFrameDefault` call.
(cherry picked from commit 49c3b0a67a)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-01-08 12:35:56 -05:00
Miss Islington (bot)
cb42565839
[3.13] gh-143553: Add support for parametrized resources in regrtests (GH-143554) (GH-143556)
For example, "-u xpickle=2.7" will run test_xpickle only against Python 2.7.
(cherry picked from commit c07e5ec0a9)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-01-08 18:12:51 +02:00
Łukasz Langa
ad99027e5c
[3.13] gh-138568: Make help mode in PyREPL not exit on empty line input (GH-143512) (GH-143520)
(cherry picked from commit b3e4a3462f)

Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Co-authored-by: yihong0618 <zouzou0208@gmail.com>
2026-01-07 18:44:39 +01:00
Serhiy Storchaka
d030847a23
[3.13] gh-75572: Forward-port test_xpickle from Python 2 to 3 (GH-22452) (GH-143509)
Move data classes used in tests to separate file test_picklecommon.py,
so it can be imported in old Python versions.
(cherry picked from commit 8735daf3e8)
(cherry picked from commit ff0a8b7289)

Co-authored-by: Ken Jin <kenjin@python.org>
2026-01-07 07:57:39 +00:00
Miss Islington (bot)
7f936694db
[3.13] gh-142991: socketmodule: fixed getsockaddrlen() for PF_DIVERT socket (GH-142993) (#143482)
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-06 16:48:03 +00:00
Stan Ulbrych
e0e255e244
[3.13] gh-143003: Fix possible shared buffer overflow in bytearray.extend() (GH-143086) (GH-143448)
When __length_hint__() returns 0 for non-empty iterator, the data can be
written past the shared 0-terminated buffer, corrupting it.
(cherry picked from commit 522563549a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-01-06 13:49:31 +02:00
Bénédikt Tran
44bdb833d1
[3.13] gh-143309: fix UAF in os.execve when the environment is concurrently mutated (GH-143314) (#143431)
[3.13] gh-143309: fix UAF in `os.execve` when the environment is concurrently mutated (GH-143314) (#143431)

(cherry picked from commit 9609574e7f)
(cherry picked from commit c99f766743)
2026-01-05 19:56:02 +01:00
Miss Islington (bot)
2b8ac2c3da
[3.13] gh-143308: fix UAF when PickleBuffer is concurrently mutated in a callback (GH-143312) (#143397)
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 23:53:59 +00:00
Miss Islington (bot)
dced1a788a
[3.13] gh-140648: Make asyncio REPL respect the -I flag (isolated mode) (GH-143045) (#143384)
gh-140648: Make asyncio REPL respect the `-I` flag (isolated mode) (GH-143045)
(cherry picked from commit e7c542de5f)

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
2026-01-03 08:25:52 +00:00
Miss Islington (bot)
c7f1e18420
[3.13] gh-138897: Use _pyrepl.pager for _sitebuiltins._Printer (GH-138898) (GH-143365)
(cherry picked from commit 0417dabe3f)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2026-01-02 17:28:04 +01:00
Miss Islington (bot)
5ad91cd654
[3.13] gh-139262: Prevent swallowing REPL input on Windows (GH-139263) (GH-143363)
(cherry picked from commit ef6f92a2a6)

Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2026-01-02 16:44:01 +01:00
Miss Islington (bot)
c09d6a437b
[3.13] gh-128067: Fix pyrepl overriding printed output without newlines (GH-138732) (GH-143351)
(cherry picked from commit 8a2deea1fc)

Co-authored-by: Jan-Eric Nitschke <47750513+JanEricNitschke@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2026-01-02 16:33:49 +01:00
Miss Islington (bot)
b40bf5ffc8
[3.13] gh-143310: fix crash in Tcl object conversion with concurrent mutations (GH-143321) (#143344)
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:12:57 +00:00
Bénédikt Tran
afa24d8324
[3.13] gh-142830: prevent some crashes when mutating sqlite3 callbacks (GH-143245) (#143323)
(cherry picked from commit 7f6c16a956)
2026-01-01 11:22:50 +00:00
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