Skip to content

[3.13] gh-80937: Fix memory leak in tkinter createcommand (GH-152294)#152329

Merged
serhiy-storchaka merged 1 commit into
python:3.13from
miss-islington:backport-bbf7786-3.13
Jun 26, 2026
Merged

[3.13] gh-80937: Fix memory leak in tkinter createcommand (GH-152294)#152329
serhiy-storchaka merged 1 commit into
python:3.13from
miss-islington:backport-bbf7786-3.13

Conversation

@miss-islington

@miss-islington miss-islington commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

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

Co-authored-by: Serhiy Storchaka storchaka@gmail.com
Co-authored-by: Claude Opus 4.8 noreply@anthropic.com

…2294)

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

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
@serhiy-storchaka serhiy-storchaka merged commit 2895ce7 into python:3.13 Jun 26, 2026
42 checks passed
@miss-islington miss-islington deleted the backport-bbf7786-3.13 branch June 26, 2026 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants