Skip to content

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

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

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

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

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
@serhiy-storchaka serhiy-storchaka enabled auto-merge (squash) June 26, 2026 18:55
@serhiy-storchaka serhiy-storchaka merged commit 2a3189c into python:3.15 Jun 26, 2026
55 checks passed
@miss-islington miss-islington deleted the backport-bbf7786-3.15 branch June 26, 2026 19:22
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