Visitar URL original
gh-97758: Fix a crash in getpath_joinpath() called without arguments by serhiy-storchaka · Pull Request #97759 · python/cpython · GitHub
Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-97758: Fix a crash in getpath_joinpath() called without arguments
  • Loading branch information
serhiy-storchaka committed Oct 3, 2022
commit 41a73a47dd9ca16e2691fdd38167b91032e441d5
2 changes: 1 addition & 1 deletion Modules/getpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ getpath_joinpath(PyObject *Py_UNUSED(self), PyObject *args)
}
Py_ssize_t n = PyTuple_GET_SIZE(args);
if (n == 0) {
return PyUnicode_FromString(NULL);
return PyUnicode_FromStringAndSize(NULL, 0);
}
/* Convert all parts to wchar and accumulate max final length */
wchar_t **parts = (wchar_t **)PyMem_Malloc(n * sizeof(wchar_t *));
Expand Down