aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/asyncio/proactor_events.py
diff options
context:
space:
mode:
authorDarioDaF <dario.fagotto@gmail.com>2022-12-11 00:07:02 +0100
committerGitHub <noreply@github.com>2022-12-10 15:07:02 -0800
commit1bb68ba6d9de6bb7f00aee11d135123163f15887 (patch)
tree1be51c00ff9587e32cd497b2948506b65f7cbf4b /Lib/asyncio/proactor_events.py
parentd5f8a2b6ad408368e728a389da918cead3ef7ee9 (diff)
downloadcpython-1bb68ba6d9de6bb7f00aee11d135123163f15887.tar.gz
cpython-1bb68ba6d9de6bb7f00aee11d135123163f15887.zip
gh-99941: Ensure that asyncio.Protocol.data_received receives immutable bytes (#100053)
Diffstat (limited to 'Lib/asyncio/proactor_events.py')
-rw-r--r--Lib/asyncio/proactor_events.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py
index c6aab408fc7..1e2a730cf36 100644
--- a/Lib/asyncio/proactor_events.py
+++ b/Lib/asyncio/proactor_events.py
@@ -288,7 +288,8 @@ class _ProactorReadPipeTransport(_ProactorBasePipeTransport,
# we got end-of-file so no need to reschedule a new read
return
- data = self._data[:length]
+ # It's a new slice so make it immutable so protocols upstream don't have problems
+ data = bytes(memoryview(self._data)[:length])
else:
# the future will be replaced by next proactor.recv call
fut.cancel()