Josh Rosenberg added the comment:

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.

----------
nosy: +josh.r

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

Reply via email to