Mailing List Archive

bpo-28953: Use `raise from` when raising new IncompleteRead (GH-29861)
https://github.com/python/cpython/commit/c5c365220ed2c867fe81078f70b827de22db2ee6
commit: c5c365220ed2c867fe81078f70b827de22db2ee6
branch: main
author: 180909 <734461790@qq.com>
committer: miss-islington <31488909+miss-islington@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

_______________________________________________
Python-checkins mailing list
Python-checkins@python.org
https://mail.python.org/mailman/listinfo/python-checkins