From: 180909 <734461790@qq.com> Date: Tue, 7 Dec 2021 00:10:49 +0000 (+0800) Subject: bpo-28953: Use `raise from` when raising new IncompleteRead (GH-29861) X-Git-Tag: v3.11.0a3~32 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c5c365220ed2c867fe81078f70b827de22db2ee6;p=thirdparty%2FPython%2Fcpython.git bpo-28953: Use `raise from` when raising new IncompleteRead (GH-29861) Automerge-Triggered-By: GH:asvetlov --- diff --git a/Lib/http/client.py b/Lib/http/client.py index a6ab135b2c38..f54172fd0dee 100644 --- a/Lib/http/client.py +++ b/Lib/http/client.py @@ -593,8 +593,8 @@ class HTTPResponse(io.BufferedIOBase): amt -= chunk_left self.chunk_left = 0 return b''.join(value) - except IncompleteRead: - raise IncompleteRead(b''.join(value)) + except IncompleteRead as exc: + raise IncompleteRead(b''.join(value)) from exc def _readinto_chunked(self, b): assert self.chunked != _UNKNOWN