Kevin Dwyer added the comment: Ok, it seems that Python 2.5 implements two new functions Py_GetFileAttributesExA and Py_GetFileAttributesExW in posixmodule.c within the #ifdef MS_WINDOWS block that may return ERROR_INVALID_PARAMETER to os.stat, which will percolate WindowsError up to os.exists():
In both functions we find: static BOOL WINAPI Py_GetFileAttributesExA(LPCSTR pszFile, GET_FILEEX_INFO_LEVELS level, LPVOID pv) { BOOL result; LPWIN32_FILE_ATTRIBUTE_DATA pfad = pv; /* First try to use the system's implementation, if that is available and either succeeds to gives an error other than that it isn't implemented. */ check_gfax(); if (gfaxa) { result = gfaxa(pszFile, level, pv); if (result || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) return result; } /* It's either not present, or not implemented. Emulate using FindFirstFile. */ if (level != GetFileExInfoStandard) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; ... static BOOL WINAPI Py_GetFileAttributesExW(LPCWSTR pszFile, GET_FILEEX_INFO_LEVELS level, LPVOID pv) { BOOL result; LPWIN32_FILE_ATTRIBUTE_DATA pfad = pv; /* First try to use the system's implementation, if that is available and either succeeds to gives an error other than that it isn't implemented. */ check_gfax(); if (gfaxa) { result = gfaxw(pszFile, level, pv); if (result || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) return result; } /* It's either not present, or not implemented. Emulate using FindFirstFile. */ if (level != GetFileExInfoStandard) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; ... I'm neither a C nor a win32api programmer - can anyone explain the purpose of this code? __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1311> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com