mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
[3.13] gh-74389: gh-70560: subprocess.Popen.communicate() now ignores stdin.flush error when closed (GH-142061) (#142065)
gh-74389: gh-70560: subprocess.Popen.communicate() now ignores stdin.flush error when closed (GH-142061)
gh-70560: gh-74389: subprocess.Popen.communicate() now ignores stdin.flush error when closed
with a unittest and news entry.
(cherry picked from commit 923056b2d4)
Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
This commit is contained in:
parent
385688d4b4
commit
99b70fe4eb
3 changed files with 20 additions and 0 deletions
|
|
@ -2099,6 +2099,10 @@ def _communicate(self, input, endtime, orig_timeout):
|
|||
self.stdin.flush()
|
||||
except BrokenPipeError:
|
||||
pass # communicate() must ignore BrokenPipeError.
|
||||
except ValueError:
|
||||
# ignore ValueError: I/O operation on closed file.
|
||||
if not self.stdin.closed:
|
||||
raise
|
||||
if not input:
|
||||
try:
|
||||
self.stdin.close()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue