]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
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>
12 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.

12 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`.

12 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>
12 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

12 months agogh-126417: Register multiprocessing proxy types to an appropriate collections.abc...
Stephen Morton [Tue, 5 Nov 2024 10:05:45 +0000 (02:05 -0800)] 
gh-126417: Register multiprocessing proxy types to an appropriate collections.abc class (#126419)

12 months agogh-126366: Fix crash if `__iter__` raises an exception during `yield from` (#126369)
Peter Bierma [Tue, 5 Nov 2024 09:56:36 +0000 (04:56 -0500)] 
gh-126366: Fix crash if `__iter__` raises an exception during `yield from` (#126369)

12 months agoDoc: C API: Delete claim that `PyObject_Init` is GC-aware (#126418)
Richard Hansen [Tue, 5 Nov 2024 09:48:46 +0000 (04:48 -0500)] 
Doc: C API: Delete claim that `PyObject_Init` is GC-aware (#126418)

12 months agogh-119793: Prefer `map(..., strict=True)` over starmap/zip in examples (#126407)
Lukas Geiger [Tue, 5 Nov 2024 07:53:32 +0000 (07:53 +0000)] 
gh-119793: Prefer `map(..., strict=True)` over starmap/zip in examples (#126407)

12 months agogh-120057: Add os.reload_environ() function (#126268)
Victor Stinner [Tue, 5 Nov 2024 07:43:34 +0000 (08:43 +0100)] 
gh-120057: Add os.reload_environ() function (#126268)

Replace the os.environ.refresh() method with a new
os.reload_environ() function.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
12 months agogh-126303: Fix pickling and copying of os.sched_param objects (GH-126336)
Serhiy Storchaka [Tue, 5 Nov 2024 06:23:17 +0000 (08:23 +0200)] 
gh-126303: Fix pickling and copying of os.sched_param objects (GH-126336)

12 months agogh-125436: Doc: Add missing ``allow_unnamed_section`` parameter to ``ConfigParser...
lit [Tue, 5 Nov 2024 02:58:15 +0000 (10:58 +0800)] 
gh-125436: Doc: Add missing ``allow_unnamed_section`` parameter to ``ConfigParser`` documentation (#125437)

Add missing ``allow_unnamed_section`` parameter to ``ConfigParser`` doc, as well as to it's parent ``RawConfigParser``.
Split too long line on ``ConfigParser`` signature.
Add some sections about when some of ``RawConfigParser`` parameters were added.

12 months agogh-126415: Fix conversion warning in `Python/bytecodes.c` (#126416)
Kirill Podoprigora [Tue, 5 Nov 2024 02:12:31 +0000 (04:12 +0200)] 
gh-126415: Fix conversion warning in `Python/bytecodes.c` (#126416)

Fix conversion warning in bytecodes

Co-authored-by: mpage <mpage@cs.stanford.edu>
12 months agogh-89640: Hardcode WASM float word ordering as little endian (#126387)
Erlend E. Aasland [Mon, 4 Nov 2024 20:48:09 +0000 (21:48 +0100)] 
gh-89640: Hardcode WASM float word ordering as little endian (#126387)

12 months agoGH-126363: Speed up pattern parsing in `pathlib.Path.glob()` (#126364)
Barney Gale [Mon, 4 Nov 2024 19:29:57 +0000 (19:29 +0000)] 
GH-126363: Speed up pattern parsing in `pathlib.Path.glob()` (#126364)

The implementation of `Path.glob()` does rather a hacky thing: it calls
`self.with_segments()` to convert the given pattern to a `Path` object, and
then peeks at the private `_raw_path` attribute to see if pathlib removed a
trailing slash from the pattern.

In this patch, we make `glob()` use a new `_parse_pattern()` classmethod
that splits the pattern into parts while preserving information about any
trailing slash. This skips the cost of creating a `Path` object, and avoids
some path anchor normalization, which makes `Path.glob()` slightly faster.
But mostly it's about making the code less naughty.

Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
12 months agogh-115999: Implement thread-local bytecode and enable specialization for `BINARY_OP...
mpage [Mon, 4 Nov 2024 19:13:32 +0000 (11:13 -0800)] 
gh-115999: Implement thread-local bytecode and enable specialization for `BINARY_OP` (#123926)

Each thread specializes a thread-local copy of the bytecode, created on the first RESUME, in free-threaded builds. All copies of the bytecode for a code object are stored in the co_tlbc array on the code object. Threads reserve a globally unique index identifying its copy of the bytecode in all co_tlbc arrays at thread creation and release the index at thread destruction. The first entry in every co_tlbc array always points to the "main" copy of the bytecode that is stored at the end of the code object. This ensures that no bytecode is copied for programs that do not use threads.

Thread-local bytecode can be disabled at runtime by providing either -X tlbc=0 or PYTHON_TLBC=0. Disabling thread-local bytecode also disables specialization.

Concurrent modifications to the bytecode made by the specializing interpreter and instrumentation use atomics, with specialization taking care not to overwrite an instruction that was instrumented concurrently.

12 months agoDoc: Fix typo in documentation for ``MAKE_FUNCTION`` opcode (#126396)
Mikhail Efimov [Mon, 4 Nov 2024 17:28:05 +0000 (20:28 +0300)] 
Doc: Fix typo in documentation for  ``MAKE_FUNCTION`` opcode (#126396)

12 months agogh-101865: Docs: Keep co_lnotab deprecation for at least 3.14 (#126392)
Hugo van Kemenade [Mon, 4 Nov 2024 16:49:59 +0000 (18:49 +0200)] 
gh-101865: Docs: Keep co_lnotab deprecation for at least 3.14 (#126392)

12 months agogh-126220: Adapt `_lsprof` to Argument Clinic (#126233)
sobolevn [Mon, 4 Nov 2024 16:18:21 +0000 (19:18 +0300)] 
gh-126220: Adapt `_lsprof` to Argument Clinic (#126233)

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
12 months agogh-119793: Add optional length-checking to `map()` (GH-120471)
Nice Zombies [Mon, 4 Nov 2024 14:00:19 +0000 (15:00 +0100)] 
gh-119793: Add optional length-checking to `map()` (GH-120471)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
12 months agogh-109413: Add more type hints to `libregrtest` (#126352)
sobolevn [Mon, 4 Nov 2024 10:15:57 +0000 (13:15 +0300)] 
gh-109413: Add more type hints to `libregrtest` (#126352)

12 months agogh-126353: remove implicit creation of loop from `asyncio.get_event_loop` (#126354)
Kumar Aditya [Mon, 4 Nov 2024 08:51:20 +0000 (14:21 +0530)] 
gh-126353: remove implicit creation of loop from `asyncio.get_event_loop` (#126354)

Remove implicit creation of loop from `asyncio.get_event_loop`. This is a step forward of deprecating the policy system of asyncio.

12 months agoDocs: turn getopt examples into doctests (#126377)
Erlend E. Aasland [Mon, 4 Nov 2024 08:27:25 +0000 (09:27 +0100)] 
Docs: turn getopt examples into doctests (#126377)

12 months agogh-126165: Improve docs of function `math.isclose` (#126215)
Zhikang Yan [Mon, 4 Nov 2024 04:08:15 +0000 (12:08 +0800)] 
gh-126165: Improve docs of function `math.isclose` (#126215)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
12 months agoDocs: Delist sqlite3 deprecation from "Pending removal in 3.14" (#126370)
Hugo van Kemenade [Sun, 3 Nov 2024 21:22:49 +0000 (23:22 +0200)] 
Docs: Delist sqlite3 deprecation from "Pending removal in 3.14" (#126370)

12 months agogh-126357: Remove gettext import guards (GH-126358)
Tomas R. [Sun, 3 Nov 2024 16:54:42 +0000 (17:54 +0100)] 
gh-126357: Remove gettext import guards (GH-126358)

12 months agogh-126313: Fix a crash in curses.napms() due to incorrect error handling (GH-126351)
Bénédikt Tran [Sun, 3 Nov 2024 15:08:34 +0000 (16:08 +0100)] 
gh-126313: Fix a crash in curses.napms() due to incorrect error handling (GH-126351)

12 months agogh-104400: Add more tests to pygettext (GH-108173)
Tomas R. [Sun, 3 Nov 2024 14:01:09 +0000 (15:01 +0100)] 
gh-104400: Add more tests to pygettext (GH-108173)

12 months agogh-113977, gh-120754: Remove unbounded reads from zipfile (GH-122101)
Cody Maloney [Sun, 3 Nov 2024 05:28:51 +0000 (22:28 -0700)] 
gh-113977, gh-120754: Remove unbounded reads from zipfile (GH-122101)

GH-113977, GH-120754: Remove unbounded reads from zipfile

Read without a size may read an unbounded amount of data + allocate
unbounded size buffers. Move to capped size reads to prevent potential
issues.

Co-authored-by: Daniel Hillier <daniel.hillier@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
12 months agogh-125832: Reformat comments for inlined comprehensions (gh-126346)
Donghee Na [Sun, 3 Nov 2024 04:15:07 +0000 (13:15 +0900)] 
gh-125832: Reformat comments for  inlined comprehensions (gh-126346)

12 months agogh-120754: Add a strace helper and test set of syscalls for open().read(), Take 2...
Cody Maloney [Sun, 3 Nov 2024 03:37:21 +0000 (20:37 -0700)] 
gh-120754: Add a strace helper and test set of syscalls for open().read(), Take 2 (#123413)

12 months agogh-99880: document rounding mode for new-style formatting (GH-121481)
Sergey B Kirpichev [Sat, 2 Nov 2024 17:11:12 +0000 (20:11 +0300)] 
gh-99880: document rounding mode for new-style formatting (GH-121481)

* gh-99880: document rounding mode for new-style formatting

The CPython uses _Py_dg_dtoa(), which does rounding to nearest with half
to even tie-breaking rule.

If that functions is unavailable, PyOS_double_to_string() fallbacks to
system snprintf().  Since CPython 3.12, build requirements include C11
compiler *and* support for IEEE 754 floating point numbers (Annex F).
This means that FE_TONEAREST macro is available and, per default,
printf-like functions should use same rounding mode as _Py_dg_dtoa().

* Update Doc/library/string.rst

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

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
12 months agogh-125832: Clarify comment for inlined comprehensions as per PEP-709 (#126322)
rimchoi [Sat, 2 Nov 2024 17:04:53 +0000 (02:04 +0900)] 
gh-125832: Clarify comment for inlined comprehensions as per PEP-709 (#126322)

* Fix comprehensions comment to inlined by pep 709

* Update spacing

Co-authored-by: RUANG (James Roy) <longjinyii@outlook.com>
* Add reference to PEP 709

---------

Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Co-authored-by: RUANG (James Roy) <longjinyii@outlook.com>
12 months agogh-126317: Simplify pickle code by using itertools.batched() (GH-126323)
Lee Dong Wook [Sat, 2 Nov 2024 14:07:32 +0000 (23:07 +0900)] 
gh-126317: Simplify pickle code by using itertools.batched() (GH-126323)

12 months agogh-125761: Clarify repeated warning suppression criteria in warnings module (gh-126326)
고병찬 [Sat, 2 Nov 2024 11:37:26 +0000 (20:37 +0900)] 
gh-125761: Clarify repeated warning suppression criteria in warnings module (gh-126326)

12 months agogh-125522: Remove bare except in test_zlib.test_flushes (gh-126321)
simple-is-great [Sat, 2 Nov 2024 08:27:07 +0000 (17:27 +0900)] 
gh-125522: Remove bare except in test_zlib.test_flushes (gh-126321)

12 months agogh-126138: Fix use-after-free in `_asyncio.Task` by evil `__getattribute__` (#126305)
Nico-Posada [Sat, 2 Nov 2024 07:46:00 +0000 (03:46 -0400)] 
gh-126138: Fix use-after-free in `_asyncio.Task` by evil `__getattribute__` (#126305)

Co-authored-by: Carol Willing <carolcode@willingconsulting.com>