From: Bob Halley Date: Mon, 2 May 2011 20:00:19 +0000 (+0100) Subject: check errno values in exceptions in a way that works with python 3 X-Git-Tag: v1.10.0-py3~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=987ee2c5ebe1cdafa740a64095a2c3e08c78d7c4;p=thirdparty%2Fdnspython.git check errno values in exceptions in a way that works with python 3 --- diff --git a/dns/query.py b/dns/query.py index 5e010751..c41b4447 100644 --- a/dns/query.py +++ b/dns/query.py @@ -110,7 +110,7 @@ def _wait_for(fd, readable, writable, error, expiration): if not _polling_backend(fd, readable, writable, error, timeout): raise dns.exception.Timeout except select.error as e: - if e.args[0] != errno.EINTR: + if e.errno != errno.EINTR: raise e done = True @@ -247,9 +247,9 @@ def _connect(s, address): s.connect(address) except socket.error: (ty, v) = sys.exc_info()[:2] - if v[0] != errno.EINPROGRESS and \ - v[0] != errno.EWOULDBLOCK and \ - v[0] != errno.EALREADY: + if v.errno != errno.EINPROGRESS and \ + v.errno != errno.EWOULDBLOCK and \ + v.errno != errno.EALREADY: raise v def tcp(q, where, timeout=None, port=53, af=None, source=None, source_port=0,