summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2014-07-20 21:30:32 -0700
committerRaymond Hettinger <python@rcn.com>2014-07-20 21:30:32 -0700
commit854e76effaa272feed874c0e828ee679a3949dc2 (patch)
tree6cedd74c082f229db0b45c51c14ab6c1d6193b6b
parent01963e6ae977ade7802d5ef67a94055e82763a44 (diff)
downloadcpython-git-854e76effaa272feed874c0e828ee679a3949dc2.tar.gz
Issue #21868: Prevent turtle crash due to invalid undo buffer size.
-rw-r--r--Lib/turtle.py2
-rw-r--r--Misc/NEWS2
2 files changed, 3 insertions, 1 deletions
diff --git a/Lib/turtle.py b/Lib/turtle.py
index 465d6e065d..c9e88d9dd1 100644
--- a/Lib/turtle.py
+++ b/Lib/turtle.py
@@ -2594,7 +2594,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)
diff --git a/Misc/NEWS b/Misc/NEWS
index b32698535d..08b3c6fa91 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -30,6 +30,8 @@ Library
- Issue #21044: tarfile.open() now handles fileobj with an integer 'name'
attribute. Based on patch by Martin Panter.
+- Issue #21867: Prevent turtle crash due to invalid undo buffer size.
+
- Issue #19076: Don't pass the redundant 'file' argument to self.error().
- Issue #21942: Fixed source file viewing in pydoc's server mode on Windows.