Commit graph

123430 commits

Author SHA1 Message Date
Miss Islington (bot)
b03ba54efc
[3.13] bpo-46128: Strip IsolatedAsyncioTestCase frames from reported stacktraces (GH-30196) (#126770)
bpo-46128: Strip IsolatedAsyncioTestCase frames from reported stacktraces (GH-30196)

---------

(cherry picked from commit 2e39d77dde)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2024-11-13 04:48:30 +00:00
Miss Islington (bot)
13fe8f946e
[3.13] gh-126688: Reinit import lock after fork (GH-126692) (GH-126765)
The PyMutex implementation supports unlocking after fork because we
clear the list of waiters in parking_lot.c. This doesn't work as well
for _PyRecursiveMutex because on some systems, such as SerenityOS, the
thread id is not preserved across fork().
(cherry picked from commit 5610860840)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-11-12 22:00:42 +00:00
Miss Islington (bot)
3dab1cebf7
[3.13] GH-120423: pathname2url(): handle forward slashes in Windows paths (GH-126593) (#126764)
GH-120423: `pathname2url()`: handle forward slashes in Windows paths (GH-126593)

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

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2024-11-12 21:57:41 +00:00
Miss Islington (bot)
865f096f51
[3.13] gh-126595: fix a crash when calling itertools.count(sys.maxsize) (GH-126617) (#126739)
gh-126595: fix a crash when calling `itertools.count(sys.maxsize)` (GH-126617)
(cherry picked from commit 6e3bb8a913)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-11-12 14:14:21 +00:00
Miss Islington (bot)
2da063e0b2
[3.13] gh-126405: fix use-after-free in _asyncio.Future.remove_done_callback (GH-126733) (#126736)
gh-126405: fix use-after-free in `_asyncio.Future.remove_done_callback` (GH-126733)
(cherry picked from commit 37c57dfad1)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-11-12 13:04:27 +00:00
Miss Islington (bot)
02cd3ce0f2
[3.13] gh-116510: Fix a Crash Due to Shared Immortal Interned Strings (gh-124865) (gh-125709) (GH-125204)
* gh-116510: Fix a Crash Due to Shared Immortal Interned Strings (gh-124865)

Fix a crash caused by immortal interned strings being shared between
sub-interpreters that use basic single-phase init. In that case, the string
can be used by an interpreter that outlives the interpreter that created and
interned it. For interpreters that share obmalloc state, also share the
interned dict with the main interpreter.

This is an un-revert of gh-124646 that then addresses the Py_TRACE_REFS
failures identified by gh-124785.
(cherry picked from commit f2cb399470)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>

* [3.13] gh-125286: Share the Main Refchain With Legacy Interpreters (gh-125709)

They used to be shared, before 3.12.  Returning to sharing them resolves a failure on Py_TRACE_REFS builds.

---------

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-11-12 13:45:12 +01:00
Alex Waygood
4f1440fd89
[3.13] gh-126451: Revert backports of ABC registrations for contextvars.Context and multiprocessing proxies (#126734) 2024-11-12 12:29:13 +00:00
Miss Islington (bot)
efd8fe4e6e
[3.13] Fix error message of "Check if Autoconf files are up to date" job (GH-126683) (#126717)
Fix error message of "Check if Autoconf files are up to date" job (GH-126683)
(cherry picked from commit 0052a8c638)

Co-authored-by: sobolevn <mail@sobolevn.me>
2024-11-12 11:01:39 +00:00
Miss Islington (bot)
6cefffcdee
[3.13] gh-126525: Fix makeunicodedata.py output on macOS and Windows (GH-126526) (#126725)
gh-126525: Fix `makeunicodedata.py` output on macOS and Windows (GH-126526)
(cherry picked from commit f223efb2a2)

Co-authored-by: sobolevn <mail@sobolevn.me>
2024-11-12 10:48:55 +00:00
Miss Islington (bot)
e5e70c5f09
Update documentation links to Microsoft's documentation pages (GH-126379)
(cherry picked from commit 6e25eb1541)

Co-authored-by: 谭九鼎 <109224573@qq.com>
2024-11-11 17:18:01 +00:00
Miss Islington (bot)
7db6d4282f
[3.13] gh-126505: Fix bugs in compiling case-insensitive character classes (GH-126557) (GH-126689)
* 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
(cherry picked from commit 819830f34a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-11 16:54:57 +00:00
Miss Islington (bot)
fc10908f7d
[3.13] gh-126500: test_ssl: Don't stop ThreadedEchoServer on OSError in ConnectionHandler; rely on __exit__ (GH-126503) (GH-126571)
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 (5b95eb90a7)
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.
(cherry picked from commit c9cda1608e)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-11-11 15:25:58 +01:00
Miss Islington (bot)
1e4b9c7fae
[3.13] gh-126499: test_ssl: Don't assume err.reason is a string (GH-126501) (GH-126574)
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.
(cherry picked from commit 78ad7e6322)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-11-11 13:56:01 +01:00
Miss Islington (bot)
e194b21753
[3.13] gh-126654: Fix crash in several functions in _interpreters module (GH-126678) (#126681)
gh-126654: Fix crash in several functions in `_interpreters` module (GH-126678)
(cherry picked from commit 9fc2808eaf)

Co-authored-by: sobolevn <mail@sobolevn.me>
2024-11-11 12:01:22 +00:00
Miss Islington (bot)
90cf1af325
[3.13] Add missing fullstop . to whatsnew/3.8.rst (GH-126553) (#126672)
Add missing fullstop `.` to whatsnew/3.8.rst (GH-126553)
(cherry picked from commit 82269c7d58)

Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
2024-11-11 07:05:15 +00:00
Miss Islington (bot)
47748758e7
[3.13] gh-126664: Use else instead of finally in "The with statement" documentation. (GH-126665) (#126670)
gh-126664: Use `else` instead of `finally` in "The with statement" documentation. (GH-126665)
(cherry picked from commit 25257d61cf)

Co-authored-by: vivodi <103735539+vivodi@users.noreply.github.com>
2024-11-11 06:54:26 +00:00
Miss Islington (bot)
387b00d43d
[3.13] gh-117378: Clear up the NEWS entry wording (GH-126634) (#126668)
gh-117378: Clear up the NEWS entry wording (GH-126634)

gh-117378: Clear up the NEWS entry wording.

Docs are hard.  Lets go shopping!
(cherry picked from commit 5c488caeb8)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-11-11 06:46:24 +00:00
Miss Islington (bot)
3d8f5490e2
[3.13] gh-126543: Docs: change "bound type var" to "bounded" when used in the context of the 'bound' kw argument to TypeVar (GH-126584) (#126657)
(cherry picked from commit 434b29767f)

Co-authored-by: Pedro Fonini <fonini@protonmail.ch>
2024-11-10 18:48:44 -08:00
Miss Islington (bot)
4567ad2ce4
[3.13] gh-126647: Doc/using/configure.rst: Add an entry for `--enable-experimental-jit` option (GH-126648) (#126655)
gh-126647: `Doc/using/configure.rst`: Add an entry for ``--enable-experimental-jit`` option (GH-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.

(cherry picked from commit f435de6765)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-11-10 21:51:21 +00:00
Miss Islington (bot)
79ad4bddfc
[3.13] gh-117378: Only run the new multiprocessing SysPath test when appropriate (GH-126635) (GH-126652)
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.
(cherry picked from commit ca878b6e45)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-11-10 21:40:33 +00:00
Miss Islington (bot)
9473ae9b51
[3.13] Skip test in test_socket.py if sys.getrefcount isn't available (GH-126640) (#126645)
Skip test in test_socket.py if `sys.getrefcount` isn't available (GH-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`.
(cherry picked from commit 0f6bb28ff3)

Co-authored-by: CF Bolz-Tereick <cfbolz@gmx.de>
2024-11-10 15:41:42 +00:00
Miss Islington (bot)
0d3aa25ee4
[3.13] gh-126565: Skip zipfile.Path.exists check in write mode (GH-126576) (#126642)
gh-126565: Skip `zipfile.Path.exists` check in write mode (GH-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.
(cherry picked from commit 160758a574)

Co-authored-by: Jan Hicken <janhicken@users.noreply.github.com>
2024-11-10 15:21:47 +00:00
Shantanu
fa3ee75e6a
[3.13] Postpone module.__loader__ deprecation to Python 3.16 (GH-126482) (#126638)
Postpone `module.__loader__` deprecation to Python 3.16 (#126482)

(cherry picked from commit 450db61a78)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-11-10 01:01:05 +00:00
Miss Islington (bot)
4e036d376e
[3.13] gh-117378: Fix multiprocessing forkserver preload sys.path inheritance. (GH-126538) (GH-126632)
gh-117378: Fix multiprocessing forkserver preload sys.path inheritance. (GH-126538)

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

(cherry picked from commit 9d08423b6e)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-09 15:47:58 -08:00
Miss Islington (bot)
20043d5cf4
[3.13] GH-126212: Fix removal of slashes in file URIs on Windows (GH-126214) (#126590)
GH-126212: Fix removal of slashes in file URIs on Windows (GH-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.
(cherry picked from commit 54c63a32d0)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2024-11-08 17:31:44 +00:00
Miss Islington (bot)
b1a406d923
gh-126497: Add missing venv redirectors to freethreaded installer (GH-126556)
(cherry picked from commit fd5580cd15)

Co-authored-by: Steve Dower <steve.dower@python.org>
2024-11-08 16:33:54 +00:00
Miss Islington (bot)
8ebb6a051b
gh-125298: Remove misleading text in os.kill documentation (GH-125749)
Windows has not accepted process handles in many releases.
(cherry picked from commit 75ffac296e)

Co-authored-by: RUANG (James Roy) <longjinyii@outlook.com>
2024-11-08 15:47:52 +00:00
Miss Islington (bot)
23468acac4
[3.13] gh-126171: fix possible null dereference in _imp_find_frozen_impl (GH-126566) (#126567)
gh-126171: fix possible null dereference in _imp_find_frozen_impl (GH-126566)
(cherry picked from commit 9ecd8f7f40)

Co-authored-by: Valery Fedorenko <federicovalenso@gmail.com>
2024-11-08 16:25:38 +05:30
Brett Cannon
9ecaee6a55
[3.13] GH-123877: make wasm32-wasip1 the target triple for WASI (#126561) 2024-11-07 16:16:12 -08:00
Miss Islington (bot)
9ab3d31b66
[3.13] Doc: C API: Demote sections to subsections for consistency (GH-126535) (#126546)
Doc: C API: Demote sections to subsections for consistency (GH-126535)

The entire file should be a single section; the headings below the
first heading should be subsections.
(cherry picked from commit e3510bd3dd)

Co-authored-by: Richard Hansen <rhansen@rhansen.org>
2024-11-07 15:35:41 +00:00
Miss Islington (bot)
29997c4fe5
[3.13] gh-48020: [docs] Remove the logging howto suggested future FileHandler multiprocessing support (GH-126531) (#126540)
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.
(cherry picked from commit 1fe67df8e3)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-11-07 10:03:58 +00:00
Miss Islington (bot)
3b05ef10c1
[3.13] gh-125679: multiprocessing Lock and RLock - fix invalid representation string on MacOSX. (GH-125680) (#126533)
gh-125679: multiprocessing Lock and RLock - fix invalid representation string on MacOSX. (GH-125680)
(cherry picked from commit 75f7cf91ec)

Co-authored-by: Duprat <yduprat@gmail.com>
2024-11-07 01:49:31 -08:00
Miss Islington (bot)
07a6aa3f8f
[3.13] gh-125631: Enable setting persistent_id and persistent_load of pickler and unpickler (GH-125752) (GH-126528)
pickle.Pickler.persistent_id and pickle.Unpickler.persistent_load can
again be overridden as instance attributes.
(cherry picked from commit 223d3dc554)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-07 07:21:23 +00:00
Miss Islington (bot)
59316a668e
[3.13] gh-126451: Register contextvars.Context to collections.abc.Mapping (GH-126452) (#126518)
gh-126451: Register contextvars.Context to collections.abc.Mapping (GH-126452)
(cherry picked from commit 5dc36dc565)

Co-authored-by: Stephen Morton <git@tungol.org>
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2024-11-06 22:41:48 +00:00
Miss Islington (bot)
9e115b1015
[3.13] gh-126489: Do not call persistent_id() for a persistent id in Python pickle (GH-126490) (GH-126514)
(cherry picked from commit 8fa4dc4ba8)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-06 22:54:48 +02:00
Miss Islington (bot)
83827ad819
[3.13] gh-126461: Fix _Unpickler_ReadFromFile() error handling (GH-126485) (#126495)
gh-126461: Fix _Unpickler_ReadFromFile() error handling (GH-126485)

Handle _Unpickler_SetStringInput() failure.
(cherry picked from commit a1c57bcfd2)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-11-06 13:51:39 +00:00
Bénédikt Tran
6e9da38866
[3.13] gh-126313: Fix a crash in curses.napms() due to incorrect error handling (GH-126351) (#126493)
gh-126313: Fix a crash in curses.napms() due to incorrect error handling (GH-126351)
2024-11-06 14:33:23 +01:00
Miss Islington (bot)
6a084b9d60
[3.13] gh-126455: Disallow _ssl.SSLSocket instantiation (GH-126481) (#126486)
gh-126455: Disallow _ssl.SSLSocket instantiation (GH-126481)

Prevent creation of incomplete/invalid _ssl.SSLSocket objects when
created directly.
(cherry picked from commit b1c4ffc205)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-11-06 11:24:45 +00:00
Miss Islington (bot)
4f1584657f
[3.13] gh-122544: Change OS image in Azure pipeline to Ubuntu 24.04 (GH-125344) (#126479)
Co-authored-by: Damien <81557462+Damien-Chen@users.noreply.github.com>
2024-11-06 10:24:55 +00:00
Valery Fedorenko
8059351051
[3.13] Fix possible null pointer dereference of freevars in _PyCompile_LookupArg (gh-126238) (#126475)
[3.13] gh-126238: Fix possible null pointer dereference of freevars in _PyCompile_LookupArg (GH-126239)

* Replace Py_DECREF by Py_XDECREF

(cherry picked from commit 8525c9375f)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2024-11-06 08:10:04 +00:00
Miss Islington (bot)
ba86632f7e
[3.13] gh-70764: inspect.getclosurevars now identifies global variables with LOAD_GLOBAL (GH-120143) (#126459)
gh-70764: inspect.getclosurevars now identifies global variables with LOAD_GLOBAL (GH-120143)
(cherry picked from commit 83ba8c2bba)

Co-authored-by: blhsing <blhsing@gmail.com>
2024-11-06 00:18:32 +00:00
Erlend E. Aasland
9dd3addc0c
[3.13] gh-89640: harden float word ordering (#125571 and #126387) (#126429)
Properly detect float word ordering on Linux (gh-125571)

autoconf-archive patch by Dan Amelang.

(cherry picked from commit 26d627779f)

Hardcode WASM float word ordering to little endian (gh-126387)

(cherry picked from commit 532fc08102)
2024-11-05 23:18:55 +01:00
Miss Islington (bot)
88e01318c2
gh-126074: Removes unnecessary DLLs from embeddable package (GH-126143)
(cherry picked from commit f51fd84034)

Co-authored-by: Steve Dower <steve.dower@python.org>
2024-11-05 21:08:44 +00:00
Miss Islington (bot)
ffb44cd08c
[3.13] gh-126425: Refactor _lsprof_Profiler_enable (GH-126426) (#126442)
gh-126425: Refactor `_lsprof_Profiler_enable` (GH-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
(cherry picked from commit 75872605aa)

Co-authored-by: sobolevn <mail@sobolevn.me>
2024-11-05 12:48:18 +00:00
Alex Waygood
c1e708ab07
[3.13] gh-126417: Register multiprocessing proxy types to an appropriate collections.abc class (#126419) (#126435)
Co-authored-by: Stephen Morton <github@tungol.org>
2024-11-05 11:22:44 +00:00
Miss Islington (bot)
cba17e4d92
[3.13] Doc: C API: Delete claim that PyObject_Init is GC-aware (GH-126418) (#126431)
Doc: C API: Delete claim that `PyObject_Init` is GC-aware (GH-126418)
(cherry picked from commit 407c0366d9)

Co-authored-by: Richard Hansen <rhansen@rhansen.org>
2024-11-05 15:31:16 +05:30
Miss Islington (bot)
ce1a1a6021
[3.13] gh-126303: Fix pickling and copying of os.sched_param objects (GH-126336) (GH-126423)
(cherry picked from commit d3840503b0)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-05 06:50:33 +00:00
Miss Islington (bot)
05da4eea5a
[3.13] gh-125436: Doc: Add missing `allow_unnamed_section parameter to ConfigParser` documentation (GH-125437) (#126421)
gh-125436: Doc: Add missing ``allow_unnamed_section`` parameter to ``ConfigParser`` documentation (GH-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.
(cherry picked from commit d960226547)

Co-authored-by: lit <litlighilit@foxmail.com>
2024-11-05 03:04:32 +00:00
Hugo van Kemenade
cccc066241
[3.13] gh-101865: Docs: Keep co_lnotab deprecation for at least 3.14 (GH-126392) (#126403)
(cherry picked from commit eac41c5ddf)
2024-11-04 19:46:26 +02:00
Miss Islington (bot)
9e72a3f2e1
[3.13] Doc: Fix typo in documentation for `MAKE_FUNCTION` opcode (GH-126396) (#126406)
Doc: Fix typo in documentation for  ``MAKE_FUNCTION`` opcode (GH-126396)
(cherry picked from commit e5a4b402ae)

Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
2024-11-04 17:35:12 +00:00