Eryk Sun <eryk...@gmail.com> added the comment:
In Windows 7, FindFirstFileA uses a per-thread static buffer to decode the input bytes path to Unicode. This buffer limits the length to 259 characters (MAX_PATH - 1), even if a "\\?\" device path is used. Windows 8+ uses a dynamic buffer, but I don't see the point of switching to a dynamic buffer on our side given Windows 7 is still so widely used and the documentation still requires Unicode for long "\\?\" paths. Ideally, I think 2.7 should raise the same exception as 3.5 does in this case [1]. For example: >>> os.listdir(long_bytes_path) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: listdir: path too long for Windows [1]: https://github.com/python/cpython/blob/v3.5.7/Modules/posixmodule.c#L928 ---------- nosy: +eryksun _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue1776160> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com