@@ -31,7 +31,7 @@ def blockingReadFromFD(fd):
3131 while True :
3232 try :
3333 output += os .read (fd , 8192 )
34- except (OSError , IOError ), ioe :
34+ except (OSError , IOError ) as ioe :
3535 if ioe .args [0 ] in (errno .EAGAIN , errno .EINTR ):
3636 # Uncomment the following line if the process seems to
3737 # take a huge amount of cpu time
@@ -52,7 +52,7 @@ def blockingWriteToFD(fd, data):
5252 try :
5353 data_length = len (data )
5454 wrote_data = os .write (fd , data )
55- except (OSError , IOError ), io :
55+ except (OSError , IOError ) as io :
5656 if io .errno in (errno .EAGAIN , errno .EINTR ):
5757 continue
5858 else :
@@ -95,8 +95,8 @@ def send(self, input):
9595 (errCode , written ) = WriteFile (x , input )
9696 except ValueError :
9797 return self ._close ('stdin' )
98- except (subprocess .pywintypes .error , Exception ), why :
99- if why [0 ] in (109 , errno .ESHUTDOWN ):
98+ except (subprocess .pywintypes .error , Exception ) as ex :
99+ if ex [0 ] in (109 , errno .ESHUTDOWN ):
100100 return self ._close ('stdin' )
101101 raise
102102
@@ -116,8 +116,8 @@ def _recv(self, which, maxsize):
116116 (errCode , read ) = ReadFile (x , nAvail , None )
117117 except (ValueError , NameError ):
118118 return self ._close (which )
119- except (subprocess .pywintypes .error , Exception ), why :
120- if why [0 ] in (109 , errno .ESHUTDOWN ):
119+ except (subprocess .pywintypes .error , Exception ) as ex :
120+ if ex [0 ] in (109 , errno .ESHUTDOWN ):
121121 return self ._close (which )
122122 raise
123123
@@ -134,8 +134,8 @@ def send(self, input):
134134
135135 try :
136136 written = os .write (self .stdin .fileno (), input )
137- except OSError , why :
138- if why [0 ] == errno .EPIPE : # broken pipe
137+ except OSError as ex :
138+ if ex [0 ] == errno .EPIPE : # broken pipe
139139 return self ._close ('stdin' )
140140 raise
141141
0 commit comments