self.stdin.write(input)
except BrokenPipeError:
pass # communicate() must ignore broken pipe errors.
- except OSError as e:
- if e.errno == errno.EINVAL and self.poll() is not None:
- # Issue #19612: On Windows, stdin.write() fails with EINVAL
- # if the process already exited before the write
+ except OSError as exc:
+ if exc.errno == errno.EINVAL:
+ # bpo-19612, bpo-30418: On Windows, stdin.write() fails
+ # with EINVAL if the child process exited or if the child
+ # process is still running but closed the pipe.
pass
else:
raise
+
try:
self.stdin.close()
except BrokenPipeError:
pass # communicate() must ignore broken pipe errors.
- except OSError as e:
- if e.errno == errno.EINVAL and self.poll() is not None:
+ except OSError as exc:
+ if exc.errno == errno.EINVAL:
pass
else:
raise
Library
-------
+- bpo-30418: On Windows, subprocess.Popen.communicate() now also ignore EINVAL
+ on stdin.write() if the child process is still running but closed the pipe.
+
- bpo-29822: inspect.isabstract() now works during __init_subclass__. Patch
by Nate Soares.