Commit graph

35546 commits

Author SHA1 Message Date
Max Schmitt
7241f2739c
gh-149388: Make asyncio PipeHandle.close idempotent (#149518) 2026-05-09 19:44:29 +05:30
László Kiss Kollár
9587726a3e
gh-149430: Fix edge-cases in profiling.sampling outputs (#149431)
The line highlights on the heatmap are driven by the URL hash and the
`:target` selector. When clicking a caller/callee link for the line that
was already selected, the hash doesn't change, so the browser keeps the
existing target state and doesn't restart the animation. Due to this the
highlight only works the first time.

With this fix, line navigation goes through JavaScript. If the target
URL already points to the current location, the highlight is replayed by
clearing the animation, forcing style recalculation, and restoring it.

The `baseline_self` variable isn't initialized for structural elided
roots. This variable is accessed later unconditionally and leads to a
crash.

The child process ends up being invoked with `--diff_flamegraph` instead
of the correct argument.
2026-05-09 14:05:46 +01:00
sobolevn
46a2c11eaa
gh-149530: Remove symtable.Class.get_methods deprecated method (#149531) 2026-05-09 08:33:09 +00:00
Maurycy Pawłowski-Wieroński
354ef336e4
gh-149474: use Py_fopen in Binary{Reader,Writer} for audit hook and path-like support (#149524) 2026-05-09 01:01:35 +01:00
Jeff Lyon
45c47d26c2
gh-149496: Fix MacOSTest.test_default regression when BROWSER env var is set (GH-149579)
gh-149496: Fix MacOSTest.test_default failing when BROWSER env var is set

MacOSTest.test_default calls webbrowser.get() and asserts it returns a
MacOS instance. When BROWSER is set in the environment (e.g. BROWSER=open,
a common macOS workaround for the old osascript-based implementation),
register_standard_browsers() registers a GenericBrowser as the preferred
browser instead, causing the assertion to fail.

This is a regression introduced in gh-137586, which added MacOSTest and
moved test_default into it from MacOSXOSAScriptTest. MacOSXOSAScriptTest
had an identical setUp() guard added in gh-131254 specifically to fix this
same failure. The guard was not carried over to MacOSTest.

Add setUp() to MacOSTest to unset BROWSER for the duration of each test,
restoring the isolation that was already established as the correct pattern
for macOS webbrowser tests.
2026-05-08 20:33:05 +00:00
Serhiy Storchaka
57ef219950
gh-79638: Test other HTTP error codes besides 403 in test_robotparser (#149569)
Also, use urllib.request.urlcleanup() in NetworkTestCase.
2026-05-08 20:24:34 +00:00
sobolevn
3a62c8f13a
gh-149537: Remove kw parameters from python version of reduce (#149538) 2026-05-08 18:34:48 +03:00
Diego Russo
ebf6d9c3e2
Rename fp unwind test module to C stack unwind (#149563) 2026-05-08 14:58:38 +01:00
Diego Russo
2a8cece95c
Skip GNU backtrace test on Arm 32-bit (#149493) 2026-05-08 14:03:05 +01:00
Petr Viktorin
578411982c
gh-149486: tarfile.data_filter: validate written link target (GH-149487)
The data filter rewrote linknames with normpath() but ran the
containment check against the un-normalised value, and computed a
symlink's directory before stripping trailing slashes.  Both let a
crafted archive create links pointing outside the destination.  Also
reject link members that resolve to the destination directory itself,
which could otherwise replace it with a symlink and redirect all
subsequent members.

(Patch by Greg; Petr's just reviewing & merging.)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2026-05-08 14:16:06 +02:00
Hai Zhu
c341e341b2
gh-149459: Fix segfault when _LOAD_SPECIAL guard deoptimizes (#149478) 2026-05-08 11:20:27 +00:00
Neko Asakura
49918f5b0c
gh-149481: skip FOR_ITER inline specialization for Python __next__ (#149491)
Co-authored-by: Savannah Ostrowski <savannah@python.org>
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-05-07 23:02:04 +00:00
Hugo van Kemenade
f0daba1652
gh-106693: Revert "Explicitly mark ob_sval as unsigned char to avoid UB (#106826)" (#149514) 2026-05-07 23:39:08 +03:00
Serhiy Storchaka
310fe88994
gh-79638: Treat an unreachable robots.txt as "disallow all" (GH-138555)
Disallow all access in urllib.robotparser if the robots.txt file is
unreachable due to server or network errors.
2026-05-07 22:06:57 +03:00
Victor Stinner
b3cfd36ba4
gh-149202: Don't use -fno-omit-frame-pointer on ppc64le (#149485)
The power ABI specification requires that compilers maintain a back
chain by default, so unwinding already works without a dedicated
frame pointer. Don't use -fno-omit-frame-pointer on ppc64le.
2026-05-07 11:47:08 +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
Jelle Zijlstra
ff422bd1c1
gh-141560: Add annotation_format parameter to getfullargspec (#149457) 2026-05-06 12:00:56 -07:00
David Ellis
8cad740557
gh-148823: Avoid importing _colorize when creating an ArgumentParser (#148827)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Savannah Ostrowski <savannah@python.org>
2026-05-06 18:24:18 +00:00
Hugo van Kemenade
7cea70e14d
gh-144384: Lazily import _colorize (#149318) 2026-05-06 16:07:43 +00: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
Bénédikt Tran
7b6c248d61
gh-142307: deprecate legacy support for altering IMAP4.file (#142335)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-05-06 17:41:26 +03:00
Serhiy Storchaka
a5c7a74418
gh-139489: Add xml.is_valid_text() (GH-149412) 2026-05-06 14:40:10 +00:00
Jeff Lyon
aeb02ac42b
gh-137586: Replace 'osascript' with 'open' on macOS in webbrowser (#146439)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2026-05-06 16:56:17 +03:00
Daniele Parmeggiani
1bdfc0f253
gh-146270: Fix PyMember_SetOne(..., NULL) not being atomic (gh-148800)
Fixes a sequential consistency bug whereby two threads that are deleting a struct member may observe both their deletions to be successful.
2026-05-06 09:50:24 -04:00
Hugo van Kemenade
e7613f2735
gh-148766: Add colour to Python help (#148767) 2026-05-06 16:48:04 +03:00
Sergey B Kirpichev
ffa4d47abd
gh-146238: Add missing tests for 'e', 'Zf' and 'Zd' array type codes in test_buffer (#149345)
This amends e79fd60.  I'll not fix this for 'F'/'D' complex types as
they might be removed.
2026-05-06 15:14:49 +02:00
Wulian233
0b75b7338d
gh-100239: specialize mixed int/float inplace binary ops (GH-149413) 2026-05-06 13:59:08 +01:00
Diego Russo
055cbf04ab
Skip test_jit when the JIT backend is "interpreter" (GH-149423) 2026-05-06 09:20:33 +01:00
Shrey Naithani
970b0433f4
gh-148615: Handle -- separator in pdb argument parsing (#148624) 2026-05-05 21:22:58 -07:00
Eduardo Villalpando Mello
17975f92ed
gh-149425: Increase test_write_without_source_date_epoch assertion delta (#149426)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Brett Cannon <brett@python.org>
2026-05-05 14:22:04 -07:00
sobolevn
bad9296fb0
gh-149410: Test that typing.NoDefault is final (#149411) 2026-05-05 17:58:49 +03: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
Hugo van Kemenade
ffb543d32f
gh-137855: Improve import time of pathlib (GH-146327)
Improve import time of pathlib
2026-05-05 14:38:03 +02:00
Hugo van Kemenade
426f99cb71
gh-149189: Modern defaults for pprint (#149190) 2026-05-05 15:04:05 +03: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
sobolevn
114781040c
gh-149403: Fix NameError in Lib/test/test_capi/test_getargs.py (#149404) 2026-05-05 09:58:32 +00: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
Tian Gao
ddfdf9b8df
gh-145378: Generate consistent colors for pdb commands (#149305) 2026-05-05 01:25:45 -07:00
Serhiy Storchaka
a76d9573e4
gh-139489: Add xml.is_valid_name() (GH-139768)
It allows to check whether a string can be used as an element or attribute
name in XML.
2026-05-05 11:25:22 +03: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
Tomas R.
ed99680487
gh-130472: Use fancycompleter in import completions (#148188) 2026-05-05 01:36:43 +00: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
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
Hugo van Kemenade
ffe050ad9b
gh-142389: Add support for backtick colorisation in argparse help text (#149375)
Co-authored-by: Savannah Ostrowski <savannah@python.org>
2026-05-04 22:58:04 +00:00
Hugo van Kemenade
ef6f0635ce
gh-142389: Add backticks to stdlib argparse help to display in colour (#149384)
Co-authored-by: Savannah Ostrowski <savannah@python.org>
2026-05-04 22:23:18 +00:00
Savannah Ostrowski
53a7f76501
GH-130750: Restore quoting of choices in argparse error messages to match documentation and improve clarity (#144983) 2026-05-04 21:51:48 +00:00
Matt Van Horn
7acee984e8
gh-146406: Add cross-language method suggestions for builtin AttributeError (#146407)
When Levenshtein-based suggestions find no match for an AttributeError
on list, str, or dict, check a static table of common method names from
JavaScript, Java, C#, and Ruby.

For example, [].push() now suggests .append(), "".toUpperCase() suggests
.upper(), and {}.keySet() suggests .keys().

The list.add() case suggests using a set instead of suggesting .append(),
since .add() is a set method and the user may have passed a list where
a set was expected (per discussion with Serhiy Storchaka, Terry Reedy,
and Paul Moore).

Design: flat (type, attr) -> suggestion text table, no runtime
introspection. Only exact builtin types are matched to avoid false
positives on subclasses.

Discussion: https://discuss.python.org/t/106632

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-04 21:38:07 +00:00