]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
2 months agogh-144278: Enable overriding sys.implementation's name and cache_tag when building...
Steve Dower [Tue, 10 Feb 2026 00:01:17 +0000 (00:01 +0000)] 
gh-144278: Enable overriding sys.implementation's name and cache_tag when building sysmodule.c (GH-144293)

Changing the values requires forking and patching, which is intentional. Simply rebuilding from source does not change the implementation enough to justify changing these values - they would still be `cpython` and compatible with existing `.pyc` files. But people who maintain forks are better served by being able to easily override these values in a place that can be forward-ported reliably.

2 months agoGH-144552: Clean up `tail-call.yml ` CI (#144553)
Savannah Ostrowski [Mon, 9 Feb 2026 22:52:45 +0000 (14:52 -0800)] 
GH-144552: Clean up `tail-call.yml ` CI (#144553)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2 months agogh-144492: Fix `process_changed_files` outputs for `reusable-{macos, wasi}.yml` ...
Stan Ulbrych [Mon, 9 Feb 2026 17:30:19 +0000 (17:30 +0000)] 
gh-144492: Fix `process_changed_files` outputs for `reusable-{macos, wasi}.yml` (#144518)

Fix `process_changed_files` double-processing reusable-{macos, wasi] ending up with incorrect outputs

2 months agogh-144490: Fix test_cppext on Windows (#144628)
Victor Stinner [Mon, 9 Feb 2026 16:17:00 +0000 (17:17 +0100)] 
gh-144490: Fix test_cppext on Windows (#144628)

Don't include pycore_backoff.h and pycore_cell.h on Windows, since
they emit C++ compiler warnings.

2 months agogh-144601: Avoid sharing exception objects raised in a `PyInit` function across multi...
Peter Bierma [Mon, 9 Feb 2026 15:57:03 +0000 (10:57 -0500)] 
gh-144601: Avoid sharing exception objects raised in a `PyInit` function across multiple interpreters (GH-144602)

2 months agogh-134179: Use sys._clear_internal_caches() at test_cmd_line (#134180)
alexey semenyuk [Mon, 9 Feb 2026 14:40:17 +0000 (19:40 +0500)] 
gh-134179: Use sys._clear_internal_caches() at test_cmd_line (#134180)

Use sys._clear_internal_caches() instead of deprecated sys._clear_type_cache() at test_cmd_line.

2 months agogh-132604: Deprecate inherited runtime checkability of protocols (GH-143806)
Bartosz Sławecki [Mon, 9 Feb 2026 14:13:47 +0000 (15:13 +0100)] 
gh-132604: Deprecate inherited runtime checkability of protocols (GH-143806)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2 months agogh-143543: Fix re-entrant use-after-free in itertools.groupby (GH-143738)
VanshAgarwal24036 [Mon, 9 Feb 2026 14:12:25 +0000 (19:42 +0530)] 
gh-143543: Fix re-entrant use-after-free in itertools.groupby (GH-143738)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2 months agogh-144623: Fix missing output uops in optimizer debug output (GH-144617)
Hai Zhu [Mon, 9 Feb 2026 13:23:02 +0000 (21:23 +0800)] 
gh-144623: Fix missing output uops in optimizer debug output (GH-144617)

2 months agogh-141563: make `PyDateTime_IMPORT` thread-safe (#144210)
Kumar Aditya [Mon, 9 Feb 2026 13:20:35 +0000 (18:50 +0530)] 
gh-141563: make `PyDateTime_IMPORT` thread-safe (#144210)

2 months agogh-140715: Add `%F` format code support to `strptime()` (GH-140647)
Jason Yalim, PhD [Mon, 9 Feb 2026 12:24:15 +0000 (05:24 -0700)] 
gh-140715: Add `%F` format code support to `strptime()` (GH-140647)

Also: add tests for the `%T` format code

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2 months agogh-119740: Remove obsoleted removal announce for trunc delegation (GH-144622)
Sergey B Kirpichev [Mon, 9 Feb 2026 11:41:05 +0000 (14:41 +0300)] 
gh-119740: Remove obsoleted removal announce for trunc delegation (GH-144622)

This was done in GH-119743 (3.14).

2 months agogh-140550: allow slots that repeat information from PyModuleDef (GH-144340)
Petr Viktorin [Mon, 9 Feb 2026 10:35:43 +0000 (11:35 +0100)] 
gh-140550: allow slots that repeat information from PyModuleDef (GH-144340)

When integrating slots-based module creation is with the inittab,
which currently requires PyModuleDef, it would be convenient to
reuse the the same slots array for the MethodDef.

Allow slots that match what's already present in the PyModuleDef.

2 months agogh-106318: Add examples for str.partition() method (#142823)
Adorilson Bezerra [Sun, 8 Feb 2026 22:10:43 +0000 (22:10 +0000)] 
gh-106318: Add examples for str.partition() method (#142823)

2 months agogh-106318: Add example for str.isalnum() (#137550)
Adorilson Bezerra [Sun, 8 Feb 2026 22:08:18 +0000 (22:08 +0000)] 
gh-106318: Add example for str.isalnum() (#137550)

2 months agoGH-131798: Optimize `_GUARD_TOS_SLICE` (GH-144470)
Sacul [Sun, 8 Feb 2026 18:08:26 +0000 (02:08 +0800)] 
GH-131798: Optimize `_GUARD_TOS_SLICE` (GH-144470)

2 months agoFor `enum.bin`, update versionadded directive from 3.10 to 3.11 (#144574)
Guo Ci [Sun, 8 Feb 2026 07:35:02 +0000 (02:35 -0500)] 
For `enum.bin`, update versionadded directive from 3.10 to 3.11 (#144574)

2 months agoBump pre-commit hooks (#144576)
Savannah Ostrowski [Sat, 7 Feb 2026 23:14:18 +0000 (15:14 -0800)] 
Bump pre-commit hooks (#144576)

2 months agogh-143700: document `secrets.DEFAULT_ENTROPY` as an opaque value (#144568)
Bénédikt Tran [Sat, 7 Feb 2026 22:36:42 +0000 (23:36 +0100)] 
gh-143700: document `secrets.DEFAULT_ENTROPY` as an opaque value (#144568)

2 months agogh-84116: Add missing backslash to `_SubParsersAction.add_parser` signature (#144572)
Guo Ci [Sat, 7 Feb 2026 18:02:01 +0000 (13:02 -0500)] 
gh-84116: Add missing backslash to `_SubParsersAction.add_parser` signature (#144572)

2 months agogh-142044: Add note to prefer `asyncio.timeout[_at]` over `asyncio.Timeout` (#144449)
kovan [Sat, 7 Feb 2026 12:22:51 +0000 (13:22 +0100)] 
gh-142044: Add note to prefer `asyncio.timeout[_at]` over `asyncio.Timeout` (#144449)

2 months agogh-140490: Document changes for `PurePath.stem` in Python 3.14 (#144450)
kovan [Sat, 7 Feb 2026 12:19:20 +0000 (13:19 +0100)] 
gh-140490: Document changes for `PurePath.stem` in Python 3.14 (#144450)

2 months agogh-144538: Upgrade bundled pip to 26.0.1 (gh-144556)
Damian Shaw [Sat, 7 Feb 2026 10:59:54 +0000 (05:59 -0500)] 
gh-144538: Upgrade bundled pip to 26.0.1 (gh-144556)

Upgrade bundled pip to 26.0.1

2 months agogh-144490: Fix C++ compatibility in pycore_cell.h (GH-144482)
Alper [Sat, 7 Feb 2026 03:11:58 +0000 (19:11 -0800)] 
gh-144490: Fix C++ compatibility in pycore_cell.h (GH-144482)

2 months agogh-84116: Docs: Document help and aliases for argparse.add_parser() (#140574)
Krishna-web-hub [Fri, 6 Feb 2026 21:26:44 +0000 (02:56 +0530)] 
gh-84116: Docs: Document help and aliases for argparse.add_parser() (#140574)

* gh-140281: Doc: Update free-threading how-to

* gh-140281: Doc: Update free-threading how-to

* Fix trailing whitespace

* doc fixing of the cpython fixes#84116

* Docs: Document help and aliases for argparse.add_parser() (gh-84116)

* Docs: Document help and aliases for argparse.add_parser() (gh-84116)

* Fix trailing whitespace

* Fix trailing whitespace

* Fix trailing whitespace

* Fix trailing whitespace

* Fix trailing whitespace

* Fix trailing whitespace

* Fix trailing errors

* Fix trailing errors and spaces

* Fix docutils formatting, NEWS ref, and trailing whitespace

* Docs: Update argparse.rst and add NEWS entry

* Delete Doc/howto/free-threading-python.rst

* Delete Misc/NEWS.d/next/Documentation/2025-10-25-00-49-43.gh-issue-140281.tuMQUe.rst

* adding the depreceated tag

* The error indexing was fixed

* Fix trailing whitespace

* Restore missing free-threading documentation

* fixing some minor error

* fixing some minor error part 2

* fixing some minor error part 3

* Fix NEWS entry format

* Final cleanup of NEWS entry format 2

* changes in the argparse.rst

* Remove unnecessary NEWS entry

* Fixing the issue as requested

* Added the Changes done before.

* done the changes

* done the changes#1

* Apply suggestion from @picnixz

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* Apply suggestion from @picnixz

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* Done the changes

* Done the new changes

* The versionadded is rectified

* Update Doc/library/argparse.rst

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
* Docs editing

* Docs fixing whitespace

* Docs rectifiying

* little bit rectification

* Indentation rectification

* Indentation rectification 1

* Apply suggestion from @picnixz

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

* Remove mistakenly added NEWS entry

* Update Doc/library/argparse.rst

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* changes #1

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* Update Doc/library/argparse.rst 2

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* removed useless thing

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* changed according to the request

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* Updated the test part

---------

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2 months agogh-144549: Fix tail calling interpreter on Windows for FT (GH-144550)
Ken Jin [Fri, 6 Feb 2026 19:20:28 +0000 (03:20 +0800)] 
gh-144549: Fix tail calling interpreter on Windows for FT (GH-144550)

2 months agogh-143658: Use `str.lower` and `replace` to further improve performance of `importlib...
Hugo van Kemenade [Fri, 6 Feb 2026 17:38:58 +0000 (19:38 +0200)] 
gh-143658: Use `str.lower` and `replace` to further improve performance of `importlib.metadata.Prepared.normalized` (#144083)

Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
2 months agogh-132132: Upgrade to VS 2026 on Windows tailcall CI (GH-144544)
Ken Jin [Fri, 6 Feb 2026 16:36:51 +0000 (00:36 +0800)] 
gh-132132: Upgrade to VS 2026 on Windows tailcall CI (GH-144544)

Upgrade to VS 2026 on Windows tailcall CI

2 months agogh-140715: Update `datetime.*.str*time` format code tables (GH-140716)
Stan Ulbrych [Fri, 6 Feb 2026 16:08:26 +0000 (16:08 +0000)] 
gh-140715: Update `datetime.*.str*time` format code tables (GH-140716)

2 months agogh-144490: Fix test_cppext: test the internal C API (#144536)
Victor Stinner [Fri, 6 Feb 2026 15:42:42 +0000 (16:42 +0100)] 
gh-144490: Fix test_cppext: test the internal C API (#144536)

Add missing TEST_INTERNAL_C_API env var.

2 months agogh-144513: Skip critical section locking during stop-the-world (gh-144524)
Sam Gross [Fri, 6 Feb 2026 15:14:08 +0000 (10:14 -0500)] 
gh-144513: Skip critical section locking during stop-the-world (gh-144524)

When the interpreter is in a stop-the-world pause, critical sections
don't need to acquire locks since no other threads can be running.
This avoids a potential deadlock where lock fairness hands off ownership
to a thread that has already suspended for stop-the-world.

2 months agogh-144446: Fix some frame object thread-safety issues (gh-144479)
Sam Gross [Fri, 6 Feb 2026 14:43:36 +0000 (09:43 -0500)] 
gh-144446: Fix some frame object thread-safety issues (gh-144479)

Fix thread-safety issues when accessing frame attributes while another
thread is executing the frame:

- Add critical section to frame_repr() to prevent races when accessing
  the frame's code object and line number

- Add _Py_NO_SANITIZE_THREAD to PyUnstable_InterpreterFrame_GetLasti()
  to allow intentional racy reads of instr_ptr.

- Fix take_ownership() to not write to the original frame's f_executable

2 months agogh-101178: Add Ascii85, Base85, and Z85 support to binascii (GH-102753)
kangtastic [Fri, 6 Feb 2026 14:43:16 +0000 (06:43 -0800)] 
gh-101178: Add Ascii85, Base85, and Z85 support to binascii (GH-102753)

Add Ascii85, Base85, and Z85 encoders and decoders to binascii,
replacing the existing pure Python implementations in base64.

This makes the codecs two orders of magnitude faster and consume
two orders of magnitude less memory.

Note that attempting to decode Ascii85 or Base85 data of length 1 mod 5
(after accounting for Ascii85 quirks) now produces an error, as no
encoder would emit such data. This should be the only significant
externally visible difference compared to the old implementation.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2 months agogh-139103: Improve namedtuple scaling in free-threaded build (gh-144332)
Sam Gross [Fri, 6 Feb 2026 14:43:05 +0000 (09:43 -0500)] 
gh-139103: Improve namedtuple scaling in free-threaded build (gh-144332)

Add `_Py_type_getattro_stackref`, a variant of type attribute lookup
that returns `_PyStackRef` instead of `PyObject*`. This allows returning
deferred references in the free-threaded build, reducing reference count
contention when accessing type attributes.

This significantly improves scaling of namedtuple instantiation across
multiple threads.

* Add blurb

* Rename PyObject_GetAttrStackRef to _PyObject_GetAttrStackRef

* Apply suggestion from @vstinner

Co-authored-by: Victor Stinner <vstinner@python.org>
* Apply suggestion from @vstinner

Co-authored-by: Victor Stinner <vstinner@python.org>
* format

* Update Include/internal/pycore_function.h

Co-authored-by: Victor Stinner <vstinner@python.org>
---------

Co-authored-by: Victor Stinner <vstinner@python.org>
2 months agoDocs: module pages should not link to themselves (#144505)
Ned Batchelder [Fri, 6 Feb 2026 11:48:27 +0000 (06:48 -0500)] 
Docs: module pages should not link to themselves (#144505)

* Docs: module pages should not link to themselves

* fix header punctuation

2 months agogh-141004: Reorganize and reword the 'Useful macros' section (GH-144471)
Petr Viktorin [Fri, 6 Feb 2026 10:55:11 +0000 (11:55 +0100)] 
gh-141004: Reorganize and reword the 'Useful macros' section (GH-144471)

- Group the macros
- Roughly order them to put the most important ones first
- Add expansions where it makes sense; especially if there's
  an equivalent in modern C or a common compiler

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2 months agoDocs: Pull expat license from `Modules/expat/` in `license.rst` (#144488)
Stan Ulbrych [Fri, 6 Feb 2026 08:54:34 +0000 (08:54 +0000)] 
Docs: Pull expat license from `Modules/expat/` in `license.rst` (#144488)

Use license directly from Modules/expat/COPYING.

Co-authored-by: Victor Stinner <vstinner@python.org>
2 months agogh-144493: Improve error message in _overlapped.BindLocal() (#144495)
David Lechner [Fri, 6 Feb 2026 08:51:19 +0000 (02:51 -0600)] 
gh-144493: Improve error message in _overlapped.BindLocal() (#144495)

Replace a confusing error message with one that actually explains what the error is in `_overlapped.BindLocal()`.

Fixes: https://github.com/python/cpython/issues/144493
2 months agogh-74453: Deprecate os.path.commonprefix (#144436)
Seth Michael Larson [Thu, 5 Feb 2026 20:37:05 +0000 (14:37 -0600)] 
gh-74453: Deprecate os.path.commonprefix (#144436)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2 months agogh-77188: Add support for pickling private methods and nested classes (GH-21480)
Zackery Spytz [Thu, 5 Feb 2026 19:50:51 +0000 (11:50 -0800)] 
gh-77188: Add support for pickling private methods and nested classes (GH-21480)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2 months agogh-144001: Support ignoring the invalid pad character in Base64 decoding (GH-144306)
Serhiy Storchaka [Thu, 5 Feb 2026 19:14:49 +0000 (21:14 +0200)] 
gh-144001: Support ignoring the invalid pad character in Base64 decoding (GH-144306)

2 months agogh-74955: Document that __all__ must contain strings in normalization form NFKC ...
Serhiy Storchaka [Thu, 5 Feb 2026 18:06:33 +0000 (20:06 +0200)] 
gh-74955: Document that __all__ must contain strings in normalization form NFKC (GH-144504)

2 months agoMore realistic lru_cache example (gh-144517)
Raymond Hettinger [Thu, 5 Feb 2026 18:04:12 +0000 (12:04 -0600)] 
More realistic lru_cache example (gh-144517)

2 months agogh-142407: Clarify copy performance on Windows in shutil docs (GH-142408)
NewUserHa [Thu, 5 Feb 2026 17:45:14 +0000 (01:45 +0800)] 
gh-142407: Clarify copy performance on Windows in shutil docs (GH-142408)

2 months agogh-144484: Warn users not to use wsgiref in production 144516/head
Seth Michael Larson [Thu, 5 Feb 2026 15:43:39 +0000 (09:43 -0600)] 
gh-144484: Warn users not to use wsgiref in production

2 months agogh-144148: Update the urllib.parse documentation (GH-144497)
Serhiy Storchaka [Thu, 5 Feb 2026 14:32:17 +0000 (16:32 +0200)] 
gh-144148: Update the urllib.parse documentation (GH-144497)

Document urlsplit() as the main parsing function and urlparse() as
an obsolete variant.

2 months agogh-144363: Update bundled libexpat to 2.7.4 (#144365)
Stan Ulbrych [Thu, 5 Feb 2026 12:58:18 +0000 (12:58 +0000)] 
gh-144363: Update bundled libexpat to 2.7.4 (#144365)

* Update to 2.7.4

* update expat license copyright year to match and a pedantic #define

* include COPYING update in refresh.sh

* Update checksum for copying

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2 months agogh-144330: Initialize classmethod and staticmethod in new (#144469)
Victor Stinner [Thu, 5 Feb 2026 10:32:56 +0000 (11:32 +0100)] 
gh-144330: Initialize classmethod and staticmethod in new (#144469)

Move classmethod and staticmethod initialization from __init__() to
__new__().

PyClassMethod_New() and PyStaticMethod_New() now copy attributes of
the wrapped functions: __module__, __name__, __qualname__ and
__doc__.

Change static type initialization: initialize PyStaticMethod_Type and
PyCFunction_Type earlier.

Remove test_refleaks_in_classmethod___init__() and
test_refleaks_in_staticmethod___init__() tests from test_descr since
classmethod and staticmethod have no __init__() method anymore.

2 months agoGH-144179: Use recorded values to make optimizer more robust (GH-144437)
Mark Shannon [Thu, 5 Feb 2026 08:58:41 +0000 (08:58 +0000)] 
GH-144179: Use recorded values to make optimizer more robust (GH-144437)

* Add three new symbol kinds
* Do not smuggle code object in _PUSH_FRAME operand
* Fix small bug in predicate analysis

2 months agoItertools recipes: Replace the tabulate() example with running_mean() (gh-144483)
Raymond Hettinger [Wed, 4 Feb 2026 20:21:20 +0000 (14:21 -0600)] 
Itertools recipes:  Replace the tabulate() example with running_mean() (gh-144483)

2 months agogh-123471: Make concurrent iteration over `itertools.permutations` and `itertools...
Pieter Eendebak [Wed, 4 Feb 2026 18:38:45 +0000 (19:38 +0100)] 
gh-123471: Make concurrent iteration over `itertools.permutations` and `itertools.combinations_with_replacement` thread-safe (gh-144402)

2 months agogh-143962: Improve name suggestions for not normalized names (GH-144154)
Serhiy Storchaka [Wed, 4 Feb 2026 17:23:09 +0000 (19:23 +0200)] 
gh-143962: Improve name suggestions for not normalized names (GH-144154)

Suggest the normalized name or the closest name to the normalized name.
If the suggested name is not ASCII, include also its ASCII representation.

2 months agogh-106318: Add examples for `str.startswith()` method (#144369)
Adorilson Bezerra [Wed, 4 Feb 2026 17:17:42 +0000 (17:17 +0000)] 
gh-106318: Add examples for `str.startswith()` method (#144369)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2 months agogh-141004: Document remaining `pyport.h` utility macros (GH-144279)
Peter Bierma [Wed, 4 Feb 2026 16:43:47 +0000 (11:43 -0500)] 
gh-141004: Document remaining `pyport.h` utility macros (GH-144279)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2 months agogh-141984: Reword and reorganize Subscription (and Slicing) docs (GH-141985)
Petr Viktorin [Wed, 4 Feb 2026 16:08:23 +0000 (17:08 +0100)] 
gh-141984: Reword and reorganize Subscription (and Slicing) docs (GH-141985)

Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2 months agogh-140824: Fix _Py_DumpExtensionModules() to ignore sub-modules (#144339)
Victor Stinner [Wed, 4 Feb 2026 15:06:35 +0000 (16:06 +0100)] 
gh-140824: Fix _Py_DumpExtensionModules() to ignore sub-modules (#144339)

Ignore "math.integer" extension if "math" is in
sys.stdlib_module_names.

2 months agogh-142903: add conda-forge license for pixi-packages (#143468)
Lucas Colley [Wed, 4 Feb 2026 12:36:14 +0000 (12:36 +0000)] 
gh-142903: add conda-forge license for pixi-packages (#143468)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: h-vetinari <h.vetinari@gmx.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2 months agogh-144386: Add support for descriptors in ExitStack and AsyncExitStack (#144420)
Serhiy Storchaka [Wed, 4 Feb 2026 11:20:18 +0000 (13:20 +0200)] 
gh-144386: Add support for descriptors in ExitStack and AsyncExitStack (#144420)

__enter__(), __exit__(), __aenter__(), and __aexit__() can now be
arbitrary descriptors, not only normal methods, for consistency with the
"with" and "async with" statements.

2 months agogh-141444: Replace dead URL in urllib.robotparser example (GH-144443)
kovan [Wed, 4 Feb 2026 08:45:15 +0000 (09:45 +0100)] 
gh-141444: Replace dead URL in urllib.robotparser example (GH-144443)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2 months agogh-143120: pixi builds for free-threading and TSAN (#142872)
Guido Imperiale [Wed, 4 Feb 2026 04:28:29 +0000 (04:28 +0000)] 
gh-143120: pixi builds for free-threading and TSAN (#142872)

Co-authored-by: Isuru Fernando <isuruf@gmail.com>
Co-authored-by: Lucas Colley <lucas.colley8@gmail.com>
2 months agoRemove unused PYEXPAT_EXPORTS from PCBuild/pyexpat.vcxproj (GH-144462)
Max Bachmann [Tue, 3 Feb 2026 23:38:22 +0000 (00:38 +0100)] 
Remove unused PYEXPAT_EXPORTS from PCBuild/pyexpat.vcxproj (GH-144462)

2 months agogh-120321: Add gi_state, cr_state, and ag_state attributes (gh-144409)
Sam Gross [Tue, 3 Feb 2026 18:06:32 +0000 (13:06 -0500)] 
gh-120321: Add gi_state, cr_state, and ag_state attributes (gh-144409)

Add `gi_state`, `cr_state`, and `ag_state` attributes to generators,
coroutines, and async generators respectively. These attributes return the
current state as a string (e.g., `GEN_RUNNING`, `CORO_SUSPENDED`).

The `inspect.getgeneratorstate()`, `inspect.getcoroutinestate()`, and
`inspect.getasyncgenstate()` functions now return these attributes directly.

This is in preparation for making `gi_frame` thread-safe, which may involve
stop-the-world synchronization. The new state attributes avoid potential
performance cliffs in `inspect.getgeneratorstate()` and similar functions by
not requiring frame access.

Also removes unused `FRAME_COMPLETED` state and renumbers the frame state enum
to start at 0 instead of -1.

2 months agogh-139103: Use borrowed references for positional args in _PyStack_UnpackDict (gh...
Sam Gross [Tue, 3 Feb 2026 17:24:35 +0000 (12:24 -0500)] 
gh-139103: Use borrowed references for positional args in _PyStack_UnpackDict (gh-144407)

The positional arguments passed to _PyStack_UnpackDict are already
kept alive by the caller, so we can avoid the extra reference count
operations by using borrowed references instead of creating new ones.

This reduces reference count contention in the free-threaded build
when calling functions with keyword arguments. In particular, this
avoids contention on the type argument to `__new__` when instantiating
namedtuples with keyword arguments.

2 months agogh-127313: Use getLogger() without argument to get root logger in logging cookbook...
AN Long [Tue, 3 Feb 2026 14:49:12 +0000 (23:49 +0900)] 
gh-127313: Use getLogger() without argument to get root logger in logging cookbook (GH-143683)

Use getLogger() to get root logger in logging cookbook

2 months agogh-74453: Add stronger security warning to os.path.commonprefix (GH-144401)
Seth Michael Larson [Tue, 3 Feb 2026 14:07:59 +0000 (08:07 -0600)] 
gh-74453: Add stronger security warning to os.path.commonprefix (GH-144401)

2 months agogh-106318: Add examples for str.rindex() method (#143887)
Adorilson Bezerra [Tue, 3 Feb 2026 13:29:05 +0000 (13:29 +0000)] 
gh-106318: Add examples for str.rindex() method (#143887)

Co-authored-by: Victor Stinner <vstinner@python.org>
2 months agogh-142956: Update `tomllib` to parse TOML 1.1.0 (#144243)
Taneli Hukkinen [Tue, 3 Feb 2026 12:41:57 +0000 (14:41 +0200)] 
gh-142956: Update `tomllib` to parse TOML 1.1.0 (#144243)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2 months agogh-144377: Clean up sqlite3 Connection's list of weakrefs to Cursor objects (#144378)
Thomas Kluyver [Tue, 3 Feb 2026 12:36:12 +0000 (12:36 +0000)] 
gh-144377: Clean up sqlite3 Connection's list of weakrefs to Cursor objects (#144378)

2 months agogh-132888: Fix Windows API error checking in pyrepl.windows_console (#144248)
AN Long [Tue, 3 Feb 2026 12:25:29 +0000 (21:25 +0900)] 
gh-132888: Fix Windows API error checking in pyrepl.windows_console (#144248)

2 months agogh-139103: use `METH_FASTCALL` for tp_new_wrapper (#144406)
Sam Gross [Tue, 3 Feb 2026 10:32:06 +0000 (05:32 -0500)] 
gh-139103: use `METH_FASTCALL` for tp_new_wrapper (#144406)

2 months agogh-144415: Android testbed fixes (#142912)
Malcolm Smith [Tue, 3 Feb 2026 08:37:34 +0000 (08:37 +0000)] 
gh-144415: Android testbed fixes (#142912)

Modifies handling of `.gz` files in Android app payloads, and ensures that
when the Android testbed streams logs, stream flushes aren't treated as
newlines. This improves the output of test suites that use "one dot per test"
progress indicators.

2 months agogh-75572: Speed up test_xpickle (GH-144393)
Serhiy Storchaka [Mon, 2 Feb 2026 18:00:12 +0000 (20:00 +0200)] 
gh-75572: Speed up test_xpickle (GH-144393)

Run a long living subprocess which handles multiple requests instead of
running a new subprocess for each request.

2 months agogh-139109: Replace `_CHECK_STACK_SPACE` with `_CHECK_STACK_SPACE_OPERAND` in JIT...
Hai Zhu [Mon, 2 Feb 2026 17:12:01 +0000 (01:12 +0800)] 
gh-139109: Replace `_CHECK_STACK_SPACE` with `_CHECK_STACK_SPACE_OPERAND` in JIT optiimizer (GH-144394)

2 months agoGH-144179: Add value recording to JIT tracing front-end (GH-144303)
Mark Shannon [Mon, 2 Feb 2026 16:57:04 +0000 (16:57 +0000)] 
GH-144179: Add value recording to JIT tracing front-end (GH-144303)

2 months agogh-144376: Only run 'address' fuzzer for python3-libraries (#144398)
Seth Michael Larson [Mon, 2 Feb 2026 15:55:11 +0000 (09:55 -0600)] 
gh-144376: Only run 'address' fuzzer for python3-libraries (#144398)

2 months agogh-144242: Note that issues aren't needed for typos in docs template (GH-144288)
Stan Ulbrych [Mon, 2 Feb 2026 14:56:45 +0000 (14:56 +0000)] 
gh-144242: Note that issues aren't needed for typos in docs template (GH-144288)

2 months agogh-142555: Fix null pointer dereference in array.__setitem__ via re-entrant __index__...
AN Long [Mon, 2 Feb 2026 14:44:08 +0000 (23:44 +0900)] 
gh-142555: Fix null pointer dereference in array.__setitem__ via re-entrant __index__ (GH-142713)

2 months agogh-134160: "First extension module" tutorial improvements (GH-144183)
Petr Viktorin [Mon, 2 Feb 2026 14:32:25 +0000 (15:32 +0100)] 
gh-134160: "First extension module" tutorial improvements (GH-144183)

- Pass -v to pip, so compiler output is visible
- Move the call ``spam.system(3)`` up so that error handling is tested
  right after it's added
- Use `PyUnicode_AsUTF8AndSize` as `PyUnicode_AsUTF8` is not in the
  Limited API.
- Add a footnote about embedded NULs.

2 months agogh-144145: Revert PR#144122 for performance and potential bugs. (GH-144391)
Hai Zhu [Mon, 2 Feb 2026 14:09:54 +0000 (22:09 +0800)] 
gh-144145: Revert PR#144122 for performance and potential bugs. (GH-144391)

Revert "gh-144145: Track nullness of properties in the Tier 2 JIT optimizer (GH-144122)"

This reverts commit 1dc12b2883c89045469f3c401157d4df13f535f0.

2 months agogh-144001: Simplify Base64 decoding with altchars and ignorechars specified (GH-144324)
Serhiy Storchaka [Mon, 2 Feb 2026 11:38:32 +0000 (13:38 +0200)] 
gh-144001: Simplify Base64 decoding with altchars and ignorechars specified (GH-144324)

Treat "+" and "/" like other characters not in the alternative Base64
alphabet when both altchars and ignorechars are specified.
E.g. discard them if they are not in altchars but are in ignorechars,
and set error if they are not in altchars and not in ignorechars.
Only emit warnings if ignorechars is not specified.

2 months agogh-115231: Fill __module__ for built-in staticmethods (#115232)
Sergey B Kirpichev [Mon, 2 Feb 2026 11:34:02 +0000 (14:34 +0300)] 
gh-115231: Fill __module__ for built-in staticmethods (#115232)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Victor Stinner <vstinner@python.org>
2 months agodocs: update dangling reference to `LOAD_METHOD` in dis.rst (#144358)
Guilherme Leobas [Mon, 2 Feb 2026 10:30:17 +0000 (07:30 -0300)] 
docs: update dangling reference to `LOAD_METHOD` in dis.rst (#144358)

2 months agogh-144380: Fix incorrect type check in `buffered_iternext()` (#144381)
Ruiyang Ke [Mon, 2 Feb 2026 10:04:18 +0000 (02:04 -0800)] 
gh-144380: Fix incorrect type check in `buffered_iternext()` (#144381)

2 months agogh-144277: Fix usage of free-threaded terminology in the documentation (GH-144333)
Peter Bierma [Mon, 2 Feb 2026 01:39:26 +0000 (17:39 -0800)] 
gh-144277: Fix usage of free-threaded terminology in the documentation (GH-144333)

2 months agogh-143904: Raise OverflowError instead of IndexError for too large offset in struct... 144349/head
Serhiy Storchaka [Sun, 1 Feb 2026 13:25:59 +0000 (15:25 +0200)] 
gh-143904: Raise OverflowError instead of IndexError for too large offset in struct.pack_into() (GH-143905)

2 months agogh-144348: annotationlib: fix test that relies on set ordering (#144359)
Jelle Zijlstra [Sun, 1 Feb 2026 04:05:46 +0000 (20:05 -0800)] 
gh-144348: annotationlib: fix test that relies on set ordering (#144359)

2 months agoFix unused variable 'COLORS' warning in optimizer.c (#144373)
AN Long [Sun, 1 Feb 2026 04:01:45 +0000 (13:01 +0900)] 
Fix unused variable 'COLORS' warning in optimizer.c (#144373)

2 months agogh-143055: Implementation of PEP 798 (#143056)
adam j hartz [Sat, 31 Jan 2026 04:37:52 +0000 (23:37 -0500)] 
gh-143055: Implementation of PEP 798 (#143056)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2 months agogh-144319: Fix huge page safety in pymalloc arenas (#144331) 128880/head
Pablo Galindo Salgado [Fri, 30 Jan 2026 18:18:56 +0000 (18:18 +0000)] 
gh-144319: Fix huge page safety in pymalloc arenas (#144331)

The pymalloc huge page support had two problems. First, on
architectures where the default huge page size exceeds the arena
size (e.g. 32 MiB on PPC, 512 MiB on ARM64 with 64 KB base
pages), mmap with MAP_HUGETLB silently allocates a full huge page
even when the requested size is smaller. The subsequent munmap
with the original arena size then fails with EINVAL, permanently
leaking the entire huge page. Second, huge pages were always
attempted when compiled in, with no way to disable them at
runtime. On Linux, if the huge page pool is exhausted, page
faults including copy-on-write faults after fork deliver SIGBUS
and kill the process.

The arena allocator now queries the system huge page size from
/proc/meminfo and skips MAP_HUGETLB when the arena size is not a
multiple of it. Huge pages also now require explicit opt-in at
runtime via the PYTHON_PYMALLOC_HUGEPAGES environment variable,
which is read through PyConfig and respects -E and -I flags.
The config field pymalloc_hugepages is propagated to the runtime
allocators struct so the low-level arena allocator can check it
without calling getenv directly.

2 months agogh-120321: Make gi_yieldfrom thread-safe in free-threading build (#144292)
Sam Gross [Fri, 30 Jan 2026 17:20:27 +0000 (12:20 -0500)] 
gh-120321: Make gi_yieldfrom thread-safe in free-threading build (#144292)

Add a FRAME_SUSPENDED_YIELD_FROM_LOCKED state that acts as a brief
lock, preventing other threads from transitioning the frame state
while gen_getyieldfrom reads the yield-from object off the stack.

2 months agogh-144280: Add missing predicate symbol to case-switch (GH-144298)
reiden [Fri, 30 Jan 2026 16:43:27 +0000 (00:43 +0800)] 
gh-144280: Add missing predicate symbol to case-switch (GH-144298)

2 months agogh-144295: Fix data race in dict method lookup and global load (gh-144312)
Sam Gross [Fri, 30 Jan 2026 16:14:10 +0000 (11:14 -0500)] 
gh-144295: Fix data race in dict method lookup and global load (gh-144312)

In `_PyDict_GetMethodStackRef`, only use the fast-path unicode lookup
when the dict is owned by the current thread or already marked as shared.
This prevents a race between the lookup and concurrent dict resizes,
which may free the PyDictKeysObject (i.e., it ensures that the resize
uses QSBR).

Address a similar issue in `_Py_dict_lookup_threadsafe_stackref` by
calling `ensure_shared_on_read()`.

2 months agogh-144145: Track nullness of properties in the Tier 2 JIT optimizer (GH-144122)
Hai Zhu [Fri, 30 Jan 2026 15:25:19 +0000 (23:25 +0800)] 
gh-144145: Track nullness of properties in the Tier 2 JIT optimizer (GH-144122)

2 months agogh-144342: Use `time.sleep` in `profiling.sampling` (#144343)
Maurycy Pawłowski-Wieroński [Fri, 30 Jan 2026 15:13:21 +0000 (16:13 +0100)] 
gh-144342: Use `time.sleep` in `profiling.sampling` (#144343)

2 months agogh-143423: Fix free-threaded build detection in sampling profiler (#143426)
Divyanshu Choudhury [Fri, 30 Jan 2026 00:35:30 +0000 (06:05 +0530)] 
gh-143423: Fix free-threaded build detection in sampling profiler (#143426)

2 months agogh-143192 Avoid incref/decref pair in long_bitwise (gh-143194)
Pieter Eendebak [Thu, 29 Jan 2026 21:32:09 +0000 (22:32 +0100)] 
gh-143192 Avoid incref/decref pair in long_bitwise (gh-143194)

Remove unnecessary reference count operations in long_bitwise in order to
avoid reference count contention in the free-threading build.

2 months agogh-144307: Fix a reference leak during module teardown (GH-144308)
Yongtao Huang [Thu, 29 Jan 2026 18:50:54 +0000 (02:50 +0800)] 
gh-144307: Fix a reference leak during module teardown (GH-144308)

Signed-off-by: Yongtao Huang <yongtaoh2022@gamil.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2 months agoTest: fix stale uops usage in `test_capi/test_opt.py` (GH-144239)
Yongtao Huang [Thu, 29 Jan 2026 17:08:14 +0000 (01:08 +0800)] 
Test: fix stale uops usage in `test_capi/test_opt.py` (GH-144239)

Signed-off-by: Yongtao Huang <yongtaoh2022@gmail.com>
2 months agogh-143946: Add more debug info in `optimize_uops` (GH-144262)
Hai Zhu [Thu, 29 Jan 2026 16:58:01 +0000 (00:58 +0800)] 
gh-143946: Add more debug info in `optimize_uops` (GH-144262)

2 months agogh-144264: Speed up Base64 decoding of data containing ignored characters (GH-144265)
Serhiy Storchaka [Thu, 29 Jan 2026 15:33:10 +0000 (17:33 +0200)] 
gh-144264: Speed up Base64 decoding of data containing ignored characters (GH-144265)

Try the fast path again after decoding a quad the slow path.
Use a bitmap cache for the ignorechars argument.