]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] gh-80937: Fix memory leak in tkinter createcommand (GH-152294) (GH-152329)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 26 Jun 2026 19:15:14 +0000 (21:15 +0200)
committerGitHub <noreply@github.com>
Fri, 26 Jun 2026 19:15:14 +0000 (19:15 +0000)
commit2895ce779fd2e060ea7c89e9a2e38d5b2254d95e
treeacb0743ab1072356f018b3a603aba827eca8382d
parent668860b846b3fa2d5171aea07ad7a31824da899b
[3.13] gh-80937: Fix memory leak in tkinter createcommand (GH-152294) (GH-152329)

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