This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author asvetlov
Recipients asvetlov, gvanrossum, vstinner, yselivanov
Date 2015-11-13.21:49:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1447451383.41.0.887300487053.issue25074@psf.upfronthosting.co.za>
In-reply-to
Content
Yes, the approach use hackery shadows for binding global variables on shutdown stage.
The same I've found in subprocess module: see https://github.com/python/cpython/blob/master/Lib/subprocess.py#L1544

The problem is: I want to inform users about unclosed resources.
Printouts like
`TypeError: 'NoneType' object is not callable`
or 
`AttributeError: 'NoneType' object has no attribute 'warn'` are too confusing for casual developer.

On shutdown logger and warnings modules may be destroyed at the moment of __del__ call, so `warnings.warn`, `loop.call_exception_handler` etc. are forbidden.

As an option we can add atexit handler to store shutdown flag into loop object (I don't know other way to get info is interpreter in shutdown or not).

According to the flag we can eihter print some short text about non-closed resources or raise proper ResourceWarning along with comprehensive logging with stacktrace if PYTHONASYNCIO is on.

Maybe I've missed something and you can suggest better solution.
History
Date User Action Args
2015-11-13 21:49:43asvetlovsetrecipients: + asvetlov, gvanrossum, vstinner, yselivanov
2015-11-13 21:49:43asvetlovsetmessageid: <1447451383.41.0.887300487053.issue25074@psf.upfronthosting.co.za>
2015-11-13 21:49:43asvetlovlinkissue25074 messages
2015-11-13 21:49:43asvetlovcreate