diff options
author | Georg Brandl <georg@python.org> | 2008-07-20 07:31:30 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2008-07-20 07:31:30 (GMT) |
commit | f1123694634045aa164a5cb31ed0fbb69f80d897 (patch) | |
tree | 6551c07aff44579b7471a38a6896c2652ad2062f /Lib/asyncore.py | |
parent | 7af6eec6d05e336d4e64c37f458b4fa68752e9d3 (diff) | |
download | cpython-f1123694634045aa164a5cb31ed0fbb69f80d897.zip cpython-f1123694634045aa164a5cb31ed0fbb69f80d897.tar.gz cpython-f1123694634045aa164a5cb31ed0fbb69f80d897.tar.bz2 |
Merged revisions 65152 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r65152 | georg.brandl | 2008-07-20 09:29:58 +0200 (Sun, 20 Jul 2008) | 2 lines
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 1a12255..cf68835 100644 --- a/Lib/asyncore.py +++ b/Lib/asyncore.py @@ -128,7 +128,7 @@ def poll(timeout=0.0, map=None): 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 @@ -174,7 +174,7 @@ def poll2(timeout=0.0, map=None): 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: @@ -230,7 +230,7 @@ class dispatcher: 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 @@ -338,7 +338,7 @@ class dispatcher: 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 @@ -348,9 +348,9 @@ class dispatcher: 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: @@ -368,7 +368,7 @@ class dispatcher: 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: @@ -381,7 +381,7 @@ class dispatcher: 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 @@ -548,7 +548,7 @@ def close_all(map=None, ignore_all=False): try: x.close() except OSError as x: - if x[0] == EBADF: + if x.args[0] == EBADF: pass elif not ignore_all: raise |