summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 838f537..5925f80 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -322,7 +322,7 @@ PyUnicodeObject *_PyUnicode_New(Py_ssize_t length)
if ((unicode->length < length) &&
unicode_resize(unicode, length) < 0) {
PyObject_DEL(unicode->str);
- goto onError;
+ unicode->str = NULL;
}
}
else {
@@ -360,6 +360,8 @@ PyUnicodeObject *_PyUnicode_New(Py_ssize_t length)
return unicode;
onError:
+ /* XXX UNREF/NEWREF interface should be more symmetrical */
+ _Py_DEC_REFTOTAL;
_Py_ForgetReference((PyObject *)unicode);
PyObject_Del(unicode);
return NULL;