diff options
Diffstat (limited to 'Modules/getpath.c')
-rw-r--r-- | Modules/getpath.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Modules/getpath.c b/Modules/getpath.c index fff502e..faf8b56 100644 --- a/Modules/getpath.c +++ b/Modules/getpath.c @@ -139,13 +139,16 @@ static wchar_t *lib_python = L"lib/python" VERSION; static int _wstat(const wchar_t* path, struct stat *buf) { - char fname[PATH_MAX]; - size_t res = wcstombs(fname, path, sizeof(fname)); - if (res == (size_t)-1) { + int err; + char *fname; + fname = _Py_wchar2char(path); + if (fname == NULL) { errno = EINVAL; return -1; } - return stat(fname, buf); + err = stat(fname, buf); + PyMem_Free(fname); + return err; } #endif |