Skip to content

Commit

Permalink
pythonGH-106584: Check buffers before seek
Browse files Browse the repository at this point in the history
  • Loading branch information
EliseevEgor committed Jul 11, 2023
1 parent 1ab5cfa commit 6313c98
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Lib/unittest/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,12 @@ def _restoreStdout(self):

sys.stdout = self._original_stdout
sys.stderr = self._original_stderr
self._stdout_buffer.seek(0)
self._stdout_buffer.truncate()
self._stderr_buffer.seek(0)
self._stderr_buffer.truncate()
if self._stdout_buffer is not None:
self._stdout_buffer.seek(0)
self._stdout_buffer.truncate()
if self._stderr_buffer is not None:
self._stderr_buffer.seek(0)
self._stderr_buffer.truncate()

def stopTestRun(self):
"""Called once after all tests are executed.
Expand Down

0 comments on commit 6313c98

Please sign in to comment.