]> granicus.if.org Git - python/commitdiff
Fix PyUnicode_InternImmortal(): PyUnicode_InternInPlace() may changes *p
authorVictor Stinner <victor.stinner@haypocalc.com>
Sun, 23 Oct 2011 18:07:00 +0000 (20:07 +0200)
committerVictor Stinner <victor.stinner@haypocalc.com>
Sun, 23 Oct 2011 18:07:00 +0000 (20:07 +0200)
Objects/unicodeobject.c

index 58f657e1e1a9fe823b7b1077cbd0fe391c7fd4e9..aedcec53c7ba6717ba7c888f3eb92164043cbb0d 100644 (file)
@@ -14001,11 +14001,9 @@ PyUnicode_InternInPlace(PyObject **p)
 void
 PyUnicode_InternImmortal(PyObject **p)
 {
-    PyUnicodeObject *u = (PyUnicodeObject *)*p;
-
     PyUnicode_InternInPlace(p);
     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);
     }
 }