]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Don't drop old slots if _unicode_to_string did not change anything.
authorMartin v. Löwis <martin@v.loewis.de>
Mon, 14 Oct 2002 21:11:34 +0000 (21:11 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Mon, 14 Oct 2002 21:11:34 +0000 (21:11 +0000)
Objects/typeobject.c

index cfd540958bab76f3d5cc6226cc5f3f9a4250f049..e11b87f62001b8e46643d19fcdbf57eeefa4119d 100644 (file)
@@ -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