summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorMarc-André Lemburg <mal@egenix.com>2000-06-17 20:31:17 (GMT)
committerMarc-André Lemburg <mal@egenix.com>2000-06-17 20:31:17 (GMT)
commitbea47e768de9918856473f9f27da8929f5449b8d (patch)
tree0ed2fe36d8e2aa718bf6ffb84e54b26b68c87e72 /Objects
parentb248b7f84848cd05428af7ec052bbf530a3aa38e (diff)
downloadcpython-bea47e768de9918856473f9f27da8929f5449b8d.zip
cpython-bea47e768de9918856473f9f27da8929f5449b8d.tar.gz
cpython-bea47e768de9918856473f9f27da8929f5449b8d.tar.bz2
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.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index bfc59dd..e6d2a1a 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -213,9 +213,8 @@ PyUnicodeObject *_PyUnicode_New(int length)
/* 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 @@ PyUnicodeObject *_PyUnicode_New(int length)
goto onError;
}
}
- else
+ else {
unicode->str = PyMem_NEW(Py_UNICODE, length + 1);
+ }
+ PyObject_INIT(unicode, &PyUnicode_Type);
}
else {
unicode = PyObject_NEW(PyUnicodeObject, &PyUnicode_Type);