Commit graph

127576 commits

Author SHA1 Message Date
Miss Islington (bot)
4af1b72b31
[3.14] gh-133600: Move config.site-wasm32-emscripten into the emscripten folder (GH-136934) (#136956)
Reorganises the large Emscripten-specific file into the Emscripten folder.
(cherry picked from commit bbe589f93c)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-07-22 00:22:57 +00:00
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
Miss Islington (bot)
718fc5b139
[3.14] gh-136870: fix data race in PyThreadState_Clear on sys_tracing_threads (GH-136951) (#136953)
gh-136870: fix data race in `PyThreadState_Clear` on `sys_tracing_threads` (GH-136951)

In free-threading, multiple threads can be cleared concurrently as such the modifications on `sys_tracing_threads` should be done while holding the profile lock, otherwise it can race with other threads setting up profiling.
(cherry picked from commit f183996eb7)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-07-21 21:01:14 +00: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)
fa9a369044
[3.14] gh-136437: Document os.path.dirname as accepting only pos-only (GH-136946) (#136947)
gh-136437: Document `os.path.dirname` as accepting only pos-only (GH-136946)
(cherry picked from commit 3224429450)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-07-21 18:29:22 +00: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)
aa17c39339
[3.14] gh-136437: Document some os.path functions as requiring pos-only (GH-136812) (#136944)
gh-136437: Document some `os.path` functions as requiring pos-only (GH-136812)
(cherry picked from commit b5428bb0e7)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-07-21 18:07:56 +00:00
Miss Islington (bot)
f86a59549b
[3.14] Pedantic rewording of why relative importing doesn't work in main modules (GH-136846) (#136940)
Pedantic rewording of why relative importing doesn't work in main modules (GH-136846)

Pedantically reword the section about relative imports and main modules.
(cherry picked from commit 4b68289ca6)

Co-authored-by: Josh Cannon <joshdcannon@gmail.com>
2025-07-21 09:58:27 -07: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)
0d87bb66d3
[3.14] gh-121028: Soft-deprecate sys.api_version (GH-136463) (GH-136928)
(cherry picked from commit 658599c15d)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-07-21 12:29:51 +00: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)
4f6f3ee8d3
[3.14] gh-136852: Emscripten: Add PYTHON_NODE_VERSION environment variable (GH-136853) (GH-136907)
To choose the node version we use. Together with:
https://github.com/python/buildmaster-config/pull/614
closes GH-136852.
(cherry picked from commit aec7f5f8b2)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-07-21 11:58:57 +02:00
Miss Islington (bot)
a69472e242
[3.14] gh-134411: assert PyLong_FromLong(x) != NULL when x is known to be small (GH-134415) (#136910)
gh-134411: assert `PyLong_FromLong(x) != NULL` when `x` is known to be small (GH-134415)

Since `PyLong_From Long(PY_MONITORING_DEBUGGER_ID)` falls to `small_int` case and can't return `NULL`. Added `assert`s for extra confidence.
https://github.com/python/cpython/issues/134411#issuecomment-2897653868
(cherry picked from commit cf19b6435d)

Co-authored-by: Sergey Muraviov <smurav@mail.ru>
2025-07-21 09:23:33 +00:00
Miss Islington (bot)
163f532530
[3.14] gh-136882: Update stale link in the basic logging tutorial. (GH-136885) (#136905)
Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-07-21 12:04:39 +03:00
Miss Islington (bot)
d0623cbbf5
[3.14] gh-136428: amend UUIDv8 performance improvements (GH-136903) (#136904)
gh-136428: amend UUIDv8 performance improvements (GH-136903)

UUIDv8 has been added in Python 3.14.0a2 and its construction time
has been improved in Python 3.14.0a4, but since those changes will
not be visible when comparing the latest Python 3.13 and 3.14 together,
we do not document them on the What's New page to avoid confusion.
(cherry picked from commit 5798348a07)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-07-21 08:29:52 +00: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)
2f7684ceee
[3.14] GH-111758: Merge TSan and UBSan reusable GHA workflows (GH-136820) (#136883)
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Sviatoslav Sydorenko <webknjaz@redhat.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-07-20 20:28:28 +00:00
Miss Islington (bot)
2caae152b9
[3.14] gh-86608: Improve and restructure tarfile examples (GH-121771) (#136866)
gh-86608: Improve and restructure tarfile examples (GH-121771)

Add an example on how to write a tarfile to stdout; general improvements.
(cherry picked from commit cc81b4e501)

Co-authored-by: Dominic H <dom@dominic.sk>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-07-20 14:16:19 +01: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
Miss Islington (bot)
ee37365e0d
[3.14] gh-136854: Exit on error in make venv (GH-136856) (#136860)
Co-authored-by: Nacho Caballero <nachocab@gmail.com>
Co-authored-by: Nacho Caballero <nacho.caballero@astrazeneca.com>
2025-07-20 12:13:48 +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)
2cb3b534e7
[3.14] gh-108362: Retarget incremental GC changes to 3.14 (GH-125453) (#136851)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-07-20 14:28:17 +03:00
Miss Islington (bot)
cce38eefd4
[3.14] Doc/c-api/memory.rst: extend --without-pymalloc doc with ASan information (GH-136790) (GH-136798)
Extend the documentation for disabling pymalloc with the `--without-pymalloc` flag regarding why it is worth to use it when enabling AddressSanitizer for Python build (which is done, e.g., in CPython's CI builds).

I have tested the CPython latest main build with both ASan and pymalloc enabled and it seems to work just fine. I did run the `python -m test` suite which didn't uncover any ASan crashes (though, it detected some memory leaks, which I believe are irrelevant here).

I have discussed ASan and this flag with @encukou on the CPython Core sprint on EuroPython 2025. We initially thought that the `--without-pymalloc` flag is needed for ASan builds due to the fact pymalloc must hit the begining of page when determining if the memory to be freed comes from pymalloc or was allocated by the system malloc. In other words, we thought, that ASan would crash CPython during free of big objects (allocated by system malloc). It may be that this was the case in the past, but it is not the case anymore as the `address_in_range` function used by pymalloc is annotated to be skipped from the ASan instrumentation.


(cherry picked from commit d19bb44713)

Co-authored-by: Disconnect3d <dominik.b.czarnota@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-07-20 10:55:06 +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)
f8af7cb723
[3.14] gh-136752: Clarify documentation for `IPv{N}Address.is_reserved` (GH-136794) (#136827)
gh-136752: Clarify documentation for ``IPv{N}Address.is_reserved`` (GH-136794)
(cherry picked from commit 6293d8a1a6)

Co-authored-by: Matthieu Lienart <50069805+mlnrt@users.noreply.github.com>
Co-authored-by: Matthieu Lienart <matthieu.lienart@axians.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-07-19 14:50:30 +00:00
Miss Islington (bot)
8d063f3d92
[3.14] gh-54732: Make argparse error caused by empty rows in option files explicit (GH-136795) (#136818)
gh-54732: Make argparse error caused by empty rows in option files explicit (GH-136795)
(cherry picked from commit 8ffc3ef01e)

Co-authored-by: jdunter <2ve@mailbox.org>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-07-19 14:28:52 +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)
03457ca2ac
[3.14] gh-135730: Clarify multiprocessing.Queue close() documentation (GH-136803) (GH-136806)
gh-135730: Clarify multiprocessing.Queue close() documentation (GH-136803)

Add a copy of the text from SimpleQueue.close()

---------
(cherry picked from commit f575588ccf)

Co-authored-by: aggshruti99 <aggshruti99@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-07-19 14:57:52 +02:00
Miss Islington (bot)
8b4275c99a
[3.14] gh-136769: Include fixed-width integers in the fundamental data types table (GH-136784) (#136785)
gh-136769: Include fixed-width integers in the fundamental data types table (GH-136784)

Fixed-sized types, like ``c_int32``, are currently missing from the fundamental data types table
in the ``ctypes`` documentation. This commit adds them, and  notes that ``c_[u]int8`` is an alias
of ``c_[u]byte``.
(cherry picked from commit acefb978dc)

Co-authored-by: Sina Zel taat <111974143+SZeltaat@users.noreply.github.com>
2025-07-19 10:26:22 +00: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)
ba6ea7c53d
[3.14] gh-74598: document that fnmatch.filterfalse is affected by cache limitation (GH-136781) (#136782)
gh-74598: document that `fnmatch.filterfalse` is affected by cache limitation (GH-136781)
(cherry picked from commit 263e451c41)

Co-authored-by: Gergely Elias <gergely.elias@gmail.com>
2025-07-19 09:56:55 +00:00
Miss Islington (bot)
aeeacdb8b5
[3.14] Docs: Improve example for `itertools.batched()` (GH-136775) (#136778)
Docs: Improve example for ``itertools.batched()`` (GH-136775)

The current example `batched('ABCDEFG', n=3) → ABC DEF G` can confuse readers because both, the size of the tuples and the number of tuples are 3.
By using a batch size of n=2, it is clearer that the `n` argument refers to the size of the resulting tuples.
I.e. the new example is: `batched('ABCDEFG', n=2) → AB CD EF G`
(cherry picked from commit 3eecc72ac7)

Co-authored-by: RafaelWO <38643099+RafaelWO@users.noreply.github.com>
2025-07-19 09:36:35 +00:00
Miss Islington (bot)
81aab6d51c
[3.14] parser_generator.py typo - keywods -> keywords (GH-135014) (#136772)
Co-authored-by: chemelnucfin <3982092+chemelnucfin@users.noreply.github.com>
2025-07-19 09:18:55 +00:00
Miss Islington (bot)
201c765d76
[3.14] Fix typo: "occured" =>"occurred" (GH-134928) (#136771)
Co-authored-by: Roman <121314722+GameRoMan@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-07-19 09:13:51 +00:00
Miss Islington (bot)
2ea3b75200
[3.14] gh-136697: Use the standard audit event format for sys.monitoring docs (GH-136747) (#136749)
gh-136697: Use the standard audit event format for sys.monitoring docs (GH-136747)
(cherry picked from commit 28937d3a21)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2025-07-17 12:00:09 -07: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)
2ce207108c
[3.14] Improved venv docs to indicate that isolation is the default. (GH-136698) (GH-136705)
(cherry picked from commit 8e2f4b4483)
Co-authored-by: Facundo Batista <facundo@taniquetil.com.ar>
Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
2025-07-17 11:24:54 +01: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
Zachary Ware
5f1d46f7d0
[3.14] gh-136710: Fix bad indentation in os.chdir docstring (GH-136719)
(cherry picked from commit bde808ad6b)

Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
2025-07-16 17:15:50 +00:00
Miss Islington (bot)
6943d8ef27
[3.14] gh-126548: Add a thread-unsafety warning for importlib.reload() (GH-136704) (GH-136723)
gh-126548: Add a thread-unsafety warning for `importlib.reload()` (GH-136704)
(cherry picked from commit 69d8fe50dd)

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
2025-07-16 16:40:11 +00: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)
9ab29cac19
[3.14] Add .gram file to the .editorconfig (GH-136680) (#136714)
Add `.gram` file to the `.editorconfig` (GH-136680)
(cherry picked from commit 2f0db9b05f)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-07-16 15:01:44 +00: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)
cdf98c3b7e
[3.14] gh-127146: Report uid in Emscripten + node as native uid (GH-136509) (#136699)
Corrects the handling of getuid on emscripten, which was consistently reporting as 0.
(cherry picked from commit e81c4e84b3)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-07-16 06:50:51 +02: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