]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-28953: Use `raise from` when raising new IncompleteRead (GH-29861)
author180909 <734461790@qq.com>
Tue, 7 Dec 2021 00:10:49 +0000 (08:10 +0800)
committerGitHub <noreply@github.com>
Tue, 7 Dec 2021 00:10:49 +0000 (16:10 -0800)
Automerge-Triggered-By: GH:asvetlov
Lib/http/client.py

index a6ab135b2c3879b588bc24f8fa4c267180d51348..f54172fd0deeaed757219ce21a17f1df5e28d4d8 100644 (file)
@@ -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