diff options
author | Georg Brandl <georg@python.org> | 2008-07-20 07:29:58 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2008-07-20 07:29:58 (GMT) |
commit | 61d5c43011a672a29ce77962c12284f676342fee (patch) | |
tree | 55777016a6aa849cc31f34ee044fab690c4f5b64 /Lib/asyncore.py | |
parent | b90f4e87300b8423695ed577f49dc277ebcc8dcb (diff) | |
download | cpython-61d5c43011a672a29ce77962c12284f676342fee.zip cpython-61d5c43011a672a29ce77962c12284f676342fee.tar.gz cpython-61d5c43011a672a29ce77962c12284f676342fee.tar.bz2 |
Remove exception indexing in asyncore.
Diffstat (limited to 'Lib/asyncore.py')
-rw-r--r-- | Lib/asyncore.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Lib/asyncore.py b/Lib/asyncore.py index 1ef4896..e82b5b4 100644 --- a/Lib/asyncore.py +++ b/Lib/asyncore.py @@ -129,7 +129,7 @@ def poll(timeout=0.0, map=None): try: r, w, e = select.select(r, w, e, timeout) except select.error, err: - if err[0] != EINTR: + if err.args[0] != EINTR: raise else: return @@ -175,7 +175,7 @@ def poll2(timeout=0.0, map=None): try: r = pollster.poll(timeout) except select.error, err: - if err[0] != EINTR: + if err.args[0] != EINTR: raise r = [] for fd, flags in r: @@ -231,7 +231,7 @@ class dispatcher: try: self.addr = sock.getpeername() except socket.error, err: - if err[0] == ENOTCONN: + if err.args[0] == ENOTCONN: # To handle the case where we got an unconnected # socket. self.connected = False @@ -339,7 +339,7 @@ class dispatcher: conn, addr = self.socket.accept() return conn, addr except socket.error, why: - if why[0] == EWOULDBLOCK: + if why.args[0] == EWOULDBLOCK: pass else: raise @@ -349,9 +349,9 @@ class dispatcher: result = self.socket.send(data) return result except socket.error, 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: @@ -369,7 +369,7 @@ class dispatcher: return data except socket.error, 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 '' else: @@ -382,7 +382,7 @@ class dispatcher: try: self.socket.close() except socket.error, 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 @@ -549,7 +549,7 @@ def close_all(map=None, ignore_all=False): try: x.close() except OSError, x: - if x[0] == EBADF: + if x.args[0] == EBADF: pass elif not ignore_all: raise |