Skip to content

Commit cfde44b

Browse files
authored
Specify exception type in request method
1 parent 994c80f commit cfde44b

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

Lib/http/client.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,13 +1339,13 @@ def endheaders(self, message_body=None, *, encode_chunked=False):
13391339
def request(self, method, url, body=None, headers={}, *,
13401340
encode_chunked=False):
13411341
"""Send a complete request to the server."""
1342-
try:
1343-
self._send_request(method, url, body, headers, encode_chunked)
1344-
except:
1345-
# If the transmission fails (e.g. timeout), close the connection
1346-
# to reset the state machine to _CS_IDLE.
1347-
self.close()
1348-
raise
1342+
try:
1343+
self._send_request(method, url, body, headers, encode_chunked)
1344+
except Exception:
1345+
# If the transmission fails (e.g. timeout), close the connection
1346+
# to reset the state machine to _CS_IDLE
1347+
self.close()
1348+
raise
13491349

13501350
def _send_request(self, method, url, body, headers, encode_chunked):
13511351
# Honor explicitly requested Host: and Accept-Encoding: headers.

0 commit comments

Comments
 (0)