Commit graph

57119 commits

Author SHA1 Message Date
Miss Islington (bot)
de401ef6a5
[3.15] gh-150114: Reduce memory usage of test_free_threading.test_iteration (gh-150115) (#150124)
Reduce NUMITEMS from 100000 to 5000. Peak RSS for the full
test_free_threading suite drops from ~850 MB to ~175 MB.

(cherry picked from commit 61f12211fc)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2026-05-19 22:05:19 +00:00
Dino Viehland
6847f4bc60
[3.15] gh-150052: Resolve un-loaded lazily loaded submodules via module.__getattr__ instead of publishing lazy values (#150055) 2026-05-19 21:23:30 +00:00
Miss Islington (bot)
021381759f
[3.15] gh-124111: Keep tests passing for Tcl prior to 9.0 (GH-150102)
Also disables the UWP build in CI, since it was breaking (and is no longer released).
(cherry picked from commit ec9ce3ee98)

Co-authored-by: Steve Dower <steve.dower@python.org>
2026-05-19 21:57:21 +01:00
Miss Islington (bot)
3227857de8
[3.15] gh-149945: Fix potential OOM for gzip with large header (GH-149979) (GH-150093)
Do not read the whole filename and comment to memory for calculating the CRC.
(cherry picked from commit 51a5715df9)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-19 20:38:47 +00:00
Miss Islington (bot)
28f275f713
[3.15] gh-86533: Restore os.makedirs() ability to apply *mode* recursively (GH-150011) (#150036)
bpo-42367: Restore os.makedirs() and pathlib.mkdir() ability to apply *mode* recursively via a new parent_mode= keyword argument.
(cherry picked from commit 9770e32ce0)

+ Make Path.mkdir parent_mode tests umask-independent

test_mkdir_with_parent_mode, test_mkdir_parent_mode_deep_hierarchy and
test_mkdir_parent_mode_same_as_mode assert exact directory mode bits but
did not pin the process umask.  On buildbots running with a restrictive
umask (e.g. 0o077) the 0o755 leaf was masked down to 0o700, failing the
assertions.  Wrap them in os_helper.temp_umask(0o022), matching the
other umask-aware mkdir tests in this file.

---------

Co-authored-by: nessita <124304+nessita@users.noreply.github.com>
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2026-05-18 22:10:01 -07:00
Miss Islington (bot)
d36e08099d
[3.15] gh-149816: fix dict.clear() race on split-table dict with non-embedded values (GH-149914) (#150000)
gh-149816: fix `dict.clear()` race on split-table dict with non-embedded values (GH-149914)
(cherry picked from commit 1692854706)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-05-19 10:12:25 +05:30
Dino Viehland
94c8bac2cd
[3.15] gh-148587: Make sys.lazy_modules match PEP and keep internal lazy submodules tra… (#150014)
Make sys.lazy_modules match PEP and keep internal lazy submodules tracking internal
2026-05-18 17:53:54 -07:00
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)
176d0f51cf
[3.15] gh-149801: Add IANA registered names and aliases with leading zeros (GH-149804) (GH-149870)
Like IBM00858, CP00858, IBM01140, CP01140.
(cherry picked from commit 20438866ae)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-15 15:08:15 +03: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)
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
deadlovelll
6a66005699
[3.15] gh-149694: Fix missing docstring on asyncio.iscoroutinefunction (#149696) 2026-05-12 22:52:36 +05:30
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)
4277df2421
[3.15] gh-146061: Clarify indent=None in json docs (GH-146095) (GH-149667)
(cherry picked from commit 833dae7c1f)

Co-authored-by: Jonathan Dung <jonathandung@yahoo.com>
2026-05-11 11:44:11 +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)
1162834c0e
[3.15] gh-139489: Add is_valid_text to xml.__all__ (GH-149641) (#149652)
gh-139489: Add is_valid_text to xml.__all__ (GH-149641)
(cherry picked from commit b45319e132)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2026-05-10 21:11:04 +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)
915b6c1572
[3.15] gh-149083: Convert _initial_missing for pure py reduce to sentinel (GH-149536) (#149592)
gh-149083: Convert `_initial_missing` for pure py `reduce` to `sentinel` (GH-149536)
(cherry picked from commit bc8cf07d8d)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-05-09 08:27:29 +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