diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-10-05 18:14:23 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-10-05 18:14:23 (GMT) |
commit | 31392e741da2ceb5256ae626766d29454a0b5658 (patch) | |
tree | 6dde4ef895931eabc83c93e4d923986f2c8f6f4a /Objects/exceptions.c | |
parent | b619bb27edba24c9c1ca08b682e08afd33e9ea0f (diff) | |
download | cpython-31392e741da2ceb5256ae626766d29454a0b5658.zip cpython-31392e741da2ceb5256ae626766d29454a0b5658.tar.gz cpython-31392e741da2ceb5256ae626766d29454a0b5658.tar.bz2 |
Fix my_basename(): make the string ready
Diffstat (limited to 'Objects/exceptions.c')
-rw-r--r-- | Objects/exceptions.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Objects/exceptions.c b/Objects/exceptions.c index 703e72e..60b340b 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++) { |