Vladimir Marangozov's long-awaited malloc restructuring.
For more comments, read the patches@python.org archives.
For documentation read the comments in mymalloc.h and objimpl.h.
(This is not exactly what Vladimir posted to the patches list; I've
made a few changes, and Vladimir sent me a fix in private email for a
problem that only occurs in debug mode. I'm also holding back on his
change to main.c, which seems unnecessary to me.)
diff --git a/Modules/cStringIO.c b/Modules/cStringIO.c
index e816178..557545f 100644
--- a/Modules/cStringIO.c
+++ b/Modules/cStringIO.c
@@ -56,7 +56,7 @@
"\n"
"This module provides a simple useful replacement for\n"
"the StringIO module that is written in C. It does not provide the\n"
-"full generality if StringIO, but it provides anough for most\n"
+"full generality if StringIO, but it provides enough for most\n"
"applications and is especially useful in conjuction with the\n"
"pickle module.\n"
"\n"
@@ -407,7 +407,7 @@
O_dealloc(Oobject *self) {
if (self->buf != NULL)
free(self->buf);
- PyMem_DEL(self);
+ PyObject_Del(self);
}
static PyObject *
@@ -465,7 +465,7 @@
newOobject(int size) {
Oobject *self;
- self = PyObject_NEW(Oobject, &Otype);
+ self = PyObject_New(Oobject, &Otype);
if (self == NULL)
return NULL;
self->pos=0;
@@ -536,7 +536,7 @@
static void
I_dealloc(Iobject *self) {
Py_XDECREF(self->pbuf);
- PyMem_DEL(self);
+ PyObject_Del(self);
}
static PyObject *
@@ -586,7 +586,7 @@
}
buf = PyString_AS_STRING(s);
size = PyString_GET_SIZE(s);
- UNLESS(self = PyObject_NEW(Iobject, &Itype)) return NULL;
+ UNLESS(self = PyObject_New(Iobject, &Itype)) return NULL;
Py_INCREF(s);
self->buf=buf;
self->string_size=size;