127149 Commits

Author SHA1 Message Date
Miss Islington (bot)
a1b6252c88
[3.14] gh-133678: Document C API third party tools (GH-134526) (#134793)
gh-133678: Document C API third party tools (GH-134526)
(cherry picked from commit c3c88064f5905889057dcdfaaaa4a48f8e2d53d4)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Steve Dower <steve.dower@python.org>
2025-05-27 15:45:08 +00:00
Mark Shannon
00122c8b2a
[3.14] GH-128161: Remove redundant GET_ITER from list comprehension code (GH-134778) 2025-05-27 12:29:48 +01:00
Miss Islington (bot)
266b541cc6
[3.14] gh-62824: Adjust test_alias_modules_exist test to use imports instead of file checks (GH-134777) (GH-134781)
gh-62824: Adjust test_alias_modules_exist test to use imports instead of file checks (GH-134777)
(cherry picked from commit 8704d6b39139d2b1c3dd871590188fb7deb8aaad)

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
2025-05-27 11:28:30 +02:00
Miss Islington (bot)
58549cfd49
[3.14] gh-134210: handle signals in _curses.window.getch (GH-134326) (#134783)
gh-134210: handle signals in `_curses.window.getch` (GH-134326)
(cherry picked from commit 51762b6cadb8f316dd783716bc5c168c2e2d07f0)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-05-27 09:16:50 +00:00
Miss Islington (bot)
452d098c0b
[3.14] gh-134752: Improve speed of test_tokenize.StringPrefixTest.test_prefixes. (GH-134766) (#134782)
gh-134752: Improve speed of test_tokenize.StringPrefixTest.test_prefixes. (GH-134766)
(cherry picked from commit 579686d9fb1bccc74c694d569f0a8bf28d9ca85a)

Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
2025-05-27 09:16:23 +00:00
Miss Islington (bot)
0f93b2f862
[3.14] gh-134664: document cleanup_socket parameter in asyncio.start_unix_server (GH-134750) (#134779)
gh-134664: document `cleanup_socket` parameter in `asyncio.start_unix_server` (GH-134750)
(cherry picked from commit 92ea1eb38ff97ac046a0031d505c30a51f58a43f)

Co-authored-by: Shamil <ashm.tech@proton.me>
2025-05-27 14:04:43 +05:30
Miss Islington (bot)
b6e624a3fc
[3.14] gh-134160: Use multi-phase init in documentation examples (GH-134296) (#134753)
gh-134160: Use multi-phase init in documentation examples (GH-134296)
(cherry picked from commit 96905bdd273d2e5724d2c1b6b0f95ecb0daeaabe)

Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-26 21:50:18 +00:00
Eric Snow
e86efabaee
[3.14] gh-132775: Unrevert "Use _PyCode GetScriptXIData()" (gh-134736)
This reverts commit 7476f90af2cf9207c792c0dc3ee9a5ca7b4fabfa, AKA gh-134600.

This effectively unreverts commit bbf8048c0f9c (gh-134515).
2025-05-26 19:41:14 +00:00
Miss Islington (bot)
74f5667bd9
[3.14] gh-134675: Add t-string prefixes to tokenizer module, lexical analysis doc, and add a test to make sure we catch this error in the future. (GH-134734) (#134739)
gh-134675: Add t-string prefixes to tokenizer module, lexical analysis doc, and add a test to make sure we catch this error in the future. (GH-134734)

* Add t-string prefixes to _all_string_prefixes, and add a test to make sure we catch this error in the future.

* Update lexical analysis docs for t-string prefixes.
(cherry picked from commit 08c78e02fab4a1c9c075637422d621f9c740959a)

Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
2025-05-26 15:24:24 -04:00
Miss Islington (bot)
c6cc28299e
[3.14] gh-134557: Suppress immortalization in _PyCode_GetScriptXIData under free-threading (gh134738)
Disable immortalization around Py_CompileString*().

The same approach as 332356b that fixed the refleaks in compile() and eval().

E: 09e72cf can pass test_capi, test_sys and test__interpchannels with this patch for me.

(cherry picked from commit c60f39ada625562bff26400f304690c19fe9f504, AKA gh-134686)

Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
2025-05-26 13:14:58 -06:00
Hugo van Kemenade
bc3d892113 Merge branch '3.14' of https://github.com/python/cpython into 3.14 2025-05-26 21:51:15 +03:00
Miss Islington (bot)
8c699015c5
[3.14] gh-134637: Fix performance regression in calling ctypes function pointer in free threading. (GH-134702) (#134742)
gh-134637: Fix performance regression in calling `ctypes` function pointer in `free threading`. (GH-134702)

Fix performance regression in calling `ctypes` function pointer in `free threading`.
(cherry picked from commit 3c0525126ef95efe2f578e93db09f3282e3ca08f)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-05-26 18:51:13 +00:00
Hugo van Kemenade
cde768cd63 Post 3.14.0b2 2025-05-26 21:50:01 +03:00
Miss Islington (bot)
b187e9403c
[3.14] Add CODEOWNERS and YAML to end-of-file-fixer and trailing-whitespace (GH-134730) (#134737) 2025-05-26 18:08:37 +00:00
Miss Islington (bot)
9ddc7c548d
[3.14] gh-119180: Updates to PEP 649/749 docs (GH-134640) (#134731)
gh-119180: Updates to PEP 649/749 docs (GH-134640)

- Mention (again) that `type.__annotations__` is unsafe. It is now safe
  when using only classes defined under PEP 649 semantics, but not with
  classes defined using `from __future__ import annotations`.
- Mention that annotations on instances no longer work. There was already
  an issue about this.
- Mention the general changes in the "Porting to Python 3.14" section.
- `annotationlib` was proposed by PEP-749, not PEP-649.
(cherry picked from commit 7291eaba8b20b19e7971d43d88286d5820e5eb56)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Emma Smith <emma@emmatyping.dev>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2025-05-26 15:40:43 +00:00
Miss Islington (bot)
2a089244f0
[3.14] gh-134693: Fix [-Wmaybe-uninitialized] warning in _remote_debugging_module.c (GH-134694) (#134726)
gh-134693: Fix `[-Wmaybe-uninitialized]` warning in `_remote_debugging_module.c` (GH-134694)
(cherry picked from commit 806107d7a2fa9baa76d4025f46fab2c8725963f4)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-05-26 15:32:52 +00:00
Miss Islington (bot)
aded785b8c
[3.14] gh-91048: Add better error messages for remote debugging for CI builds (GH-134682) (#134719) 2025-05-26 15:04:36 +00:00
Miss Islington (bot)
01ccc824ca
[3.14] Add CODEOWNERS for remote debugging (GH-134720) (#134721) 2025-05-26 15:46:51 +01:00
Hugo van Kemenade
12d3f883ae Python 3.14.0b2 v3.14.0b2 2025-05-26 16:26:47 +03:00
Miss Islington (bot)
6c917cb11c
[3.14] gh-91048: Correct Apple platform includes for iOS. (GH-134712) (#134714)
Correct Apple platform includes for iOS.
(cherry picked from commit 965662ee4a986605b60da470d9e7c1e9a6f922b3)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2025-05-26 13:10:37 +00:00
Miss Islington (bot)
da3d55403a
[3.14] gh-132710: add missing NEWS entry for GH-134697 (GH-134705) (#134707)
gh-132710: add missing NEWS entry for GH-134697 (GH-134705)
(cherry picked from commit 9eb84d83e00070cec3cfe78f1d0c7a7a0fbef30f)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-05-26 12:46:29 +02:00
Bénédikt Tran
072f50fc12
[3.14] gh-132710: only use stable _uuid.generate_time_safe() to deduce MAC address (GH-132901) (#134697)
(cherry picked from commit 3bffada46728e51f84c41ecbb0d3722595693e63)
2025-05-26 10:45:36 +00:00
Miss Islington (bot)
c8379c7edf
[3.14] gh-134559: Add versionadded for `object.__replace__()` (GH-134672) (#134699)
gh-134559: Add versionadded for ``object.__replace__()`` (GH-134672)
(cherry picked from commit 71290a6fbe79cef3773a3af6fcf08d8bf15c8460)

Co-authored-by: tmlnv <108088921+tmlnv@users.noreply.github.com>
2025-05-26 10:29:51 +00:00
Bénédikt Tran
ed52549c37
[3.14] gh-134208: remove dead AC directives for _curses.window.{chgat,getstr,instr} (GH-134325) (#134701)
(cherry picked from commit 29e81159644cf78d958e30aaef208e22a04a8b25)
2025-05-26 10:09:02 +00:00
Miss Islington (bot)
dc441efbd0
[3.14] gh-132493: Remove __annotations__ usage in inspect._signature_is_functionlike (GH-133415) (#133796)
gh-132493: Remove __annotations__ usage in inspect._signature_is_functionlike (GH-133415)

This check is potentially problematic because it could force evaluation of
annotations unnecessarily. This doesn't trigger for builtin objects (functions,
classes, or modules) with annotations, but it could trigger for third-party objects.

The check was not particularly useful anyway, because it succeeds if ``__annotations__``
is a dict or None, so the only thing this did was guard against objects that have an
``__annotations__`` attribute that is of some other type. That doesn't seem particularly
useful, so I just removed the check.
(cherry picked from commit cb6596c6aa30c8c3213c8746d5590e6e2757a6c1)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-05-26 08:22:14 +00:00
Miss Islington (bot)
1ce68f6297
[3.14] gh-134152: Fix UnboundLocalError in email._header_value_parser _get_ptext_to_endchars (GH-134233) (#134678)
Co-authored-by: R. David Murray <rdmurray@bitdance.com>
2025-05-26 11:02:52 +03:00
Miss Islington (bot)
ebfd18b3f0
[3.14] gh-127833: lexical analysis: Improve section on Names (GH-131474) (#134423)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Blaise Pabon <blaise@gmail.com>
2025-05-26 11:00:17 +03:00
Miss Islington (bot)
16187b58bf
[3.14] gh-132876: workaround broken ldexp() on Windows 10 (GH-133135) (#134684)
gh-132876: workaround broken ldexp() on Windows 10 (GH-133135)

* gh-132876: workaround broken ldexp() on Windows 10

ldexp() fails to round subnormal results before Windows 11,
so hide their bug.
(cherry picked from commit cf8941c60356acdd00055e5583a2d64761c34af4)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Tim Peters <tim.peters@gmail.com>
2025-05-25 22:23:45 -05:00
Miss Islington (bot)
7216f7b59c
[3.14] gh-69605: Disable PyREPL module autocomplete fallback on regular completion (gh-134181) (gh-134680)
(cherry picked from commit 0e3bc962c6462f836751e35ef35fa837fd952550)

Co-authored-by: Loïc Simon <loic.simon@napta.io>
2025-05-25 23:33:02 +00:00
Pablo Galindo Salgado
1822f33b1a
[3.14] gh-91048: Refactor and optimize remote debugging module (#134652) (#134673)
gh-91048: Refactor and optimize remote debugging module (#134652)

Completely refactor Modules/_remote_debugging_module.c with improved
code organization, replacing scattered reference counting and error
handling with centralized goto error paths. This cleanup improves
maintainability and reduces code duplication throughout the module while
preserving the same external API.

Implement memory page caching optimization in Python/remote_debug.h to
avoid repeated reads of the same memory regions during debugging
operations. The cache stores previously read memory pages and reuses
them for subsequent reads, significantly reducing system calls and
improving performance.

Add code object caching mechanism with a new code_object_generation
field in the interpreter state that tracks when code object caches need
invalidation. This allows efficient reuse of parsed code object metadata
and eliminates redundant processing of the same code objects across
debugging sessions.

Optimize memory operations by replacing multiple individual structure
copies with single bulk reads for the same data structures. This reduces
the number of memory operations and system calls required to gather
debugging information from the target process.

Update Makefile.pre.in to include Python/remote_debug.h in the headers
list, ensuring that changes to the remote debugging header force proper
recompilation of dependent modules and maintain build consistency across
the codebase.

Also, make the module compatible with the free threading build as an extra :)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>

(cherry picked from commit 42b25ad4d3d6bcdc28ddfe07d2bf8831378bb0d1)
2025-05-25 22:10:20 +00:00
Miss Islington (bot)
f68f05cbe3
[3.14] gh-115999: Add PyCodeObject.co_tlbc to the debug offsets (GH-134286) (#134348)
gh-115999: Add PyCodeObject.co_tlbc to the debug offsets (GH-134286)
(cherry picked from commit dd7f1130570d50461b2a0f81ab01c55b9ce93700)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2025-05-25 21:16:10 +00:00
Miss Islington (bot)
f5a8bfa335
[3.14] Fix sphinx-lint warnings (default-role used). (GH-134647) (#134670)
Fix sphinx-lint warnings (default-role used). (GH-134647)
(cherry picked from commit 24a47155d2172966fab7d56f2bf9181056fba8d0)

Co-authored-by: Julien Palard <julien@palard.fr>
2025-05-25 19:29:04 +00:00
Miss Islington (bot)
6917fbf98f
[3.14] GH-130328: Fix WindowsConsoleGetEventTests after gh-133728 (gh-134660) (gh-134666)
(cherry picked from commit 1000283694136ee0538baa6c6b2eee662ee618d4)

Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
2025-05-25 18:43:07 +00:00
Miss Islington (bot)
9c6d2dbe26
[3.14] gh-133960: Improve typing.evaluate_forward_ref (GH-133961) (#134663)
gh-133960: Improve typing.evaluate_forward_ref (GH-133961)

As explained in GH-133960, this removes most of the behavior differences with ForwardRef.evaluate.
The remaining difference is about recursive evaluation of forwardrefs; this is practically useful
in cases where an annotation refers to a type alias that itself is string-valued.

This also improves several edge cases that were previously not handled optimally. For example,
the function now takes advantage of the partial evaluation behavior of ForwardRef.evaluate() to
evaluate more ForwardRefs in the FORWARDREF format.

This also fixes GH-133959 as a side effect, because the buggy behavior in GH-133959 derives from
evaluate_forward_ref().
(cherry picked from commit 57fef27cfc2bdfc1e3a65ef8c8a760198d15b14d)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-05-25 17:52:04 +00:00
Miss Islington (bot)
8c6653428f
[3.14] annotationlib docs: note that ForwardRef.evaluate eventually defaults to empty globals (GH-134661) (#134662)
annotationlib docs: note that ForwardRef.evaluate eventually defaults to empty globals (GH-134661)
(cherry picked from commit b51b08a0a5fedde4f74e4cc338b8b5ad9656ad50)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-05-25 10:39:44 -07:00
Miss Islington (bot)
c61fd7c0f2
[3.14] gh-134582: Fix t-strings untokenize() roundtrip removing space between braces (GH-134603) (#134659)
gh-134582: Fix t-strings untokenize() roundtrip removing space between braces (GH-134603)
(cherry picked from commit 52509cc94b1a18cb325dbfa7e5f830b32759a903)

Co-authored-by: Loïc Simon <loic.pano@gmail.com>
2025-05-25 16:48:19 +00:00
Miss Islington (bot)
cbf4ccf1d0
[3.14] gh-133684: Fix get_annotations() where PEP 563 is involved (GH-133795) (#134656)
gh-133684: Fix get_annotations() where PEP 563 is involved (GH-133795)
(cherry picked from commit 3e562b394252ff75d9809b7940020a775e4df68b)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-05-25 16:05:19 +00:00
Miss Islington (bot)
d82d445b18
[3.14] gh-133778: Fix setting __annotations__ under PEP 563 (GH-133794) (#134655)
gh-133778: Fix setting `__annotations__` under PEP 563 (GH-133794)
(cherry picked from commit 4443110c3409ecba9f0fd49495d039030cb7ed58)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-05-25 16:04:22 +00:00
Miss Islington (bot)
93aee568c0
[3.14] GH-130328: Speedup pasting in legacy console on Windows (gh-133728) (#134653)
(cherry picked from commit 91b48868a82821c1cbfd2245212699b57d3a24c7)

Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
2025-05-25 15:54:28 +02:00
Miss Islington (bot)
80d70defc2
[3.14] gh-134578: Mark more slow tests (GH-134579) (GH-134590)
(cherry picked from commit 77eade39f972a4f3d8e9fec00288779f35ceee21)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-24 15:06:54 +00:00
Bénédikt Tran
81f099375e
[3.14] gh-134168: fix http.server CLI support for IPv6 and --directory when serving over HTTPS (GH-134169) (#134630)
[3.14] gh-134168: fix `http.server` CLI support for IPv6 and `--directory` when serving over HTTPS (GH-134169)
(cherry picked from commit 2fd09b011031f3c00c342b44e02e2817010e507c)

Co-authored-by: ggqlq <124190229+ggqlq@users.noreply.github.com>
2025-05-24 15:34:31 +02:00
Miss Islington (bot)
162e3f3511
[3.14] gh-134595: Update HOWTO to reflect change in CIBW option (GH-134598) (#134622)
Co-authored-by: Jasper Wong <111284156+3willows@users.noreply.github.com>
2025-05-24 07:21:34 +00:00
Miss Islington (bot)
00fd5440f0
[3.14] gh-80334: fix multiprocessing.freeze_support for other spawn platforms (GH-134462) (#134619)
gh-80334: fix multiprocessing.freeze_support for other spawn platforms (GH-134462)

Doc/library/multiprocessing.rst: freeze_support: Change to specify spawn method instead of platform
Have multiprocessing.freeze_support() enable on spawn, not just win32.

---------
(cherry picked from commit 80284b5c5eebd0e603c38322f94a97a2853ceeba)

Co-authored-by: Eddy Mulyono <eddymul@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-05-24 04:16:02 +00:00
Miss Islington (bot)
de9444ef94
[3.14] gh-134546: ensure remote pdb script is readable (GH-134552) (#134616)
gh-134546: ensure remote pdb script is readable (GH-134552)
(cherry picked from commit 74a9c60f3ee2195e506144c3811090f1334c996b)

Co-authored-by: Anthony Sottile <asottile@umich.edu>
2025-05-24 03:34:17 +00:00
Miss Islington (bot)
576177d4b3
[3.14] gh-128840: Limit the number of parts in IPv6 address parsing (GH-128841) (#134610)
gh-128840: Limit the number of parts in IPv6 address parsing (GH-128841)

GH-128840: Limit the number of parts in IPv6 address parsing
Limit length of IP address string to 39

---------
(cherry picked from commit 47f1161d3a2bec52b5b5e952150141709c247da2)

Co-authored-by: Seth Michael Larson <seth@python.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-05-23 20:33:35 -07:00
Miss Islington (bot)
38a38243b7
[3.14] gh-132983: Make _zstd C code PEP 7 compliant (GH-134605) (#134609)
gh-132983: Make _zstd C code PEP 7 compliant (GH-134605)

Make _zstd C code PEP 7 compliant
(cherry picked from commit 973b8f69d31b4d86c37e0b7194a209f4f2efff06)

Co-authored-by: Emma Smith <emma@emmatyping.dev>
2025-05-24 02:28:40 +00:00
Miss Islington (bot)
f301af627e
[3.14] gh-132983: Slightly tweak error messages for _zstd compressor/decompressor options dict (GH-134601) (#134602)
gh-132983: Slightly tweak error messages for _zstd compressor/decompressor options dict (GH-134601)

Slightly tweak error messages for options dict
(cherry picked from commit f478331f98930d94f7efc741f3bed4b693d5cec1)

Co-authored-by: Emma Smith <emma@emmatyping.dev>
2025-05-23 22:18:08 +00:00
Eric Snow
7476f90af2
[3.14] gh-134557: Revert "[3.14] gh-132775: Use _PyCode GetScriptXIData()" (gh-134600)
This reverts commit bbf8048c0f9c, AKA gh-134515.

We are reverting due to refleaks on free-threaded builds.
2025-05-23 20:11:38 +00:00
Miss Islington (bot)
09a34f1f65
[3.14] gh-134381: Fix RuntimeError when starting not-yet started Thread after fork (gh-134514) (gh-134596)
(cherry picked from commit 9a2346df861f26d5f8d054ad2f9c37134dee3822)

Co-authored-by: Jiucheng(Oliver) <git.jiucheng@gmail.com>
2025-05-23 19:49:13 +00:00
Miss Islington (bot)
6e60586175
[3.14] gh-133454: Reduce the number of threads in test_racing_getbuf_and_releasebuf (GH-133458) (GH-134589)
The original reproducer only used 10 threads.
(cherry picked from commit fc0c9c24121c1a62b25b79062286f976699b59e9)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-23 17:23:47 +00:00