Fix PyUnicode_InternImmortal(): PyUnicode_InternInPlace() may changes *p

This commit is contained in:
Victor Stinner 2011-10-23 20:07:00 +02:00
parent 9faa384bed
commit af9e4b8c29

View File

@ -14001,11 +14001,9 @@ PyUnicode_InternInPlace(PyObject **p)
void void
PyUnicode_InternImmortal(PyObject **p) PyUnicode_InternImmortal(PyObject **p)
{ {
PyUnicodeObject *u = (PyUnicodeObject *)*p;
PyUnicode_InternInPlace(p); PyUnicode_InternInPlace(p);
if (PyUnicode_CHECK_INTERNED(*p) != SSTATE_INTERNED_IMMORTAL) { if (PyUnicode_CHECK_INTERNED(*p) != SSTATE_INTERNED_IMMORTAL) {
_PyUnicode_STATE(u).interned = SSTATE_INTERNED_IMMORTAL; _PyUnicode_STATE(*p).interned = SSTATE_INTERNED_IMMORTAL;
Py_INCREF(*p); Py_INCREF(*p);
} }
} }