]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
9 months agogh-128563: Move GO_TO_INSTRUCTION and PREDICT to cases generator (GH-129115)
Ken Jin [Wed, 22 Jan 2025 01:22:25 +0000 (09:22 +0800)] 
gh-128563: Move GO_TO_INSTRUCTION and PREDICT to cases generator (GH-129115)

9 months agogh-129093: Fix f-string debug text sometimes getting cut off when expression contains...
Tomas R. [Wed, 22 Jan 2025 00:26:37 +0000 (01:26 +0100)] 
gh-129093: Fix f-string debug text sometimes getting cut off when expression contains `!` (#129159)

9 months agoGH-121970: Extract ``pydoc_topics`` into a new extension (#129116)
Adam Turner [Tue, 21 Jan 2025 23:28:32 +0000 (23:28 +0000)] 
GH-121970: Extract ``pydoc_topics`` into a new extension (#129116)

9 months agogh-118878: Pyrepl: show completions menu below the current line (#118939)
Daniel Hollas [Tue, 21 Jan 2025 21:06:13 +0000 (21:06 +0000)] 
gh-118878: Pyrepl: show completions menu below the current line (#118939)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
9 months agogh-123024: Correctly prepare/restore around help and show-history commands (#124485)
Lysandros Nikolaou [Tue, 21 Jan 2025 21:04:30 +0000 (22:04 +0100)] 
gh-123024: Correctly prepare/restore around help and show-history commands (#124485)

Co-authored-by: Emily Morehouse <emily@cuttlesoft.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
9 months agogh-126332: Fix pyrepl crash for double ctrl-z in line overflow (#126650)
Pieter Eendebak [Tue, 21 Jan 2025 20:14:10 +0000 (21:14 +0100)] 
gh-126332: Fix pyrepl crash for double ctrl-z in line overflow (#126650)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
9 months agogh-126172: Fix a misleading statement in PYTHON_BASIC_REPL documentation (#127203)
Michael Kashirin [Tue, 21 Jan 2025 20:05:19 +0000 (23:05 +0300)] 
gh-126172: Fix a misleading statement in PYTHON_BASIC_REPL documentation (#127203)

Fix a misleading statement in PYTHON_BASIC_REPL documentation.

9 months agogh-122845: fix parameter_list_starargs in function definition pseudo-grammar (#122847)
Sergey B Kirpichev [Tue, 21 Jan 2025 20:04:07 +0000 (23:04 +0300)] 
gh-122845: fix parameter_list_starargs in function definition pseudo-grammar (#122847)

Thanks to Artur Chakhvadze for bugfix.

9 months agogh-125553: Fix backslash continuation in `untokenize` (#126010)
Tomas R. [Tue, 21 Jan 2025 19:58:44 +0000 (20:58 +0100)] 
gh-125553: Fix backslash continuation in `untokenize` (#126010)

9 months agogh-128720: Fix doc inacurracy about __main__.__file__ existence in the REPL (#128721)
Wim Jeantine-Glenn [Tue, 21 Jan 2025 19:52:21 +0000 (13:52 -0600)] 
gh-128720: Fix doc inacurracy about __main__.__file__ existence in the REPL (#128721)

Fix doc inacurracy about __main__.__file__ existence in the REPL

9 months agoGH-128520: Make `pathlib._abc.WritablePath` a sibling of `ReadablePath` (#129014)
Barney Gale [Tue, 21 Jan 2025 18:35:37 +0000 (18:35 +0000)] 
GH-128520: Make `pathlib._abc.WritablePath` a sibling of `ReadablePath` (#129014)

In the private pathlib ABCs, support write-only virtual filesystems by
making `WritablePath` inherit directly from `JoinablePath`, rather than
subclassing `ReadablePath`.

There are two complications:

- `ReadablePath.open()` applies to both reading and writing
- `ReadablePath.copy` is secretly an object that supports the *read* side
  of copying, whereas `WritablePath.copy` is a different kind of object
  supporting the *write* side

We untangle these as follow:

- A new `pathlib._abc.magic_open()` function replaces the `open()` method,
  which is dropped from the ABCs but remains in `pathlib.Path`. The
  function works like `io.open()`, but additionally accepts objects with
  `__open_rb__()` or `__open_wb__()` methods as appropriate for the mode.
  These new dunders are made abstract methods of `ReadablePath` and
  `WritablePath` respectively.  If the pathlib ABCs are made public, we
  could consider blessing an "openable" protocol and supporting it in
  `io.open()`, removing the need for `pathlib._abc.magic_open()`.
- `ReadablePath.copy` becomes a true method, whereas `WritablePath.copy` is
  deleted. A new `ReadablePath._copy_reader` property provides a
  `CopyReader` object, and similarly `WritablePath._copy_writer` is a
  `CopyWriter` object. Once GH-125413 is resolved, we'll be able to move
  the `CopyReader` functionality into `ReadablePath.info` and eliminate
  `ReadablePath._copy_reader`.

9 months agogh-129141: Fix build on gcc-9.4.0 (GH-129142)
Michael Droettboom [Tue, 21 Jan 2025 18:13:33 +0000 (13:13 -0500)] 
gh-129141: Fix build on gcc-9.4.0 (GH-129142)

9 months agogh-127873: Only check `sys.flags.ignore_environment` for `PYTHON*` env vars (#127877)
Hugo van Kemenade [Tue, 21 Jan 2025 16:10:08 +0000 (18:10 +0200)] 
gh-127873: Only check `sys.flags.ignore_environment` for `PYTHON*` env vars (#127877)

9 months agogh-128889: Zero out memory ctypes for generated struct layout tests (GH-128944)
Petr Viktorin [Tue, 21 Jan 2025 15:29:02 +0000 (16:29 +0100)] 
gh-128889: Zero out memory ctypes for generated struct layout tests (GH-128944)

9 months agogh-71339: Fix an order-dependent failure in test_unittest (GH-129133)
Serhiy Storchaka [Tue, 21 Jan 2025 14:45:20 +0000 (16:45 +0200)] 
gh-71339: Fix an order-dependent failure in test_unittest (GH-129133)

It failed if it was preceded by test_builtin.

9 months agogh-128563: Move lltrace into the frame struct (GH-129113)
Ken Jin [Tue, 21 Jan 2025 14:17:15 +0000 (22:17 +0800)] 
gh-128563: Move lltrace into the frame struct (GH-129113)

9 months agogh-128679: Use _PyThreadState_GET() in tracemalloc.c (#129126)
Victor Stinner [Tue, 21 Jan 2025 13:43:31 +0000 (14:43 +0100)] 
gh-128679: Use _PyThreadState_GET() in tracemalloc.c (#129126)

Replace uncommon PyGILState_GetThisThreadState() with common
_PyThreadState_GET().

9 months agogh-129064: Fix RST markup for the NEWS and What's New entries (#129131)
Bénédikt Tran [Tue, 21 Jan 2025 11:43:09 +0000 (12:43 +0100)] 
gh-129064: Fix RST markup for the NEWS and What's New entries (#129131)

This amends the NEWS and What's New entries introduced in 0a6412f9cc9e694e76299cfbd73ec969b7d47af6.

9 months agogh-126925: Make PyConfig.use_system_logger read-only (#129124)
Victor Stinner [Tue, 21 Jan 2025 11:02:38 +0000 (12:02 +0100)] 
gh-126925: Make PyConfig.use_system_logger read-only (#129124)

The variable is only used once during early Python initialization, it
doesn't make sense to modify it at runtime.

9 months agoRemove PyInit__imp() function (#129125)
Victor Stinner [Tue, 21 Jan 2025 10:58:43 +0000 (11:58 +0100)] 
Remove PyInit__imp() function (#129125)

This function was exposed by mistake to the public C API. It's the
only "PyInit" function which is exposed.

9 months agogh-111178: fix UBSan failures in `Modules/_ctypes` (#129071)
Bénédikt Tran [Tue, 21 Jan 2025 10:50:13 +0000 (11:50 +0100)] 
gh-111178: fix UBSan failures in `Modules/_ctypes` (#129071)

This fixes UBSan failures for the following objects:

- `DictRemoverObject` and `StructParamObject`,
- `CDataObject` and `CFieldObject`, and
- `PyCFuncPtrObject` and `PyCArgObject`.

On the default build, we convert the `LOCK_PTR` and `UNLOCK_PTR` macros to
functions with an unused parameter to ease "unused variable" compiler warnings
suppression. Finally, we also remove some redundant casts to `PyObject *`.

9 months agogh-127787: allow retrieving the clipped slice length in `_PyUnicodeError_GetParams...
Bénédikt Tran [Tue, 21 Jan 2025 10:45:53 +0000 (11:45 +0100)] 
gh-127787: allow retrieving the clipped slice length in `_PyUnicodeError_GetParams` (GH-128980)

9 months agogh-126349: test_turtle: Add cleanup to avoid reference leaks (GH-129079)
Petr Viktorin [Tue, 21 Jan 2025 10:28:34 +0000 (11:28 +0100)] 
gh-126349: test_turtle: Add cleanup to avoid reference leaks (GH-129079)

9 months agoGH-128563: Add new frame owner type for interpreter entry frames (GH-129078)
Mark Shannon [Tue, 21 Jan 2025 10:15:02 +0000 (10:15 +0000)] 
GH-128563: Add new frame owner type for interpreter entry frames (GH-129078)

Add new frame owner type for interpreter entry frames

9 months agogh-128156: Guard use of `ffi_type_complex_double` on macOS system libffi (GH-128680)
Petr Viktorin [Tue, 21 Jan 2025 09:59:18 +0000 (10:59 +0100)] 
gh-128156: Guard use of `ffi_type_complex_double` on macOS system libffi (GH-128680)

* Determine ffi complex support at runtime
* Also, generate SIMPLE_TYPE_CHARS once at runtime

9 months agoGH-127953: Make line number lookup O(1) regardless of the size of the code object...
Mark Shannon [Tue, 21 Jan 2025 09:33:23 +0000 (09:33 +0000)] 
GH-127953: Make line number lookup O(1) regardless of the size of the code object (GH-128350)

9 months agogh-71339: Use new assertion methods in test_import and test_importlib (GH-129052)
Serhiy Storchaka [Tue, 21 Jan 2025 09:24:19 +0000 (11:24 +0200)] 
gh-71339: Use new assertion methods in test_import and test_importlib (GH-129052)

9 months agoDocs: fix typo in `Doc/howto/mro.rst` (GH-129095)
smelnikov [Tue, 21 Jan 2025 09:22:13 +0000 (13:22 +0400)] 
Docs: fix typo in `Doc/howto/mro.rst` (GH-129095)

9 months agogh-128595: Fix `test__colorize` unexpected keyword argument 'file' on buildbots ...
Hugo van Kemenade [Tue, 21 Jan 2025 09:20:54 +0000 (11:20 +0200)] 
gh-128595: Fix `test__colorize` unexpected keyword argument 'file' on buildbots (#129070)

9 months agoRevert "doc: add social cards generation support in sphinxext-opengraph (#129085...
Adam Turner [Mon, 20 Jan 2025 23:53:33 +0000 (23:53 +0000)] 
Revert "doc: add social cards generation support in sphinxext-opengraph (#129085)" (#129106)

9 months agoGH-121970: Extract ``changes`` into a new extension (#129105)
Adam Turner [Mon, 20 Jan 2025 23:53:08 +0000 (23:53 +0000)] 
GH-121970: Extract ``changes`` into a new extension (#129105)

9 months agoAdd Adam Turner to CODEOWNERS (#129104)
Adam Turner [Mon, 20 Jan 2025 22:32:31 +0000 (22:32 +0000)] 
Add Adam Turner to CODEOWNERS (#129104)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
9 months agoGH-92897: schedule the check_home deprecation to 3.15 (#129102)
Filipe Laíns 🇵🇸 [Mon, 20 Jan 2025 21:25:14 +0000 (21:25 +0000)] 
GH-92897: schedule the check_home deprecation to 3.15 (#129102)

9 months agogh-111178: fix UBSan failures in `Modules/_multiprocessing/semaphore.c` (#129084)
Bénédikt Tran [Mon, 20 Jan 2025 20:43:55 +0000 (21:43 +0100)] 
gh-111178: fix UBSan failures in `Modules/_multiprocessing/semaphore.c` (#129084)

fix UBSan failures for `SemLockObject`

9 months agodoc: add social cards generation support in sphinxext-opengraph (#129085)
Filipe Laíns 🇵🇸 [Mon, 20 Jan 2025 20:41:27 +0000 (20:41 +0000)] 
doc: add social cards generation support in sphinxext-opengraph (#129085)

9 months agodoc: fix venv creating for the local Python using uv (#129094)
Filipe Laíns 🇵🇸 [Mon, 20 Jan 2025 19:04:05 +0000 (19:04 +0000)] 
doc: fix venv creating for the local Python using uv (#129094)

9 months agogh-91279: ZipFile.writestr now respect SOURCE_DATE_EPOCH (#124435)
Wulian [Mon, 20 Jan 2025 18:12:29 +0000 (02:12 +0800)] 
gh-91279: ZipFile.writestr now respect SOURCE_DATE_EPOCH (#124435)

9 months agoGH-128131: Completely support random read access of uncompressed unencrypted files...
5ec1cff [Mon, 20 Jan 2025 18:04:43 +0000 (02:04 +0800)] 
GH-128131: Completely support random read access of uncompressed unencrypted files in ZipFile (#128143)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
9 months agogh-128588: gh-128550: remove eager tasks optimization that missed and introduced...
Thomas Grainger [Mon, 20 Jan 2025 17:13:01 +0000 (17:13 +0000)] 
gh-128588: gh-128550: remove eager tasks optimization that missed and introduced incorrect cancellations (#129063)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
9 months agoGH-128914: Remove conditional stack effects from `bytecodes.c` and the code generator...
Mark Shannon [Mon, 20 Jan 2025 17:09:23 +0000 (17:09 +0000)] 
GH-128914: Remove conditional stack effects from `bytecodes.c` and the code generators (GH-128918)

9 months agoGH-129064: deprecate sysconfig.expand_makefile_vars (#129082)
Filipe Laíns 🇵🇸 [Mon, 20 Jan 2025 17:03:44 +0000 (17:03 +0000)] 
GH-129064: deprecate sysconfig.expand_makefile_vars (#129082)

9 months agogh-128308: pass `**kwargs` to asyncio task_factory (#128768)
Thomas Grainger [Mon, 20 Jan 2025 16:53:55 +0000 (16:53 +0000)] 
gh-128308: pass `**kwargs` to asyncio task_factory (#128768)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
9 months agoMove to public Linux arm64 hosted runners (#128964)
Diego Russo [Mon, 20 Jan 2025 16:51:09 +0000 (16:51 +0000)] 
Move to public Linux arm64 hosted runners (#128964)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
9 months agogh-118915: C API: Document compiler flag macros (GH-129028)
Peter Bierma [Mon, 20 Jan 2025 16:45:08 +0000 (11:45 -0500)] 
gh-118915: C API: Document compiler flag macros (GH-129028)

9 months agoDocs C API: Clarify what happens when null bytes are passed to `PyUnicode_AsUTF8...
Peter Bierma [Mon, 20 Jan 2025 15:54:29 +0000 (10:54 -0500)] 
Docs C API: Clarify what happens when null bytes are passed to `PyUnicode_AsUTF8` (#127458)

Co-authored-by: Stan U. <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
9 months agoGH-128939: Refactor JIT optimize structs (GH-128940)
Mark Shannon [Mon, 20 Jan 2025 15:49:15 +0000 (15:49 +0000)] 
GH-128939: Refactor JIT optimize structs (GH-128940)

9 months agogh-129044: Update glossary entry for 'loader' to reflect current import system (...
nikalinov [Mon, 20 Jan 2025 15:46:09 +0000 (15:46 +0000)] 
gh-129044: Update glossary entry for 'loader' to reflect current import system (#129073)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
9 months agogh-129033: Remove _PyInterpreterState_SetConfig() function (#129048)
Victor Stinner [Mon, 20 Jan 2025 15:31:33 +0000 (16:31 +0100)] 
gh-129033: Remove _PyInterpreterState_SetConfig() function (#129048)

Remove _PyInterpreterState_GetConfigCopy() and
_PyInterpreterState_SetConfig() private functions. PEP 741 "Python
Configuration C API" added a better public C API: PyConfig_Get() and
PyConfig_Set().

9 months agoAdd Configuration Options table to PyInitConfig API doc (#129062)
Victor Stinner [Mon, 20 Jan 2025 14:46:45 +0000 (15:46 +0100)] 
Add Configuration Options table to PyInitConfig API doc (#129062)

Document PyConfig members:

* dump_refs_file
* stdlib_dir
* use_frozen_modules
* _pystats

9 months agogh-71339: Use new assertion methods in test_ctypes (GH-129054)
Serhiy Storchaka [Mon, 20 Jan 2025 13:30:00 +0000 (15:30 +0200)] 
gh-71339: Use new assertion methods in test_ctypes (GH-129054)

9 months agogh-128978: Fix a `NameError` in `sysconfig.expand_makefile_vars` (#128979)
Bénédikt Tran [Mon, 20 Jan 2025 13:27:14 +0000 (14:27 +0100)] 
gh-128978: Fix a `NameError` in `sysconfig.expand_makefile_vars` (#128979)

This fixes a regression introduced by 4a53a397c311567f05553bc25a28aebaba4f6f65.

9 months agoRemove duplicated dict keys in `test_{embed,long}.py` fixtures (#128727)
Bénédikt Tran [Mon, 20 Jan 2025 12:50:10 +0000 (13:50 +0100)] 
Remove duplicated dict keys in `test_{embed,long}.py` fixtures (#128727)

9 months agogh-111178: Regen clinic and fix exceptions.c post gh-128447 (#129060)
Erlend E. Aasland [Mon, 20 Jan 2025 12:46:30 +0000 (13:46 +0100)] 
gh-111178: Regen clinic and fix exceptions.c post gh-128447 (#129060)

9 months agogh-71339: Use new assertion methods in test_capi (GH-129053)
Serhiy Storchaka [Mon, 20 Jan 2025 12:32:27 +0000 (14:32 +0200)] 
gh-71339: Use new assertion methods in test_capi (GH-129053)

9 months agogh-111178: Generate correct signature for most self converters (#128447)
Erlend E. Aasland [Mon, 20 Jan 2025 11:40:18 +0000 (12:40 +0100)] 
gh-111178: Generate correct signature for most self converters (#128447)

9 months agogh-128360: Add `_Py_AssertHoldsTstate` as assertion for holding a thread state (...
Peter Bierma [Mon, 20 Jan 2025 11:34:35 +0000 (06:34 -0500)] 
gh-128360: Add `_Py_AssertHoldsTstate` as assertion for holding a thread state (#128361)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
9 months agogh-71339: Use new assertion methods in `test_asyncio` (#129051)
Serhiy Storchaka [Mon, 20 Jan 2025 11:32:39 +0000 (13:32 +0200)] 
gh-71339: Use new assertion methods in `test_asyncio` (#129051)

9 months agogh-128595: Default to stdout isatty for colour detection instead of stderr (#128498)
Hugo van Kemenade [Mon, 20 Jan 2025 10:52:42 +0000 (12:52 +0200)] 
gh-128595: Default to stdout isatty for colour detection instead of stderr (#128498)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
9 months agoReorganize the PyInitConfig documentation (#129047)
Victor Stinner [Mon, 20 Jan 2025 10:42:04 +0000 (11:42 +0100)] 
Reorganize the PyInitConfig documentation (#129047)

Document the new PyInitConfig API before the old PyConfig API.

9 months agoFix a typo in `syslog`'s error message (#129029)
Tomas R. [Mon, 20 Jan 2025 10:11:08 +0000 (11:11 +0100)] 
Fix a typo in `syslog`'s error message (#129029)

9 months agogh-129033: Remove _Py_InitializeMain() function (#129034)
Victor Stinner [Mon, 20 Jan 2025 10:03:22 +0000 (11:03 +0100)] 
gh-129033: Remove _Py_InitializeMain() function (#129034)

Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
9 months agogh-71339: Use new assertion methods in test_traceback (GH-128848)
Serhiy Storchaka [Mon, 20 Jan 2025 09:22:33 +0000 (11:22 +0200)] 
gh-71339: Use new assertion methods in test_traceback (GH-128848)

9 months agogh-71339: Use assertIsSubclass() and assertNotIsSubclass() in test_decimal (GH-128827)
Serhiy Storchaka [Mon, 20 Jan 2025 09:20:49 +0000 (11:20 +0200)] 
gh-71339: Use assertIsSubclass() and assertNotIsSubclass() in test_decimal (GH-128827)

9 months agogh-71339: Use new assertion methods in test_abc (GH-128826)
Serhiy Storchaka [Mon, 20 Jan 2025 09:19:43 +0000 (11:19 +0200)] 
gh-71339: Use new assertion methods in test_abc (GH-128826)

9 months agogh-71339: Improve error report for types in assertHasAttr() and assertNotHasAttr...
Serhiy Storchaka [Mon, 20 Jan 2025 09:17:49 +0000 (11:17 +0200)] 
gh-71339: Improve error report for types in assertHasAttr() and assertNotHasAttr() (GH-128818)

9 months agogh-71339: Use new assertion methods in test_functools (GH-128829)
Serhiy Storchaka [Mon, 20 Jan 2025 09:17:04 +0000 (11:17 +0200)] 
gh-71339: Use new assertion methods in test_functools (GH-128829)

9 months agogh-71339: Use assertIsSubclass() and assertNotIsSubclass() in test_collections (GH...
Serhiy Storchaka [Mon, 20 Jan 2025 09:16:32 +0000 (11:16 +0200)] 
gh-71339: Use assertIsSubclass() and assertNotIsSubclass() in test_collections (GH-128824)

9 months agoGH-125722: Use long options for Sphinx (#129039)
Adam Turner [Mon, 20 Jan 2025 06:11:22 +0000 (06:11 +0000)] 
GH-125722: Use long options for Sphinx (#129039)

9 months agoGH-125722: Increase minimum supported Sphinx to 8.1.3 (#128922)
Adam Turner [Mon, 20 Jan 2025 00:26:24 +0000 (00:26 +0000)] 
GH-125722: Increase minimum supported Sphinx to 8.1.3 (#128922)

9 months agogh-129020: Remove ambiguous sentence from `tokenize.untokenize` docs (#129021)
Tomas R. [Mon, 20 Jan 2025 00:05:22 +0000 (01:05 +0100)] 
gh-129020: Remove ambiguous sentence from `tokenize.untokenize` docs (#129021)

9 months agogh-118761: Redudce the import time of ``optparse`` (#128899)
Eli Schwartz [Mon, 20 Jan 2025 00:03:19 +0000 (19:03 -0500)] 
gh-118761: Redudce the import time of ``optparse`` (#128899)

The same change was made, and for the same reason, by ``argparse`` back in
2017. The ``textwrap`` module is only used when printing help text, so most
invocations will never need it imported.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
9 months agogh-118761: Improve the import time of ``gettext`` (#128898)
Eli Schwartz [Mon, 20 Jan 2025 00:01:20 +0000 (19:01 -0500)] 
gh-118761: Improve the import time of ``gettext`` (#128898)

``gettext`` is often imported in programs that may not end up translating
anything. In fact, the ``struct`` module already has a delayed import when
parsing ``GNUTranslations`` to speed up the no ``.mo`` files case. The re module
is also used in the same situation, but behind a function chain only
called by ``GNUTranslations``.

Cache the compiled regex globally the first time it is used. The
finditer function is converted to a method call on the compiled
object which is slightly more efficient, and necessary for the
delayed re import.

9 months agoComplete doc of pending C API removals in Python 3.15 (#129032)
Victor Stinner [Sun, 19 Jan 2025 21:47:05 +0000 (22:47 +0100)] 
Complete doc of pending C API removals in Python 3.15 (#129032)

9 months agogh-77782: Postpone Py_VerboseFlag removal to Python 3.15 (#129024)
Victor Stinner [Sun, 19 Jan 2025 19:51:17 +0000 (20:51 +0100)] 
gh-77782: Postpone Py_VerboseFlag removal to Python 3.15 (#129024)

Postpone the global configuration variables removal to Python 3.15.
Do the same for PySys_SetArgvEx(), PySys_SetArgv(),
Py_SetProgramName() and Py_SetPythonHome().

9 months agogh-100239: Handle NaN and zero division in guards for `BINARY_OP_EXTEND` (#128963)
Kirill Podoprigora [Sun, 19 Jan 2025 11:02:49 +0000 (13:02 +0200)] 
gh-100239: Handle NaN and zero division in guards for `BINARY_OP_EXTEND` (#128963)

Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
9 months agogh-80222: Fix email address header folding with long quoted-string (#122753)
Mike Edmunds [Sun, 19 Jan 2025 00:50:52 +0000 (16:50 -0800)] 
gh-80222: Fix email address header folding with long quoted-string (#122753)

Email generators using email.policy.default could incorrectly omit the
quote ('"') characters from a quoted-string during header refolding,
leading to invalid address headers and enabling header spoofing. This
change restores the quote characters on a bare-quoted-string as the
header is refolded, and escapes backslash and quote chars in the string.

9 months agogh-128991: Release the enter frame reference within bdb callback (#128992)
Tian Gao [Sat, 18 Jan 2025 21:53:06 +0000 (16:53 -0500)] 
gh-128991: Release the enter frame reference within bdb callback (#128992)

* Release the enter frame reference within bdb callback

* 📜🤖 Added by blurb_it.

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
9 months agogh-128998: Fix indentation of numbered list and literal block (#128999)
Rafael Fontenelle [Sat, 18 Jan 2025 20:52:30 +0000 (17:52 -0300)] 
gh-128998: Fix indentation of numbered list and literal block (#128999)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
9 months agogh-121542: Document trailing newline behavior in `set_content()` (#121543)
Peter Bierma [Sat, 18 Jan 2025 18:34:40 +0000 (13:34 -0500)] 
gh-121542: Document trailing newline behavior in `set_content()` (#121543)

Co-authored-by: Yizheng Meng <dev@rapidcow.org>
9 months agoPre-commit: Drop specific language version and bump hooks (#128801)
Peter Bierma [Sat, 18 Jan 2025 17:53:17 +0000 (12:53 -0500)] 
Pre-commit: Drop specific language version and bump hooks (#128801)

9 months agogh-128679: Skip test_tracemalloc_track_race() on debug build (#128988)
Victor Stinner [Sat, 18 Jan 2025 15:13:54 +0000 (16:13 +0100)] 
gh-128679: Skip test_tracemalloc_track_race() on debug build (#128988)

There is a race condition between PyMem_SetAllocator() and
PyMem_RawMalloc()/PyMem_RawFree(). While PyMem_SetAllocator() write
is protected by a lock, PyMem_RawMalloc()/PyMem_RawFree() reads are
not protected by a lock. PyMem_RawMalloc()/PyMem_RawFree() can be
called with an old context and the new function pointer.

On a release build, it's not an issue since the context is not used.
On a debug build, the debug hooks use the context and so can crash.

9 months agogh-59705: Make PYTHREAD_NAME_MAXLEN macro private (#128945)
Victor Stinner [Sat, 18 Jan 2025 15:10:29 +0000 (16:10 +0100)] 
gh-59705: Make PYTHREAD_NAME_MAXLEN macro private (#128945)

Rename PYTHREAD_NAME_MAXLEN to _PYTHREAD_NAME_MAXLEN.

9 months agogh-125997: suggest efficient alternatives for `time.sleep(0)` (#128752)
Bénédikt Tran [Sat, 18 Jan 2025 11:02:43 +0000 (12:02 +0100)] 
gh-125997: suggest efficient alternatives for `time.sleep(0)` (#128752)

9 months agogh-118761: Improve import time for `csv` (#128858)
Bénédikt Tran [Sat, 18 Jan 2025 10:45:18 +0000 (11:45 +0100)] 
gh-118761: Improve import time for `csv` (#128858)

This reduces the import time of the `csv` module by up to five times,
by importing `re` on demand.

In particular, the `re` module is no more implicitly exposed as `csv.re`.

9 months agogh-126349: Add 'fill', 'poly', and 'no_animation' context managers to turtle (#126350)
Marie Roald [Sat, 18 Jan 2025 10:27:22 +0000 (11:27 +0100)] 
gh-126349: Add 'fill', 'poly', and 'no_animation' context managers to turtle (#126350)

Co-authored-by: Marie Roald <roald.marie@gmail.com>
Co-authored-by: Yngve Mardal Moe <yngve.m.moe@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Daniel Hollas <danekhollas@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend@python.org>
9 months agogh-128961: Fix exhausted array iterator crash in __setstate__() (#128962)
Tomasz Pytel [Sat, 18 Jan 2025 09:55:29 +0000 (04:55 -0500)] 
gh-128961: Fix exhausted array iterator crash in __setstate__() (#128962)

9 months agogh-128515: Add BOLT build to CI (gh-128845)
Zanie Blue [Sat, 18 Jan 2025 07:32:23 +0000 (01:32 -0600)] 
gh-128515: Add BOLT build to CI (gh-128845)

9 months agogh-128916: Do not set `SO_REUSEPORT` on non-`AF_INET*` sockets (GH-128933)
Michał Górny [Sat, 18 Jan 2025 00:49:16 +0000 (01:49 +0100)] 
gh-128916: Do not set `SO_REUSEPORT` on non-`AF_INET*` sockets (GH-128933)

* gh-128916: Do not set `SO_REUSEPORT` on non-`AF_INET*` sockets

Do not attempt to set ``SO_REUSEPORT`` on sockets of address familifies other
than ``AF_INET`` and ``AF_INET6``, as it is meaningless with these address
families, and the call with fail with Linux kernel 6.12.9 and newer.

* Apply suggestions from code review

Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
---------

Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
9 months agoFix definition of a `generator iterator` in `glossary.rst` (GH-128952)
Daniel F Moisset [Sat, 18 Jan 2025 00:46:19 +0000 (00:46 +0000)] 
Fix definition of a `generator iterator` in `glossary.rst` (GH-128952)

Fix possible typo/grammar in glossary.rst

As discussed in https://discuss.python.org/t/typo-in-glossary-entry-for-generator-iterator/77163

9 months agogh-128923: fix test_pydoc for object subclasses without `__module__` (#128951)
T. Wouters [Fri, 17 Jan 2025 22:43:17 +0000 (23:43 +0100)] 
gh-128923: fix test_pydoc for object subclasses without `__module__` (#128951)

Fix pydoc's docclass() for classes inheriting from object without the `__module__` attribute, like `_testcapi.HeapType`.

9 months agogh-128955: Fix goto if tlbc creation fails when throwing into a generator (#128957)
mpage [Fri, 17 Jan 2025 20:53:29 +0000 (12:53 -0800)] 
gh-128955: Fix goto if tlbc creation fails when throwing into a generator (#128957)

We don't have the correct copy of the bytecode and can't update next_instr
appropriately, so just unwind.

9 months agogh-128911: Add tests on the PyImport C API (#128915)
Victor Stinner [Fri, 17 Jan 2025 17:52:18 +0000 (18:52 +0100)] 
gh-128911: Add tests on the PyImport C API (#128915)

* Add Modules/_testlimitedcapi/import.c
* Add Lib/test/test_capi/test_import.py
* Remove _testcapi.check_pyimport_addmodule(): tests already covered
  by newly added tests.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
9 months agoRefactor code generators a bit (GH-128920)
Mark Shannon [Fri, 17 Jan 2025 16:59:30 +0000 (16:59 +0000)] 
Refactor code generators a bit (GH-128920)

Refactor code generators a bit to avoid passing stack property around all over the place

9 months agogh-128923: Use zero to indicate unassigned unique id (#128925)
Sam Gross [Fri, 17 Jan 2025 15:42:27 +0000 (10:42 -0500)] 
gh-128923: Use zero to indicate unassigned unique id (#128925)

In the free threading build, the per thread reference counting uses a
unique id for some objects to index into the local reference count
table. Use 0 instead of -1 to indicate that the id is not assigned. This
avoids bugs where zero-initialized heap type objects look like they have
a unique id assigned.

9 months agogh-58956: Fix a frame refleak in bdb (#128190)
Tian Gao [Fri, 17 Jan 2025 15:33:04 +0000 (10:33 -0500)] 
gh-58956: Fix a frame refleak in bdb (#128190)

9 months agogh-59705: Implement _thread.set_name() on Windows (#128675)
Victor Stinner [Fri, 17 Jan 2025 13:55:43 +0000 (14:55 +0100)] 
gh-59705: Implement _thread.set_name() on Windows (#128675)

Implement set_name() with SetThreadDescription() and _get_name() with
GetThreadDescription(). If SetThreadDescription() or
GetThreadDescription() is not available in kernelbase.dll, delete the
method when the _thread module is imported.

Truncate the thread name to 32766 characters.

Co-authored-by: Eryk Sun <eryksun@gmail.com>
9 months agoRevert "gh-128770: raise warnings as errors in test suite - except for test_socket...
Hugo van Kemenade [Fri, 17 Jan 2025 13:16:10 +0000 (15:16 +0200)] 
Revert "gh-128770: raise warnings as errors in test suite - except for test_socket which still logs warnings (#128726)" (#128936)

9 months agogh-58689: Fix os.kill() error handling on Windows (#128932)
Victor Stinner [Fri, 17 Jan 2025 12:30:40 +0000 (13:30 +0100)] 
gh-58689: Fix os.kill() error handling on Windows (#128932)

9 months agogh-128770: raise warnings as errors in test suite - except for test_socket which...
Thomas Grainger [Fri, 17 Jan 2025 11:39:16 +0000 (11:39 +0000)] 
gh-128770: raise warnings as errors in test suite - except for test_socket which still logs warnings (#128726)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Brett Cannon <brett@python.org>
9 months agogh-118761: Improve import time of `tomllib` (#128907)
Taneli Hukkinen [Fri, 17 Jan 2025 02:48:42 +0000 (04:48 +0200)] 
gh-118761: Improve import time of `tomllib` (#128907)

Improve import time of `tomllib`  (in sync with upstream)