New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tbuffer in turtle allows negative size #66067
Comments
Currently, you can set the undobuffer size to negative numbers. Aka, the Tbuffer can be set to negative. s = turtle.Screen()
raw = turtle.RawTurtle(s)
raw.setundobuffer(-10)
raw.undobuffer.bufsize == -10 <-- returns True This should not be possible. Tbuffer should not be allowed to have negative inputs. If the value is less than 0, it should just default to 0 or None. Otherwise, when you call undo, turtle just crashes. |
Here is a patch for this bug. Basically, when a user gives 0 and below, it doesn't create a TBuffer. Then "undo" does the right thing. |
I should clarify. The right thing being that calling undo does nothing, and turtle keeps on running. This is the default behaviour when setundobuffer is called with no size. |
Hey Raymond, just wanted to ping you to see if you had a chance to review this patch yet. Thanks! |
I looked at this and marked it as high priority (crashes are an unacceptable outcome). The patch looks fine but I haven't had a chance to test it yet. If it passes muster, I'll apply it shortly (I'm overseas traveling this week). In the meantime, can you mark the "versions" in the tracker so I'll know in advance whether this applies to 2.7, 3.4 and 3.5? Thanks. |
Hi Raymond! Just wanted to check if you had time to test this yet. I ran the tests through the Turtle tests I wrote (bpo-21914), but those are still pending approval. This is off topic, but I also didn't realize till now that you gave a talk about "Transforming Code into Beautiful, Idiomatic Python", which is super awesome! Getting a patch reviewed by you is super exciting! :) |
New changeset 847a0e74c4cc by Raymond Hettinger in branch '2.7': |
New changeset 02b25ec13c94 by Raymond Hettinger in branch '3.4': |
Thanks for the patch Lita. This was a nice fix. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: