From 31392e741da2ceb5256ae626766d29454a0b5658 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 5 Oct 2011 20:14:23 +0200 Subject: [PATCH] Fix my_basename(): make the string ready --- Objects/exceptions.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Objects/exceptions.c b/Objects/exceptions.c index 703e72e65b00..60b340b9a321 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -963,8 +963,13 @@ static PyObject* my_basename(PyObject *name) { Py_ssize_t i, size, offset; - int kind = PyUnicode_KIND(name); - void *data = PyUnicode_DATA(name); + int kind; + void *data; + + if (PyUnicode_READY(name)) + return NULL; + kind = PyUnicode_KIND(name); + data = PyUnicode_DATA(name); size = PyUnicode_GET_LENGTH(name); offset = 0; for(i=0; i < size; i++) { -- 2.47.3