[issue17137] Malfunctioning compiled code in Python 3.3 x64

STINNER Victor report at bugs.python.org
Tue Feb 5 23:01:40 CET 2013


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 <report at bugs.python.org>
<http://bugs.python.org/issue17137>
_______________________________________


More information about the Python-bugs-list mailing list