[issue33414] Make shutil.copytree use os.scandir to take advantage of cached is_(dir|file|symlink)

Serhiy Storchaka report at bugs.python.org
Tue May 8 01:47:21 EDT 2018


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

The code with using scandir() is more complex and is different enough from the code with using listdir() for having significant risk of introducing bugs. Also using scandir() introduces a risk of leaking file descriptors.

We don't rewrite the code without good reasons. If you propose performance enhancement, please provide benchmark results that expose the benefit of this change. If it is not large enough, it is not worth to do.

Actually your change looks making the code slower: it reads the directory twice.

----------

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


More information about the Python-bugs-list mailing list