summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/exceptions.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2020-11-28 15:07:51 (GMT)
committerGitHub <noreply@github.com>2020-11-28 15:07:51 (GMT)
commitdf6c8bcffef3380869c8f76317610ce452880b25 (patch)
treee5a54dcf925a1d6726dcd8a2c3e689bf33f7dfec /Lib/asyncio/exceptions.py
parent761c5a1ce477b82cca35a79917c88d72d57ed776 (diff)
downloadcpython-df6c8bcffef3380869c8f76317610ce452880b25.zip
cpython-df6c8bcffef3380869c8f76317610ce452880b25.tar.gz
cpython-df6c8bcffef3380869c8f76317610ce452880b25.tar.bz2
bpo-34215: Clarify IncompleteReadError message when "expected" is None (GH-21925) (GH-23539)
Co-Authored-By: Tyler Bell <mrbell321@gmail.com> (cherry picked from commit 8085f742f4adfbc85f13fc734dfab036aa23acfb) Co-authored-by: Zackery Spytz <zspytz@gmail.com> Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Diffstat (limited to 'Lib/asyncio/exceptions.py')
-rw-r--r--Lib/asyncio/exceptions.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/asyncio/exceptions.py b/Lib/asyncio/exceptions.py
index e03602e..f07e448 100644
--- a/Lib/asyncio/exceptions.py
+++ b/Lib/asyncio/exceptions.py
@@ -34,8 +34,9 @@ class IncompleteReadError(EOFError):
- expected: total number of expected bytes (or None if unknown)
"""
def __init__(self, partial, expected):
+ r_expected = 'undefined' if expected is None else repr(expected)
super().__init__(f'{len(partial)} bytes read on a total of '
- f'{expected!r} expected bytes')
+ f'{r_expected} expected bytes')
self.partial = partial
self.expected = expected