Commit graph

130878 commits

Author SHA1 Message Date
Victor Stinner
feee573f36
gh-148014: Accept a function name in -X presite option (#148015) 2026-04-07 14:05:39 +00:00
Jonathan Dung
e65987d4c0
gh-146547: Use lazy imports in ctypes (GH-146548) 2026-04-07 15:26:53 +02:00
grayjk
dfeb160bc3
gh-130273: Fix traceback color output with unicode characters (GH-142529)
Account for the display width of Unicode characters so that colors and underlining in traceback output is correct.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-04-07 15:05:23 +02:00
Petr Viktorin
cf59bf7647
gh-146121: Clarify security model of pkgutil.getdata; revert checks (GH-148197)
This reverts commit bcdf231946,
and clarifies get_data's security model.


Co-authored-by: Stan Ulbrych <stan@python.org>
2026-04-07 11:39:50 +02:00
Chris Eibl
a4d9d6483f
GH-145762: Fix test_ci_fuzz_stdlib for source archive builds (#145778)
Co-authored-by: Stan Ulbrych <stan@ulbrych.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-04-07 12:02:15 +03:00
Stan Ulbrych
63d3c490d4
gh-101178: Fix UB in binascii.b2a_ascii85 (#148166) 2026-04-07 08:44:03 +01:00
Petr Viktorin
fbc1a5b076
gh-146636: abi3t: Define Py_GIL_DISABLED but do not use it (GH-148142)
When compiling for abi3t, define Py_GIL_DISABLED, so that users who
check it to enable additional locking aren't broken.

But also avoid using Py_GIL_DISABLED in Python headers themselves
-- abi3 and abi3t ought to be the same except
the _Py_OPAQUE_PYOBJECT differences.

A check for this is coming in a later PR.
It will require rewriting some preprocessor conditions, some of these
changes are included in this PR.
For _Py_IsOwnedByCurrentThread & supporting functions
I opted to move them to a cpython/ header, as they're rather self-contained.
2026-04-07 09:06:17 +02:00
Gregory P. Smith
5e9d90b615
gh-144503: Pass sys.argv to forkserver as real argv elements (GH-148194)
Avoid embedding the parent's sys.argv into the forkserver -c command
string via repr().  When sys.argv is large (e.g. thousands of file
paths from a pre-commit hook), the resulting single argument could
exceed the OS per-argument length limit (MAX_ARG_STRLEN on Linux,
typically 128 KiB), causing posix_spawn to fail and the parent to
observe a BrokenPipeError.

Instead, append the argv entries as separate command-line arguments
after -c; the forkserver child reads them back as sys.argv[1:].  This
cannot exceed any limit the parent itself did not already satisfy.

Regression introduced by gh-143706 / 298d5440eb.
2026-04-06 22:41:02 -07:00
Brandt Bucher
6bb7b33e8f
GH-146128: Remove the buggy AArch64 "33rx" relocation (#146263) 2026-04-07 07:52:59 +03:00
Semyon Moroz
132abfd135
gh-112632: Add optional keyword-only argument expand to pprint (#136964)
Co-authored-by: stodoran <stefan.todoran@uipath.com>
Co-authored-by: StefanTodoran <stefan.alex4@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-04-07 07:42:54 +03:00
Tim Peters
3df0c4da4c
Note out-of-date obmalloc comments (#148149)
Vladimir's original overviews, from 1998, are still good, but going
on 30 years later details have changed. Note that, but rather try
to keep up with moving targets in a different file, point to
sys._debugmallocstats() as the sure way to discover precise current
details.

No code changes, just added a block comment.

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
2026-04-06 23:08:47 -05:00
Mazin Sharaf
8a73478fed
gh-145844: Update WASI SDK from 30 to 32 (#145859)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Brett Cannon <brett@python.org>
2026-04-06 16:48:38 -07:00
Gregory P. Smith
bac4fee745
gh-73613: clarify padding= docs in for base64 & binascii modules (GH-148183)
Based on mayeut's comment in https://github.com/python/cpython/pull/147974#discussion_r3038498019.
2026-04-06 16:45:13 -07:00
Pablo Galindo Salgado
ca960b6f38
gh-148110: Resolve lazy import filter names for relative imports (#148111) 2026-04-06 22:29:02 +01:00
Fionn
a0c57a8d17
gh-137586: Open external osascript program with absolute path (GH-137584)
Open web browser with absolute path

On macOS, web browsers are opened via popen calling osascript. However,
if a user has a colliding osascript executable earlier in their PATH,
this may fail or cause unwanted behaviour.

Depending on one's environment or level of paranoia, this may be considered a security vulnerability.

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-04-06 09:42:10 -07:00
Junya Fukuda
3d724dd914
gh-148072: Cache pickle.dumps/loads per interpreter in XIData (GH-148125)
Store references to pickle.dumps and pickle.loads in _PyXI_state_t
so they are looked up only once per interpreter lifetime, avoiding
repeated PyImport_ImportModuleAttrString calls on every cross-interpreter
data transfer via pickle fallback.

Benchmarks show 1.7x-3.3x speedup for InterpreterPoolExecutor
when transferring mutable types (list, dict) through XIData.
2026-04-06 11:37:02 -04:00
Pablo Galindo Salgado
f8293faf37
gh-130472: Remove readline-only hacks from PyREPL completions (#148161)
PyREPL was still carrying over two readline-specific tricks from the
fancy completer: a synthetic CSI prefix to influence sorting and a fake
blank completion entry to suppress readline's prefix insertion. Those
workarounds are not appropriate in PyREPL because the reader already
owns completion ordering and menu rendering, so the fake entries leaked
into the UI as real terminal attributes and empty menu cells.

Sort completion candidates in ReadlineAlikeReader by their visible text
with stripcolor(), and let the fancy completer return only real matches.
That keeps colored completions stable without emitting bogus escape
sequences, removes the empty completion slot, and adds regression tests
for both the low-level completer output and the reader integration.
2026-04-06 14:57:25 +00:00
Hugo van Kemenade
36f15ba5cd
gh-140279: Stale workflow needs 'actions: write' to update its own cache (#148165) 2026-04-06 13:07:15 +00:00
Pieter Eendebak
efda60e2ec
gh-100239: Propagate type info through _BINARY_OP_EXTEND in tier 2 (GH-148146) 2026-04-06 20:52:42 +08:00
Stan Ulbrych
476fadc9ae
Add Stan to docs config reviewers (#148164) 2026-04-06 15:47:44 +03:00
Wulian233
69f51625e6
gh-148119: Refactor get_type_attr_as_size to improve error handling in structseq.c (#148120) 2026-04-06 17:41:30 +05:30
Stan Ulbrych
1795fccfbc
gh-148157: Check for _PyPegen_add_type_comment_to_arg fail in _PyPegen_name_default_pair (#148158) 2026-04-06 12:56:36 +01:00
Hugo van Kemenade
acf5229081
Docs: Update "Installing Python modules" (#146249) 2026-04-06 14:21:59 +03:00
Serhiy Storchaka
d0e204fb1d
gh-148153: Do not use assert for parameter validation in base64 (GH-148154)
base64.b32encode() now always raises ValueError instead of
AssertionError for the value of map01 with invalid length.
2026-04-06 13:47:27 +03:00
Malcolm Smith
a95ee3a21d
gh-144418: Increase Android testbed emulator RAM to 4 GB (#148054)
Pre-create the Android emulator image so that the the configuration can be
modified to use 4GB of RAM.
2026-04-06 13:48:00 +08:00
Pablo Galindo Salgado
fbfc6ccb0a
gh-148144: Initialize visited on copied interpreter frames (#148143)
_PyFrame_Copy() copied interpreter frames into generator and
frame-object storage without initializing the visited byte. Incremental
GC later reads frame->visited in mark_stacks() on non-start passes, so
copied frames could expose an uninitialized value once they became live
on a thread stack again.

Reset visited when copying a frame so copied frames start with defined
GC bookkeeping state. Preserve lltrace in Py_DEBUG builds.
2026-04-06 00:23:07 +01:00
Stan Ulbrych
bce96a1813
gh-145098: Use macos-15-intel instead of unstable macos-26-intel in {jit,tail-call}.yml (#148126)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-04-05 22:23:43 +03:00
Loïc Simon
b07becb573
gh-140870: PyREPL auto-complete module attributes in import statements (#140871)
Co-authored-by: Pablo Galindo Salgado <pablogsal@gmail.com>
2026-04-05 19:10:59 +00:00
Loïc Simon
c64baff1d8
gh-69605: Add math.integer to PyREPL module completer hardcoded list (#144811) 2026-04-05 19:31:19 +01:00
Stan Ulbrych
d6e044512c
Silence unused-variable warnings in optimizer_cases.c.h (#148127) 2026-04-05 19:22:10 +01:00
Gregory P. Smith
a1cf4430ed
gh-94632: document the subprocess need for extra_groups=() with user= (GH-148129) 2026-04-05 11:07:07 -07:00
Pablo Galindo Salgado
77fc2f5a5e
gh-144319: Fix huge page leak in datastack chunk allocator (#147963)
Fix huge page leak in datastack chunk allocator

The original fix rounded datastack chunk allocations in pystate.c so that
_PyObject_VirtualFree() would receive the full huge page mapping size.

Change direction and move that logic into _PyObject_VirtualAlloc() and
_PyObject_VirtualFree() instead. The key invariant is that munmap() must see
the full mapped size, so alloc and free now apply the same platform-specific
rounding in the allocator layer.

This keeps _PyStackChunk bookkeeping in requested-size units, avoids a
hardcoded 2 MB assumption, and also covers other small virtual-memory users
such as the JIT tracer state allocation in optimizer.c.
2026-04-05 16:29:38 +01:00
Chris Eibl
668c5723eb
GH-139922: add interpreter types to InternalDocs/interpreter.md (GH-148035) 2026-04-05 23:25:14 +08:00
Antonio Cuni
1c4408aeca
gh-130472: Integrate fancycompleter with the new repl, to get colored tab completions (#130473)
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2026-04-05 14:23:07 +00:00
Ezio Melotti
1f36a510a2
Add permissions: {} to all reusable workflows (#148114)
Add permissions: {} to all reusable workflows
2026-04-05 00:31:54 +02:00
ivonastojanovic
4ff8b07a3d
gh-142927: Show self time in flamegraph tooltip (#147706)
We already show self time in differential flamegraphs, but it should
be included in regular flamegraphs as well. Display the time spent
in the function body excluding callees, not just the total inclusive
time.
2026-04-04 20:55:05 +01:00
Stan Ulbrych
c43b490ca3
gh-145000: Find correct merge base in reusable-check-html-ids.yml workflow (#147975) 2026-04-04 20:47:11 +01:00
Serhiy Storchaka
8bf8bf9292
gh-73613: Support Base32 and Base64 without padding (GH-147974)
Add the padded parameter in functions related to Base32 and Base64 codecs
in the binascii and base64 modules.  In the encoding functions it controls
whether the pad character can be added in the output, in the decoding
functions it controls whether padding is required in input.

Padding of input no longer required in base64.urlsafe_b64decode() by default.
2026-04-04 21:26:16 +03:00
Stan Ulbrych
75be902a13
Docs: Standardize documentation authors (#148102) 2026-04-04 19:02:16 +01:00
Pablo Galindo Salgado
21fb9dc71d
gh-146527: Heap-allocate gc_stats to avoid bloating PyInterpreterState (#148057)
The gc_stats struct contains ring buffers of gc_generation_stats
entries (11 young + 3×2 old on default builds). Embedding it inline
in _gc_runtime_state, which is itself inline in PyInterpreterState,
pushed fields like _gil.locked and threads.head to offsets beyond
what out-of-process profilers and debuggers can reasonably read in
a single buffer (e.g. offset 9384 for _gil.locked vs an 8 KiB read
buffer).

Heap-allocate generation_stats via PyMem_RawCalloc in _PyGC_Init and
free it in _PyGC_Fini. This shrinks PyInterpreterState by ~1.6 KiB
and keeps the GIL, thread-list, and other frequently-inspected fields
at stable, low offsets.
2026-04-04 18:42:30 +01:00
Stan Ulbrych
b1d2d9829c
Docs: Fix a typo in the 'Non-ASCII characters in names' section (#148043) 2026-04-04 17:45:52 +01:00
Hugo van Kemenade
fbdbea949f
Regex HOWTO: invalid string literals result in SyntaxWarning (#148092)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-04-04 19:13:17 +03:00
Donghee Na
853dafe23a
gh-148083: Prevent constant folding when lhs is container types (gh-148090) 2026-04-05 00:40:12 +09:00
Wulian233
c398490fbf
gh-148074: Fix typeobject.c missing error return (#148075) 2026-04-04 21:04:55 +05:30
Donghee Na
289f19adb0
gh-148083: Constant-fold _CONTAINS_OP_SET for frozenset (gh-148084) 2026-04-04 12:32:12 +00:00
Stan Ulbrych
fe9befc1ca
gh-145883: Fix two heap-buffer-overflows in _zoneinfo (#145885) 2026-04-04 13:29:17 +01:00
Ken Jin
328da67b2c
gh-146073: Revert "gh-146073: Add fitness/exit quality mechanism for JIT trace frontend (GH-147966)" (#148082)
This reverts commit 198b04b75f.
2026-04-04 11:56:40 +00:00
TT
611d606a18
gh-148067: Fix typo in asyncio event loop docs: 'signals' -> 'signal' (#148073) 2026-04-04 16:02:58 +05:30
Ken Jin
c50d6cd012
gh-148078: Fix uses of sym_is_not_null in JIT optimizer (GH-148079) 2026-04-04 18:16:23 +08:00
Kumar Aditya
e7bf8eac0f
gh-131798: split recursion check to _CHECK_RECURSION_LIMIT and combine checks (GH-148070) 2026-04-04 17:23:03 +08:00