Skip to content

Commit

Permalink
Merge pull request #422 from python/master
Browse files Browse the repository at this point in the history
bpo-43423 Fix IndexError in subprocess _communicate function (pythonGH-24777)
  • Loading branch information
sthagen authored Mar 11, 2021
2 parents c24a599 + b4fc44b commit 6fc610a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Lib/subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -1535,10 +1535,8 @@ def _communicate(self, input, endtime, orig_timeout):
self.stderr.close()

# All data exchanged. Translate lists into strings.
if stdout is not None:
stdout = stdout[0]
if stderr is not None:
stderr = stderr[0]
stdout = stdout[0] if stdout else None
stderr = stderr[0] if stderr else None

return (stdout, stderr)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
:func:`subprocess.communicate` no longer raises an IndexError when there is an
empty stdout or stderr IO buffer during a timeout on Windows.

0 comments on commit 6fc610a

Please sign in to comment.