try:
r, w, e = select.select(r, w, e, timeout)
except select.error as err:
- if err[0] != EINTR:
+ if err.args[0] != EINTR:
raise
else:
return
try:
r = pollster.poll(timeout)
except select.error as err:
- if err[0] != EINTR:
+ if err.args[0] != EINTR:
raise
r = []
for fd, flags in r:
try:
self.addr = sock.getpeername()
except socket.error as err:
- if err[0] == ENOTCONN:
+ if err.args[0] == ENOTCONN:
# To handle the case where we got an unconnected
# socket.
self.connected = False
conn, addr = self.socket.accept()
return conn, addr
except socket.error as why:
- if why[0] == EWOULDBLOCK:
+ if why.args[0] == EWOULDBLOCK:
pass
else:
raise
result = self.socket.send(data)
return result
except socket.error as why:
- if why[0] == EWOULDBLOCK:
+ if why.args[0] == EWOULDBLOCK:
return 0
- elif why[0] in (ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED):
+ elif why.args[0] in (ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED):
self.handle_close()
return 0
else:
return data
except socket.error as why:
# winsock sometimes throws ENOTCONN
- if why[0] in [ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED]:
+ if why.args[0] in [ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED]:
self.handle_close()
return b''
else:
try:
self.socket.close()
except socket.error as why:
- if why[0] not in (ENOTCONN, EBADF):
+ if why.args[0] not in (ENOTCONN, EBADF):
raise
# cheap inheritance, used to pass all other attribute
try:
x.close()
except OSError as x:
- if x[0] == EBADF:
+ if x.args[0] == EBADF:
pass
elif not ignore_all:
raise