STINNER Victor added the comment:

On Windows, os.path.isdir calls nt._isdir(). Core of this C function:

        wchar_t *wpath = PyUnicode_AsUnicode(po);
        if (wpath == NULL)
            return NULL;

        attributes = GetFileAttributesW(wpath);
        if (attributes == INVALID_FILE_ATTRIBUTES)
            Py_RETURN_FALSE;
        ...

Can you please try to call directly nt._isdir()? Can also also compare with 
stat.S_ISDIR(os.stat(fn).st_mode)?

If the problem is something with the implementation of Unicode, it would be 
interesting to try to get the content of the string using:

 * print(ascii(path.encode("unicode_internal"))) # should be result of 
PyUnicode_AsUnicode() which is cached
 * print(ascii(path.encode("utf-8")))

----------

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

Reply via email to