]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Add compatibility with BlockingIOError for Python3 158/head
authorNathan Henrie <nate@n8henrie.com>
Sat, 14 May 2016 21:10:52 +0000 (15:10 -0600)
committerNathan Henrie <nate@n8henrie.com>
Sat, 14 May 2016 21:10:52 +0000 (15:10 -0600)
Fixes rthalley/dnspython#156

At least in Python3.5, BlockingIOError is not subscriptable. Its
`.errno` attribute seems to be able to provide the necessary
information.

dns/query.py

index cfa3f172032cc22554937bb60385a2d3e0145fec..841dff4fd8412ba18f9ba77ad8476978ca33869b 100644 (file)
@@ -292,9 +292,12 @@ 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 hasattr(v, 'errno'):
+            v_err = v.errno
+        else:
+            v_err = v[0]
+        if v_err not in [errno.EINPROGRESS, errno.EWOULDBLOCK, errno.EALREADY]:
             raise v