summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Objects/typeobject.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index cfd5409..e11b87f 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -1169,8 +1169,10 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
#ifdef Py_USING_UNICODE
tmp = _unicode_to_string(slots, nslots);
- Py_DECREF(slots);
- slots = tmp;
+ if (tmp != slots) {
+ Py_DECREF(slots);
+ slots = tmp;
+ }
if (!tmp)
return NULL;
#endif