Commit graph

15907 commits

Author SHA1 Message Date
Pablo Galindo Salgado
65fbec64f6
[3.15] gh-151613: Fix remote debugging frame cache ABA (#152448)
gh-151613: Fix remote debugging frame cache ABA (#151614)

The remote debugging frame cache previously used only the last_profiled_frame address as its cache anchor. If a frame returned and a later frame reused the same _PyInterpreterFrame address, the profiler could accept a stale cache entry and splice parent frames from a different call chain into the current stack.

This adds a last_profiled_frame_seq counter next to last_profiled_frame, increments it when the anchor advances, stores it in frame cache entries, and validates cache hits against both the frame address and the sequence. Cache miss walks now copy stack chunks before storing new cache entries so stored continuations come from a stable snapshot. The new regression test exercises alternating call chains and checks that cached stacks never contain frames from both branches.

(cherry picked from commit 8cda6ae2f1)
2026-06-27 17:42:31 +00:00
Miss Islington (bot)
592575ca7a
[3.15] gh-151126: Sets missing exceptions in tkinter and socket modules initializations (GH-152418) (#152420)
gh-151126: Sets missing exceptions in `tkinter` and `socket` modules initializations (GH-152418)
(cherry picked from commit a9fa856014)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-06-27 15:28:27 +00:00
Miss Islington (bot)
2a3189ce67
[3.15] gh-80937: Fix memory leak in tkinter createcommand (GH-152294) (GH-152327)
A command created with createcommand() held a strong reference to the
interpreter, forming an uncollectable cycle (interpreter -> command ->
interpreter) that kept the interpreter and the callback alive until the
command was removed with deletecommand() or destroy().  The command now
borrows the reference; it cannot outlive the interpreter, which deletes its
commands when finalized.
(cherry picked from commit bbf7786a90)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-26 19:22:21 +00:00
Miss Islington (bot)
52bdfcc141
[3.15] gh-139145: Fix tkinter event loop in interactive mode (GH-152257) (GH-152291)
When a Tcl command running its own event loop (such as vwait or
wait_variable) was active and the user typed input on stdin, the event
loop kept spinning at 100% CPU.  The stdin file handler is now removed as
soon as input becomes available.

Also fix gh-139816: an exception raised in a callback no longer stops the
event loop to wait for Enter on a Python built without readline; pending
callbacks keep running until input is actually available on stdin.
(cherry picked from commit 3ffda34f5c)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: mdehoon <mjldehoon@yahoo.com>
Co-authored-by: Christopher Chavez <chrischavez@gmx.us>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-26 18:00:56 +03:00
Miss Islington (bot)
f3e6bdafd2
[3.15] gh-152052: Fix misleading json error for \uXXXX escape at the end of input (GH-152053) (#152283)
(cherry picked from commit 588be7af08)

Co-authored-by: tonghuaroot (童话) <tonghuaroot@gmail.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-26 14:15:21 +00:00
Miss Islington (bot)
62842c9ff5
[3.15] gh-152156: Fix a crash in interpeters.create under limited memory conditions (GH-152163) (#152269)
gh-152156: Fix a crash in `interpeters.create` under limited memory conditions (GH-152163)
(cherry picked from commit 3ad66bf10d)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-06-26 12:11:14 +00:00
Miss Islington (bot)
1926cf3dc9
[3.15] gh-151929: Get uptime on BSD/macOS in pythoninfo (GH-152189) (#152196)
gh-151929: Get uptime on BSD/macOS in pythoninfo (GH-152189)

* Check sysctlbyname() function and sys/sysctl.h header in
  configure.
* Add _testcapi.uptime_bsd() function.
(cherry picked from commit b6d89edc4a)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-06-25 13:41:18 +00:00
Victor Stinner
ae4c2c126b
[3.15] gh-151929: Get machine ID and uptime on Windows in pythoninfo (#152146) (#152187)
gh-151929: Get machine ID and uptime on Windows in pythoninfo (#152146)

* Replace "linux." prefix with "system." in pythoninfo.
* Add _winapi.GetTickCount64() function.

(cherry picked from commit f9910519af)
2026-06-25 12:34:16 +00:00
Miss Islington (bot)
d6fd5378e3
[3.15] gh-151126: Add missing PyErr_NoMemory in _winapi.c (GH-151588) (#152182)
gh-151126: Add missing `PyErr_NoMemory` in `_winapi.c` (GH-151588)
(cherry picked from commit a580029f11)

Co-authored-by: Ivy Xu <fakeshadow1337@gmail.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
2026-06-25 11:15:27 +00:00
Miss Islington (bot)
06506197c9
[3.15] gh-151126: Fix missing memory errors in _interpretersmodule.c (GH-151624) (#152169)
gh-151126: Fix missing memory errors in `_interpretersmodule.c` (GH-151624)
(cherry picked from commit 05225aa06a)

Co-authored-by: stevens <lipengyu@kylinos.cn>
2026-06-25 10:35:45 +00:00
Miss Islington (bot)
93ff7c31af
[3.15] gh-151126: Fix missing PyErr_NoMemory in testinternalcapi.c (GH-152177) (#152179)
gh-151126: Fix missing `PyErr_NoMemory` in `testinternalcapi.c` (GH-152177)
(cherry picked from commit a0093282ea)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-06-25 13:19:48 +03:00
Miss Islington (bot)
cf8051b2e7
[3.15] gh-152079: Fix _datetime.fromisoformat() mishandling a sub-second tz offset (GH-152087) (#152174)
(cherry picked from commit 6f9c76d8d8)

Co-authored-by: tonghuaroot (童话) <tonghuaroot@gmail.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-25 09:41:48 +00:00
Miss Islington (bot)
703c9bf976
[3.15] gh-151763: Fix crash in _interpqueues.create on MemoryError (GH-152131) (#152158)
gh-151763: Fix crash in `_interpqueues.create` on `MemoryError` (GH-152131)
(cherry picked from commit a6c2d4ae3b)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-06-25 07:32:24 +00:00
Miss Islington (bot)
4e7843ea3e
[3.15] gh-151763: Fix NULL dereference in os._path_normpath() under OOM (GH-151779) (#152096)
(cherry picked from commit ce8b81fff4)

Co-authored-by: Zain Nadeem <zainnadeemzainnadeem80@gmail.com>
2026-06-24 16:25:28 +00:00
Miss Islington (bot)
d4836f4d99
[3.15] gh-90949: Fix copy-paste typo in pyexpat capsule API initialization (GH-151147) (#152088)
(cherry picked from commit 15696a69d6)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-24 14:40:44 +00:00
Miss Islington (bot)
c3129e692f
[3.15] gh-152020: Fix asyncio.all_tasks() loosing eager tasks on FT-build (GH-152022) (#152076)
gh-152020: Fix `asyncio.all_tasks()` loosing eager tasks on FT-build (GH-152022)
(cherry picked from commit ad2cabfccb)

Co-authored-by: Timofei <128279579+deadlovelll@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-06-24 12:47:07 +00:00
Miss Islington (bot)
6bad84d64c
[3.15] gh-151814: Fix unbounded memory growth from repeated empty writes to io.TextIOWrapper (GH-151817)
(cherry picked from commit c61307222e)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-24 12:14:01 +00:00
Miss Islington (bot)
f84299087f
[3.15] gh-87904: Document curses classes (GH-151643) (GH-152048)
Add docstrings for the curses.window, curses.error, curses.panel.panel
and curses.panel.error classes.  Document the panel class and its error
exception in curses.panel.rst, using the real lowercase panel name.
(cherry picked from commit 560ff8e202)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24 10:19:09 +03:00
Miss Islington (bot)
dbc9b686e0
[3.15] gh-126219: Fix crash in tkinter.Tk with non-BMP className on Tcl/Tk 8.x (GH-151980) (GH-152045)
Tcl 8.x crashes when title-casing a non-BMP character during Tk
initialization, so such a className is now rejected with a ValueError.
(cherry picked from commit 124c7cd91b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 06:32:05 +00:00
Miss Islington (bot)
415e218ed5
[3.15] gh-151842: Fix crash upon OOM in _interpreters.capture_exception (GH-151843) (GH-152031)
(cherry picked from commit 5e0747db2f)

Co-authored-by: Amrutha <amruthamodela06@gmail.com>
2026-06-23 20:58:10 +00:00
Miss Islington (bot)
45a0043971
[3.15] gh-151770: Fix datetime.fromisoformat() on an out-of-range month w/ a 24:00 time (GH-151771) (#151809)
(cherry picked from commit 1fb874cc07)

Co-authored-by: tonghuaroot (童话) <tonghuaroot@gmail.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-20 17:01:40 +00:00
Miss Islington (bot)
b83a217558
[3.15] gh-150836: Mount embedded Tk ZIP in _tkinter on Windows (GH-151735)
Tcl/Tk 9 may embed the Tk script library in the Tk DLL on Windows. This embedded library is not found by Tcl by default.

Mount the loaded Tk DLL as a zipfs archive before calling Tk_Init(), so Tk can find its embedded tk_library using its existing library discovery logic.

Preserve Tk_Init()'s normal path if the library is not embedded.
(cherry picked from commit c4eb3adbb4)

Co-authored-by: Jonathan J. Helmus <jjhelmus@gmail.com>
2026-06-19 18:31:12 -05:00
Miss Islington (bot)
022a018b5b
[3.15] gh-151695: Fix use-after-free of the curses screen encoding (GH-151696) (GH-151703)
The module-global curses_screen_encoding stored a borrowed pointer to the
encoding owned by the window returned by the first initscr() call.  That
window can be deallocated while unctrl() and ungetch(), which have no window
of their own, still use the pointer to encode non-ASCII characters.

Keep a private copy of the encoding instead.
(cherry picked from commit 551f8e16f8)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 09:07:51 +00:00
Miss Islington (bot)
3135ab811d
[3.15] gh-151436: Fix missing tstate->last_profiled_frame updates (GH-151437) (#151612)
gh-151436: Fix missing `tstate->last_profiled_frame` updates (GH-151437)
(cherry picked from commit a8d74c062f)

Co-authored-by: Maurycy Pawłowski-Wieroński <maurycy@maurycy.com>
2026-06-19 10:24:53 +02:00
Miss Islington (bot)
c0582dbe7f
[3.15] gh-151229: Finalize JIT tracer in test eval-frame stub (gh-151609) (gh-151648)
gh-151229: Finalize JIT tracer in test eval-frame stub (gh-151609)
(cherry picked from commit 3fa92e7c55)

Co-authored-by: Donghee Na <donghee.na@python.org>
2026-06-18 12:45:25 +00:00
Miss Islington (bot)
d9a1bff40b
[3.15] gh-151623: Add missing curses docstrings and document intrflush() (GH-151632) (GH-151641)
(cherry picked from commit 12add3822f)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-06-18 14:23:06 +03:00
Miss Islington (bot)
7aa41c406b
[3.15] gh-151623: Improve curses documentation and docstrings (GH-151625) (GH-151628)
Fix errors and clarify the curses, curses.panel and curses.ascii docs
against X/Open Curses and ncurses, and sync the affected docstrings.
(cherry picked from commit 65afcdd8df)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-06-18 08:48:56 +00:00
Miss Islington (bot)
e9c7cc1f0b
[3.15] gh-149044: Improve Py_tp_base[s] docs & error message for non-type bases (GH-151252) (GH-151606)
gh-149044: Improve Py_tp_base[s] docs & error message for non-type bases (GH-151252)

The initial implementation of PEP 820 worsened the error message
when non-types are given as base types in Py_tp_bases & Py_tp_base.
Bring back the 'bases must be types' wording and add a 'got' note for
easier debugging.

Improve slot ID documentation, and soft-deprecate Py_tp_base
(as per the PEP).
(cherry picked from commit 16185e9fe2)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2026-06-18 10:17:15 +02:00
Miss Islington (bot)
8fe5897853
[3.15] gh-151510: Fix __lazy_import__ without frame (GH-151511) (#151610)
gh-151510: Fix __lazy_import__ without frame (GH-151511)
(cherry picked from commit eff805b7a7)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2026-06-17 18:40:33 +00:00
Miss Islington (bot)
a86de0bc23
[3.15] gh-151544: Fixes CVE-2026-12003 by removing the fallback to %VPATH%/Modules/Setup.local for discovering sources in getpath.py (GH-151545)
(cherry picked from commit 9e863fab28)

Co-authored-by: Steve Dower <steve.dower@python.org>
2026-06-17 16:42:35 +01:00
Miss Islington (bot)
821e5d79fa
[3.15] gh-151584: Remove PyUnstable_Module_SetGIL call in _remote_debugging (GH-151585) (#151603)
gh-151584: Remove `PyUnstable_Module_SetGIL` call in `_remote_debugging` (GH-151585)
(cherry picked from commit a173a6d65b)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-06-17 14:10:31 +00:00
Miss Islington (bot)
255b3fff97
[3.15] gh-151223: fix tsan data races in load global specializations (GH-151393) (#151513)
gh-151223: fix tsan data races in load global specializations (GH-151393)
(cherry picked from commit e9d5280f6c)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-06-15 22:52:52 +05:30
Miss Islington (bot)
75289a92df
[3.15] gh-151424: Fix impossible stack traces in RemoteUnwinder(..., cache_frames=True) by copying chunks on cache miss (GH-151426) (#151459)
gh-151424: Fix impossible stack traces in `RemoteUnwinder(..., cache_frames=True)` by copying chunks on cache miss (GH-151426)
(cherry picked from commit 6ce088e20a)

Co-authored-by: Maurycy Pawłowski-Wieroński <maurycy@maurycy.com>
2026-06-13 23:40:19 +00:00
Miss Islington (bot)
5dd32176a1
[3.15] gh-151403: Fix use-after-free when an argv item's __fspath__ mutates args (GH-151404) (#151445)
gh-151403: Fix use-after-free when an argv item's __fspath__ mutates args (GH-151404)

---------
(cherry picked from commit 6679ac07d8)

Co-authored-by: tonghuaroot (童话) <tonghuaroot@gmail.com>
Co-authored-by: tonghuaroot <23011166+tonghuaroot@users.noreply.github.com>
2026-06-13 14:32:48 -07:00
Miss Islington (bot)
3603bd318b
[3.15] gh-151126: Fix crash on unset memory error in ctypes.get_errno (GH-151382) (#151398)
gh-151126: Fix crash on unset memory error in `ctypes.get_errno` (GH-151382)
(cherry picked from commit 6b217ea90b)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-06-12 11:31:51 +00:00
Miss Islington (bot)
a2e551610f
[3.15] gh-151297: Fix undefined behavior in _PyObject_MiRealloc (GH-151358) (GH-151388)
The standard says that a call to `memcpy` must pass a valid source and
destination pointer even if the size is 0, so we must avoid calling
`memcpy` when our source pointer is NULL. If we don't, an optimizing
compiler can decide that the pointer must be non-NULL based on the
presence of UB, and optimize out checks for null pointers.

Specifically, note that the standard says:

    Where an argument declared as size_t n specifies the length of the
    array for a function, n can have the value zero on a call to that
    function. Unless explicitly stated otherwise in the description of
    a particular function in this subclause, pointer arguments on such
    a call shall still have valid values, as described in 7.1.4.

And section 7.1.4 says:

    If an argument to a function has an invalid value (such as a value
    outside the domain of the function, or a pointer outside the address
    space of the program, or a null pointer, or a pointer to
    non-modifiable storage when the corresponding parameter is not
    const-qualified) or a type (after default argument promotion) not
    expected by a function with a variable number of arguments, the
    behavior is undefined.

The specification for `memcpy` doesn't state that it's allowed to be
called with null pointers, and Linux's `/usr/include/string.h` declares
`memcpy` as `__nonnull ((1, 2))`.
(cherry picked from commit c37599200f)

Co-authored-by: Matt Wozniski <mwozniski@bloomberg.net>
2026-06-12 01:47:01 +00:00
Miss Islington (bot)
e87e732fda
[3.15] gh-151337: Avoid possible memory leak in _tkinter.c on Windows. (GH-151340) (GH-151379)
(cherry picked from commit 71805db429)

Co-authored-by: Ivy Xu <fakeshadow1337@gmail.com>
2026-06-11 20:25:05 +00:00
Miss Islington (bot)
b53743fb78
[3.15] gh-151126: Fix missing memory error in os._path_splitroot (GH-151339) (#151360)
gh-151126: Fix missing memory error in `os._path_splitroot` (GH-151339)
(cherry picked from commit 10595b1cb7)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-06-11 16:55:19 +00:00
Miss Islington (bot)
54ee910bcd
[3.15] gh-151126: Fix missing memory errors in _interpchannelsmodule.c (GH-151239) (#151265)
gh-151126: Fix missing memory errors in `_interpchannelsmodule.c` (GH-151239)
(cherry picked from commit 9fd1a125bc)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-06-10 16:26:38 +00:00
Miss Islington (bot)
9261f8b588
[3.15] gh-143988: Fix re-entrant mutation crashes in socket sendmsg/recvmsg_into (GH-143987) (#151246)
gh-143988: Fix re-entrant mutation crashes in socket sendmsg/recvmsg_into (GH-143987)

Fix crashes in socket.sendmsg() and socket.recvmsg_into() that could
occur if buffer sequences are mutated re-entrantly during argument
parsing via __buffer__ protocol callbacks.

The bug occurs because:

1. PySequence_Fast() returns the original list object when the input
   is already a list (not a copy).
2. During iteration, PyObject_GetBuffer() triggers __buffer__
   callbacks which may clear the list.
3. Subsequent iterations access invalid memory (heap OOB read).

The fix replaces PySequence_Fast() with PySequence_Tuple() which
always creates a new tuple, ensuring the sequence cannot be mutated
during iteration.
(cherry picked from commit 896f7fdc7d)

Co-authored-by: tonghuaroot (童话) <tonghuaroot@gmail.com>
Co-authored-by: tonghuaroot <23011166+tonghuaroot@users.noreply.github.com>
2026-06-10 14:25:33 +00:00
Cody Maloney
0318867acf
[3.15] gh-143008: Fix race re-initializing TextIOWrapper (#151203)
__init__() changes multiple variables and may be called more than once
from multiple threads.
2026-06-10 11:13:46 +02:00
Miss Islington (bot)
489d6af9af
[3.15] gh-151126: Add missing PyErr_NoMemory in _winapi module (GH-151154) (#151180)
gh-151126: Add missing `PyErr_NoMemory` in `_winapi` module (GH-151154)
(cherry picked from commit 8d94fa7b86)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-06-09 17:10:18 +00:00
Miss Islington (bot)
3199f3ba29
[3.15] gh-151039: Fix a crash when _datetime types outlive _datetime module (GH-151044) (#151143)
gh-151039: Fix a crash when `_datetime` types outlive `_datetime` module (GH-151044)
(cherry picked from commit 9fdbade99e)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-06-09 12:14:47 +00:00
Miss Islington (bot)
2d432f21db
[3.15] gh-151130: Add more tests for PyWeakref_* C API (GH-151131) (GH-151140)
(cherry picked from commit c3cd75afdf)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-06-09 11:37:56 +00:00
Pablo Galindo Salgado
83e26a43a7
[3.15] gh-149321: Remove lazy_imports=none startup mode (GH-149389) (#150129) 2026-06-08 22:55:57 +00:00
Miss Islington (bot)
99979753b3
[3.15] gh-149816: Fix SNI callback callable race (GH-150018) (GH-150099)
(cherry picked from commit 8b31d08e62)

Co-authored-by: Kirill Ignatev <kiri11@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2026-06-08 21:01:31 +03:00
Miss Islington (bot)
d3ca26983d
[3.15] gh-150599: Prevent bz2 decompressor reuse after errors (GH-150600)
(cherry picked from commit 5755d0f083)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-07 17:48:30 +01:00
Miss Islington (bot)
a642d1ab38
[3.15] gh-151021: Fix mmap empty searches past the end (GH-151023) (GH-151041)
(cherry picked from commit f2cab7b0cf)

Co-authored-by: esadomer <54475303+esadomer@users.noreply.github.com>
2026-06-07 13:27:26 +00:00
Miss Islington (bot)
c6d64cc60d
[3.15] gh-150913: Fix sqlite3.Blob validation for empty slice assignment (GH-150915) (GH-150923)
ass_subscript_slice() returned early when the computed slice length
was zero, bypassing validation performed for non-empty slices.
(cherry picked from commit fc9c4db130)

Co-authored-by: Jiseok CHOI <jiseok.dev@gmail.com>
2026-06-04 14:10:30 +00:00
Miss Islington (bot)
42a41cc69f
[3.15] gh-150750: Fix a race condition in deque.index with free-threading (GH-150779) (#150920)
gh-150750: Fix a race condition in `deque.index` with free-threading (GH-150779)
(cherry picked from commit d83d50b5b7)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-06-04 13:58:59 +00:00