bpo-28953: Use raise from when raising new IncompleteRead (GH-29861)

Automerge-Triggered-By: GH:asvetlov
This commit is contained in:
180909 2021-12-07 08:10:49 +08:00 committed by GitHub
parent b7ef27bc08
commit c5c365220e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -593,8 +593,8 @@ class HTTPResponse(io.BufferedIOBase):
amt -= chunk_left amt -= chunk_left
self.chunk_left = 0 self.chunk_left = 0
return b''.join(value) return b''.join(value)
except IncompleteRead: except IncompleteRead as exc:
raise IncompleteRead(b''.join(value)) raise IncompleteRead(b''.join(value)) from exc
def _readinto_chunked(self, b): def _readinto_chunked(self, b):
assert self.chunked != _UNKNOWN assert self.chunked != _UNKNOWN