gh-152434: Block --async-aware with --binary (GH-152444)
The binary writer does not currently handle AwaitedInfo samples and
crashes when running in --async-aware mode.
(cherry picked from commit 876c06cab9)
Co-authored-by: László Kiss Kollár <kiss.kollar.laszlo@gmail.com>
gh-151029: Fix sys.remote_exec() unable to find writable memory when libpython replaced on disk (GH-151032)
(cherry picked from commit a69d0fc41e)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
Document Windows cursor files (gh-99089).
(cherry picked from commit ea7f64a65c)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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).
(cherry picked from commit 11b394381f)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.
(cherry picked from commit 389e00f13f)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.
(cherry picked from commit 5c3555bdc5)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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).
(cherry picked from commit 5fed5ce85d)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
IDLE: fix dedent() usage in htest (GH-152256)
Fix typos: in GH-112642, initial string concatenation quotes were left when switching to textwrap.dedent().
(cherry picked from commit 74272d4f0b)
Co-authored-by: Inada Naoki <songofacandy@gmail.com>
gh-98894: Skip test_dtrace when building without dtrace (GH-152239)
(cherry picked from commit 671357691f)
Co-authored-by: stratakis <cstratak@redhat.com>
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.
(cherry picked from commit bbf7786a90)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
gh-151722: Do not track the frozendict in the GC in _PyDict_FromKeys() (GH-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.
(cherry picked from commit 55bc3126e0)
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Donghee Na <donghee.na@python.org>
Co-authored-by: Inada Naoki <songofacandy@gmail.com>
(cherry picked from commit 11c241e1a8)
Co-authored-by: Shahar Naveh <50263213+ShaharNaveh@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
gh-151929: Get uptime on BSD/macOS in pythoninfo (GH-152189)
* Check sysctlbyname() function and sys/sysctl.h header in
configure.
* Add _testcapi.uptime_bsd() function.
(cherry picked from commit b6d89edc4a)
Co-authored-by: Victor Stinner <vstinner@python.org>
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.
(cherry picked from commit deeae2ac07)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
gh-151929: Get machine ID and uptime on Windows in pythoninfo (#152146)
* Replace "linux." prefix with "system." in pythoninfo.
* Add _winapi.GetTickCount64() function.
(cherry picked from commit f9910519af)
Decorate ttk.MenubuttonTest with add_configure_tests() and make
ttk.OptionMenuTest inherit it to cover the standard widget options.
(cherry picked from commit ce147129c1)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
gh-151929: Get boot ID, machine ID and uptime in test.pythoninfo (GH-152127)
(cherry picked from commit 3db3bba4d1)
GHA: Run test.pythoninfo on the "Cross build Linux" job.
Co-authored-by: Victor Stinner <vstinner@python.org>
gh-151496: Use process groups in TraceBackend in test_dtrace (GH-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.
(cherry picked from commit 1785f4b35f)
Co-authored-by: stratakis <cstratak@redhat.com>
gh-143927: Normalize all line endings (CR, CRLF, and LF) in configparser (GH-143929)
(cherry picked from commit 5858e42c53)
Co-authored-by: Seth Larson <seth@python.org>
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.
(cherry picked from commit da99711d37)
Co-authored-by: Shardul Deshpande <iamsharduld@users.noreply.github.com>
Tcl 8.x crashes when title-casing a non-BMP character during Tk
initialization, so such a className is now rejected with a ValueError.
(cherry picked from commit 124c7cd91b)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
The Tcl commands created for event callbacks are now deleted when a
binding is replaced or unbound, instead of being leaked.
(cherry picked from commit 3f09a175ad)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Document where widget methods shadow inherited Misc, geometry-manager and
Wm methods, correct the inaccurate "size/bbox is an alias of
grid_size/grid_bbox" claims, and add "# overrides X" comments at the
definitions.
Also document the geometry-manager ambiguity: the short names forget, info,
slaves, content and propagate are defined by Pack, Place and Grid but
resolve to the pack variant.
Cross-reference the window-manager methods grid, forget and state with the
same-named grid geometry manager, Pack.forget and ttk.Widget.state.
(cherry picked from commit 4de5683f21)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.
(cherry picked from commit 706238e764)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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).
(cherry picked from commit e51b616eff)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.
(cherry picked from commit aa71eb287f)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>