Skip to content

Commit c97da58

Browse files
authored
Create EOFError exceptions with text EOF. (rthalley#1124)
Previously, EOFErrors were being created with no text, leading to bad looking error messages.
1 parent e03819b commit c97da58

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

dns/_asyncio_backend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def connection_lost(self, exc):
4242
if exc is None:
4343
# EOF we triggered. Is there a better way to do this?
4444
try:
45-
raise EOFError
45+
raise EOFError('EOF')
4646
except EOFError as e:
4747
self.recvfrom.set_exception(e)
4848
else:

dns/asyncquery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ async def _read_exactly(sock, count, expiration):
342342
while count > 0:
343343
n = await sock.recv(count, _timeout(expiration))
344344
if n == b"":
345-
raise EOFError
345+
raise EOFError('EOF')
346346
count = count - len(n)
347347
s = s + n
348348
return s

dns/query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,7 @@ def _net_read(sock, count, expiration):
976976
try:
977977
n = sock.recv(count)
978978
if n == b"":
979-
raise EOFError
979+
raise EOFError('EOF')
980980
count -= len(n)
981981
s += n
982982
except (BlockingIOError, ssl.SSLWantReadError):

0 commit comments

Comments
 (0)