From: Victor Stinner Date: Tue, 4 Aug 2020 00:40:10 +0000 (+0200) Subject: bpo-41467: Fix asyncio recv_into() on Windows (GH-21720) X-Git-Tag: v3.10.0a1~314 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=602a971a2af3a685d625c912c400cadd452718b1;p=thirdparty%2FPython%2Fcpython.git bpo-41467: Fix asyncio recv_into() on Windows (GH-21720) On Windows, fix asyncio recv_into() return value when the socket/pipe is closed (BrokenPipeError): return 0 rather than an empty byte string (b''). --- diff --git a/Lib/asyncio/windows_events.py b/Lib/asyncio/windows_events.py index c07fe3241c56..a6759b78bd80 100644 --- a/Lib/asyncio/windows_events.py +++ b/Lib/asyncio/windows_events.py @@ -469,7 +469,7 @@ class IocpProactor: else: ov.ReadFileInto(conn.fileno(), buf) except BrokenPipeError: - return self._result(b'') + return self._result(0) def finish_recv(trans, key, ov): try: diff --git a/Misc/NEWS.d/next/Library/2020-08-04-00-20-30.bpo-41467.Z8DgTL.rst b/Misc/NEWS.d/next/Library/2020-08-04-00-20-30.bpo-41467.Z8DgTL.rst new file mode 100644 index 000000000000..f12693e11763 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2020-08-04-00-20-30.bpo-41467.Z8DgTL.rst @@ -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''``).