From 8faab1b6f4cf6c83dddb17862b811db277db73fa Mon Sep 17 00:00:00 2001 From: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Date: Sat, 29 Oct 2022 22:13:42 +0530 Subject: [PATCH] GH-90352: fix _SelectorDatagramTransport to inherit from DatagramTransport (GH-98844) (cherry picked from commit 9bdec0aa4516650e51b998418fb6188427137fed) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> --- Lib/asyncio/selector_events.py | 2 +- Lib/test/test_asyncio/test_selector_events.py | 4 ++++ .../Library/2022-10-29-09-42-20.gh-issue-90352.t8QEPt.rst | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Library/2022-10-29-09-42-20.gh-issue-90352.t8QEPt.rst diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py index 572d4a8ce12d49..fb169649e55166 100644 --- a/Lib/asyncio/selector_events.py +++ b/Lib/asyncio/selector_events.py @@ -990,7 +990,7 @@ def _reset_empty_waiter(self): self._empty_waiter = None -class _SelectorDatagramTransport(_SelectorTransport): +class _SelectorDatagramTransport(_SelectorTransport, transports.DatagramTransport): _buffer_factory = collections.deque diff --git a/Lib/test/test_asyncio/test_selector_events.py b/Lib/test/test_asyncio/test_selector_events.py index ac221da4432f1f..c09bdc1ebcacf2 100644 --- a/Lib/test/test_asyncio/test_selector_events.py +++ b/Lib/test/test_asyncio/test_selector_events.py @@ -1114,6 +1114,10 @@ def test_read_ready(self): self.protocol.datagram_received.assert_called_with( b'data', ('0.0.0.0', 1234)) + def test_transport_inheritance(self): + transport = self.datagram_transport() + self.assertIsInstance(transport, asyncio.DatagramTransport) + def test_read_ready_tryagain(self): transport = self.datagram_transport() diff --git a/Misc/NEWS.d/next/Library/2022-10-29-09-42-20.gh-issue-90352.t8QEPt.rst b/Misc/NEWS.d/next/Library/2022-10-29-09-42-20.gh-issue-90352.t8QEPt.rst new file mode 100644 index 00000000000000..8e80eae512e6d5 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2022-10-29-09-42-20.gh-issue-90352.t8QEPt.rst @@ -0,0 +1 @@ +Fix ``_SelectorDatagramTransport`` to inherit from :class:`~asyncio.DatagramTransport` in :mod:`asyncio`. Patch by Kumar Aditya.