[issue33105] os.path.isfile returns false on Windows when file path is longer than 260 characters

Eryk Sun report at bugs.python.org
Mon Mar 1 08:02:07 EST 2021


Eryk Sun <eryksun at gmail.com> added the comment:

I'm closing this as not a bug. If the process limits DOS paths to MAX_PATH, then checking os.path.isfile() should not be special cased to support longer DOS paths because calling open() on such a path will raise FileNotFoundError. My suggestion in msg314126 to have stat() fall back on querying the directory in this case is too magical, even if it does make os.stat() more consistent with os.listdir() and the stat result from os.scandir().

----------
resolution:  -> not a bug
stage: needs patch -> resolved
status: open -> closed

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


More information about the Python-bugs-list mailing list