Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 13b1a5c

Browse files
committed
Don't drop old slots if _unicode_to_string did not change anything.
1 parent d919a59 commit 13b1a5c

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

Objects/typeobject.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,8 +1169,10 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
11691169

11701170
#ifdef Py_USING_UNICODE
11711171
tmp = _unicode_to_string(slots, nslots);
1172-
Py_DECREF(slots);
1173-
slots = tmp;
1172+
if (tmp != slots) {
1173+
Py_DECREF(slots);
1174+
slots = tmp;
1175+
}
11741176
if (!tmp)
11751177
return NULL;
11761178
#endif

0 commit comments

Comments
 (0)