]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] gh-80937: Fix memory leak in tkinter createcommand (GH-152294) (GH-152328)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 26 Jun 2026 19:17:48 +0000 (21:17 +0200)
committerGitHub <noreply@github.com>
Fri, 26 Jun 2026 19:17:48 +0000 (19:17 +0000)
commitb1679d501de294a8dfacaf311a5d522ff04d0466
tree7fed747b7a1f8bd4427348b517d04c51713d5966
parent4fa86ca03da8c2068202d8ac3ddcf14640e2f2b9
[3.14] gh-80937: Fix memory leak in tkinter createcommand (GH-152294) (GH-152328)

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

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Lib/test/test_tkinter/test_misc.py
Misc/NEWS.d/next/Library/2026-06-26-13-10-00.gh-issue-80937.Hq3mNp.rst [new file with mode: 0644]
Modules/_tkinter.c