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 gvanrossum
Recipients benhoyt, gvanrossum, larry, serhiy.storchaka, vstinner
Date 2016-01-12.18:36:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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.
Date User Action Args
2016-01-12 18:36:17gvanrossumsetrecipients: + gvanrossum, vstinner, larry, benhoyt, serhiy.storchaka
2016-01-12 18:36:17gvanrossumsetmessageid: <>
2016-01-12 18:36:17gvanrossumlinkissue25995 messages
2016-01-12 18:36:17gvanrossumcreate