if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL):
obj.handle_close()
except OSError as e:
- if e.args[0] not in _DISCONNECTED:
+ if e.errno not in _DISCONNECTED:
obj.handle_error()
else:
obj.handle_close()
try:
self.addr = sock.getpeername()
except OSError as err:
- if err.args[0] in (ENOTCONN, EINVAL):
+ if err.errno in (ENOTCONN, EINVAL):
# To handle the case where we got an unconnected
# socket.
self.connected = False
except TypeError:
return None
except OSError as why:
- if why.args[0] in (EWOULDBLOCK, ECONNABORTED, EAGAIN):
+ if why.errno in (EWOULDBLOCK, ECONNABORTED, EAGAIN):
return None
else:
raise
result = self.socket.send(data)
return result
except OSError as why:
- if why.args[0] == EWOULDBLOCK:
+ if why.errno == EWOULDBLOCK:
return 0
- elif why.args[0] in _DISCONNECTED:
+ elif why.errno in _DISCONNECTED:
self.handle_close()
return 0
else:
return data
except OSError as why:
# winsock sometimes raises ENOTCONN
- if why.args[0] in _DISCONNECTED:
+ if why.errno in _DISCONNECTED:
self.handle_close()
return b''
else:
try:
self.socket.close()
except OSError as why:
- if why.args[0] not in (ENOTCONN, EBADF):
+ if why.errno not in (ENOTCONN, EBADF):
raise
# log and log_info may be overridden to provide more sophisticated
try:
x.close()
except OSError as x:
- if x.args[0] == EBADF:
+ if x.errno == EBADF:
pass
elif not ignore_all:
raise
# a race condition may occur if the other end is closing
# before we can get the peername
self.close()
- if err.args[0] != errno.ENOTCONN:
+ if err.errno != errno.ENOTCONN:
raise
return
print('Peer:', repr(self.peer), file=DEBUGSTREAM)
self._timeout_occurred = True
raise
except error as e:
- if e.args[0] in _blocking_errnos:
+ if e.errno in _blocking_errnos:
return None
raise
return self._sock.send(b)
except error as e:
# XXX what about EINTR?
- if e.args[0] in _blocking_errnos:
+ if e.errno in _blocking_errnos:
return None
raise