]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix my_basename(): make the string ready
authorVictor Stinner <victor.stinner@haypocalc.com>
Wed, 5 Oct 2011 18:14:23 +0000 (20:14 +0200)
committerVictor Stinner <victor.stinner@haypocalc.com>
Wed, 5 Oct 2011 18:14:23 +0000 (20:14 +0200)
Objects/exceptions.c

index 703e72e65b00ad24ff5cb447e5f7fd80d2403036..60b340b9a3217aee950c41c054523fbd2f57e330 100644 (file)
@@ -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++) {