]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
6 months agogh-132775: Revert "gh-132775: Add _PyCode_VerifyStateless() (gh-133221)" (#133497)
Petr Viktorin [Tue, 6 May 2025 10:09:41 +0000 (12:09 +0200)] 
gh-132775: Revert "gh-132775: Add _PyCode_VerifyStateless() (gh-133221)" (#133497)

6 months agogh-133490: Fix syntax highlighting for remote PDB (#133494)
Matt Wozniski [Tue, 6 May 2025 09:44:49 +0000 (05:44 -0400)] 
gh-133490: Fix syntax highlighting for remote PDB (#133494)

6 months agogh-132983: Add What's New entry for PEP 784 implementation (#133495)
Emma Smith [Tue, 6 May 2025 06:54:40 +0000 (23:54 -0700)] 
gh-132983: Add What's New entry for PEP 784 implementation (#133495)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
6 months agogh-81793: Replace skip decorators with specific helpers (GH-133493)
Zachary Ware [Tue, 6 May 2025 05:58:38 +0000 (00:58 -0500)] 
gh-81793: Replace skip decorators with specific helpers (GH-133493)

6 months agotyping: Modernize type annotations on IO classes (#133487)
Jelle Zijlstra [Tue, 6 May 2025 05:32:38 +0000 (22:32 -0700)] 
typing: Modernize type annotations on IO classes (#133487)

Remove unnecessary strings, use of Union[], use of List[], and reliance
on implicit Optional.

These type annotations are not actually used for anything but I feel
we should set a good example.

6 months agogh-133490: Add color support to remote PDB (#133491)
Matt Wozniski [Tue, 6 May 2025 05:28:16 +0000 (01:28 -0400)] 
gh-133490: Add color support to remote PDB (#133491)

6 months agoGH-113464: Add the JIT to What's New (GH-133486)
Brandt Bucher [Tue, 6 May 2025 03:06:41 +0000 (20:06 -0700)] 
GH-113464: Add the JIT to What's New (GH-133486)

6 months agogh-132493: Avoid eager evaluation of annotations in `@reprlib.recursive_repr()` ...
Jelle Zijlstra [Tue, 6 May 2025 02:20:11 +0000 (19:20 -0700)] 
gh-132493: Avoid eager evaluation of annotations in `@reprlib.recursive_repr()` (#133411)

6 months agogh-130117: Document why nested `Union`, `Literal`, and `Annotated` types referenced...
Valentin Berlier [Tue, 6 May 2025 02:05:16 +0000 (04:05 +0200)] 
gh-130117: Document why nested `Union`, `Literal`, and `Annotated` types referenced through a type alias are not flattened (#130119)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
6 months agoRemove duplicate includes: Include/internal/ (#132624)
Adam Turner [Tue, 6 May 2025 01:08:42 +0000 (02:08 +0100)] 
Remove duplicate includes: Include/internal/ (#132624)

6 months agogh-132983: Add the `compression.zstd` pacakge and tests (#133365)
Emma Smith [Tue, 6 May 2025 00:38:08 +0000 (17:38 -0700)] 
gh-132983: Add the `compression.zstd` pacakge and tests (#133365)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Co-authored-by: Rogdham <contact@rogdham.net>
6 months agoGH-132983: Use a standard autoconf version check for zstd (#133479)
Adam Turner [Tue, 6 May 2025 00:35:02 +0000 (01:35 +0100)] 
GH-132983: Use a standard autoconf version check for zstd (#133479)

6 months agogh-102567: Add -X importtime=2 for logging an importtime message for already-loaded...
Noah Kim [Tue, 6 May 2025 00:03:55 +0000 (20:03 -0400)] 
gh-102567: Add -X importtime=2 for logging an importtime message for already-loaded modules (#118655)

Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
6 months agoGH-132983: Build ``_zstd`` on Windows (#133366)
Adam Turner [Mon, 5 May 2025 23:58:47 +0000 (00:58 +0100)] 
GH-132983: Build ``_zstd`` on Windows (#133366)

6 months agogh-132775: Add _PyCode_GetXIData() (gh-133475)
Eric Snow [Mon, 5 May 2025 23:46:03 +0000 (17:46 -0600)] 
gh-132775: Add _PyCode_GetXIData() (gh-133475)

6 months agogh-132775: Do Not Set __name__ to __main__ With _PyPickle_GetXIData() (gh-133472)
Eric Snow [Mon, 5 May 2025 23:25:26 +0000 (17:25 -0600)] 
gh-132775: Do Not Set __name__ to __main__ With _PyPickle_GetXIData() (gh-133472)

This is a follow-up to gh-133107.  I realized that we could end up with an
infinite recursion if we try to run a function from __main__ in a subinterpreter.

6 months agogh-91048: Add filename:line_no information to `asyncio pstree` (#133478)
Łukasz Langa [Mon, 5 May 2025 23:07:33 +0000 (01:07 +0200)] 
gh-91048: Add filename:line_no information to `asyncio pstree` (#133478)

6 months agogh-118761: Add test_lazy_import for more modules (#133057)
Daniel Hollas [Mon, 5 May 2025 22:46:05 +0000 (23:46 +0100)] 
gh-118761: Add test_lazy_import for more modules (#133057)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
6 months agoGH-133231: Add JIT utilities in sys._jit (GH-133233)
Brandt Bucher [Mon, 5 May 2025 22:25:22 +0000 (15:25 -0700)] 
GH-133231: Add JIT utilities in sys._jit (GH-133233)

6 months agogh-133469: Adds to advanced section on installing PyManager (GH-133471)
Steve Dower [Mon, 5 May 2025 22:23:08 +0000 (23:23 +0100)] 
gh-133469: Adds to advanced section on installing PyManager (GH-133471)

6 months agogh-132775: Add _PyCode_VerifyStateless() (gh-133221)
Eric Snow [Mon, 5 May 2025 21:48:58 +0000 (15:48 -0600)] 
gh-132775: Add _PyCode_VerifyStateless() (gh-133221)

"Stateless" code is a function or code object which does not rely on external state or internal state.
It may rely on arguments and builtins, but not globals or a closure. I've left a comment in
pycore_code.h that provides more detail.

We also add _PyFunction_VerifyStateless(). The new functions will be used in several later changes
that facilitate "sharing" functions and code objects between interpreters.

6 months agogh-133346: Make theming support in _colorize extensible (GH-133347)
Łukasz Langa [Mon, 5 May 2025 21:45:25 +0000 (23:45 +0200)] 
gh-133346: Make theming support in _colorize extensible (GH-133347)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
6 months agoGH-131798: Split CALL_LEN into several uops (GH-133180)
Diego Russo [Mon, 5 May 2025 21:31:48 +0000 (22:31 +0100)] 
GH-131798: Split CALL_LEN into several uops (GH-133180)

6 months agogh-132917: Use RSS + swap for estimate of process memory usage (gh-133464)
Neil Schemenauer [Mon, 5 May 2025 21:15:05 +0000 (14:15 -0700)] 
gh-132917: Use RSS + swap for estimate of process memory usage (gh-133464)

6 months agogh-132017: Handle SIGCONT in `pyrepl` (#132918)
Stan Ulbrych [Mon, 5 May 2025 20:37:01 +0000 (21:37 +0100)] 
gh-132017: Handle SIGCONT in `pyrepl` (#132918)

6 months agoGH-133261: Make sure trashcan pointers look mortal -- 32 bit (GH-133450)
Mark Shannon [Mon, 5 May 2025 19:51:32 +0000 (20:51 +0100)] 
GH-133261: Make sure trashcan pointers look mortal -- 32 bit (GH-133450)

Make sure trashcan pointer look mortal -- 32 bit

6 months agogh-132975: Improve Remote PDB interrupt handling (#133223)
Matt Wozniski [Mon, 5 May 2025 19:33:59 +0000 (15:33 -0400)] 
gh-132975: Improve Remote PDB interrupt handling (#133223)

6 months agogh-132775: Unrevert "Add _PyCode_GetVarCounts()" (gh-133265)
Eric Snow [Mon, 5 May 2025 19:24:29 +0000 (13:24 -0600)] 
gh-132775: Unrevert "Add _PyCode_GetVarCounts()" (gh-133265)

This reverts commit 811edcf (gh-133232), which itself reverted the original commit 811edcf (gh-133128).

We reverted the original change due to failing s390 builds (a big-endian architecture).
It ended up that I had not accommodated op caches.

6 months agogh-133140: Add `PyUnstable_Object_IsUniquelyReferenced` for free-threading (#133144)
Peter Bierma [Mon, 5 May 2025 19:01:20 +0000 (15:01 -0400)] 
gh-133140: Add `PyUnstable_Object_IsUniquelyReferenced` for free-threading (#133144)

6 months agogh-133349: Enable auto-indent for pdb's multi-line mode (#133350)
Tian Gao [Mon, 5 May 2025 17:48:09 +0000 (10:48 -0700)] 
gh-133349: Enable auto-indent for pdb's multi-line mode (#133350)

6 months agogh-130645: Add color to stdlib argparse CLIs (gh-133380)
Hugo van Kemenade [Mon, 5 May 2025 17:46:46 +0000 (20:46 +0300)] 
gh-130645: Add color to stdlib argparse CLIs (gh-133380)

6 months agogh-133367: Add missing options to `ast` CLI (#133369)
Semyon Moroz [Mon, 5 May 2025 17:17:43 +0000 (21:17 +0400)] 
gh-133367: Add missing options to `ast` CLI (#133369)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
6 months agogh-132917: Check resident set size (RSS) before GC trigger. (gh-133399)
Neil Schemenauer [Mon, 5 May 2025 17:17:05 +0000 (10:17 -0700)] 
gh-132917: Check resident set size (RSS) before GC trigger. (gh-133399)

For the free-threaded build, check the process resident set size (RSS)
increase before triggering a full automatic garbage collection.  If the RSS
has not increased 10% since the last collection then it is deferred.

6 months agoGH-123599: `url2pathname()`: don't call `gethostbyname()` by default (#132610)
Barney Gale [Mon, 5 May 2025 17:03:42 +0000 (18:03 +0100)] 
GH-123599: `url2pathname()`: don't call `gethostbyname()` by default (#132610)

Follow-up to 66cdb2bd8ab93a4691bead7f5d1e54e5ca6895b4.

Add *resolve_host* keyword-only argument to `url2pathname()`, defaulting to
false. When set to true, we call `socket.gethostbyname()` to resolve the
URL hostname.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Steve Dower <steve.dower@microsoft.com>
6 months agogh-133395: add option for extension modules to specialize BINARY_OP/SUBSCR, apply...
Irit Katriel [Mon, 5 May 2025 16:46:56 +0000 (17:46 +0100)] 
gh-133395: add option for extension modules to specialize BINARY_OP/SUBSCR, apply to arrays (#133396)

6 months agoGH-132439: Fix REPL swallowing characters entered with AltGr on cmd.exe (GH-132440)
Chris Eibl [Mon, 5 May 2025 16:45:45 +0000 (18:45 +0200)] 
GH-132439: Fix REPL swallowing characters entered with AltGr on cmd.exe (GH-132440)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
6 months agogh-131296: Avoid posixmodule.c warning (GH-133142)
Wulian233 [Mon, 5 May 2025 16:45:15 +0000 (00:45 +0800)] 
gh-131296: Avoid posixmodule.c warning (GH-133142)

Clang-cl detects that on 32-bit builds the variable is always smaller than the value. But since the same code is used for other architectures, we can't just _fix_ it. This cast avoids the tautological-constant-out-of-range-compare warning.

6 months agogh-131878: Fix input of unicode characters with two or more code points in new pyrepl...
Sergey Miryanov [Mon, 5 May 2025 16:25:00 +0000 (09:25 -0700)] 
gh-131878: Fix input of unicode characters with two or more code points in new pyrepl on Windows (gh-131901)

Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
6 months agogh-132143: Fix the `AssertionError` in the test case `test.test_sys.TestRemoteExec...
littlebutt's workshop [Mon, 5 May 2025 16:08:49 +0000 (00:08 +0800)] 
gh-132143: Fix the `AssertionError` in the test case `test.test_sys.TestRemoteExec` (#132248)

6 months agogh-63882: Break down `and` tests in `test_minidom` (#133026)
Stan Ulbrych [Mon, 5 May 2025 16:07:24 +0000 (17:07 +0100)] 
gh-63882: Break down `and` tests in `test_minidom` (#133026)

6 months agogh-110067: Make max heap methods public and add missing ones (GH-130725)
Stan Ulbrych [Mon, 5 May 2025 15:52:49 +0000 (16:52 +0100)] 
gh-110067: Make max heap methods public and add missing ones (GH-130725)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
6 months agogh-82129: Improve annotations for make_dataclass() (#133406)
Jelle Zijlstra [Mon, 5 May 2025 15:21:32 +0000 (08:21 -0700)] 
gh-82129: Improve annotations for make_dataclass() (#133406)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Carl Meyer <carl@oddbird.net>
6 months agogh-119180: Make the FORWARDREF format work with more kinds of runtime errors (#133407)
Jelle Zijlstra [Mon, 5 May 2025 15:21:11 +0000 (08:21 -0700)] 
gh-119180: Make the FORWARDREF format work with more kinds of runtime errors (#133407)

6 months agoGH-133336: Remove reserved ``-J`` flag for Jython (#133444)
Adam Turner [Mon, 5 May 2025 15:09:19 +0000 (16:09 +0100)] 
GH-133336: Remove reserved ``-J`` flag for Jython (#133444)

6 months agoRevert "gh-124715: Fix method_dealloc(): use PyObject_GC_UnTrack() (#133199)" (#133434)
Victor Stinner [Mon, 5 May 2025 15:04:43 +0000 (17:04 +0200)] 
Revert "gh-124715: Fix method_dealloc(): use PyObject_GC_UnTrack() (#133199)" (#133434)

This reverts commit 662dd294563ce86980c640ad67e3d460a72c9cb9.

The root issue was fixed by the
commit f554237b8ef6c60df651ac17eb0ef0c095cef185.

6 months agogh-131878: Handle top level exceptions in new pyrepl and prevent of closing it (...
Sergey Miryanov [Mon, 5 May 2025 14:54:19 +0000 (07:54 -0700)] 
gh-131878: Handle top level exceptions in new pyrepl and prevent of closing it (#131910)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
6 months agogh-61103: drop unused Py_HAVE_C_COMPLEX define (GH-133435)
Sergey B Kirpichev [Mon, 5 May 2025 13:50:57 +0000 (16:50 +0300)] 
gh-61103: drop unused Py_HAVE_C_COMPLEX define (GH-133435)

Py_HAVE_C_COMPLEX was added in 3.14 so the removal doesn't need a deprecation
period even under a strict reading of PEP 387.

The Py_FFI_SUPPORT_C_COMPLEX check configure check implies support for
complex types in ctypes.

6 months agogh-131747: ctypes: Deprecate _pack_ implicitly setting _layout_ = 'ms' (GH-133205)
Petr Viktorin [Mon, 5 May 2025 13:32:06 +0000 (15:32 +0200)] 
gh-131747: ctypes: Deprecate _pack_ implicitly setting _layout_ = 'ms' (GH-133205)

On non-Windows, warn when _pack_ implicitly changes default _layout_
to 'ms'.

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
6 months agoGH-133261: Make sure that the GC doesn't untrack objects in trashcan (GH-133431)
Mark Shannon [Mon, 5 May 2025 12:44:50 +0000 (13:44 +0100)] 
GH-133261: Make sure that the GC doesn't untrack objects in trashcan (GH-133431)

6 months agogh-133419: fix test_external_inspection race assert (#133433)
Victor Stinner [Mon, 5 May 2025 12:38:51 +0000 (14:38 +0200)] 
gh-133419: fix test_external_inspection race assert (#133433)

Follow-up of commit c4cc5d58aee6a3be55a95efee6ec25d5774f7b5f,
fix more tests.

6 months agogh-107006: Move `threading.local` docstring to docs (#131840)
Lysandros Nikolaou [Mon, 5 May 2025 12:00:15 +0000 (14:00 +0200)] 
gh-107006: Move `threading.local` docstring to docs (#131840)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
6 months agoBump mypy to 1.15 (#133405)
sobolevn [Mon, 5 May 2025 10:29:48 +0000 (13:29 +0300)] 
Bump mypy to 1.15 (#133405)

6 months agogh-61103: don't use C _Complex types to implement F/D/G in ctypes (GH-133237)
Sergey B Kirpichev [Mon, 5 May 2025 09:23:30 +0000 (12:23 +0300)] 
gh-61103: don't use C _Complex types to implement F/D/G in ctypes (GH-133237)

According to the C standard, the memory representation of _Complex types
is equivalent to 2-element arrays. Unlike _Complex, arrays are always available.

- drop _complex.h header
- use appropriate real arrays to replace complex types

Co-authored-by: Lisandro Dalcin <dalcinl@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
6 months agoGH-133410: Use commit hashes for change detection (gh-133416)
Adam Turner [Mon, 5 May 2025 08:49:12 +0000 (09:49 +0100)] 
GH-133410: Use commit hashes for change detection (gh-133416)

6 months agogh-113081: Highlight source code in pdb (#133355)
Tian Gao [Mon, 5 May 2025 07:49:52 +0000 (00:49 -0700)] 
gh-113081: Highlight source code in pdb (#133355)

6 months agogh-128307: Support eager_start=<bool> in create_eager_task_factory and various creat...
Thomas Grainger [Mon, 5 May 2025 04:58:07 +0000 (05:58 +0100)] 
gh-128307:  Support eager_start=<bool> in create_eager_task_factory and various create_task functions (#128306)

Some create_task() functions were changed from `name=None, context=None` to `**kwargs`.

Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
6 months ago[GH-133419] fix test_external_inspection race assert (#133422)
Gregory P. Smith [Mon, 5 May 2025 04:41:22 +0000 (21:41 -0700)] 
[GH-133419] fix test_external_inspection race assert (#133422)

[tests] fix test_external_inspection race assert

either line could be where the inspection finds the foo()
function as after ready is sent, the process may not have made progress
onto the next line yet.  "solve" by putting the statements on the same
line.

6 months ago[tests] test_subprocess maybe avoid a timeout race condition? (#133420)
Gregory P. Smith [Mon, 5 May 2025 04:02:16 +0000 (21:02 -0700)] 
[tests] test_subprocess maybe avoid a timeout race condition? (#133420)

The few buildbot failures on https://github.com/python/cpython/pull/133103
are possibly just due to racing a child process launch and exit?

6 months agogh-133371: Don't optimize `LOAD_FAST` instructions whose local is killed by `DELETE_F...
mpage [Mon, 5 May 2025 04:00:11 +0000 (21:00 -0700)] 
gh-133371: Don't optimize `LOAD_FAST` instructions whose local is killed by `DELETE_FAST` (#133383)

In certain cases it's possible for locals loaded by `LOAD_FAST` instructions
to be on the stack when the local is killed by `DEL_FAST`. These `LOAD_FAST`
instructions should not be optimized into `LOAD_FAST_BORROW` as the strong
reference in the frame is killed while there is still a reference on the stack.

6 months agogh-133089: Use original timeout value for `TimeoutExpired` when the func `subprocess...
Nadeshiko Manju [Mon, 5 May 2025 01:15:31 +0000 (09:15 +0800)] 
gh-133089: Use original timeout value for `TimeoutExpired` when the func `subprocess.run` is called with a timeout (GH-133103)

Signed-off-by: Manjusaka <me@manjusaka.me>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
6 months agogh-133376: build: allow parser.c to be created if missing (#133378)
dura0ok [Mon, 5 May 2025 00:34:31 +0000 (07:34 +0700)] 
gh-133376: build: allow parser.c to be created if missing (#133378)

6 months agoGH-91048: Minor fixes for ``_remotedebugging`` & rename to ``_remote_debugging``...
Adam Turner [Mon, 5 May 2025 00:30:14 +0000 (01:30 +0100)] 
GH-91048: Minor fixes for ``_remotedebugging`` & rename to ``_remote_debugging`` (#133398)

6 months agogh-131421: Fix ASDL tests (#133408)
Jelle Zijlstra [Sun, 4 May 2025 23:46:21 +0000 (16:46 -0700)] 
gh-131421: Fix ASDL tests (#133408)

PR #131419 broke this, but we failed to run tests on the PR due to a bug
in our script.

6 months agogh-131421: fix ASDL grammar for `Dict` to have an `expr?*` keys field (#131419)
Samuel [Sun, 4 May 2025 23:03:38 +0000 (00:03 +0100)] 
gh-131421: fix ASDL grammar for `Dict` to have an `expr?*` keys field (#131419)

In the `ast` documentation for Python:

* https://docs.python.org/3/library/ast.html#ast.Dict
it is made clear that:

> When doing dictionary unpacking using dictionary literals the expression to be expanded goes in the values list, with a `None` at the corresponding position in `keys`.

Hence, `keys` is really a `expr?*` and *not* a `expr*`.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
6 months agogh-125618: Make FORWARDREF format succeed more often (#132818)
Jelle Zijlstra [Sun, 4 May 2025 22:21:56 +0000 (15:21 -0700)] 
gh-125618: Make FORWARDREF format succeed more often (#132818)

Fixes #125618.

6 months agogh-91048: Add filename and line number to external inspection routines (GH-133385)
Pablo Galindo Salgado [Sun, 4 May 2025 21:33:37 +0000 (23:33 +0200)] 
gh-91048: Add filename and line number to external inspection routines (GH-133385)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
6 months agogh-131178: Add tests for `ast` command-line interface (#133329)
Semyon Moroz [Sun, 4 May 2025 21:11:13 +0000 (01:11 +0400)] 
gh-131178: Add tests for `ast` command-line interface (#133329)

Co-authored-by: sobolevn <mail@sobolevn.me>
6 months agoRegenerate pcbuild.sln in Visual Studio 2022 (#133394)
Adam Turner [Sun, 4 May 2025 20:10:19 +0000 (21:10 +0100)] 
Regenerate pcbuild.sln in Visual Studio 2022 (#133394)

* Regenerate pcbuild.sln in Visual Studio 2022
* Move _remotedebugging to the end

6 months agogh-133042: disable HACL* HMAC on Emscripten (#133064)
Bénédikt Tran [Sun, 4 May 2025 19:55:49 +0000 (21:55 +0200)] 
gh-133042: disable HACL* HMAC on Emscripten (#133064)

6 months agogh-133351: Fix remote PDB's multi-line block tab completion (#133387)
Matt Wozniski [Sun, 4 May 2025 19:20:28 +0000 (15:20 -0400)] 
gh-133351: Fix remote PDB's multi-line block tab completion (#133387)

6 months agogh-109700: Improve stress tests for interpreter creation (GH-109946)
Serhiy Storchaka [Sun, 4 May 2025 18:53:24 +0000 (21:53 +0300)] 
gh-109700: Improve stress tests for interpreter creation (GH-109946)

* Ensure that destructors are called in the test that created interpreters, not after finishing it.
* Try to create/run interpreters in threads simultaneously.
* Mark tests that requires over 6GB of memory with bigmemtest.

6 months agogh-81793: Skip tests for os.link() to symlink on Android (GH-133388)
Serhiy Storchaka [Sun, 4 May 2025 18:48:06 +0000 (21:48 +0300)] 
gh-81793: Skip tests for os.link() to symlink on Android (GH-133388)

6 months agogh-126835: Rename `ast_opt.c` to `ast_preprocess.c` and related stuff after moving...
Yan Yanchii [Sun, 4 May 2025 18:07:35 +0000 (20:07 +0200)] 
gh-126835: Rename `ast_opt.c` to `ast_preprocess.c` and related stuff after moving const folding to the peephole optimizier (#131830)

6 months agogh-91048: Relax test_async_global_awaited_by to fix flakyness (#133368)
Pablo Galindo Salgado [Sun, 4 May 2025 16:52:20 +0000 (18:52 +0200)] 
gh-91048: Relax test_async_global_awaited_by to fix flakyness (#133368)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
6 months agogh-132457: make staticmethod and classmethod generic (#132460)
Ivan Kirpichnikov [Sun, 4 May 2025 16:26:38 +0000 (19:26 +0300)] 
gh-132457: make staticmethod and classmethod generic (#132460)

Co-authored-by: sobolevn <mail@sobolevn.me>
6 months agogh-132805: annotationlib: Fix handling of non-constant values in FORWARDREF (#132812)
Jelle Zijlstra [Sun, 4 May 2025 15:49:13 +0000 (08:49 -0700)] 
gh-132805: annotationlib: Fix handling of non-constant values in FORWARDREF (#132812)

Co-authored-by: David C Ellis <ducksual@gmail.com>
6 months agogh-132426: Add get_annotate_from_class_namespace replacing get_annotate_function...
Jelle Zijlstra [Sun, 4 May 2025 14:26:42 +0000 (07:26 -0700)] 
gh-132426: Add get_annotate_from_class_namespace replacing get_annotate_function (#132490)

As noted on the issue, making get_annotate_function() support both types and
mappings is problematic because one object may be both. So let's add a new one
that works with any mapping.

This leaves get_annotate_function() not very useful, so remove it.

6 months agogh-81793: Always call linkat() from os.link(), if available (GH-132517)
Serhiy Storchaka [Sun, 4 May 2025 14:24:10 +0000 (17:24 +0300)] 
gh-81793: Always call linkat() from os.link(), if available (GH-132517)

This fixes os.link() on platforms (like Linux and OpenIndiana) where the
system link() function does not follow symlinks.

* On Linux, it now follows symlinks by default and if
  follow_symlinks=True is specified.
* On Windows, it now raises error if follow_symlinks=True is passed.
* On macOS, it now raises error if follow_symlinks=False is passed and
  the system linkat() function is not available at runtime.
* On other platforms, it now raises error if follow_symlinks is passed
  with a value that does not match the system link() function behavior
  if if the behavior is not known.

Co-authored-by: Joachim Henke <37883863+jo-he@users.noreply.github.com>
Co-authored-by: Thomas Kluyver <takowl@gmail.com>
6 months agogh-122559: Synchronize C and Python implementation of the io module about pickling...
Serhiy Storchaka [Sun, 4 May 2025 14:06:49 +0000 (17:06 +0300)] 
gh-122559: Synchronize C and Python implementation of the io module about pickling (GH-122628)

In the C implementation, remove __reduce__ and __reduce_ex__ methods
that always raise TypeError and restore __getstate__ methods that always
raise TypeErrori.

This restores fine details of the pre-3.12 behavior and unifies
both implementations.

6 months agogh-69605: Add PyREPL import autocomplete feature to 'What's New' (#133358)
Tomas R. [Sun, 4 May 2025 11:22:42 +0000 (13:22 +0200)] 
gh-69605: Add PyREPL import autocomplete feature to 'What's New' (#133358)

6 months agobpo-44172: Keep reference to original window in curses subwindow objects (GH-26226)
Michael Forney [Sun, 4 May 2025 10:29:44 +0000 (03:29 -0700)] 
bpo-44172: Keep reference to original window in curses subwindow objects (GH-26226)

The X/Open curses specification[0] and ncurses documentation[1]
both state that subwindows must be deleted before the main window.

Deleting the windows in the wrong order causes a double-free with
NetBSD's curses implementation.

To fix this, keep track of the original window object in the subwindow
object, and keep a reference to the original for the lifetime of
the subwindow.

[0] https://pubs.opengroup.org/onlinepubs/7908799/xcurses/delwin.html
[1] https://invisible-island.net/ncurses/man/curs_window.3x.html

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
6 months agoGH-133231: Changes to executor management to support proposed `sys._jit` module ...
Mark Shannon [Sun, 4 May 2025 09:05:35 +0000 (10:05 +0100)] 
GH-133231: Changes to executor management to support proposed `sys._jit` module (GH-133287)

* Track the current executor, not the previous one, on the thread-state.

* Batch executors for deallocation to avoid having to constantly incref executors; this is an ad-hoc form of deferred reference counting.

6 months agogh-133363: Fix Cmd completion for lines beginning with `! ` (#133364)
Matt Wozniski [Sun, 4 May 2025 02:50:37 +0000 (22:50 -0400)] 
gh-133363: Fix Cmd completion for lines beginning with `! ` (#133364)

6 months agogh-132983: Introduce `_zstd` bindings module (GH-133027)
Emma Smith [Sun, 4 May 2025 01:29:55 +0000 (18:29 -0700)] 
gh-132983: Introduce `_zstd` bindings module (GH-133027)

* Add _zstd module for https://peps.python.org/pep-0784/

This commit introduces the `_zstd` module, with bindings to libzstd from
the pyzstd project. It also includes the unix build system configuration.
Windows build system support will be integrated independently as it
depends on integration with cpython-source-deps.

* Add _zstd to modules

* Fix path for compression.zstd module

* Ignore _zstd module like _io

* Expand module state macros to improve code quality

Also removes module state references from the classes in the _zstd
module and instead uses PyType_GetModuleState()

* Remove backticks suggested in review

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
* Use critical sections to lock object state

This should avoid races and deadlocks.

* Remove compress/decompress and mark module as not reliant on the GIL

The `compress`/`decompress` functions will be moved to Python code for simplicity.
C implementations can always be re-added in the future.

Also, mark _zstd as not requiring the GIL.

* Lift critical section to avoid clang warning

* Respond to comments by picnixz

* Call out pyzstd explicitly in license description

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
* Use a much more robust implementation...

... for `get_zstd_state_from_type`

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* Use PyList_GetItemRef for thread safety purposes

* Use a macro for the minimum supported version

* remove const from primivite types

* Use PyMem_New in another spot

* Simplify error handling in _get_frame_size

* Another simplification of error handling in get_frame_info

* Rename _module_state to mod_state

* Rewrite comment explaining the context of the code

* Add link to pyzstd

* Add TODO about refactoring dict training code

* Use PyModule_AddObjectRef over PyModule_AddObject

PyModule_AddObject is soft-deprecated, so we should use PyModule_AddObjectRef

* Check result of OutputBufferGrow

* Simplify return logic in `add_constant_to_type`

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* Ignore return value of _zstd_clear()

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* Remove redundant comments

* Remove __reduce__ from ZstdDict

We should instead document that to pickle a dictionary a user should use
the `.dict_content` attribute.

* Use PyUnicode_FromFormat instead of a buffer

* Don't use C constants/types in error messages

* Make error messages easier to understand for Python users

* Lower minimum required version 1.4.0

* Use casts and make slot function signatures correct

* Be consistent with CPython on const usage

* Make else clauses in line with PEP 7

* Fix over-indented blocks in argument clinic

* Add critical section around ZSTD_DCtx_setParameter

* Add a TODO about refactoring critical sections

* Use Py_UNREACHABLE

* Move bytes operations out of Py_BEGIN_ALLOW_THREADS

* Add TODO about ensuring a lock is held

* Remove asserts that may not be correct

* Add TODO to make ZstdDict and others GC objects

* Make objects GC tracked

* Remove unused include

* Fix some memory issues

* Fix refleaks on module and in ZstdDict

* Update configure to check for ZDICT_finalizeDictionary

* Properly check version in configure

* exit(1) if check fails

* Use AC_RUN_IFELSE

* Use a define() to re-use version check

* Actually properly set _zstd module status based on version

---------

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
6 months ago GH-91048: Add utils for printing the call stack for asyncio tasks (#133284)
Pablo Galindo Salgado [Sun, 4 May 2025 00:51:57 +0000 (02:51 +0200)] 
 GH-91048: Add utils for printing the call stack for asyncio tasks (#133284)

6 months agogh-133139: Add curses.assume_default_colors() (GH-133145)
Serhiy Storchaka [Sat, 3 May 2025 20:33:22 +0000 (23:33 +0300)] 
gh-133139: Add curses.assume_default_colors() (GH-133145)

This is a refinement of the curses.use_default_colors() function which
allows to change the color pair 0.

6 months agogh-123539: Add new error message changes to "Whats New" (#133344)
sobolevn [Sat, 3 May 2025 17:18:40 +0000 (20:18 +0300)] 
gh-123539: Add new error message changes to "Whats New" (#133344)

6 months agogh-133210: Fix `test_rlcompleter` in `--without-doc-strings` mode (#133332)
sobolevn [Sat, 3 May 2025 15:38:27 +0000 (18:38 +0300)] 
gh-133210: Fix `test_rlcompleter` in `--without-doc-strings` mode (#133332)

6 months agogh-123299: Add PyREPL syntax highlighting to release highlights (#133321)
Hugo van Kemenade [Sat, 3 May 2025 15:25:13 +0000 (18:25 +0300)] 
gh-123299: Add PyREPL syntax highlighting to release highlights (#133321)

6 months agogh-133304: workaround for RISC-V in PyFloat_Pack4/Unpack4() (#133328)
Sergey B Kirpichev [Sat, 3 May 2025 15:07:52 +0000 (18:07 +0300)] 
gh-133304: workaround for RISC-V in PyFloat_Pack4/Unpack4() (#133328)

6 months agogh-133306: Use \z instead of \Z in regular expressions in the stdlib (GH-133337)
Serhiy Storchaka [Sat, 3 May 2025 14:58:49 +0000 (17:58 +0300)] 
gh-133306: Use \z instead of \Z in regular expressions in the stdlib (GH-133337)

6 months agogh-133306: Use \z instead of \Z in fnmatch.translate() and glob.translate() (GH-133338)
Serhiy Storchaka [Sat, 3 May 2025 14:58:21 +0000 (17:58 +0300)] 
gh-133306: Use \z instead of \Z in fnmatch.translate() and glob.translate() (GH-133338)

6 months agogh-133117: Enable stricter mypy checks for `tomllib` (#133206)
sobolevn [Sat, 3 May 2025 13:57:09 +0000 (16:57 +0300)] 
gh-133117: Enable stricter mypy checks for `tomllib` (#133206)

6 months agogh-130160: use `.. program::` directive for documenting `platform` CLI (#133335)
Semyon Moroz [Sat, 3 May 2025 12:05:04 +0000 (16:05 +0400)] 
gh-130160: use `.. program::` directive for documenting `platform` CLI (#133335)

6 months agogh-131524: Update platform CLI to use argparse (#131542)
Harry [Sat, 3 May 2025 08:58:59 +0000 (09:58 +0100)] 
gh-131524: Update platform CLI to use argparse (#131542)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
6 months agogh-133306: Support \z as a synonym for \Z in regular expressions (GH-133314)
Serhiy Storchaka [Sat, 3 May 2025 07:54:33 +0000 (10:54 +0300)] 
gh-133306: Support \z as a synonym for \Z in regular expressions (GH-133314)

\Z was an error inherited from PCRE 0.95. It was fixed in PCRE 2.0.
In other engines, \Z means not “anchor at string end”, but
“anchor before optional newline at string end”.

\z means “anchor at string end” in most RE engines.

6 months agogh-114713: Revert gh-114731 (#133330)
Kirill Podoprigora [Sat, 3 May 2025 07:47:08 +0000 (08:47 +0100)] 
gh-114713: Revert gh-114731 (#133330)

Revert "gh-114713: Handle case of an empty string passed to `zoneinfo.ZoneInfo` (#114731)"

This reverts commit 884df116d79b05d9342e05e50484d61c684ecb8b.

6 months agogh-133194: Fix regression with PEP 758 parsing on older `feature_version` (#133289)
sobolevn [Sat, 3 May 2025 07:33:14 +0000 (10:33 +0300)] 
gh-133194: Fix regression with PEP 758 parsing on older `feature_version` (#133289)

gh-133192: Fix regression with PEP 758 parsing on older `feature_version`

6 months agogh-133037: Add test for shadowing __annotate__ (#133084)
Jelle Zijlstra [Sat, 3 May 2025 02:42:49 +0000 (19:42 -0700)] 
gh-133037: Add test for shadowing __annotate__ (#133084)

6 months agogh-91156: Document how TextIOWrapper interacts with UTF-8 mode (GH-132885)
Malcolm Smith [Sat, 3 May 2025 01:20:10 +0000 (02:20 +0100)] 
gh-91156: Document how TextIOWrapper interacts with UTF-8 mode (GH-132885)

Document how TextIOWrapper interacts with UTF-8 mode