Commit graph

35569 commits

Author SHA1 Message Date
Miss Islington (bot)
84ea87cde0
[3.15] gh-149977: Fix extra output of -m test test_lazy_import (GH-149978) (#150016)
gh-149977: Fix extra output of `-m test test_lazy_import` (GH-149978)
(cherry picked from commit 6d5be4b1d6)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-05-18 19:24:06 +00:00
Miss Islington (bot)
bdc44c55a2
[3.15] gh-149916: Restore the commented out part of test_body_encode in test_email (GH-149917) (GH-149937)
(cherry picked from commit 1cbe035723)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-17 08:33:11 +00:00
Miss Islington (bot)
6136ad6801
[3.15] gh-142349: Add help("lazy") support (GH-149886) (#149889)
gh-142349: Add `help("lazy")` support (GH-149886)
(cherry picked from commit 8be3fb1b50)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-05-15 16:57:59 +00:00
Miss Islington (bot)
0e2184aca0
[3.15] gh-149786: Fixes venvlauncher builds on Windows free-threaded (GH-149847)
(cherry picked from commit 1c5fe21eb2)

Co-authored-by: Steve Dower <steve.dower@python.org>
2026-05-15 14:12:05 +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
Miss Islington (bot)
5dadc64673
[3.15] gh-87451: Apply CVE-2021-4189 PASV fix to ftplib.ftpcp() (GH-149648) (#149792)
gh-87451: Apply CVE-2021-4189 PASV fix to ftplib.ftpcp() (GH-149648)

ftpcp() called parse227() directly and passed the source server's
self-reported PASV IPv4 address to the target server's PORT command,
bypassing the CVE-2021-4189 fix that was applied only to FTP.makepasv().
A malicious source FTP server could use this to redirect the target
server's data connection to an arbitrary host:port (SSRF).

ftpcp() now uses the source server's actual peer address, honoring the
existing trust_server_pasv_ipv4_address opt-out, the same as makepasv().

Thanks to Qi Ding at Aurascape AI for the report. (GHSA-w8c5-q2xf-gf7c)
(cherry picked from commit eac4fe3b2c)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2026-05-15 10:50:45 +00:00
Miss Islington (bot)
ed27363ddf
[3.15] gh-149144: Use decodeURIComponent() for UTF-8 support in js_output() (GH-149157) (GH-149846)
gh-149144: Use decodeURIComponent() for UTF-8 support in js_output() (GH-149157)
(cherry picked from commit 461b1d9631)

Co-authored-by: Seth Larson <seth@python.org>
2026-05-15 00:38:11 +02:00
Miss Islington (bot)
21909e898e
[3.15] gh-124111: Update Windows build to use Tcl/Tk 9.0.3 (GH-149842)
(cherry picked from commit c62c3710dc)

Co-authored-by: Zachary Ware <zach@python.org>
2026-05-14 13:49:29 -05:00
Miss Islington (bot)
6302a8f17a
[3.15] gh-148821: Add more tests for invalid XML encodings (GH-149820) (GH-149821)
(cherry picked from commit c6f7368157)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-14 10:37:11 +00:00
Barry Warsaw
45fc9acb8c
[3.15] gh-149504: Fix re-entrancy bug when .pth/.start file invokes site.add sitedir() (#149659) (#149799)
* gh-149504: Fix re-entrancy bug when .pth/.start file invokes site.addsitedir() (#149659)

* Add re-entrant tests for gh-149504
* Add end-to-end integration test coverage

This ensures that future whitebox internal test changes do not regress the
public surface semantics.

* Implement a state class to process .pth and .start files

By using this state class and managing implicit and explicit batching, we make it structurally
impossible to get bitten by re-entrant site startup processing.

Fixes #149504

(cherry picked from commit b162307d7f)

* Add myself back to CODEOWNERS
2026-05-13 15:45:39 -07: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)
fb3500466d
[3.15] gh-128110: Fix rfc2047 whitespace handling in email parser address headers (GH-130749) (#149787)
RFC 2047 Section 6.2 requires that "any 'linear-white-space' that
separates a pair of adjacent 'encoded-word's is ignored." The modern
header value parser correctly implements that for unstructured headers,
but had missed a case in structured headers. This could cause a parsed
address header to include extraneous spaces in a display-name.

Switch to @bitdancer's fix from review feedback. Recharacterize space
between ews as fws after parsing in get_phrase.

RDM: This fix is dependent on the fact that "subsequent" atoms will never have
leading whitespace because that's been consumed already. I don't think
it's worth adding extra code for the possibility of leading whitespace
because the parser won't produce it. It's a bit of parser fragility in the
face of code changes, but I think that's a minor concern given the
parser design (which is that it consumes whitespace greedily)
(cherry picked from commit 7a4c6dfb88)

Co-authored-by: Mike Edmunds <medmunds@gmail.com>
Co-authored-by: R David Murray <rdmurray@bitdance.com>
2026-05-13 16:26:42 -04:00
Miss Islington (bot)
bb7a539da2
[3.15] gh-149776: Skip UDP Lite tests if it's not supported (GH-149777) (#149780)
gh-149776: Skip UDP Lite tests if it's not supported (GH-149777)

Fix test_socket on Linux kernel 7.1 and newer: skip UDP Lite tests if
it's not supported.
(cherry picked from commit 3cfc249e11)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-05-13 15:36:27 +00:00
Miss Islington (bot)
1a639b8669
[3.15] gh-148821: Add more strict tests for XML encodings (GH-149765) (GH-149770)
Exclude encodings like 'utf-8-sig', 'iso2022-jp' and 'hz' from the list of
supported encodings.
(cherry picked from commit fa2afa64d9)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-13 11:10:30 +00:00
Miss Islington (bot)
37f3deb571
[3.15] bpo-45509: Check gzip headers for corrupted fields (GH-29028) (GH-149769)
Check the header checksum it the HCRC field is present.
(cherry picked from commit dd94457893)

Co-authored-by: Ruben Vorderman <r.h.p.vorderman@lumc.nl>
2026-05-13 10:54:10 +00: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)
4e369c1dea
[3.15] gh-149701: Fully silence potential hash -r error (GH-149702) (GH-149757)
(cherry picked from commit cd6096887e)
2026-05-13 10:28:27 +01:00
Miss Islington (bot)
15a597e9ba
[3.15] gh-149642: Fix interaction between exec and lazy_imports=all (GH-149643) (#149749)
gh-149642: Fix interaction between exec and lazy_imports=all (GH-149643)
(cherry picked from commit 4087ff8599)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2026-05-13 03:36:32 +00:00
Miss Islington (bot)
8b73ce9ab8
[3.15] gh-149718: Aggregate same stack frames in Tachyon in some collectors (GH-149719) (#149747)
gh-149718: Aggregate same stack frames in Tachyon in some collectors (GH-149719)
(cherry picked from commit 76f2285341)

Co-authored-by: Maurycy Pawłowski-Wieroński <maurycy@maurycy.com>
2026-05-13 01:30:22 +01:00
Miss Islington (bot)
e3fbcc3eac
[3.15] gh-149496: Fix MacOSTest.test_default regression when BROWSER env var is set (GH-149579) (#149745)
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.
(cherry picked from commit 45c47d26c2)

Co-authored-by: Jeff Lyon <146767590+secengjeff@users.noreply.github.com>
2026-05-12 21:25:21 +00:00
Miss Islington (bot)
d3b86111ef
[3.15] gh-149676: Fix hash(frozendict | frozendict) (GH-149675) (#149717)
gh-149676: Fix hash(frozendict | frozendict) (GH-149675)

Fix new_dict_impl() to properly initialize ma_hash on frozendict.
(cherry picked from commit f5fb491341)

Co-authored-by: Thomas Kowalski <thom.kowa@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-05-12 15:57:02 +02:00
Miss Islington (bot)
45c431a55d
[3.15] Update mypy to 2.1.0 (GH-149709) (#149711)
Update mypy to 2.1.0 (GH-149709)
(cherry picked from commit b546cc10f5)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-05-12 09:09:52 +00:00
Savannah Ostrowski
a8c420879e
[3.15] gh-149614 - Restore deepcopiability of argparse.ArgumentParser… (#149693)
[3.15] gh-149614 - Restore deepcopiability of argparse.ArgumentParser instances (GH-149617)
(cherry picked from commit fadd9bc14e)

Co-authored-by: David Ellis <ducksual@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2026-05-11 18:25:40 +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)
b4f2e88203
[3.15] gh-112821: Fix rlcompleter failures on objects with descriptors (GH-149577) (#149656)
gh-112821: Fix rlcompleter failures on objects with descriptors (GH-149577)

* gh-112821: Fix rlcompleter failures on objects with descriptors

* Confirm no accesses
(cherry picked from commit f23a1837d7)

Co-authored-by: Michael Droettboom <mdboom@gmail.com>
2026-05-11 12:07:50 -04:00
Miss Islington (bot)
8fdeb2dd3a
[3.15] gh-144957: Fix lazy imports + module __getattr__ (GH-149624) (#149678)
gh-144957: Fix lazy imports + module __getattr__ (GH-149624)
(cherry picked from commit 56171da341)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2026-05-11 13:36:35 +00:00
Miss Islington (bot)
5cf47a248c
[3.15] gh-149486: tarfile.data_filter: validate written link target (GH-149487) (GH-149553)
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.

(cherry picked from commit 578411982c)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2026-05-11 11:57:32 +02: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)
212e996cba
[3.15] gh-149388: Make asyncio PipeHandle.close idempotent (GH-149518) (#149605)
gh-149388: Make asyncio `PipeHandle.close` idempotent (GH-149518)
(cherry picked from commit 7241f2739c)

Co-authored-by: Max Schmitt <max@schmitt.mx>
2026-05-09 20:38:34 +05:30
Miss Islington (bot)
dc8c32e59d
[3.15] gh-149430: Fix edge-cases in profiling.sampling outputs (GH-149431) (#149602)
gh-149430: Fix edge-cases in `profiling.sampling` outputs (GH-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.
(cherry picked from commit 9587726a3e)

Co-authored-by: László Kiss Kollár <kiss.kollar.laszlo@gmail.com>
2026-05-09 13:33:05 +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
Miss Islington (bot)
bb060b82f6
[3.15] gh-79638: Test other HTTP error codes besides 403 in test_robotparser (GH-149569) (GH-149580)
Also, use urllib.request.urlcleanup() in NetworkTestCase.
(cherry picked from commit 57ef219950)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-08 20:53:55 +00:00
Miss Islington (bot)
0bdbc48101
[3.15] Rename fp unwind test module to C stack unwind (GH-149563) (#149565) 2026-05-08 14:24:49 +00:00
Miss Islington (bot)
54a187d3b3
[3.15] Skip GNU backtrace test on Arm 32-bit (GH-149493) (#149562) 2026-05-08 13:32:59 +00:00
Miss Islington (bot)
f9e5975deb
[3.15] gh-149459: Fix segfault when _LOAD_SPECIAL guard deoptimizes (GH-149478) (#149552)
gh-149459: Fix segfault when `_LOAD_SPECIAL` guard deoptimizes (GH-149478)
(cherry picked from commit c341e341b2)

Co-authored-by: Hai Zhu <haiizhu@outlook.com>
2026-05-08 11:48:04 +00:00
Miss Islington (bot)
5cb915da44
[3.15] gh-149481: skip FOR_ITER inline specialization for Python __next__ (GH-149491) (#149523)
gh-149481: skip `FOR_ITER` inline specialization for Python `__next__` (GH-149491)
(cherry picked from commit 49918f5b0c)

Co-authored-by: Neko Asakura <neko.asakura@outlook.com>
Co-authored-by: Savannah Ostrowski <savannah@python.org>
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-05-07 19:08:12 -07: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