Commit graph

15834 commits

Author SHA1 Message Date
Miss Islington (bot)
cfb2e431cd
[3.15] gh-150285: Fix too long docstrings in the io module (GH-150287) (GH-150332)
(cherry picked from commit 160dc74122)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-24 16:23:45 +03:00
Miss Islington (bot)
29cbb44200
[3.15] gh-150285: Fix too long docstrings in the curses module (GH-150286) (GH-150331)
(cherry picked from commit 4c0fe2d134)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-24 16:23:25 +03:00
Miss Islington (bot)
1b7ab11cd6
[3.15] gh-150285: Fix too long docstrings in the _remote_debugging module (GH-150289) (#150334)
gh-150285: Fix too long docstrings in the _remote_debugging module (GH-150289)
(cherry picked from commit cdc499ae77)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-24 14:09:13 +01:00
Miss Islington (bot)
ca59d7511e
[3.15] gh-149816: add missing critical section on self in buffered_iternext (GH-150295) (#150305)
gh-149816: add missing critical section on self in buffered_iternext (GH-150295)
(cherry picked from commit e8545ed3ea)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-05-23 09:25:56 +00:00
Miss Islington (bot)
77cc4428a7
[3.15] gh-146452: Fix pickle segfault on concurrent mutation of dict in pickle (GH-146470) (#150292)
gh-146452: Fix pickle segfault on concurrent mutation of dict in pickle (GH-146470)
(cherry picked from commit e62a61177f)

Co-authored-by: Farhan Saif <fsaif@uic.edu>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-05-23 07:33:21 +00:00
Victor Stinner
795dd3bd35
[3.15] Revert "[3.15] gh-146452: Improve locking granularity in pickle's batch_dict_exact and fix race condition (GH-150025) (#150039)" (#150262)
Revert "[3.15] gh-146452: Improve locking granularity in pickle's batch_dict_exact and fix race condition (GH-150025) (#150039)"

This reverts commit 66ade2861f.
2026-05-23 12:27:27 +05:30
Miss Islington (bot)
f5231469b5
[3.15] gh-148829: Make sentinels' repr and module customizable (GH-149654) (#150092)
Implementation of python/peps#4968.
(cherry picked from commit 08218030a5)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2026-05-22 07:44:34 -07:00
Miss Islington (bot)
034c536d56
[3.15] gh-149584: Fix excessive overhead in the Tachyon profiler regarding the cache behavior (GH-149649) (#150152) 2026-05-20 11:59:10 +00:00
Miss Islington (bot)
d6dda0d23c
[3.15] gh-150042: queue.SimpleQueue.put: fix minor refleak. (GH-150043) (GH-150127)
If queue.SimpleQueue.put can't handoff the item to a
waiting thread, and fails to allocate memory when adding
the item to a ringbuf, it would leak a reference.  Fixed.
(cherry picked from commit 79088e0d82)

Co-authored-by: larryhastings <larry@hastings.org>
2026-05-20 02:46:42 +02:00
Miss Islington (bot)
f46b397975
[3.15] gh-149983: Fix PyErr_NoMemory call without GIL in winconsoleio.c (GH-149984) (GH-150113)
(cherry picked from commit 3d2aa899ba)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2026-05-19 23:11:13 +02:00
Miss Islington (bot)
66ade2861f
[3.15] gh-146452: Improve locking granularity in pickle's batch_dict_exact and fix race condition (GH-150025) (#150039)
gh-146452: Improve locking granularity in pickle's batch_dict_exact and fix race condition (GH-150025)

Remove assertion that could fail in rare race condition.

Replace the coarse critical section wrapping the entire function with
fine-grained sections covering only PyDict_Next + Py_INCREF.
Also handle PyDict_Next returning 0 in the single-item fast path.
(cherry picked from commit 57a0e570d3)

Co-authored-by: Saul Cooperman <58375603+scopreon@users.noreply.github.com>
2026-05-18 23:53:57 +00:00
Miss Islington (bot)
c417fcabfd
[3.15] gh-149590: Remove faulthandler_traverse (GH-150023) (#150037)
gh-149590: Remove faulthandler_traverse (GH-150023)

`faulthandler_traverse` visits Python objects owned by `_PyRuntime`, not
by the module instance. With multi-phase init allowing multiple module
instances, each instance's GC traversal decrements `gc_refs` on the same
runtime-owned objects, driving it negative when two instances are
collected simultaneously.
(cherry picked from commit 56737483c2)

Co-authored-by: Armaan Vakharia <43391096+armaan-v924@users.noreply.github.com>
2026-05-18 23:28:04 +00:00
Miss Islington (bot)
01b07df858
[3.15] gh-149816: Fix a RC in _random.Random.__init__ method (GH-149824) (#149997)
gh-149816: Fix a RC in `_random.Random.__init__` method (GH-149824)
(cherry picked from commit 14af19e6c0)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-05-18 16:16:55 +00:00
Miss Islington (bot)
6e83c55e64
[3.15] gh-149953: Fix null pointer dereference order in code_objects.c (GH-149956) (#149976)
gh-149953: Fix null pointer dereference order in `code_objects.c` (GH-149956)

Move  check before
(cherry picked from commit 0ed497a350)

Co-authored-by: Nezuko Agent <nezukoagent@gmail.com>
2026-05-18 09:00:19 +00:00
Miss Islington (bot)
42ff9b4959
[3.15] gh-149921: Fix reference leaks in _interpchannels and _interpqueues modules (GH-149922) (#149943)
gh-149921: Fix reference leaks in _interpchannels and _interpqueues modules (GH-149922)
(cherry picked from commit acefff95ea)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2026-05-17 11:01:15 +00:00
Miss Islington (bot)
cc624f74ba
[3.15] gh-148675: Use a string for ctypes cparam tag (GH-149778) (#149869)
gh-148675: Use a string for ctypes cparam tag (GH-149778)
(cherry picked from commit 3ecca22567)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-05-15 11:52:55 +00:00
Victor Stinner
8d32ae75d4
[3.15] gh-149707: Fix compiler warning in _ctypes_test on strchr() (#149791) (#149865)
gh-149707: Fix compiler warning in _ctypes_test on strchr() (#149791)

Change my_strchr() return type to "const char*" (add "const").

Fix the compiler warning:

Modules/_ctypes/_ctypes_test.c: In function 'my_strchr':
Modules/_ctypes/_ctypes_test.c:451:12: warning: return discards
'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  451 |     return strchr(s, c);
      |            ^~~~~~

When using C23, strchr(text, ch) return type is "const char*" if text
type is "const char*".

(cherry picked from commit 5465b69255)
2026-05-15 11:36:21 +00:00
Miss Islington (bot)
b5d508d40b
[3.15] gh-149698: Update bundled expat to 2.8.1 (GH-149699) (#149812)
(cherry picked from commit f1a47e79fb)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-05-14 09:52:51 +01:00
Miss Islington (bot)
b6503057b2
[3.15] gh-140550: Update xxlimited with 3.15 limited API (GH-142827) (GH-149785)
(cherry picked from commit fa81cd976a)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2026-05-14 00:00:29 +02:00
Miss Islington (bot)
a5f77a13fd
[3.15] gh-148829: Add PySentinel_CheckExact() (GH-149725) (#149766)
gh-148829: Add PySentinel_CheckExact() (GH-149725)
(cherry picked from commit 94df62542c)

Co-authored-by: scoder <stefan_ml@behnel.de>
2026-05-13 10:39:38 +00:00
Miss Islington (bot)
670f982fbd
[3.15] gh-134837: Correct and improve base85 documentation for base64 and binascii modules (GH-145843) (GH-149742)
(cherry picked from commit e667d62f11)

Co-authored-by: David Huggins-Daines <dhd@ecolingui.ca>
2026-05-12 20:25:28 +00:00
Miss Islington (bot)
e2e9cea769
[3.15] GH-149501: Fix compilation warning in _YIELD_VALUE uop (GH-149502) (#149737)
GH-149501: Fix compilation warning in `_YIELD_VALUE` uop (GH-149502)
(cherry picked from commit 1a79fd0ad6)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
2026-05-12 17:58:31 +00:00
Sam Gross
8297d50a63
[3.15] gh-145235: Make dict watcher API thread-safe for free-threaded builds (gh-145233) (#149690)
In free-threaded builds, concurrent calls to PyDict_AddWatcher, PyDict_ClearWatcher, PyDict_Watch, and PyDict_Unwatch can race on the shared callback array and the per-dict watcher tags. This change adds a mutex to serialize watcher registration and removal, atomic operations for tag updates, and atomic acquire/release synchronization for callback dispatch in _PyDict_SendEvent.

(cherry picked from commit 8a4895985f)

Co-authored-by: Alper <alperyoney@fb.com>
2026-05-11 14:23:39 -04:00
Miss Islington (bot)
73c80cb859
[3.15] gh-149083: use sentinel to fix _functools.reduce() signature (GH-149591) (#149653)
gh-149083: use sentinel to fix _functools.reduce() signature (GH-149591)
(cherry picked from commit c6fd7de64a)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2026-05-10 23:32:35 +00:00
Miss Islington (bot)
46a54ea5b0
[3.15] gh-148441: Avoid integer overflow in Expat's CharacterDataHandler (GH-148904) (#149639)
gh-148441: Avoid integer overflow in Expat's CharacterDataHandler (GH-148904)
(cherry picked from commit bc1be4f617)

Co-authored-by: ByteFlow <fakeshadow1337@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-05-10 14:11:57 +00:00
Miss Islington (bot)
2b1eed460d
[3.15] gh-149474: use Py_fopen in Binary{Reader,Writer} for audit hook and path-like support (GH-149524) (#149586)
gh-149474: use `Py_fopen` in `Binary{Reader,Writer}` for audit hook and path-like support (GH-149524)
(cherry picked from commit 354ef336e4)

Co-authored-by: Maurycy Pawłowski-Wieroński <maurycy@maurycy.com>
2026-05-09 00:28:21 +00:00
Petr Viktorin
612140e7dd
gh-149202: Fix frame pointer unwinding on ppc64le and armv7/clang (#149409)
- ppc64's backchain format is also different from x86
- On 32-bit ARM, clang needs `-mno-thumb`, not `-marm` like GCC
2026-05-07 10:37:00 +02:00
Peter Bierma
2b7c28a440
gh-149101: Implement PEP 788 (GH-149116)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Sam Gross <colesbury@gmail.com>
2026-05-06 17:39:30 -04:00
Pablo Galindo Salgado
4ed40146f1
gh-149202: Fix frame pointer unwinding on s390x and ARM (GH-149362)
-fno-omit-frame-pointer is not enough to make every target walkable by the
simple manual frame pointer unwinder.

The helper used by test_frame_pointer_unwind used to assume the frame pointer
named a two-word record where fp[0] was the previous frame pointer and fp[1]
was the return address. That is only the generic layout used by some targets.
This patch keeps that default, but moves the slots behind named offsets so
architecture-specific layouts can describe where the backchain and return
address really live.

On s390x, GCC and Clang do not emit a usable backchain unless -mbackchain is
enabled. Without it, the unwinder stops at the current C frame and the test
reports no Python frames. Once backchains are present, the helper must also
stop at the current thread's known C stack bounds; otherwise it can follow the
final backchain far enough to dereference an invalid frame and segfault.
For Linux s390x backchain frames, the documented z/Architecture stack-frame
layout saves r14, the return-address register, at byte offset 112 from the
frame pointer, so read the return address from that named slot instead of fp[1].

The 112-byte offset comes from Linux's s390 debugging documentation: its Stack
Frame Layout table shows z/Architecture backchain frames with the backchain at
offset 0 and saved r14 of the caller function at offset 112:
https://www.kernel.org/doc/html/v5.3/s390/debugging390.html#stack-frame-layout

This helper remains scoped to Linux s390x backchain frames. GNU SFrame's s390x
notes state that the s390x ELF ABI does not generally mandate where RA and FP
are saved, or whether they are saved at all:
https://sourceware.org/binutils/docs/sframe-spec.html#s390x

As Jens Remus noted, -fno-omit-frame-pointer is not needed when -mbackchain is
present.

On 32-bit ARM, GCC defaults to Thumb mode on common armhf toolchains. The Thumb
prologue keeps the saved frame pointer and link register at offsets that depend
on the generated frame, which breaks the fp[0]/fp[1] walk used by the helper.
Use -marm when it is supported for frame-pointer builds, and teach the helper
the GCC ARM-mode slots where the previous frame pointer is at fp[-1] and the
saved LR return address is at fp[0].


Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-05-06 15:03:37 +00:00
Alex Malyshev
646853df13
gh-145559: Add PyUnstable_DumpTraceback() and PyUnstable_DumpTracebackThreads() (#148145)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-05-06 15:01:12 +00:00
Victor Stinner
9274d969f3
gh-148675: Optimize arraydescr structure: use char[3] (GH-149455)
Replace "const char *typecode;" with "char typecode[3];" to make the
arraydescr structure smaller and avoids an indirection.
2026-05-06 16:28:11 +02:00
Mark Shannon
70bd1c2dd2
GH-143732: SEND specialization (GH-148963)
* SEND specialization. Adds 2 new specialized instructions:

* SEND_VIRTUAL: for sends to virtual iterators e.g lists and tuples
* SEND_ASYNC_GEN: for sends to async generators

Tweak FOR_ITER_VIRTUAL so that SEND_VIRTUAL and FOR_ITER_VIRTUAL use equivalent guards
2026-05-05 15:19:16 +01:00
Anuj Nitin Bharambe
f6d16a0d70
gh-149216: Notify type watchers on heap type deallocation (GH-149236)
Authored-by: Anuj Bharambe <anujnitinb@gmail.com>
2026-05-05 11:24:07 +01:00
Diego Russo
1e5d94274d
GH-126910: Add GNU backtrace support for unwinding JIT frames (#149104)
Co-authored-by: Pablo Galindo Salgado <pablogsal@gmail.com>
2026-05-05 09:29:07 +01:00
Petr Viktorin
508b49845d
gh-149044: Implement PEP 820 – PySlot: Unified slot system for the C API (GH-149055)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2026-05-05 09:18:04 +02:00
Maurycy Pawłowski-Wieroński
c266f0c375
gh-149009: Validate thread_count in profiling.sampling binary reader (#149147) 2026-05-05 00:50:06 +00:00
Maurycy Pawłowski-Wieroński
04ce318522
gh-146256: Add --jsonl collector to the profiling.sampling (#146257) 2026-05-05 00:44:37 +00:00
Maurycy Pawłowski-Wieroński
f025dba62e
gh-149230: _remote_debugging: Fix async-aware for tasks in non-main threads (#149235) 2026-05-05 01:33:56 +01:00
Maurycy Pawłowski-Wieroński
6f8c964dc0
gh-149342: _remote_debugging: Fix binary profile corruption when sampling a (temporarily) empty stack (#149343) 2026-05-05 00:32:06 +00:00
Maurycy Pawłowski-Wieroński
9dca1ff759
gh-149300: _remote_debugging: clean up magic and duplicate consts in the binary format helper (#149301) 2026-05-05 01:31:53 +01:00
Pablo Galindo Salgado
9a268e3e33
gh-98894: Restore function entry/exit DTrace probes (#142397)
The function__entry and function__return probes stopped working in Python 3.11
when the interpreter was restructured around the new bytecode system. This change
restores these probes by adding DTRACE_FUNCTION_ENTRY() at the start_frame label
in bytecodes.c and DTRACE_FUNCTION_RETURN() in the RETURN_VALUE and YIELD_VALUE
instructions. The helper functions are defined in ceval.c and extract the
filename, function name, and line number from the frame before firing the probe.

This builds on the approach from https://github.com/python/cpython/pull/125019
but avoids modifying the JIT template since the JIT does not currently support
DTrace. The macros are conditionally compiled with WITH_DTRACE and are no-ops
otherwise. The tests have been updated to use modern opcode names (CALL, CALL_KW,
CALL_FUNCTION_EX) and a new bpftrace backend was added for Linux CI alongside
the existing SystemTap tests. Line probe tests were removed since that probe
was never restored after 3.11.
2026-05-05 00:29:55 +00:00
Pablo Galindo Salgado
8c796782fc
gh-146462: Add dict introspection debug offsets (#148633) 2026-05-04 23:00:23 +00:00
Sergey Miryanov
e89568f0cb
GH-148726: Add heap_size to generational GC (#149195) 2026-05-04 22:14:45 +01:00
Victor Stinner
952784af47
gh-137030: Fix YIELD_VALUE bytecode assertion (#149184)
Co-authored-by: Mark Shannon <mark@hotpy.org>
2026-05-04 18:09:57 +02:00
Victor Stinner
5dd5c8b5a6
gh-148675: Remove F and D formats from array and memoryview (GH-149368) 2026-05-04 17:26:30 +02:00
Victor Stinner
6e6f9053e3
gh-148675: Add Zd/Zf formats to array, ctypes, memoryview, struct (#148676)
* Add Zd/Zf format support to array, memoryview and struct.
* ctypes: Replace F/D/G complex format with Zf/Zd/Zg.
* Modify array, ctypes and struct modules to support format strings
  longer than 1 character (such as "Zd").
* Change array.typecodes type from str to tuple.
2026-05-04 16:14:23 +02:00
Victor Stinner
7b7fa3f9bf
gh-148292: Update _ssl._SSLSocket for OpenSSL 4 (#149102)
The _SSLSocket object now remembers if it gets an EOF error. In this
case, read(), sendfile(), write() and do_handshake method calls fail
with SSLEOFError without calling the underlying OpenSSL function.

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2026-05-04 13:52:57 +02:00
Maurycy Pawłowski-Wieroński
0c6d2f64c0
gh-148093: Raise binascii.Error from binascii.a2b_uu() on empty input (GH-149077)
Instead of reading past the end of the empty buffer.
2026-05-04 12:40:52 +03:00
Kumar Aditya
5847931d11
gh-143732: allow dict subclasses to be specialized (GH-148128) 2026-05-04 09:39:03 +01:00
Zachary Ware
68fe899feb
gh-149254: Update CI to use latest OpenSSL and AWS-LC versions (GH-149330)
Also update Modules/_ssl_data_36.h to include an added symbol from OpenSSL 3.6.2.
2026-05-03 20:20:51 +00:00