Skip to content

Commit 73e3510

Browse files
gh-97758: Fix a crash in getpath_joinpath() called without arguments (GH-97759)
(cherry picked from commit f8cbd79) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
1 parent 79b5c1a commit 73e3510

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Modules/getpath.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ getpath_joinpath(PyObject *Py_UNUSED(self), PyObject *args)
261261
}
262262
Py_ssize_t n = PyTuple_GET_SIZE(args);
263263
if (n == 0) {
264-
return PyUnicode_FromString(NULL);
264+
return PyUnicode_FromStringAndSize(NULL, 0);
265265
}
266266
/* Convert all parts to wchar and accumulate max final length */
267267
wchar_t **parts = (wchar_t **)PyMem_Malloc(n * sizeof(wchar_t *));

0 commit comments

Comments
 (0)