bpo-30418: Popen.communicate() always ignore EINVAL (#2002) (#2006) · python/cpython@e5bdad2 (original) (raw)

Original file line number Diff line number Diff line change
@@ -720,10 +720,11 @@ def _communicate(self, input):
720 720 if e.errno == errno.EPIPE:
721 721 # communicate() should ignore broken pipe error
722 722 pass
723 -elif (e.errno == errno.EINVAL
724 -and self.poll() is not None):
725 -# Issue #19612: stdin.write() fails with EINVAL
726 -# if the process already exited before the write
723 +elif e.errno == errno.EINVAL:
724 +# bpo-19612, bpo-30418: On Windows, stdin.write()
725 +# fails with EINVAL if the child process exited or
726 +# if the child process is still running but closed
727 +# the pipe.
727 728 pass
728 729 else:
729 730 raise