]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
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>
3 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>
3 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.

3 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)

3 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>
3 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>
3 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)

3 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>
3 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>
3 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>
3 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)

3 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)

3 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>
3 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.

3 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>
3 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)

3 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>
3 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>
3 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>
3 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>
3 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)

4 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>
4 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>
4 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.

4 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.

4 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)

4 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>
4 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)

4 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.

4 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>
4 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.

4 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)

4 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>
5 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>
5 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>
5 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)

5 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>
5 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>
5 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>
5 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)

5 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)

5 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>
5 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)

5 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)

5 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.

5 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)

5 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.

5 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>
5 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)

5 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)

5 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>
5 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>
5 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>
5 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>
5 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)

6 days agogh-84008: Document that the LC_NUMERIC locale affects tkinter numeric widgets (GH...
Serhiy Storchaka [Wed, 24 Jun 2026 06:30:17 +0000 (09:30 +0300)] 
gh-84008: Document that the LC_NUMERIC locale affects tkinter numeric widgets (GH-152008)

Spinbox, Scale and ttk.Spinbox format floating-point values according to
the LC_NUMERIC locale, but such values are always parsed with a period, so
a comma-decimal locale breaks DoubleVar.get().

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
6 days agogh-87904: Document curses classes (GH-151643)
Serhiy Storchaka [Wed, 24 Jun 2026 06:08:34 +0000 (09:08 +0300)] 
gh-87904: Document curses classes (GH-151643)

Add docstrings for the curses.window, curses.error, curses.panel.panel
and curses.panel.error classes.  Document the panel class and its error
exception in curses.panel.rst, using the real lowercase panel name.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
6 days agogh-126219: Fix crash in tkinter.Tk with non-BMP className on Tcl/Tk 8.x (GH-151980)
Serhiy Storchaka [Wed, 24 Jun 2026 05:59:42 +0000 (08:59 +0300)] 
gh-126219: Fix crash in tkinter.Tk with non-BMP className on Tcl/Tk 8.x (GH-151980)

Tcl 8.x crashes when title-casing a non-BMP character during Tk
initialization, so such a className is now rejected with a ValueError.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
6 days agogh-151757: Support wide and combining characters in the curses module (GH-151758)
Serhiy Storchaka [Wed, 24 Jun 2026 05:52:10 +0000 (08:52 +0300)] 
gh-151757: Support wide and combining characters in the curses module (GH-151758)

The character-cell window methods now accept a full character cell -- a
spacing character optionally followed by combining characters (up to
CCHARW_MAX wide characters) -- in addition to a single int or byte
character.  This affects addch(), bkgd(), bkgdset(), border(), box(),
echochar(), hline(), insch() and vline(); they dispatch to the ncursesw
wide-character functions (wadd_wch(), wbkgrnd(), wborder_set(),
wecho_wchar(), whline_set(), wins_wch(), wvline_set(), ...) when given a
string.  border() and box() cannot mix integer or byte characters with
wide string characters in a single call.  A cell is one spacing character
optionally followed by combining characters, so an extra spacing or
control character (such as "ab") is rejected with ValueError rather than
being silently truncated by setcchar().

Also add the wide-character read methods get_wstr() and in_wstr(), the
counterparts of getstr() and instr() that return a str rather than a
bytes object, and the module functions erasewchar(), killwchar() and
wunctrl(), the wide-character counterparts of erasechar(), killchar()
and unctrl().

All of this is available only when built against the wide-character
ncursesw library.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
6 days agogh-152033: Optimize category escapes outside character sets (GH-152035)
Serhiy Storchaka [Wed, 24 Jun 2026 05:49:14 +0000 (08:49 +0300)] 
gh-152033: Optimize category escapes outside character sets (GH-152035)

Character class escapes (``\d``, ``\D``, ``\s``, ``\S``, ``\w`` and
``\W``) that occur outside a character set are now compiled directly to a
single CATEGORY opcode instead of being wrapped in an IN block.  This
removes the IN wrapper (three code words) and an indirect charset() call,
and makes such an escape a simple repeatable unit so that, for example,
``\d+`` uses the REPEAT_ONE fast path; a CATEGORY case is added to
SRE(count).

The transformation preserves behaviour exactly.  For category-heavy
patterns the compiled byte code is about 20% smaller and matching is up
to ~2x faster, with no effect on patterns that do not use bare category
escapes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
6 days agogh-150994: _colorize: modernize typing imports (#151018)
Jelle Zijlstra [Wed, 24 Jun 2026 02:58:00 +0000 (19:58 -0700)] 
gh-150994: _colorize: modernize typing imports (#151018)

6 days agogh-151842: Fix crash upon OOM in `_interpreters.capture_exception` (GH-151843)
Amrutha [Tue, 23 Jun 2026 20:31:47 +0000 (02:01 +0530)] 
gh-151842: Fix crash upon OOM in `_interpreters.capture_exception` (GH-151843)

6 days agogh-150565: Add additional tests for Lazy Imports (#149739)
Brittany Reynoso [Tue, 23 Jun 2026 20:15:11 +0000 (13:15 -0700)] 
gh-150565: Add additional tests for Lazy Imports (#149739)

Add lazy import tests ported from internal test suite

6 days agogh-151126: Add missing `PyErr_NoMemory()` in `type_from_slots_or_spec` (#151582)
Ivy Xu [Tue, 23 Jun 2026 14:48:11 +0000 (22:48 +0800)] 
gh-151126: Add missing `PyErr_NoMemory()` in `type_from_slots_or_spec` (#151582)

Co-authored-by: Stan Ulbrych <stan@python.org>
6 days agogh-151773: Fix NULL dereference in `PyContextVar_Set` (#151836)
dev [Tue, 23 Jun 2026 14:15:15 +0000 (19:45 +0530)] 
gh-151773: Fix NULL dereference in `PyContextVar_Set` (#151836)

6 days agogh-143927: Normalize all line endings (CR, CRLF, and LF) in configparser (GH-143929)
Seth Larson [Tue, 23 Jun 2026 13:33:51 +0000 (08:33 -0500)] 
gh-143927: Normalize all line endings (CR, CRLF, and LF) in configparser (GH-143929)

6 days agogh-151558: Fix symlink escape via `tarfile` hardlink-extraction fallback (GH-151559)
Stan Ulbrych [Tue, 23 Jun 2026 13:31:38 +0000 (14:31 +0100)] 
gh-151558: Fix symlink escape via `tarfile` hardlink-extraction fallback (GH-151559)

6 days agogh-151981: Make tarfile._Stream.seek break at EOF (GH-151982)
Petr Viktorin [Tue, 23 Jun 2026 13:13:30 +0000 (15:13 +0200)] 
gh-151981: Make tarfile._Stream.seek break at EOF (GH-151982)

Co-authored-by: Stan Ulbrych <stan@python.org>
6 days agogh-151556: Show example CSV file content in the `csv` module docs (#151563)
Lucas [Tue, 23 Jun 2026 12:01:21 +0000 (09:01 -0300)] 
gh-151556: Show example CSV file content in the `csv` module docs (#151563)

Co-authored-by: Stan Ulbrych <stan@python.org>
6 days agoClarify `multiprocessing.Queue.get_nowait()` documentation (#150863)
Jack Harper [Tue, 23 Jun 2026 11:29:20 +0000 (12:29 +0100)] 
Clarify `multiprocessing.Queue.get_nowait()` documentation (#150863)

7 days agogh-151497: Avoid huge pre-allocation for oversized tarfile extended headers (GH-151498)
Shardul Deshpande [Tue, 23 Jun 2026 09:32:31 +0000 (15:02 +0530)] 
gh-151497: Avoid huge pre-allocation for oversized tarfile extended headers (GH-151498)

tarfile reads a member's extended header (a GNU long name/link or a pax
header) with a single read sized by the header's size field:

    buf = tarfile.fileobj.read(self._block(self.size))

The size is taken from the archive and is not validated, so a ~512-byte
crafted file can claim several gigabytes (or, via base-256 encoding, far
more) and make read() pre-allocate that much memory -- on open/iterate,
before any extraction filter runs.

Read the extended-header data in bounded chunks instead, so an oversized
or truncated header can no longer force a huge allocation. The bytes
returned for valid archives are unchanged.

7 days agogh-59396: Modernize tkinter.simpledialog (GH-151848)
Serhiy Storchaka [Tue, 23 Jun 2026 08:01:10 +0000 (11:01 +0300)] 
gh-59396: Modernize tkinter.simpledialog (GH-151848)

Rework SimpleDialog and Dialog to match the look and feel of the native Tk
dialogs ::tk_dialog and ::tk::MessageBox.

* SimpleDialog is a Python port of ::tk_dialog and Dialog a base class
  modelled on ::tk::MessageBox.  Both adopt the message-box keyboard
  conventions: button accelerators, a default ring that follows the keyboard
  focus, and a <Return> binding that invokes the focused button.
* Both classes gain a use_ttk parameter that selects the classic Tk or the
  themed ttk widgets.  It controls the widget set and the appearance that the
  two procedures style differently, but not the keyboard behaviour.
* Update _place_window with the Tk 9.1 placement refinements.
* The new helpers _temp_grab_focus (a modal grab/focus context manager),
  _underline_ampersand and _find_alt_key_target (ports of the Tk
  accelerator-key procedures) can be reused by other tkinter dialogs, as
  _setup_dialog already is.
* Fix several defects uncovered while comparing with the Tcl sources.
* Improve the simpledialog demo.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
7 days agogh-101284: Allow passing Menubutton options to tkinter.OptionMenu (GH-151959)
Serhiy Storchaka [Tue, 23 Jun 2026 06:24:17 +0000 (09:24 +0300)] 
gh-101284: Allow passing Menubutton options to tkinter.OptionMenu (GH-151959)

Arbitrary keyword arguments are now forwarded to the underlying
Menubutton and can override OptionMenu's default appearance options.
The positional API is unchanged.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
7 days agogh-151678: Add tests for ttk Menubutton and OptionMenu widget options (GH-151960)
Serhiy Storchaka [Tue, 23 Jun 2026 06:17:16 +0000 (09:17 +0300)] 
gh-151678: Add tests for ttk Menubutton and OptionMenu widget options (GH-151960)

Decorate ttk.MenubuttonTest with add_configure_tests() and make
ttk.OptionMenuTest inherit it to cover the standard widget options.

7 days agogh-75666: Fix a reference leak in tkinter event bindings (GH-151808)
Serhiy Storchaka [Tue, 23 Jun 2026 03:59:25 +0000 (06:59 +0300)] 
gh-75666: Fix a reference leak in tkinter event bindings (GH-151808)

The Tcl commands created for event callbacks are now deleted when a
binding is replaced or unbound, instead of being leaked.

7 days agogh-151722: Defer GC tracking of frozendict to end of construction (gh-151740)
Donghee Na [Mon, 22 Jun 2026 23:45:55 +0000 (08:45 +0900)] 
gh-151722: Defer GC tracking of frozendict to end of construction (gh-151740)

7 days agoGH-150605: use windows-2025 in GitHub Actions (#150606)
Chris Eibl [Mon, 22 Jun 2026 20:21:08 +0000 (22:21 +0200)] 
GH-150605: use windows-2025 in GitHub Actions (#150606)

use windows-2025 in GitHub Actions

7 days agogh-62480: De-personalize docs on using the C API (#151784)
Rafael Weingartner-Ortner [Mon, 22 Jun 2026 20:01:09 +0000 (22:01 +0200)] 
gh-62480: De-personalize docs on using the C API (#151784)

Co-authored-by: Stan Ulbrych <stan@python.org>
7 days agogh-151920: Add the ttk.Style.theme_styles() method (GH-151921)
Serhiy Storchaka [Mon, 22 Jun 2026 17:43:43 +0000 (20:43 +0300)] 
gh-151920: Add the ttk.Style.theme_styles() method (GH-151921)

Wrap the Tk 9.0 ``ttk::style theme styles ?themeName?`` subcommand as
ttk.Style.theme_styles(themename=None), returning the list of styles
defined in a theme (the current theme if themename is omitted).

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>