[Python-ideas] Hooks into the IO system to intercept raw file reads/writes

Guido van Rossum guido at python.org
Wed Feb 4 21:55:46 CET 2015


Well, there is a lot of I/O machinery that keeps itself alive unless you
explicitly close it. So __del__ is unlikely to be called until it's too
late (at the dreaded module teardown stage). We may have to document this
better, but explicit closing a loop is definitely strongly recommended. On
Windows I think it's mandatory if you use the IOCP loop.

On Wed, Feb 4, 2015 at 12:21 PM, Greg Ewing <greg.ewing at canterbury.ac.nz>
wrote:

> Paul Moore wrote:
>
>> ... found it. You need loop.close() at the end. Maybe the loop object
>> should close itself in the __del__ method, like file objects?
>>
>
> Yeah, this looks like a bug -- I didn't notice anything
> in the docs about it being mandatory to close() a loop
> when you're finished with it, and such a requirement
> seems rather unpythonic.
>
> --
> Greg
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>



-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150204/890d7537/attachment.html>


More information about the Python-ideas mailing list