]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
3 months agoUse `test.support.is_wasm32` flag for `is_emscripten` or `is_wasi` for generic checks...
Ani [Tue, 22 Jul 2025 19:50:13 +0000 (01:20 +0530)] 
Use `test.support.is_wasm32` flag for `is_emscripten` or `is_wasi` for generic checks (GH-136815)

Co-authored-by: Brett Cannon <brett@python.org>
3 months agoFix tables in 'Using on Windows' for the text writer (#137012)
Adam Turner [Tue, 22 Jul 2025 16:15:29 +0000 (18:15 +0200)] 
Fix tables in 'Using on Windows' for the text writer (#137012)

3 months agogh-136459: Add perf trampoline support for macOS (#136461)
Nazım Can Altınova [Tue, 22 Jul 2025 15:47:24 +0000 (17:47 +0200)] 
gh-136459: Add perf trampoline support for macOS  (#136461)

3 months agoGH-136975: Emend a spelling error (algorthm -> algorithm) (#136999)
Adam Turner [Tue, 22 Jul 2025 13:48:58 +0000 (15:48 +0200)] 
GH-136975: Emend a spelling error (algorthm -> algorithm) (#136999)

3 months agoFix code example in `annotationlib` documentation (#136972)
Victorien [Tue, 22 Jul 2025 13:48:02 +0000 (15:48 +0200)] 
Fix code example in `annotationlib` documentation (#136972)

3 months agoRevert "gh-112068: C API: Add support of nullable arguments in PyArg_Parse (GH-121303...
Serhiy Storchaka [Tue, 22 Jul 2025 13:39:50 +0000 (16:39 +0300)] 
Revert "gh-112068: C API: Add support of nullable arguments in PyArg_Parse (GH-121303)" (#136991)

3 months agogh-136437: Convert more ``os.path`` functions to positional-only in the docs (#136970)
sobolevn [Tue, 22 Jul 2025 13:38:33 +0000 (16:38 +0300)] 
gh-136437: Convert more ``os.path`` functions to positional-only in the docs (#136970)

3 months agogh-124621: Emscripten: Fix __syscall_ioctl patch (GH-136993)
Hood Chatham [Tue, 22 Jul 2025 13:05:26 +0000 (15:05 +0200)] 
gh-124621: Emscripten: Fix __syscall_ioctl patch (GH-136993)

If there is an error, we have to return `-errno` not positive errno.
Included in backport of GH-136931: #136988

3 months agogh-133742: Fix test_sysconfig and test_build_details for relocated directories (...
Pablo Galindo Salgado [Tue, 22 Jul 2025 11:53:05 +0000 (13:53 +0200)] 
gh-133742: Fix test_sysconfig and test_build_details for relocated directories (#136987)

3 months agogh-118350: Fix support of elements "textarea" and "title" in HTMLParser (#135310)
Timon Viola [Tue, 22 Jul 2025 11:27:13 +0000 (13:27 +0200)] 
gh-118350: Fix support of elements "textarea" and "title" in HTMLParser (#135310)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
3 months agogh-124621: Emscripten: Support pyrepl in browser (GH-136931)
Hood Chatham [Tue, 22 Jul 2025 10:13:38 +0000 (12:13 +0200)] 
gh-124621: Emscripten: Support pyrepl in browser (GH-136931)

Basic support for pyrepl in Emscripten. Limitations:
* requires JSPI
* no signal handling implemented

As followup work, it would be nice to implement a webworker variant
for when JSPI is not available and proper signal handling.

Because it requires JSPI, it doesn't work in Safari. Firefox requires
setting an experimental flag. All the Chromiums have full support since
May. Until we make it work without JSPI, let's keep the original web_example
around.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Éric <merwok@netwok.org>
3 months agogh-132661: Document t-strings and `templatelib` (#135229)
Dave Peck [Tue, 22 Jul 2025 09:44:13 +0000 (02:44 -0700)] 
gh-132661: Document t-strings and `templatelib` (#135229)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Loïc Simon <loic.pano@gmail.com>
Co-authored-by: pauleveritt <pauleveritt@me.com>
3 months agoFix 3 typos in "Next" News items (#136892)
Cornelius Roemer [Tue, 22 Jul 2025 08:22:08 +0000 (10:22 +0200)] 
Fix 3 typos in "Next" News items (#136892)

3 months agogh-131531: Android test fixes (#136845)
Malcolm Smith [Tue, 22 Jul 2025 06:51:16 +0000 (07:51 +0100)] 
gh-131531: Android test fixes (#136845)

Modifies the test runner script to no longer export the the HOST environment
variable, and to allow for tests that produce no Python output (output from the
Android console is still expected and required). These changes stem from
knowledge gained during developing a PR for Android support in cibuildwheel.

3 months agogh-135228: When @dataclass(slots=True) replaces a dataclass, make the original class...
Jelle Zijlstra [Tue, 22 Jul 2025 04:43:34 +0000 (21:43 -0700)] 
gh-135228: When @dataclass(slots=True) replaces a dataclass, make the original class collectible (#136893)

An interesting hack, but more localized in scope than #135230.

This may be a breaking change if people intentionally keep the original class around
when using `@dataclass(slots=True)`, and then use `__dict__` or `__weakref__` on the
original class.

Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
3 months agogh-133600: Move config.site-wasm32-emscripten into the emscripten folder (#136934)
Hood Chatham [Mon, 21 Jul 2025 23:58:31 +0000 (01:58 +0200)] 
gh-133600: Move config.site-wasm32-emscripten into the emscripten folder (#136934)

Reorganises the large Emscripten-specific file into the Emscripten folder.

3 months agogh-136170: Revert adding `ZipFile.data_offset` (GH-136950)
Emma Smith [Mon, 21 Jul 2025 23:16:30 +0000 (16:16 -0700)] 
gh-136170: Revert adding `ZipFile.data_offset` (GH-136950)

* Revert "gh-84481: Make ZipFile.data_offset more robust (#132178)"

This reverts commit 6cd1d6c6b142697fb72f422b7b448c27ebc30534.

* Revert "gh-84481: Add ZipFile.data_offset attribute (#132165)"

This reverts commit 0788948dcb980c7648b29ca363390b696d7f188f.

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org>
3 months agogh-133296: Publicly expose critical section API that accepts PyMutex (gh-135899)
Nathan Goldbaum [Mon, 21 Jul 2025 21:25:43 +0000 (15:25 -0600)] 
gh-133296: Publicly expose critical section API that accepts PyMutex (gh-135899)

This makes the following APIs public:

* `Py_BEGIN_CRITICAL_SECTION_MUTEX(mutex),`
* `Py_BEGIN_CRITICAL_SECTION2_MUTEX(mutex1, mutex2)`
* `void PyCriticalSection_BeginMutex(PyCriticalSection *c, PyMutex *mutex)`
* `void PyCriticalSection2_BeginMutex(PyCriticalSection2 *c, PyMutex *mutex1, PyMutex *mutex2)`

The macros are identical to the corresponding `Py_BEGIN_CRITICAL_SECTION` and
`Py_BEGIN_CRITICAL_SECTION2` macros (e.g., they include braces), but they
accept a `PyMutex` instead of an object.

The new macros are still paired with the existing END macros
(`Py_END_CRITICAL_SECTION`, `Py_END_CRITICAL_SECTION2`).

3 months agogh-136870: fix data race in `PyThreadState_Clear` on `sys_tracing_threads` (#136951)
Kumar Aditya [Mon, 21 Jul 2025 20:35:25 +0000 (02:05 +0530)] 
gh-136870: fix data race in `PyThreadState_Clear` on `sys_tracing_threads` (#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.

3 months agogh-136437: Document `os.path.dirname` as accepting only pos-only (#136946)
sobolevn [Mon, 21 Jul 2025 18:22:58 +0000 (21:22 +0300)] 
gh-136437: Document `os.path.dirname` as accepting only pos-only (#136946)

3 months agogh-136437: Document some `os.path` functions as requiring pos-only (#136812)
sobolevn [Mon, 21 Jul 2025 18:01:43 +0000 (21:01 +0300)] 
gh-136437: Document some `os.path` functions as requiring pos-only (#136812)

3 months agogh-136421: Load `_datetime` static types during interpreter initialization (GH-136583)
Peter Bierma [Mon, 21 Jul 2025 17:47:26 +0000 (12:47 -0500)] 
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.

3 months agoGH-136874: `url2pathname()`: discard query and fragment components (#136875)
Barney Gale [Mon, 21 Jul 2025 17:33:20 +0000 (18:33 +0100)] 
GH-136874: `url2pathname()`: discard query and fragment components (#136875)

In `urllib.request.url2pathname()`, ignore any query or fragment components
in the given URL.

3 months agoPedantic rewording of why relative importing doesn't work in main modules (GH-136846)
Josh Cannon [Mon, 21 Jul 2025 16:30:17 +0000 (11:30 -0500)] 
Pedantic rewording of why relative importing doesn't work in main modules (GH-136846)

Pedantically reword the section about relative imports and main modules.

3 months agogh-116738: Make syslog module thread-safe (#136760)
Alper [Mon, 21 Jul 2025 16:24:42 +0000 (09:24 -0700)] 
gh-116738: Make syslog module thread-safe (#136760)

Make the setlogmask() function in the syslog module thread-safe. These changes are relevant for scenarios where the GIL is disabled or when using subinterpreters.

3 months agogh-136859: Improve `StrEnum` docs (GH-136864)
Nacho Caballero [Mon, 21 Jul 2025 15:18:40 +0000 (17:18 +0200)] 
gh-136859: Improve `StrEnum` docs (GH-136864)

Co-authored-by: Nacho Caballero <nacho.caballero@astrazeneca.com>
Co-authored-by: Antonio Spadaro <ilovelinux@users.noreply.github.com>
3 months agogh-136438: Make sure `test_generated_cases` pass with all optimization levels (#136594)
Mikhail Efimov [Mon, 21 Jul 2025 12:25:25 +0000 (15:25 +0300)] 
gh-136438: Make sure `test_generated_cases` pass with all optimization levels (#136594)

Fix the `test_generated_cases` to work with `-O` or `-OO` flags.
Previously, `test_generated_cases` was catching an `AssertionError` while `Tools/cases_generator/optimizer_generator.py` used an `assert` statement.  This approach semantically incorrect, no one should trying to catch an `AssertionError`!
Now the `assert` statement has been replaced with an explicit `raise ValueError(...)` and the corresponding `self.assertRaisesRegex(AssertionError, ...)` has been updated to catch a `ValueError` instead.

3 months agogh-121028: Soft-deprecate sys.api_version (GH-136463)
Petr Viktorin [Mon, 21 Jul 2025 12:22:48 +0000 (14:22 +0200)] 
gh-121028: Soft-deprecate sys.api_version (GH-136463)

3 months agogh-135621: Simplify TermInfo (GH-136916)
Petr Viktorin [Mon, 21 Jul 2025 11:06:42 +0000 (13:06 +0200)] 
gh-135621: Simplify TermInfo (GH-136916)

3 months agogh-135661: Fix parsing attributes with whitespaces around the "=" separator in HTMLPa...
Serhiy Storchaka [Mon, 21 Jul 2025 10:07:15 +0000 (13:07 +0300)] 
gh-135661: Fix parsing attributes with whitespaces around the "=" separator in HTMLParser (GH-136908)

This fixes a regression introduced in GH-135930.

3 months agogh-135621: Remove dependency on curses from PyREPL (GH-136758)
Łukasz Langa [Mon, 21 Jul 2025 09:57:34 +0000 (11:57 +0200)] 
gh-135621: Remove dependency on curses from PyREPL (GH-136758)

3 months agogh-136251: Improvements to WASM demo REPL (GH-136252)
adam j hartz [Mon, 21 Jul 2025 09:56:45 +0000 (05:56 -0400)] 
gh-136251: Improvements to WASM demo REPL (GH-136252)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
3 months agogh-136852: Emscripten: Fix bug in #136853 (#136909)
Hood Chatham [Mon, 21 Jul 2025 09:17:36 +0000 (11:17 +0200)] 
gh-136852: Emscripten: Fix bug in #136853 (#136909)

We need to get rid of some whitespace to make this work.

3 months agogh-134411: assert `PyLong_FromLong(x) != NULL` when `x` is known to be small (#134415)
Sergey Muraviov [Mon, 21 Jul 2025 08:59:06 +0000 (11:59 +0300)] 
gh-134411: assert `PyLong_FromLong(x) != NULL` when `x` is known to be small (#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

3 months agogh-136882: Update stale link in the basic logging tutorial. (#136885)
Vinay Sajip [Mon, 21 Jul 2025 08:29:12 +0000 (09:29 +0100)] 
gh-136882: Update stale link in the basic logging tutorial. (#136885)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
3 months agogh-136428: amend UUIDv8 performance improvements (#136903)
Bénédikt Tran [Mon, 21 Jul 2025 08:23:16 +0000 (10:23 +0200)] 
gh-136428: amend UUIDv8 performance improvements (#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.

3 months agogh-132661: Disallow `Template`/`str` concatenation after PEP 750 spec update (#135996)
Dave Peck [Mon, 21 Jul 2025 06:44:26 +0000 (23:44 -0700)] 
gh-132661: Disallow `Template`/`str` concatenation after PEP 750 spec update (#135996)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
3 months agogh-136470: Correct InterpreterPoolExecutor's default thread name (GH-136472)
AN Long [Sun, 20 Jul 2025 23:34:32 +0000 (08:34 +0900)] 
gh-136470: Correct InterpreterPoolExecutor's default thread name (GH-136472)

The OS thread name is now correctly prefixed with `InterpreterPoolExecutor` instead of `ThreadPoolExecutor`.

3 months agogh-136852: Emscripten: Add PYTHON_NODE_VERSION environment variable (#136853)
Hood Chatham [Sun, 20 Jul 2025 22:30:35 +0000 (00:30 +0200)] 
gh-136852: Emscripten: Add PYTHON_NODE_VERSION environment variable (#136853)

To choose the node version we use. Together with:
https://github.com/python/buildmaster-config/pull/614
closes #136852.

3 months agoGH-130645: Default to color help in argparse (#136809)
Pablo Galindo Salgado [Sun, 20 Jul 2025 21:55:44 +0000 (23:55 +0200)] 
GH-130645: Default to color help in argparse (#136809)

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>
3 months agoGH-111758: Merge TSan and UBSan reusable GHA workflows (#136820)
🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) [Sun, 20 Jul 2025 20:03:46 +0000 (22:03 +0200)] 
GH-111758: Merge TSan and UBSan reusable GHA workflows (#136820)

Co-authored-by: Sviatoslav Sydorenko <webknjaz@redhat.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
3 months agogh-136492: Add `FrameLocalsProxyType` to `types` (GH-136546)
Peter Bierma [Sun, 20 Jul 2025 18:49:00 +0000 (20:49 +0200)] 
gh-136492: Add `FrameLocalsProxyType` to `types` (GH-136546)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
3 months agogh-91349: Adjust default compression level to 6 (down from 9) in gzip and tarfile...
morotti [Sun, 20 Jul 2025 16:43:40 +0000 (17:43 +0100)] 
gh-91349: Adjust default compression level to 6 (down from 9) in gzip and tarfile (GH-131470)

gh-91349: Adjust default compression level to 6 (down from 9) in gzip and tarfile

It is the default level used by most compression tools and a
better tradeoff between speed and performance.

Co-authored-by: rmorotti <romain.morotti@man.com>
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
3 months agogh-131724: Add a new max_response_headers param to HTTP/HTTPSConnection (GH-136814)
Alexander Urieles [Sun, 20 Jul 2025 13:53:54 +0000 (15:53 +0200)] 
gh-131724: Add a new max_response_headers param to HTTP/HTTPSConnection (GH-136814)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
3 months agogh-127598: Improve ModuleNotFoundError when -S is passed (GH-136821)
MonadChains [Sun, 20 Jul 2025 13:33:58 +0000 (14:33 +0100)] 
gh-127598: Improve ModuleNotFoundError when -S is passed (GH-136821)

3 months agogh-134531: prefer using `_hashlib` module state instead of module object (#136865)
Bénédikt Tran [Sun, 20 Jul 2025 13:10:36 +0000 (15:10 +0200)] 
gh-134531: prefer using `_hashlib` module state instead of module object (#136865)

Some internal helper functions taking the module object to retrieve its state
under some conditions now directly take the module's state instead as those
conditions hold most of the time.

3 months agogh-136547: fix `hashlib_helper` for blocking and requesting digests (#136762)
Bénédikt Tran [Sun, 20 Jul 2025 12:32:35 +0000 (14:32 +0200)] 
gh-136547: fix `hashlib_helper` for blocking and requesting digests (#136762)

- Fix `hashlib_helper.block_algorithm` where the dummy functions were incorrectly defined.
- Rename `hashlib_helper.HashAPI` to `hashlib_helper.HashInfo` and add more helper methods.
- Simplify `hashlib_helper.requires_*()` functions.
- Rewrite some private helpers in `hashlib_helper`.
- Remove `find_{builtin,openssl}_hashdigest_constructor()` as they are no more needed and were
  not meant to be public in the first place.
- Fix some tests in `test_hashlib` when FIPS mode is on.

3 months agogh-86608: Improve and restructure tarfile examples (#121771)
Dominic H. [Sun, 20 Jul 2025 12:19:47 +0000 (14:19 +0200)] 
gh-86608: Improve and restructure tarfile examples (#121771)

Add an example on how to write a tarfile to stdout; general improvements.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
3 months agogh-130655: gettext: Add fallback testcase (#136857)
Dominic H. [Sun, 20 Jul 2025 12:08:13 +0000 (14:08 +0200)] 
gh-130655: gettext: Add fallback testcase (#136857)

3 months agogh-136854: Exit on error in `make venv` (#136856)
Nacho Caballero [Sun, 20 Jul 2025 12:08:00 +0000 (14:08 +0200)] 
gh-136854: Exit on error in `make venv` (#136856)

Co-authored-by: Nacho Caballero <nacho.caballero@astrazeneca.com>
3 months agogh-108362: Retarget incremental GC changes to 3.14 (#125453)
Hugo van Kemenade [Sun, 20 Jul 2025 09:56:55 +0000 (12:56 +0300)] 
gh-108362: Retarget incremental GC changes to 3.14 (#125453)

3 months agogh-136438: Make sure `test_remote_pdb` pass with all optimization levels (GH-136788)
Olga Pustovalova [Sun, 20 Jul 2025 08:57:54 +0000 (10:57 +0200)] 
gh-136438: Make sure `test_remote_pdb` pass with all optimization levels (GH-136788)

3 months agogh-136787: improve exception messages for invalid hash algorithms (#136802)
Bénédikt Tran [Sun, 20 Jul 2025 08:49:34 +0000 (10:49 +0200)] 
gh-136787: improve exception messages for invalid hash algorithms (#136802)

3 months agogh-124621: Emscripten: Fix regression in use-after-close error handling (#136837)
Hood Chatham [Sat, 19 Jul 2025 19:43:50 +0000 (21:43 +0200)] 
gh-124621: Emscripten: Fix regression in use-after-close error handling (#136837)

3 months agogh-136839: Refactor simple dict.update calls (#136811)
Disconnect3d [Sat, 19 Jul 2025 17:12:10 +0000 (19:12 +0200)] 
gh-136839: Refactor simple dict.update calls (#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})
```

3 months agogh-133875: Remove deprecated `pathlib.PurePath.is_reserved` (#133876)
sobolevn [Sat, 19 Jul 2025 17:07:46 +0000 (20:07 +0300)] 
gh-133875: Remove deprecated `pathlib.PurePath.is_reserved` (#133876)

3 months agogh-124621: Emscripten: Add support for async input devices (GH-136822)
Hood Chatham [Sat, 19 Jul 2025 15:14:29 +0000 (17:14 +0200)] 
gh-124621: Emscripten: Add support for async input devices (GH-136822)

This is useful for implementing proper `input()`. It requires the
JavaScript engine to support the wasm JSPI spec which is now stage 4.
It is supported on Chrome since version 137 and on Firefox and node
behind a flag.

We override the `__wasi_fd_read()` syscall with our own variant that
checks for a readAsync operation. If it has it, we use our own async
variant of `fd_read()`, otherwise we use the original `fd_read()`.
We also add a variant of `FS.createDevice()` called
`FS.createAsyncInputDevice()`.

Finally, if JSPI is available, we wrap the `main()` symbol with
`WebAssembly.promising()` so that we can stack switch from `fd_read()`.
If JSPI is not available, attempting to read from an AsyncInputDevice
will raise an `OSError`.

3 months agogh-136793: Update the sampling rate in the documentation (#136829)
Slavaqq [Sat, 19 Jul 2025 15:00:46 +0000 (17:00 +0200)] 
gh-136793: Update the sampling rate in the documentation (#136829)

3 months agogh-136752: Clarify documentation for ``IPv{N}Address.is_reserved`` (#136794)
Matthieu Lienart [Sat, 19 Jul 2025 14:43:56 +0000 (16:43 +0200)] 
gh-136752: Clarify documentation for ``IPv{N}Address.is_reserved`` (#136794)

Co-authored-by: Matthieu Lienart <matthieu.lienart@axians.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
3 months agogh-135468: Improve ``BaseHandler.http_error_default()`` parameter descriptions (...
Valerio Gianella [Sat, 19 Jul 2025 14:43:00 +0000 (16:43 +0200)] 
gh-135468: Improve ``BaseHandler.http_error_default()`` parameter descriptions (#136797)

Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
3 months agogh-54732: Make argparse error caused by empty rows in option files explicit (#136795)
jdunter [Sat, 19 Jul 2025 14:08:19 +0000 (16:08 +0200)] 
gh-54732: Make argparse error caused by empty rows in option files explicit (#136795)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
3 months agogh-136801: Fix PyREPL syntax highlightning on match cases after multi-line case ...
Olga Matoula [Sat, 19 Jul 2025 13:15:49 +0000 (14:15 +0100)] 
gh-136801: Fix PyREPL syntax highlightning on match cases after multi-line case (GH-136804)

3 months agogh-136764: improve comment in enum.verify.__call__ (GH-136774)
Saurav Singh [Sat, 19 Jul 2025 12:55:02 +0000 (14:55 +0200)] 
gh-136764: improve comment in enum.verify.__call__ (GH-136774)

3 months agogh-135730: Clarify multiprocessing.Queue close() documentation (#136803)
aggshruti99 [Sat, 19 Jul 2025 12:24:39 +0000 (13:24 +0100)] 
gh-135730: Clarify multiprocessing.Queue close() documentation (#136803)

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

---------

Co-authored-by: saggarwal145 <saggarwal145@bloomberg.net>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
3 months agoDoc/c-api/memory.rst: extend --without-pymalloc doc with ASan information (GH-136790)
Disconnect3d [Sat, 19 Jul 2025 11:52:54 +0000 (13:52 +0200)] 
Doc/c-api/memory.rst: extend --without-pymalloc doc with ASan information (GH-136790)

* Doc/c-api/memory.rst: extend --without-pymalloc doc with ASan information

This commit extends 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.

This code can be seen here:
https://github.com/python/cpython/blob/acefb978dcb5dd554e3c49a3015ee5c2ad6bfda1/Objects/obmalloc.c#L2096-L2110

While the annotation macro is defined here:
https://github.com/python/cpython/blob/acefb978dcb5dd554e3c49a3015ee5c2ad6bfda1/Include/pyport.h#L582-L598

And the corresponding attribute is documented in:
* for gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-no_005fsanitize_005faddress-function-attribute
* for clang: https://clang.llvm.org/docs/AttributeReference.html#no-sanitize-address-no-address-safety-analysis

* Update Doc/c-api/memory.rst

* Improve --with-address-sanitizer and pymalloc docs

---------

Co-authored-by: Petr Viktorin <encukou@gmail.com>
3 months agogh-122450: Indicate that `Fraction` denominators are always positive (#136789)
nacind [Sat, 19 Jul 2025 11:26:50 +0000 (13:26 +0200)] 
gh-122450: Indicate that `Fraction` denominators are always positive (#136789)

3 months agogh-136769: Include fixed-width integers in the fundamental data types table (#136784)
Sina Zel taat [Sat, 19 Jul 2025 10:19:41 +0000 (12:19 +0200)] 
gh-136769: Include fixed-width integers in the fundamental data types table (#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``.

3 months agogh-74598: document that `fnmatch.filterfalse` is affected by cache limitation (#136781)
Gergely Elias [Sat, 19 Jul 2025 09:51:11 +0000 (11:51 +0200)] 
gh-74598: document that `fnmatch.filterfalse` is affected by cache limitation (#136781)

3 months agoDocs: Improve example for ``itertools.batched()`` (#136775)
RafaelWO [Sat, 19 Jul 2025 09:29:44 +0000 (11:29 +0200)] 
Docs: Improve example for ``itertools.batched()`` (#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`

3 months agoFix typo in `Lib/test/test_ast/test_ast.py` (#136767)
Hunter Hogan [Sat, 19 Jul 2025 09:14:49 +0000 (04:14 -0500)] 
Fix typo in `Lib/test/test_ast/test_ast.py` (#136767)

`ASTOptimiziationTests` -> `ASTOptimizationTests`

3 months agoparser_generator.py typo - keywods -> keywords (#135014)
chemelnucfin [Sat, 19 Jul 2025 08:54:20 +0000 (01:54 -0700)] 
parser_generator.py typo - keywods -> keywords (#135014)

3 months agoFix typo: "occured" =>"occurred" (#134928)
Roman [Sat, 19 Jul 2025 08:48:04 +0000 (09:48 +0100)] 
Fix typo: "occured" =>"occurred" (#134928)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
3 months agogh-136438: Make sure `test_ast` pass with all optimization levels (#136596)
Mikhail Efimov [Fri, 18 Jul 2025 16:07:46 +0000 (19:07 +0300)] 
gh-136438: Make sure `test_ast` pass with all optimization levels (#136596)

Explicitly pass an `optimizer` parameter to the calls of `ast.parse/compile`, because if it is not provided, the interpreter will use its internal state, which can be modified using the `-O` or `-OO` flags.

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
3 months agogh-136697: Use the standard audit event format for sys.monitoring docs (#136747)
Tian Gao [Thu, 17 Jul 2025 18:10:10 +0000 (11:10 -0700)] 
gh-136697: Use the standard audit event format for sys.monitoring docs (#136747)

3 months agogh-116738: Make pwd module thread-safe (#136695)
Alper [Thu, 17 Jul 2025 16:16:01 +0000 (09:16 -0700)] 
gh-116738: Make pwd module thread-safe (#136695)

Make the pwd module functions getpwuid(), getpwnam(), and getpwall() thread-safe. These changes apply to scenarios where the GIL is disabled or in subinterpreter use cases.

3 months agogh-127146: Emscripten: Set umask to zero in python.sh (#136740)
Hood Chatham [Thu, 17 Jul 2025 15:39:01 +0000 (17:39 +0200)] 
gh-127146: Emscripten: Set umask to zero in python.sh (#136740)

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.

3 months agofix traceback.FrameSummary docstring by adding end_lineno, colno, and end_colno ...
Ole Herman Schumacher Elgesem [Wed, 16 Jul 2025 17:29:30 +0000 (19:29 +0200)] 
fix traceback.FrameSummary docstring by adding end_lineno, colno, and end_colno (#136716)

3 months agogh-136669: build `_asyncio` as static module (#136670)
Kumar Aditya [Wed, 16 Jul 2025 16:39:08 +0000 (22:09 +0530)] 
gh-136669: build `_asyncio` as static module (#136670)

`_asyncio` is now built as a static module so that thread states can be accessed directly via registers and avoids the overhead of function call.

3 months agogh-126548: Add a thread-unsafety warning for `importlib.reload()` (GH-136704)
Bartosz Sławecki [Wed, 16 Jul 2025 16:34:14 +0000 (18:34 +0200)] 
gh-126548: Add a thread-unsafety warning for `importlib.reload()` (GH-136704)

3 months agogh-127146: Emscripten: Don't need to avoid unpaired surrogate anymore (#136707)
Hood Chatham [Wed, 16 Jul 2025 15:53:47 +0000 (17:53 +0200)] 
gh-127146: Emscripten: Don't need to avoid unpaired surrogate anymore (#136707)

This might have been fixed by gh-136624, or by some Emscripten change.
In any case, it no longer seems to be needed.

3 months agogh-136710: Fix bad indentation in `os.chdir` docstring (GH-136709)
Harmen Stoppels [Wed, 16 Jul 2025 15:30:10 +0000 (17:30 +0200)] 
gh-136710: Fix bad indentation in `os.chdir` docstring (GH-136709)

3 months agoAdd `.gram` file to the `.editorconfig` (#136680)
sobolevn [Wed, 16 Jul 2025 14:35:15 +0000 (17:35 +0300)] 
Add `.gram` file to the `.editorconfig` (#136680)

3 months agogh-127146: Emscripten: more regular stack overflow skips (#136708)
Hood Chatham [Wed, 16 Jul 2025 14:02:25 +0000 (16:02 +0200)] 
gh-127146: Emscripten: more regular stack overflow skips (#136708)

Makes the Emscripten stack overflow skip message consistent with WASI,
and replaces some ad-hoc skips.

3 months agogh-127146: Emscripten: Make os.umask() actually work (#136706)
Hood Chatham [Wed, 16 Jul 2025 13:33:15 +0000 (15:33 +0200)] 
gh-127146: Emscripten: Make os.umask() actually work (#136706)

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.

3 months agoImproved venv docs to indicate that isolation is the default. (#136698)
Facundo Batista [Wed, 16 Jul 2025 11:55:31 +0000 (08:55 -0300)] 
Improved venv docs to indicate that isolation is the default. (#136698)

* Improved venv docs to note that isolation is the default.

* Insert "that" so that a sentence reads better.

* Improved wording.

---------

Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
3 months agogh-135148: Correctly handle f/t strings with comments and debug expressions (#135198)
Pablo Galindo Salgado [Wed, 16 Jul 2025 09:47:13 +0000 (11:47 +0200)] 
gh-135148: Correctly handle f/t strings with comments and debug expressions (#135198)

3 months agofix grammar typo in `logging.rst` (#136584)
William Andrea [Wed, 16 Jul 2025 07:01:26 +0000 (04:01 -0300)] 
fix grammar typo in `logging.rst` (#136584)

3 months agogh-127146: Report uid in Emscripten + node as native uid (#136509)
Hood Chatham [Wed, 16 Jul 2025 04:17:16 +0000 (06:17 +0200)] 
gh-127146: Report uid in Emscripten + node as native uid (#136509)

Corrects the handling of getuid on emscripten, which was consistently reporting as 0.

3 months agoFix the doctest.testmod() docstring (GH-136675)
Serhiy Storchaka [Tue, 15 Jul 2025 16:42:02 +0000 (19:42 +0300)] 
Fix the doctest.testmod() docstring (GH-136675)

__test__ = None is not supported since Python 2.4.

3 months agoFix index entry and anchor for module.__test__ (GH-136674)
Serhiy Storchaka [Tue, 15 Jul 2025 15:52:51 +0000 (18:52 +0300)] 
Fix index entry and anchor for module.__test__ (GH-136674)

It was "doctest.module attribute". Now it is "module attribute".

3 months agogh-135909: Assert incoming `refcnt != 0` for the free threaded GC (GH-136009)
andrewreds [Tue, 15 Jul 2025 15:26:16 +0000 (01:26 +1000)] 
gh-135909: Assert incoming `refcnt != 0` for the free threaded GC (GH-136009)

This helps catch double deallocation bugs and is similar to the
assertion in the GIL-enabled build.  The call to `validate_refcounts`
is moved up to start of the GC because `queue_untracked_obj_decref()`
creates it own zero reference count garbage.

3 months agogh-72327: Suggest using system terminal for pip install in PyREPL (#136328)
Richard Si [Tue, 15 Jul 2025 14:25:07 +0000 (10:25 -0400)] 
gh-72327: Suggest using system terminal for pip install in PyREPL (#136328)

Users new to Python packaging often try to use pip from the REPL only to
be met with a confusing SyntaxError. If this happens, guide the user to
use a system terminal instead to invoke pip.

Closes #72327

---------

Co-authored-by: Tom Viner <tom@viner.tv>
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
3 months agogh-111968: remove redundant fetching of interpreter state in `dict` implementation...
Kumar Aditya [Tue, 15 Jul 2025 13:45:11 +0000 (19:15 +0530)] 
gh-111968: remove redundant fetching of interpreter state in `dict` implementation  (#136673)

3 months agogh-136682: Remove incorrect statement that `os.path.samestat` accepts file-like objec...
Ran Benita [Tue, 15 Jul 2025 12:49:11 +0000 (15:49 +0300)] 
gh-136682: Remove incorrect statement that `os.path.samestat` accepts file-like objects (#136683)

3 months agogh-136155: Docs: check for EPUB fatal errors in CI (#134074)
Maciej Olko [Tue, 15 Jul 2025 12:26:24 +0000 (14:26 +0200)] 
gh-136155: Docs: check for EPUB fatal errors in CI (#134074)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
3 months agogh-72570: mention the incompatibility of XOFs with HMAC (#136676)
Bénédikt Tran [Tue, 15 Jul 2025 12:03:21 +0000 (14:03 +0200)] 
gh-72570: mention the incompatibility of XOFs with HMAC (#136676)

3 months agoGH-132661: Add ``string.templatelib.convert()`` (#135217)
Adam Turner [Tue, 15 Jul 2025 09:56:42 +0000 (10:56 +0100)] 
GH-132661: Add ``string.templatelib.convert()`` (#135217)

3 months agoGH-133711: Enable UTF-8 mode by default (PEP 686) (#133712)
Adam Turner [Tue, 15 Jul 2025 09:45:41 +0000 (10:45 +0100)] 
GH-133711: Enable UTF-8 mode by default (PEP 686) (#133712)

Co-authored-by: Victor Stinner <vstinner@python.org>
3 months agogh-131189: Fix "msvcrt" import warning on Linux when "_ctypes" is not available....
Dzmitry Plashchynski [Tue, 15 Jul 2025 07:44:31 +0000 (10:44 +0300)] 
gh-131189: Fix "msvcrt" import warning on Linux when "_ctypes" is not available. (GH-131201)

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.

3 months agogh-136663: fix signatures of PyFloat_Pack/Unpack in docs (#136664)
Sergey B Kirpichev [Tue, 15 Jul 2025 05:30:12 +0000 (08:30 +0300)] 
gh-136663: fix signatures of PyFloat_Pack/Unpack in docs (#136664)