![](https://secure.gravatar.com/avatar/8ac615df352a970211b0e3d94a307c6d.jpg?s=120&d=mm&r=g)
Author: victor.stinner Date: Fri Jul 30 03:41:57 2010 New Revision: 83249 Log: NullImporter constructor uses PyUnicode_AsWideChar() instead of _PyUnicode_AsString(), and GetFileAttributesW() instead of instead of GetFileAttributesA(), to be fully unicode compliant. Modified: python/branches/import_unicode/Python/import.c Modified: python/branches/import_unicode/Python/import.c ============================================================================== --- python/branches/import_unicode/Python/import.c (original) +++ python/branches/import_unicode/Python/import.c Fri Jul 30 03:41:57 2010 @@ -3828,14 +3828,16 @@ } #else /* MS_WINDOWS */ DWORD rv; - char *path; - /* FIXME: use PyUnicode_AsWideChar() and GetFileAttributesW() */ - path = _PyUnicode_AsString(pathobj); + wchar_t path[MAXPATHLEN+1]; + Py_ssize_t len; + len = PyUnicode_AsWideChar(pathobj, path, sizeof(path)); + if (len == -1) + return -1; /* see issue1293 and issue3677: * stat() on Windows doesn't recognise paths like * "e:\\shared\\" and "\\\\whiterab-c2znlh\\shared" as dirs. */ - rv = GetFileAttributesA(path); + rv = GetFileAttributesW(path); if (rv != INVALID_FILE_ATTRIBUTES) { /* it exists */ if (rv & FILE_ATTRIBUTE_DIRECTORY) {
participants (1)
-
victor.stinner