]> granicus.if.org Git - python/commitdiff
Issue #21868: Prevent turtle crash due to invalid undo buffer size.
authorRaymond Hettinger <python@rcn.com>
Mon, 21 Jul 2014 04:30:32 +0000 (21:30 -0700)
committerRaymond Hettinger <python@rcn.com>
Mon, 21 Jul 2014 04:30:32 +0000 (21:30 -0700)
Lib/turtle.py
Misc/NEWS

index 465d6e065d16f9eca8b2d398c0a5ad65a3e1b75c..c9e88d9dd12c6a87162b02d78564b5e126ef1d04 100644 (file)
@@ -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)
index b32698535d1fb7f9d111cbeeb74dd7bed46c2d55..08b3c6fa9196eb5274eddc8777cc875b690baa45 100644 (file)
--- 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.