]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-100348: Fix ref cycle in `asyncio._SelectorSocketTransport` with `_read_ready_cb...
authorRichard Kojedzinszky <rkojedzinszky@users.noreply.github.com>
Tue, 20 Dec 2022 10:40:56 +0000 (11:40 +0100)
committerGitHub <noreply@github.com>
Tue, 20 Dec 2022 10:40:56 +0000 (16:10 +0530)
Lib/asyncio/selector_events.py
Misc/NEWS.d/next/Library/2022-12-19-19-30-06.gh-issue-100348.o7IAHh.rst [new file with mode: 0644]

index 3d30006198f6716699f95572a362a7bca671ab0a..74f289f0e6f81165a6f18c1aeb22cd8874e0f0d5 100644 (file)
@@ -1133,6 +1133,10 @@ class _SelectorSocketTransport(_SelectorTransport):
     def _reset_empty_waiter(self):
         self._empty_waiter = None
 
+    def close(self):
+        self._read_ready_cb = None
+        super().close()
+
 
 class _SelectorDatagramTransport(_SelectorTransport, transports.DatagramTransport):
 
diff --git a/Misc/NEWS.d/next/Library/2022-12-19-19-30-06.gh-issue-100348.o7IAHh.rst b/Misc/NEWS.d/next/Library/2022-12-19-19-30-06.gh-issue-100348.o7IAHh.rst
new file mode 100644 (file)
index 0000000..b5d4f7c
--- /dev/null
@@ -0,0 +1,2 @@
+Fix ref cycle in :class:`!asyncio._SelectorSocketTransport` by removing ``_read_ready_cb`` in ``close``.
+