Skip to content

Commit

Permalink
bpo-41467: Fix asyncio recv_into() on Windows (GH-21720)
Browse files Browse the repository at this point in the history
On Windows, fix asyncio recv_into() return value when the socket/pipe
is closed (BrokenPipeError): return 0 rather than an empty byte
string (b'').
(cherry picked from commit 602a971)

Co-authored-by: Victor Stinner <vstinner@python.org>
  • Loading branch information
miss-islington and vstinner authored Aug 4, 2020
1 parent b6724be commit 1d16229
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Lib/asyncio/windows_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ def recv_into(self, conn, buf, flags=0):
else:
ov.ReadFileInto(conn.fileno(), buf)
except BrokenPipeError:
return self._result(b'')
return self._result(0)

def finish_recv(trans, key, ov):
try:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
On Windows, fix asyncio ``recv_into()`` return value when the socket/pipe is
closed (:exc:`BrokenPipeError`): return ``0`` rather than an empty byte
string (``b''``).

0 comments on commit 1d16229

Please sign in to comment.