]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
9 months agogh-91048: fix `_asyncio.future_discard_from_awaited_by` (#129731)
Kumar Aditya [Thu, 6 Feb 2025 16:35:33 +0000 (22:05 +0530)] 
gh-91048: fix `_asyncio.future_discard_from_awaited_by` (#129731)

fix discard

9 months agogh-91048: fix thread safety for asyncio stack introspection APIs (#129399)
Kumar Aditya [Thu, 6 Feb 2025 16:03:52 +0000 (21:33 +0530)] 
gh-91048: fix thread safety for asyncio stack introspection APIs (#129399)

9 months agogh-129707: Check `Tools/build/compute-changes.py` with `mypy` (#129708)
sobolevn [Thu, 6 Feb 2025 15:47:29 +0000 (18:47 +0300)] 
gh-129707: Check `Tools/build/compute-changes.py` with `mypy` (#129708)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
9 months agogh-128563: A new tail-calling interpreter (GH-128718)
Ken Jin [Thu, 6 Feb 2025 15:21:57 +0000 (23:21 +0800)] 
gh-128563: A new tail-calling interpreter (GH-128718)

Co-authored-by: Garrett Gu <garrettgu777@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
9 months agogh-129694: Add `--parallel-threads` TSAN job to CI (gh-129696)
Sam Gross [Thu, 6 Feb 2025 15:19:00 +0000 (10:19 -0500)] 
gh-129694: Add `--parallel-threads` TSAN job to CI (gh-129696)

For now, this just adds a single test suite to the TSAN CI to be run
with `--parallel-threads`.

9 months agogh-128714: Fix function object races in `__annotate__`, `__annotations__` and `__type...
Xuanteng Huang [Thu, 6 Feb 2025 14:40:50 +0000 (22:40 +0800)] 
gh-128714: Fix function object races in `__annotate__`, `__annotations__` and `__type_params__` in  free-threading build (#129016)

9 months agogh-129643: Fix `PyList_Insert` in free-threading builds (#129680)
sobolevn [Thu, 6 Feb 2025 12:54:40 +0000 (15:54 +0300)] 
gh-129643: Fix `PyList_Insert` in free-threading builds (#129680)

9 months agogh-118915: Fix bad link in documentation (GH-129691)
Miro Hrončok [Thu, 6 Feb 2025 12:34:06 +0000 (13:34 +0100)] 
gh-118915: Fix bad link in documentation (GH-129691)

9 months ago_markupbase.py: Use a permalink for the analysis of MS-Word extensions (GH-129017)
Stan Ulbrych [Thu, 6 Feb 2025 10:40:43 +0000 (10:40 +0000)] 
_markupbase.py: Use a permalink for the analysis of MS-Word extensions (GH-129017)

Update _markupbase.py

9 months agogh-129005: Update _pyio.BytesIO to use bytearray.resize on write (#129702)
Cody Maloney [Thu, 6 Feb 2025 10:18:08 +0000 (02:18 -0800)] 
gh-129005: Update _pyio.BytesIO to use bytearray.resize on write (#129702)

Co-authored-by: Victor Stinner <vstinner@python.org>
9 months agogh-86206: Change IDLE splash line (#129698)
Stan Ulbrych [Thu, 6 Feb 2025 07:55:25 +0000 (07:55 +0000)] 
gh-86206: Change IDLE splash line (#129698)

Change splash line

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
9 months agogh-69001: Replace maintainer email in IDLE credits (#129588)
Stan Ulbrych [Thu, 6 Feb 2025 06:44:50 +0000 (06:44 +0000)] 
gh-69001: Replace maintainer email in IDLE credits (#129588)

Instead, anyone requesting credit should submit a PR with contribution summary.
(Also fix typo in existing name.)

9 months agogh-129201: Use prefetch in GC mark alive phase. (gh-129203)
Neil Schemenauer [Wed, 5 Feb 2025 19:38:30 +0000 (11:38 -0800)] 
gh-129201: Use prefetch in GC mark alive phase. (gh-129203)

For the free-threaded version of the cyclic GC, restructure the "mark alive" phase to use software prefetch instructions.  This gives a speedup in most cases when the number of objects is large enough.  The prefetching is enabled conditionally based on the number of long-lived objects the GC finds.

9 months agogh-129559: Add `bytearray.resize()` (GH-129560)
Cody Maloney [Wed, 5 Feb 2025 19:33:17 +0000 (11:33 -0800)] 
gh-129559: Add `bytearray.resize()` (GH-129560)

Add bytearray.resize() which wraps PyByteArray_Resize.

Make negative size passed to resize exception/error rather than crash in optimized builds.

9 months agoConvert change detection to a Python script (#129627)
Adam Turner [Wed, 5 Feb 2025 16:39:42 +0000 (16:39 +0000)] 
Convert change detection to a Python script (#129627)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
9 months agogh-127833: Docs: Add a `grammar-snippet` directive & replace `productionlist` (GH...
Petr Viktorin [Wed, 5 Feb 2025 15:12:23 +0000 (16:12 +0100)] 
gh-127833: Docs: Add a `grammar-snippet` directive & replace `productionlist` (GH-127835)

As a first step toward aligning the grammar documentation with Python's actual
grammar, this overrides the ReST `productionlist` directive to:
- use `:` instead of the `::=` symbol
- add syntax highlighting for strings (using a Pygments highlighting class)

All links and link targets should be preserved. (Unfortunately, this reaches
into some Sphinx internals; I don't see a better way to do exactly what
Sphinx does.)

This also adds a new directive, `grammar-snippet`, which formats the snippet
almost exactly like what's in the source, modulo syntax highlighting and
keeping the backtick character to mark links to other rules.
This will allow formatting the snippets as in the grammar file
(file:///home/encukou/dev/cpython/Doc/build/html/reference/grammar.html).

The new directive is applied to two simple rules in toplevel_components.rst

---------

Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: William Ferreira <wqferr@gmail.com>
Co-authored-by: bswck <bartoszpiotrslawecki@gmail.com>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
9 months agogh-129354: Cleanup test_coroutines (#129684)
Victor Stinner [Wed, 5 Feb 2025 11:43:46 +0000 (12:43 +0100)] 
gh-129354: Cleanup test_coroutines (#129684)

Remove unused variables.

9 months agogh-129354: Use PyErr_FormatUnraisable() function (#129523)
Victor Stinner [Wed, 5 Feb 2025 10:31:59 +0000 (11:31 +0100)] 
gh-129354: Use PyErr_FormatUnraisable() function (#129523)

Replace PyErr_WriteUnraisable() with PyErr_FormatUnraisable().

Update tests:

* test_coroutines
* test_exceptions
* test_generators
* test_struct

9 months agogh-128911: Use PyImport_ImportModuleAttr() function (#129657)
Victor Stinner [Wed, 5 Feb 2025 10:03:58 +0000 (11:03 +0100)] 
gh-128911: Use PyImport_ImportModuleAttr() function (#129657)

* Replace PyImport_ImportModule() + PyObject_GetAttr() with
  PyImport_ImportModuleAttr().
* Replace PyImport_ImportModule() + PyObject_GetAttrString() with
  PyImport_ImportModuleAttrString().

9 months agogh-129643: fix thread safety of `PyList_SetItem` (#129644)
Kumar Aditya [Wed, 5 Feb 2025 07:38:02 +0000 (13:08 +0530)] 
gh-129643: fix thread safety of `PyList_SetItem` (#129644)

9 months agogh-104400: pygettext: Prepare to replace TokenEater with a NodeVisitor (#129672)
Tomas R. [Tue, 4 Feb 2025 22:59:23 +0000 (23:59 +0100)] 
gh-104400: pygettext: Prepare to replace TokenEater with a NodeVisitor (#129672)

* Update the module docstring
* Move ``key_for`` inside the class
* Move ``write_pot_file`` outside the class

9 months agogh-127933: Add option to run regression tests in parallel (gh-128003)
Sam Gross [Tue, 4 Feb 2025 22:44:59 +0000 (17:44 -0500)] 
gh-127933: Add option to run regression tests in parallel (gh-128003)

This adds a new command line argument, `--parallel-threads` to the
regression test runner to allow it to run individual tests in multiple
threads in parallel in order to find multithreading bugs.

Some tests pass when run with `--parallel-threads`, but there's still
more work before the entire suite passes.

9 months agogh-129660: Do not use test_embed in PGO profile builds (#129661)
neonene [Tue, 4 Feb 2025 19:33:07 +0000 (04:33 +0900)] 
gh-129660: Do not use test_embed in PGO profile builds (#129661)

9 months agogh-129646: Update the locale alias mapping (#129647)
Serhiy Storchaka [Tue, 4 Feb 2025 15:22:05 +0000 (17:22 +0200)] 
gh-129646: Update the locale alias mapping (#129647)

* gh-129646: Update the locale alias mapping

* Add a NEWS file.

9 months agogh-129354: Use PyErr_FormatUnraisable() function (#129656)
Victor Stinner [Tue, 4 Feb 2025 15:21:10 +0000 (16:21 +0100)] 
gh-129354: Use PyErr_FormatUnraisable() function (#129656)

Replace PyErr_WriteUnraisable() with PyErr_FormatUnraisable().

9 months agogh-128772: Fix pydoc for methods with __module__ is None (GH-129177)
Serhiy Storchaka [Tue, 4 Feb 2025 14:25:49 +0000 (16:25 +0200)] 
gh-128772: Fix pydoc for methods with __module__ is None (GH-129177)

9 months agogh-129350: Make tests for glob with trailing slash more strict (GH-129376)
Serhiy Storchaka [Tue, 4 Feb 2025 14:24:22 +0000 (16:24 +0200)] 
gh-129350: Make tests for glob with trailing slash more strict (GH-129376)

Test that the trailing pathname separator is preserved.

Multiple trailing pathname separators are only preserved if the pattern
does not contain metacharacters, otherwise only one trailing pathname
separator is preserved. This is rather an implementation detail.

9 months agoUse roles :data: and :const: for referencing module variables (GH-129507)
Serhiy Storchaka [Tue, 4 Feb 2025 14:16:41 +0000 (16:16 +0200)] 
Use roles :data: and :const: for referencing module variables (GH-129507)

9 months agoGH-128682: Mark two more macros as escaping. (GH-129645)
Mark Shannon [Tue, 4 Feb 2025 14:00:51 +0000 (14:00 +0000)] 
GH-128682: Mark two more macros as escaping. (GH-129645)

Expand out SETLOCAL so that code generator can see the decref. Mark Py_CLEAR as escaping

9 months agoGH-128682: Spill the stack pointer in labels, as well as instructions (GH-129618)
Mark Shannon [Tue, 4 Feb 2025 12:18:31 +0000 (12:18 +0000)] 
GH-128682: Spill the stack pointer in labels, as well as instructions (GH-129618)

9 months agogh-126835: Fix reference leak in `Python/flowgrapc.::optimize_if_const_subscr` ...
Yan Yanchii [Tue, 4 Feb 2025 10:38:06 +0000 (11:38 +0100)] 
gh-126835: Fix reference leak in `Python/flowgrapc.::optimize_if_const_subscr`  (#129634)

9 months agogh-126835: Move constant subscript folding to CFG (#129568)
Yan Yanchii [Tue, 4 Feb 2025 08:10:55 +0000 (09:10 +0100)] 
gh-126835: Move constant subscript folding to CFG (#129568)

Move folding of constant subscription from AST optimizer to CFG.

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
9 months agogh-111637: Clarify MIME type recognition behavior in mimetypes documentation (GH...
donBarbos [Mon, 3 Feb 2025 16:42:12 +0000 (20:42 +0400)] 
gh-111637: Clarify MIME type recognition behavior in mimetypes documentation (GH-129546)

9 months agoGH-128563: Generate `opcode = ...` in instructions that need `opcode` (GH-129608)
Mark Shannon [Mon, 3 Feb 2025 15:09:21 +0000 (15:09 +0000)] 
GH-128563: Generate `opcode = ...` in instructions that need `opcode` (GH-129608)

* Remove support for GO_TO_INSTRUCTION

9 months agoGH-128682: Make `PyStackRef_CLOSE` escaping. (GH-129404)
Mark Shannon [Mon, 3 Feb 2025 12:41:32 +0000 (12:41 +0000)] 
GH-128682: Make `PyStackRef_CLOSE` escaping. (GH-129404)

9 months agogh-129354: Use PyErr_FormatUnraisable() function (#129524)
Victor Stinner [Mon, 3 Feb 2025 12:10:18 +0000 (13:10 +0100)] 
gh-129354: Use PyErr_FormatUnraisable() function (#129524)

Replace PyErr_WriteUnraisable() with PyErr_FormatUnraisable().

Update test_sqlite3 tests.

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
9 months agogh-101944: Clarify PyModule_AddObjectRef() documentation (#129433)
Victor Stinner [Mon, 3 Feb 2025 11:55:22 +0000 (12:55 +0100)] 
gh-101944: Clarify PyModule_AddObjectRef() documentation (#129433)

9 months agogh-129407: Clarify that a `SystemError` isn't always CPython's fault (#129410)
Peter Bierma [Mon, 3 Feb 2025 11:46:13 +0000 (06:46 -0500)] 
gh-129407: Clarify that a `SystemError` isn't always CPython's fault (#129410)

9 months agogh-129342: Explain how to replace Py_GetProgramName() in C (#129361)
Victor Stinner [Mon, 3 Feb 2025 11:36:41 +0000 (12:36 +0100)] 
gh-129342: Explain how to replace Py_GetProgramName() in C (#129361)

9 months agogh-81340: Use copy_file_range in shutil.copyfile copy functions (GH-93152)
Illia Volochii [Mon, 3 Feb 2025 10:23:27 +0000 (12:23 +0200)] 
gh-81340: Use copy_file_range in shutil.copyfile copy functions (GH-93152)

This allows the underlying file system an opportunity to optimise or avoid the actual copy.

9 months agoGH-129231: Group executable JIT code in memory (GH-129232)
Diego Russo [Sun, 2 Feb 2025 23:19:55 +0000 (23:19 +0000)] 
GH-129231: Group executable JIT code in memory (GH-129232)

9 months agoGH-128842: Collect JIT memory stats (GH-128941)
Diego Russo [Sun, 2 Feb 2025 23:17:53 +0000 (23:17 +0000)] 
GH-128842: Collect JIT memory stats (GH-128941)

9 months agoGH-128872: Remove unused argument from _PyCode_Quicken (GH-128873)
Yan Yanchii [Sun, 2 Feb 2025 23:09:30 +0000 (00:09 +0100)] 
GH-128872: Remove unused argument from _PyCode_Quicken (GH-128873)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
9 months agogh-105875: amend sqlite3 docstring wrt. SQLite requirement (#129599)
Erlend E. Aasland [Sun, 2 Feb 2025 23:03:54 +0000 (00:03 +0100)] 
gh-105875: amend sqlite3 docstring wrt. SQLite requirement (#129599)

9 months agogh-91417: Remove PySequence_Fast() from the limited C API (#129398)
Victor Stinner [Sun, 2 Feb 2025 22:17:30 +0000 (23:17 +0100)] 
gh-91417: Remove PySequence_Fast() from the limited C API (#129398)

The function never worked with the limited C API. It was added by
mistake.

9 months agoGH-121970: Extract ``misc_news`` into a new extension (#129577)
Adam Turner [Sun, 2 Feb 2025 16:17:02 +0000 (16:17 +0000)] 
GH-121970: Extract ``misc_news`` into a new extension (#129577)

9 months agogh-126609: Allow translating the ``availability`` directive (#129549)
Adam Turner [Sun, 2 Feb 2025 16:12:01 +0000 (16:12 +0000)] 
gh-126609: Allow translating the ``availability`` directive (#129549)

9 months agogh-115514: Fix incomplete writes after close while using ssl in asyncio(#128037)
Vojtěch Boček [Sun, 2 Feb 2025 15:11:25 +0000 (16:11 +0100)] 
gh-115514: Fix incomplete writes after close while using ssl in asyncio(#128037)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
9 months agoRevert "gh-129005: Align FileIO.readall() allocation (#129458)" (#129572)
Cody Maloney [Sun, 2 Feb 2025 14:59:15 +0000 (06:59 -0800)] 
Revert "gh-129005: Align FileIO.readall() allocation (#129458)" (#129572)

This reverts commit f927204f64b3f8dbecec784e05bc8e25d2a78b2e.

9 months agogh-104400: Remove ``fintl.gettext`` from pygettext (#129580)
Adam Turner [Sun, 2 Feb 2025 14:30:34 +0000 (14:30 +0000)] 
gh-104400: Remove ``fintl.gettext`` from pygettext (#129580)

The ``fintl`` module is never installed or tested, meaning that the
fallback identity function is unconditionally used for ``_()``.
This means we can simplify, converting the docstring to a real
docstring, and converting some other strings to f-strings.

We also convert the module to UTF-8, sort imports,
and remove the history comment, which was last updated in 2002.
Consult the git history for a more accurate summary of changes.

9 months agogh-129539: Reorganize posixmodule.c header (#129558)
Victor Stinner [Sun, 2 Feb 2025 09:16:48 +0000 (10:16 +0100)] 
gh-129539: Reorganize posixmodule.c header (#129558)

Add sections: Python includes, system includes, etc.

Add a comment explaining why an include is needed.

9 months agogh-119461: Restore the testSocket VSOCK skipUnless removed by PR #119465 (#129561)
Gregory P. Smith [Sun, 2 Feb 2025 04:46:56 +0000 (20:46 -0800)] 
gh-119461: Restore the testSocket VSOCK skipUnless removed by PR #119465 (#129561)

Restore the skipUnless removed by #119465.

This test can only pass on virtual machines, not actual machines.

actual machines see:

```
    self.cli.connect((cid, VSOCKPORT))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
OSError: [Errno 19] No such device
```

Reproduced on (Linux) Ubuntu 24.04.1 running 6.8.0-52-generic.

9 months agogh-126022: Replace TeX quotation marks with ``"`` in Doc/license.rst (#129535)
Stan Ulbrych [Sat, 1 Feb 2025 16:49:45 +0000 (16:49 +0000)] 
gh-126022: Replace TeX quotation marks with ``"`` in  Doc/license.rst (#129535)

9 months agogh-93649: Move _testcapi tests to specific files (#129544)
Victor Stinner [Sat, 1 Feb 2025 12:39:16 +0000 (13:39 +0100)] 
gh-93649: Move _testcapi tests to specific files (#129544)

Move many functions from _testcapimodule.c into more specific files
in Modules/_testcapi/.

In moved code:

* Replace get_testerror() with PyExc_AssertionError.
* Replace raiseTestError() with
  PyErr_Format(PyExc_AssertionError, ...).

9 months agogh-126835: Move optimization of constant sequence creation from codegen to CFG (...
Kirill Podoprigora [Sat, 1 Feb 2025 11:39:44 +0000 (11:39 +0000)] 
gh-126835: Move optimization of constant sequence creation from codegen to CFG (#129426)

Codegen phase has an optimization that transforms
```
LOAD_CONST x
LOAD_CONST y
LOAD_CONXT z
BUILD_LIST/BUILD_SET (3)
```
->
```
BUILD_LIST/BUILD_SET (0)
LOAD_CONST (x, y, z)
LIST_EXTEND/SET_UPDATE 1
```
This optimization has now been moved to CFG phase to make #128802 work.

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Co-authored-by: Yan Yanchii <yyanchiy@gmail.com>
9 months agogh-105704: Disallow square brackets (`[` and `]`) in domain names for parsed URLs...
Seth Michael Larson [Fri, 31 Jan 2025 17:41:34 +0000 (11:41 -0600)] 
gh-105704: Disallow square brackets (`[` and `]`) in domain names for parsed URLs (#129418)

* gh-105704: Disallow square brackets ( and ) in domain names for parsed URLs

* Use Sphinx references

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* Add mismatched bracket test cases, fix news format

* Add more test coverage for ports

---------

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
9 months agoGH-128563: Move some labels, to simplify implementing tailcalling interpreter. (GH...
Mark Shannon [Fri, 31 Jan 2025 17:13:20 +0000 (17:13 +0000)] 
GH-128563: Move some labels, to simplify implementing tailcalling interpreter. (GH-129525)

9 months agogh-128509: Add `sys._is_immortal` for identifying immortal objects (#128510)
Peter Bierma [Fri, 31 Jan 2025 15:27:08 +0000 (10:27 -0500)] 
gh-128509: Add `sys._is_immortal` for identifying immortal objects (#128510)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
9 months agogh-93649: Add Modules/_testcapi/function.c file (#129521)
Victor Stinner [Fri, 31 Jan 2025 15:02:50 +0000 (16:02 +0100)] 
gh-93649: Add Modules/_testcapi/function.c file (#129521)

* Move PyFunction C API tests to a new file.
* Add Lib/test/test_capi/test_function.py.
* Move tests from test_capi.test_misc to test_capi.test_function.

9 months agogh-126108: Fix potential null pointer dereference in `PySys_AddWarnOptionUnicode...
Valery Fedorenko [Fri, 31 Jan 2025 14:36:30 +0000 (22:36 +0800)] 
gh-126108: Fix potential null pointer dereference in `PySys_AddWarnOptionUnicode` (#126118)

9 months agogh-129430: Make walking vm regions more efficient in MacOS (#129494)
Pablo Galindo Salgado [Fri, 31 Jan 2025 14:08:48 +0000 (14:08 +0000)] 
gh-129430: Make walking vm regions more efficient in MacOS (#129494)

9 months agogh-129354: Use PyErr_FormatUnraisable() function (#129518)
Victor Stinner [Fri, 31 Jan 2025 14:06:14 +0000 (15:06 +0100)] 
gh-129354: Use PyErr_FormatUnraisable() function (#129518)

Replace PyErr_WriteUnraisable() with PyErr_FormatUnraisable().

9 months agogh-93649: Add Modules/_testcapi/type.c file (#129516)
Victor Stinner [Fri, 31 Jan 2025 14:03:54 +0000 (15:03 +0100)] 
gh-93649: Add Modules/_testcapi/type.c file (#129516)

Move PyType C API tests to a new file.

Move following tests from test_capi.test_misc to test_capi.test_type:

* BuiltinStaticTypesTests
* test_get_type_name()
* test_get_base_by_token()

9 months agogh-111178: fix UBSan failures in `Modules/_sqlite` (GH-129087)
Bénédikt Tran [Fri, 31 Jan 2025 13:33:30 +0000 (14:33 +0100)] 
gh-111178: fix UBSan failures in `Modules/_sqlite` (GH-129087)

* fix UBSan failures for `pysqlite_Blob`
* fix UBSan failures for `pysqlite_Connection`
* fix UBSan failures for `pysqlite_Cursor`
* fix UBSan failures for `pysqlite_PrepareProtocol`
* fix UBSan failures for `pysqlite_Row`
* fix UBSan failures for `pysqlite_Statement`

* suppress unused return values

9 months agogh-129502: Fix handling errors in ctypes callbacks (GH-129504)
Serhiy Storchaka [Fri, 31 Jan 2025 13:30:19 +0000 (15:30 +0200)] 
gh-129502: Fix handling errors in ctypes callbacks (GH-129504)

Unlikely errors in preparing arguments for ctypes callback are now
handled in the same way as errors raised in the callback of in converting
the result of the callback -- using sys.unraisablehook() instead of
sys.excepthook() and not setting sys.last_exc and other variables.

9 months agogh-129354: Use PyErr_FormatUnraisable() function (#129514)
Victor Stinner [Fri, 31 Jan 2025 13:20:35 +0000 (14:20 +0100)] 
gh-129354: Use PyErr_FormatUnraisable() function (#129514)

Replace PyErr_WriteUnraisable() with PyErr_FormatUnraisable().

9 months agogh-93649: Move PyFrame C API tests to test_capi (#129512)
Victor Stinner [Fri, 31 Jan 2025 12:51:58 +0000 (13:51 +0100)] 
gh-93649: Move PyFrame C API tests to test_capi (#129512)

* Add Lib/test/test_capi/test_frame.py file.
* Move C API tests from test_frame to test_capi.test_frame.
* Add Modules/_testcapi/frame.c file.
* Move C API tests from _testcapimodule.c to frame.c

9 months agogh-71494: string.Formatter: support keys/attributes in unnumbered fields (GH-21767)
qm2k [Fri, 31 Jan 2025 12:16:24 +0000 (12:16 +0000)] 
gh-71494: string.Formatter: support keys/attributes in unnumbered fields (GH-21767)

9 months agogh-129354: Use PyErr_FormatUnraisable() function (#129511)
Victor Stinner [Fri, 31 Jan 2025 12:16:08 +0000 (13:16 +0100)] 
gh-129354: Use PyErr_FormatUnraisable() function (#129511)

Replace PyErr_WriteUnraisable() with PyErr_FormatUnraisable().

9 months agoGH-128563: Simplify recursion check in `_PyEval_EvalFrameDefault` (GH-129481)
Mark Shannon [Fri, 31 Jan 2025 12:12:24 +0000 (12:12 +0000)] 
GH-128563: Simplify recursion check in `_PyEval_EvalFrameDefault` (GH-129481)

Simplify recursion check in _PyEval_EvalFrameDefault

9 months agoGH-128469: Revert "warn when libpython was loaded from outside the build directory...
Petr Viktorin [Fri, 31 Jan 2025 11:17:37 +0000 (12:17 +0100)] 
GH-128469: Revert "warn when libpython was loaded from outside the build directory (#128645)" (#129506)

9 months agoGH-129386: Add `test.support.reset_code` (GH-129486)
Brandt Bucher [Fri, 31 Jan 2025 10:50:54 +0000 (02:50 -0800)] 
GH-129386: Add `test.support.reset_code` (GH-129486)

9 months agogh-129393: Make 'sys.platform' return "freebsd" only on FreeBSD (#129394)
Michael Osipov [Fri, 31 Jan 2025 09:02:45 +0000 (10:02 +0100)] 
gh-129393: Make 'sys.platform' return "freebsd" only on FreeBSD (#129394)

Make 'sys.platform' return "freebsd" only on FreeBSD without major version.

9 months agogh-127975: Avoid reusing quote types in ast.unparse if not needed (#127980)
Shantanu [Fri, 31 Jan 2025 08:49:06 +0000 (00:49 -0800)] 
gh-127975: Avoid reusing quote types in ast.unparse if not needed (#127980)

9 months agogh-129354: Fix grammar in PyErr_FormatUnraisable() (#129475)
Victor Stinner [Fri, 31 Jan 2025 08:45:35 +0000 (09:45 +0100)] 
gh-129354: Fix grammar in PyErr_FormatUnraisable() (#129475)

Replace "on verb+ing" with "while verb+ing".

9 months agoRevert "gh-129005: _pyio.BufferedIO remove copy on readall (#129454)" (#129500)
Cody Maloney [Fri, 31 Jan 2025 08:40:44 +0000 (00:40 -0800)] 
Revert "gh-129005: _pyio.BufferedIO remove copy on readall (#129454)" (#129500)

This reverts commit e1c4ba928852eac0b0e0bded1c314e3e36975286.

9 months agogh-128452: fix warning in socketmodule.c (#129478)
Kumar Aditya [Fri, 31 Jan 2025 08:11:11 +0000 (13:41 +0530)] 
gh-128452: fix warning in socketmodule.c (#129478)

9 months agogh-129205: Update multiprocessing.forkserver to use os.readinto() (#129425)
Cody Maloney [Thu, 30 Jan 2025 22:24:52 +0000 (14:24 -0800)] 
gh-129205: Update multiprocessing.forkserver to use os.readinto() (#129425)

9 months agogh-127349: Add check for correct resizing in REPL (#127387)
donBarbos [Thu, 30 Jan 2025 19:34:09 +0000 (19:34 +0000)] 
gh-127349: Add check for correct resizing in REPL (#127387)

9 months agogh-111495: Add PyFile tests (#129449)
Victor Stinner [Thu, 30 Jan 2025 17:05:32 +0000 (18:05 +0100)] 
gh-111495: Add PyFile tests (#129449)

Add tests for the following functions in test_capi.test_file:

* PyFile_FromFd()
* PyFile_GetLine()
* PyFile_NewStdPrinter()
* PyFile_WriteObject()
* PyFile_WriteString()
* PyObject_AsFileDescriptor()

Add Modules/_testlimitedcapi/file.c file.

Remove test_embed.StdPrinterTests which became redundant.

9 months agogh-129354: Use PyErr_FormatUnraisable() function (#129435)
Victor Stinner [Thu, 30 Jan 2025 15:09:38 +0000 (16:09 +0100)] 
gh-129354: Use PyErr_FormatUnraisable() function (#129435)

Replace PyErr_WriteUnraisable() with PyErr_FormatUnraisable().

9 months agoclearer error and suggestion when c-analyzer cannot read ignored.tsv (#129423)
Irit Katriel [Thu, 30 Jan 2025 11:38:52 +0000 (11:38 +0000)] 
clearer error and suggestion when c-analyzer cannot read ignored.tsv (#129423)

9 months agogh-89188: Implement PyUnicode_KIND() as a function (#129412)
Victor Stinner [Thu, 30 Jan 2025 11:27:27 +0000 (12:27 +0100)] 
gh-89188: Implement PyUnicode_KIND() as a function (#129412)

Implement PyUnicode_KIND() and PyUnicode_DATA() as function, in
addition to the macros with the same names. The macros rely on C bit
fields which have compiler-specific layout.

9 months agogh-129005: _pyio.BufferedIO remove copy on readall (#129454)
Cody Maloney [Thu, 30 Jan 2025 11:23:25 +0000 (03:23 -0800)] 
gh-129005: _pyio.BufferedIO remove copy on readall (#129454)

Slicing buf and appending chunk would always result in a copy. Commonly
in a readall() there is no already read data in buf, and the amount of
data read may be large, so the copy is expensive.

9 months agogh-128911: Add PyImport_ImportModuleAttr() function (#128912)
Victor Stinner [Thu, 30 Jan 2025 11:17:29 +0000 (12:17 +0100)] 
gh-128911: Add PyImport_ImportModuleAttr() function (#128912)

Add PyImport_ImportModuleAttr() and
PyImport_ImportModuleAttrString() functions.

* Add unit tests.
* Replace _PyImport_GetModuleAttr()
  with PyImport_ImportModuleAttr().
* Replace _PyImport_GetModuleAttrString()
  with PyImport_ImportModuleAttrString().
* Remove "pycore_import.h" includes, no longer needed.

9 months agogh-129005: Align FileIO.readall() allocation (#129458)
Cody Maloney [Thu, 30 Jan 2025 11:14:23 +0000 (03:14 -0800)] 
gh-129005: Align FileIO.readall() allocation (#129458)

Both now use a pre-allocated buffer of length `bufsize`, fill it using
a readinto(), and have matching "expand buffer" logic.

On my machine this takes:

`./python -m test -M8g -uall test_largefile -m test_large_read -v`

from ~3.7 seconds to ~3.4 seconds.

9 months agogh-129467: Fix compiler warning in mpdecimal word_to_string() (#116346)
Sergey B Kirpichev [Thu, 30 Jan 2025 10:57:55 +0000 (13:57 +0300)] 
gh-129467: Fix compiler warning in mpdecimal word_to_string() (#116346)

Turn off false-positive -Wstringop-overflow in word_to_string().

9 months agogh-129438: Update ``--enable-experimental-jit`` section with install requirements...
Stan Ulbrych [Thu, 30 Jan 2025 10:16:05 +0000 (10:16 +0000)] 
gh-129438: Update ``--enable-experimental-jit`` section with install requirements (#129450)

Add a note to the `JIT` docs that building CPython with `JIT` requires Python 3.11 or newer.

Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
9 months agogh-111178: fix UBSan failures in `Modules/_ssl/cert.c` (GH-129088)
Bénédikt Tran [Thu, 30 Jan 2025 10:11:37 +0000 (11:11 +0100)] 
gh-111178: fix UBSan failures in `Modules/_ssl/cert.c` (GH-129088)

fix UBSan failures for `PySSLCertificate`

9 months agoremove type annotations from multiprocessing. (#129381)
Gregory P. Smith [Thu, 30 Jan 2025 08:31:54 +0000 (00:31 -0800)] 
remove type annotations from multiprocessing. (#129381)

* remove type annotations from multiprocessing.

One of them was technically invalid per typing specs... but since we're not
checking these in the stdlib today lets elide them.

https://discuss.python.org/t/static-type-annotations-in-cpython/65068/13

* use the actual comment style annotation format

Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
---------

Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
9 months agogh-129403: Fix `ValueError` messages in `asyncio.Barrier` and `threading.Barrier...
Stan Ulbrych [Thu, 30 Jan 2025 08:11:12 +0000 (08:11 +0000)] 
gh-129403: Fix `ValueError` messages in `asyncio.Barrier` and `threading.Barrier` (#129419)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
9 months agotests: add test.support.venv.VirtualEnvironmentMixin (#129461)
Filipe Laíns 🇵🇸 [Thu, 30 Jan 2025 03:32:24 +0000 (03:32 +0000)] 
tests: add test.support.venv.VirtualEnvironmentMixin (#129461)

9 months agogh-128779: Fix site venv() for system site-packages (#129184)
Victor Stinner [Thu, 30 Jan 2025 00:02:31 +0000 (01:02 +0100)] 
gh-128779: Fix site venv() for system site-packages (#129184)

9 months agogh-127432: Add CI job to cross build Python (#128380)
Matthew Hughes [Wed, 29 Jan 2025 23:24:09 +0000 (23:24 +0000)] 
gh-127432: Add CI job to cross build Python (#128380)

Co-authored-by: Filipe Laíns 🇵🇸 <lains@riseup.net>
9 months agoGH-127178: improve compatibility in `_sysconfig_vars_(...).json` (#128558)
Filipe Laíns 🇵🇸 [Wed, 29 Jan 2025 22:47:20 +0000 (22:47 +0000)] 
GH-127178: improve compatibility in `_sysconfig_vars_(...).json` (#128558)

9 months agoGH-128469: warn when libpython was loaded from outside the build directory (#128645)
Filipe Laíns 🇵🇸 [Wed, 29 Jan 2025 22:35:55 +0000 (22:35 +0000)] 
GH-128469: warn when libpython was loaded from outside the build directory (#128645)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
9 months agogh-125522: Fix bare except in `test_uuid` (#129018)
Tomas R. [Wed, 29 Jan 2025 20:59:45 +0000 (21:59 +0100)] 
gh-125522: Fix bare except in `test_uuid` (#129018)

9 months agogh-126400: Add TCP socket timeout to SysLogHandler to prevent blocking (GH-126716)
Hod [Wed, 29 Jan 2025 19:37:43 +0000 (21:37 +0200)] 
gh-126400: Add TCP socket timeout to SysLogHandler to prevent blocking (GH-126716)

Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
9 months agoGH-129386: Use symbolic constants for specialization tests (GH-129415)
Brandt Bucher [Wed, 29 Jan 2025 18:49:58 +0000 (10:49 -0800)] 
GH-129386: Use symbolic constants for specialization tests (GH-129415)

9 months agogh-118761: Always lazy import `warnings` in `threading` (#129428)
Taneli Hukkinen [Wed, 29 Jan 2025 17:24:37 +0000 (19:24 +0200)] 
gh-118761: Always lazy import `warnings` in `threading` (#129428)