From: Nathan Henrie Date: Sat, 14 May 2016 21:28:58 +0000 (-0600) Subject: Explicitly use bytes to avoid TypeError with concatenation X-Git-Tag: v1.14.0~6^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6eff53b229a525ed434b5ce78e43709c0b069a9c;p=thirdparty%2Fdnspython.git Explicitly use bytes to avoid TypeError with concatenation 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. --- diff --git a/dns/query.py b/dns/query.py index cfa3f172..71fa38cb 100644 --- a/dns/query.py +++ b/dns/query.py @@ -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