diff options
Diffstat (limited to 'Lib/asyncio/unix_events.py')
-rw-r--r-- | Lib/asyncio/unix_events.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py index 1a62db4f59..73d4bda7c2 100644 --- a/Lib/asyncio/unix_events.py +++ b/Lib/asyncio/unix_events.py @@ -511,10 +511,9 @@ class _UnixReadPipeTransport(transports.ReadTransport): if not self._closing: self._close(None) - def __del__(self): + def __del__(self, _warn=warnings.warn): if self._pipe is not None: - warnings.warn(f"unclosed transport {self!r}", ResourceWarning, - source=self) + _warn(f"unclosed transport {self!r}", ResourceWarning, source=self) self._pipe.close() def _fatal_error(self, exc, message='Fatal error on pipe transport'): @@ -707,10 +706,9 @@ class _UnixWritePipeTransport(transports._FlowControlMixin, # write_eof is all what we needed to close the write pipe self.write_eof() - def __del__(self): + def __del__(self, _warn=warnings.warn): if self._pipe is not None: - warnings.warn(f"unclosed transport {self!r}", ResourceWarning, - source=self) + _warn(f"unclosed transport {self!r}", ResourceWarning, source=self) self._pipe.close() def abort(self): |