Commit graph

55124 commits

Author SHA1 Message Date
Eric V. Smith
579686d9fb
gh-134752: Improve speed of test_tokenize.StringPrefixTest.test_prefixes. (#134766) 2025-05-27 04:49:28 -04:00
Bénédikt Tran
737b4ba020
gh-134635: add zlib.{adler32,crc32}_combine to combine checksums (#134650) 2025-05-27 10:48:34 +02:00
Miro Hrončok
8704d6b391
gh-62824: Adjust test_alias_modules_exist test to use imports instead of file checks (#134777) 2025-05-27 10:25:12 +02:00
Eric Snow
56743afe87
gh-132775: Unrevert "Use _PyCode GetScriptXIData()" (gh-134735)
This reverts commit 8a793c4a36, AKA gh-134599.

This effectively re-applies commit 09e72cf (gh-134511)
2025-05-26 11:50:10 -06:00
Eric V. Smith
08c78e02fa
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. (#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.
2025-05-26 13:49:39 -04:00
Pablo Galindo Salgado
0909d6d8e8
gh-91048: Add better error messages for remote debugging for CI builds (#134682) 2025-05-26 15:31:47 +01:00
Bénédikt Tran
3bffada467
gh-132710: only use stable _uuid.generate_time_safe() to deduce MAC address (#132901) 2025-05-26 10:56:31 +02:00
Sergey B Kirpichev
cf8941c603
gh-132876: workaround broken ldexp() on Windows 10 (#133135)
* gh-132876: workaround broken ldexp() on Windows 10

ldexp() fails to round subnormal results before Windows 11,
so hide their bug.

Co-authored-by: Tim Peters <tim.peters@gmail.com>
2025-05-25 21:44:33 -05:00
Loïc Simon
0e3bc962c6
gh-69605: Disable PyREPL module autocomplete fallback on regular completion (gh-134181)
Co-authored-by: Loïc Simon <loic.simon@napta.io>
2025-05-26 01:05:08 +02:00
R. David Murray
a32ea45699
gh-134152: Fix UnboundLocalError in email._header_value_parser _get_ptext_to_endchars (#134233)
Fix an UnboundLocalError that can occur when parsing certain delimited constructs in headers (domain literals, quoted strings, comments). After the fix the _get_ptext_to_endchars returns an empty string if there is no content after the opening delimiter. The calling code is responsible for handling the lack of the trailing delimiter, which it already does; this edge case was the header ending immediately after the opening delimiter.
2025-05-25 18:09:32 -04:00
Pablo Galindo Salgado
42b25ad4d3
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>
2025-05-25 20:19:29 +00:00
Hugo van Kemenade
328a778db8
gh-134357: Remove unused imports in tests (#134340) 2025-05-25 20:09:02 +00:00
Chris Eibl
1000283694
GH-130328: Fix WindowsConsoleGetEventTests after gh-133728 (gh-134660) 2025-05-25 20:17:13 +02:00
Jelle Zijlstra
57fef27cfc
gh-133960: Improve typing.evaluate_forward_ref (#133961)
As explained in #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 #133959 as a side effect, because the buggy behavior in #133959 derives from
evaluate_forward_ref().
2025-05-25 17:26:39 +00:00
Loïc Simon
52509cc94b
gh-134582: Fix t-strings untokenize() roundtrip removing space between braces (#134603) 2025-05-25 17:23:38 +01:00
Jelle Zijlstra
3e562b3942
gh-133684: Fix get_annotations() where PEP 563 is involved (#133795) 2025-05-25 08:40:58 -07:00
Jelle Zijlstra
4443110c34
gh-133778: Fix setting __annotations__ under PEP 563 (#133794) 2025-05-25 08:38:18 -07:00
Chris Eibl
91b48868a8
GH-130328: Speedup pasting in legacy console on Windows (gh-133728) 2025-05-25 15:17:43 +02:00
ggqlq
2fd09b0110
gh-134168: fix http.server CLI support for IPv6 and --directory when serving over HTTPS (#134169) 2025-05-24 12:19:20 +00:00
Bénédikt Tran
5d9c8fe3f6
gh-131178: add E2E mockless tests for http.server command-line interface (#134279) 2025-05-24 13:48:50 +02:00
Eddy Mulyono
80284b5c5e
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.

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-05-24 03:50:19 +00:00
Anthony Sottile
74a9c60f3e
gh-134546: ensure remote pdb script is readable (#134552) 2025-05-23 23:07:39 -04:00
Seth Michael Larson
47f1161d3a
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

---------

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-24 02:57:13 +00:00
Emma Smith
f478331f98
gh-132983: Slightly tweak error messages for _zstd compressor/decompressor options dict (#134601)
Slightly tweak error messages for options dict
2025-05-23 14:51:41 -07:00
Eric Snow
8a793c4a36
gh-134557: Revert "gh-132775: Use _PyCode GetScriptXIData()" (gh-134599)
This reverts commit 09e72cf091, AKA gh-134511.

We are reverting due to refleaks on free-threaded builds.
2025-05-23 20:04:20 +00:00
Jiucheng(Oliver)
9a2346df86
gh-134381: Fix RuntimeError when starting not-yet started Thread after fork (gh-134514) 2025-05-23 15:22:14 -04:00
Serhiy Storchaka
393773ae87
gh-134565: Use ExceptionGroup to handle multiple errors in unittest.doModuleCleanups() (GH-134566) 2025-05-23 21:07:49 +03:00
Serhiy Storchaka
77eade39f9
gh-134578: Mark more slow tests (GH-134579) 2025-05-23 19:59:10 +03:00
Serhiy Storchaka
fc0c9c2412
gh-133454: Reduce the number of threads in test_racing_getbuf_and_releasebuf (GH-133458)
The original reproducer only used 10 threads.
2025-05-23 19:58:34 +03:00
Kumar Aditya
366d95d862
gh-133372: remove out of date todos from types module about generator wrapper (#134563) 2025-05-23 05:19:41 +00:00
Evgeny Demchenko
f9324cb3cb
gh-134451: Converted asyncio.tools.CycleFoundException from dataclass to a regular exception type. (#134513) 2025-05-23 05:15:21 +00:00
Kumar Aditya
5804ee7b46
gh-114177: avoid calling connection lost callbacks when loop is already closed in asyncio subprocess (#134508) 2025-05-23 10:03:16 +05:30
Emma Smith
8dbc119719
gh-133885: Use locks instead of critical sections for _zstd (gh-134289)
Move from using critical sections to locks for the (de)compression methods.
Since the methods allow other threads to run, we should use a lock rather
than a critical section.
2025-05-22 23:30:10 -04:00
Brett Cannon
ad42dc1909
GH-130397: remove special-casing of C stack depth for WASI (#134469)
Removed special-casing for WASI when setting C stack depth limits. Since WASI has its own C stack checking this isn't a security risk.

Also disabled some tests that stopped passing. They all happened to have already been disabled under Emscripten.
2025-05-22 14:08:44 -07:00
Tomas R.
484e00379b
GH-131798: Optimize away isinstance calls in the JIT (GH-134369) 2025-05-22 12:52:47 -04:00
Duprat
fade146cfb
gh-134322: Fix repr(threading.RLock) (#134389)
Fix the `__repr__` value of `threading.RLock` from `_thread` module, when just created.
2025-05-22 16:46:57 +00:00
Brandt Bucher
ec736e7dae
GH-131798: Optimize cached class attributes and methods in the JIT (GH-134403) 2025-05-22 11:15:03 -04:00
Eric Snow
09e72cf091
gh-132775: Use _PyCode GetScriptXIData() (gh-134511) 2025-05-22 08:40:33 -06:00
Nadeshiko Manju
8c5e5557c6
GH-131798: Turn _LOAD_SMALL_INT into _LOAD_CONST_INLINE_BORROW in the JIT (GH-134406) 2025-05-22 09:54:57 -04:00
Duprat
3effede97c
gh-134323: Fix the new threading.RLock.locked method (#134368)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-05-22 13:48:24 +00:00
Eric Snow
d0eedfa10e
gh-132775: Use _PyObject_GetXIData (With Fallback) (gh-134440)
This change includes some semi-related refactoring of queues and channels.
2025-05-22 06:50:06 -06:00
Serhiy Storchaka
2602d8ae98
gh-71339: Use new assertion methods in tests (GH-129046) 2025-05-22 13:17:22 +03:00
Sergey Miryanov
7309eb60c0
gh-131357: Add some extra tests for empty bytes and bytearray (#134458) 2025-05-22 09:01:46 +02:00
Gregory P. Smith
296a66051e
gh-127840: Revert "gh-127840: pass flags and address from send_fds (GH-127841)" (#134482)
Revert "gh-127840: pass flags and address from send_fds (GH-127841)"

This reverts commit 518c95b552.
2025-05-22 03:38:44 +00:00
Mike Salvatore
f3fc0c16e0
gh-134062: Fix hash collisions in IPv4Network and IPv6Network (GH-134063)
gh-134062: Fix hash collisions in IPv4Network and IPv6Network
gh-134062: Add hash collision regression test
2025-05-21 19:48:10 -07:00
Marcin Bachry
518c95b552
gh-127840: pass flags and address from send_fds (GH-127841)
socket: pass flags and address from send_fds

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-05-21 19:38:01 -07:00
Yuichiro Tachibana (Tsuchiya)
b1b8962443
gh-127960 Fix the REPL to set the correct namespace by setting the correct __main__ module (gh-134275)
The `__main__` module imported in the `_pyrepl` module points to the `_pyrepl` module itself when the interpreter was launched without `-m` option and didn't execute a module,
while it's an unexpected behavior that `__main__` can be `_pyrepl` and relative imports such as `from . import *` works based on the `_pyrepl` module.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-05-22 02:18:00 +02:00
Eric Snow
a66bae8bb5
gh-132775: Use _PyFunction_VerifyStateless() and _PyCode_VerifyStateless() (gh-134439) 2025-05-21 14:16:55 -06:00
Bénédikt Tran
1a07a01014
gh-132124: improve safety nets for creating AF_UNIX socket files (GH-134085)
* ensure that we can create AF_UNIX socket files
* emit a warning if system-wide temporary directory is used
2025-05-21 10:10:31 -07:00
Cody Maloney
0a68068bd2
gh-62184: Remove _pyio import of _io.FileIO (gh-134192)
This was added in the add of `_io`, isn't used since bpo-21859 when a
`_pyio` implementation was added which defines `FileIO` lower down in
the file.
2025-05-21 17:29:18 +02:00