Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 854e76e

Browse files
committed
Issue #21868: Prevent turtle crash due to invalid undo buffer size.
1 parent 01963e6 commit 854e76e

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

Lib/turtle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2594,7 +2594,7 @@ def setundobuffer(self, size):
25942594
Example (for a Turtle instance named turtle):
25952595
>>> turtle.setundobuffer(42)
25962596
"""
2597-
if size is None:
2597+
if size is None or size <= 0:
25982598
self.undobuffer = None
25992599
else:
26002600
self.undobuffer = Tbuffer(size)

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ Library
3030
- Issue #21044: tarfile.open() now handles fileobj with an integer 'name'
3131
attribute. Based on patch by Martin Panter.
3232

33+
- Issue #21867: Prevent turtle crash due to invalid undo buffer size.
34+
3335
- Issue #19076: Don't pass the redundant 'file' argument to self.error().
3436

3537
- Issue #21942: Fixed source file viewing in pydoc's server mode on Windows.

0 commit comments

Comments
 (0)