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

This commit is contained in:
Oleg Iarygin 2022-05-18 01:27:32 +03:00 committed by GitHub
parent 6b932cb133
commit 33880b4b1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -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:

View File

@ -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.