From bf818ebfb859efe94c2eb508c58ec57ada37648b Mon Sep 17 00:00:00 2001 From: shanyuduo <71872674+shanyuduo@users.noreply.github.com> Date: Sat, 19 Sep 2026 18:30:11 +0800 Subject: [PATCH 1/2] gh-136722: Document TurtleGraphicsError in the turtle module docs Add an Exceptions section to Doc/library/turtle.rst documenting the TurtleGraphicsError class, which was previously absent from the API reference. Keep the entry minimal, following review feedback: a one-sentence description with a single doctest example (a malformed color string). --- Doc/library/turtle.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Doc/library/turtle.rst b/Doc/library/turtle.rst index 5dc083c12ccce2..8d7a2c236bbb94 100644 --- a/Doc/library/turtle.rst +++ b/Doc/library/turtle.rst @@ -2571,6 +2571,24 @@ Public classes * ``a.rotate(angle)`` rotation +Exceptions +========== + +The :mod:`!turtle` module defines the following exception class: + +.. exception:: TurtleGraphicsError + + Raised for invalid arguments or operations. + For example, a malformed color string: + + .. doctest:: + :skipif: _tkinter is None + + >>> turtle.color("blau") + Traceback (most recent call last): + ... + turtle.TurtleGraphicsError: bad color string: blau + .. _turtle-explanation: Explanation From 7c4303115c6998ce2bcbe75eaf09ee4410f84212 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Sat, 19 Sep 2026 13:24:22 +0100 Subject: [PATCH 2/2] Apply batched suggestions from code review Co-authored-by: Stan Ulbrych --- Doc/library/turtle.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/library/turtle.rst b/Doc/library/turtle.rst index 8d7a2c236bbb94..da590bcb8de550 100644 --- a/Doc/library/turtle.rst +++ b/Doc/library/turtle.rst @@ -2574,7 +2574,7 @@ Public classes Exceptions ========== -The :mod:`!turtle` module defines the following exception class: +The :mod:`!turtle` module defines the following exception: .. exception:: TurtleGraphicsError @@ -2589,6 +2589,7 @@ The :mod:`!turtle` module defines the following exception class: ... turtle.TurtleGraphicsError: bad color string: blau + .. _turtle-explanation: Explanation