diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py index d2ee49dd88f..bfa4590154f 100644 --- a/Lib/asyncio/selector_events.py +++ b/Lib/asyncio/selector_events.py @@ -1126,7 +1126,7 @@ class _SelectorSocketTransport(_SelectorTransport): 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 796037bcf59..ca555387dd2 100644 --- a/Lib/test/test_asyncio/test_selector_events.py +++ b/Lib/test/test_asyncio/test_selector_events.py @@ -1081,6 +1081,10 @@ class SelectorDatagramTransportTests(test_utils.TestCase): 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 00000000000..8e80eae512e --- /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.