]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-90352: fix _SelectorDatagramTransport to inherit from DatagramTransport (#98844)
authorKumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Sat, 29 Oct 2022 16:43:42 +0000 (22:13 +0530)
committerGitHub <noreply@github.com>
Sat, 29 Oct 2022 16:43:42 +0000 (09:43 -0700)
Lib/asyncio/selector_events.py
Lib/test/test_asyncio/test_selector_events.py
Misc/NEWS.d/next/Library/2022-10-29-09-42-20.gh-issue-90352.t8QEPt.rst [new file with mode: 0644]

index d2ee49dd88f8cf212bc096a1200347dc03bb3346..bfa4590154f37210b105eceb1a7c95f8c38d459e 100644 (file)
@@ -1126,7 +1126,7 @@ class _SelectorSocketTransport(_SelectorTransport):
         self._empty_waiter = None
 
 
-class _SelectorDatagramTransport(_SelectorTransport):
+class _SelectorDatagramTransport(_SelectorTransport, transports.DatagramTransport):
 
     _buffer_factory = collections.deque
 
index 796037bcf59c49b1c5dd700b653928fbd1318e8f..ca555387dd2493d28bb7fcbdf686b1fb0a9887fa 100644 (file)
@@ -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 (file)
index 0000000..8e80eae
--- /dev/null
@@ -0,0 +1 @@
+Fix ``_SelectorDatagramTransport`` to inherit from :class:`~asyncio.DatagramTransport` in :mod:`asyncio`. Patch by Kumar Aditya.