From b606d45fb26d38ba00b06a4349fd05172ba9e12c Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Sun, 20 Jul 2014 21:26:04 -0700 Subject: [PATCH] Issue #21868: Prevent turtle crash due to invalid undo buffer size. --- Lib/lib-tk/turtle.py | 2 +- Misc/ACKS | 1 + Misc/NEWS | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Lib/lib-tk/turtle.py b/Lib/lib-tk/turtle.py index 6a9071594fb..75673a4bcb8 100644 --- a/Lib/lib-tk/turtle.py +++ b/Lib/lib-tk/turtle.py @@ -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) diff --git a/Misc/ACKS b/Misc/ACKS index 27be9493f08..2dc0e779ddb 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -235,6 +235,7 @@ Ingrid Cheung Albert Chin-A-Young Adal Chiriliuc Matt Chisholm +Lita Cho Anders Chrigström Tom Christiansen Renee Chu diff --git a/Misc/NEWS b/Misc/NEWS index 9ba62e87806..0181a4614ee 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -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.