From cb8a9235656641dbab516ce2ab6e8f8d18cf74ad Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Wed, 24 May 2023 19:49:44 +0300 Subject: [PATCH 1/4] Remove deprecated turtle.RawTurtle.settiltangle --- Doc/library/turtle.rst | 26 +-------------- Doc/whatsnew/3.11.rst | 2 +- Doc/whatsnew/3.13.rst | 5 +++ Lib/turtle.py | 33 ++----------------- Misc/NEWS.d/3.11.0a3.rst | 2 +- ...-05-24-19-48-16.gh-issue-104876.Z00Qnk.rst | 3 ++ 6 files changed, 14 insertions(+), 57 deletions(-) create mode 100644 Misc/NEWS.d/next/Library/2023-05-24-19-48-16.gh-issue-104876.Z00Qnk.rst diff --git a/Doc/library/turtle.rst b/Doc/library/turtle.rst index c656f6d9cfdaad..c9ce955a6d2ba4 100644 --- a/Doc/library/turtle.rst +++ b/Doc/library/turtle.rst @@ -166,7 +166,6 @@ Turtle state | :func:`resizemode` | :func:`shapesize` | :func:`turtlesize` | :func:`shearfactor` - | :func:`settiltangle` | :func:`tiltangle` | :func:`tilt` | :func:`shapetransform` @@ -1301,28 +1300,6 @@ Appearance >>> turtle.fd(50) -.. function:: settiltangle(angle) - - :param angle: a number - - Rotate the turtleshape to point in the direction specified by *angle*, - regardless of its current tilt-angle. *Do not* change the turtle's heading - (direction of movement). - - .. doctest:: - :skipif: _tkinter is None or 'always; deprecated method' - - >>> turtle.reset() - >>> turtle.shape("circle") - >>> turtle.shapesize(5,2) - >>> turtle.settiltangle(45) - >>> turtle.fd(50) - >>> turtle.settiltangle(-45) - >>> turtle.fd(50) - - .. deprecated:: 3.1 - - .. function:: tiltangle(angle=None) :param angle: a number (optional) @@ -2529,8 +2506,7 @@ Changes since Python 3.0 :func:`get_shapepoly` have been added. Thus the full range of regular linear transforms is now available for transforming turtle shapes. :func:`tiltangle` has been enhanced in functionality: it now can - be used to get or set the tilt angle. :func:`settiltangle` has been - deprecated. + be used to get or set the tilt angle. - The :class:`Screen` method :func:`onkeypress` has been added as a complement to :func:`onkey`. As the latter binds actions to the key release event, diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index fd4a75ce47b350..aa674381e4a290 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -1817,7 +1817,7 @@ Standard Library They will be removed in Python 3.13. (Contributed by Serhiy Storchaka and Miro HronĨok in :gh:`92728`.) -* :func:`turtle.settiltangle` has been deprecated since Python 3.1; +* :func:`!turtle.settiltangle` has been deprecated since Python 3.1; it now emits a deprecation warning and will be removed in Python 3.13. Use :func:`turtle.tiltangle` instead (it was earlier incorrectly marked as deprecated, and its docstring is now corrected). diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst index 1102225e50b658..b759f405d58a02 100644 --- a/Doc/whatsnew/3.13.rst +++ b/Doc/whatsnew/3.13.rst @@ -118,6 +118,11 @@ Removed * Remove support for using :class:`pathlib.Path` objects as context managers. This functionality was deprecated and made a no-op in Python 3.9. +* Remove the :meth:`!turtle.RawTurtle.settiltangle` method, + deprecated in docs since Python 3.1 + and with a warning since Python 3.11. + (Contributed by Hugo van Kemenade in :gh:`104876`.) + * :pep:`594`: Remove the :mod:`!cgi`` and :mod:`!cgitb` modules, deprecated in Python 3.11. diff --git a/Lib/turtle.py b/Lib/turtle.py index cf111158b7c149..a8e48ec52e4d5d 100644 --- a/Lib/turtle.py +++ b/Lib/turtle.py @@ -127,7 +127,7 @@ 'isvisible', 'left', 'lt', 'onclick', 'ondrag', 'onrelease', 'pd', 'pen', 'pencolor', 'pendown', 'pensize', 'penup', 'pos', 'position', 'pu', 'radians', 'right', 'reset', 'resizemode', 'rt', - 'seth', 'setheading', 'setpos', 'setposition', 'settiltangle', + 'seth', 'setheading', 'setpos', 'setposition', 'setundobuffer', 'setx', 'sety', 'shape', 'shapesize', 'shapetransform', 'shearfactor', 'showturtle', 'speed', 'st', 'stamp', 'teleport', 'tilt', 'tiltangle', 'towards', 'turtlesize', 'undo', 'undobufferentries', 'up', 'width', @@ -2896,33 +2896,6 @@ def shearfactor(self, shear=None): return self._shearfactor self.pen(resizemode="user", shearfactor=shear) - def settiltangle(self, angle): - """Rotate the turtleshape to point in the specified direction - - Argument: angle -- number - - Rotate the turtleshape to point in the direction specified by angle, - regardless of its current tilt-angle. DO NOT change the turtle's - heading (direction of movement). - - Deprecated since Python 3.1 - - Examples (for a Turtle instance named turtle): - >>> turtle.shape("circle") - >>> turtle.shapesize(5,2) - >>> turtle.settiltangle(45) - >>> turtle.stamp() - >>> turtle.fd(50) - >>> turtle.settiltangle(-45) - >>> turtle.stamp() - >>> turtle.fd(50) - """ - warnings._deprecated("turtle.RawTurtle.settiltangle()", - "{name!r} is deprecated since Python 3.1 and scheduled " - "for removal in Python {remove}. Use tiltangle() instead.", - remove=(3, 13)) - self.tiltangle(angle) - def tiltangle(self, angle=None): """Set or return the current tilt-angle. @@ -2935,8 +2908,8 @@ def tiltangle(self, angle=None): between the orientation of the turtleshape and the heading of the turtle (its direction of movement). - (Incorrectly marked as deprecated since Python 3.1, it is really - settiltangle that is deprecated.) + (Incorrectly marked as deprecated since Python 3.1, it was really + settiltangle that was deprecated (and removed in 3.13).) Examples (for a Turtle instance named turtle): >>> turtle.shape("circle") diff --git a/Misc/NEWS.d/3.11.0a3.rst b/Misc/NEWS.d/3.11.0a3.rst index 426531904993a9..7fdc191c244849 100644 --- a/Misc/NEWS.d/3.11.0a3.rst +++ b/Misc/NEWS.d/3.11.0a3.rst @@ -440,7 +440,7 @@ Added missing kw_only parameter to dataclasses.make_dataclass(). .. nonce: aGyr1I .. section: Library -The :meth:`turtle.RawTurtle.settiltangle` is deprecated since Python 3.1, it +The :meth:`!turtle.RawTurtle.settiltangle` is deprecated since Python 3.1, it now emits a deprecation warning and will be removed in Python 3.13. Use :meth:`turtle.RawTurtle.tiltangle` instead. diff --git a/Misc/NEWS.d/next/Library/2023-05-24-19-48-16.gh-issue-104876.Z00Qnk.rst b/Misc/NEWS.d/next/Library/2023-05-24-19-48-16.gh-issue-104876.Z00Qnk.rst new file mode 100644 index 00000000000000..893c837361614b --- /dev/null +++ b/Misc/NEWS.d/next/Library/2023-05-24-19-48-16.gh-issue-104876.Z00Qnk.rst @@ -0,0 +1,3 @@ +Remove the :meth:`!turtle.RawTurtle.settiltangle` method, deprecated in docs +since Python 3.1 and with a warning since Python 3.11. Patch by Hugo van +Kemenade. From dd17c3e4e6d85a857f48c1f89559447c38bc2f1d Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 25 May 2023 19:16:22 +0300 Subject: [PATCH 2/4] Improve wording Co-authored-by: Victor Stinner --- Doc/whatsnew/3.13.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst index 489885ecb9dfe3..78d1d3d2aaa87c 100644 --- a/Doc/whatsnew/3.13.rst +++ b/Doc/whatsnew/3.13.rst @@ -120,7 +120,7 @@ Removed * Remove the :meth:`!turtle.RawTurtle.settiltangle` method, deprecated in docs since Python 3.1 - and with a warning since Python 3.11. + and with a deprecation warning since Python 3.11. (Contributed by Hugo van Kemenade in :gh:`104876`.) * Removed the following :mod:`unittest` functions, deprecated in Python 3.11: From df25c04e51c261b3ea9c41d35d1887c490401bac Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 25 May 2023 19:17:26 +0300 Subject: [PATCH 3/4] Remove outdated comment --- Lib/turtle.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/Lib/turtle.py b/Lib/turtle.py index a8e48ec52e4d5d..54f0efa4c06224 100644 --- a/Lib/turtle.py +++ b/Lib/turtle.py @@ -2908,9 +2908,6 @@ def tiltangle(self, angle=None): between the orientation of the turtleshape and the heading of the turtle (its direction of movement). - (Incorrectly marked as deprecated since Python 3.1, it was really - settiltangle that was deprecated (and removed in 3.13).) - Examples (for a Turtle instance named turtle): >>> turtle.shape("circle") >>> turtle.shapesize(5, 2) From e0fdf63d8201df3d2405657ec31bcb7761fef790 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 25 May 2023 19:19:08 +0300 Subject: [PATCH 4/4] Improve wording --- .../Library/2023-05-24-19-48-16.gh-issue-104876.Z00Qnk.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS.d/next/Library/2023-05-24-19-48-16.gh-issue-104876.Z00Qnk.rst b/Misc/NEWS.d/next/Library/2023-05-24-19-48-16.gh-issue-104876.Z00Qnk.rst index 893c837361614b..ce1f5606415085 100644 --- a/Misc/NEWS.d/next/Library/2023-05-24-19-48-16.gh-issue-104876.Z00Qnk.rst +++ b/Misc/NEWS.d/next/Library/2023-05-24-19-48-16.gh-issue-104876.Z00Qnk.rst @@ -1,3 +1,3 @@ Remove the :meth:`!turtle.RawTurtle.settiltangle` method, deprecated in docs -since Python 3.1 and with a warning since Python 3.11. Patch by Hugo van -Kemenade. +since Python 3.1 and with a deprecation warning since Python 3.11. Patch by +Hugo van Kemenade.