gh-70758: Fix creating a turtle screen after closing one (GH-30355)

serhiy-storchaka <[email protected]> Sun, 09 Aug 2026 17:11:46 -0400 (EDT)
Newsgroups gmane.comp.python.cvs
Message-ID <[email protected]>
https://github.com/python/cpython/commit/1286d4398e505f70f97e50edda6b0341f16ca267
commit: 1286d4398e505f70f97e50edda6b0341f16ca267
branch: main
author: williamnavaraj <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2026-08-09T21:01:24Z
summary:

gh-70758: Fix creating a turtle screen after closing one (GH-30355)

Creating a new turtle screen after the previous one was closed no longer
raises turtle.Terminator on the first turtle command.

Co-authored-by: Serhiy Storchaka <[email protected]>

files:
A Misc/NEWS.d/next/Library/2022-01-03-12-50-42.gh-issue-70758.2NjFW_.rst
M Lib/turtle.py

diff --git a/Lib/turtle.py b/Lib/turtle.py
index af2c7448a0af17f..b49df26bd07bc5a 100644
--- a/Lib/turtle.py
+++ b/Lib/turtle.py
@@ -1002,6 +1002,9 @@ def __init__(self, cv, mode=_CFG["mode"],
             rootwindow.wm_attributes(topmost=True)
             rootwindow.wm_attributes(topmost=False)
 
+        # A new screen means that turtle graphics is running again.
+        TurtleScreen._RUNNING = True
+
     def clear(self):
         """Delete all drawings and all turtles from the TurtleScreen.
 
diff --git a/Misc/NEWS.d/next/Library/2022-01-03-12-50-42.gh-issue-70758.2NjFW_.rst b/Misc/NEWS.d/next/Library/2022-01-03-12-50-42.gh-issue-70758.2NjFW_.rst
new file mode 100644
index 000000000000000..c59f6fed93fd630
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2022-01-03-12-50-42.gh-issue-70758.2NjFW_.rst
@@ -0,0 +1,2 @@
+Creating a new :mod:`turtle` screen after the previous one was closed no
+longer raises ``turtle.Terminator`` on the first turtle command.

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]