mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
gh-99941: Ensure that asyncio.Protocol.data_received receives immutable bytes (#100053)
This commit is contained in:
parent
d5f8a2b6ad
commit
1bb68ba6d9
4 changed files with 10 additions and 4 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue