]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
2 days agogh-152099: Raise SendfileNotAvailableError for fallback-only transports in asyncio...
Zain Nadeem [Sun, 28 Jun 2026 10:26:27 +0000 (15:26 +0500)] 
gh-152099: Raise SendfileNotAvailableError for fallback-only transports in asyncio (#152223)

2 days agogh-152074: Increase the buffer size to 256 KiB in `asyncio` `_sendfile_fallback...
Prakash Sellathurai [Sun, 28 Jun 2026 10:17:49 +0000 (15:47 +0530)] 
gh-152074: Increase the buffer size to 256 KiB  in `asyncio` `_sendfile_fallback` (#152097)

2 days agogh-152470: Make wide-character curses functions work on a narrow build (GH-152476)
Serhiy Storchaka [Sun, 28 Jun 2026 09:35:37 +0000 (12:35 +0300)] 
gh-152470: Make wide-character curses functions work on a narrow build (GH-152476)

curses.window.get_wch, curses.window.get_wstr, curses.unget_wch,
curses.erasewchar, curses.killwchar and curses.wunctrl now also work when
Python is built against a non-wide curses library, on an 8-bit locale, where
each character is a single byte in the relevant encoding.  curses.ungetch now
also accepts a one-character string, like curses.unget_wch.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2 days agogh-152233: Make the curses cell API work without ncursesw (ПР-152466)
Serhiy Storchaka [Sun, 28 Jun 2026 05:22:43 +0000 (08:22 +0300)] 
gh-152233: Make the curses cell API work without ncursesw (ПР-152466)

Back complexchar, complexstr and the cell read methods (in_wch,
in_wchstr, in_wstr, getbkgrnd) with a chtype instead of a cchar_t when
ncursesw is absent, so the same code works on both builds.  A narrow
build is limited to one character per cell, encodable as a single byte in
the window's encoding (8-bit locales), with the color pair limited to the
color_pair() range.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2 days agogh-133031: Support non-ASCII characters in curses.textpad.Textbox (GH-152451)
Serhiy Storchaka [Sun, 28 Jun 2026 05:14:33 +0000 (08:14 +0300)] 
gh-133031: Support non-ASCII characters in curses.textpad.Textbox (GH-152451)

Textbox mangled non-ASCII characters of an 8-bit locale encoding: it masked
reads with curses.ascii.ascii(), which clears the 8th bit, and tested input
with curses.ascii.isprint(), which rejects bytes above 127.

Decode cells and input bytes with the window's encoding instead.  Cells are
read with instr() and the lower-right cell is written as text, since inch() and
insch() with an int byte mishandle a non-ASCII character on a wide build.  This
uses only the byte-oriented curses API, so it works without wide-character
support.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
3 days agogh-83274: Don't crash when a Tcl interpreter is deallocated in the wrong thread ...
Serhiy Storchaka [Sat, 27 Jun 2026 21:26:11 +0000 (00:26 +0300)] 
gh-83274: Don't crash when a Tcl interpreter is deallocated in the wrong thread (GH-152323)

Deallocating the interpreter from a thread other than the one it was created
in ran Tcl_DeleteInterp() there, which makes Tcl abort the process
("Tcl_AsyncDelete: async handler deleted by the wrong thread").

Tkapp_Dealloc() now leaks the interpreter in that case and reports a
RuntimeWarning instead.

Co-Authored-By: E. Paine <63801254+E-Paine@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
3 days agoProvide a cross-reference to PEP 798 unpacking syntax (#152454)
Raymond Hettinger [Sat, 27 Jun 2026 21:17:41 +0000 (16:17 -0500)] 
Provide a cross-reference to PEP 798 unpacking syntax (#152454)

Co-authored-by: Rishit Agnihotri <Twix1288@users.noreply.github.com>
3 days agogh-152332: Add the curses.term_attrs() function (GH-152333)
Serhiy Storchaka [Sat, 27 Jun 2026 20:23:55 +0000 (23:23 +0300)] 
gh-152332: Add the curses.term_attrs() function (GH-152333)

term_attrs() returns the video attributes supported by the terminal as
WA_* values, the counterpart of termattrs() for the A_* values.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
3 days agogh-152415: Exercise curses non-ASCII tests under 8-bit locale encodings (GH-152416)
Serhiy Storchaka [Sat, 27 Jun 2026 19:16:32 +0000 (22:16 +0300)] 
gh-152415: Exercise curses non-ASCII tests under 8-bit locale encodings (GH-152416)

The non-ASCII tests only exercised what the runner's locale could encode (in
practice UTF-8).  Add 8-bit-encoding cases to the character and string I/O
tests, each guarded by the existing encodability check: ASCII, a character
common to the Latin encodings ('é'), and ones distinctive to a single encoding
(byte 0xA4 is '¤' in ISO-8859-1, '€' in ISO-8859-15, 'є' in KOI8-U).  Run the
whole suite under different locales to cover them; unrepresentable cases skip.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* gh-152415: Verify character output round-trips in test_output_character

Read each written character back with in_wch() or instr() rather than
inch(), which on a wide build returns the low byte of the code point
instead of the locale-encoded byte and so mangles a non-ASCII character
of an 8-bit locale.  This lets the int-argument cases cover '€'/'є', and
adds matching coverage for the str argument.

insch() with an int byte > 127 is checked only for Latin-1: on a wide
build ncurses winsch stores a printable byte directly as a code point
instead of decoding it through the locale.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
3 days agogh-152434: Fix async-aware Gecko collection (#152442)
László Kiss Kollár [Sat, 27 Jun 2026 17:29:50 +0000 (18:29 +0100)] 
gh-152434: Fix async-aware Gecko collection (#152442)

3 days agogh-145306: Fix browser open after empty export (#150017)
ivonastojanovic [Sat, 27 Jun 2026 17:09:49 +0000 (18:09 +0100)] 
gh-145306: Fix browser open after empty export (#150017)

3 days agogh-146495: Improve `SyntaxError` message for `&&` and `||` operators (#150906)
Aniket [Sat, 27 Jun 2026 16:57:10 +0000 (22:27 +0530)] 
gh-146495: Improve `SyntaxError` message for `&&` and `||` operators (#150906)

3 days agogh-151613: Fix remote debugging frame cache ABA (#151614)
Pablo Galindo Salgado [Sat, 27 Jun 2026 16:56:31 +0000 (18:56 +0200)] 
gh-151613: Fix remote debugging frame cache ABA (#151614)

The remote debugging frame cache previously used only the last_profiled_frame address as its cache anchor. If a frame returned and a later frame reused the same _PyInterpreterFrame address, the profiler could accept a stale cache entry and splice parent frames from a different call chain into the current stack.

This adds a last_profiled_frame_seq counter next to last_profiled_frame, increments it when the anchor advances, stores it in frame cache entries, and validates cache hits against both the frame address and the sequence. Cache miss walks now copy stack chunks before storing new cache entries so stored continuations come from a stable snapshot. The new regression test exercises alternating call chains and checks that cached stacks never contain frames from both branches.

3 days agogh-152434: Block --async-aware with --binary (#152444)
László Kiss Kollár [Sat, 27 Jun 2026 16:55:57 +0000 (17:55 +0100)] 
gh-152434: Block --async-aware with --binary (#152444)

The binary writer does not currently handle AwaitedInfo samples and
crashes when running in --async-aware mode.

3 days agogh-151029: Fix sys.remote_exec() unable to find writable memory when libpython replac...
Łukasz Langa [Sat, 27 Jun 2026 16:21:15 +0000 (09:21 -0700)] 
gh-151029: Fix sys.remote_exec() unable to find writable memory when libpython replaced on disk (#151032)

Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
3 days agogh-152391: Improve `test_interpreters.test_stress` test (#152396)
sobolevn [Sat, 27 Jun 2026 15:12:22 +0000 (18:12 +0300)] 
gh-152391: Improve `test_interpreters.test_stress` test (#152396)

3 days agogh-152305: Fix `_pydatetime.time.strftime()` raising on year directives (#152306)
tonghuaroot (童话) [Sat, 27 Jun 2026 15:07:32 +0000 (23:07 +0800)] 
gh-152305: Fix `_pydatetime.time.strftime()` raising on year directives (#152306)

Co-authored-by: Stan Ulbrych <stan@python.org>
3 days agogh-151126: Sets missing exceptions in `tkinter` and `socket` modules initializations...
sobolevn [Sat, 27 Jun 2026 15:00:34 +0000 (18:00 +0300)] 
gh-151126: Sets missing exceptions in `tkinter` and `socket` modules initializations (#152418)

3 days agoDocs: Fix incomplete sentence in `tp_itemsize` documentation (GH-152381)
da-woods [Sat, 27 Jun 2026 13:45:04 +0000 (14:45 +0100)] 
Docs: Fix incomplete sentence in `tp_itemsize` documentation (GH-152381)

3 days agogh-152402: Use `support.nomemtest` in `test_pyexpat` (#152403)
sobolevn [Sat, 27 Jun 2026 13:29:10 +0000 (16:29 +0300)] 
gh-152402: Use `support.nomemtest` in `test_pyexpat` (#152403)

3 days agogh-152275: Add integer overflow guards to the curses chtype and color-pair packing...
Serhiy Storchaka [Sat, 27 Jun 2026 12:42:41 +0000 (15:42 +0300)] 
gh-152275: Add integer overflow guards to the curses chtype and color-pair packing path (GH-152303)

curses.color_pair() now raises OverflowError for a pair number too large
to be packed, instead of silently masking it to a different pair.

The attr argument of the character-cell and attribute methods (addch,
addstr, attron, attrset and others) now goes through the checked attr
converter, so an out-of-range or non-integer attribute is rejected rather
than silently truncated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
3 days agogh-152260: Fix flaky curses test_scr_dump on macOS (GH-152390)
Serhiy Storchaka [Sat, 27 Jun 2026 11:59:53 +0000 (14:59 +0300)] 
gh-152260: Fix flaky curses test_scr_dump on macOS (GH-152390)

The screen dump embeds raw pointers that change after scr_restore(),
so comparing dump bytes is unreliable.  Test the round-trip functionally
instead.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
3 days agogh-70273: Document default class bindings in tkinter (GH-152389)
Serhiy Storchaka [Sat, 27 Jun 2026 11:37:41 +0000 (14:37 +0300)] 
gh-70273: Document default class bindings in tkinter (GH-152389)

Note in the Bindings and events section that every widget inherits Tk
class bindings for its standard behavior, where they are documented, and
how to suppress an unwanted one by returning "break" from a callback.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
3 days agogh-82830: Improve tkinter messagebox docstrings and cursor documentation (GH-152380)
Serhiy Storchaka [Sat, 27 Jun 2026 11:01:34 +0000 (14:01 +0300)] 
gh-82830: Improve tkinter messagebox docstrings and cursor documentation (GH-152380)

Document Windows cursor files (gh-99089).

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
3 days agogh-152212: Reject a POSIX TZ footer with a missing std offset in pure-Python `zoneinf...
tonghuaroot (童话) [Sat, 27 Jun 2026 09:16:43 +0000 (17:16 +0800)] 
gh-152212: Reject a POSIX TZ footer with a missing std offset in pure-Python `zoneinfo` (#152213)

3 days agogh-127949: remove asyncio policy system (#150310)
Kumar Aditya [Sat, 27 Jun 2026 07:16:50 +0000 (12:46 +0530)] 
gh-127949: remove asyncio policy system (#150310)

3 days agogh-87904: Report the public module name in curses types and exceptions (GH-152341)
Serhiy Storchaka [Sat, 27 Jun 2026 07:10:11 +0000 (10:10 +0300)] 
gh-87904: Report the public module name in curses types and exceptions (GH-152341)

The curses C types and exceptions now set their tp_name to the public
module, so __module__, repr() and help() report curses.window,
curses.complexchar, curses.complexstr, curses.screen, curses.error,
curses.panel.panel and curses.panel.error instead of the underscore
extension modules.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
3 days agogh-151678: Add more tests for tkinter.dnd (GH-152362)
Serhiy Storchaka [Sat, 27 Jun 2026 07:09:07 +0000 (10:09 +0300)] 
gh-151678: Add more tests for tkinter.dnd (GH-152362)

Cover the drag cursor, the Motion and ButtonRelease bindings, switching
between targets, the target search up the master chain, dnd_accept()
returning None, and restarting after a drag has finished.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
3 days agogh-71880: Allow editing the last cell in curses.textpad.Textbox (GH-152363)
Serhiy Storchaka [Sat, 27 Jun 2026 07:08:04 +0000 (10:08 +0300)] 
gh-71880: Allow editing the last cell in curses.textpad.Textbox (GH-152363)

Textbox.edit() ignored typing in the lower-right cell of the window.  It is
now written with insch(), which fills the cell without moving the cursor out
of the window (addch() there raises an error and scrolls a scrollable window).

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
3 days agoRemove commented out code
Jonathan Dung [Fri, 26 Jun 2026 23:27:47 +0000 (07:27 +0800)] 
Remove commented out code

3 days agogh-38464: Make tkinter nametowidget() work with cloned menus (GH-152336)
Serhiy Storchaka [Fri, 26 Jun 2026 23:02:52 +0000 (02:02 +0300)] 
gh-38464: Make tkinter nametowidget() work with cloned menus (GH-152336)

Map the auto-generated name of a cloned menu (a menu used as a menubar
or a cascade) back to the original widget instead of raising KeyError.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
3 days agogh-88758: Handle non-tkinter widgets in tkinter focus methods (GH-152337)
Serhiy Storchaka [Fri, 26 Jun 2026 23:00:38 +0000 (02:00 +0300)] 
gh-88758: Handle non-tkinter widgets in tkinter focus methods (GH-152337)

focus_get(), focus_displayof(), focus_lastfor() and winfo_containing()
now return None instead of raising KeyError when the focused widget was
not created by tkinter (for example a torn-off menu).

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
3 days agogh-152334: Add curses key-management functions (GH-152338)
Serhiy Storchaka [Fri, 26 Jun 2026 22:59:24 +0000 (01:59 +0300)] 
gh-152334: Add curses key-management functions (GH-152338)

Add define_key(), key_defined() and keyok(), the ncurses extensions for
managing how control strings are recognized as key codes, beyond the
predefined terminfo keys and the all-or-nothing window.keypad().

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
3 days agoIDLE: fix dedent() usage in htest (#152256)
Inada Naoki [Fri, 26 Jun 2026 22:47:33 +0000 (07:47 +0900)] 
IDLE: fix dedent() usage in htest (#152256)

Fix typos: in #112642, initial string concatenation quotes were left when switching to textwrap.dedent().

3 days agogh-152260: Fix test_scr_dump() on macOS (GH-152340)
Serhiy Storchaka [Fri, 26 Jun 2026 22:45:30 +0000 (01:45 +0300)] 
gh-152260: Fix test_scr_dump() on macOS (GH-152340)

The dump format embeds raw pointers on some platforms, so two dumps of the
same screen are not always byte-identical.  Only compare dump files when
the format proves deterministic.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
4 days agogh-80937: Fix memory leak in tkinter createcommand (GH-152294)
Serhiy Storchaka [Fri, 26 Jun 2026 18:52:10 +0000 (21:52 +0300)] 
gh-80937: Fix memory leak in tkinter createcommand (GH-152294)

A command created with createcommand() held a strong reference to the
interpreter, forming an uncollectable cycle (interpreter -> command ->
interpreter) that kept the interpreter and the callback alive until the
command was removed with deletecommand() or destroy().  The command now
borrows the reference; it cannot outlive the interpreter, which deletes its
commands when finalized.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
4 days agogh-152238: Revert gh-150490 and gh-152200. (gh-152232)
Neil Schemenauer [Fri, 26 Jun 2026 18:20:41 +0000 (11:20 -0700)] 
gh-152238: Revert gh-150490 and gh-152200. (gh-152232)

Revert commits:
    gh-151593: Fix dead lock in PyDict insert_split_key() (#152200)
    gh-150490: Raise PyType_Modified for insertion into split dictionary (#150489)

For gh-150489, it violates locking discipline and results in deadlocks,
gh-151593 is an example of it being hit in CI.  The attempted fix
gh-152200 avoids the deadlock but introduces a data-race.  The race
window is small but can be triggered with pure Python code.

4 days agogh-152235: Defer GC tracking in set.union and set.difference (gh-152290)
Donghee Na [Fri, 26 Jun 2026 17:11:33 +0000 (02:11 +0900)] 
gh-152235: Defer GC tracking in set.union and set.difference (gh-152290)

4 days agogh-152260: Add curses.scr_dump(), scr_restore(), scr_init() and scr_set() (GH-152261)
Serhiy Storchaka [Fri, 26 Jun 2026 16:36:31 +0000 (19:36 +0300)] 
gh-152260: Add curses.scr_dump(), scr_restore(), scr_init() and scr_set() (GH-152261)

These module-level functions write the whole virtual screen to a file and
load it back -- the screen-wide counterpart of window.putwin()/getwin().
The filename argument accepts a string or a path-like object.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
4 days agogh-151776: Fix test_state_getters on terminals without insert/delete capability ...
Serhiy Storchaka [Fri, 26 Jun 2026 15:50:30 +0000 (18:50 +0300)] 
gh-151776: Fix test_state_getters on terminals without insert/delete capability (GH-152304)

idcok() and idlok() take effect only when the terminal can insert or
delete characters or lines, so check their getters against the
terminal's capabilities instead of asserting an unconditional round-trip.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
4 days agogh-98894: Skip test_dtrace when building without dtrace (#152239)
stratakis [Fri, 26 Jun 2026 14:48:12 +0000 (16:48 +0200)] 
gh-98894: Skip test_dtrace when building without dtrace (#152239)

4 days agogh-152258: Add curses.window.dupwin() (GH-152259)
Serhiy Storchaka [Fri, 26 Jun 2026 14:28:53 +0000 (17:28 +0300)] 
gh-152258: Add curses.window.dupwin() (GH-152259)

dupwin() returns a new window that is an independent duplicate of an existing
one -- same size, position, contents and attributes, but with its own cell
buffer, so changes to one do not affect the other.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
4 days agogh-139145: Fix tkinter event loop in interactive mode (GH-152257)
Serhiy Storchaka [Fri, 26 Jun 2026 14:14:43 +0000 (17:14 +0300)] 
gh-139145: Fix tkinter event loop in interactive mode (GH-152257)

When a Tcl command running its own event loop (such as vwait or
wait_variable) was active and the user typed input on stdin, the event
loop kept spinning at 100% CPU.  The stdin file handler is now removed as
soon as input becomes available.

Also fix gh-139816: an exception raised in a callback no longer stops the
event loop to wait for Enter on a Python built without readline; pending
callbacks keep running until input is actually available on stdin.

Co-authored-by: mdehoon <mjldehoon@yahoo.com>
Co-authored-by: Christopher Chavez <chrischavez@gmx.us>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
4 days agogh-152052: Fix misleading `json` error for `\uXXXX` escape at the end of input (...
tonghuaroot (童话) [Fri, 26 Jun 2026 13:47:22 +0000 (21:47 +0800)] 
gh-152052: Fix misleading `json` error for `\uXXXX` escape at the end of input (#152053)

Co-authored-by: Stan Ulbrych <stan@python.org>
4 days agogh-152236: Fix skips on `_testcapi.set_nomemory` tests (#152253)
sobolevn [Fri, 26 Jun 2026 13:36:41 +0000 (16:36 +0300)] 
gh-152236: Fix skips on `_testcapi.set_nomemory` tests (#152253)

4 days agogh-152235: Defer GC tracking in more set operations (gh-152273)
Donghee Na [Fri, 26 Jun 2026 13:35:17 +0000 (22:35 +0900)] 
gh-152235: Defer GC tracking in more set operations (gh-152273)

4 days agogh-121249: Soft deprecate F and D struct format types (#149346)
Sergey B Kirpichev [Fri, 26 Jun 2026 13:03:49 +0000 (16:03 +0300)] 
gh-121249: Soft deprecate F and D struct format types (#149346)

Remove F/D type codes from table in the struct module documentation.

Co-authored-by: Victor Stinner <vstinner@python.org>
4 days agogh-151722: Defer GC tracking in frozendict.copy() (#152230)
Victor Stinner [Fri, 26 Jun 2026 11:55:54 +0000 (13:55 +0200)] 
gh-151722: Defer GC tracking in frozendict.copy() (#152230)

Fix _PyDict_Or() and frozendict.copy(): only track the frozendict by
the GC once the dictionary is fully initialized.

Functions modifying frozendict now ensures that the object is not
tracked by the GC (in debug mode).

* can_modify_dict() checks that _PyObject_GC_IS_TRACKED() is false
  for frozendicts.
* dict_merge_api() makes sure that the dictionary is tracked by the
  GC.

4 days agogh-90533: Implement BytesIO.peek() (#150917)
Marcel Martin [Fri, 26 Jun 2026 11:46:39 +0000 (13:46 +0200)] 
gh-90533: Implement BytesIO.peek() (#150917)

Add io.BytesIO.peek() method to read without advancing position.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Emma Smith <emma@emmatyping.dev>
Co-authored-by: Stan Ulbrych <stan@python.org>
Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
4 days agogh-152156: Fix a crash in `interpeters.create` under limited memory conditions (...
sobolevn [Fri, 26 Jun 2026 11:41:55 +0000 (14:41 +0300)] 
gh-152156: Fix a crash in `interpeters.create` under limited memory conditions (#152163)

4 days agogh-152246: Fix pure-Python `zoneinfo` accepting invalid seperators in POSIX TZ rules...
tonghuaroot (童话) [Fri, 26 Jun 2026 11:39:26 +0000 (19:39 +0800)] 
gh-152246: Fix pure-Python `zoneinfo` accepting invalid seperators in POSIX TZ rules (#152247)

Co-authored-by: Stan Ulbrych <stan@python.org>
4 days agogh-152233: Add curses complexstr type and wide-character cell-array methods (GH-152262)
Serhiy Storchaka [Fri, 26 Jun 2026 11:37:30 +0000 (14:37 +0300)] 
gh-152233: Add curses complexstr type and wide-character cell-array methods (GH-152262)

Add the immutable curses.complexstr type, an array of styled wide-character
cells -- the string counterpart of complexchar.  It is constructible from an
iterable of cells (each a complexchar or a str) or from a string split into
cells, with optional attr and pair applied to every cell.  It is an immutable
sequence (indexing yields a complexchar, slicing and concatenation yield a
complexstr), is hashable, and str() returns its cells' text.

Add the window method in_wchstr(), the wide-character counterpart of instr()
and in_wstr() that keeps each cell's attributes and color pair instead of
stripping them; it returns a complexstr.

The methods addstr(), addnstr(), insstr() and insnstr() now also accept a
complexstr, so a run read with in_wchstr() can be written back unchanged.  The
cells carry their own rendition, so combining one with an explicit attr raises
TypeError.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
4 days agogh-95555: Allow a negated property as a character set member (GH-152245)
Serhiy Storchaka [Fri, 26 Jun 2026 11:15:12 +0000 (14:15 +0300)] 
gh-95555: Allow a negated property as a character set member (GH-152245)

A negated multi-range property such as \P{ASCII} or \P{Pattern_Syntax} was
rejected inside a character class.  Such members are now alternated in with
the other members: [\P{ASCII}abc] becomes [abc] | [^ASCII], and [\P{ASCII}]
alone is just the negated charset.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
4 days agogh-152100: Fuse set-operation character classes into a single charset (GH-152214)
Serhiy Storchaka [Fri, 26 Jun 2026 11:12:46 +0000 (14:12 +0300)] 
gh-152100: Fuse set-operation character classes into a single charset (GH-152214)

Add a compile-time optimization pass (Lib/re/_optimizer.py) that rewrites
set-operation character classes into a single character set where the
engine's charset() representation allows it.  charset() treats every NEGATE
as a polarity toggle, so a mid-list NEGATE expresses set difference and a
flat run expresses union.

Set difference -- [A--B], emitted by the parser as A(?<![B]) -- fuses into
the charset [NEGATE] B [NEGATE] A, matching A minus B in one test instead of
a charset match plus a lookbehind rescan.  _optimize_charset is made
segment-aware so the interior NEGATE compiles correctly.

A union with a non-flat operand, such as [0-9||[a-z--b]], is emitted by the
parser as a BRANCH that it cannot merge.  Once its alternatives are all
one-character matchers, their item lists are concatenated into a single IN.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
4 days agogh-152233: Add curses complexchar type and wide-character cell reads (GH-152250)
Serhiy Storchaka [Fri, 26 Jun 2026 10:49:17 +0000 (13:49 +0300)] 
gh-152233: Add curses complexchar type and wide-character cell reads (GH-152250)

Add the immutable `curses.complexchar` type: a styled wide-character cell — a spacing character optionally followed by combining characters, plus attributes and a color pair. The color pair is stored separately rather than packed into a `chtype` via `COLOR_PAIR()`, so it is not limited to the values that fit alongside the attribute bits. `str(cc)` returns the text; the read-only `attr` and `pair` attributes return its rendition.

Add the window methods `in_wch()` and `getbkgrnd()` — the wide-character counterparts of `inch()` and `getbkgd()` — which return a `complexchar`. (`inch()`/`getbkgd()` can only return a packed `chtype`, so these fill a real gap; this resolves the long-standing gh-83395 request for `in_wch`.)

The existing character-cell methods (`addch`, `insch`, `echochar`, `bkgd`, `bkgdset`, `border`, `box`, `hline`, `vline`) now also accept a `complexchar`. A `complexchar` already carries its own rendition, so passing one together with an explicit `attr` argument raises `TypeError`.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
4 days agogh-152219: Add curses window attribute get/set methods and WA_* constants (GH-152221)
Serhiy Storchaka [Fri, 26 Jun 2026 04:48:53 +0000 (07:48 +0300)] 
gh-152219: Add curses window attribute get/set methods and WA_* constants (GH-152221)

Add the window methods attr_get(), attr_set(), attr_on(), attr_off() and
color_set(), wrapping wattr_get(), wattr_set(), wattr_on(), wattr_off() and
wcolor_set().  Unlike the legacy attron()/attroff()/attrset() methods, these
pass the color pair as a separate argument instead of packing it into the
attribute value.  Also add the corresponding WA_* attribute constants.

Add an attr_converter that range-checks the attr_t attribute argument and
raises OverflowError instead of silently truncating it; apply it to attr_set(),
attr_on(), attr_off() and chgat().

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
4 days agogh-95555: Support Unicode property escapes \p{...} in regular expressions (GH-151969)
Serhiy Storchaka [Fri, 26 Jun 2026 04:33:33 +0000 (07:33 +0300)] 
gh-95555: Support Unicode property escapes \p{...} in regular expressions (GH-151969)

Add support for \p{property} and \P{property} escapes in Unicode (str)
regular expressions, for the properties the engine can resolve without
the unicodedata database.  They are matched as CATEGORY opcodes or as
fixed sets of character ranges.

Supported in this change: many General_Category values (the groups L, N,
Z, C and the values Lu, Lt, Lm, Nd, Nl, No, Zs, Zl, Zp, Cc, Cf, Cs, Co
and Cn); the binary properties Alphabetic, Lowercase, Uppercase, Numeric,
Printable, XID_Start, XID_Continue, Cased and Case_Ignorable; the POSIX
compatibility classes; the code-point classes ASCII, Any, Assigned,
Noncharacter_Code_Point, Join_Control, Pattern_Syntax and
Pattern_White_Space; and Regional_Indicator, ASCII_Hex_Digit and
Hex_Digit.

Property and value names use loose matching (UAX #44 UAX44-LM3), so a
property may be spelled \p{Lu}, \p{gc=Lu} or \p{name=yes}.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
4 days agogh-152235: Defer GC tracking of set and frozenset to end of construction (gh-152237)
Donghee Na [Fri, 26 Jun 2026 02:34:13 +0000 (11:34 +0900)] 
gh-152235: Defer GC tracking of set and frozenset to end of construction (gh-152237)

5 days agogh-151722: Do not track the frozendict in the GC in _PyDict_FromKeys() (#152067)
Victor Stinner [Thu, 25 Jun 2026 18:06:07 +0000 (20:06 +0200)] 
gh-151722: Do not track the frozendict in the GC in _PyDict_FromKeys() (#152067)

_PyDict_FromKeys() now creates a frozendict copy which is
not tracked by the GC.

dict_merge() no longer requires the dictionary to be tracked by the
GC.

Co-authored-by: Donghee Na <donghee.na@python.org>
Co-authored-by: Inada Naoki <songofacandy@gmail.com>
5 days agogh-151593: Fix dead lock in PyDict insert_split_key() (#152200)
Victor Stinner [Thu, 25 Jun 2026 17:58:27 +0000 (19:58 +0200)] 
gh-151593: Fix dead lock in PyDict insert_split_key() (#152200)

Do not hold LOCK_KEYS() lock when calling PyType_Modified() to avoid
a deadlock.

Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
5 days agogh-151929: Add pythoninfo commands to Platforms/WASI (#152136)
Victor Stinner [Thu, 25 Jun 2026 17:15:45 +0000 (19:15 +0200)] 
gh-151929: Add pythoninfo commands to Platforms/WASI (#152136)

The "build" command now also runs "pythoninfo-build" and
"pythoninfo-host" commands.

If no subcommand is provided, display the help.

GitHub Action "WASI":

* Add "pythoninfo-build" and "pythoninfo-host" commands.
* Remove unused and outdated CROSS_BUILD_PYTHON environment variable.

5 days agogh-151929: Add pythoninfo-build command to Platforms/emscripten (#152210)
Victor Stinner [Thu, 25 Jun 2026 16:32:37 +0000 (18:32 +0200)] 
gh-151929: Add pythoninfo-build command to Platforms/emscripten (#152210)

* Add also "pythoninfo-host" command.
* Add pythoninfo to the "build" command.

5 days agogh-148825: Fix build error if specialization is disabled (#148826)
Marc Mueller [Thu, 25 Jun 2026 14:06:22 +0000 (16:06 +0200)] 
gh-148825: Fix build error if specialization is disabled (#148826)

5 days agoDon't require `_testcapi` for `test_code` (#152185)
Shahar Naveh [Thu, 25 Jun 2026 13:33:36 +0000 (16:33 +0300)] 
Don't require `_testcapi` for `test_code` (#152185)

Co-authored-by: Stan Ulbrych <stan@python.org>
5 days agogh-152168: Don't skip `test_bigmem` if `_testcapi` is missing (#152171)
Shahar Naveh [Thu, 25 Jun 2026 13:30:49 +0000 (16:30 +0300)] 
gh-152168: Don't skip `test_bigmem` if `_testcapi` is missing (#152171)

5 days agogh-151929: Get uptime on BSD/macOS in pythoninfo (#152189)
Victor Stinner [Thu, 25 Jun 2026 13:11:17 +0000 (15:11 +0200)] 
gh-151929: Get uptime on BSD/macOS in pythoninfo (#152189)

* Check sysctlbyname() function and sys/sysctl.h header in
  configure.
* Add _testcapi.uptime_bsd() function.

5 days agogh-127802: Schedule removal of legacy tkinter variable trace methods in 3.17 (GH...
Serhiy Storchaka [Thu, 25 Jun 2026 12:05:46 +0000 (15:05 +0300)] 
gh-127802: Schedule removal of legacy tkinter variable trace methods in 3.17 (GH-152012)

The tkinter.Variable methods trace_variable(), trace(), trace_vdelete()
and trace_vinfo(), deprecated since Python 3.14, are now scheduled for
removal in Python 3.17.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
5 days agogh-151929: Get machine ID and uptime on Windows in pythoninfo (#152146)
Victor Stinner [Thu, 25 Jun 2026 12:02:53 +0000 (14:02 +0200)] 
gh-151929: Get machine ID and uptime on Windows in pythoninfo (#152146)

* Replace "linux." prefix with "system." in pythoninfo.
* Add _winapi.GetTickCount64() function.

5 days agogh-51067: Refactor duplicated logic in `zipfile` to `_read_local_file_header` helper...
Danny Lin [Thu, 25 Jun 2026 11:58:28 +0000 (19:58 +0800)] 
gh-51067: Refactor duplicated logic in `zipfile` to `_read_local_file_header` helper (#152139)

5 days agogh-151126: Add missing `PyErr_NoMemory` in `_winapi.c` (#151588)
Ivy Xu [Thu, 25 Jun 2026 10:47:25 +0000 (18:47 +0800)] 
gh-151126: Add missing `PyErr_NoMemory` in `_winapi.c` (#151588)

Co-authored-by: sobolevn <mail@sobolevn.me>
5 days agogh-151126: Fix missing `PyErr_NoMemory` in `testinternalcapi.c` (#152177)
sobolevn [Thu, 25 Jun 2026 09:48:23 +0000 (12:48 +0300)] 
gh-151126: Fix missing `PyErr_NoMemory` in `testinternalcapi.c` (#152177)

5 days agogh-152079: Fix `_datetime.fromisoformat()` mishandling a sub-second tz offset (#152087)
tonghuaroot (童话) [Thu, 25 Jun 2026 09:15:28 +0000 (17:15 +0800)] 
gh-152079: Fix `_datetime.fromisoformat()` mishandling a sub-second tz offset (#152087)

Co-authored-by: Stan Ulbrych <stan@python.org>
5 days agogh-151126: Fix missing memory errors in `_interpretersmodule.c` (#151624)
stevens [Thu, 25 Jun 2026 09:02:00 +0000 (17:02 +0800)] 
gh-151126: Fix missing memory errors in `_interpretersmodule.c` (#151624)

5 days agogh-152100: Move re compiler optimizations to Lib/re/_optimizer.py (GH-152154)
Serhiy Storchaka [Thu, 25 Jun 2026 08:09:56 +0000 (11:09 +0300)] 
gh-152100: Move re compiler optimizations to Lib/re/_optimizer.py (GH-152154)

Move the compile-time optimizations (_optimize_charset, _compile_charset,
_simple, _compile_info and the literal/charset prefix helpers) out of
_compiler.py into a new Lib/re/_optimizer.py.  _compiler.py keeps only the
bytecode emitter and imports them.  This is groundwork for a follow-up
optimization; there is no behavior change.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
5 days agogh-152100: Support set operations in character classes (GH-152153)
Serhiy Storchaka [Thu, 25 Jun 2026 07:09:41 +0000 (10:09 +0300)] 
gh-152100: Support set operations in character classes (GH-152153)

Implement set difference [A--B], intersection [A&&B] and union [A||B] in
regular expression character classes (Unicode Technical Standard #18),
including nested, complemented and compound set operands.  Symmetric
difference [A~~B] remains reserved.

Also use the new syntax in the standard library (_strptime, textwrap,
doctest, pkgutil).

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
5 days agogh-151763: Fix crash in `_interpqueues.create` on `MemoryError` (#152131)
sobolevn [Thu, 25 Jun 2026 07:04:02 +0000 (10:04 +0300)] 
gh-151763: Fix crash in `_interpqueues.create` on `MemoryError` (#152131)

5 days agogh-151929: Get boot ID, machine ID and uptime in test.pythoninfo (#152127)
Victor Stinner [Wed, 24 Jun 2026 23:30:51 +0000 (01:30 +0200)] 
gh-151929: Get boot ID, machine ID and uptime in test.pythoninfo (#152127)

GHA: Run test.pythoninfo on the "Cross build Linux" job.

5 days agogh-152093: Fix test_tk_caret() on macOS (GH-152115)
Serhiy Storchaka [Wed, 24 Jun 2026 21:36:57 +0000 (00:36 +0300)] 
gh-152093: Fix test_tk_caret() on macOS (GH-152115)

macOS records the caret only for the key window, so the query reads back
zeros instead of the values set in the test.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
6 days agogh-105895: Add `match` and `case` doc to `help()` (#152113)
sobolevn [Wed, 24 Jun 2026 21:31:57 +0000 (00:31 +0300)] 
gh-105895: Add `match` and `case` doc to `help()` (#152113)

Co-authored-by: dzherb <zherbin.dima@yandex.ru>
Co-authored-by: Stan Ulbrych <stan@python.org>
6 days agogh-151776: Add curses state-query functions (GH-151778)
Serhiy Storchaka [Wed, 24 Jun 2026 19:31:50 +0000 (22:31 +0300)] 
gh-151776: Add curses state-query functions (GH-151778)

Add window methods and module functions that report curses state which could
previously only be set: the window getters is_cleared(), is_idcok(),
is_idlok(), is_immedok(), is_keypad(), is_leaveok(), is_nodelay(),
is_notimeout(), is_pad(), is_scrollok(), is_subwin(), is_syncok(),
getdelay(), getparent() and getscrreg(), and the functions is_cbreak(),
is_echo(), is_nl() and is_raw().  They are available when built against an
ncurses with NCURSES_EXT_FUNCS.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
6 days agoAdd Jacob to CODEOWNERS for Infra/GHA/CI (#152112)
Jacob Coffee [Wed, 24 Jun 2026 19:12:01 +0000 (21:12 +0200)] 
Add Jacob to CODEOWNERS for Infra/GHA/CI  (#152112)

6 days agogh-151774: Add curses dynamic color-pair functions (GH-151775)
Serhiy Storchaka [Wed, 24 Jun 2026 18:24:11 +0000 (21:24 +0300)] 
gh-151774: Add curses dynamic color-pair functions (GH-151775)

Add alloc_pair(), find_pair(), free_pair() and reset_color_pairs(),
wrapping the ncurses extended-color dynamic pair management.  They are
available only when built against a wide-character ncurses with
extended-color support.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
6 days agogh-86726: Improve the structure of the tkinter reference (GH-152109)
Serhiy Storchaka [Wed, 24 Jun 2026 18:10:16 +0000 (21:10 +0300)] 
gh-86726: Improve the structure of the tkinter reference (GH-152109)

Add short group intros before each cluster of Misc methods.
Group the Tk and Toplevel classes in a new "Toplevel widgets" section, move
the Tcl() function to the module-level functions, and move the "File
handlers" section into the reference.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
6 days agoRe-raise unexpected exceptions instead of swallowing them in various tests (#152019)
An Long [Wed, 24 Jun 2026 16:26:34 +0000 (01:26 +0900)] 
Re-raise unexpected exceptions instead of swallowing them in various tests (#152019)

Co-authored-by: Stan Ulbrych <stan@python.org>
6 days agogh-151955: Allow more ParamSpec and TypeVarTuple bounds (#151956)
Jelle Zijlstra [Wed, 24 Jun 2026 16:10:10 +0000 (09:10 -0700)] 
gh-151955: Allow more ParamSpec and TypeVarTuple bounds (#151956)

6 days agogh-151763: Fix NULL dereference in `os._path_normpath()` under OOM (#151779)
Zain Nadeem [Wed, 24 Jun 2026 15:56:10 +0000 (20:56 +0500)] 
gh-151763: Fix NULL dereference in `os._path_normpath()` under OOM (#151779)

6 days agogh-151485: Fix command quoting in subprocess.CalledProcessError.__str__ (#151486)
Benjy Wiener [Wed, 24 Jun 2026 14:11:02 +0000 (17:11 +0300)] 
gh-151485: Fix command quoting in subprocess.CalledProcessError.__str__ (#151486)

CalledProcessError previously formatted cmd as `"... '%s' ..."`. This lead to
unbalanced quoting when cmd contains single-quotes or, more commonly, when cmd
is a list. This change updates the relevant format strings to use %r instead.

Co-authored-by: Benjy Wiener <benjywiener@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
6 days agogh-90949: Fix copy-paste typo in pyexpat capsule API initialization (#151147)
Stan Ulbrych [Wed, 24 Jun 2026 14:10:46 +0000 (15:10 +0100)] 
gh-90949: Fix copy-paste typo in pyexpat capsule API initialization (#151147)

6 days ago`valgrind-python.supp`: Update suppression for readline leaks (#151783)
Stan Ulbrych [Wed, 24 Jun 2026 13:54:33 +0000 (14:54 +0100)] 
`valgrind-python.supp`: Update suppression for readline leaks (#151783)

6 days agogh-151496: Use process groups in TraceBackend in test_dtrace (#152039)
stratakis [Wed, 24 Jun 2026 13:46:56 +0000 (15:46 +0200)] 
gh-151496: Use process groups in TraceBackend in test_dtrace (#152039)

Run the generic DTrace/SystemTap commands in a new process group and
terminate the whole group on timeout.

This prevents a forked tracer child from keeping stdout/stderr pipes
open after the direct tracer process is killed.

6 days agogh-152060: Fix `_pydatetime.fromisoformat()` raising `AssertionError` on invalid...
tonghuaroot (童话) [Wed, 24 Jun 2026 13:40:46 +0000 (21:40 +0800)] 
gh-152060: Fix `_pydatetime.fromisoformat()` raising `AssertionError` on invalid lengths (#152061)

6 days agogh-151456: Document the show_jit parameter in dis (#151457)
Shardul Deshpande [Wed, 24 Jun 2026 13:05:37 +0000 (18:35 +0530)] 
gh-151456: Document the show_jit parameter in dis (#151457)

show_jit was added to dis.dis(), distb(), disassemble(), get_instructions() and the Bytecode class (gh-150478) but was never documented. Document it across those APIs with a versionchanged:: 3.16 note, and fix a pre-existing show_offset -> show_offsets typo in the distb signature.

6 days agogh-152020: Fix `asyncio.all_tasks()` loosing eager tasks on FT-build (#152022)
Timofei [Wed, 24 Jun 2026 12:21:42 +0000 (15:21 +0300)] 
gh-152020: Fix `asyncio.all_tasks()` loosing eager tasks on FT-build (#152022)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
6 days agogh-151814: Fix unbounded memory growth from repeated empty writes to `io.TextIOWrappe...
Stan Ulbrych [Wed, 24 Jun 2026 11:47:52 +0000 (12:47 +0100)] 
gh-151814: Fix unbounded memory growth from repeated empty writes to `io.TextIOWrapper` (#151817)

6 days agogh-151763: Fix possible crash on `CodeType` deallocation (#152034)
sobolevn [Wed, 24 Jun 2026 11:46:39 +0000 (14:46 +0300)] 
gh-151763: Fix possible crash on `CodeType` deallocation (#152034)

6 days agogh-90092: Support multiple terminals in the curses module (GH-151748)
Serhiy Storchaka [Wed, 24 Jun 2026 11:33:02 +0000 (14:33 +0300)] 
gh-90092: Support multiple terminals in the curses module (GH-151748)

Add the X/Open Curses SCREEN API for driving more than one terminal:
newterm() and set_term(), plus the ncurses extension new_prescr().

A new screen object wraps the C SCREEN.  It exposes the terminal's
standard window as screen.stdscr.  Each window keeps a reference to its
screen (like a subwindow does to its parent window), so the screen is
deleted automatically once it and all of its windows are unreferenced.

The ncurses use_screen()/use_window() locking helpers are exposed as
the screen.use() and window.use() methods.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
6 days agogh-151757: Fix curses wide-character tests in non-UTF-8 locales (GH-152062)
Serhiy Storchaka [Wed, 24 Jun 2026 11:16:44 +0000 (14:16 +0300)] 
gh-151757: Fix curses wide-character tests in non-UTF-8 locales (GH-152062)

wcwidth() only classifies combining characters in a locale that can
encode them, so guard the wide-character test operations on encodability.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
6 days agogh-140550: Docs additions & fixups for PEP 793 (GH-151661)
Petr Viktorin [Wed, 24 Jun 2026 11:15:25 +0000 (13:15 +0200)] 
gh-140550: Docs additions & fixups for PEP 793 (GH-151661)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
6 days agogh-152056: Compile single-category character sets to a bare CATEGORY opcode (GH-152057)
Pieter Eendebak [Wed, 24 Jun 2026 11:09:50 +0000 (13:09 +0200)] 
gh-152056: Compile single-category character sets to a bare CATEGORY opcode (GH-152057)

A character set containing exactly one category, e.g. [\d] or [^\s], now
compiles to a single CATEGORY opcode (like \d or \S) instead of an IN
block.  The negated form maps to the complementary category.  This speeds
up matching and reduces the size of the compiled byte code.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
6 days agoCapitalize first word in `unittest.mock.assert_*` docs and docstrings (#151951)
Hans Yu [Wed, 24 Jun 2026 10:07:21 +0000 (12:07 +0200)] 
Capitalize first word in `unittest.mock.assert_*` docs and docstrings (#151951)