There was an error while loading. Please reload this page.
1 parent 296f016 commit 7586115Copy full SHA for 7586115
3 files changed
Lib/doctest.py
@@ -285,7 +285,8 @@ def getvalue(self):
285
return result
286
287
def truncate(self, size=None):
288
- self.seek(size)
+ if size is not None:
289
+ self.seek(size)
290
StringIO.truncate(self)
291
292
# Worst-case linear-time ellipsis matching.
Misc/ACKS
@@ -426,6 +426,7 @@ Hauke Dämpfling
426
Evan Dandrea
427
Eric Daniel
428
Scott David Daniels
429
+Aaron Davidson
430
Derzsi Dániel
431
Lawrence D'Anna
432
Steven D'Aprano
Misc/NEWS.d/next/Library/2023-03-23-19-47-05.gh-issue-102967.gfIYkN.rst
@@ -0,0 +1,2 @@
1
+A bug in :func:`!doctest._SpoofOut.truncate` was causing None to be passed to :func:`!StringIO.seek` when no size was given.
2
+A simple fix skips the seek call when no size is given so the buffer can be truncated from the current position.
0 commit comments