https://github.com/python/cpython/commit/df22bcdf5fca83db3f76dfec36cfd7cc7d4ff18a commit: df22bcdf5fca83db3f76dfec36cfd7cc7d4ff18a branch: 3.14 author: Miss Islington (bot) <[email protected]> committer: picnixz <[email protected]> date: 2025-12-14T10:17:54Z summary:
[3.14] gh-141938: document treatment of `OSError` raised by `HTTPConnection.getresponse` (GH-142339) (#142704) gh-141938: document treatment of `OSError` raised by `HTTPConnection.getresponse` (GH-142339) (cherry picked from commit 11aef219f5186fcb9b8121651e5bdbd7e84c3a4e) Co-authored-by: Bénédikt Tran <[email protected]> files: M Doc/library/http.client.rst diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst index 75aa818ab9f5d7..14c67a0600f728 100644 --- a/Doc/library/http.client.rst +++ b/Doc/library/http.client.rst @@ -311,6 +311,12 @@ HTTPConnection Objects :class:`str` or bytes-like object that is not also a file as the body representation. + .. note:: + + Note that you must have read the whole response or call :meth:`close` + if :meth:`getresponse` raised an non-:exc:`ConnectionError` exception + before you can send a new request to the server. + .. versionchanged:: 3.2 *body* can now be an iterable. @@ -326,16 +332,15 @@ HTTPConnection Objects Should be called after a request is sent to get the response from the server. Returns an :class:`HTTPResponse` instance. - .. note:: - - Note that you must have read the whole response before you can send a new - request to the server. - .. versionchanged:: 3.5 If a :exc:`ConnectionError` or subclass is raised, the :class:`HTTPConnection` object will be ready to reconnect when a new request is sent. + Note that this does not apply to :exc:`OSError`\s raised by the underlying + socket. Instead the caller is responsible to call :meth:`close` on the + existing connection. + .. method:: HTTPConnection.set_debuglevel(level) _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
