summaryrefslogtreecommitdiff
path: root/Objects/object.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/object.c')
-rw-r--r--Objects/object.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/object.c b/Objects/object.c
index 51188b7862..25e64e1e74 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -403,6 +403,8 @@ PyObject_Str(PyObject *v)
if (v == NULL)
return PyUnicode_FromString("<NULL>");
if (PyUnicode_CheckExact(v)) {
+ if (PyUnicode_READY(v) < 0)
+ return NULL;
Py_INCREF(v);
return v;
}
@@ -424,6 +426,9 @@ PyObject_Str(PyObject *v)
Py_DECREF(res);
return NULL;
}
+ if (PyUnicode_READY(res) < 0)
+ return NULL;
+ assert(_PyUnicode_CheckConsistency(res, 1));
return res;
}