Issue 21867: Turtle returns TypeError when undobuffer is set to 0 (aka no undo is allowed) (original) (raw)

Issue21867

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 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 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 .
History
Date User Action Args
2022-04-11 14:58:05 admin set github: 66066
2014-07-25 16:21:55 berker.peksag set status: open -> closedtype: behaviorstage: resolved
2014-07-23 01:39:33 Lita.Cho set resolution: fixedmessages: +
2014-06-25 20:06:25 Lita.Cho set messages: +
2014-06-25 20:00:47 rhettinger set assignee: rhettingermessages: + nosy: + rhettinger
2014-06-25 16:48:49 Lita.Cho set messages: +
2014-06-25 07:02:09 Lita.Cho set nosy: + jesstess
2014-06-25 07:01:57 Lita.Cho create