]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Explicitly use bytes to avoid TypeError with concatenation 159/head
authorNathan Henrie <nate@n8henrie.com>
Sat, 14 May 2016 21:28:58 +0000 (15:28 -0600)
committerNathan Henrie <nate@n8henrie.com>
Sat, 14 May 2016 21:28:58 +0000 (15:28 -0600)
Fixes rthalley/dnspython#157

On Python3, this previously would raise a TypeError when one tried to
add bytes and a string, this initializes s and n to bytes instead.

dns/query.py

index cfa3f172032cc22554937bb60385a2d3e0145fec..71fa38cb12b9c4aea434d19390e85b5b401fb431 100644 (file)
@@ -264,11 +264,11 @@ def _net_read(sock, count, expiration):
     A Timeout exception will be raised if the operation is not completed
     by the expiration time.
     """
-    s = ''
+    s = b''
     while count > 0:
         _wait_for_readable(sock, expiration)
         n = sock.recv(count)
-        if n == '':
+        if n == b'':
             raise EOFError
         count = count - len(n)
         s = s + n