Skip to content

[3.13] gh-50966: Fix unbounded recursion in turtle drag handlers (GH-152626)#152667

Open
serhiy-storchaka wants to merge 1 commit into
python:3.13from
serhiy-storchaka:backport-6f103fa-3.13
Open

[3.13] gh-50966: Fix unbounded recursion in turtle drag handlers (GH-152626)#152667
serhiy-storchaka wants to merge 1 commit into
python:3.13from
serhiy-storchaka:backport-6f103fa-3.13

Conversation

@serhiy-storchaka

Copy link
Copy Markdown
Member

TurtleScreenBase._update() redraws with cv.update(), which also reprocesses
input events, so a handler that moves the turtle (such as
screen.ondrag(turtle.goto)) reenters _update() for every queued event until
the interpreter crashes. A reentrant _update() now only flushes drawing with
update_idletasks().
(cherry picked from commit 6f103fa)

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


Manual backport (miss-islington could not apply it to 3.13): the turtle.py fix and the NEWS entry applied cleanly; only the new test_update_is_not_reentrant test conflicted, because the TestTurtleScreen class it was added to on main does not exist in 3.13. The test method was placed in a minimal TestTurtleScreen class; it is otherwise unchanged.

pythonGH-152626)

TurtleScreenBase._update() redraws with cv.update(), which also reprocesses
input events, so a handler that moves the turtle (such as
screen.ondrag(turtle.goto)) reenters _update() for every queued event until
the interpreter crashes.  A reentrant _update() now only flushes drawing with
update_idletasks().
(cherry picked from commit 6f103fa)

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 30, 2026 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant