mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-106242: Fix path truncation in os.path.normpath (GH-106816)
This commit is contained in:
parent
607f18c894
commit
0932272431
5 changed files with 30 additions and 9 deletions
|
@ -5274,7 +5274,9 @@ os__path_normpath_impl(PyObject *module, PyObject *path)
|
|||
if (!buffer) {
|
||||
return NULL;
|
||||
}
|
||||
PyObject *result = PyUnicode_FromWideChar(_Py_normpath(buffer, len), -1);
|
||||
Py_ssize_t norm_len;
|
||||
wchar_t *norm_path = _Py_normpath_and_size(buffer, len, &norm_len);
|
||||
PyObject *result = PyUnicode_FromWideChar(norm_path, norm_len);
|
||||
PyMem_Free(buffer);
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue