Skip to content

Commit 055a01b

Browse files
committed
gh-70560: gh-74389: subprocess.Popen.communicate() now ignores stdin.flush error when closed
1 parent 526d7a8 commit 055a01b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Lib/subprocess.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2075,8 +2075,12 @@ def _communicate(self, input, endtime, orig_timeout):
20752075
# been writing to .stdin in an uncontrolled fashion.
20762076
try:
20772077
self.stdin.flush()
2078-
except BrokenPipeError:
2078+
except (BrokenPipeError, ValueError):
20792079
pass # communicate() must ignore BrokenPipeError.
2080+
except ValueError:
2081+
# ignore ValueError: I/O operation on closed file.
2082+
if not self.stdin.closed:
2083+
raise
20802084
if not input:
20812085
try:
20822086
self.stdin.close()

0 commit comments

Comments
 (0)