From f2b80a04670f7d09486628c91e5d7aa2aef33633 Mon Sep 17 00:00:00 2001 From: Oleg Iarygin Date: Mon, 16 May 2022 11:02:24 +0300 Subject: [PATCH 1/2] Fix asyncio's RuntimeError: Event loop is closed --- Lib/asyncio/proactor_events.py | 2 +- .../next/Windows/2022-05-16-11-45-06.gh-issue-92841.NQx107.rst | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Windows/2022-05-16-11-45-06.gh-issue-92841.NQx107.rst diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py index 9636c6b4d28fad..ddb9daca026936 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 00000000000000..0903d9f3162de2 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2022-05-16-11-45-06.gh-issue-92841.NQx107.rst @@ -0,0 +1,2 @@ +:meth:`asyncio` no longer throws ``RuntimeError: Event loop is closed`` on +interpreter exit after asynchronous socket activity. Patch by Oleg Iarygin. From b7d21274b9273956ab3642ec4e31af94ac02e25b Mon Sep 17 00:00:00 2001 From: Oleg Iarygin Date: Tue, 17 May 2022 23:29:33 +0300 Subject: [PATCH 2/2] Update Misc/NEWS.d/next/Windows/2022-05-16-11-45-06.gh-issue-92841.NQx107.rst Co-authored-by: Steve Dower --- .../next/Windows/2022-05-16-11-45-06.gh-issue-92841.NQx107.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index 0903d9f3162de2..5e1897e6ba1bc6 100644 --- 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 @@ -1,2 +1,2 @@ -:meth:`asyncio` no longer throws ``RuntimeError: Event loop is closed`` on +:mod:`asyncio` no longer throws ``RuntimeError: Event loop is closed`` on interpreter exit after asynchronous socket activity. Patch by Oleg Iarygin.