Skip to content

gh-91167: Fix cloned turtle pen not clearing completely#146660

Open
yukarikaname wants to merge 2 commits intopython:mainfrom
yukarikaname:fix-91167
Open

gh-91167: Fix cloned turtle pen not clearing completely#146660
yukarikaname wants to merge 2 commits intopython:mainfrom
yukarikaname:fix-91167

Conversation

@yukarikaname
Copy link
Copy Markdown

When calling clear() on a cloned turtle, it incorrectly cleared the source
turtle's drawings instead of its own.

The issue was in RawTurtle.clone(): after deepcopy(), the clone inherited
the source turtle's currentLine and items lists, causing the clone's
clear() to delete items owned by the source turtle.

Fix by reinitializing currentLine and items for the clone to track only
its own drawing state.

yukarikaname and others added 2 commits March 8, 2026 17:13
When calling clear() on a cloned turtle, it incorrectly cleared the source
turtle's drawings instead of its own. Fix by reinitializing the clone's
currentLine and items to track only its own drawing state.
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