Skip to content

Commit 31392e7

Browse files
author
Victor Stinner
committed
Fix my_basename(): make the string ready
1 parent b619bb2 commit 31392e7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Objects/exceptions.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -963,8 +963,13 @@ static PyObject*
963963
my_basename(PyObject *name)
964964
{
965965
Py_ssize_t i, size, offset;
966-
int kind = PyUnicode_KIND(name);
967-
void *data = PyUnicode_DATA(name);
966+
int kind;
967+
void *data;
968+
969+
if (PyUnicode_READY(name))
970+
return NULL;
971+
kind = PyUnicode_KIND(name);
972+
data = PyUnicode_DATA(name);
968973
size = PyUnicode_GET_LENGTH(name);
969974
offset = 0;
970975
for(i=0; i < size; i++) {

0 commit comments

Comments
 (0)