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 josh.r
Recipients enkore, josh.r, serhiy.storchaka, xiang.zhang
Date 2016-10-31.16:37:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1477931830.65.0.116938256174.issue28564@psf.upfronthosting.co.za>
In-reply-to
Content
You need to cache the names up front because the loop is unlinking entries, and readdir isn't consistent when the directory entries are mutated between calls. https://github.com/kripken/emscripten/issues/2528

FindFirstFile/FindNextFile likely has similar issues, even if they're not consistently seen (due to DeleteFile itself not guaranteeing deletion until the last handle to the file is closed).

scandir might save some stat calls, but you'd need to convert it from generator to list before the loop begins, which would limit the savings a bit.
History
Date User Action Args
2016-10-31 16:37:10josh.rsetrecipients: + josh.r, serhiy.storchaka, xiang.zhang, enkore
2016-10-31 16:37:10josh.rsetmessageid: <1477931830.65.0.116938256174.issue28564@psf.upfronthosting.co.za>
2016-10-31 16:37:10josh.rlinkissue28564 messages
2016-10-31 16:37:10josh.rcreate