summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorDarioDaF <dario.fagotto@gmail.com>2022-12-10 23:07:02 (GMT)
committerGitHub <noreply@github.com>2022-12-10 23:07:02 (GMT)
commit1bb68ba6d9de6bb7f00aee11d135123163f15887 (patch)
tree1be51c00ff9587e32cd497b2948506b65f7cbf4b /Lib/test
parentd5f8a2b6ad408368e728a389da918cead3ef7ee9 (diff)
downloadcpython-1bb68ba6d9de6bb7f00aee11d135123163f15887.zip
cpython-1bb68ba6d9de6bb7f00aee11d135123163f15887.tar.gz
cpython-1bb68ba6d9de6bb7f00aee11d135123163f15887.tar.bz2
gh-99941: Ensure that asyncio.Protocol.data_received receives immutable bytes (#100053)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_asyncio/test_proactor_events.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/test/test_asyncio/test_proactor_events.py b/Lib/test/test_asyncio/test_proactor_events.py
index ae30185..6cb7dc3 100644
--- a/Lib/test/test_asyncio/test_proactor_events.py
+++ b/Lib/test/test_asyncio/test_proactor_events.py
@@ -75,7 +75,10 @@ class ProactorSocketTransportTests(test_utils.TestCase):
called_buf = bytearray(self.buffer_size)
called_buf[:len(buf)] = buf
self.loop._proactor.recv_into.assert_called_with(self.sock, called_buf)
- self.protocol.data_received.assert_called_with(bytearray(buf))
+ self.protocol.data_received.assert_called_with(buf)
+ # assert_called_with maps bytearray and bytes to the same thing so check manually
+ # regression test for https://github.com/python/cpython/issues/99941
+ self.assertIsInstance(self.protocol.data_received.call_args.args[0], bytes)
@unittest.skipIf(sys.flags.optimize, "Assertions are disabled in optimized mode")
def test_loop_reading_no_data(self):