Commit graph

57157 commits

Author SHA1 Message Date
Serhiy Storchaka
2f9131575b
[3.15] gh-149489: Fix ElementTree serialization to HTML (GH-149490) (GH-150595)
* The content of comments, processing instructions and elements "xmp",
  "iframe", "noembed", "noframes", and "plaintext" is no longer escaped.
* The "plaintext" element no longer have the closing tag.
* Add support of empty attributes (with value None).
(cherry picked from commit bcd29e466f)
2026-05-29 21:48:10 +00:00
Miss Islington (bot)
863c7e0f9f
[3.15] gh-149056: Properly pass array_hook in json.load() to json.loads() (GH-149057) (GH-150591)
(cherry picked from commit f87d9605d3)

Co-authored-by: Thomas Kowalski <thom.kowa@gmail.com>
2026-05-29 21:30:50 +00:00
Miss Islington (bot)
b980552f34
[3.15] gh-150107: Fix asyncio sendfile fallback ignoring non-zero offset (GH-150270) (#150570)
gh-150107: Fix asyncio sendfile fallback ignoring non-zero offset (GH-150270)
(cherry picked from commit c72d5ea638)

Co-authored-by: Grant Herman <grantlouisherman041@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-05-29 18:40:56 +05:30
Miss Islington (bot)
77666483b7
[3.15] gh-150046: Fix test_add_python_opts to ignore PYTHON* env vars (GH-150089) (#150561)
gh-150046: Fix `test_add_python_opts` to ignore `PYTHON*` env vars (GH-150089)

Avoid the runtime environment from affecting the tests' behaviours,
which notably checks the warning filters which can be controlled by
various PYTHON environment variables.
(cherry picked from commit ef2246f788)

Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>
2026-05-28 17:15:27 +00:00
Miss Islington (bot)
f216c89631
[3.15] gh-84353: Preserve non-UTF-8 filenames when appending to ZipFile (GH-150091) (GH-150527)
Preserve non-UTF-8 filenames when appending to a ZipFile.

---------
(cherry picked from commit 24c6bbc92b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2026-05-27 21:47:03 +00:00
Miss Islington (bot)
cc6fea844f
[3.15] gh-150389: Make perf profiler tests resilient (GH-150437) (#150515) 2026-05-27 12:52:48 +00:00
Miss Islington (bot)
d2b10e75c7
[3.15] gh-149571: Fix the C implementation of Element.itertext() (GH-149929) (GH-150509)
It no longer emits text for comments and processing instructions.
(cherry picked from commit 7de4fcd445)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-27 10:52:02 +00:00
Miss Islington (bot)
528356eac0
[3.15] gh-150175: Fix ThreadingMock call_count race condition (GH-150176) (#150182)
gh-150175: Fix ThreadingMock call_count race condition (GH-150176)

ThreadingMock._increment_mock_call() was not thread-safe.
Multiple threads calling the mock simultaneously could lose
increments due to race conditions on call_count and other
attributes.

Fix by overriding _increment_mock_call in ThreadingMixin
and wrapping it with the existing _mock_calls_events_lock.
(cherry picked from commit 388e023fe1)

Co-authored-by: saisneha196 <156835592+saisneha196@users.noreply.github.com>
2026-05-26 12:46:16 -07:00
Miss Islington (bot)
79e17d7fa5
[3.15] gh-88726: Stop using non-standard charset names eucgb2312_cn and big5_tw in email (GH-149959) (GH-150491)
(cherry picked from commit 5e467f4331)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-26 19:21:36 +00:00
Pablo Galindo Salgado
d5381e18b8
[3.15] gh-149619: Harden _remote_debugging error paths (GH-150349) (#150435)
(cherry picked from commit a5be25d3bd)
2026-05-25 23:02:37 +00:00
Miss Islington (bot)
d23b06b2a8
[3.15] gh-150387: Fix hang in test_run_failed_script_live on slow buildbots (GH-150405) (#150420) 2026-05-25 18:46:19 +00:00
Serhiy Storchaka
4bdff2cc89
[3.15] gh-80198: Improve test_pwd and test_grp (GH-150380) (GH-150398)
Fix tests for non-existing names and ids when getpwall()/getgrall()
don't return all users/groups.

Add tests for out-of-range uids, integer float ids, bytes names,
null-terminated names, names with surrogates, empty names, excessive
arguments.
(cherry picked from commit 46e8f7a9e7)
2026-05-25 21:43:23 +03:00
Miss Islington (bot)
28037c2d11
[3.15] gh-145896: Fix typos and stale docstrings in the traceback module (GH-145897) (GH-150383)
(cherry picked from commit 832afeddce)

Co-authored-by: devdanzin <74280297+devdanzin@users.noreply.github.com>
2026-05-25 10:13:01 +00:00
Miss Islington (bot)
03244b9f04
[3.15] gh-150285: Fix too long docstrings in some Python modules (GH-150366) (GH-150375)
(cherry picked from commit 01c6d3d76b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-25 11:19:36 +03:00
Miss Islington (bot)
c95aa3aeb1
[3.15] gh-149449: Fix use-after-free in _PyUnicode_GetNameCAPI (GH-150323) (#150352)
gh-149449: Fix use-after-free in `_PyUnicode_GetNameCAPI` (GH-150323)
(cherry picked from commit 43c60ec2fd)

Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-05-25 07:05:24 +00:00
Serhiy Storchaka
739552caae
[3.15] gh-150285: Fix too long docstrings in the os module (GH-150296) (GH-150341)
(cherry picked from commit a5cb7c34dd)
2026-05-24 13:53:29 +00:00
Miss Islington (bot)
d3e2a133d2
[3.15] gh-150285: Fix too long docstrings in the zstd module (GH-150291) (GH-150335)
(cherry picked from commit 9fceb1c0c5)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-24 16:24:34 +03:00
Miss Islington (bot)
e8f534d1af
[3.15] gh-150285: Fix too long docstrings in the decimal module (GH-150288) (GH-150333)
(cherry picked from commit 6bed57a3b6)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-24 16:24:08 +03:00
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)
22c994cc92
[3.15] gh-149335: Avoid JIT trace buffer asserts with overhead above FITNESS_INITIAL (GH-149633) (#150245)
gh-149335: Avoid JIT trace buffer asserts with overhead above `FITNESS_INITIAL` (GH-149633)
(cherry picked from commit 441af3a934)

Co-authored-by: Hai Zhu <haiizhu@outlook.com>
2026-05-24 12:48:58 +05:30
Miss Islington (bot)
6f99363150
[3.15] gh-150258: Show relative percentage on Tachyon flamegraph (GH-150266) (#150312)
gh-150258: Show relative percentage on Tachyon flamegraph (GH-150266)

When running profiling, users rarely care about the global percentage of
the runtime. Often, they want to select a function and measure child
percentages relative to that.

This PR updates the flamegraph tooltips to show both "Percentage" and
"Relative Percentage" when the user clicks a specific function.
(cherry picked from commit fad0674605)

Co-authored-by: Eduardo Villalpando Mello <eduardovil@microsoft.com>
2026-05-23 15:30:19 +00:00
Miss Islington (bot)
8a162b2e27
[3.15] gh-148450: abc.register needs to update type_version when tp_flags is changed (GH-148623) (#150300)
gh-148450: `abc.register` needs to update `type_version` when `tp_flags` is changed (GH-148623)
(cherry picked from commit e7eaed5614)

Co-authored-by: Hai Zhu <haiizhu@outlook.com>
2026-05-23 08:53:12 +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
Miss Islington (bot)
3daf1fad7a
[3.15] gh-149189: Revert "Modern defaults for pprint (GH-149190)" (GH-150249) (#150268)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-05-22 20:49:36 +00:00
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)
e192a0ea52
[3.15] gh-137571: Protect against possible UnboundLocalError in gzip._GzipReader.read() (GH-150222) (GH-150229)
This has not been observed in practice, but we cannot be 100% sure that
it will not happen with some weird gzip data.
(cherry picked from commit 28eac9a726)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-22 09:46:14 +00:00
Miss Islington (bot)
b039d1bd97
[3.15] gh-133998: Fix gzip file creation when time is out of range (GH-134278) (GH-150221)
(cherry picked from commit 1daad8a163)

Co-authored-by: adang1345 <adang1345@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-22 07:48:42 +00:00
Miss Islington (bot)
591c4ffdd9
[3.15] gh-149995: Update typing.py docstrings and documentation (GH-149996) (#150215)
gh-149995: Update typing.py docstrings and documentation (GH-149996)

Some of these docstrings read as if they were written when typing.py was
first written, and things have evolved since then.

A few motivations:
- Call protocols protocols instead of ABCs. They are also ABCs, but the fact
  they are protocols is more relevant to typing.
- Avoid recommending direct use of .__annotations__ and steer users to
  annotationlib instead.
- For TypedDict, mention NotRequired before total=False since it is more
  general and probably more frequently useful.
- For overloads, mention runtime use first instead of stub use. I think early on
  there was talk of allowing overload only in stubs, but it is now heavily used at
  runtime too and that's more likely to be relevant to users.
(cherry picked from commit f159419ae2)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2026-05-22 06:41:43 +00:00
Miss Islington (bot)
233cf75d6d
[3.15] gh-149819: fix .pth and .start file processing in subprocess when inheriting PYTHONPATH (GH-150177) (#150202)
gh-149819: fix .pth and .start file processing in subprocess when inheriting PYTHONPATH (GH-150177)

* gh-149819: Fix .pth files not loaded in Python subprocesses

After PR gh-149583 (Fix double evaluation of .pth and .site files in
venvs), .pth files are no longer loaded in subprocesses started with
subprocess.run([sys.executable, ...]).  The root cause: main() seeds
known_paths from removeduppaths() with all sys.path entries inherited
from the parent process.  addsitedir() then skips .pth processing for
every directory already in known_paths.

Fix:
- main(): call removeduppaths() for dedup but start known_paths as a
  fresh empty set, so that addsitedir() processes .pth files in every
  site-packages directory regardless of inherited sys.path.
- addsitedir(): move known_paths.add() before the sys.path.append and
  guard the append with 'sitedir not in sys.path' to avoid creating
  duplicate entries when called with a fresh known_paths.

This preserves the gh-75723 dedup guarantee while allowing subprocesses
to load .pth files.

* Fill out the tests for GH#149888

* Extend _make_start() and _make_pth() to take an optional `basedir` which is used instead of
 `site.tmpdir` if given.
* Add test_pth_processed_when_sitedir_already_on_path() to test the core GH#149819 bug: .pth files
  in subprocesses aren't handled if PYTHONPATH pointing to the .pth directory is inherited.
* Similarly add test_start_processed_when_sitedir_already_on_path() to verify that .start files in
  the same circumstances are also now processed.

* Update Lib/site.py



* Oops!  Remove redundant code

---------
(cherry picked from commit 3c298e2e38)

Co-authored-by: Barry Warsaw <barry@python.org>
Co-authored-by: BugBounty Mind <bugbounty-mind@deepseek.tui>
Co-authored-by: scoder <stefan_ml@behnel.de>
2026-05-21 15:31:41 -07:00
Miss Islington (bot)
e6e3b9f490
[3.15] gh-107398: Fix tarfile stream mode exception when process the file with the gzip extra field (GH-126304) (GH-150199)
(cherry picked from commit 65f99329ed)

Co-authored-by: Nadeshiko Manju <me@manjusaka.me>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-21 20:02:10 +00:00
Miss Islington (bot)
9d042ad9ae
[3.15] gh-149219: Test frozendict in Lib/test/test_crossinterp.py (GH-149220) (#150186)
gh-149219: Test `frozendict` in `Lib/test/test_crossinterp.py` (GH-149220)
(cherry picked from commit c35b0f2b62)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-05-21 15:22:24 +00:00
sobolevn
a56a271000
[3.15] gh-149981: Test lazy import corner cases with module-level __getattr__ (GH-149982) (#150185)
(cherry picked from commit 6dbf4ba403)
2026-05-21 09:53:00 +00:00
Miss Islington (bot)
ca0da94f09
[3.15] gh-134261: ZipFile - Don't rely on local time for reproducible builds & tests (GH-134264) (#150137)
gh-134261: ZipFile - Don't rely on local time for reproducible builds & tests (GH-134264)

---------
(cherry picked from commit 9dcf94e906)

Co-authored-by: Caleb <23644849+ctrlaltf2@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Emma Smith <emma@emmatyping.dev>
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2026-05-20 19:49:13 +00:00
Miss Islington (bot)
61444f60a1
[3.15] gh-150146: Fix NULL dereference in _Py_subs_parameters (GH-150147) (#150153)
gh-150146: Fix NULL dereference in `_Py_subs_parameters` (GH-150147)
(cherry picked from commit f621ba16b7)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-05-20 13:55:30 +00:00
Miss Islington (bot)
9c2620964e
[3.15] gh-150034: Print JSONL filename when profiling finishes (GH-150035) (#150151) 2026-05-20 12:00:49 +00: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)
7f29fa5032
[3.15] gh-149807: Fix hash(frozendict): compute (key, value) pair hash (GH-149841) (#150149)
gh-149807: Fix hash(frozendict): compute (key, value) pair hash (GH-149841)
(cherry picked from commit 244300162d)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-05-20 11:51:54 +00:00
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