[issue40486] pathlib's iterdir doesn't specify what happens if directory content change

Serhiy Storchaka report at bugs.python.org
Sun May 3 13:25:39 EDT 2020


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

There is no principal difference between Path.iterdir() and os.listdir(). Somebody can change the directory during iteration. The only difference is that in the latter case you iterate in C instead of Python, so it is less easy to catch a race condition. What would happen is OS and FS specific. Depending on OS and FS it may be even possible to get the same name several times when somebody quickly creates and removes entities in the directory.

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40486>
_______________________________________


More information about the Python-bugs-list mailing list