Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3b8bfef

Browse files
committed
Fix an oversight in r78946 which causes failure in the subprocess module on Windows.
1 parent da22704 commit 3b8bfef

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

Lib/subprocess.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -681,11 +681,11 @@ def __init__(self, args, bufsize=0, executable=None,
681681
restore_signals, start_new_session)
682682

683683
if mswindows:
684-
if p2cwrite is not None:
684+
if p2cwrite != -1:
685685
p2cwrite = msvcrt.open_osfhandle(p2cwrite.Detach(), 0)
686-
if c2pread is not None:
686+
if c2pread != -1:
687687
c2pread = msvcrt.open_osfhandle(c2pread.Detach(), 0)
688-
if errread is not None:
688+
if errread != -1:
689689
errread = msvcrt.open_osfhandle(errread.Detach(), 0)
690690

691691
if bufsize == 0:
@@ -909,11 +909,11 @@ def _execute_child(self, args, executable, preexec_fn, close_fds,
909909
# output pipe are maintained in this process or else the
910910
# pipe will not close when the child process exits and the
911911
# ReadFile will hang.
912-
if p2cread is not None:
912+
if p2cread != -1:
913913
p2cread.Close()
914-
if c2pwrite is not None:
914+
if c2pwrite != -1:
915915
c2pwrite.Close()
916-
if errwrite is not None:
916+
if errwrite != -1:
917917
errwrite.Close()
918918

919919

0 commit comments

Comments
 (0)