File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -778,19 +778,21 @@ def _stdin_write(self, input):
778778 self .stdin .write (input )
779779 except BrokenPipeError :
780780 pass # communicate() must ignore broken pipe errors.
781- except OSError as e :
782- if e .errno == errno .EINVAL and self .poll () is not None :
783- # Issue #19612: On Windows, stdin.write() fails with EINVAL
784- # if the process already exited before the write
781+ except OSError as exc :
782+ if exc .errno == errno .EINVAL :
783+ # bpo-19612, bpo-30418: On Windows, stdin.write() fails
784+ # with EINVAL if the child process exited or if the child
785+ # process is still running but closed the pipe.
785786 pass
786787 else :
787788 raise
789+
788790 try :
789791 self .stdin .close ()
790792 except BrokenPipeError :
791793 pass # communicate() must ignore broken pipe errors.
792- except OSError as e :
793- if e .errno == errno .EINVAL and self . poll () is not None :
794+ except OSError as exc :
795+ if exc .errno == errno .EINVAL :
794796 pass
795797 else :
796798 raise
Original file line number Diff line number Diff line change @@ -350,6 +350,9 @@ Extension Modules
350350Library
351351-------
352352
353+ - bpo-30418: On Windows, subprocess.Popen.communicate() now also ignore EINVAL
354+ on stdin.write() if the child process is still running but closed the pipe.
355+
353356- bpo-30463: Addded empty __slots__ to abc.ABC. This allows subclassers
354357 to deny __dict__ and __weakref__ creation. Patch by Aaron Hall.
355358
You can’t perform that action at this time.
0 commit comments