This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Turtle returns TypeError when undobuffer is set to 0 (aka no undo is allowed)
Type: behavior Stage: resolved
Components: Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: Lita.Cho, jesstess, rhettinger
Priority: normal Keywords:

Created on 2014-06-25 07:01 by Lita.Cho, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (5)
msg221529 - (view) Author: Lita Cho (Lita.Cho) * Date: 2014-06-25 07:01
Turtle currently has a bug where it will return a TypeError when undobuffer is set to less than or equal to 0 (aka undo is not allowed).

turtle.setundobuffer(0)
turtle.undo()


If an exception must be thrown, it should be a Turtle exception and not a TypeError. However, I also feel like if the user calls undo, nothing should happen when undobuffer is set to 0.
msg221557 - (view) Author: Lita Cho (Lita.Cho) * Date: 2014-06-25 16:48
The patch in issue21868 will fix this issue if it gets approved.
msg221569 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2014-06-25 20:00
For the most part, we don't change exceptions once they are published in the standard library because it breaks any code that relies on those exceptions.  That is why it is so important to get the API correct to begin with.

TypeError was the wrong choice, it should has been a ValueError (the type is correct but the value doesn't make sense).   There is some case for a TurtleError (modules like decimal and sqlite3 define their own clusters of exceptions); however, that makes the exception less interoperable with the rest of Python where things like IndexError, StopIteration, ValueError, and KeyError get caught and handled appropriately.
msg221570 - (view) Author: Lita Cho (Lita.Cho) * Date: 2014-06-25 20:06
That makes a lot of sense. Does that mea we shouldn't change this behaviour as there might be code that relies on these exceptions? The fix in issue21868 will make it so that undo doesn't cause turtle to crash.
msg223714 - (view) Author: Lita Cho (Lita.Cho) * Date: 2014-07-23 01:39
This is now fixed due to a patch in issue21868.
History
Date User Action Args
2022-04-11 14:58:05adminsetgithub: 66066
2014-07-25 16:21:55berker.peksagsetstatus: open -> closed
type: behavior
stage: resolved
2014-07-23 01:39:33Lita.Chosetresolution: fixed
messages: + msg223714
2014-06-25 20:06:25Lita.Chosetmessages: + msg221570
2014-06-25 20:00:47rhettingersetassignee: rhettinger

messages: + msg221569
nosy: + rhettinger
2014-06-25 16:48:49Lita.Chosetmessages: + msg221557
2014-06-25 07:02:09Lita.Chosetnosy: + jesstess
2014-06-25 07:01:57Lita.Chocreate