Mercurial > cpython-lru_cache-weakref
diff Objects/unicodeobject.c @ 12939:88004f25dc25 legacy-trunk
Vladimir MARANGOZOV <Vladimir.Marangozov@inrialpes.fr>:
This patch fixes an optimisation mystery in _PyUnicodeNew causing segfaults
on AIX when the interpreter is compiled with -O.
| author | Marc-André Lemburg <mal@egenix.com> |
|---|---|
| date | Sat, 17 Jun 2000 20:31:17 +0000 |
| parents | 2d0b99778edf |
| children | 97dd6dc33503 |
line wrap: on
line diff
--- a/Objects/unicodeobject.c Sat Jun 17 02:19:30 2000 +0000 +++ b/Objects/unicodeobject.c Sat Jun 17 20:31:17 2000 +0000 @@ -213,9 +213,8 @@ /* Unicode freelist & memory allocation */ if (unicode_freelist) { unicode = unicode_freelist; - unicode_freelist = *(PyUnicodeObject **)unicode_freelist; + unicode_freelist = *(PyUnicodeObject **)unicode; unicode_freelist_size--; - PyObject_INIT(unicode, &PyUnicode_Type); if (unicode->str) { /* Keep-Alive optimization: we only upsize the buffer, never downsize it. */ @@ -225,8 +224,10 @@ goto onError; } } - else + else { unicode->str = PyMem_NEW(Py_UNICODE, length + 1); + } + PyObject_INIT(unicode, &PyUnicode_Type); } else { unicode = PyObject_NEW(PyUnicodeObject, &PyUnicode_Type);
