diff options
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r-- | Objects/unicodeobject.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index fe0337fc46..501921df8e 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -11180,10 +11180,14 @@ unicode_index(PyObject *self, PyObject *args) &start, &end)) return NULL; - if (PyUnicode_READY(self) == -1) + if (PyUnicode_READY(self) == -1) { + Py_DECREF(substring); return NULL; - if (PyUnicode_READY(substring) == -1) + } + if (PyUnicode_READY(substring) == -1) { + Py_DECREF(substring); return NULL; + } result = any_find_slice(1, self, substring, start, end); |