]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Create EOFError exceptions with text EOF. (#1124)
authorBrian Wellington <bwelling@xbill.org>
Fri, 23 Aug 2024 20:31:57 +0000 (13:31 -0700)
committerGitHub <noreply@github.com>
Fri, 23 Aug 2024 20:31:57 +0000 (13:31 -0700)
Previously, EOFErrors were being created with no text, leading to bad
looking error messages.

dns/_asyncio_backend.py
dns/asyncquery.py
dns/query.py

index de18c40173cd4793bb3385446dbe3e5f7843982e..0c5e3bf8f8181e42f8c7c366320de23143efd734 100644 (file)
@@ -42,7 +42,7 @@ class _DatagramProtocol:
             if exc is None:
                 # EOF we triggered.  Is there a better way to do this?
                 try:
-                    raise EOFError
+                    raise EOFError('EOF')
                 except EOFError as e:
                     self.recvfrom.set_exception(e)
             else:
index 622c9d520f422c49c003c521d6636868663df160..05163fa9d7097ff38d514cf2e62b6ce3c7fa6aad 100644 (file)
@@ -342,7 +342,7 @@ async def _read_exactly(sock, count, expiration):
     while count > 0:
         n = await sock.recv(count, _timeout(expiration))
         if n == b"":
-            raise EOFError
+            raise EOFError('EOF')
         count = count - len(n)
         s = s + n
     return s
index 8e21ed2fa989ee2bce06f71e4f554a9b7a11cebd..4af4eb23475f5a99dd381c4d550d6fcf7b175d49 100644 (file)
@@ -976,7 +976,7 @@ def _net_read(sock, count, expiration):
         try:
             n = sock.recv(count)
             if n == b"":
-                raise EOFError
+                raise EOFError('EOF')
             count -= len(n)
             s += n
         except (BlockingIOError, ssl.SSLWantReadError):