Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Lib/doctest.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,8 @@ def getvalue(self):
return result

def truncate(self, size=None):
self.seek(size)
if size is not None:
self.seek(size)
StringIO.truncate(self)

# Worst-case linear-time ellipsis matching.
Expand Down
1 change: 1 addition & 0 deletions Misc/ACKS
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ Lars Damerow
Evan Dandrea
Eric Daniel
Scott David Daniels
Aaron Davidson
Derzsi Dániel
Lawrence D'Anna
Ben Darnell
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
A bug in :func:`!doctest._SpoofOut.truncate` was causing None to be passed to :func:`!StringIO.seek` when no size was given.
A simple fix skips the seek call when no size is given so the buffer can be truncated from the current position.
Loading