[Python-checkins] cpython: Use the small object allocator for small bytearrays
antoine.pitrou
python-checkins at python.org
Sat Nov 12 21:20:30 CET 2011
http://hg.python.org/cpython/rev/9b26fa7f9adf
changeset: 73534:9b26fa7f9adf
user: Antoine Pitrou <solipsis at pitrou.net>
date: Sat Nov 12 21:15:28 2011 +0100
summary:
Use the small object allocator for small bytearrays
files:
Objects/bytearrayobject.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c
--- a/Objects/bytearrayobject.c
+++ b/Objects/bytearrayobject.c
@@ -139,7 +139,7 @@
}
else {
alloc = size + 1;
- new->ob_bytes = PyMem_Malloc(alloc);
+ new->ob_bytes = PyObject_Malloc(alloc);
if (new->ob_bytes == NULL) {
Py_DECREF(new);
return PyErr_NoMemory();
@@ -209,7 +209,7 @@
alloc = size + 1;
}
- sval = PyMem_Realloc(((PyByteArrayObject *)self)->ob_bytes, alloc);
+ sval = PyObject_Realloc(((PyByteArrayObject *)self)->ob_bytes, alloc);
if (sval == NULL) {
PyErr_NoMemory();
return -1;
@@ -870,7 +870,7 @@
}
newsize = 15 + length * 4;
- buffer = PyMem_Malloc(newsize);
+ buffer = PyObject_Malloc(newsize);
if (buffer == NULL) {
PyErr_NoMemory();
return NULL;
@@ -924,7 +924,7 @@
}
v = PyUnicode_DecodeASCII(buffer, p - buffer, NULL);
- PyMem_Free(buffer);
+ PyObject_Free(buffer);
return v;
}
@@ -1020,7 +1020,7 @@
PyErr_Print();
}
if (self->ob_bytes != 0) {
- PyMem_Free(self->ob_bytes);
+ PyObject_Free(self->ob_bytes);
}
Py_TYPE(self)->tp_free((PyObject *)self);
}
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list