diff options
author | Pablo Galindo <pablogsal@gmail.com> | 2022-01-14 21:20:56 (GMT) |
---|---|---|
committer | Pablo Galindo <pablogsal@gmail.com> | 2022-01-14 21:20:56 (GMT) |
commit | 2402f1e1f80499a870a86d848e5228d527d9be1d (patch) | |
tree | 3c9a8c5f87659b1610c880a0cbb93872f6f7b856 /Python/fileutils.c | |
parent | 01d4fe09763a6e55e38d338bf45e8c35e32a3581 (diff) | |
parent | c5640ef87511c960e339af37b486678788be910a (diff) | |
download | cpython-2402f1e1f80499a870a86d848e5228d527d9be1d.zip cpython-2402f1e1f80499a870a86d848e5228d527d9be1d.tar.gz cpython-2402f1e1f80499a870a86d848e5228d527d9be1d.tar.bz2 |
Merge remote-tracking branch 'upstream/main'
Diffstat (limited to 'Python/fileutils.c')
-rw-r--r-- | Python/fileutils.c | 37 |
1 files changed, 1 insertions, 36 deletions
diff --git a/Python/fileutils.c b/Python/fileutils.c index 151c6fe..9a71b83 100644 --- a/Python/fileutils.c +++ b/Python/fileutils.c @@ -2049,42 +2049,7 @@ _Py_abspath(const wchar_t *path, wchar_t **abspath_p) } #ifdef MS_WINDOWS - wchar_t woutbuf[MAX_PATH], *woutbufp = woutbuf; - DWORD result; - - result = GetFullPathNameW(path, - Py_ARRAY_LENGTH(woutbuf), woutbuf, - NULL); - if (!result) { - return -1; - } - - if (result >= Py_ARRAY_LENGTH(woutbuf)) { - if ((size_t)result <= (size_t)PY_SSIZE_T_MAX / sizeof(wchar_t)) { - woutbufp = PyMem_RawMalloc((size_t)result * sizeof(wchar_t)); - } - else { - woutbufp = NULL; - } - if (!woutbufp) { - *abspath_p = NULL; - return 0; - } - - result = GetFullPathNameW(path, result, woutbufp, NULL); - if (!result) { - PyMem_RawFree(woutbufp); - return -1; - } - } - - if (woutbufp != woutbuf) { - *abspath_p = woutbufp; - return 0; - } - - *abspath_p = _PyMem_RawWcsdup(woutbufp); - return 0; + return _PyOS_getfullpathname(path, abspath_p); #else wchar_t cwd[MAXPATHLEN + 1]; cwd[Py_ARRAY_LENGTH(cwd) - 1] = 0; |