Mailing List Archive

bpo-41467: Fix asyncio recv_into() on Windows (GH-21720)
https://github.com/python/cpython/commit/602a971a2af3a685d625c912c400cadd452718b1
commit: 602a971a2af3a685d625c912c400cadd452718b1
branch: master
author: Victor Stinner <vstinner@python.org>
committer: GitHub <noreply@github.com>
date: 2020-08-04T02:40:10+02:00
summary:

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'').

files:
A Misc/NEWS.d/next/Library/2020-08-04-00-20-30.bpo-41467.Z8DgTL.rst
M Lib/asyncio/windows_events.py

diff --git a/Lib/asyncio/windows_events.py b/Lib/asyncio/windows_events.py
index c07fe3241c569..a6759b78bd801 100644
--- a/Lib/asyncio/windows_events.py
+++ b/Lib/asyncio/windows_events.py
@@ -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:
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 0000000000000..f12693e117631
--- /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''``).

_______________________________________________
Python-checkins mailing list
Python-checkins@python.org
https://mail.python.org/mailman/listinfo/python-checkins
bpo-41467: Fix asyncio recv_into() on Windows (GH-21720) [ In reply to ]
https://github.com/python/cpython/commit/b934d832d1e16bf235c536dcde3006faf29757fc
commit: b934d832d1e16bf235c536dcde3006faf29757fc
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
committer: GitHub <noreply@github.com>
date: 2020-08-03T17:58:06-07:00
summary:

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'').
(cherry picked from commit 602a971a2af3a685d625c912c400cadd452718b1)

Co-authored-by: Victor Stinner <vstinner@python.org>

files:
A Misc/NEWS.d/next/Library/2020-08-04-00-20-30.bpo-41467.Z8DgTL.rst
M Lib/asyncio/windows_events.py

diff --git a/Lib/asyncio/windows_events.py b/Lib/asyncio/windows_events.py
index ac51109ff1a83..12e87abfbf2ea 100644
--- a/Lib/asyncio/windows_events.py
+++ b/Lib/asyncio/windows_events.py
@@ -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:
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 0000000000000..f12693e117631
--- /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''``).

_______________________________________________
Python-checkins mailing list
Python-checkins@python.org
https://mail.python.org/mailman/listinfo/python-checkins