From 3bb30729afa55f636d31afbaa5155740394de297 Mon Sep 17 00:00:00 2001 From: Aaron Date: Fri, 24 Mar 2023 04:24:27 +0900 Subject: [PATCH 1/2] bufix for issue-102967 --- Lib/doctest.py | 3 ++- Misc/ACKS | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Lib/doctest.py b/Lib/doctest.py index 2776d74bf9b586..51bdd2f381e848 100644 --- a/Lib/doctest.py +++ b/Lib/doctest.py @@ -270,7 +270,8 @@ def getvalue(self): return result def truncate(self, size=None): - self.seek(size) + if size != None: + self.seek(size) StringIO.truncate(self) # Worst-case linear-time ellipsis matching. diff --git a/Misc/ACKS b/Misc/ACKS index 8cf5166a2bb1f4..2a1d0181452c7b 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -406,6 +406,7 @@ Lars Damerow Evan Dandrea Eric Daniel Scott David Daniels +Aaron Davidson Derzsi Dániel Lawrence D'Anna Ben Darnell From 8d4e729bf8f80337a40c80f28d256b65b13ffc2a Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Thu, 23 Mar 2023 19:47:06 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Library/2023-03-23-19-47-05.gh-issue-102967.gfIYkN.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2023-03-23-19-47-05.gh-issue-102967.gfIYkN.rst diff --git a/Misc/NEWS.d/next/Library/2023-03-23-19-47-05.gh-issue-102967.gfIYkN.rst b/Misc/NEWS.d/next/Library/2023-03-23-19-47-05.gh-issue-102967.gfIYkN.rst new file mode 100644 index 00000000000000..bcece939531869 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2023-03-23-19-47-05.gh-issue-102967.gfIYkN.rst @@ -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.