[issue23243] asyncio: emit ResourceWarning warnings if transports/event loops are not explicitly closed

STINNER Victor report at bugs.python.org
Thu Jan 15 00:18:04 CET 2015


New submission from STINNER Victor:

I propose to add destructors to transports and event loops which emit a ResourceWarning if they are not closed.

The change should help to detect resource leaks and bugs.

Attached patch implements this issue. It only adds destructors on Python 3.4 and later, because older Python versions don't implement the PEP 442 (Safe object finalization) and so objects part of reference cycle would never be deleted.

The patch adds a new _closed attribute to BaseSubprocessTransport and _SSLProtocolTransport classes, to track if the transport was closed or not.

The patch should help to find bugs like this one:
https://code.google.com/p/tulip/issues/detail?id=218

----------
components: asyncio
files: resource_warnings.patch
keywords: patch
messages: 234043
nosy: gvanrossum, haypo, yselivanov
priority: normal
severity: normal
status: open
title: asyncio: emit ResourceWarning warnings if transports/event loops are not explicitly closed
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file37708/resource_warnings.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23243>
_______________________________________


More information about the Python-bugs-list mailing list