Issue #21868: Prevent turtle crash due to invalid undo buffer size.

This commit is contained in:
Raymond Hettinger 2014-07-20 21:26:04 -07:00
parent e2d1e64a1f
commit b606d45fb2
3 changed files with 5 additions and 1 deletions

View File

@ -2499,7 +2499,7 @@ class RawTurtle(TPen, TNavigator):
Example (for a Turtle instance named turtle):
>>> turtle.setundobuffer(42)
"""
if size is None:
if size is None or size <= 0:
self.undobuffer = None
else:
self.undobuffer = Tbuffer(size)

View File

@ -235,6 +235,7 @@ Ingrid Cheung
Albert Chin-A-Young
Adal Chiriliuc
Matt Chisholm
Lita Cho
Anders Chrigström
Tom Christiansen
Renee Chu

View File

@ -16,6 +16,9 @@ Library
- Issue #22017: Correct reference counting errror in the initialization of the
_warnings module.
- Issue #21868: Prevent turtle crash when undo buffer set to a value less
than one.
- Issue #21044: tarfile.open() now handles fileobj with an integer 'name'
attribute. Based on patch by Martin Panter.