Commit graph

55244 commits

Author SHA1 Message Date
Miss Islington (bot)
ecd97caaf5
[3.14] gh-136421: Load _datetime static types during interpreter initialization (GH-136583) (GH-136943)
gh-136421: Load `_datetime` static types during interpreter initialization (GH-136583)

`_datetime` is a special module, because it's the only non-builtin C extension that contains static types. As such, it would initialize static types in the module's execution function, which can run concurrently. Since static type initialization is not thread-safe, this caused crashes. This fixes it by moving the initialization of `_datetime`'s static types to interpreter startup (where all other static types are initialized), which is already properly protected through other locks.
(cherry picked from commit a10960699a)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-07-21 19:23:05 -04:00
Serhiy Storchaka
893707c538
[3.14] gh-135661: Fix parsing attributes with whitespaces around the "=" separator in HTMLParser (GH-136908) (#136927) 2025-07-21 20:34:24 +02:00
Miss Islington (bot)
81edfb7140
[3.14] GH-136874: url2pathname(): discard query and fragment components (GH-136875) (#136942)
GH-136874: `url2pathname()`: discard query and fragment components (GH-136875)

In `urllib.request.url2pathname()`, ignore any query or fragment components
in the given URL.
(cherry picked from commit 80b2d60a51)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2025-07-21 19:08:07 +01:00
Miss Islington (bot)
11378e1c85
[3.14] gh-135621: Simplify TermInfo (GH-136916) (#136925) 2025-07-21 18:04:13 +02:00
Lysandros Nikolaou
af8d1f56f5
[3.14] gh-132661: Disallow Template/str concatenation after PEP 750 spec update (#135996) (#136901)
Co-authored-by: Dave Peck <davepeck@gmail.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
2025-07-21 17:34:54 +02:00
Miss Islington (bot)
031645a884
[3.14] gh-135621: Remove dependency on curses from PyREPL (GH-136758) (GH-136915)
(cherry picked from commit 09dfb50f1b)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-07-21 13:02:41 +02:00
Miss Islington (bot)
9663f93a50
[3.14] gh-136470: Correct InterpreterPoolExecutor's default thread name (GH-136472) (GH-136889)
gh-136470: Correct InterpreterPoolExecutor's default thread name (GH-136472)

The OS thread name is now correctly prefixed with `InterpreterPoolExecutor` instead of `ThreadPoolExecutor`.
(cherry picked from commit 246be21de1)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2025-07-21 00:00:19 +00:00
Miss Islington (bot)
17c5959aa3
[3.14] GH-130645: Default to color help in argparse (GH-136809) (#136886)
GH-130645: Default to color help in argparse (GH-136809)
(cherry picked from commit acbe896cb1)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-07-20 15:22:53 -07:00
Miss Islington (bot)
c537b98e48
[3.14] gh-130655: gettext: Add fallback testcase (GH-136857) (#136862)
gh-130655: gettext: Add fallback testcase (GH-136857)
(cherry picked from commit c6e6fe92cd)

Co-authored-by: Dominic H <dom@dominic.sk>
2025-07-20 12:32:58 +00:00
Olga Pustovalova
0e909267f6
[3.14] gh-136438: Make sure test_remote_pdb pass with all optimization levels (GH-136788) (GH-136855)
(cherry picked from commit 588d9fb84a)
2025-07-20 13:51:59 +02:00
Miss Islington (bot)
197f3eca2a
[3.14] gh-136764: improve comment in enum.verify.__call__ (GH-136774) (GH-136841)
gh-136764: improve comment in enum.verify.__call__ (GH-136774)
(cherry picked from commit 6a1c93af80)

Co-authored-by: Saurav Singh <sauravsinghshakya@yahoo.com>
2025-07-19 11:00:15 -07:00
Miss Islington (bot)
4606b4089d
[3.14] gh-136839: Refactor simple dict.update calls (GH-136811) (#136840)
gh-136839: Refactor simple dict.update calls (GH-136811)

Refactor simple dict.update calls

This commit refactors simple `dict.update({key: value})` calls which can
be done via `dict[key] = value` instead.

I found those cases with the [semgrep](https://semgrep.dev/) tool:

```
$ semgrep --lang python --pattern '$DICT.update({$A: ...})'

┌─────────────────┐
│ 5 Code Findings │
└─────────────────┘

    Lib/dataclasses.py
         1268┆ slots.update({slot: doc})

    Lib/multiprocessing/resource_tracker.py
           50┆ _CLEANUP_FUNCS.update({
           51┆     'semaphore': _multiprocessing.sem_unlink,
           52┆ })
            ⋮┆----------------------------------------
           53┆ _CLEANUP_FUNCS.update({
           54┆     'shared_memory': _posixshmem.shm_unlink,
           55┆ })

    Lib/tkinter/scrolledtext.py
           26┆ kw.update({'yscrollcommand': self.vbar.set})

    Lib/xmlrpc/server.py
          242┆ self.funcs.update({'system.multicall' : self.system_multicall})
```
(cherry picked from commit 69ea1b3a8f)

Co-authored-by: Disconnect3d <dominik.b.czarnota@gmail.com>
2025-07-19 17:36:31 +00:00
Miss Islington (bot)
2a9aeb0f57
[3.14] gh-136801: Fix PyREPL syntax highlightning on match cases after multi-line case (GH-136804) (GH-136813)
(cherry picked from commit 3a64844533)

Co-authored-by: Olga Matoula <olgamatoula@gmail.com>
2025-07-19 15:56:40 +02:00
Miss Islington (bot)
a91e2bc440
[3.14] Fix typo in Lib/test/test_ast/test_ast.py (GH-136767) (#136783)
Fix typo in `Lib/test/test_ast/test_ast.py` (GH-136767)

`ASTOptimiziationTests` -> `ASTOptimizationTests`
(cherry picked from commit 60146f4f6f)

Co-authored-by: Hunter Hogan <hunterhogan@users.noreply.github.com>
2025-07-19 10:23:52 +00:00
Miss Islington (bot)
76d4a43bd8
[3.14] gh-127146: Emscripten: Set umask to zero in python.sh (GH-136740) (#136745)
Clears the umask used during a test of pydoc.apropos when testing on
Emscripten. This is to work around a known issue in Emscripten; but it's not
clear if the chmod call that is causing the problem is actually testing
anything of significance.
(cherry picked from commit 22af5d35a6)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-07-17 16:05:40 +00:00
Miss Islington (bot)
9bf3464852
[3.14] gh-135148: Correctly handle f/t strings with comments and debug expressions (GH-135198) (#136720) 2025-07-17 00:10:46 +02:00
Miss Islington (bot)
9b7c4183cd
[3.14] gh-127146: Emscripten: Don't need to avoid unpaired surrogate anymore (GH-136707) (#136717)
This might have been fixed by gh-136624, or by some Emscripten change.
In any case, it no longer seems to be needed.
(cherry picked from commit dcd27aace1)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-07-16 16:24:15 +00:00
Miss Islington (bot)
4eee754091
[3.14] gh-127146: Emscripten: Make os.umask() actually work (GH-136706) (#136711)
Provide a stub implementation of umask that is enough to get some tests passing.
More work is needed upstream in Emscripten to make all umask tests to pass.
(cherry picked from commit 12e52cad71)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-07-16 16:12:36 +00:00
Miss Islington (bot)
ca6db4fdae
[3.14] gh-127146: Emscripten: more regular stack overflow skips (GH-136708) (#136712)
Makes the Emscripten stack overflow skip message consistent with WASI,
and replaces some ad-hoc skips.
(cherry picked from commit c730952aa6)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-07-16 17:54:04 +02:00
Miss Islington (bot)
677b0e314c
[3.14] gh-136523: Fix wave.Wave_write emitting an unraisable when open raises (GH-136529) (GH-136606)
(cherry picked from commit 171de05b48)

Co-authored-by: Sachin Shah <39803835+inventshah@users.noreply.github.com>
2025-07-16 07:26:52 +00:00
Miss Islington (bot)
d888f46fba
[3.14] Fix the doctest.testmod() docstring (GH-136675) (GH-136690)
__test__ = None is not supported since Python 2.4.
(cherry picked from commit cb59eaefed)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-07-15 17:07:01 +00:00
Miss Islington (bot)
9ae74e94a0
[3.14] gh-136396: Include instrumentation when creating new copies of the bytecode (GH-136525) (GH-136657)
Previously, we assumed that instrumentation would happen for all copies of
the bytecode if the instrumentation version on the code object didn't match
the per-interpreter instrumentation version. That assumption was incorrect:
instrumentation will exit early if there are no new "events," even if there
is an instrumentation version mismatch.

To fix this, include the instrumented opcodes when creating new copies of
the bytecode, rather than replacing them with their uninstrumented variants.
I don't think we have to worry about races between instrumentation and creating
new copies of the bytecode: instrumentation and new bytecode creation cannot happen
concurrently. Instrumentation requires that either the world is stopped or the
code object's per-object lock is held and new bytecode creation requires holding
the code object's per-object lock.
(cherry picked from commit d995922198)

Co-authored-by: mpage <mpage@meta.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-07-15 11:10:37 -04:00
Miss Islington (bot)
2ae0eb1a87
[3.14] GH-132661: Add `string.templatelib.convert()` (GH-135217) (#136671)
GH-132661: Add ``string.templatelib.convert()`` (GH-135217)
(cherry picked from commit 5b969fd645)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-07-15 10:22:24 +00:00
Miss Islington (bot)
115477399b
[3.14] gh-131189: Fix "msvcrt" import warning on Linux when "_ctypes" is not available. (GH-131201) (GH-136668)
Fix "msvcrt" import warning on Linux when "_ctypes" is not available.

On Linux, compiling without "libffi" causes a
"No module named 'msvcrt'" warning when launching PyREPL.
(cherry picked from commit f320c951c3)

Co-authored-by: Dzmitry Plashchynski <plashchynski@gmail.com>
2025-07-15 10:12:45 +02:00
Miss Islington (bot)
55eaaab8a4
[3.14] gh-116738: Make grp module thread-safe (GH-135434) (#136658)
gh-116738: Make grp module thread-safe (GH-135434)

Make grp module methods getgrgid() and getgrnam() thread-safe when the GIL is disabled and getgrgid_r()/getgrnam_r() C APIs are not available.
---------
(cherry picked from commit 9363703bd3)

Co-authored-by: Alper <alperyoney@fb.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-07-15 11:03:33 +05:30
Miss Islington (bot)
ba070b6b07
[3.14] gh-135256: Simplify parsing parameters in Argument Clinic (GH-135257) (121914136635)
(cherry picked from commit b74fb8e220)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-07-13 20:52:02 +00:00
Miss Islington (bot)
348e22cf06
[3.14] gh-127971: fix off-by-one read beyond the end of a string during search (GH-132574) (#136628)
gh-127971: fix off-by-one read beyond the end of a string during search (GH-132574)
(cherry picked from commit 85ec3b3b50)

Co-authored-by: Duane Griffin <duaneg@dghda.com>
2025-07-13 13:58:03 +00:00
Miss Islington (bot)
64df22c190
[3.14] gh-136549: Fix signature of threading.excepthook() (GH-136559) (GH-136589)
(cherry picked from commit be2c3d284e)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-07-12 16:18:23 +00:00
Miss Islington (bot)
d5866a8e84
[3.14] gh-91153: prevent a crash in bytearray.__setitem__(ind, ...) when ind.__index__ has side-effects (GH-132379) (#136581)
gh-91153: prevent a crash in `bytearray.__setitem__(ind, ...)` when `ind.__index__` has side-effects (GH-132379)
(cherry picked from commit 5e1e21dee3)

Co-authored-by: Bast <52266665+bast0006@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-07-12 14:38:57 +00:00
Miss Islington (bot)
c71ecd1418
[3.14] gh-134759: fix UnboundLocalError in email.message.Message.get_payload (GH-136071) (#136579)
gh-134759: fix `UnboundLocalError` in `email.message.Message.get_payload` (GH-136071)
(cherry picked from commit 25335d297b)

Co-authored-by: Kliment Lamonov <klimentlamonov@yandex.ru>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-07-12 13:56:10 +00:00
Miss Islington (bot)
33f561d7be
[3.14] gh-89083: Add CLI tests for UUIDv{6,7,8} (GH-136548) (#136576)
gh-89083: Add CLI tests for `UUIDv{6,7,8}` (GH-136548)
(cherry picked from commit c564847e98)

Co-authored-by: Weilin Du <108666168+LamentXU123@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-07-12 12:33:53 +00:00
Miss Islington (bot)
e03db7317f
[3.14] gh-136517: Print uncollectable objects if DEBUG_UNCOLLECTABLE mode was set (GH-136518) (#136522)
gh-136517: Print uncollectable objects if DEBUG_UNCOLLECTABLE mode was set (GH-136518)
(cherry picked from commit c560df9658)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
2025-07-11 15:20:05 +01:00
Miss Islington (bot)
a464c4e2e8
[3.14] gh-136434: Fix docs generation of UnboundItem in subinterpreters (GH-136435) (#136540)
gh-136434: Fix docs generation of `UnboundItem` in subinterpreters (GH-136435)
(cherry picked from commit 3343fce05a)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-07-11 12:57:52 +00:00
Miss Islington (bot)
183b020cb5
[3.14] gh-52876: Implement missing parameter in codecs.StreamReaderWriter functions (GH-136498) (#136514)
gh-52876: Implement missing parameter in `codecs.StreamReaderWriter` functions (GH-136498)

Closes GH-52876
(cherry picked from commit 35e2c35970)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-07-10 16:09:45 +00:00
Miss Islington (bot)
95baa28d9f
[3.14] gh-132661: Add default value (of "") for Interpolation.expression (GH-136441) (#136511)
Co-authored-by: Dave Peck <davepeck@gmail.com>
2025-07-10 14:52:18 +00:00
Miss Islington (bot)
da8bcfd949
[3.14] gh-136394: Fix race condition in test_zstd (GH-136432) (GH-136506)
gh-136394: Fix race condition in test_zstd (GH-136432)
(cherry picked from commit f519918ec6)

Co-authored-by: Rogdham <3994389+Rogdham@users.noreply.github.com>
2025-07-10 09:13:34 -04:00
Miss Islington (bot)
2de82bcc62
[3.14] gh-136438: Make sure test_builtins pass with all optimization levels (GH-136474) (#136496)
gh-136438: Make sure `test_builtins` pass with all optimization levels (GH-136474)
(cherry picked from commit c176543349)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-07-10 12:30:07 +03:00
Miss Islington (bot)
4d025a2318
[3.14] gh-136476: Show the full stack in get_async_stack_trace in _remote_debugging (GH-136483) (#136490)
gh-136476: Show the full stack in get_async_stack_trace in _remote_debugging (GH-136483)
(cherry picked from commit ea45a2f97c)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2025-07-10 00:57:40 +01:00
Miss Islington (bot)
19518a4205
[3.14] gh-136447: Use self.loop instead of global loop variable in asyncio REPL (GH-136448) (#136458)
gh-136447: Use `self.loop` instead of global `loop` variable in asyncio REPL (GH-136448)
(cherry picked from commit 77fa7a4dcc)

Co-authored-by: Justin Su <injustsu@gmail.com>
2025-07-09 09:23:43 +00:00
Miss Islington (bot)
c29fce05f3
[3.14] gh-134657: Remove newly added private names from asyncio.__all__ (GH-134665) (#136455)
gh-134657: Remove newly added private names from asyncio.__all__ (GH-134665)
(cherry picked from commit 797abd1f7f)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-07-09 08:34:19 +00:00
Miss Islington (bot)
66f85f4be8
[3.14] Update bytecode magic number in tests for the 3.14 release candidate (GH-136427) (#136429)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-07-08 17:38:37 +00:00
Miss Islington (bot)
f937b9fffb
[3.14] gh-136380: Fix import behavior for concurrent.futures.InterpreterPoolExecutor (GH-136381) (#136420)
gh-136380: Fix import behavior for `concurrent.futures.InterpreterPoolExecutor` (GH-136381)
(cherry picked from commit 490eea0281)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
2025-07-08 19:11:48 +03:00
Hugo van Kemenade
0a15ae71ad Merge branch '3.14' of https://github.com/python/cpython into 3.14 2025-07-08 17:35:22 +03:00
Miss Islington (bot)
78c1227381
[3.14] gh-136186: Fix race condition in test_external_inspection.test_only_active_thread (GH-136347) (#136416) 2025-07-08 12:48:03 +00:00
Hugo van Kemenade
7ec1faba0c Python 3.14.0b4 2025-07-08 11:57:23 +03:00
Miss Islington (bot)
145c08629b
[3.14] gh-136297: Fix hypothesis and subTest usage in test_zoneinfo_property.py (GH-136384) (#136407)
gh-136297: Fix `hypothesis` and `subTest` usage in `test_zoneinfo_property.py` (GH-136384)
(cherry picked from commit db699db99d)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-07-08 08:16:51 +00:00
Miss Islington (bot)
e25531331b
[3.14] gh-87790: support thousands separators for formatting fractional part of Decimal (GH-132202) (#136365)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-07-07 19:24:30 +03:00
Miss Islington (bot)
442b781cfc
[3.14] gh-87790: support thousands separators for formatting fractional part of Fraction (GH-132204) (#136364)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-07-07 19:24:24 +03:00
Miss Islington (bot)
d9c36a7aa6
[3.14] gh-124486: Fix test_whichdb_ndbm in test_dbm on NetBSD (GH-136335) (GH-136378)
On NetBSD, ndbm.open() does not fail for empty file.
(cherry picked from commit b7aa2a4b4d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-07-07 12:57:37 +00:00
Miss Islington (bot)
f87578f831
[3.14] gh-130662: Accept leading zeros in precision/width for Decimal's formatting (GH-132549) (#136362)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-07-07 09:55:35 +00:00