bpo-34215: Clarify IncompleteReadError message when "expected" is None (GH-21925)

Co-Authored-By: Tyler Bell <mrbell321@gmail.com>
This commit is contained in:
Zackery Spytz 2020-11-28 07:27:28 -07:00 committed by GitHub
parent 5b0194ed31
commit 8085f742f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 4 deletions

View file

@ -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