Skip to content

Commit 024bc08

Browse files
serhiy-storchakamiss-islington
authored andcommitted
pythongh-97758: Fix a crash in getpath_joinpath() called without arguments (pythonGH-97759)
(cherry picked from commit f8cbd79) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
1 parent 79b5c1a commit 024bc08

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Modules/getpath.c

Lines changed: 1 addition & 1 deletion
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)