From 6eff53b229a525ed434b5ce78e43709c0b069a9c Mon Sep 17 00:00:00 2001 From: Nathan Henrie Date: Sat, 14 May 2016 15:28:58 -0600 Subject: [PATCH] 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. --- dns/query.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 -- 2.47.3