131867 Commits

Author SHA1 Message Date
Danny Lin aec0aed197 gh-51067: Add remove() and repack() to ZipFile (GH-134627)
The docs included in the commit do the best job of describing this.

Much discussion on the PR and issue.

thank you to to core team folks jaraco, emmatyping, gpshead, and all others who added their constructive comments along the way.

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2026-06-20 12:45:53 -07:00
tonghuaroot (童话) 1fb874cc07 gh-151770: Fix datetime.fromisoformat() on an out-of-range month w/ a 24:00 time (#151771)
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-20 17:33:16 +01:00
Serhiy Storchaka e51b616eff gh-151678: Add tests for tkinter widget virtual events (GH-151793)
Verify the virtual events that widgets emit in response to user
interaction, driven by generated events: <<ListboxSelect>> (Listbox),
<<Increment>> and <<Decrement>> (ttk Spinbox), and <<TreeviewSelect>>,
<<TreeviewOpen>> and <<TreeviewClose>> (ttk Treeview).

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 14:31:40 +00:00
Serhiy Storchaka 88e5d8a7b7 gh-151675: Add tkinter Text.sync() and Text.pendingsync() (GH-151677)
Wrap the Tk text widget "sync" and "pendingsync" subcommands, which
control and report the synchronization of the displayed view with the
underlying text when line heights have not yet been computed.
2026-06-20 17:11:21 +03:00
Serhiy Storchaka 706238e764 gh-151678: Add interactive tests for tkinter.simpledialog (GH-151794)
Drive the modal query dialogs with generated events to exercise the
<Return> and <Escape> key bindings and the value validation: accepting
an integer, float or string, cancelling, rejecting a non-numeric value
and rejecting a value outside the allowed range.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 13:46:39 +00:00
Serhiy Storchaka aa71eb287f gh-151678: Add tests for the remaining tkinter Misc, Wm and Text methods (GH-151782)
Cover Misc.wait_variable and wait_window, tk_focusFollowsMouse,
selection_handle, the error paths of grab_set_global, send, the
X11-specific Wm methods iconposition, iconmask, iconwindow,
colormapwindows and manage/forget, and the Text.window_config alias and
deprecated yview_pickplace.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 13:42:53 +00:00
Serhiy Storchaka 58fd9ec3cf gh-151678: Add tests for tkinter.filedialog (GH-151781)
Exercise the native dialogs (Open, SaveAs and Directory) through the
_test_callback seam without opening them, and test the pure-Python
FileDialog selection, filter and ok/cancel logic without entering its
modal loop.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 13:21:19 +00:00
Serhiy Storchaka 2a126a534b gh-151678: Add tests for tkinter.dnd (GH-151780)
Drive the drag-and-drop protocol (dnd_start and the DndHandler enter/
motion/commit, leave/cancel and end callbacks).

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 16:08:55 +03:00
Serhiy Storchaka aa5b164577 gh-151674: Add tkinter Text.edit_canundo() and Text.edit_canredo() (GH-151676)
Wrap the Tk text widget "edit canundo" and "edit canredo" subcommands,
which report whether the undo and redo stacks are non-empty.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-20 09:39:09 +03:00
Serhiy Storchaka a9db5cb52f gh-151678: Add tests for tkinter.scrolledtext (GH-151753)
Add a test for the ScrolledText widget, which had no tests: that it is
a Text widget held in a Frame with a Scrollbar, that Text methods work,
that the geometry manager methods are redirected to the frame while
configure is not, and that the scrollbar tracks the text view.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 23:39:34 +00:00
Serhiy Storchaka 66cc048551 gh-151678: Add tests for tkinter font, image, variable, Misc and Wm methods (GH-151751)
* font: copy(), the config alias, the displayof argument of measure and
  metrics, and the errors raised for invalid options and a wrong number
  of arguments;
* image: the cget method and the config alias, and the errors raised by
  transparency_get and transparency_set;
* variable: that initialize is an alias of set and the deprecated trace
  is an alias of trace_variable;
* Misc: tk_focusNext, tk_focusPrev, tk_strictMotif, tk_bisque and
  option_readfile;
* Wm: wm_iconphoto.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 22:45:47 +00:00
Serhiy Storchaka 2e5843e13f gh-151744: Add curses.nofilter() (GH-151747)
Wrap the ncurses nofilter() function, which undoes the effect of
filter().  Without it there is no way to restore normal screen sizing
after a curses.filter() call in the same process.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 17:49:26 +00:00
Serhiy Storchaka 7d4a0aad7b gh-151678: Add tests for tkinter.ttk methods (GH-151736)
Cover previously-untested ttk methods:

* Progressbar.step, start and stop;
* Treeview.parent, next, prev, see and identify_element;
* Style.theme_settings;
* OptionMenu.set_menu.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 18:45:39 +03:00
Serhiy Storchaka 23793ac211 gh-151678: Add tests for tkinter Misc, Wm and geometry manager methods (GH-151732)
Cover previously-untested methods of the Misc, Wm, Pack, Place and Grid
classes:

* a new WinfoTest class for the winfo_* query methods (class, name,
  parent, children, toplevel, visual and screen information, atoms,
  pointer and screen coordinates, fpixels, containing, interps,
  viewable), including the pre-existing winfo_rgb and winfo_pathname;
* in MiscTest: getint, getdouble, getvar, register, deletecommand,
  option_add/get/clear, nametowidget, the focus_*, grab_* and
  selection_own* methods, event_add/delete/info, and bell;
* in WmTest: title, geometry, minsize/maxsize, resizable, aspect, grid,
  positionfrom/sizefrom, focusmodel, iconname, client/command,
  overrideredirect, state (with withdraw and deiconify), frame, group,
  protocol and transient;
* the short-named aliases of the grid_*, pack_* and place_* geometry
  manager methods.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 17:38:32 +03:00
Jonathan J. Helmus c4eb3adbb4 gh-150836: Mount embedded Tk ZIP in _tkinter on Windows (GH-151562)
Tcl/Tk 9 may embed the Tk script library in the Tk DLL on Windows. This embedded library is not found by Tcl by default.

Mount the loaded Tk DLL as a zipfs archive before calling Tk_Init(), so Tk can find its embedded tk_library using its existing library discovery logic.

Preserve Tk_Init()'s normal path if the library is not embedded.
2026-06-19 14:23:01 +00:00
Serhiy Storchaka 64fab74bd7 gh-151693: Make the curses tests portable to other curses implementations (GH-151729)
Make the curses tests portable to other curses implementations

Guard the chgat() check (chgat() needs wchgat()) and stop assuming a
subpad shares the parent pad's cells (implementation-defined in X/Open).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 11:32:02 +00:00
Serhiy Storchaka 93b9e7666f gh-151678: Add tests for the remaining tkinter widgets (GH-151687)
Cover previously-untested methods of several widgets:

* Button, Checkbutton and Radiobutton: invoke, flash and toggle;
* Entry: delete, icursor and the select_* aliases;
* Spinbox: invoke, identify and scan;
* Scale and Scrollbar: identify, and Scrollbar fraction and delta;
* PanedWindow: panes, remove/forget, sash and proxy positioning,
  identify, and adding panes with configuration options.

Also test that invoke does nothing for a disabled button and the
errors raised for invalid indices, coordinates, option names and values.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 13:23:38 +03:00
Serhiy Storchaka b4cfb992ed gh-151693: Add curses tests for panels, textpad, and window behavior (GH-151694)
Add curses tests for panels, textpad, and window behavior

Extend test_curses with behavior-verifying tests that go beyond the
existing smoke tests:

* curses.panel stacking: new_panel/top/bottom/above/below ordering,
  hide/show/hidden, move, replace and userptr round-trip.
* Real-window curses.textpad.Textbox: gather(), edit(), stripspaces,
  insert mode and the Emacs-like editing commands (previously only
  exercised through a MagicMock).
* Window output: addstr cursor advance and addnstr truncation,
  insstr/insnstr shifting without cursor movement, and pad behavior
  (instr, subpad cell sharing, the required 6-argument refresh()).
* Error handling: out-of-range coordinates raising curses.error and
  bad character/string argument types.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 09:35:36 +00:00
Serhiy Storchaka bb127c5a96 gh-151678: Add tests for tkinter.Canvas (GH-151683)
Cover previously-untested Canvas methods in CanvasTest:

* item creation and types, bbox, coordinate conversion, move/scale,
  find and addtag queries, tags, item configuration, stacking order,
  text-item editing, selection, focus, scan and postscript;
* the create_arc, create_oval, create_bitmap, create_image,
  create_text and create_window item creation methods, checking
  coordinates, default and explicit options, valid enumerations and
  rejection of invalid values;
* tag_bind() and tag_unbind(), checking the returned function id and
  binding script, querying bound sequences, the add parameter, event
  delivery to items via a tag, and removal of a single binding by id
  or all bindings for a sequence.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 09:13:41 +00:00
Serhiy Storchaka cf3b3c1148 gh-151678: Add tests for tkinter.Listbox (GH-151686)
Cover previously-untested Listbox methods in ListboxTest: size, delete,
index resolution, nearest, see, activate, and the selection methods
(selection_set/clear/includes/anchor and their select_* aliases),
including the errors raised for invalid indices.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 12:04:10 +03:00
Serhiy Storchaka ef5c32a40b gh-151678: Add tests for tkinter.Menu (GH-151685)
Cover previously-untested Menu methods in MenuTest: adding, inserting and
deleting items of every type, index resolution, invoking items, entry x/y
positions, and post/unpost/tk_popup mapping.

Also test per-entry configuration options and the errors raised for
invalid indices, entry types, option names and option values.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 11:59:14 +03:00
da-woods a5568d0eb7 gh-141510 Add frozendict fast paths to abstract.c (#150692)
Add frozendict to the fast paths of PyMapping_GetOptionalItem(),
PyMapping_Keys(), PyMapping_Values(), and PyMapping_Items().

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2026-06-19 08:41:00 +00:00
Serhiy Storchaka 551f8e16f8 gh-151695: Fix use-after-free of the curses screen encoding (GH-151696)
The module-global curses_screen_encoding stored a borrowed pointer to the
encoding owned by the window returned by the first initscr() call.  That
window can be deallocated while unctrl() and ungetch(), which have no window
of their own, still use the pointer to encode non-ASCII characters.

Keep a private copy of the encoding instead.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 08:38:15 +00:00
Serhiy Storchaka 4ac809e10b gh-151678: Add tests for tkinter.Text (GH-151681)
Cover previously-untested Text methods (indices, content, marks, tags,
undo/redo, dump, embedded images and windows, peers, and geometry) and
the tag, embedded-image and embedded-window configuration options.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 11:38:02 +03:00
Duprat da69fcf98d gh-151427: add 'not macOS' and 'not iOS' restrictions on availability state of some functions in os module. (#151537) 2026-06-19 04:08:53 -04:00
Cody Maloney 9688d252d3 gh-101100: Document os.uname_result and os.statvfs_result with related constants (GH-151301) 2026-06-19 09:50:22 +03:00
Hood Chatham d701f8edbe gh-145177: Bump Emscripten to 6.0.0 (#151611)
Bumps Emscripten to 6.0.0, and fixes related issues in getentropy() and umask().
2026-06-19 07:29:33 +08:00
Donghee Na 17720b184d gh-151229: Add CI to prevent JIT stress test regression (#151647) 2026-06-19 04:57:41 +09:00
mushitoriami 15d74068f3 docs: Fix broken reference of parameter type in library/logging.rst (GH-151645) 2026-06-18 18:45:04 +01:00
Harjoth Khara e99b319682 gh-146353: Document PyBytesWriter_GetData pointer validity (GH-151418) 2026-06-18 12:55:06 -04:00
Serhiy Storchaka bfecfcc2a8 gh-86726: Add few missing versionadded directives (GH-151662)
Pack.pack_content, Place.place_content and Grid.grid_content were
added in 3.15.
2026-06-18 15:46:57 +00:00
Serhiy Storchaka 3cd02a1c2d gh-86726: Fix the documented return type of tkinter info_patchlevel() (GH-151655)
It returns a sys.version_info-like named tuple, not a string.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 17:34:57 +03:00
Mark Shannon ad1513a263 GH-150516: Reduce the work done to spill and reload the stack around calls (GH-151587) 2026-06-18 15:14:30 +01:00
Serhiy Storchaka d47c27e47a gh-86726: Fix "deprecated" directive for wm_attributes (GH-151652) 2026-06-18 16:26:58 +03:00
da-woods fd53ae1139 gh-141510 Document and test frozendict class matching behaviour (#150799)
Frozendict has `_Py_TPFLAGS_MATCH_SELF` set so works correctly
with the single-arg class matching. However it isn't documented
in the list of classes this works with and it isn't tested.

The test is some way below the other similar tests but anything
else would need a large renumbering.
2026-06-18 14:53:09 +02:00
Serhiy Storchaka 8b270b72a2 gh-86726: Document the full public API of tkinter (GH-151579)
Replace the previously sparse reference documentation with full coverage of
the public API of the tkinter package, written from the Tcl/Tk manual pages,
the existing documentation and the module docstrings.

* Doc/library/tkinter.rst gains a "Reference" section documenting every public
  class, method, function and constant of the core module -- the widgets, the
  Misc, Wm, Pack, Place, Grid, XView and YView mix-ins, the Variable and image
  classes, the module-level functions and the symbolic constants.
* Doc/library/tkinter.ttk.rst, dialog.rst, tkinter.font.rst and the other
  module pages document their remaining classes, methods and functions.

The descriptions are Python-oriented (correct return types -- tuples rather
than Tcl lists, booleans, integers, None on cancellation, and so on) and were
checked against the Tcl/Tk 9.1 manual pages and the implementation.

versionadded, versionchanged and deprecated directives are added for the
public API, determined from the git history relative to Python 3.0: the
tkinter.ttk module (3.1); the Text, Wm, Menu and Misc methods exposing Tk 8.5
features (3.3); and the many later additions and behavior changes up to 3.15.
The Tk version required by features added after Tk 8.6 is noted as well.  The
bundled Tcl/Tk version is updated to 9.0 and the manual-page links point at
the tcl9.0 reference.

--------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-06-18 15:39:06 +03:00
Donghee Na 3fa92e7c55 gh-151229: Finalize JIT tracer in test eval-frame stub (gh-151609) 2026-06-18 20:58:12 +09:00
Serhiy Storchaka 12add3822f gh-151623: Add missing curses docstrings and document intrflush() (#151632) 2026-06-18 13:52:26 +03:00
Hugo van Kemenade f551705011 gh-151623: Improve curses documentation style (#151635) 2026-06-18 12:43:33 +03:00
Serhiy Storchaka 65afcdd8df gh-151623: Improve curses documentation and docstrings (GH-151625)
Fix errors and clarify the curses, curses.panel and curses.ascii docs
against X/Open Curses and ncurses, and sync the affected docstrings.
2026-06-18 11:20:03 +03:00
mushitoriami 3a03405e0f docs: Fix indent misalignment in library/logging.config.rst (GH-151617) 2026-06-18 08:21:24 +01:00
Donghee Na 8d7c6dcde0 gh-150942: Optimize PicklerMemoProxy.copy() with _PyDict_SetItem_Take2 (gh-151608) 2026-06-18 09:08:00 +09:00
Maurycy Pawłowski-Wieroński a8d74c062f gh-151436: Fix missing tstate->last_profiled_frame updates (#151437) 2026-06-17 16:49:23 -04:00
AN Long eff805b7a7 gh-151510: Fix __lazy_import__ without frame (#151511) 2026-06-17 14:09:51 -04:00
Petr Viktorin 16185e9fe2 gh-149044: Improve Py_tp_base[s] docs & error message for non-type bases (GH-151252)
The initial implementation of PEP 820 worsened the error message
when non-types are given as base types in Py_tp_bases & Py_tp_base.
Bring back the 'bases must be types' wording and add a 'got' note for
easier debugging.

Improve slot ID documentation, and soft-deprecate Py_tp_base
(as per the PEP).
2026-06-17 15:27:02 +02:00
Pablo Galindo Salgado 6b142ab9a0 gh-150966: Fix live profiling error tests (GH-151020) 2026-06-17 15:17:16 +02:00
sobolevn a173a6d65b gh-151584: Remove PyUnstable_Module_SetGIL call in _remote_debugging (#151585) 2026-06-17 15:37:08 +03:00
blhsing 5ad3c6dfbf gh-120665: make unittest loaders avoid loading test cases that are abstract base classes (#120666) 2026-06-17 07:48:09 -04:00
Victor Stinner 460dec2651 gh-151593: Use timeout on GitHub Action TSan jobs (#151594)
Use a timeout of 15 minutes for --tsan command and a timeout of 10
minutes for --tsan-parallel command. Display also the slowest tests
to help adjusting these timeouts later if needed.
2026-06-17 13:02:22 +02:00
Victor Stinner a064b323f4 gh-151496: Use process groups in test_dtrace (#151512)
Create a new process group to run bpftrace commands, so it's possible
to kill also child processes on timeout.
2026-06-17 10:58:22 +02:00