]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
13 days agogh-141388: Improve docs/tests for non-function callables as annotate functions (...
dr-carlos [Sun, 3 May 2026 01:21:59 +0000 (10:51 +0930)] 
gh-141388: Improve docs/tests for non-function callables as annotate functions (#142327)

13 days agogh-139167: Allow users to hook gen_colors function to pyrepl Reader (#141619)
Tian Gao [Sat, 2 May 2026 20:28:00 +0000 (13:28 -0700)] 
gh-139167: Allow users to hook gen_colors function to pyrepl Reader (#141619)

13 days agogh-148871: extend and improve `LOAD_COMMON_CONSTANT` (GH-148971)
Neko Asakura [Sat, 2 May 2026 18:59:51 +0000 (02:59 +0800)] 
gh-148871: extend and improve `LOAD_COMMON_CONSTANT` (GH-148971)

13 days agogh-149171: Make TypeAliasType __module__ writable (#149172)
Eric Mark Martin [Sat, 2 May 2026 17:28:08 +0000 (13:28 -0400)] 
gh-149171: Make TypeAliasType __module__ writable (#149172)

closes #149171.

13 days agogh-149267: Document ast.Constant.kind attribute (#149268)
Anuj Nitin Bharambe [Sat, 2 May 2026 16:55:29 +0000 (22:25 +0530)] 
gh-149267: Document ast.Constant.kind attribute (#149268)

The kind attribute of ast.Constant was not mentioned in the
documentation. It is set to 'u' for u-prefixed string literals
and None for all other constants.

---------

Co-authored-by: Anuj Bharambe <anujnitinb@gmail.com>
13 days agogh-148063: documentation: move ast.compare from "Compiler flags" to "ast helpers...
Hunter Hogan [Sat, 2 May 2026 16:54:26 +0000 (11:54 -0500)] 
gh-148063: documentation: move ast.compare from "Compiler flags" to "ast helpers" (#147954)

13 days agogh-116021: Deprecate support for instantiating abstract AST nodes (#137865)
Brian Schubert [Sat, 2 May 2026 16:50:06 +0000 (12:50 -0400)] 
gh-116021: Deprecate support for instantiating abstract AST nodes (#137865)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
13 days agogh-149285: Increase recursion depth for `test_xml_etree` from 150k to 500k (#149286)
Zanie Blue [Sat, 2 May 2026 16:04:36 +0000 (11:04 -0500)] 
gh-149285: Increase recursion depth for `test_xml_etree` from 150k to 500k (#149286)

13 days agogh-149282: Fix `gc.c` compilation with `--enable-pystats` (#149283)
sobolevn [Sat, 2 May 2026 15:24:17 +0000 (18:24 +0300)] 
gh-149282: Fix `gc.c` compilation with `--enable-pystats` (#149283)

13 days agogh-146527: Remove private module entry from what's new (#149284)
Pablo Galindo Salgado [Sat, 2 May 2026 15:16:38 +0000 (16:16 +0100)] 
gh-146527: Remove private module entry from what's new (#149284)

Remove private module entry from what's new

13 days agoGH-146527: Add get_gc_stats function to _remote_debugging (#148071)
Sergey Miryanov [Sat, 2 May 2026 15:04:18 +0000 (20:04 +0500)] 
GH-146527: Add get_gc_stats function to _remote_debugging (#148071)

13 days agogh-148380: remove all uses of `_PyType_LookupByVersion` in `optimizer_bytecodes.c...
Neko Asakura [Sat, 2 May 2026 14:45:38 +0000 (22:45 +0800)] 
gh-148380: remove all uses of `_PyType_LookupByVersion` in `optimizer_bytecodes.c` (GH-148394)

13 days agogh-149214: Fix non ascii characters in remote debugging (#149228)
Pablo Galindo Salgado [Sat, 2 May 2026 14:07:28 +0000 (15:07 +0100)] 
gh-149214: Fix non ascii characters in remote debugging (#149228)

13 days agoGH-126910: Add gdb support for unwinding JIT frames (#146071)
Diego Russo [Sat, 2 May 2026 13:42:03 +0000 (14:42 +0100)] 
GH-126910: Add gdb support for unwinding JIT frames (#146071)

Co-authored-by: Pablo Galindo Salgado <pablogsal@gmail.com>
13 days agogh-149221: Minor comment edit (gh-149278)
Raymond Hettinger [Sat, 2 May 2026 13:29:06 +0000 (08:29 -0500)] 
gh-149221: Minor comment edit (gh-149278)

Minor comment edit

13 days agogh-149221:Fix binomialvariate Function for random module (gh-149222)
lighting9999 [Sat, 2 May 2026 12:55:43 +0000 (20:55 +0800)] 
gh-149221:Fix binomialvariate Function for random module (gh-149222)

13 days agoGH-148932: Improve error message if profiling.sampling run from venv on Windows platf...
Sergey Miryanov [Sat, 2 May 2026 09:23:16 +0000 (14:23 +0500)] 
GH-148932: Improve error message if profiling.sampling run from venv on Windows platform (#149247)

13 days agogh-148914: Fix memoization of in-band PickleBuffer in the Python implementation ...
Serhiy Storchaka [Sat, 2 May 2026 09:04:05 +0000 (12:04 +0300)] 
gh-148914: Fix memoization of in-band PickleBuffer in the Python implementation (GH-149052)

Previously, identical PickleBuffers did not preserve identity.
Also, empty writable PickleBuffer memoized an empty bytearray object
in place of b'' which is a singleton in CPython, so the following
references to b'' were unpickled as an empty bytearray object.

13 days agogh-149254: Bump OpenSSL versions for iOS and Android. (#149270)
Russell Keith-Magee [Sat, 2 May 2026 08:50:32 +0000 (16:50 +0800)] 
gh-149254: Bump OpenSSL versions for iOS and Android. (#149270)

Bump OpenSSL versions for iOS and Android.

13 days agogh-149244 Document statistics functions that require sequence inputs. (gh-149264)
Raymond Hettinger [Sat, 2 May 2026 03:58:23 +0000 (22:58 -0500)] 
gh-149244 Document statistics functions that require sequence inputs. (gh-149264)

13 days agostatistics: Fix geometric_mean() error message for negative inputs (#149246)
htjworld [Sat, 2 May 2026 03:54:24 +0000 (12:54 +0900)] 
statistics: Fix geometric_mean() error message for negative inputs (#149246)

13 days agogh-149254: Update macOS installer to use OpenSSL 3.5.6. (#149262)
Ned Deily [Sat, 2 May 2026 03:52:43 +0000 (23:52 -0400)] 
gh-149254: Update macOS installer to use OpenSSL 3.5.6. (#149262)

13 days agogh-149117: Set `ImportError.name` on errors from `runpy.run_module`/`run_path` (gh...
W. H. Wang [Sat, 2 May 2026 02:27:23 +0000 (10:27 +0800)] 
gh-149117: Set `ImportError.name` on errors from `runpy.run_module`/`run_path` (gh-149159)

Set ImportError.name on errors from runpy.run_module/run_path

`runpy.run_module()` and `runpy.run_path()` now set the `name` attribute
of the `ImportError` they raise to the requested module name, matching
the behaviour of a regular import statement (previously `name` was
always `None`, which broke introspection).

The `name=` kwarg is gated on `issubclass(error, ImportError)` because
`_get_module_details()` is also used by `_run_module_as_main()` with
a private `_Error` sentinel class. `_Error` does not subclass
ImportError, and `BaseException.__init__` rejects unknown kwargs at
the C level, so passing `name=` unconditionally would break the
`python -m foo` codepath.

2 weeks agoGH-149252: Update WASI SDK version from 32 to 33 (#149253)
Brett Cannon [Fri, 1 May 2026 23:51:06 +0000 (16:51 -0700)] 
GH-149252: Update WASI SDK version from 32 to 33 (#149253)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2 weeks agogh-75707: tarfile: Add optional open() argument "mtime" (GH-138117)
Amp Tell [Fri, 1 May 2026 22:39:58 +0000 (00:39 +0200)] 
gh-75707: tarfile: Add optional open() argument "mtime" (GH-138117)

This makes it possible to set the gzip header mtime field without
overriding time.time(), making it useful when creating reproducible
archives.

* 📜🤖 Added by blurb_it.

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2 weeks agogh-124397: Add free-threading support for iterators. (gh-148894)
Raymond Hettinger [Fri, 1 May 2026 21:31:00 +0000 (16:31 -0500)] 
gh-124397: Add free-threading support for iterators. (gh-148894)

2 weeks agogh-149202: Implement PEP 831 – Frame Pointers Everywhere: Enabling System-Level Obser...
Pablo Galindo Salgado [Fri, 1 May 2026 20:16:11 +0000 (21:16 +0100)] 
gh-149202: Implement PEP 831 – Frame Pointers Everywhere: Enabling System-Level Observability for Python (#149201)

Co-authored-by: Savannah Ostrowski <savannah@python.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Emma Smith <emma@emmatyping.dev>
2 weeks agogh-149083: Change several other docs examples to use `sentinel()` (#149213)
sobolevn [Fri, 1 May 2026 19:53:28 +0000 (22:53 +0300)] 
gh-149083: Change several other docs examples to use `sentinel()` (#149213)

2 weeks agoFix source link in `Doc/howto/descriptor.rst` (#149215)
sobolevn [Fri, 1 May 2026 19:37:14 +0000 (22:37 +0300)] 
Fix source link in `Doc/howto/descriptor.rst` (#149215)

2 weeks agoClarify `max_length` in zstd & zlib decompressor documentation (#143805)
Sam Bull [Fri, 1 May 2026 19:32:50 +0000 (20:32 +0100)] 
Clarify `max_length` in zstd & zlib decompressor documentation (#143805)

Also provide examples of how to decompress data using max_length for zstd and zlib.

Co-authored-by: Emma Smith <emma@emmatyping.dev>
2 weeks agogh-148726: Document the GC change in What's New in Python 3.14 (#149209)
Hugo van Kemenade [Fri, 1 May 2026 18:57:09 +0000 (21:57 +0300)] 
gh-148726: Document the GC change in What's New in Python 3.14 (#149209)

2 weeks agogh-139038: Update final JIT figures for 3.15rc1 (#149210)
Ken Jin [Fri, 1 May 2026 18:55:38 +0000 (19:55 +0100)] 
gh-139038: Update final JIT figures for 3.15rc1 (#149210)

Co-authored-by: Stan Ulbrych <stan@python.org>
2 weeks agoBuild mpdecimal from source to workaround unreliable launchpad.net (#149248)
Hugo van Kemenade [Fri, 1 May 2026 18:39:36 +0000 (21:39 +0300)] 
Build mpdecimal from source to workaround unreliable launchpad.net (#149248)

2 weeks agogh-81074: Allow non-ASCII addr_spec in email.headerregistry.Address (#122477)
Mike Edmunds [Fri, 1 May 2026 18:00:46 +0000 (11:00 -0700)] 
gh-81074: Allow non-ASCII addr_spec in email.headerregistry.Address (#122477)

The email.headerregistry.Address constructor raised an error if
addr_spec contained a non-ASCII character. (But it fully supports
non-ASCII in the separate username and domain args.) This change
removes the error for a non-ASCII addr_spec, as well as the
Defect that triggered it.  In the unicode era non-ascii is not a
defect, though it is an error when an attempt is made to serialize
it to ascii.  The serialization issue was handled in #122540.

2 weeks agogh-83938, gh-122476: Stop incorrectly RFC 2047 encoding non-ASCII email addresses...
Mike Edmunds [Fri, 1 May 2026 17:52:06 +0000 (10:52 -0700)] 
gh-83938, gh-122476: Stop incorrectly RFC 2047 encoding non-ASCII email addresses (#122540)

The email generators had been incorrectly flattening non-ASCII email
addresses to RFC 2047 encoded-word format, leaving them undeliverable.
(RFC 2047 prohibits use of encoded-word in an addr-spec.)
This change raises a HeaderWriteError when attempting to flatten an
EmailMessage with a non-ASCII addr-spec and a policy with utf8=False.
(Exception: If the non-ASCII address originated from parsing a message,
it will be flattened as originally parsed, without error.)  This also applies
to other contexts in which RFC2047 words are not allowed by the RFCs.

Non-ASCII email addresses are supported when using a policy with
utf8=True (such as email.policy.SMTPUTF8) under RFCs 6531 and 6532.

Non-ASCII email address domains (but not localparts) can also be used
with non-SMTPUTF8 policies by encoding the domain as an IDNA A-label.
(The email package does not perform this encoding, because it cannot
know whether the caller wants IDNA 2003, IDNA 2008, or some other
variant such as UTS #46.)

Co-authored-by: R. David Murray <rdmurray@bitdance.com>
2 weeks agogh-148850: Fix memory sanitizer false positive in os.getrandom (GH-148851)
petervanvugt [Fri, 1 May 2026 15:37:36 +0000 (08:37 -0700)] 
gh-148850: Fix memory sanitizer false positive in os.getrandom (GH-148851)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2 weeks agogh-148967: Fix FFI type pointer handling for C complex support in set_stginfo_ffi_typ...
sunmy2019 [Fri, 1 May 2026 12:12:08 +0000 (20:12 +0800)] 
gh-148967: Fix FFI type pointer handling for C complex support in set_stginfo_ffi_type_pointer (GH-148969)

2 weeks agogh-149204: add `_RROT_3` uop to reduce stack moves (GH-149205)
Neko Asakura [Fri, 1 May 2026 11:35:31 +0000 (19:35 +0800)] 
gh-149204: add `_RROT_3` uop to reduce stack moves (GH-149205)

2 weeks agogh-133560: Clarified `parser.md` doc for pegen parser issue in using the existing...
chemelnucfin [Fri, 1 May 2026 08:11:53 +0000 (01:11 -0700)] 
gh-133560: Clarified `parser.md` doc for pegen parser issue in using the existing `Grammar/python.gram` file. (GH-139194)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2 weeks agogh-145497: Use same size of static_types array in all builds (GH-149139)
Petr Viktorin [Fri, 1 May 2026 07:41:28 +0000 (09:41 +0200)] 
gh-145497: Use same size of static_types array in all builds (GH-149139)

When someone adds a new type but doesn't increment
`_Py_MAX_MANAGED_STATIC_BUILTIN_TYPES` or
`_Py_MAX_MANAGED_STATIC_EXT_TYPES`, JIT tests fail,
because JIT builds define an extra type.
But the JIT tests don't necessarily run for the commit
that causes the failure.

As a workaround, use the same size for the array for all
builds, potentially with an empty spot.

2 weeks agogh-149173: Fix inverted PYTHON_BASIC_REPL environment check in _pyrepl_available...
Tan Long [Fri, 1 May 2026 05:32:57 +0000 (13:32 +0800)] 
gh-149173: Fix inverted PYTHON_BASIC_REPL environment check in _pyrepl_available() (#149174)

2 weeks agoGH-146475: Block Apple Clang for building JIT stencils (#149188)
Savannah Ostrowski [Thu, 30 Apr 2026 22:09:36 +0000 (15:09 -0700)] 
GH-146475: Block Apple Clang for building JIT stencils (#149188)

2 weeks agogh-148518 fix index error in local part attribute (#148522)
R. David Murray [Thu, 30 Apr 2026 21:41:43 +0000 (17:41 -0400)] 
gh-148518 fix index error in local part attribute (#148522)

As part of fixing bpo-27931 code was introduced to get_bare_quoted_string
that added an empty Terminal if the quoted string was empty.  This isn't
the best answer in terms of the parse tree; we really want the token
list to be empty in that case.  But having it be empty resulted in
local_part raising the index error.  We find that same problem if we
try to parse an address consisting of a single dquote.  By fixing
local_part to not raise on an empty token list, we can have the
bare_quoted_string code correctly return an empty token list for
the empty string cases (two dquotes or a single dquote as the
entire addrespec, at the end of a line).

2 weeks agogh-144319: Use transparent huge pages via `madvise(MADV_HUGEPAGE)` in pymalloc (...
Maurycy Pawłowski-Wieroński [Thu, 30 Apr 2026 21:18:07 +0000 (23:18 +0200)] 
gh-144319: Use transparent huge pages via `madvise(MADV_HUGEPAGE)` in pymalloc (#144353)

2 weeks agogh-149028: Revert gh-92936 changes (GH-149182)
Serhiy Storchaka [Thu, 30 Apr 2026 19:19:46 +0000 (22:19 +0300)] 
gh-149028: Revert gh-92936 changes (GH-149182)

* Revert "gh-92936: update `http.cookies` docs post GH-113663 (#137566)"

This reverts commit d86c2257a69a8d6c650c0db470499463131a569f.

* Revert "gh-92936: allow double quote in cookie values (#113663)"

This reverts commit d7dbde895884d58e3da7ed4107fd33171afad7cb.

2 weeks agoGH-148726: Forward-port generational GC. (GH-148746)
Sergey Miryanov [Thu, 30 Apr 2026 19:19:13 +0000 (00:19 +0500)] 
GH-148726: Forward-port generational GC. (GH-148746)

The replaces the incremental GC with a forward port (from 3.13) of the generational GC.

Co-Authored-By: Neil Schemenauer <nas@arctrix.com>
Co-Authored-By: Zanie Blue <contact@zanie.dev>
Co-Authored-By: Sergey Miryanov <sergey.miryanov@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2 weeks agobpo-39100: _header_value_parser: do not treat a Group as invalid-mailbox (#24872)
elenril [Thu, 30 Apr 2026 17:24:23 +0000 (18:24 +0100)] 
bpo-39100: _header_value_parser: do not treat a Group as invalid-mailbox (#24872)

When an address in an address-list has garbage at the end, the code will
currently:

1. change the mailbox in the last parsed address into invalid-mailbox by
   overriding its token_type;
2. wrap the trailing garbage into another invalid-mailbox and append it
   to the last parsed address.

However, that does not take into account that an address may
also contain a Group instead of a single mailbox. In that case,
overwriting token_type leads to undesirable results, e.g. parsing an
email with the following 'To' header:

unlisted-recipients:; (no To-header on input)

raises an AttributeError from trying to treat the Group as a Mailbox.

Moreover it is questionable whether the previously parsed mailbox should
be treated as invalid in addition to the trailing garbage.

Address both of the above by wrapping the trailing garbage in a new
Address with a single invalid-mailbox, and append it to the AddressList
directly.

Changes the results of the
test_get_address_list_mailboxes_invalid_addresses test, where the
address list is now parsed into 4 mailboxes instead of 3 (all but the
first one are invalid).

2 weeks agogh-147991: Speed up tomllib import time (GH-147992)
Victor Stinner [Thu, 30 Apr 2026 16:25:32 +0000 (18:25 +0200)] 
gh-147991: Speed up tomllib import time (GH-147992)

- Use lazy import for regular expressions.
- Use frozendict for string escapes

Co-authored-by: Taneli Hukkinen <hukkinen@eurecom.fr>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2 weeks agogh-149083: Use `sentinel` in `functools.rst` docs (#149176)
sobolevn [Thu, 30 Apr 2026 16:18:56 +0000 (19:18 +0300)] 
gh-149083: Use `sentinel` in `functools.rst` docs (#149176)

2 weeks agogh-113471: Add custom default Content-Type to http.server (#113475)
John Comeau [Thu, 30 Apr 2026 15:00:48 +0000 (08:00 -0700)] 
gh-113471: Add custom default Content-Type to http.server (#113475)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: donBarbos <donbarbos@proton.me>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2 weeks agogh-148829: Move sentinelobject.h to Include/cpython/ (#149186)
Victor Stinner [Thu, 30 Apr 2026 14:57:29 +0000 (16:57 +0200)] 
gh-148829: Move sentinelobject.h to Include/cpython/ (#149186)

This C API is not part of the limited C API, so move it to the
CPython C API.

2 weeks agogh-111264: Add a note about untrusted input to tomllib docs (GH-146209)
Petr Viktorin [Thu, 30 Apr 2026 14:33:13 +0000 (16:33 +0200)] 
gh-111264: Add a note about untrusted input to tomllib docs (GH-146209)

Co-authored-by: Stan Ulbrych <stan@python.org>
2 weeks agogh-149085: Add `max_threads` keyword to `faulthandler.dump_traceback()` (GH-149106)
Eric Froemling [Thu, 30 Apr 2026 13:27:57 +0000 (06:27 -0700)] 
gh-149085: Add `max_threads` keyword to `faulthandler.dump_traceback()` (GH-149106)

Add a keyword-only `max_threads` argument to `dump_traceback()` and
`dump_traceback_later()`, defaulting to 100 to preserve existing
behavior. Allows server processes with many worker threads to dump
beyond the historical 100-thread cap (previously a hardcoded
`MAX_NTHREADS = 100` in `Python/traceback.c`).

The cap matters in practice: tstates are prepended to the
PyInterpreterState linked list, so the dump walks newest-first. With
more than 100 threads alive, the main thread (oldest, at the tail) is
silently elided from watchdog dumps -- exactly the thread that's
usually wanted.

The hardcoded value is moved to a new internal macro
`_Py_TRACEBACK_MAX_NTHREADS` in `pycore_traceback.h` so the in-tree
fatal-signal callers all reference one source of truth.

2 weeks agogh-149122: Fix refleak in codegen (GH-149179)
Petr Viktorin [Thu, 30 Apr 2026 10:05:48 +0000 (12:05 +0200)] 
gh-149122: Fix refleak in codegen (GH-149179)

2 weeks agogh-149049: Fix jit binary op stack underflow (GH-149076)
Pieter Eendebak [Thu, 30 Apr 2026 09:36:04 +0000 (11:36 +0200)] 
gh-149049: Fix jit binary op stack underflow (GH-149076)

2 weeks agoRevert pylock.toml change to make MSI builds pass (#149175)
Petr Viktorin [Thu, 30 Apr 2026 08:30:34 +0000 (10:30 +0200)] 
Revert pylock.toml change to make MSI builds pass (#149175)

GH-149058 made MSI installer tests fail. GHA didn't catch this because MSI-related files weren't changed.

This reverts the build.bat change from commit 40dc61a0e0672810c3934da8cc2eda68027c24ce.

Also: a README style nitpick to trigger CI.

2 weeks agoGH-145378: Use PyREPL as the default input console for pdb (#145379)
Tian Gao [Thu, 30 Apr 2026 05:55:09 +0000 (22:55 -0700)] 
GH-145378: Use PyREPL as the default input console for pdb (#145379)

2 weeks agogh-149083: Convert dataclasses.MISSING and dataclasses.KW_ONLY to sentinels (#149086)
Jelle Zijlstra [Thu, 30 Apr 2026 02:39:29 +0000 (19:39 -0700)] 
gh-149083: Convert dataclasses.MISSING and dataclasses.KW_ONLY to sentinels (#149086)

There were comments claiming these were implemented as custom classes to give a nicer
repr(), but the repr() wasn't all that nice:

>>> repr(dataclasses.MISSING)
'<dataclasses._MISSING_TYPE object at 0x1005e7e00>'
>>> repr(dataclasses.KW_ONLY)
'<dataclasses._KW_ONLY_TYPE object at 0x100884050>'

Sentinels are conceptually the right tool for these, so let's use them.

This does change the repr() of these two objects.

2 weeks agogh-149026: Add colour to `pickletools` CLI output (#149027)
Hugo van Kemenade [Wed, 29 Apr 2026 15:33:05 +0000 (18:33 +0300)] 
gh-149026: Add colour to `pickletools` CLI output (#149027)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2 weeks agogh-149148: Upgrade bundled pip to 26.1 (#149150)
Victor Stinner [Wed, 29 Apr 2026 14:36:01 +0000 (16:36 +0200)] 
gh-149148: Upgrade bundled pip to 26.1 (#149150)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2 weeks agogh-148740: Fix `uuid` CLI with custom UUIDs for UUIDv3/v5 namespaces (#148741)
Jansen Price [Wed, 29 Apr 2026 13:44:22 +0000 (08:44 -0500)] 
gh-148740: Fix `uuid` CLI with custom UUIDs for UUIDv3/v5 namespaces (#148741)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2 weeks agogh-149122: Fix segfault in compiler when certain builtin functions are passed a corou...
Irit Katriel [Wed, 29 Apr 2026 13:35:51 +0000 (14:35 +0100)] 
gh-149122: Fix segfault in compiler when certain builtin functions are passed a coroutine as arg (#149138)

2 weeks agogh-135528: Support more second-level domain names in http.cookiejar (#135820)
Weilin Du [Wed, 29 Apr 2026 11:33:51 +0000 (19:33 +0800)] 
gh-135528: Support more second-level domain names in http.cookiejar (#135820)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2 weeks agogh-142927: Show module names instead of file paths in flamegraph (#146040)
ivonastojanovic [Wed, 29 Apr 2026 09:00:07 +0000 (10:00 +0100)] 
gh-142927: Show module names instead of file paths in flamegraph (#146040)

2 weeks agogh-148829: bump number of static types (#149121)
Jelle Zijlstra [Wed, 29 Apr 2026 01:59:48 +0000 (18:59 -0700)] 
gh-148829: bump number of static types (#149121)

2 weeks agogh-149119: docs: mention that sentinel does not support subclassing (#149120)
Stelar [Tue, 28 Apr 2026 23:50:53 +0000 (01:50 +0200)] 
gh-149119: docs: mention that sentinel does not support subclassing (#149120)

Add note about sentinel objects not supporting subclassing

Clarify that sentinel objects do not support subclassing.

2 weeks agoBuild docs from `pylock.toml` (#149058)
Hugo van Kemenade [Tue, 28 Apr 2026 18:45:38 +0000 (21:45 +0300)] 
Build docs from `pylock.toml` (#149058)

2 weeks agoReplace deprecated action with RtD app (#149111)
Hugo van Kemenade [Tue, 28 Apr 2026 17:30:16 +0000 (20:30 +0300)] 
Replace deprecated action with RtD app (#149111)

2 weeks agogh-108951: document addition of TaskGroup.cancel() (#149031)
John Belmonte [Tue, 28 Apr 2026 16:45:55 +0000 (09:45 -0700)] 
gh-108951: document addition of TaskGroup.cancel() (#149031)

Co-authored-by: Alex Grönholm <alex.gronholm@nextday.fi>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2 weeks agogh-142927: Fix inverted flamegraph width (#148568)
ivonastojanovic [Tue, 28 Apr 2026 16:42:21 +0000 (17:42 +0100)] 
gh-142927: Fix inverted flamegraph width (#148568)

Fix inverted flamegraph width

The inverted view used thread presence as a proxy for self time.
This missed self samples on C-level wrapper frames like _run_code,
where the node's thread always appears in its children too. Those
samples were silently dropped, causing the chart to render narrower
than full width. Now uses the explicit self field on each node
instead of the thread heuristic.

2 weeks agogh-148211: decompose `_SHUFFLE_3_LOAD_CONST_INLINE_BORROW` in JIT (GH-148816)
Neko Asakura [Tue, 28 Apr 2026 12:48:23 +0000 (20:48 +0800)] 
gh-148211: decompose `_SHUFFLE_3_LOAD_CONST_INLINE_BORROW` in JIT (GH-148816)

2 weeks agogh-148571: [JIT] Preserve family-head recorder layouts for specialized opcode familie...
Hai Zhu [Tue, 28 Apr 2026 12:41:16 +0000 (20:41 +0800)] 
gh-148571: [JIT] Preserve family-head recorder layouts for specialized opcode families (GH-148730)

* Records the same objects for each member of family before execution
* Records derived values when recording the trace
* This makes sure that specialization, or deoptimization, does not cause invalid values to be recorded

2 weeks agoGH-83065: Fix import deadlock by implementing hierarchical module locking (GH-137196)
Gregory P. Smith [Tue, 28 Apr 2026 08:06:23 +0000 (01:06 -0700)] 
GH-83065: Fix import deadlock by implementing hierarchical module locking (GH-137196)

Make _find_and_load() acquire the module locks for the full
dotted-name chain (parent before child) when loading a nested module, so
both threads contend on the same first lock and serialise instead of
deadlocking.

When acquiring a parent's lock would itself deadlock with another thread
that is loading that parent (cross-package circular imports), the parent's
lock is skipped and the partially-initialised parent is accepted -- the
same policy _lock_unlock_module() already applies on the existing code
path -- so concurrent circular imports that worked before continue to work.

2 weeks agogh-125862: Keep ContextDecorator open across generator/coroutine execution (GH-136212)
Alex Grönholm [Tue, 28 Apr 2026 05:26:38 +0000 (08:26 +0300)] 
gh-125862: Keep ContextDecorator open across generator/coroutine execution (GH-136212)

ContextDecorator and AsyncContextDecorator (and therefore @contextmanager
and @asynccontextmanager used as decorators) now detect generator,
coroutine, and asynchronous generator functions and emit a wrapper of the
matching kind, so the context manager spans iteration or await rather than
just the call that constructs the lazy object.  Wrapped generators are
explicitly closed when iteration ends.

For asynchronous generator wrappers, values passed via asend() and
exceptions via athrow() are not forwarded to the wrapped generator.

AsyncContextDecorator now also accepts synchronous functions and
generators, returning an asynchronous wrapper; ContextDecorator remains
the recommended choice for those.

inspect.isgeneratorfunction(), iscoroutinefunction(), and
isasyncgenfunction() now return True for the decorated result when the
input is of that kind.

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2 weeks agogh-149035: Modernize legacy Python patterns in `Doc/tutorial/stdlib2.rst` (#149036)
ByteFlow [Tue, 28 Apr 2026 05:08:23 +0000 (13:08 +0800)] 
gh-149035: Modernize legacy Python patterns in `Doc/tutorial/stdlib2.rst` (#149036)

Co-authored-by: Copilot <copilot@github.com>
2 weeks agogh-137600: Promote `ast` node constructor deprecation warnings to errors (#137601)
Brian Schubert [Tue, 28 Apr 2026 02:51:06 +0000 (22:51 -0400)] 
gh-137600: Promote `ast` node constructor deprecation warnings to errors (#137601)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2 weeks agogh-148829: Implement PEP 661 (#148831)
Jelle Zijlstra [Tue, 28 Apr 2026 02:28:30 +0000 (19:28 -0700)] 
gh-148829: Implement PEP 661 (#148831)

Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2 weeks agogh-148252: Avoid overflow in `_remote_debugging` binary reader bounds checks (#148972)
Maurycy Pawłowski-Wieroński [Mon, 27 Apr 2026 23:06:23 +0000 (01:06 +0200)] 
gh-148252: Avoid overflow in `_remote_debugging` binary reader bounds checks (#148972)

2 weeks agogh-149017: Upgrade bundled Expat to 2.8.0 (#149020)
Stan Ulbrych [Mon, 27 Apr 2026 20:22:35 +0000 (21:22 +0100)] 
gh-149017: Upgrade bundled Expat to 2.8.0 (#149020)

2 weeks agogh-146581: Fix vulnerability in shutil.unpack_archive() for ZIP files on Windows...
Serhiy Storchaka [Mon, 27 Apr 2026 18:43:15 +0000 (21:43 +0300)] 
gh-146581: Fix vulnerability in shutil.unpack_archive() for ZIP files on Windows (GH-146591)

Use ZipFile.extractall() to sanitize file names and extract files.

Files with invalid names (e.g. absolute paths) are now skipped.

Files containing ".." in the name are no longer skipped.

2 weeks agogh-148529: Minor improvements of the struct module documentation (GH-148565)
Serhiy Storchaka [Mon, 27 Apr 2026 18:30:48 +0000 (21:30 +0300)] 
gh-148529: Minor improvements of the struct module documentation (GH-148565)

* Document that 's' and 'p' accept bytes and bytearray.
* Fix some footnotes.
* Clarify that "string" is a byte string.
* Fix the module docstring.

2 weeks agoGH-146073: Add fitness to executor dumps. (GH-148959)
Mark Shannon [Mon, 27 Apr 2026 16:34:09 +0000 (17:34 +0100)] 
GH-146073: Add fitness to executor dumps. (GH-148959)

2 weeks agoUn-skip previously-broken `test_get_type_hints_modules_forwardref` (#149048)
Thomas Kowalski [Mon, 27 Apr 2026 15:30:35 +0000 (17:30 +0200)] 
Un-skip previously-broken `test_get_type_hints_modules_forwardref` (#149048)

2 weeks agoGH-135357: Add socket.SO_PASSRIGHTS constant (#135355)
Salvo 'LtWorf' Tomaselli [Mon, 27 Apr 2026 13:12:34 +0000 (15:12 +0200)] 
GH-135357: Add socket.SO_PASSRIGHTS constant (#135355)

Constant added to Linux 6.16. See the LWN article:
https://lwn.net/Articles/1023085/

Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2 weeks agogh-148868: Increase test coverage for `cmath.isinf` (#148869)
Manoj K M [Mon, 27 Apr 2026 07:22:20 +0000 (12:52 +0530)] 
gh-148868: Increase test coverage for `cmath.isinf` (#148869)

2 weeks agoFix typo in `ceval.c` error message (#148860)
Anonymous941 [Mon, 27 Apr 2026 07:21:53 +0000 (03:21 -0400)] 
Fix typo in `ceval.c` error message (#148860)

Fix the "multiple values for keyword argument" error message
used when the function's `__qualname__` cannot be retrieved.

2 weeks agogh-82665 Mention that HTMLParser.handle_starttag value can be None (#134312)
Micah Najacht [Mon, 27 Apr 2026 06:27:05 +0000 (01:27 -0500)] 
gh-82665 Mention that HTMLParser.handle_starttag value can be None (#134312)

* Specify boolean attribute behavior in parser

* Tweak wording and example

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
* Fix backticks

---------

Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2 weeks agoDocument that multiprocessing treats local same-user processes as trusted (GH-149001)
Gregory P. Smith [Mon, 27 Apr 2026 01:42:13 +0000 (18:42 -0700)] 
Document that multiprocessing treats local same-user processes as trusted (GH-149001)

Clarify in the Authentication keys section that the authkey handshake
covers Listener/Client (addressable endpoints) only, not the anonymous
pipes behind Pipe() and Queue, and that isolation between same-user
processes must be arranged at the OS level.

2 weeks agogh-47798: Refactor the POSIX subprocess.Popen._communicate selector loop into helpers...
Gregory P. Smith [Mon, 27 Apr 2026 00:40:20 +0000 (17:40 -0700)] 
gh-47798: Refactor the POSIX subprocess.Popen._communicate selector loop into helpers (GH-149032)

No public API change.  Lift the per-iteration select/read/write loop out of
Popen._communicate (POSIX) into a module-level _communicate_io_posix(), with
small _flush_stdin / _make_input_view / _translate_newlines helpers alongside
it.  Popen._communicate calls the helper and persists the returned input
offset for resume-after-timeout.

Retire the private Popen._remaining_time method in favor of module-level
_deadline_remaining; all call sites (POSIX and Windows) updated.

Defensive behavioural deltas: the stdin and stdout/stderr .close() calls in
the I/O loop now swallow BrokenPipeError / OSError, matching __exit__ and the
no-input path; previously these were bare.

Adds test_communicate_timeout_resume_partial_write to cover _input_offset
bookkeeping across TimeoutExpired/resume.

2 weeks agogh-148991: Add colour to `tokenize` CLI output (#148992)
Hugo van Kemenade [Sun, 26 Apr 2026 19:14:33 +0000 (22:14 +0300)] 
gh-148991: Add colour to `tokenize` CLI output (#148992)

Co-authored-by: Stan Ulbrych <stan@python.org>
2 weeks agogh-146455: Fix O(N²) in add_const() after constant folding moved to CFG (#146456)
zSirius [Sun, 26 Apr 2026 12:15:24 +0000 (20:15 +0800)] 
gh-146455: Fix O(N²) in add_const() after constant folding moved to CFG (#146456)

The add_const() function in flowgraph.c uses a linear search over the
consts list to find the index of a constant. After gh-126835 moved
constant folding from the AST optimizer to the CFG optimizer, this
function is now called N times for N inner tuple elements during
fold_tuple_of_constants(), resulting in O(N²) total time.

Fix by maintaining an auxiliary _Py_hashtable_t that maps object
pointers to their indices in the consts list, providing O(1) lookup.

For a file with 100,000 constant 2-tuples:
- Before: 10.38s (add_const occupies 83.76% of CPU time)
- After:  1.48s

2 weeks agogh-148981: Add color parameter to `ast.dump` (#148982)
Stan Ulbrych [Sun, 26 Apr 2026 09:15:54 +0000 (10:15 +0100)] 
gh-148981: Add color parameter to `ast.dump` (#148982)

And turn on color for the `ast` module CLI.

2 weeks agogh-137855: Lazy import `inspect` module in dataclasses (#144387)
Daniel Hollas [Sun, 26 Apr 2026 05:57:38 +0000 (06:57 +0100)] 
gh-137855: Lazy import `inspect` module in dataclasses (#144387)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2 weeks agogh-141473: Speed up subprocess test_communicate_timeout_large_input long tail (#149003)
Gregory P. Smith [Sun, 26 Apr 2026 04:01:33 +0000 (21:01 -0700)] 
gh-141473: Speed up subprocess test_communicate_timeout_large_input long tail (#149003)

gh-141473: Speed up test_communicate_timeout_large_input

Replace the slow reader's 30s sleep with a parent-driven wake over a
loopback socket so post-timeout communicate() doesn't block waiting
for the child to wake on its own. Worst-case runtime: ~30s -> <1s.

2 weeks agogh-146311: Reject non-canonical padding bits in base32, 64, & 85 decoding (GH-146312)
Gregory P. Smith [Sat, 25 Apr 2026 23:02:51 +0000 (16:02 -0700)] 
gh-146311: Reject non-canonical padding bits in base32, 64, & 85 decoding (GH-146312)

Add `canonical=False` keyword argument to `a2b_base64`, `a2b_base32`, `a2b_base85`, and `a2b_ascii85` (and their `base64` module wrappers). When `canonical=True`, non-canonical encodings are rejected per [RFC 4648 section 3.5](https://datatracker.ietf.org/doc/html/rfc4648.html#section-3.5).

This is independent of `strict_mode`.

For base85/ascii85, the check also rejects single-character final groups (never produced by a conforming encoder) and verifies partial group padding matches what the encoder would produce.

Co-authored-by: Serhiy Storchaka via lots of great code review!
2 weeks agogh-148989: `_remote_debugging`: Remove dead code, unnecessary gc state read (#148990)
Maurycy Pawłowski-Wieroński [Sat, 25 Apr 2026 21:28:51 +0000 (23:28 +0200)] 
gh-148989: `_remote_debugging`: Remove dead code, unnecessary gc state read (#148990)

dead code

2 weeks agogh-140727: Update tachyon logo (#148965)
Mai Giménez [Sat, 25 Apr 2026 21:27:11 +0000 (22:27 +0100)] 
gh-140727: Update tachyon logo (#148965)

2 weeks agogh-134690: Removed deprecated `codetype.co_lnotab` (#134691)
sobolevn [Sat, 25 Apr 2026 16:13:48 +0000 (19:13 +0300)] 
gh-134690: Removed deprecated `codetype.co_lnotab` (#134691)

2 weeks agogh-148947: dataclasses: fix error on empty __class__ cell (#148948)
Jelle Zijlstra [Sat, 25 Apr 2026 15:31:22 +0000 (08:31 -0700)] 
gh-148947: dataclasses: fix error on empty __class__ cell  (#148948)

Also add a test demonstrating the need for the existing "is oldcls" check.

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
2 weeks agogh-140287: Handle `PYTHONSTARTUP` script exceptions in the asyncio REPL (#140288)
Bartosz Sławecki [Sat, 25 Apr 2026 14:24:40 +0000 (16:24 +0200)] 
gh-140287: Handle `PYTHONSTARTUP` script exceptions in the asyncio REPL (#140288)