homepage

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: Tbuffer in turtle allows negative size
Type: Stage: patch review
Components: Versions: Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: Lita.Cho, jesstess, python-dev, rhettinger
Priority: high Keywords: needs review, patch

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

Files
File name Uploaded Description Edit
undobuffer_fix.patch Lita.Cho, 2014年06月25日 16:47
Messages (9)
msg221530 - (view) Author: Lita Cho (Lita.Cho) * Date: 2014年06月25日 07:10
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.
msg221556 - (view) Author: Lita Cho (Lita.Cho) * Date: 2014年06月25日 16:47
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.
msg221571 - (view) Author: Lita Cho (Lita.Cho) * Date: 2014年06月25日 20:07
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.
msg222224 - (view) Author: Lita Cho (Lita.Cho) * Date: 2014年07月03日 21:43
Hey Raymond, just wanted to ping you to see if you had a chance to review this patch yet. Thanks!
msg222231 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2014年07月03日 22:24
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.
msg222810 - (view) Author: Lita Cho (Lita.Cho) * Date: 2014年07月11日 23:00
Hi Raymond! Just wanted to check if you had time to test this yet. I ran the tests through the Turtle tests I wrote (issue21914), 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! :)
msg223556 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014年07月21日 04:26
New changeset 847a0e74c4cc by Raymond Hettinger in branch '2.7':
Issue #21868: Prevent turtle crash due to invalid undo buffer size.
http://hg.python.org/cpython/rev/847a0e74c4cc 
msg223557 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014年07月21日 04:31
New changeset 02b25ec13c94 by Raymond Hettinger in branch '3.4':
Issue #21868: Prevent turtle crash due to invalid undo buffer size.
http://hg.python.org/cpython/rev/02b25ec13c94 
msg223558 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2014年07月21日 04:33
Thanks for the patch Lita. This was a nice fix.
History
Date User Action Args
2022年04月11日 14:58:05adminsetgithub: 66067
2014年07月21日 04:33:08rhettingersetstatus: open -> closed
resolution: fixed
messages: + msg223558
2014年07月21日 04:31:43python-devsetmessages: + msg223557
2014年07月21日 04:26:14python-devsetnosy: + python-dev
messages: + msg223556
2014年07月17日 04:39:06jesstesssetkeywords: + needs review
stage: patch review
2014年07月11日 23:00:57Lita.Chosetmessages: + msg222810
2014年07月03日 22:35:59Lita.Chosetversions: + Python 2.7
2014年07月03日 22:35:47Lita.Chosetversions: + Python 3.4, Python 3.5
2014年07月03日 22:24:14rhettingersetmessages: + msg222231
2014年07月03日 21:43:48Lita.Chosetmessages: + msg222224
2014年06月25日 20:07:48Lita.Chosetmessages: + msg221571
2014年06月25日 20:01:30rhettingersetpriority: normal -> high
assignee: rhettinger

nosy: + rhettinger
2014年06月25日 16:47:16Lita.Chosetfiles: + undobuffer_fix.patch
keywords: + patch
messages: + msg221556
2014年06月25日 07:10:34Lita.Chosetnosy: + jesstess
2014年06月25日 07:10:25Lita.Chocreate

AltStyle によって変換されたページ (->オリジナル) /