[Python-checkins] gh-92841: Fix asyncio's RuntimeError: Event loop is closed (GH-92842)

miss-islington webhook-mailer at python.org
Tue May 17 18:59:37 EDT 2022


https://github.com/python/cpython/commit/36da1a77c6bad47a6acc98d6629e80c58b859f7d
commit: 36da1a77c6bad47a6acc98d6629e80c58b859f7d
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-05-17T15:59:29-07:00
summary:

gh-92841: Fix asyncio's RuntimeError: Event loop is closed (GH-92842)

(cherry picked from commit 33880b4b1c60f54aa9e7fa02698a3c82eafe3dc7)

Co-authored-by: Oleg Iarygin <oleg at arhadthedev.net>

files:
A Misc/NEWS.d/next/Windows/2022-05-16-11-45-06.gh-issue-92841.NQx107.rst
M Lib/asyncio/proactor_events.py

diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py
index 9636c6b4d28fa..ddb9daca02693 100644
--- a/Lib/asyncio/proactor_events.py
+++ b/Lib/asyncio/proactor_events.py
@@ -113,7 +113,7 @@ def close(self):
     def __del__(self, _warn=warnings.warn):
         if self._sock is not None:
             _warn(f"unclosed transport {self!r}", ResourceWarning, source=self)
-            self.close()
+            self._sock.close()
 
     def _fatal_error(self, exc, message='Fatal error on pipe transport'):
         try:
diff --git a/Misc/NEWS.d/next/Windows/2022-05-16-11-45-06.gh-issue-92841.NQx107.rst b/Misc/NEWS.d/next/Windows/2022-05-16-11-45-06.gh-issue-92841.NQx107.rst
new file mode 100644
index 0000000000000..5e1897e6ba1bc
--- /dev/null
+++ b/Misc/NEWS.d/next/Windows/2022-05-16-11-45-06.gh-issue-92841.NQx107.rst
@@ -0,0 +1,2 @@
+:mod:`asyncio` no longer throws ``RuntimeError: Event loop is closed`` on
+interpreter exit after asynchronous socket activity. Patch by Oleg Iarygin.



More information about the Python-checkins mailing list