[Python-checkins] bpo-28953: Use `raise from` when raising new IncompleteRead (GH-29861)

miss-islington webhook-mailer at python.org
Mon Dec 6 19:10:57 EST 2021


https://github.com/python/cpython/commit/c5c365220ed2c867fe81078f70b827de22db2ee6
commit: c5c365220ed2c867fe81078f70b827de22db2ee6
branch: main
author: 180909 <734461790 at qq.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2021-12-06T16:10:49-08:00
summary:

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



Automerge-Triggered-By: GH:asvetlov

files:
M Lib/http/client.py

diff --git a/Lib/http/client.py b/Lib/http/client.py
index a6ab135b2c387..f54172fd0deea 100644
--- a/Lib/http/client.py
+++ b/Lib/http/client.py
@@ -593,8 +593,8 @@ def _read_chunked(self, amt=None):
                     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



More information about the Python-checkins mailing list