Commit graph

55600 commits

Author SHA1 Message Date
Miss Islington (bot)
82ebdd207f
[3.14] GH-139436: Remove PDF and CHM from IDLE HelpSource (GH-140418) (#142552)
GH-139436: Remove PDF and CHM from IDLE HelpSource (GH-140418)
(cherry picked from commit c5825ff4c9)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-12-11 02:18:36 +00:00
Miss Islington (bot)
cc705be468
gh-140172: Skip JSON tools test during PGO training (GH-140809)
(cherry picked from commit fa448451ab)

Co-authored-by: Steve Dower <steve.dower@python.org>
2025-12-11 01:01:59 +00:00
Miss Islington (bot)
cbec73cf63
[3.14] gh-142489: Increase ssl_handshake_timeout in asyncio tests (GH-142523) (#142545)
gh-142489: Increase ssl_handshake_timeout in asyncio tests (GH-142523)

Replace SHORT_TIMEOUT with LONG_TIMEOUT for very slow CIs.
And add the HANDSHAKE_TIMEOUT constant.
(cherry picked from commit dc3ece2bc0)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-12-10 22:46:35 +00:00
Serhiy Storchaka
dafac8a47a
[3.14] gh-112527: Fix help text for required options in argparse (GH-112528) (GH-142475)
For optional arguments with required=True, the ArgumentDefaultsHelpFormatter
would always add a " (default: None)" to the end of the help text.
Since that's a bit misleading, it is removed with this commit.
(cherry picked from commit 1adb17b1a2)

Co-authored-by: Fabian Henze <32638720+henzef@users.noreply.github.com>
2025-12-09 17:35:49 +00:00
Miss Islington (bot)
5d5d92b62f
[3.14] gh-105836: Fix asyncio.run_coroutine_threadsafe leaving underlying cancelled asyncio task running (GH-141696) (#142358)
gh-105836: Fix `asyncio.run_coroutine_threadsafe` leaving underlying cancelled asyncio task running (GH-141696)
(cherry picked from commit 14715e3a64)

Co-authored-by: Kaisheng Xu <iaalmsimon@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-12-09 20:16:05 +05:30
Miss Islington (bot)
19968c8927
[3.14] gh-142282 Fix winreg.QueryValueEx() under race condition (GH-142283) (GH-142453)
(cherry picked from commit 3ec941b364)

Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com>
2025-12-09 12:33:35 +00:00
Miss Islington (bot)
f200776b13
[3.14] gh-68552: fix defects policy (GH-138579) (#142366)
Co-authored-by: Ivo Bellin Salarin <nilleb@users.noreply.github.com>
Co-authored-by: Martin Panter <vadmium@users.noreply.github.com>
Co-authored-by: Ivo Bellin Salarin <ivo@nilleb.com>
2025-12-09 07:39:01 +00:00
Miss Islington (bot)
9bb27cd105
[3.14] gh-140125: Increase object recursion depth for test_json from 200k to 500k (GH-142226) (#142416)
gh-140125: Increase object recursion depth for `test_json` from 200k to 500k (GH-142226)
(cherry picked from commit e3539e99e3)

Co-authored-by: Zanie Blue <contact@zanie.dev>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-12-08 13:31:56 +00:00
Miss Islington (bot)
d2f5a0e72e
[3.14] gh-141794: Reduce size of compiler stress tests to fix Android warnings (GH-142263) (#142386)
gh-141794: Reduce size of compiler stress tests to fix Android warnings (GH-142263)
(cherry picked from commit f193c8fe9e)

Co-authored-by: Malcolm Smith <smith@chaquo.com>
2025-12-08 09:58:21 +02:00
Miss Islington (bot)
7308015d9c
[3.14] gh-142346: Fix usage formatting for mutually exclusive groups in argparse (GH-142381) (GH-142385)
Support groups preceded by positional arguments or followed or intermixed
with other optional arguments. Support empty groups.
(cherry picked from commit 1db9f56bff)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-12-07 20:03:05 +00:00
Miss Islington (bot)
b188ebeca0
[3.14] gh-142006: Fix HeaderWriteError in email.policy.default caused by extra newline (GH-142008) (#142361)
gh-142006: Fix HeaderWriteError in email.policy.default caused by extra newline (GH-142008)

RDM: This fixes a subtle folding error that showed up when a token exactly filled a line and was followed by whitespace and a token with no folding whitespace that was longer than a line.  In this particular circumstance the whitespace after the first token got pushed on to the next line, and then stolen to go in front of the next unfoldable token...leaving a completely empty line in the line buffer.  That line got turned in to a newline, which is RFC illegal, and the newish security check caught it.  The fix is to just delete that empty line from the buffer.
(cherry picked from commit 07eff899d8)

Co-authored-by: Paresh Joshi <rahulj9223@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2025-12-06 16:39:47 -05:00
Miss Islington (bot)
1dfe219fec
[3.14] gh-142332: Fix usage formatting for positional arguments in mutually exclusive groups in argparse (GH-142333) (GH-142356)
(cherry picked from commit 70c27ce94b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-12-06 18:28:54 +00:00
Miss Islington (bot)
4556b9e7dc
[3.14] GH-75949: Fix argparse dropping '|' in mutually exclusive groups on line wrap (GH-142312) (#142347) 2025-12-06 15:37:34 +00:00
Miss Islington (bot)
95d19fc5b6
[3.14] Docs: fix RFC index reference for TLS 1.3 (GH-142262) (#142340)
Docs: fix RFC index reference for TLS 1.3 (GH-142262)
(cherry picked from commit 61823a5382)

Co-authored-by: Y. Z. Chen <754097987@qq.com>
2025-12-06 14:51:08 +00:00
Hugo van Kemenade
66d1d7ed37 Merge branch '3.14' of https://github.com/python/cpython into 3.14 2025-12-05 22:00:48 +02:00
Miss Islington (bot)
37c6dd1c91
[3.14] GH-142267: Cache formatter to avoid repeated _set_color calls (GH-142268) (#142313)
GH-142267: Cache formatter to avoid repeated `_set_color` calls (GH-142268)
(cherry picked from commit 4085ff7b32)

Co-authored-by: Savannah Ostrowski <savannah@python.org>
2025-12-05 17:14:56 +00:00
Hugo van Kemenade
df793163d5 Python 3.14.2 2025-12-05 18:49:16 +02:00
Hugo van Kemenade
4cb6cbb6fa
[3.14] Revert "gh-140797: Forbid capturing groups in re.Scanner lexicon patterns (GH-140944) (GH-140982)" (#142309) 2025-12-05 16:45:15 +00:00
Miss Islington (bot)
d8b1ce10bd
[3.14] Add explanation comments for tests for overlapped ZIP entries (GH-137152) (GH-142310)
(cherry picked from commit 100c726d98)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-12-05 16:35:21 +00:00
Miss Islington (bot)
8fd39c0e51
[3.14] gh-140482: Avoid changing terminal settings in test_pty (gh-142202) (gh-142239)
The previous test_spawn_doesnt_hang test had a few problems:

* It would cause ENV CHANGED failures if other tests were running
  concurrently due to stty changes
* Typing while the test was running could cause it to fail
(cherry picked from commit c0c65141b3)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-12-05 11:18:40 -05:00
Serhiy Storchaka
0e4f4f1a46
[3.14] gh-119452: Fix a potential virtual memory allocation denial of service in http.server (GH-142216)
The CGI server on Windows could consume the amount of memory specified
in the Content-Length header of the request even if the client does not
send such much data. Now it reads the POST request body by chunks,
therefore the memory consumption is proportional to the amount of sent
data.
2025-12-05 16:20:23 +02:00
Petr Viktorin
f130b06da3
[3.14] gh-142206: multiprocessing.resource_tracker: Decode messages using older protocol (GH-142215) (GH-142285)
(cherry picked from commit 4172644d78)

Difference from the original commit: the default in 3.14 is to use
the simpler original protocol (except for filenames with newlines).

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-12-05 12:47:30 +01:00
Miss Islington (bot)
654e3c7435
[3.14] gh-142214: Fix two regressions in dataclasses (GH-142223) (#142277)
gh-142214: Fix two regressions in dataclasses (GH-142223)
(cherry picked from commit 53ec7c8fc0)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-12-05 08:08:15 +00:00
Miss Islington (bot)
88e1f695f3
[3.14] gh-129483: Make TestLocalTimeDisambiguation's time format locale independent (GH-142193) (#142258)
gh-129483: Make `TestLocalTimeDisambiguation`'s time format locale independent (GH-142193)

* Change to update %c to the exact time format.

---------
(cherry picked from commit 8392095bf9)

Co-authored-by: Kir Chou <148194051+gkirchou@users.noreply.github.com>
Co-authored-by: Kir Chou <note351@hotmail.com>
2025-12-04 14:03:36 +00:00
Miss Islington (bot)
319c6a2ae1
[3.14] gh-142218: Fix split table dictionary crash (gh-142229) (gh-142244)
This fixes a regression introduced in gh-140558. The interpreter would
crash if we inserted a non `str` key into a split table that matches an
existing key.
(cherry picked from commit 547d8daf78)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-12-04 00:03:18 +00:00
Miss Islington (bot)
027f21e417
[3.14] gh-142145: Remove quadratic behavior in node ID cache clearing (GH-142146) (#142209)
gh-142145: Remove quadratic behavior in node ID cache clearing (GH-142146)

* Remove quadratic behavior in node ID cache clearing



* Add news fragment

---------
(cherry picked from commit 08d8e18ad8)

Co-authored-by: Seth Michael Larson <seth@python.org>
Co-authored-by: Jacob Walls <38668450+jacobtylerwalls@users.noreply.github.com>
2025-12-03 19:09:44 +00:00
Hugo van Kemenade
57e0d177c2 Python 3.14.1 2025-12-02 14:51:37 +02:00
Hugo van Kemenade
49fe7574d9
[3.14] Revert "gh-119452: Fix a potential virtual memory allocation denial of service in http.server (GH-119455)" (#142184)
Fix a potential virtual memory allocation denial of service in http.server (GH-119455)"
2025-12-02 12:06:25 +00:00
Miss Islington (bot)
15a25f44ee
[3.14] gh-59000: Fix pdb breakpoint resolution for class methods when module not imported (GH-141949) (#142171)
gh-59000: Fix pdb breakpoint resolution for class methods when module not imported (GH-141949)
(cherry picked from commit 5e58548ebe)

Co-authored-by: LloydZ <35182391+cocolato@users.noreply.github.com>
2025-12-02 05:06:26 +00:00
Hugo van Kemenade
7642070807
[3.14] Revert "GH-91636: Clear weakrefs created by finalizers. (GH-136401) (#141993)" (#142152) 2025-12-01 20:34:37 +02:00
Miss Islington (bot)
4ce27904b5
[3.14] gh-119451: Fix a potential denial of service in http.client (GH-119454) (#142138)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-12-01 20:34:09 +02:00
Miss Islington (bot)
afce34fbf0
[3.14] gh-141930: Use the regular IO stack to write .pyc files for a better error message on failure (GH-141931) (#142021)
Co-authored-by: Stefano Rivera <stefano@rivera.za.net>
2025-12-01 18:43:50 +02:00
Miss Islington (bot)
b64441e485
[3.14] gh-119342: Fix a potential denial of service in plistlib (GH-119343) (GH-142143)
Reading a specially prepared small Plist file could cause OOM because file's
read(n) preallocates a bytes object for reading the specified amount of
data. Now plistlib reads large data by chunks, therefore the upper limit of
consumed memory is proportional to the size of the input file.
(cherry picked from commit 694922cf40)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-12-01 15:54:58 +00:00
Serhiy Storchaka
29c657a1f2
[3.14] gh-119452: Fix a potential virtual memory allocation denial of service in http.server (GH-119455)
The CGI server on Windows could consume the amount of memory specified
in the Content-Length header of the request even if the client does not
send such much data. Now it reads the POST request body by chunks,
so that the memory consumption is proportional to the amount of sent
data.
2025-12-01 12:59:09 +00:00
Hugo van Kemenade
b95d16a338
[3.14] gh-133146: Add the old public get_value method to documentation and refactor code. (GH-133301) (#142110)
also uses it within the internals in a few places.
(cherry picked from commit db098a475a)

Co-authored-by: Duprat <yduprat@gmail.com>
2025-11-30 13:06:56 -08:00
Miss Islington (bot)
52731c4e62
[3.14] gh-140373: Correctly emit PY_UNWIND event when generator is closed (GH-140767) (#140816)
Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
2025-11-30 14:35:14 +02:00
Miss Islington (bot)
848a2ebe53
[3.14] gh-136063: fix quadratic-complexity parsing in email.message._parseparam (GH-136072) (#140827)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-11-30 14:30:56 +02:00
Miss Islington (bot)
fed2af6f9e
[3.14] GH-91636: Clear weakrefs created by finalizers. (GH-136401) (#141993)
GH-91636: Clear weakrefs created by finalizers. (GH-136401)

Weakrefs to unreachable garbage that are created during running of
finalizers need to be cleared.  This avoids exposing objects that
have `tp_clear` called on them to Python-level code.
(cherry picked from commit b6b99bf7f1)

Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
2025-11-28 23:34:36 -08:00
Itamar Oren
f7d17ac9f8
[3.14] gh-140011: Delete importdl assertion that prevents importing embedded modules from packages (GH-141605) (#141986)
gh-140011: Delete importdl assertion that prevents importing embedded modules from packages (GH-141605)

(cherry picked from commit 27f62eb711)
2025-11-28 23:30:57 -08:00
Miss Islington (bot)
20b910ca8b
[3.14] Fix multiprocessing queue test_get() (GH-142024) (#142070)
Fix multiprocessing queue test_get() (GH-142024)

* Replace sleep() with support.sleeping_retry().
* Test get_nowait() first.
* Restore previously disabled test.

Fix the failure:

FAIL: test_get (test.test_multiprocessing_spawn.test_processes.WithProcessesTestQueue.test_get)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "Lib/test/_test_multiprocessing.py", line 1208, in test_get
    self.assertEqual(queue_empty(queue), False)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: True != False
(cherry picked from commit 5e749d3743)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-11-29 07:25:46 +00:00
Miss Islington (bot)
6b799e1591
[3.14] gh-74389: gh-70560: subprocess.Popen.communicate() now ignores stdin.flush error when closed (GH-142061) (#142064)
gh-74389: gh-70560: subprocess.Popen.communicate() now ignores stdin.flush error when closed (GH-142061)

gh-70560: gh-74389: subprocess.Popen.communicate() now ignores stdin.flush error when closed

with a unittest and news entry.
(cherry picked from commit 923056b2d4)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2025-11-28 23:03:05 -08:00
Miss Islington (bot)
c7f741100b
[3.14] gh-87512: Fix subprocess using timeout= on Windows blocking with a large input= (GH-142058) (#142068)
gh-87512: Fix `subprocess` using `timeout=` on Windows blocking with a large `input=` (GH-142058)

On Windows, Popen._communicate() previously wrote to stdin synchronously, which could block indefinitely if the subprocess didn't consume input= quickly and the pipe buffer filled up. The timeout= parameter was only checked when joining the reader threads, not during the stdin write.

This change moves the Windows stdin writing to a background thread (similar to how stdout/stderr are read in threads), allowing the timeout to be properly enforced. If timeout expires, TimeoutExpired is raised promptly and the writer thread continues in the background. Subsequent calls to communicate() will join the existing writer thread.

Adds test_communicate_timeout_large_input to verify that TimeoutExpired is raised promptly when communicate() is called with large input and a timeout, even when the subprocess doesn't consume stdin quickly.

This test already passed on POSIX (where select() is used) but failed on Windows where the stdin write blocks without checking the timeout.
(cherry picked from commit 5b1862bdd8)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-11-29 06:47:04 +00:00
Miss Islington (bot)
476089479d
[3.14] gh-141473: Fix subprocess.Popen.communicate to send input to stdin upon a subsequent post-timeout call (GH-141477) (#142059)
gh-141473: Fix subprocess.Popen.communicate to send input to stdin upon a subsequent post-timeout call (GH-141477)

* gh-141473: Fix subprocess.Popen.communicate to send input to stdin
* Docs: Clarify that `input` is one time only on `communicate()`
* NEWS entry
* Add a regression test.

---------
(cherry picked from commit 526d7a8bb4)

Co-authored-by: Artur Jamro <artur.jamro@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-11-28 22:21:43 -08:00
Miss Islington (bot)
c1d3e2523b
[3.14] GH-134453: Fix subprocess memoryview input handling on POSIX (GH-134949) (#142062)
GH-134453: Fix subprocess memoryview input handling on POSIX (GH-134949)

Fix inconsistent subprocess.Popen.communicate() behavior between Windows
and POSIX when using memoryview objects with non-byte elements as input.

On POSIX systems, the code was incorrectly comparing bytes written against
element count instead of byte count, causing data truncation for large
inputs with non-byte element types.

Changes:
- Cast memoryview inputs to byte view when input is already a memoryview
- Fix progress tracking to use len(input_view) instead of len(self._input)
- Add comprehensive test coverage for memoryview inputs

🤖 Generated with [Claude Code](https://claude.ai/code)



* old-man-yells-at-ReST
* Update 2025-05-30-18-37-44.gh-issue-134453.kxkA-o.rst
* assertIsNone review feedback
* fix memoryview_nonbytes test to fail without our fix on main, and have a nicer error.

Thanks to Peter Bierma @ZeroIntensity for the code review.
(cherry picked from commit cc6bc4c97f)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2025-11-29 04:52:14 +00:00
Stan Ulbrych
64d6bde38f
[3.14] gh-98896: resource_tracker: use json&base64 to allow arbitrary shared memory names (GH-138473) (GH-141922)
Co-authored-by: Rani Pinchuk <33353578+rani-pinchuk@users.noreply.github.com>
2025-11-27 13:17:39 +01:00
Miss Islington (bot)
f47e928574
[3.14] gh-116738: Fix thread-safety issue in re module for free threading (gh-141923) (gh-141990)
Added atomic operations to `scanner_begin()` and `scanner_end()` to prevent
race conditions on the `executing` flag in free-threaded builds. Also added
tests for concurrent usage of the `re` module.

Without the atomic operations, `test_scanner_concurrent_access()` triggers
`assert(self->executing)` failures, or a thread sanitizer run emits errors.
(cherry picked from commit bc9e63dd9d)

Co-authored-by: Alper <alperyoney@fb.com>
2025-11-26 21:08:39 +00:00
Miss Islington (bot)
9969c4280f
[3.14] gh-140911: Ensure that UserString.index() and UserString.rindex() accept UserString as argument (GH-140945) (GH-141946)
(cherry picked from commit e6174ee981)

Co-authored-by: Krishna Chaitanya <141550576+XChaitanyaX@users.noreply.github.com>
2025-11-25 13:56:05 +00:00
Miss Islington (bot)
add73fdda0
[3.14] gh-141907: Better handle support for SHA3 for test_hashlib (GH-141908) (#141918)
gh-141907: Better handle support for SHA3 for test_hashlib (GH-141908)

* test_hashlib: better handle support for SHA3

It's possible that the SSL library supports only SHA3 algo and doesn't
have SHAKE one.

The current test wrongly detect this and set both HASH and HASHXOF to
None expecting to have the extra SHA3 attributes present but this should
only be true for SHAKE algo.

To better handle this, move the HASH condition to a dedicated try-expect
condition and check if HASHXOF is None in the relevant code effectively
checking if SHA3 is supported by the SSL library but SHAKE algo needs to
use the sha3module one.

---------
(cherry picked from commit fee7782650)

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Co-authored-by: Christian Marangi <ansuelsmth@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-11-25 02:20:35 +01:00
Miss Islington (bot)
7ccdbbd04e
[3.14] Fix implicit import in test_monitoring.py (gh-141795) (gh-141920)
(cherry picked from commit 369ce2b139)

Co-authored-by: SubbaraoGarlapati <53627478+SubbaraoGarlapati@users.noreply.github.com>
2025-11-24 20:19:20 +00:00
Miss Islington (bot)
f8b0c90208
[3.14] gh-129441: Fix some flakiness in test_instrumentation (gh-141881) (gh-141913)
Most of the `self.assertTrue(self.called)` checks are flaky because
the worker threads may sometimes finish before the main thread calls
`self.during_threads()`.
(cherry picked from commit 71126ab19c)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-11-24 16:44:54 +00:00