Guido van Rossum added the comment:

I like them both, if I had to choose I'd pick patch 2.

But yes, we need to add a close() method to the scandir iterator object.

In the meantime, I am still worried about what would happen if somehow the loop 
got interrupted and the frame got kept alive and the iterator wasn't closed by 
its dealloc until much later.  This kind of thing was common in asyncio and we 
had to resort to similar tricks to break some cycles. Maybe you can add a 
try/finally that *deletes* scandir_it to force it to close itself (at least in 
CPython)? That can go into 3.5.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25995>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to