Commit graph

131963 commits

Author SHA1 Message Date
Victor Stinner
bef5706222
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>
2026-06-25 19:58:27 +02:00
Victor Stinner
7c8163719c
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.
2026-06-25 19:15:45 +02:00
Victor Stinner
7676427cd8
gh-151929: Add pythoninfo-build command to Platforms/emscripten (#152210)
* Add also "pythoninfo-host" command.
* Add pythoninfo to the "build" command.
2026-06-25 16:32:37 +00:00
Marc Mueller
56ae0b8e4f
gh-148825: Fix build error if specialization is disabled (#148826) 2026-06-25 14:06:22 +00:00
Shahar Naveh
11c241e1a8
Don't require _testcapi for test_code (#152185)
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-25 14:33:36 +01:00
Shahar Naveh
6a82832a0b
gh-152168: Don't skip test_bigmem if _testcapi is missing (#152171) 2026-06-25 14:30:49 +01:00
Victor Stinner
b6d89edc4a
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.
2026-06-25 13:11:17 +00:00
Serhiy Storchaka
deeae2ac07
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>
2026-06-25 15:05:46 +03:00
Victor Stinner
f9910519af
gh-151929: Get machine ID and uptime on Windows in pythoninfo (#152146)
* Replace "linux." prefix with "system." in pythoninfo.
* Add _winapi.GetTickCount64() function.
2026-06-25 12:02:53 +00:00
Danny Lin
2b3ea68ceb
gh-51067: Refactor duplicated logic in zipfile to _read_local_file_header helper (#152139) 2026-06-25 12:58:28 +01:00
Ivy Xu
a580029f11
gh-151126: Add missing PyErr_NoMemory in _winapi.c (#151588)
Co-authored-by: sobolevn <mail@sobolevn.me>
2026-06-25 10:47:25 +00:00
sobolevn
a0093282ea
gh-151126: Fix missing PyErr_NoMemory in testinternalcapi.c (#152177) 2026-06-25 09:48:23 +00:00
tonghuaroot (童话)
6f9c76d8d8
gh-152079: Fix _datetime.fromisoformat() mishandling a sub-second tz offset (#152087)
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-25 10:15:28 +01:00
stevens
05225aa06a
gh-151126: Fix missing memory errors in _interpretersmodule.c (#151624) 2026-06-25 12:02:00 +03:00
Serhiy Storchaka
a00464bc33
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>
2026-06-25 08:09:56 +00:00
Serhiy Storchaka
bd4bd3e76a
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>
2026-06-25 10:09:41 +03:00
sobolevn
a6c2d4ae3b
gh-151763: Fix crash in _interpqueues.create on MemoryError (#152131) 2026-06-25 07:04:02 +00:00
Victor Stinner
3db3bba4d1
gh-151929: Get boot ID, machine ID and uptime in test.pythoninfo (#152127)
GHA: Run test.pythoninfo on the "Cross build Linux" job.
2026-06-24 23:30:51 +00:00
Serhiy Storchaka
b41dc4ac63
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>
2026-06-25 00:36:57 +03:00
sobolevn
1d55b3778c
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>
2026-06-24 21:31:57 +00:00
Serhiy Storchaka
a52f428fba
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>
2026-06-24 22:31:50 +03:00
Jacob Coffee
e0909f0f09
Add Jacob to CODEOWNERS for Infra/GHA/CI (#152112) 2026-06-24 20:12:01 +01:00
Serhiy Storchaka
3cd4283ba6
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>
2026-06-24 21:24:11 +03:00
Serhiy Storchaka
c7faa6936e
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>
2026-06-24 21:10:16 +03:00
An Long
6c3da17d1f
Re-raise unexpected exceptions instead of swallowing them in various tests (#152019)
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-24 17:26:34 +01:00
Jelle Zijlstra
0fb82b46df
gh-151955: Allow more ParamSpec and TypeVarTuple bounds (#151956) 2026-06-24 09:10:10 -07:00
Zain Nadeem
ce8b81fff4
gh-151763: Fix NULL dereference in os._path_normpath() under OOM (#151779) 2026-06-24 16:56:10 +01:00
Benjy Wiener
b35c37910a
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>
2026-06-24 16:11:02 +02:00
Stan Ulbrych
15696a69d6
gh-90949: Fix copy-paste typo in pyexpat capsule API initialization (#151147) 2026-06-24 15:10:46 +01:00
Stan Ulbrych
28b63d301d
valgrind-python.supp: Update suppression for readline leaks (#151783) 2026-06-24 13:54:33 +00:00
stratakis
1785f4b35f
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.
2026-06-24 13:46:56 +00:00
tonghuaroot (童话)
ff781d52d4
gh-152060: Fix _pydatetime.fromisoformat() raising AssertionError on invalid lengths (#152061) 2026-06-24 14:40:46 +01:00
Shardul Deshpande
f7e5cddcbb
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.
2026-06-24 15:05:37 +02:00
Timofei
ad2cabfccb
gh-152020: Fix asyncio.all_tasks() loosing eager tasks on FT-build (#152022)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-06-24 17:51:42 +05:30
Stan Ulbrych
c61307222e
gh-151814: Fix unbounded memory growth from repeated empty writes to io.TextIOWrapper (#151817) 2026-06-24 12:47:52 +01:00
sobolevn
22dd5b5b37
gh-151763: Fix possible crash on CodeType deallocation (#152034) 2026-06-24 14:46:39 +03:00
Serhiy Storchaka
ac023ea48f
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>
2026-06-24 11:33:02 +00:00
Serhiy Storchaka
793f471767
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>
2026-06-24 11:16:44 +00:00
Petr Viktorin
763cc2209d
gh-140550: Docs additions & fixups for PEP 793 (GH-151661)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2026-06-24 13:15:25 +02:00
Pieter Eendebak
21c4b7359d
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>
2026-06-24 11:09:50 +00:00
Hans Yu
a46db4f8ba
Capitalize first word in unittest.mock.assert_* docs and docstrings (#151951) 2026-06-24 11:07:21 +01:00
Serhiy Storchaka
ee78d4323c
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>
2026-06-24 09:30:17 +03:00
Serhiy Storchaka
560ff8e202
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>
2026-06-24 06:08:34 +00:00
Serhiy Storchaka
124c7cd91b
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>
2026-06-24 08:59:42 +03:00
Serhiy Storchaka
a5677bff84
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>
2026-06-24 08:52:10 +03:00
Serhiy Storchaka
fde4cf862c
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>
2026-06-24 08:49:14 +03:00
Jelle Zijlstra
fcda96fbf3
gh-150994: _colorize: modernize typing imports (#151018) 2026-06-23 19:58:00 -07:00
Amrutha
5e0747db2f
gh-151842: Fix crash upon OOM in _interpreters.capture_exception (GH-151843) 2026-06-23 16:31:47 -04:00
Brittany Reynoso
10d1b63ed8
gh-150565: Add additional tests for Lazy Imports (#149739)
Add lazy import tests ported from internal test suite
2026-06-23 13:15:11 -07:00
Ivy Xu
7928a8b730
gh-151126: Add missing PyErr_NoMemory() in type_from_slots_or_spec (#151582)
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-23 15:48:11 +01:00