From 13b1a5cc990e4bbffa47d58a6769b5940da7548e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Mon, 14 Oct 2002 21:11:34 +0000 Subject: [PATCH] Don't drop old slots if _unicode_to_string did not change anything. --- Objects/typeobject.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c index cfd540958b..e11b87f620 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 -- 2.50.0