Skip to content

Commit 08ada3e

Browse files
authored
[PR #9405/b96b01b backport][3.10] Only create the connection closed exception once (#9410)
1 parent 978ed74 commit 08ada3e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

aiohttp/client_reqrep.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,9 @@ async def _on_headers_request_sent(
829829
await trace.send_request_headers(method, url, headers)
830830

831831

832+
_CONNECTION_CLOSED_EXCEPTION = ClientConnectionError("Connection closed")
833+
834+
832835
class ClientResponse(HeadersMixin):
833836

834837
# Some of these attributes are None when created,
@@ -1188,7 +1191,7 @@ def _cleanup_writer(self) -> None:
11881191
def _notify_content(self) -> None:
11891192
content = self.content
11901193
if content and content.exception() is None:
1191-
set_exception(content, ClientConnectionError("Connection closed"))
1194+
set_exception(content, _CONNECTION_CLOSED_EXCEPTION)
11921195
self._released = True
11931196

11941197
async def wait_for_close(self) -> None:

0 commit comments

Comments
 (0)