Commit graph

32952 commits

Author SHA1 Message Date
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 fa44efa0ef)

Co-authored-by: AZero13 <gfunni234@gmail.com>
2026-01-22 15:52:49 +00:00
Miss Islington (bot)
ac9715bf13
[3.13] gh-77188: Add pickle tests for objects with slots (GH-144116) (GH-144120)
(cherry picked from commit cf71e34940)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-01-22 11:26:48 +00:00
Miss Islington (bot)
015b90dc02
[3.13] gh-143959: Make _datetime optional for test_sys (GH-144003) (#144144)
gh-143959: Make _datetime optional for test_sys (GH-144003)
(cherry picked from commit c447d1bc14)

Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com>
2026-01-22 11:15:00 +00:00
Yongtao Huang
a6acb1628f
[3.13] gh-144085: Add {gi,cr}_suspended to inspect comments and generator/coroutine tests (GH-144086) (#144134)
(cherry picked from commit 4ef30a5871)
2026-01-22 12:20:32 +03:00
Bera
740db907a8
[3.13] gh-143866: Verify return value of pathlib.write_{bytes,text} methods in tests (GH-143870) (#144078)
(cherry picked from commit cb6a662bb0)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-01-20 21:34:43 +03: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 fe629262c0)

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 76b484b9d1)

Co-authored-by: Yongtao Huang <yongtaoh2022@gmail.com>
2026-01-20 12:59:24 +02: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 f7fceed79c)

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 8054184f9f)

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 21ed1e2a94)

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


(cherry picked from commit 1241432150)

Co-authored-by: zhong <60600792+superboy-zjc@users.noreply.github.com>
2026-01-16 14:23:03 +01:00
Miss Islington (bot)
d7f11ea054
[3.13] gh-143672: Add more tests for struct.pack_into() (GH-143901) (GH-143903)
Add tests for negative offset, out of bound offset, invalid type of offset,
non-writeable buffer, non-continuous buffer, invalid type of buffer.

Repeat all tests for struct.Struct.pack_into().
(cherry picked from commit 66680f1230)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-01-16 11:49:30 +00:00
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
eb6dbd7fec
[3.13] Add regression test for add() after remove() with hash collision in set (GH-143781) (GH-143859)
(cherry picked from commit 565685f6e8)
2026-01-15 10:04:34 +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
Stan Ulbrych
8a09b511a0
[3.13] gh-141536: Fix a crash when running test_capi *after* test_code in the same process (GH-141537) (GH-143625)
(cherry picked from commit b2827de18f)

Co-authored-by: T. Wouters <thomas@python.org>
2026-01-12 20:07:34 +02: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
Miss Islington (bot)
ea1ecf6504
[3.13] gh-127750: Fix annotations in singledispatchmethod signature tests (GH-143571) (GH-143708)
These tests relied on a bug -- gh-84644, which is that singledispatch
doesn't verify the annotation is on the "first" parameter.
(cherry picked from commit 620a5b9269)

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
2026-01-11 19:47:05 +00: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
Miss Islington (bot)
7c99a42d10
[3.13] gh-143641: Make ready_to_import always remove tempdir from sys.path (GH-143642) (#143648)
gh-143641: Make `ready_to_import` always remove tempdir from `sys.path` (GH-143642)

Make ready_to_import always remove tempdir from sys.path
(cherry picked from commit e7f5ffa0de)

Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com>
2026-01-10 10:14:46 +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
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
Miss Islington (bot)
cf0f4e6ebc
[3.13] gh-143528: Fix test_time.test_thread_time() (GH-143558) (#143560)
gh-143528: Fix test_time.test_thread_time() (GH-143558)

Tolerate 100 ms instead of 20 ms to support slow CIs.
(cherry picked from commit efaa56f73c)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-01-08 13:29:41 +00: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)
2cd3b0ec91
[3.13] gh-143394: On macOS, run main PyREPL tests as "Apple Terminal" as well (GH-143461) (GH-143467)
(cherry picked from commit 7dae1077cd)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2026-01-06 19:11:48 +01:00
Miss Islington (bot)
4d8abae57d
[3.13] gh-143394: filter for turning off automatic margins in test_no_newline (GH-143433) (GH-143478)
Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2026-01-06 17:38:38 +01: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)
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
Jakub Kulík
515d449e26
[3.13] gh-91214: Skip tests failing on Solaris (GH-31978) (GH-138462)
(cherry picked from commit 34ed03875a)
2025-12-31 13:09:10 +02: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)
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
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