@@ -128,7 +128,7 @@ def poll(timeout=0.0, map=None):
128128 try :
129129 r , w , e = select .select (r , w , e , timeout )
130130 except select .error as err :
131- if err [0 ] != EINTR :
131+ if err . args [0 ] != EINTR :
132132 raise
133133 else :
134134 return
@@ -174,7 +174,7 @@ def poll2(timeout=0.0, map=None):
174174 try :
175175 r = pollster .poll (timeout )
176176 except select .error as err :
177- if err [0 ] != EINTR :
177+ if err . args [0 ] != EINTR :
178178 raise
179179 r = []
180180 for fd , flags in r :
@@ -230,7 +230,7 @@ def __init__(self, sock=None, map=None):
230230 try :
231231 self .addr = sock .getpeername ()
232232 except socket .error as err :
233- if err [0 ] == ENOTCONN :
233+ if err . args [0 ] == ENOTCONN :
234234 # To handle the case where we got an unconnected
235235 # socket.
236236 self .connected = False
@@ -338,7 +338,7 @@ def accept(self):
338338 conn , addr = self .socket .accept ()
339339 return conn , addr
340340 except socket .error as why :
341- if why [0 ] == EWOULDBLOCK :
341+ if why . args [0 ] == EWOULDBLOCK :
342342 pass
343343 else :
344344 raise
@@ -348,9 +348,9 @@ def send(self, data):
348348 result = self .socket .send (data )
349349 return result
350350 except socket .error as why :
351- if why [0 ] == EWOULDBLOCK :
351+ if why . args [0 ] == EWOULDBLOCK :
352352 return 0
353- elif why [0 ] in (ECONNRESET , ENOTCONN , ESHUTDOWN , ECONNABORTED ):
353+ elif why . args [0 ] in (ECONNRESET , ENOTCONN , ESHUTDOWN , ECONNABORTED ):
354354 self .handle_close ()
355355 return 0
356356 else :
@@ -368,7 +368,7 @@ def recv(self, buffer_size):
368368 return data
369369 except socket .error as why :
370370 # winsock sometimes throws ENOTCONN
371- if why [0 ] in [ECONNRESET , ENOTCONN , ESHUTDOWN , ECONNABORTED ]:
371+ if why . args [0 ] in [ECONNRESET , ENOTCONN , ESHUTDOWN , ECONNABORTED ]:
372372 self .handle_close ()
373373 return b''
374374 else :
@@ -381,7 +381,7 @@ def close(self):
381381 try :
382382 self .socket .close ()
383383 except socket .error as why :
384- if why [0 ] not in (ENOTCONN , EBADF ):
384+ if why . args [0 ] not in (ENOTCONN , EBADF ):
385385 raise
386386
387387 # cheap inheritance, used to pass all other attribute
@@ -548,7 +548,7 @@ def close_all(map=None, ignore_all=False):
548548 try :
549549 x .close ()
550550 except OSError as x :
551- if x [0 ] == EBADF :
551+ if x . args [0 ] == EBADF :
552552 pass
553553 elif not ignore_all :
554554 raise
0 commit comments