]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
check errno values in exceptions in a way that works with python 3
authorBob Halley <halley@nominum.com>
Mon, 2 May 2011 20:00:19 +0000 (21:00 +0100)
committerBob Halley <halley@nominum.com>
Mon, 2 May 2011 20:00:19 +0000 (21:00 +0100)
dns/query.py

index 5e010751f0b26356af463afa331e933350e24425..c41b4447ba65203c2b9b1ee35b4b886c5b9d32dc 100644 (file)
@@ -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,