30418 Commits

Author SHA1 Message Date
Jelle Zijlstra
bc92e7878f
[3.13] gh-144169: Fix three crashes in AST objects with non-str kwargs (GH-144178) (#144260)
(cherry picked from commit 639c1ad4f1ef5c2409a62fa8ed16e6aa3a6f9ab8)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-01-27 20:37:35 -08:00
Victor Stinner
3df9e31142
[3.13] gh-144100: Fix crash for POINTER(str) used in ctypes argtypes (#144108) (#144245)
gh-144100: Fix crash for POINTER(str) used in ctypes argtypes (#144108)


(cherry picked from commit 8f459255eba2b6639f1912e5c5e318a7cdafada1)

Co-authored-by: VanshAgarwal24036 <148854295+VanshAgarwal24036@users.noreply.github.com>
2026-01-27 12:59:55 +01:00
Petr Viktorin
fdac87ae39
[3.13] gh-127773: Disable attribute cache on incompatible MRO entries (GH-127924) (GH-143729) 2026-01-26 16:31:52 +01:00
Miss Islington (bot)
f738386838
[3.13] gh-143935: Email preserve parens when folding comments (GH-143936) (#144035)
gh-143935: Email preserve parens when folding comments (GH-143936)

Fix a bug in the folding of comments when flattening an email message
using a modern email policy. Comments consisting of a very long sequence of
non-foldable characters could trigger a forced line wrap that omitted the
required leading space on the continuation line, causing the remainder of
the comment to be interpreted as a new header field. This enabled header
injection with carefully crafted inputs.
(cherry picked from commit 17d1490aa97bd6b98a42b1a9b324ead84e7fd8a2)

Co-authored-by: Seth Michael Larson <seth@python.org>
Co-authored-by: Denis Ledoux <dle@odoo.com>
2026-01-25 17:09:53 +00:00
Miss Islington (bot)
8ad828750f
[3.13] gh-143237: Fix support of named pipes in the rotating logging handlers (GH-143259) (#143298)
gh-143237: Fix support of named pipes in the rotating logging handlers (GH-143259)

This fixes regression introduced in GH-105887.
(cherry picked from commit aa8a43d179bad5cd9fbfce63b630e2ee0bd617e4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-01-25 17:09:40 +00:00
Miss Islington (bot)
0a925ab591
[3.13] gh-144125: email: verify headers are sound in BytesGenerator (#144181)
gh-144125: email: verify headers are sound in BytesGenerator
(cherry picked from commit 052e55e7d44718fe46cbba0ca995cb8fcc359413)

Co-authored-by: Seth Michael Larson <seth@python.org>
Co-authored-by: Denis Ledoux <dle@odoo.com>
Co-authored-by: Denis Ledoux <5822488+beledouxdenis@users.noreply.github.com>
Co-authored-by: Petr Viktorin <302922+encukou@users.noreply.github.com>
Co-authored-by: Bas Bloemsaat <1586868+basbloemsaat@users.noreply.github.com>
2026-01-25 17:09:26 +00:00
Miss Islington (bot)
918387e491
[3.13] gh-143919: Reject control characters in http cookies (#144090)
gh-143919: Reject control characters in http cookies
(cherry picked from commit 95746b3a13a985787ef53b977129041971ed7f70)

Co-authored-by: Seth Michael Larson <seth@python.org>
Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
2026-01-25 17:09:22 +00:00
Seth Michael Larson
a35ca3be58
[3.13] gh-143925: Reject control characters in data: URL mediatypes (#144111)
(cherry picked from commit f25509e78e8be6ea73c811ac2b8c928c28841b9f)
2026-01-25 17:06:01 +00:00
Stan Ulbrych
8072d67a7c
[3.13] gh-142461: Move misplaced NEWS entries to an appropriate section (GH-143392) (GH-144153)
(cherry picked from commit 72bacb0cd0882bce6bd7e9e2e4e9c112d70213e7)

Co-authored-by: Aniket <148300120+Aniketsy@users.noreply.github.com>
2026-01-24 17:13:13 +02:00
Stan Ulbrych
837b88fd9f
[3.13] gh-144023: Prevent follow_symlinks from being allowed with an fd of 0 (GH-144022) (#144152)
[3.13] 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 fa44efa0ef1972ac1e2f66996303154be11f605e)

Co-authored-by: AZero13 <gfunni234@gmail.com>
2026-01-22 15:52:49 +00:00
Miss Islington (bot)
77dddece52
[3.13] gh-144050: Fix stat.filemode pure Python file type detection (GH-144059) (GH-144074)
(cherry picked from commit fe629262c0db7aa18bad8bf3ac524acd8695739b)

Co-authored-by: VanshAgarwal24036 <148854295+VanshAgarwal24036@users.noreply.github.com>
2026-01-20 12:44:46 +00:00
Miss Islington (bot)
11bf6efcaf
[3.13] gh-143999: Fix: handle suspended state on types.coroutine wrappers (GH-144000) (GH-144065)
(cherry picked from commit 76b484b9d16d6a3b1749dc89d99773b5b4a5c4a5)

Co-authored-by: Yongtao Huang <yongtaoh2022@gmail.com>
2026-01-20 12:59:24 +02:00
Miss Islington (bot)
746d2f979b
[3.13] gh-143774 - Improve IDLE Format Paragraph doc (GH-143775) (#144063)
gh-143774 - Improve IDLE Format Paragraph doc (GH-143775)

Add a reminder to not rewrap code line to the Menu => Format => Reformat Paragraph entry.
In Editing and Nagivagion, add a new 'Format block' subsection that defines 'paragraph'
to better match what is dependably handled as more or less expected.
In particular, specify equal indents and that the resulting indent equals original indent.
Also mention that selections are expanded to complete lines and how to modify max length.

(Also fix a couple case errors in cross references.)
(cherry picked from commit fa3abf5a51d42b2d62e1bc89e9465b398a567e94)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2026-01-20 09:32:55 +00:00
Gregory P. Smith
22e4d55285
[3.13] gh-143916: Reject control characters in wsgiref.headers.Headers (GH-143917) (#143973)
gh-143916: Reject control characters in wsgiref.headers.Headers  (GH-143917)

* Add 'test.support' fixture for C0 control characters
* gh-143916: Reject control characters in wsgiref.headers.Headers

(cherry picked from commit f7fceed79ca1bceae8dbe5ba5bc8928564da7211)

Co-authored-by: Seth Michael Larson <seth@python.org>
2026-01-17 18:23:57 +00:00
Sam Gross
0f21962fb7
[3.13] gh-133253: making linecache thread-safe (GH-133305) (#143911)
(cherry picked from commit 8054184f9f32c7ba561e6e23b358074824e4928d)

Co-authored-by: vfdev <vfdev.5@gmail.com>
2026-01-16 13:34:53 -05:00
Miss Islington (bot)
6fdb9f1872
[3.13] gh-65784: Add support for parametrized resource wantobjects in regrtests (GH-143570) (GH-143914)
This allows to run Tkinter tests with the specified value of
tkinter.wantobjects, for example "-u wantobjects=0".
(cherry picked from commit 21ed1e2a9401a2e96ccc910fcb66f22afc96efbd)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-01-16 17:01:53 +00:00
Victor Stinner
201e819355
[3.13] gh-143602: Fix duplicate buffer exports in io.BytesIO.write (#143629) (#143872) (#143878)
[3.14] gh-143602: Fix duplicate buffer exports in io.BytesIO.write (#143629) (#143872)

gh-143602: Fix duplicate buffer exports in io.BytesIO.write (#143629)

Fix an inconsistency issue in io.BytesIO.write() where the buffer was exported
twice, which could lead to unexpected data overwrites and position drift when
the buffer changes between exports.

(cherry picked from commit c461aa99e2fabbaf5859c0a8a93e08306ee8115d)


(cherry picked from commit 1241432150f6342e3d38c5a80a19c8c157a4ebe8)

Co-authored-by: zhong <60600792+superboy-zjc@users.noreply.github.com>
2026-01-16 14:23:03 +01:00
sobolevn
aa5ad50597
[3.13] gh-143635: Fix crash in ga_repr_items_list (GH-143670) (#143852)
(cherry picked from commit bdba5f0db2ab29f3deedb9416f3c143d33e4ab66)
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 a4086d7f89e5d388e4ffcdb13e4fba0255234286)

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 b8e925b4f8f6c5e28fbebc4f3965bf77610698b3)
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 ce8f5f98c6fc95a1704360d986a4d0281eeada79)

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 298d5440eb83f2dfd5651bac86d1592ec358d54c)
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 103a384bfdeafc68ab39ea9bf8838a8b2eec83dd)

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 3d44f0ab65221d8704d9298712a5114cba3aeea9)

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 515ae4078dffa0b74e5e5431462c2f4fe4563ffa)
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 dbd10a6c29ba1cfc9348924a090b5dc514470002)
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 5f28aa2f372339ba0c70373b96d33ec4d2879e04)

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 6d54b6ac7d5744e1f59d784c8e020d632d2959a3)

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 d1282efb2b847bf9274d78c5f15ea00499b2c894)
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 ce6bae92da671e31013b00901591ce2b595b61ce)
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 66bca383bd3b12d21e879d991d77b37a4c638f88)
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 1d0baf1ae48f98b61cc869a82e1b7206298f653f)


(cherry picked from commit 39a2bcf949095bd603f7b73f15b5b478dbb49ba9)

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 49c3b0a67a77bb42e736cea7dcbc1aa8fa704074)

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 c07e5ec0a9e5843fc39dec6aa94172faf6354858)

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 b3e4a3462f6011cacdfc58c565c69e4d7de6b9cd)

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 8735daf3e82d50defd791e9be7b9ae6843bc4ed1)
(cherry picked from commit ff0a8b72892e94ef6616ed70241d23985f7a5ac4)

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 05406b221dc9d5946c60253392788d60f1f08c8b)

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 522563549a49d28e763635c58274a23a6055f041)

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 9609574e7fd36edfaa8b575558a82cc14e65bfbc)
(cherry picked from commit c99f7667436d8978b4077704333e2a351f2a026f)
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 6c53af18f61c074d514e677b469b6201573a59da)

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

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 e7c542de5f069a4b83e8eded3067613e4d59a529)

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 0417dabe3f560470eec63a2485b1741ba9c5e697)

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 ef6f92a2a63fd83d62d9a431b2c3133a9a069ea0)

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 8a2deea1fc725f8147254f87c6042fcf75a1d03b)

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 9712dc1d9eb03ffa96ed746d20bd43239d251ba7)

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 7f6c16a956d598663d8c67071c492f197045d967)
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 b6b0e14b3d4aa9e9b89bef9a516177238883e1a7)

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 fa9a4254e81c0abcc3345021c45aaf5f788f9ea9)

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 3ca1f2a370e44874d0dc8c82a01465e0171bec5c)

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