Skip to content

Commit

Permalink
Remove duplicate checks in the StreamWriter
Browse files Browse the repository at this point in the history
Calling self._protocol.connected is a check to see if self._protocol.transport
is not None. Since we already check that, only do it once
  • Loading branch information
bdraco committed Sep 22, 2024
1 parent 3c1ca45 commit b7fd159
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions aiohttp/http_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ def _write(self, chunk: bytes) -> None:
size = len(chunk)
self.buffer_size += size
self.output_size += size
transport = self.transport
if not self._protocol.connected or transport is None or transport.is_closing():
transport = self._protocol.transport
if transport is None or transport.is_closing():
raise ClientConnectionResetError("Cannot write to closing transport")
transport.write(chunk)

Expand Down

0 comments on commit b7fd159

Please sign in to comment.