]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
11 months agoGH-120423: `pathname2url()`: handle forward slashes in Windows paths (#126593)
Barney Gale [Tue, 12 Nov 2024 19:52:30 +0000 (19:52 +0000)] 
GH-120423: `pathname2url()`: handle forward slashes in Windows paths (#126593)

Adjust `urllib.request.pathname2url()` so that forward slashes in Windows
paths are handled identically to backward slashes.

11 months agogh-116897: Deprecate generic false values in urllib.parse.parse_qsl() (GH-116903)
Serhiy Storchaka [Tue, 12 Nov 2024 19:10:29 +0000 (21:10 +0200)] 
gh-116897: Deprecate generic false values in urllib.parse.parse_qsl() (GH-116903)

Accepting objects with false values (like 0 and []) except empty strings
and byte-like objects and None in urllib.parse functions parse_qsl() and
parse_qs() is now deprecated.

11 months agogh-89083: add support for UUID version 8 (RFC 9562) (#123224)
Bénédikt Tran [Tue, 12 Nov 2024 18:08:49 +0000 (19:08 +0100)] 
gh-89083: add support for UUID version 8 (RFC 9562) (#123224)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
11 months agogh-126705: Make os.PathLike more like a protocol (#126706)
Stephen Morton [Tue, 12 Nov 2024 17:54:13 +0000 (09:54 -0800)] 
gh-126705: Make os.PathLike more like a protocol (#126706)

it can now be used as a base class in other protocols

11 months agogh-76785: Improved Subinterpreters Compatibility with 3.12 (2/2) (gh-126707)
Eric Snow [Tue, 12 Nov 2024 17:41:51 +0000 (10:41 -0700)] 
gh-76785: Improved Subinterpreters Compatibility with 3.12 (2/2) (gh-126707)

These changes makes it easier to backport the _interpreters, _interpqueues, and _interpchannels modules to Python 3.12.

This involves the following:

* add the _PyXI_GET_STATE() and _PyXI_GET_GLOBAL_STATE() macros
* add _PyXIData_lookup_context_t and _PyXIData_GetLookupContext()
* add _Py_xi_state_init() and _Py_xi_state_fini()

11 months agogh-95382: Use cache for indentations in the JSON encoder (GH-118636)
Serhiy Storchaka [Tue, 12 Nov 2024 17:19:15 +0000 (19:19 +0200)] 
gh-95382: Use cache for indentations in the JSON encoder (GH-118636)

11 months agogh-126133: Only use start year in PSF copyright, remove end years (#126236)
Hugo van Kemenade [Tue, 12 Nov 2024 13:59:19 +0000 (15:59 +0200)] 
gh-126133: Only use start year in PSF copyright, remove end years (#126236)

11 months agogh-126061: Add PyLong_IsPositive/Zero/Negative() functions (#126065)
RUANG (James Roy) [Tue, 12 Nov 2024 13:18:06 +0000 (21:18 +0800)] 
gh-126061: Add PyLong_IsPositive/Zero/Negative() functions (#126065)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
11 months agogh-125916: Allow functools.reduce() 'initial' to be a keyword argument (#125917)
Sayandip Dutta [Tue, 12 Nov 2024 13:11:58 +0000 (18:41 +0530)] 
gh-125916: Allow functools.reduce() 'initial' to be a keyword argument (#125917)

11 months agogh-126595: fix a crash when calling `itertools.count(sys.maxsize)` (#126617)
Bénédikt Tran [Tue, 12 Nov 2024 13:10:10 +0000 (14:10 +0100)] 
gh-126595: fix a crash when calling `itertools.count(sys.maxsize)` (#126617)

11 months agogh-126405: fix use-after-free in `_asyncio.Future.remove_done_callback` (#126733)
Kumar Aditya [Tue, 12 Nov 2024 12:31:34 +0000 (18:01 +0530)] 
gh-126405: fix use-after-free in `_asyncio.Future.remove_done_callback` (#126733)

11 months agogh-126209: Fix inconsistency of `skip_file_prefixes` in `warnings.warn`'s C and...
Daehee Kim [Tue, 12 Nov 2024 12:01:56 +0000 (21:01 +0900)] 
gh-126209: Fix inconsistency of  `skip_file_prefixes` in `warnings.warn`'s C and Python implementations (GH-126329)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
11 months agogh-126525: Fix `makeunicodedata.py` output on macOS and Windows (#126526)
sobolevn [Tue, 12 Nov 2024 10:23:57 +0000 (13:23 +0300)] 
gh-126525: Fix `makeunicodedata.py` output on macOS and Windows (#126526)

11 months agogh-126699: allow AsyncIterator to be used as a base for Protocols (#126702)
Stephen Morton [Tue, 12 Nov 2024 09:17:07 +0000 (01:17 -0800)] 
gh-126699: allow AsyncIterator to be used as a base for Protocols (#126702)

11 months agoFix error message of "Check if Autoconf files are up to date" job (#126683)
sobolevn [Tue, 12 Nov 2024 07:51:13 +0000 (10:51 +0300)] 
Fix error message of "Check if Autoconf files are up to date" job (#126683)

11 months agogh-84852: Add MIME types for .eot, ,otf, .ttf, .woff and .woff2 fonts (#20199)
Sahil Prajapati [Tue, 12 Nov 2024 06:48:38 +0000 (12:18 +0530)] 
gh-84852: Add MIME types for .eot, ,otf, .ttf, .woff and .woff2 fonts (#20199)

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>
11 months agoGH-126195: Use M1 JIT memory protection APIs (GH-126196)
Diego Russo [Tue, 12 Nov 2024 01:20:10 +0000 (01:20 +0000)] 
GH-126195: Use M1 JIT memory protection APIs (GH-126196)

11 months agogh-58749: Remove incorrect language spec claims about the global statement (GH-126523)
Beomsoo Kim [Tue, 12 Nov 2024 00:11:40 +0000 (09:11 +0900)] 
gh-58749: Remove incorrect language spec claims about the global statement (GH-126523)

* Removes erroneous explanation of the `global` statement restrictions; a name declared as global can be subsequently bound using any kind of name binding operation.
* Updates `test_global.py` to also test various name-binding scenarios for global
variables to ensure correct behavior

11 months agogh-76785: Improved Subinterpreters Compatibility with 3.12 (1/2) (gh-126704)
Eric Snow [Mon, 11 Nov 2024 22:58:46 +0000 (15:58 -0700)] 
gh-76785: Improved Subinterpreters Compatibility with 3.12 (1/2) (gh-126704)

These changes makes it easier to backport the _interpreters, _interpqueues, and _interpchannels modules to Python 3.12.

This involves the following:

* rename several structs and typedefs
* add several typedefs
* stop using the PyThreadState.state field directly in parking_lot.c

11 months agoDocs: re-create pages for removed modules to document their removal. (#126622)
Ned Batchelder [Mon, 11 Nov 2024 22:49:48 +0000 (17:49 -0500)] 
Docs: re-create pages for removed modules to document their removal. (#126622)

Will also need to change the redirects that were created here:
https://github.com/python/psf-salt/pull/521/files

11 months agogh-126413: Add translation tests for getopt and optparse (GH-126698)
Tomas R. [Mon, 11 Nov 2024 22:16:39 +0000 (23:16 +0100)] 
gh-126413: Add translation tests for getopt and optparse (GH-126698)

11 months agogh-76785: Minor Cleanup of Exception-related Cross-interpreter State (gh-126602)
Eric Snow [Mon, 11 Nov 2024 21:49:41 +0000 (14:49 -0700)] 
gh-76785: Minor Cleanup of Exception-related Cross-interpreter State (gh-126602)

This change makes it easier to backport the _interpreters, _interpqueues, and _interpchannels modules to Python 3.12.

11 months agogh-89416: Add RFC 9559 MIME types for Matroska formats (#126412)
Hugo van Kemenade [Mon, 11 Nov 2024 21:08:54 +0000 (23:08 +0200)] 
gh-89416: Add RFC 9559 MIME types for Matroska formats (#126412)

Co-authored-by: Zachary Ware <zachary.ware@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
11 months agogh-84559: gh-103134: Whats new 3.14 entries for multiprocessing. (GH-126697)
Gregory P. Smith [Mon, 11 Nov 2024 19:19:08 +0000 (11:19 -0800)] 
gh-84559: gh-103134: Whats new 3.14 entries for multiprocessing. (GH-126697)

11 months agoUpdate documentation links to Microsoft's documentation pages (GH-126379)
谭九鼎 [Mon, 11 Nov 2024 17:10:49 +0000 (01:10 +0800)] 
Update documentation links to Microsoft's documentation pages (GH-126379)

11 months agogh-126374: Add support of options with optional arguments in the getopt module (GH...
Serhiy Storchaka [Mon, 11 Nov 2024 16:29:28 +0000 (18:29 +0200)] 
gh-126374: Add support of options with optional arguments in the getopt module (GH-126375)

11 months agogh-117941: Reject option names starting with "--no-" in argparse.BooleanOptionalActio...
Serhiy Storchaka [Mon, 11 Nov 2024 16:28:30 +0000 (18:28 +0200)] 
gh-117941: Reject option names starting with "--no-" in argparse.BooleanOptionalAction (GH-125894)

They never worked correctly.

11 months agogh-126505: Fix bugs in compiling case-insensitive character classes (GH-126557)
Serhiy Storchaka [Mon, 11 Nov 2024 16:27:26 +0000 (18:27 +0200)] 
gh-126505: Fix bugs in compiling case-insensitive character classes (GH-126557)

* upper-case non-BMP character was ignored
* the ASCII flag was ignored when matching a character range whose
  upper bound is beyond the BMP region

11 months agogh-126654: Fix crash in several functions in `_interpreters` module (#126678)
sobolevn [Mon, 11 Nov 2024 11:35:56 +0000 (14:35 +0300)] 
gh-126654: Fix crash in several functions in `_interpreters` module (#126678)

11 months agogh-126417: validate ABC methods on multiprocessing proxy types (#126454)
Stephen Morton [Mon, 11 Nov 2024 07:08:58 +0000 (23:08 -0800)] 
gh-126417: validate ABC methods on multiprocessing proxy types (#126454)

Checks that appropriate dunder __ methods exist on the dict and list proxy types.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
11 months agoAdd missing fullstop `.` to whatsnew/3.8.rst (GH-126553)
Rafael Fontenelle [Mon, 11 Nov 2024 06:59:23 +0000 (03:59 -0300)] 
Add missing fullstop `.` to whatsnew/3.8.rst (GH-126553)

11 months agogh-126664: Use `else` instead of `finally` in "The with statement" documentation...
vivodi [Mon, 11 Nov 2024 06:47:56 +0000 (14:47 +0800)] 
gh-126664: Use `else` instead of `finally` in "The with statement" documentation. (GH-126665)

11 months agogh-117378: Clear up the NEWS entry wording (GH-126634)
Gregory P. Smith [Mon, 11 Nov 2024 06:39:58 +0000 (22:39 -0800)] 
gh-117378: Clear up the NEWS entry wording (GH-126634)

gh-117378: Clear up the NEWS entry wording.

Docs are hard.  Lets go shopping!

11 months agogh-126543: Docs: change "bound type var" to "bounded" when used in the context of...
Pedro Fonini [Mon, 11 Nov 2024 00:40:25 +0000 (21:40 -0300)] 
gh-126543: Docs: change "bound type var" to "bounded" when used in the context of the 'bound' kw argument to TypeVar (#126584)

11 months agogh-126647: `Doc/using/configure.rst`: Add an entry for ``--enable-experimental-jit...
Kirill Podoprigora [Sun, 10 Nov 2024 21:44:56 +0000 (23:44 +0200)] 
gh-126647: `Doc/using/configure.rst`: Add an entry for ``--enable-experimental-jit`` option (#126648)

Add an entry for the ``--enable-experimental-jit`` option in ``Doc/using/configure.rst``.
This was added as an experimental option in CPython 3.13.
Possible values for it:
* `no` - don't build the JIT.
* `yes` - build the JIT.
* `yes-off` - build the JIT but disable it by default.
* `interpreter` - don't build the JIT but enable tier 2 interpreter instead.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
11 months agogh-117378: Only run the new multiprocessing SysPath test when appropriate (GH-126635)
Gregory P. Smith [Sun, 10 Nov 2024 21:17:05 +0000 (13:17 -0800)] 
gh-117378: Only run the new multiprocessing SysPath test when appropriate (GH-126635)

The first version had it running two forkserver and one spawn tests underneath each of the _fork, _forkserver, and _spawn test suites that build off the generic one.

This adds to the existing complexity of the multiprocessing test suite by offering BaseTestCase classes another attribute to control which suites they are invoked under. Practicality vs purity here. :/

Net result: we don't over-run the new test and their internal logic is simplified.

11 months agoSkip test in test_socket.py if `sys.getrefcount` isn't available (#126640)
CF Bolz-Tereick [Sun, 10 Nov 2024 15:16:36 +0000 (16:16 +0100)] 
Skip test in test_socket.py if `sys.getrefcount` isn't available (#126640)

Skip `testMakefileCloseSocketDestroy` test if `sys.getrefcount` isn't available. This is necessary for  PyPy and other Python implementations that do not have `sys.getrefcount`.

11 months agogh-126565: Skip `zipfile.Path.exists` check in write mode (#126576)
Jan Hicken [Sun, 10 Nov 2024 14:57:24 +0000 (15:57 +0100)] 
gh-126565: Skip `zipfile.Path.exists` check in write mode (#126576)

When `zipfile.Path.open` is called, the implementation will check
whether the path already exists in the ZIP file. However, this check is
only required when the ZIP file is in read mode. By swapping arguments
of the `and` operator, the short-circuiting will prevent the check from
being run in write mode.

This change will improve the performance of `open()`, because checking
whether a file exists is slow in write mode, especially when the archive
has many members.

11 months agoPostpone `module.__loader__` deprecation to Python 3.16 (#126482)
Hugo van Kemenade [Sun, 10 Nov 2024 00:48:33 +0000 (02:48 +0200)] 
Postpone `module.__loader__` deprecation to Python 3.16 (#126482)

11 months agogh-117378: Fix multiprocessing forkserver preload sys.path inheritance. (GH-126538)
Gregory P. Smith [Sat, 9 Nov 2024 23:01:32 +0000 (15:01 -0800)] 
gh-117378: Fix multiprocessing forkserver preload sys.path inheritance. (GH-126538)

gh-117378: Fix multiprocessing forkserver preload sys.path inheritance.

`sys.path` was not properly being sent from the parent process when launching
the multiprocessing forkserver process to preload imports.  This bug has been
there since the forkserver start method was introduced in Python 3.4.  It was
always _supposed_ to inherit `sys.path` the same way the spawn method does.

Observable behavior change: A `''` value in `sys.path` will now be replaced in
the forkserver's `sys.path` with an absolute pathname
`os.path.abspath(os.getcwd())` saved at the time that `multiprocessing` was
imported in the parent process as it already was when using the spawn start
method. **This will only be observable during forkserver preload imports**.

The code invoked before calling things in another process already correctly sets `sys.path`.
Which is likely why this went unnoticed for so long as a mere performance issue in
some configurations.

A workaround for the bug on impacted Pythons is to set PYTHONPATH in the
environment before multiprocessing's forkserver process was started. Not perfect
as that is then inherited by other children, etc, but likely good enough for many
people's purposes.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
11 months agopathlib ABCs: tighten up `resolve()` and `absolute()` (#126611)
Barney Gale [Sat, 9 Nov 2024 18:47:49 +0000 (18:47 +0000)] 
pathlib ABCs: tighten up `resolve()` and `absolute()` (#126611)

In `PathBase.resolve()`, raise `UnsupportedOperation` if a non-POSIX path
parser is used (our implementation uses `posixpath._realpath()`, which
produces incorrect results for non-POSIX path flavours.) Also tweak code to
call `self.absolute()` upfront rather than supplying an emulated `getcwd()`
function.

Adjust `PathBase.absolute()` to work somewhat like `resolve()`. If a POSIX
path parser is used, we treat the root directory as the current directory.
This is the simplest useful behaviour for concrete path types without a
current directory cursor.

11 months agopathlib ABCs: support initializing paths with no arguments (#126608)
Barney Gale [Sat, 9 Nov 2024 18:21:53 +0000 (18:21 +0000)] 
pathlib ABCs: support initializing paths with no arguments (#126608)

In the past I've equivocated about whether to require at least one argument
in the `PurePathBase` (and `PathBase`) initializer, and what the default
should be if we make it optional. I now have a local use case that has
persuaded me to make it optional and default to the empty string (a
`zipp.Path`-like class that treats relative and absolute paths similarly.)
Happily this brings the base class more in line with `PurePath` and `Path`.

11 months agogh-120619: Strength reduce function guards, support 2-operand uop forms (GH-124846)
Ken Jin [Sat, 9 Nov 2024 03:35:33 +0000 (11:35 +0800)] 
gh-120619: Strength reduce function guards, support 2-operand uop forms (GH-124846)

Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
11 months agogh-126187 Add emscripten.py script to automate emscripten build (#126190)
Hood Chatham [Sat, 9 Nov 2024 02:12:55 +0000 (03:12 +0100)] 
gh-126187 Add emscripten.py script to automate emscripten build (#126190)

Add emscripten.py script to automate emscripten build.

This is modeled heavily on `Tools/wasm/wasi.py`. This will form the basis of an Emscripten build bot.

12 months agoGH-126212: Fix removal of slashes in file URIs on Windows (#126214)
Barney Gale [Fri, 8 Nov 2024 16:47:51 +0000 (16:47 +0000)] 
GH-126212: Fix removal of slashes in file URIs on Windows (#126214)

Adjust `urllib.request.pathname2url()` and `url2pathname()` so that they
don't remove slashes from Windows DOS drive paths and URLs. There was no
basis for this behaviour, and it conflicts with how UNC and POSIX paths are
handled.

12 months agoGH-126547: Pre-assign version numbers for a few common classes (GH-126551)
Mark Shannon [Fri, 8 Nov 2024 16:44:44 +0000 (16:44 +0000)] 
GH-126547: Pre-assign version numbers for a few common classes (GH-126551)

12 months agogh-126497: Add missing venv redirectors to freethreaded installer (GH-126556)
Steve Dower [Fri, 8 Nov 2024 16:09:34 +0000 (16:09 +0000)] 
gh-126497: Add missing venv redirectors to freethreaded installer (GH-126556)

12 months agogh-125298: Remove misleading text in os.kill documentation (GH-125749)
RUANG (James Roy) [Fri, 8 Nov 2024 15:29:16 +0000 (23:29 +0800)] 
gh-125298: Remove misleading text in os.kill documentation (GH-125749)

Windows has not accepted process handles in many releases.

12 months agogh-126072: Set docstring attribute for module and class (#126231)
Xuanteng Huang [Fri, 8 Nov 2024 15:13:18 +0000 (23:13 +0800)] 
gh-126072: Set docstring attribute for module and class (#126231)

12 months agoremove minor redundant code from `_asyncio` (#126578)
Kumar Aditya [Fri, 8 Nov 2024 13:17:03 +0000 (18:47 +0530)] 
remove minor redundant code from `_asyncio` (#126578)

12 months agogh-126579: Adapt sys.audit() to Argument Clinic (GH-126580)
Serhiy Storchaka [Fri, 8 Nov 2024 13:11:44 +0000 (15:11 +0200)] 
gh-126579: Adapt sys.audit() to Argument Clinic (GH-126580)

12 months agoGH-107803: use circular double linked list for tasks in `_asyncio` (#126577)
Kumar Aditya [Fri, 8 Nov 2024 12:51:11 +0000 (18:21 +0530)] 
GH-107803: use circular double linked list for tasks in `_asyncio` (#126577)

12 months agogh-122943: Add the varpos parameter in _PyArg_UnpackKeywords (GH-126564)
Serhiy Storchaka [Fri, 8 Nov 2024 12:23:50 +0000 (14:23 +0200)] 
gh-122943: Add the varpos parameter in _PyArg_UnpackKeywords (GH-126564)

Remove _PyArg_UnpackKeywordsWithVararg.
Add comments for integer arguments of _PyArg_UnpackKeywords.

12 months agogh-122943: Move code generation for var-positional parameter to converters (GH-126575)
Serhiy Storchaka [Fri, 8 Nov 2024 12:12:15 +0000 (14:12 +0200)] 
gh-122943: Move code generation for var-positional parameter to converters (GH-126575)

12 months agogh-89640: Restore configure error message on failure to detect float word order ...
Hood Chatham [Fri, 8 Nov 2024 11:57:17 +0000 (12:57 +0100)] 
gh-89640: Restore configure error message on failure to detect float word order (#126569)

Before #126387, if we didn't detect float word order we'd raise the following
configure error:

    Unknown float word ordering. You need to manually preset
    ax_cv_c_float_words_bigendian=no (or yes) according to your system.

This puts it back (except for ARM or WASM, which as hardcoded).

12 months agogh-126171: fix possible null dereference in _imp_find_frozen_impl (#126566)
Valery Fedorenko [Fri, 8 Nov 2024 10:19:15 +0000 (13:19 +0300)] 
gh-126171: fix possible null dereference in _imp_find_frozen_impl (#126566)

12 months agogh-122943: Remove the object converter for var-positional parameter (GH-126560)
Serhiy Storchaka [Fri, 8 Nov 2024 05:41:54 +0000 (07:41 +0200)] 
gh-122943: Remove the object converter for var-positional parameter (GH-126560)

12 months agogh-120017: use 'do-while(0)' in some `{codegen,compile}.c` multi-line macros (#120018)
Bénédikt Tran [Thu, 7 Nov 2024 23:03:11 +0000 (00:03 +0100)] 
gh-120017: use 'do-while(0)' in some `{codegen,compile}.c` multi-line macros (#120018)

12 months agoGH-123877: default to `wasm32-wasip1` instead of `wasm32-wasi` to be more specific...
Brett Cannon [Thu, 7 Nov 2024 21:40:56 +0000 (13:40 -0800)] 
GH-123877: default to `wasm32-wasip1` instead of `wasm32-wasi` to be more specific (GH-126552)

Eventually wasm32-wasi will represent WASI 1.0, and so it's currently deprecated so it can be used for that eventual purpose. wasm32-wasip1 is also more specific to what version of WASI is currently supported.

---------

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
12 months agogh-122943: Rework support of var-positional parameter in Argument Clinic (GH-122945)
Serhiy Storchaka [Thu, 7 Nov 2024 21:40:03 +0000 (23:40 +0200)] 
gh-122943: Rework support of var-positional parameter in Argument Clinic (GH-122945)

Move creation of a tuple for var-positional parameter out of
_PyArg_UnpackKeywordsWithVararg().
Merge _PyArg_UnpackKeywordsWithVararg() with _PyArg_UnpackKeywords().
Add a new parameter in _PyArg_UnpackKeywords().

The "parameters" and "converters" attributes of ParseArgsCodeGen no
longer contain the var-positional parameter. It is now available as the
"varpos" attribute. Optimize code generation for var-positional
parameter and reuse the same generating code for functions with and without
keyword parameters.

Add special converters for var-positional parameter. "tuple" represents it as
a Python tuple and "array" represents it as a continuous array of PyObject*.
"object" is a temporary alias of "tuple".

12 months agoGH-126464 Fix JIT CI on aarch64-apple-darwin (GH-126494)
alm [Thu, 7 Nov 2024 18:55:31 +0000 (20:55 +0200)] 
GH-126464 Fix JIT CI on aarch64-apple-darwin (GH-126494)

12 months agogh-126298: Don't deduplicate slice constants based on equality (#126398)
Michael Droettboom [Thu, 7 Nov 2024 16:39:23 +0000 (11:39 -0500)] 
gh-126298: Don't deduplicate slice constants based on equality (#126398)

* gh-126298: Don't deduplicated slice constants based on equality

* NULL check for PySlice_New

* Fix refcounting

* Fix refcounting some more

* Fix refcounting

* Make tests more complete

* Fix tests

12 months agogh-76785: Minor Cleanup of "Cross-interpreter" Code (gh-126457)
Eric Snow [Thu, 7 Nov 2024 16:32:42 +0000 (09:32 -0700)] 
gh-76785: Minor Cleanup of "Cross-interpreter" Code (gh-126457)

The primary objective here is to allow some later changes to be cleaner. Mostly this involves renaming things and moving a few things around.

* CrossInterpreterData -> XIData
* crossinterpdatafunc -> xidatafunc
* split out pycore_crossinterp_data_registry.h
* add _PyXIData_lookup_t

12 months agoChore: Fix typo in `pyarena.c` (#126527)
Aditya Borikar [Thu, 7 Nov 2024 15:37:41 +0000 (07:37 -0800)] 
Chore: Fix typo in `pyarena.c` (#126527)

12 months agogh-126529: Update devguide links to relative filenames in InternalDocs (#126530)
Valerii [Thu, 7 Nov 2024 15:35:29 +0000 (20:35 +0500)] 
gh-126529: Update devguide links to relative filenames in InternalDocs (#126530)

Update devguide links to relative filenames in InternalDocs/parser.md
and InternalDocs/compiler.md.

12 months agoDoc: C API: Demote sections to subsections for consistency (#126535)
Richard Hansen [Thu, 7 Nov 2024 15:29:31 +0000 (10:29 -0500)] 
Doc: C API: Demote sections to subsections for consistency (#126535)

The entire file should be a single section; the headings below the
first heading should be subsections.

12 months agoGH-126222: Fix `_PyUop_num_popped` (GH-126507)
Mark Shannon [Thu, 7 Nov 2024 10:48:27 +0000 (10:48 +0000)] 
GH-126222: Fix `_PyUop_num_popped` (GH-126507)

12 months agogh-126500: test_ssl: Don't stop ThreadedEchoServer on OSError in ConnectionHandler...
Petr Viktorin [Thu, 7 Nov 2024 10:07:02 +0000 (11:07 +0100)] 
gh-126500: test_ssl: Don't stop ThreadedEchoServer on OSError in ConnectionHandler; rely on __exit__ (GH-126503)

If `read()` in the ConnectionHandler thread raises `OSError` (except `ConnectionError`),
the ConnectionHandler shuts down the entire ThreadedEchoServer,
preventing further connections.
It also does that for `EPROTOTYPE` in `wrap_conn`.

As far as I can see, this is done to avoid the server thread getting stuck,
forgotten, in its accept loop. However, since 2011 (5b95eb90a7167285b6544b50865227c584943c9a)
the server is used as a context manager, and its `__exit__` does `stop()` and `join()`.
(I'm not sure if we *always* used `with` since that commit, but currently we do.)

Make sure that the context manager *is* used, and remove the `server.stop()`
calls from ConnectionHandler.

12 months agogh-126499: test_ssl: Don't assume err.reason is a string (GH-126501)
Petr Viktorin [Thu, 7 Nov 2024 10:06:27 +0000 (11:06 +0100)] 
gh-126499: test_ssl: Don't assume err.reason is a string (GH-126501)

The skipping machinery called `getattr(err, "reason", "")` on an arbitrary
exception. As intermittent Buildbot failures show, sometimes it's set
to None.

Convert it to string for this specific check.

12 months agogh-48020: [docs] Remove the logging howto suggested future FileHandler multiprocessin...
Gregory P. Smith [Thu, 7 Nov 2024 09:57:01 +0000 (01:57 -0800)] 
gh-48020: [docs] Remove the logging howto suggested future FileHandler multiprocessing support (GH-126531)

Docs: Remove the logging howto potential promise of multiprocessing support in the future.

Stick to the facts and suggestions, don't provide hope where we're not going to
implement complexity that we'd rather the user implement themselves when
needed.

12 months agogh-96398: Improve accuracy of compiler checks in configure.ac (#117815)
Erlend E. Aasland [Thu, 7 Nov 2024 09:49:58 +0000 (10:49 +0100)] 
gh-96398: Improve accuracy of compiler checks in configure.ac (#117815)

The following variables are now used in compiler checks:
- $ac_cv_gcc_compat is set to 'yes' for GCC compatible compilers
  (the C preprocessor defines the __GNUC__ macro)
- for compiler basename checks, use $CC_BASENAME
  (may contain platform triplets)
- for the rest, use $ac_cv_cc_name
  (does not contain platform triplets)

12 months agogh-125679: multiprocessing Lock and RLock - fix invalid representation string on...
Duprat [Thu, 7 Nov 2024 08:10:57 +0000 (09:10 +0100)] 
gh-125679: multiprocessing Lock and RLock - fix invalid representation string on MacOSX. (#125680)

12 months agoCleanup multiprocessing comment and unusual import error message (#126532)
Gregory P. Smith [Thu, 7 Nov 2024 08:06:14 +0000 (00:06 -0800)] 
Cleanup multiprocessing comment and unusual import error message (#126532)

Define constants as constants rather than calling `list(range(2))`.
Explain which values must remain in sync via comments.

12 months agogh-125926: Fix urllib.parse.urljoin() for base URI with undefined authority (GH-125989)
Serhiy Storchaka [Thu, 7 Nov 2024 07:09:59 +0000 (09:09 +0200)] 
gh-125926: Fix urllib.parse.urljoin() for base URI with undefined authority (GH-125989)

Although this goes beyond the application of RFC 3986, urljoin()
should support relative base URIs for backward compatibility.

12 months agogh-125631: Enable setting persistent_id and persistent_load of pickler and unpickler...
Serhiy Storchaka [Thu, 7 Nov 2024 06:53:02 +0000 (08:53 +0200)] 
gh-125631: Enable setting persistent_id and persistent_load of pickler and unpickler (GH-125752)

pickle.Pickler.persistent_id and pickle.Unpickler.persistent_load can
again be overridden as instance attributes.

12 months agoGH-126458: disable SIMD for HACL under WASI (#126512)
Brett Cannon [Wed, 6 Nov 2024 22:33:46 +0000 (14:33 -0800)] 
GH-126458: disable SIMD for HACL under WASI (#126512)

Requires an extra `-msimd128` flag and the `*mmintrin.h` header files are exclusive to x86-family CPUs.

12 months agogh-126451: Register contextvars.Context to collections.abc.Mapping (#126452)
Stephen Morton [Wed, 6 Nov 2024 22:12:45 +0000 (14:12 -0800)] 
gh-126451: Register contextvars.Context to collections.abc.Mapping (#126452)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
12 months agogh-126509: Update link to CPython's grammar docs in InternalDocs/parser.md (#126510)
Valerii [Wed, 6 Nov 2024 22:11:48 +0000 (03:11 +0500)] 
gh-126509: Update link to CPython's grammar docs in InternalDocs/parser.md (#126510)

12 months agogh-126513: Use helpers for `_Py_Specialize_ConstainsOp` (#126517)
Kirill Podoprigora [Wed, 6 Nov 2024 21:52:15 +0000 (23:52 +0200)] 
gh-126513: Use helpers for `_Py_Specialize_ConstainsOp` (#126517)

* Use helpers for _Py_Specialize_ConstainsOp

* Remove unnecessary variable

12 months agogh-126489: Do not call persistent_id() for a persistent id in Python pickle (GH-126490)
Serhiy Storchaka [Wed, 6 Nov 2024 20:25:14 +0000 (22:25 +0200)] 
gh-126489: Do not call persistent_id() for a persistent id in Python pickle (GH-126490)

12 months agogh-115999: Move specializer test from test_dis to test_opcache (gh-126498)
Donghee Na [Wed, 6 Nov 2024 20:23:47 +0000 (05:23 +0900)] 
gh-115999: Move specializer test from test_dis to test_opcache (gh-126498)

12 months agogh-115999: Introduce helpers for (un)specializing instructions (#126414)
mpage [Wed, 6 Nov 2024 20:04:04 +0000 (12:04 -0800)] 
gh-115999: Introduce helpers for (un)specializing instructions (#126414)

Introduce helpers for (un)specializing instructions

Consolidate the code to specialize/unspecialize instructions into
two helper functions and use them in `_Py_Specialize_BinaryOp`.
The resulting code is more concise and keeps all of the logic at
the point where we decide to specialize/unspecialize an instruction.

12 months agogh-126461: Fix _Unpickler_ReadFromFile() error handling (#126485)
Victor Stinner [Wed, 6 Nov 2024 13:24:46 +0000 (14:24 +0100)] 
gh-126461: Fix _Unpickler_ReadFromFile() error handling (#126485)

Handle _Unpickler_SetStringInput() failure.

12 months agogh-122838: Document missing opcodes (#123073)
Kamil Turek [Wed, 6 Nov 2024 12:16:13 +0000 (13:16 +0100)] 
gh-122838: Document missing opcodes (#123073)

12 months agogh-126455: Disallow _ssl.SSLSocket instantiation (#126481)
Victor Stinner [Wed, 6 Nov 2024 10:59:39 +0000 (11:59 +0100)] 
gh-126455: Disallow _ssl.SSLSocket instantiation (#126481)

Prevent creation of incomplete/invalid _ssl.SSLSocket objects when
created directly.

12 months agogh-126433: Change channel_info.count to int64_t (#126447)
Victor Stinner [Wed, 6 Nov 2024 10:20:17 +0000 (11:20 +0100)] 
gh-126433: Change channel_info.count to int64_t (#126447)

Fix compiler warnings on 32-bit Windows: change channel_info.count
type from Py_ssize_t to int64_t in _interpchannelsmodule.c.

12 months agogh-120754: Add to `io` optimization to what's new (#126466)
Cody Maloney [Wed, 6 Nov 2024 06:54:40 +0000 (22:54 -0800)] 
gh-120754: Add to `io` optimization to what's new (#126466)

12 months agogh-115999: Add free-threaded specialization for CONTAINS_OP (gh-126450)
Donghee Na [Wed, 6 Nov 2024 03:35:10 +0000 (12:35 +0900)] 
gh-115999: Add free-threaded specialization for CONTAINS_OP (gh-126450)

- The specialization logic determines the appropriate specialization using only the operand's type, which is safe to read non-atomically (changing it requires stopping the world). We are guaranteed that the type will not change in between when it is checked and when we specialize the bytecode because the types involved are immutable (you cannot assign to `__class__` for exact instances of `dict`, `set`, or `frozenset`). The bytecode is mutated atomically using helpers.
- The specialized instructions rely on the operand type not changing in between the `DEOPT_IF` checks and the calls to the appropriate type-specific helpers (e.g. `_PySet_Contains`). This is a correctness requirement in the default builds and there are no changes to the opcodes in the free-threaded builds that would invalidate this.

12 months agoGH-126464: Temporarily disable `aarch64-apple-darwin` JIT CI jobs (gh-126465)
Brandt Bucher [Wed, 6 Nov 2024 03:09:04 +0000 (19:09 -0800)] 
GH-126464: Temporarily disable `aarch64-apple-darwin` JIT CI jobs (gh-126465)

* Temporarily disable aarch64-apple-darwin JIT CI jobs

* Also up here

12 months agogh-70764: inspect.getclosurevars now identifies global variables with LOAD_GLOBAL...
blhsing [Tue, 5 Nov 2024 23:53:54 +0000 (07:53 +0800)] 
gh-70764: inspect.getclosurevars now identifies global variables with LOAD_GLOBAL (#120143)

12 months agogh-122544: Change OS image in GitHub Actions to Ubuntu 24.04 (#122566)
Damien [Tue, 5 Nov 2024 23:29:21 +0000 (07:29 +0800)] 
gh-122544: Change OS image in GitHub Actions to Ubuntu 24.04 (#122566)

12 months agoGH-125911: Rename big trampoline to "shim" (GH-126339)
Savannah Ostrowski [Tue, 5 Nov 2024 23:26:46 +0000 (15:26 -0800)] 
GH-125911: Rename big trampoline to "shim" (GH-126339)

12 months agogh-122544: Change OS image in Azure pipeline to Ubuntu 24.04 (#125344)
Damien [Tue, 5 Nov 2024 23:10:12 +0000 (07:10 +0800)] 
gh-122544: Change OS image in Azure pipeline to Ubuntu 24.04 (#125344)

12 months agopathlib ABCs: defer path joining (#126409)
Barney Gale [Tue, 5 Nov 2024 21:19:36 +0000 (21:19 +0000)] 
pathlib ABCs: defer path joining (#126409)

Defer joining of path segments in the private `PurePathBase` ABC. The new
behaviour matches how the public `PurePath` class handles path segments.

This removes a hard-to-grok difference between the ABCs and the main
classes. It also slightly reduces the size of `PurePath` objects by
eliminating a `_raw_path` slot.

12 months agogh-126074: Removes unnecessary DLLs from embeddable package (GH-126143)
Steve Dower [Tue, 5 Nov 2024 20:43:52 +0000 (20:43 +0000)] 
gh-126074: Removes unnecessary DLLs from embeddable package (GH-126143)

12 months agoGH-124985: Document that `pathlib.Path.copy()` uses copy-on-write. (#125861)
Barney Gale [Tue, 5 Nov 2024 18:43:43 +0000 (18:43 +0000)] 
GH-124985: Document that `pathlib.Path.copy()` uses copy-on-write. (#125861)

12 months agogh-126238: Fix possible null pointer dereference of freevars in _PyCompile_LookupArg...
Valery Fedorenko [Tue, 5 Nov 2024 17:34:33 +0000 (20:34 +0300)] 
gh-126238: Fix possible null pointer dereference of freevars in _PyCompile_LookupArg (#126239)

* Replace Py_DECREF by Py_XDECREF

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
12 months agogh-126433: Fix compiler warnings on 32-bit Windows (#126444)
Victor Stinner [Tue, 5 Nov 2024 15:05:13 +0000 (16:05 +0100)] 
gh-126433: Fix compiler warnings on 32-bit Windows (#126444)

12 months agogh-115999: Fix gdb support for libpython.so after thread-local bytecode change (...
T. Wouters [Tue, 5 Nov 2024 14:49:27 +0000 (15:49 +0100)] 
gh-115999: Fix gdb support for libpython.so after thread-local bytecode change (#126440)

Fix the gdb pretty printer in the face of --enable-shared by delaying the attempt to load the _PyInterpreterFrame definition until after .so files are loaded.

12 months agogh-126425: Refactor `_lsprof_Profiler_enable` (#126426)
sobolevn [Tue, 5 Nov 2024 12:23:24 +0000 (15:23 +0300)] 
gh-126425: Refactor `_lsprof_Profiler_enable` (#126426)

- Explicit memory management for `None` objects (since we still try to treat immortal objects as regular objects)
- Respect possible errors of `sys.monitoring.register_callback` call