From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 28 Jun 2022 09:43:14 +0000 (-0700) Subject: gh-92841: Fix asyncio's RuntimeError: Event loop is closed (GH-92842) (GH-92904) X-Git-Tag: v3.10.6~111 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=608ddd32779c0c2a2eb23d7295a4bb9af2895a4b;p=thirdparty%2FPython%2Fcpython.git gh-92841: Fix asyncio's RuntimeError: Event loop is closed (GH-92842) (GH-92904) (cherry picked from commit 33880b4b1c60f54aa9e7fa02698a3c82eafe3dc7) Co-authored-by: Oleg Iarygin --- diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py index 411685bbda55..9657f9680422 100644 --- a/Lib/asyncio/proactor_events.py +++ b/Lib/asyncio/proactor_events.py @@ -113,7 +113,7 @@ class _ProactorBasePipeTransport(transports._FlowControlMixin, 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 000000000000..5e1897e6ba1b --- /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.