]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
14 min agogh-154791: Fix asyncio.Future losing traceback on repeated result() call (#154798) main
Iaroslav [Fri, 31 Jul 2026 13:06:47 +0000 (18:06 +0500)] 
gh-154791: Fix asyncio.Future losing traceback on repeated result() call (#154798)

105 min agogh-154726: Fix `shutil.copyfile()` for symlinks to special files with `follow_symlink...
Łukasz [Fri, 31 Jul 2026 11:36:05 +0000 (13:36 +0200)] 
gh-154726: Fix `shutil.copyfile()` for symlinks to special files with `follow_symlinks=False` (GH-154728)

2 hours agogh-154738: Propagate reparse-deferral setting to pyexpat subparsers (GH-154739)
tonghuaroot (童话) [Fri, 31 Jul 2026 10:58:59 +0000 (18:58 +0800)] 
gh-154738: Propagate reparse-deferral setting to pyexpat subparsers (GH-154739)

2 hours agogh-154863: Fix iconv encoding of ISO-2022-CN-EXT returning empty bytes (GH-154899)
Vyron Vasileiadis [Fri, 31 Jul 2026 10:56:52 +0000 (13:56 +0300)] 
gh-154863: Fix iconv encoding of ISO-2022-CN-EXT returning empty bytes (GH-154899)

The flush that emits the pending shift sequence can report a nonreversible
conversion, which the loop mistook for a substituted character. It then
retried while still flushing, converted nothing and returned the empty
output buffer.

4 hours agogh-154848: Enforce frame boundaries in the C unpickler (GH-154893)
Serhiy Storchaka [Fri, 31 Jul 2026 09:04:30 +0000 (12:04 +0300)] 
gh-154848: Enforce frame boundaries in the C unpickler (GH-154893)

The C unpickler did not enforce PEP 3154 frame boundaries: an opcode or its
argument could straddle a frame, and a new frame could begin before the
previous one ended.  Such reads now raise UnpicklingError, as in the pure
Python implementation.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
4 hours agogh-154936: Fix JSON control character error position (GH-154941)
yangbaechu [Fri, 31 Jul 2026 08:57:00 +0000 (17:57 +0900)] 
gh-154936: Fix JSON control character error position (GH-154941)

Report the index of the invalid literal control character instead of
the following index in the pure Python decoder.

11 hours agogh-152075: Avoid lock contention in _Py_Specialize_LoadGlobal under free threading...
Peter Hawkins [Fri, 31 Jul 2026 01:28:20 +0000 (18:28 -0700)] 
gh-152075: Avoid lock contention in _Py_Specialize_LoadGlobal under free threading (gh-153720)

Under high thread concurrency in free-threaded builds, `_Py_Specialize_LoadGlobal` suffers from lock contention when acquiring the critical section mutexes for the `globals` and `builtins` dictionaries during bytecode specialization.

This PR skips LOAD_GLOBAL bytecode specialization if acquiring the two object mutexes would block.

14 hours agogh-154746: Document `collections.Counter` internal order and display order (#154777)
Raymond Hettinger [Thu, 30 Jul 2026 22:39:09 +0000 (17:39 -0500)] 
gh-154746: Document `collections.Counter` internal order and display order (#154777)

16 hours agogh-94543: Improve tempfile.mkstemp documentation about cleanup (#154748)
Stephen Rosen [Thu, 30 Jul 2026 20:42:32 +0000 (15:42 -0500)] 
gh-94543: Improve tempfile.mkstemp documentation about cleanup (#154748)

Co-authored-by: picnic-sven <88426829+picnic-sven@users.noreply.github.com>
17 hours agoSome tidying for GitHub Actions (#154950)
Stefano Rivera [Thu, 30 Jul 2026 20:06:34 +0000 (13:06 -0700)] 
Some tidying for GitHub Actions (#154950)

17 hours agogh-135828: Disable syntax highlighting in Using Python on macOS (#150074)
Taeknology [Thu, 30 Jul 2026 19:56:28 +0000 (04:56 +0900)] 
gh-135828: Disable syntax highlighting in Using Python on macOS (#150074)

17 hours agoCODEOWNERS: Remove everyone from `removed-ids.txt` (#154886)
Hugo van Kemenade [Thu, 30 Jul 2026 19:55:38 +0000 (22:55 +0300)] 
CODEOWNERS: Remove everyone from `removed-ids.txt` (#154886)

17 hours agogh-154874: Fix the sign of curses.termattrs() (GH-154875)
Vyron Vasileiadis [Thu, 30 Jul 2026 19:50:03 +0000 (22:50 +0300)] 
gh-154874: Fix the sign of curses.termattrs() (GH-154875)

termattrs() returns a chtype mask, but it was routed through an int, so a
terminal that advertises A_ITALIC came back negative and the result could
no longer be passed to the attribute functions.

17 hours agoUpdate bytecode magic number for the 3.15 release candidate (#154881)
Hugo van Kemenade [Thu, 30 Jul 2026 19:48:17 +0000 (22:48 +0300)] 
Update bytecode magic number for the 3.15 release candidate (#154881)

18 hours agogh-151942: Fix all Sphinx nitpicks in the Python 2.6 What's New (#154550)
Stan Ulbrych [Thu, 30 Jul 2026 19:17:49 +0000 (21:17 +0200)] 
gh-151942: Fix all Sphinx nitpicks in the Python 2.6 What's New (#154550)

19 hours agogh-154934: Remove ncurses assumptions from curses and its tests (GH-154940)
Serhiy Storchaka [Thu, 30 Jul 2026 18:12:29 +0000 (21:12 +0300)] 
gh-154934: Remove ncurses assumptions from curses and its tests (GH-154940)

Parse the integer forms of addch() and friends as unsigned long long: the
width of a chtype is up to the library.

Expose _curses._wide_character_support so that the tests can ask what a
cell holds instead of probing for a function.

Mask an integer keystroke in textpad as the byte it is, and keep the key
codes out of the printable range.

21 hours agoGH-148468: Accept string-like proxy objects in colorized argparse help (#154653)
Savannah Ostrowski [Thu, 30 Jul 2026 15:59:59 +0000 (08:59 -0700)] 
GH-148468: Accept string-like proxy objects in colorized argparse help (#154653)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
22 hours agogh-154037: Fix race in the hash(Decimal) (#154045)
Sergey B Kirpichev [Thu, 30 Jul 2026 15:02:59 +0000 (18:02 +0300)] 
gh-154037: Fix race in the hash(Decimal) (#154045)

22 hours agoImproved test coverage for codeop.py. (GH-154100)
vjabuilds [Thu, 30 Jul 2026 14:44:18 +0000 (16:44 +0200)] 
Improved test coverage for codeop.py. (GH-154100)

* Ported existing tests to cover both the CommandCompiler and Compile classes
* Added tests that cover the case when PyCF_ONLY_AST is set
* Added tests that cover the case when the compile method returns a code object with flags

Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
23 hours agogh-154587: Fix Windows buffer declaration in _cursesmodule (GH-154609)
Bhuvansh [Thu, 30 Jul 2026 14:15:05 +0000 (19:45 +0530)] 
gh-154587: Fix Windows buffer declaration in _cursesmodule (GH-154609)

24 hours agogh-151941: Fix Sphinx reference warnings in `Doc/c-api/` (GH-152044)
Aniket [Thu, 30 Jul 2026 12:48:38 +0000 (18:18 +0530)] 
gh-151941: Fix Sphinx reference warnings in `Doc/c-api/` (GH-152044)

25 hours agogh-151728: Clear the typing caches at interpreter shutdown (GH-154858)
Wenzel Jakob [Thu, 30 Jul 2026 12:00:08 +0000 (14:00 +0200)] 
gh-151728: Clear the typing caches at interpreter shutdown (GH-154858)

The typing module caches every subscripted type. When an extension module
leaks a reference to typing, these caches also keep types owned by other
(correct) extension modules alive past interpreter shutdown, where nothing
can free them anymore. The cache_clear callables are already collected in
typing._cleanups, so registering them with atexit is enough to avoid this.

34 hours agoMinor fixes for Android (#154895)
Malcolm Smith [Thu, 30 Jul 2026 02:31:40 +0000 (03:31 +0100)] 
Minor fixes for Android (#154895)

A collection of small cleanups for Android support:

* Clarifies the documentation around version number handling for iOS and
  Android in os.uname and platform.release
* Ensures that automated NDK installs surface messages written to stderr
* Makes the Android NDK check more robust for incomplete downloads
* Corrects some linting errors in Android build scripts

35 hours agoMake `os.get_terminal_size` check `isatty` before calling `ioctl` (#154885)
Malcolm Smith [Thu, 30 Jul 2026 02:04:46 +0000 (03:04 +0100)] 
Make `os.get_terminal_size` check `isatty` before calling `ioctl` (#154885)

Calling ioctl on stdout raises warnings on Android. Ensure we have a TTY
before doing terminal size calls.

40 hours agogh-135736: Fix interaction between TaskGroup and aclose() (#154649)
Michael J. Sullivan [Wed, 29 Jul 2026 21:08:45 +0000 (14:08 -0700)] 
gh-135736: Fix interaction between TaskGroup and aclose() (#154649)

Currently if you have a generator like:
```
async def test():
    async with asyncio.TaskGroup() as tg:
        async for x in whatever():
            yield x
```

If aclose() is called on the generator and GeneratorExit is raised,
the TaskGroup's __aexit__ will raise a BaseExceptionGroup, and that
will be raised from the aclose() call instead of it being swallowed.

Fix this by raising GeneratorExit from __aexit__ when:
1. The body of task group raised it
2. No subtasks raised exceptions

This makes GeneratorExit work without swallowing other exceptions
(like it would if we just added it to _is_base_error).

43 hours agogh-154836: Fix Popen.wait() with very large timeouts on the pidfd/kqueue wait paths...
Calvin Prewitt [Wed, 29 Jul 2026 17:45:41 +0000 (12:45 -0500)] 
gh-154836: Fix Popen.wait() with very large timeouts on the pidfd/kqueue wait paths (GH-154837)

The event-driven wait introduced by gh-83069 passes the caller's timeout
unclamped to poll() / kqueue.control(), so values that do not fit the C
timestamp conversion (float('inf'), sys.maxsize, 1e10, ...) raise
OverflowError on Linux and, on macOS/BSD, a misleading
"TypeError: timeout must be a real number or None" -- all of which
worked on 3.14 and earlier.

- Lib/subprocess.py: clamp each wait to _MAXIMUM_WAIT_TIMEOUT (24h,
  following asyncio's MAXIMUM_SELECT_TIMEOUT precedent) and loop until
  the real deadline in both _wait_pidfd() and _wait_kqueue().
- Modules/selectmodule.c: only rewrite the kqueue.control() timeout
  conversion failure into TypeError when the original exception IS a
  TypeError, exactly like the select()/poll()/devpoll()/epoll() sites,
  so OverflowError surfaces for out-of-range values.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
43 hours agogh-154709: Fix out-of-bounds access in dict reverse iterator (GH-154721)
Bhuvansh [Wed, 29 Jul 2026 17:26:45 +0000 (22:56 +0530)] 
gh-154709: Fix out-of-bounds access in dict reverse iterator (GH-154721)

44 hours agogh-151321: Fix incorrect opcode metadata flags for LOAD_DEREF opcode (GH-154778)
coroma01 [Wed, 29 Jul 2026 17:06:03 +0000 (18:06 +0100)] 
gh-151321: Fix incorrect opcode metadata flags for LOAD_DEREF opcode (GH-154778)

46 hours agogh-131565: Implement ctypes.util.dllist() in the _ctypes extension (GH-154255)
Serhiy Storchaka [Wed, 29 Jul 2026 14:47:52 +0000 (17:47 +0300)] 
gh-131565: Implement ctypes.util.dllist() in the _ctypes extension (GH-154255)

On NetBSD dl_iterate_phdr() reports only the link-map group of the calling
object.  Called through ctypes, the caller is libffi's closure trampoline,
which belongs to no object, so only the main executable was reported.
Calling dl_iterate_phdr() from the _ctypes extension module makes _ctypes
the caller and reports all loaded shared libraries.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
47 hours agogh-64192: Add *buffersize* to `imap()`/`imap_unordered()` in `multiprocessing.pool...
Oleksandr Baltian [Wed, 29 Jul 2026 13:56:07 +0000 (15:56 +0200)] 
gh-64192: Add *buffersize* to `imap()`/`imap_unordered()` in `multiprocessing.pool` (GH-136871)

The new argument allows consuming the input iterator lazily, potentially
saving memory, and allowing long/infinite iterators.

It mirrors the *buffersize* argument to `concurrent.futures.Executor.map`
that was added in 3.14.

Co-authored-by: Oleksandr Baltian <oleksandr.baltian@maklai.com.ua>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Sasha Baltian <sasha.baltian@hyperexponential.com>
2 days agogh-153531: fix thread safety of setting func.__doc__ and func.__module__ (#154851)
Kumar Aditya [Wed, 29 Jul 2026 06:35:11 +0000 (12:05 +0530)] 
gh-153531: fix thread safety of setting func.__doc__ and func.__module__ (#154851)

2 days agogh-154781: Fix garbage from curses window.in_wstr() (GH-154782)
Vyron Vasileiadis [Wed, 29 Jul 2026 06:30:37 +0000 (09:30 +0300)] 
gh-154781: Fix garbage from curses window.in_wstr() (GH-154782)

in_wstr() searched the result for a terminating null, but winnwstr()
writes one only if it stored at least one character.  Use the number of
characters it returns as the length.

2 days agogh-154788: Make curses window.getparent() unconditional (GH-154789)
Vyron Vasileiadis [Wed, 29 Jul 2026 06:07:15 +0000 (09:07 +0300)] 
gh-154788: Make curses window.getparent() unconditional (GH-154789)

getparent() calls no curses function, it returns the window's stored parent,
but it was compiled only when the ncurses extension functions were present.
Close the guard after getscrreg(), which does need it.

The test moves out of test_state_getters, which is gated on is_scrollok(), so
that getparent() is covered on backends without the extensions.

2 days agogh-154271: Enable socket ancillary data and forkserver on illumos (GH-154273)
Serhiy Storchaka [Tue, 28 Jul 2026 17:35:26 +0000 (20:35 +0300)] 
gh-154271: Enable socket ancillary data and forkserver on illumos (GH-154273)

illumos declares the socket ancillary-data API (CMSG_*, sendmsg(),
recvmsg()) only under _XOPEN_SOURCE >= 600.  __EXTENSIONS__ keeps the
other platform features.  This enables the forkserver start method.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2 days agogh-154324: Fix os.sendfile() error reporting on illumos (GH-154327)
Serhiy Storchaka [Tue, 28 Jul 2026 17:14:00 +0000 (20:14 +0300)] 
gh-154324: Fix os.sendfile() error reporting on illumos (GH-154327)

illumos sendfile(3EXT) returns the number of transferred bytes by adding
it to the offset without initializing it, so the offset cannot be used to
detect a partial write.  Use sendfilev(3EXT), which reports the number of
transferred bytes in an explicit out parameter.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2 days agogh-154821: fix data races on function attributes (#154826)
Kumar Aditya [Tue, 28 Jul 2026 16:54:27 +0000 (22:24 +0530)] 
gh-154821: fix data races on function attributes (#154826)

2 days agogh-154822: Fix racy assertion during finalization (GH-154824)
Peter Bierma [Tue, 28 Jul 2026 16:06:52 +0000 (12:06 -0400)] 
gh-154822: Fix racy assertion during finalization (GH-154824)

3 days agogh-152674: Avoid quadratic behavior in xml.etree.ElementPath index predicates (GH...
Petr Viktorin [Tue, 28 Jul 2026 11:36:47 +0000 (13:36 +0200)] 
gh-152674: Avoid quadratic behavior in xml.etree.ElementPath index predicates (GH-152676)

Co-authored-by: Alexis <alexis.challande@trailofbits.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
3 days agogh-132604: Track deprecation related to runtime-checkable protocols (3.20) (#154790)
Bartosz Sławecki [Tue, 28 Jul 2026 10:27:31 +0000 (12:27 +0200)] 
gh-132604: Track deprecation related to runtime-checkable protocols (3.20) (#154790)

* Track deprecation related to runtime-checkable protocols until 3.20

* Add deprecation note to 3.15 what's new

3 days agogh-142349: Clarify lazy import filters have positional-only parameters (GH-144856)
Bartosz Sławecki [Tue, 28 Jul 2026 09:14:51 +0000 (11:14 +0200)] 
gh-142349: Clarify lazy import filters have positional-only parameters (GH-144856)

3 days agogh-154661: Reorganize difflib documentation (GH-154662)
Petr Viktorin [Tue, 28 Jul 2026 09:04:23 +0000 (11:04 +0200)] 
gh-154661: Reorganize difflib documentation (GH-154662)

- Put common information in an intro section at the beginning, rather
  than in a duplicate doc entry for `SequenceMatcher`
- Merge the two doc entries for `Differ`
- Document timing as a CPython implementation detail
- Group examples together

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
3 days agogh-154775: Don't accept duplicate plus sign when matching complex number (GH-154776)
Petr Viktorin [Tue, 28 Jul 2026 07:19:46 +0000 (09:19 +0200)] 
gh-154775: Don't accept duplicate plus sign when matching complex number (GH-154776)

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
3 days agogh-150866: Fix asyncio shutdown_asyncgens to report BaseException (#150867)
Timofei Ivankov [Tue, 28 Jul 2026 06:59:49 +0000 (09:59 +0300)] 
gh-150866: Fix asyncio shutdown_asyncgens to report BaseException (#150867)

3 days agogh-154786: Fix crashes on a screen without a terminal (GH-154787)
Serhiy Storchaka [Tue, 28 Jul 2026 05:00:39 +0000 (08:00 +0300)] 
gh-154786: Fix crashes on a screen without a terminal (GH-154787)

screen.use() makes its screen current for the callback, so a new_prescr()
screen, which has no terminal, can be current without set_term().
Operations that need a terminal then crashed inside curses.

Raise curses.error instead, checking that stdscr exists.

3 days agogh-154746: Update docstring for `collections.Counter` (GH-154792)
Dan Shernicoff [Tue, 28 Jul 2026 01:41:17 +0000 (21:41 -0400)] 
gh-154746: Update docstring for `collections.Counter` (GH-154792)

Added a note to `collections.Counter`'s docstring that initializing a `Counter` from a `Mapping` or `Counter` will have different behaviour than initializing from other `Iterable`s.

This behaviour was already documented in the canonical docs but is missing from the help() output.

3 days agogh-154467: Fix empty (Pdb) prompt when attaching to a process with pdb -p (#154469)
Łukasz Langa [Mon, 27 Jul 2026 20:45:40 +0000 (13:45 -0700)] 
gh-154467: Fix empty (Pdb) prompt when attaching to a process with pdb -p (#154469)

_PdbServer inherits _cmdloop, which wraps cmdloop() in
_maybe_use_pyrepl_as_stdin(). That context manager blanks self.prompt to ''
so that a local pyrepl draws the prompt itself. The remote server, however,
never reads from a local pyrepl -- it transmits self.prompt to the client
over the socket -- so the blanking made it send an empty prompt whenever the
target process had a pyrepl-capable terminal (pyrepl_input is set).

Override _maybe_use_pyrepl_as_stdin() in _PdbServer to a no-op, keeping the
real prompt. Add an integration test that attaches to a target running under
a pty, so PyREPL is genuinely enabled inside it, and asserts the transmitted
prompt is "(Pdb) ".

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
3 days agogh-154675: reorganize some imports in importlib (#154657)
Brett Cannon [Mon, 27 Jul 2026 20:18:53 +0000 (13:18 -0700)] 
gh-154675: reorganize some imports in importlib (#154657)

3 days agogh-152912: Fix audit hook exception check in sys.addaudithook() (GH-152913)
k00shi [Mon, 27 Jul 2026 19:35:40 +0000 (03:35 +0800)] 
gh-152912: Fix audit hook exception check in sys.addaudithook() (GH-152913)

3 days agogh-152548: Add a test.support.isolation.runInSubprocess() decorator (GH-152551)
Serhiy Storchaka [Mon, 27 Jul 2026 19:02:59 +0000 (22:02 +0300)] 
gh-152548: Add a test.support.isolation.runInSubprocess() decorator (GH-152551)

Run a test in a fresh interpreter subprocess, so that it does not share global
or interpreter state with the rest of the test run.  It can decorate a test
method (only that method runs in a subprocess) or a TestCase subclass (the
whole class runs in one subprocess, with its setUpClass()/setUp()/tearDown()/
tearDownClass() running there rather than in the parent).

Failures, errors and skips, including those of individual subtests, are
reported for the test; a failure or an error shows the original subprocess
traceback.  The subprocess inherits the parent's resource, memory, verbosity
and failfast configuration, so that requires_resource(), bigmemtest() and
similar behave the same in both processes.  A decorated test is skipped where
subprocesses are unavailable, since it must spawn one.

The test.support.isolation.runningInSubprocess flag is true in the subprocess,
so that fixtures can choose what to run there.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
3 days agogh-154749: Reject a terminal-less screen in curses.set_term() (GH-154750)
Vyron Vasileiadis [Mon, 27 Jul 2026 18:59:46 +0000 (21:59 +0300)] 
gh-154749: Reject a terminal-less screen in curses.set_term() (GH-154750)

set_term() accepted a screen returned by new_prescr(), which has no
terminal, and the next refresh crashed inside curses.  Raise
curses.error instead.

3 days agogh-154751: Fix use-after-free in curses.initscr() after newterm() (GH-154752)
Vyron Vasileiadis [Mon, 27 Jul 2026 18:24:10 +0000 (21:24 +0300)] 
gh-154751: Fix use-after-free in curses.initscr() after newterm() (GH-154752)

initscr() called while a newterm() screen is current returned a second
window object over that screen's standard window, with no reference to
the screen.  Either wrapper could then free the window used by the other.

Return the screen's own standard window instead.

3 days agogh-154744: Improve detection of skipinitialspace in csv.Sniffer (GH-154745)
Serhiy Storchaka [Mon, 27 Jul 2026 15:03:17 +0000 (18:03 +0300)] 
gh-154744: Improve detection of skipinitialspace in csv.Sniffer (GH-154745)

Detect the padding by parsing the sample both with and without
skipinitialspace and comparing the two readings, instead of testing
whether every field following a delimiter starts with a space.

3 days agogh-154431: Revert "gh-154431: Fix data race in `sys.audithook` (#154462)" (GH-154769)
Petr Viktorin [Mon, 27 Jul 2026 14:00:20 +0000 (16:00 +0200)] 
gh-154431: Revert "gh-154431: Fix data race in `sys.audithook` (#154462)" (GH-154769)

This commit caused a refleak.

This reverts commit 596cd5c5d7b6ada3e50c6499447eb90a065769ad.

4 days agogh-122931: Allow stable abi3 API extensions to include a multiarch tuple in the filen...
Stefano Rivera [Mon, 27 Jul 2026 13:05:40 +0000 (06:05 -0700)] 
gh-122931: Allow stable abi3 API extensions to include a multiarch tuple in the filename (GH-152461)

This permits stable ABI extensions for multiple architectures to be
co-installed into the same directory, without clashing with each other,
the same way (non-stable ABI) regular extensions can.

It is listed before the current platform-less suffixes since it's more
specific.

The platform is stored in a new pyconfig.h define & sysconfig
variable, SOABI_PLATFORM.
On some known architectures (FreeBSD, Windows), this
will be undefined/zero; these won't have the new tag (yet).

Add SOABI_PLATFORM & ALT_SOABI the info to
`make pythoninfo` as well.

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
4 days agoUpdate mypy to 2.3 (#154764)
sobolevn [Mon, 27 Jul 2026 11:31:02 +0000 (14:31 +0300)] 
Update mypy to 2.3 (#154764)

4 days agogh-154070: Build the curses module wide by capability, not by name (GH-154071)
Serhiy Storchaka [Mon, 27 Jul 2026 11:04:51 +0000 (14:04 +0300)] 
gh-154070: Build the curses module wide by capability, not by name (GH-154071)

configure built the module wide (HAVE_NCURSESW) only for a backend named
ncursesw.  Probe for the wide API in the ncurses and auto backends too, so
a widec-built ncurses keeping the plain name (pkgsrc, macOS) is built wide.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
4 days agogh-145177: Upgrade to Emscripten 6.0.4 (#154743)
Hood Chatham [Sun, 26 Jul 2026 22:37:20 +0000 (00:37 +0200)] 
gh-145177: Upgrade to Emscripten 6.0.4 (#154743)

Bumps Emscripten version for builds to 6.0.4.

5 days agogh-93251: Decode localized socket error messages from the locale encoding (GH-154683)
Serhiy Storchaka [Sun, 26 Jul 2026 09:31:26 +0000 (12:31 +0300)] 
gh-93251: Decode localized socket error messages from the locale encoding (GH-154683)

The gai_strerror() and hstrerror() messages were decoded as UTF-8, so
gaierror and herror could be replaced with UnicodeDecodeError if the
message is localized and the locale encoding is not UTF-8.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
5 days agogh-148736: Use ag_frame when walking async generators in asyncio.graph (#148737)
Raj Kripal Danday [Sun, 26 Jul 2026 09:08:51 +0000 (02:08 -0700)] 
gh-148736: Use ag_frame when walking async generators in asyncio.graph (#148737)

5 days agogh-153862: Fix spurious color pair in curses window.inch() on a wide build (GH-154703)
Serhiy Storchaka [Sun, 26 Jul 2026 08:02:50 +0000 (11:02 +0300)] 
gh-153862: Fix spurious color pair in curses window.inch() on a wide build (GH-154703)

winch() returns the whole code point, so inch() replacing only its low
8 bits left the high bits in the color field.  Rebuild from
getcchar()'s attributes and color pair.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
5 days agogh-154695: fix asyncio.Task eager_start=True with no explicit loop (#154697)
Timofei [Sun, 26 Jul 2026 04:56:24 +0000 (07:56 +0300)] 
gh-154695: fix asyncio.Task eager_start=True with no explicit loop (#154697)

5 days agoFix a stale link to the `math.integer.isqrt()` correctness proof (#154685)
Mark Dickinson [Sat, 25 Jul 2026 14:42:44 +0000 (15:42 +0100)] 
Fix a stale link to the `math.integer.isqrt()` correctness proof (#154685)

5 days agoAdd the free-threaded Windows build output dirs to `.gitignore` (#154641)
Jason G [Sat, 25 Jul 2026 14:28:10 +0000 (21:28 +0700)] 
Add the free-threaded Windows build output dirs to `.gitignore` (#154641)

5 days agogh-154199: Soft-deprecate `ctypes.util.find_msvcrt` (GH-154553)
Peter Bierma [Sat, 25 Jul 2026 14:08:55 +0000 (10:08 -0400)] 
gh-154199: Soft-deprecate `ctypes.util.find_msvcrt` (GH-154553)

6 days agogh-150621: avoid quadratic bytes slicing in `asyncio.protocols._feed_data_to_buffered...
Timofei [Sat, 25 Jul 2026 13:14:49 +0000 (16:14 +0300)] 
gh-150621: avoid quadratic bytes slicing in `asyncio.protocols._feed_data_to_buffered_proto` (#150622)

6 days agogh-154493: Add the UCD license to `Doc/license.rst` (#154651)
Stan Ulbrych [Sat, 25 Jul 2026 13:13:58 +0000 (15:13 +0200)] 
gh-154493: Add the UCD license to `Doc/license.rst` (#154651)

6 days agogh-153296: Fix thread-safety data race in io.StringIO iterator (#153368)
Rishit Agnihotri [Sat, 25 Jul 2026 08:35:25 +0000 (01:35 -0700)] 
gh-153296: Fix thread-safety data race in io.StringIO iterator (#153368)

6 days agogh-154043: Fix a data race when iterating a shared `types.GenericAlias` iterator...
Ivy Xu [Sat, 25 Jul 2026 08:29:59 +0000 (16:29 +0800)] 
gh-154043: Fix a data race when iterating a shared `types.GenericAlias` iterator in FT build (#154108)

6 days agogh-120866: Document behavior change of asyncio.Server.wait_closed() since 3.12 (...
Kumar Aditya [Sat, 25 Jul 2026 06:40:22 +0000 (12:10 +0530)] 
gh-120866: Document behavior change of asyncio.Server.wait_closed() since 3.12 (#154676)

6 days agogh-153290: Fix data race in BytesIO.__setstate__ installing __dict__ (#153376)
Bhuvi [Sat, 25 Jul 2026 05:56:33 +0000 (11:26 +0530)] 
gh-153290: Fix data race in BytesIO.__setstate__ installing __dict__ (#153376)

6 days agoGH-153809: Untrack TaskObj from GC before calling unregister_task (#154563)
Sergey Miryanov [Sat, 25 Jul 2026 03:31:06 +0000 (08:31 +0500)] 
GH-153809: Untrack TaskObj from GC before calling unregister_task (#154563)

6 days agogh-118150: warn in doc about results asymmetry for difflib junk (GH-153892)
Lenormand Julien [Fri, 24 Jul 2026 23:40:32 +0000 (01:40 +0200)] 
gh-118150: warn in doc about results asymmetry for difflib junk (GH-153892)

6 days agogh-134745: Remove dead code in `thread_nt.h` left by gh-134747 (#154338)
Ivy Xu [Fri, 24 Jul 2026 22:33:29 +0000 (06:33 +0800)] 
gh-134745: Remove dead code in `thread_nt.h` left by gh-134747 (#154338)

6 days agogh-154189: Fix use-after-free in `functools.partial_vectorcall` (GH-154508)
Brij Kapadia [Fri, 24 Jul 2026 21:32:07 +0000 (17:32 -0400)] 
gh-154189: Fix use-after-free in `functools.partial_vectorcall` (GH-154508)

6 days agoGH-154638: Use lazy imports in argparse (#154639)
Savannah Ostrowski [Fri, 24 Jul 2026 20:33:26 +0000 (13:33 -0700)] 
GH-154638: Use lazy imports in argparse (#154639)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
6 days agoGH-142035: Fix wrapping of colorized argparse help text (#154634)
Savannah Ostrowski [Fri, 24 Jul 2026 19:50:09 +0000 (12:50 -0700)] 
GH-142035: Fix wrapping of colorized argparse help text (#154634)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
6 days agogh-70990: Support bytes addresses of Unix sockets in SysLogHandler (GH-154500)
Serhiy Storchaka [Fri, 24 Jul 2026 16:54:01 +0000 (19:54 +0300)] 
gh-70990: Support bytes addresses of Unix sockets in SysLogHandler (GH-154500)

Only a str address was recognized as a Unix domain socket.  A bytes
address, which socket.bind() accepts, fell through to the (host, port)
branch and raised ValueError.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
6 days agogh-154580: Fix python-gdb.py pretty-printing non-ASCII strings in non-UTF-8 locales...
Serhiy Storchaka [Fri, 24 Jul 2026 16:11:15 +0000 (19:11 +0300)] 
gh-154580: Fix python-gdb.py pretty-printing non-ASCII strings in non-UTF-8 locales (GH-154581)

The gdb pretty-printer used locale.getpreferredencoding() to decide whether to
escape a character, but gdb writes its output in its host charset.  Use
gdb.host_charset() instead.  test_strings had the same problem.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
6 days agogh-153419: Fix several issues around bytearray __init__ (#153498)
Steve Stagg [Fri, 24 Jul 2026 15:25:11 +0000 (16:25 +0100)] 
gh-153419: Fix several issues around bytearray __init__ (#153498)

Introduce a bytearray_new() function to ensure that
ob_bytes_object is always set on a bytearray.

Resizing a bytearray to 0 length now explicitly sets
the ob_bytes_object to the empty constant immortal.

Add a check in the 'bytearray init from string'
fast path to ensure there are no active exports.

This fixes asserts/crashes on the following:
 - bytearray(1).__init__()
 - bytearray().__new__(bytearray).append(1)
 - a = bytearray(); b = memoryview(a); a.__init__('x', 'ascii')

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
6 days agogh-76595: Add tests for PyCapsule_Import() (GH-154588)
Serhiy Storchaka [Fri, 24 Jul 2026 15:01:56 +0000 (18:01 +0300)] 
gh-76595: Add tests for PyCapsule_Import() (GH-154588)

Add _testcapi helpers to create a capsule with an arbitrary name and to call PyCapsule_Import(), and Python tests covering the current behavior: only the first component of the dotted name is imported, the rest are attribute lookups.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
6 days agogh-73458: Fix logging.config.listen() on a host without an IPv4 address (GH-154491)
Serhiy Storchaka [Fri, 24 Jul 2026 15:00:40 +0000 (18:00 +0300)] 
gh-73458: Fix logging.config.listen() on a host without an IPv4 address (GH-154491)

The server is created in a thread which set the "ready" event only after a
successful start, so a failure to start left the caller waiting for that
event forever.  Set it also on failure.

The receiver always used AF_INET, which fails if the host has no IPv4
address, for example if "localhost" is only aliased to ::1.  Use the family
of the first resolved address in such case.

Also fixes gh-82076.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
6 days agogh-145107: simplify asyncio staggered race using eager_start=False (#145108)
Thomas Grainger [Fri, 24 Jul 2026 14:40:25 +0000 (15:40 +0100)] 
gh-145107: simplify asyncio staggered race using eager_start=False (#145108)

6 days agogh-140326: disable the relative import in asyncio REPL (#140327)
Locked-chess-official [Fri, 24 Jul 2026 14:39:57 +0000 (22:39 +0800)] 
gh-140326: disable the relative import in asyncio REPL (#140327)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
6 days agogh-150361: add test for FlowControlMixin pause_writing exception handling (#150362)
Mohammad Reza [Fri, 24 Jul 2026 14:04:04 +0000 (17:34 +0330)] 
gh-150361: add test for FlowControlMixin pause_writing exception handling (#150362)

6 days agogh-145030: Fix asyncio write pipe transport for named FIFOs on macOS (#154222)
Bhuvi [Fri, 24 Jul 2026 13:53:51 +0000 (19:23 +0530)] 
gh-145030: Fix asyncio write pipe transport for named FIFOs on macOS (#154222)

7 days agogh-91484: Allow memoryview cast for F-contiguous (GH-137803)
Jaemin Park [Fri, 24 Jul 2026 13:17:06 +0000 (22:17 +0900)] 
gh-91484: Allow memoryview cast for F-contiguous (GH-137803)

7 days agogh-154582: Fix test_invalid_utf8_arg in non-UTF-8 multibyte locales (GH-154584)
Serhiy Storchaka [Fri, 24 Jul 2026 12:22:45 +0000 (15:22 +0300)] 
gh-154582: Fix test_invalid_utf8_arg in non-UTF-8 multibyte locales (GH-154584)

Arbitrary bytes round-trip through surrogateescape only in UTF-8 and
single-byte encodings, not in a stateful multibyte encoding such as EUC-JP.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
7 days agogh-146011: Fix use-after-free in `signaldict_repr` after deletion (#153784)
Brij Kapadia [Fri, 24 Jul 2026 12:21:43 +0000 (08:21 -0400)] 
gh-146011: Fix use-after-free in `signaldict_repr` after deletion (#153784)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
7 days agogh-154592: Fix test_peg_generator in non-UTF-8 locales with a non-ASCII work dir...
Serhiy Storchaka [Fri, 24 Jul 2026 12:20:21 +0000 (15:20 +0300)] 
gh-154592: Fix test_peg_generator in non-UTF-8 locales with a non-ASCII work dir (GH-154593)

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
7 days agogh-153785: Generate `AttributeError` messages from context (#153786)
Bartosz Sławecki [Fri, 24 Jul 2026 12:14:47 +0000 (14:14 +0200)] 
gh-153785: Generate `AttributeError` messages from context (#153786)

Co-authored-by: Victor Stinner <vstinner@python.org>
7 days agogh-150546: Fix cleanup for replacement_locations in _PyCode_New() (#150549)
stevens [Fri, 24 Jul 2026 11:42:29 +0000 (19:42 +0800)] 
gh-150546: Fix cleanup for replacement_locations in _PyCode_New() (#150549)

7 days agogh-153570: Fix use-after-free in bytearray.take_bytes() with a reentrant __index__...
tonghuaroot (童话) [Fri, 24 Jul 2026 10:15:01 +0000 (18:15 +0800)] 
gh-153570: Fix use-after-free in bytearray.take_bytes() with a reentrant __index__ (#153572)

bytearray.take_bytes() cached the size before the argument's __index__ call and
used it for the bounds check and the buffer reads, so an __index__ that resizes
the bytearray left it reading freed memory. Re-read the size after __index__,
matching bytearray.__setitem__ (GH-91153).

7 days agogh-152433: Windows: modernize and refactor stat emulation APIs (GH-153700)
thexai [Fri, 24 Jul 2026 09:56:48 +0000 (11:56 +0200)] 
gh-152433: Windows: modernize and refactor stat emulation APIs (GH-153700)

This allows build on more API sets (e.g. UWP) without excluding any currently supported desktop OS.

7 days agogh-152263: Fix test_set_wide for locales with wide characters (GH-154583)
Serhiy Storchaka [Fri, 24 Jul 2026 07:58:42 +0000 (10:58 +0300)] 
gh-152263: Fix test_set_wide for locales with wide characters (GH-154583)

The soft label can be truncated to fit the soft label width, e.g. in the
EUC-JP locale, where "Å" and "ö" are double-width JIS X 0212 characters.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
7 days agogh-153176: Fix destroy_interpreter() test helper clearing a non-current thread state...
Jiucheng(Oliver) [Fri, 24 Jul 2026 04:41:08 +0000 (00:41 -0400)] 
gh-153176: Fix destroy_interpreter() test helper clearing a non-current thread state (#153307)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Xiaowei Lu <weixlu420302@gmail.com>
7 days agogh-154551: Fix ctypes.util.find_library() in non-UTF-8 locales (GH-154552)
Serhiy Storchaka [Thu, 23 Jul 2026 17:28:39 +0000 (20:28 +0300)] 
gh-154551: Fix ctypes.util.find_library() in non-UTF-8 locales (GH-154552)

_findLib_ld() failed to decode the localized "ld" stderr in the locale
encoding.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
7 days agogh-153903: Copy docstrings and other metadata in `ctypes.util.wrap_dll_function`...
Brian Ward [Thu, 23 Jul 2026 16:57:55 +0000 (12:57 -0400)] 
gh-153903: Copy docstrings and other metadata in `ctypes.util.wrap_dll_function` (GH-154495)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
7 days agogh-69573: Check the return value of msvcrt._putch() and _putwch() (GH-154364)
Jason G [Thu, 23 Jul 2026 15:52:42 +0000 (22:52 +0700)] 
gh-69573: Check the return value of msvcrt._putch() and _putwch() (GH-154364)

7 days agogh-154525: Skip ncurses find_pair()/alloc_pair() reuse checks before 6.3 (GH-154543)
Serhiy Storchaka [Thu, 23 Jul 2026 15:37:43 +0000 (18:37 +0300)] 
gh-154525: Skip ncurses find_pair()/alloc_pair() reuse checks before 6.3 (GH-154543)

find_pair() and reuse in alloc_pair() were fixed in ncurses 6.3 (patch
20200411).  On earlier versions find_pair() returns -1 and alloc_pair()
allocates a fresh pair instead of reusing an equal one, so
test_dynamic_color_pairs failed on ncurses 6.1 and 6.2.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
7 days agogh-154525: Fix curses getcchar() failure on ncurses older than 6.3 (GH-154526)
Serhiy Storchaka [Thu, 23 Jul 2026 14:48:17 +0000 (17:48 +0300)] 
gh-154525: Fix curses getcchar() failure on ncurses older than 6.3 (GH-154526)

getcchar() rejected a non-NULL opts argument before ncurses 6.3, so read
the color pair through the short slot instead.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>