[Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.157,2.158 ceval.c,2.176,2.177 compile.c,2.107,2.108 import.c,2.133,2.134 marshal.c,1.46,1.47 pythonrun.c,2.95,2.96 traceback.c,2.26,2.27
Guido van Rossum
python-dev@python.org
Wed, 3 May 2000 19:45:14 -0400 (EDT)
- Previous message: [Python-checkins] CVS: python/dist/src/Objects bufferobject.c,2.6,2.7 classobject.c,2.85,2.86 cobject.c,2.7,2.8 complexobject.c,2.23,2.24 dictobject.c,2.51,2.52 fileobject.c,2.72,2.73 floatobject.c,2.56,2.57 frameobject.c,2.38,2.39 funcobject.c,2.19,2.20 intobject.c,2.40,2.41 listobject.c,2.68,2.69 longobject.c,1.56,1.57 methodobject.c,2.25,2.26 moduleobject.c,2.24,2.25 object.c,2.69,2.70 rangeobject.c,2.11,2.12 sliceobject.c,2.3,2.4 stringobject.c,2.62,2.63 tupleobject.c,2.32,2.33 unicodeobject.c,2.15,2.16 xxobject.c,2.14,2.15
- Next message: [Python-checkins] CVS: python/dist/src/Objects unicodeobject.c,2.16,2.17
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /projects/cvsroot/python/dist/src/Python
In directory eric:/projects/python/develop/guido/clean/Python
Modified Files:
bltinmodule.c ceval.c compile.c import.c marshal.c pythonrun.c
traceback.c
Log Message:
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.)
Index: bltinmodule.c
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Python/bltinmodule.c,v
retrieving revision 2.157
retrieving revision 2.158
diff -C2 -r2.157 -r2.158
*** bltinmodule.c 2000/05/03 22:03:46 2.157
--- bltinmodule.c 2000/05/03 23:44:38 2.158
***************
*** 1876,1880 ****
result = PyString_FromStringAndSize(s, strlen(s)-1);
}
! free(s);
return result;
}
--- 1876,1880 ----
result = PyString_FromStringAndSize(s, strlen(s)-1);
}
! PyMem_FREE(s);
return result;
}
Index: ceval.c
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Python/ceval.c,v
retrieving revision 2.176
retrieving revision 2.177
diff -C2 -r2.176 -r2.177
*** ceval.c 2000/04/21 21:17:39 2.176
--- ceval.c 2000/05/03 23:44:38 2.177
***************
*** 2559,2563 ****
Py_DECREF(arg);
! PyMem_XDEL(k);
return result;
--- 2559,2564 ----
Py_DECREF(arg);
! if (k != NULL)
! PyMem_DEL(k);
return result;
Index: compile.c
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Python/compile.c,v
retrieving revision 2.107
retrieving revision 2.108
diff -C2 -r2.107 -r2.108
*** compile.c 2000/05/01 17:54:56 2.107
--- compile.c 2000/05/03 23:44:38 2.108
***************
*** 113,117 ****
Py_XDECREF(co->co_name);
Py_XDECREF(co->co_lnotab);
! PyMem_DEL(co);
}
--- 113,117 ----
Py_XDECREF(co->co_name);
Py_XDECREF(co->co_lnotab);
! PyObject_DEL(co);
}
Index: import.c
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Python/import.c,v
retrieving revision 2.133
retrieving revision 2.134
diff -C2 -r2.133 -r2.134
*** import.c 2000/05/01 20:19:08 2.133
--- import.c 2000/05/03 23:44:39 2.134
***************
*** 125,129 ****
for (scan = _PyImport_StandardFiletab; scan->suffix != NULL; ++scan)
++countS;
! filetab = malloc((countD + countS + 1) * sizeof(struct filedescr));
memcpy(filetab, _PyImport_DynLoadFiletab,
countD * sizeof(struct filedescr));
--- 125,129 ----
for (scan = _PyImport_StandardFiletab; scan->suffix != NULL; ++scan)
++countS;
! filetab = PyMem_NEW(struct filedescr, countD + countS + 1);
memcpy(filetab, _PyImport_DynLoadFiletab,
countD * sizeof(struct filedescr));
***************
*** 2399,2406 ****
! /* API for embedding applications that want to add their own entries to the
! table of built-in modules. This should normally be called *before*
! Py_Initialize(). When the malloc() or realloc() call fails, -1 is returned
! and the existing table is unchanged.
After a similar function by Just van Rossum. */
--- 2399,2406 ----
! /* API for embedding applications that want to add their own entries
! to the table of built-in modules. This should normally be called
! *before* Py_Initialize(). When the table resize fails, -1 is
! returned and the existing table is unchanged.
After a similar function by Just van Rossum. */
***************
*** 2423,2430 ****
/* Allocate new memory for the combined table */
! if (our_copy == NULL)
! p = malloc((i+n+1) * sizeof(struct _inittab));
! else
! p = realloc(our_copy, (i+n+1) * sizeof(struct _inittab));
if (p == NULL)
return -1;
--- 2423,2428 ----
/* Allocate new memory for the combined table */
! p = our_copy;
! PyMem_RESIZE(p, struct _inittab, i+n+1);
if (p == NULL)
return -1;
Index: marshal.c
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Python/marshal.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -r1.46 -r1.47
*** marshal.c 2000/03/31 00:37:41 1.46
--- marshal.c 2000/05/03 23:44:39 1.47
***************
*** 515,523 ****
return NULL;
}
! buffer = (char *)Py_Malloc(n);
if (buffer == NULL)
! return NULL;
if (r_string(buffer, (int)n, p) != n) {
! free(buffer);
PyErr_SetString(PyExc_EOFError,
"EOF read where object expected");
--- 515,523 ----
return NULL;
}
! buffer = PyMem_NEW(char, n);
if (buffer == NULL)
! return PyErr_NoMemory();
if (r_string(buffer, (int)n, p) != n) {
! PyMem_DEL(buffer);
PyErr_SetString(PyExc_EOFError,
"EOF read where object expected");
***************
*** 525,529 ****
}
v = PyUnicode_DecodeUTF8(buffer, n, NULL);
! free(buffer);
return v;
}
--- 525,529 ----
}
v = PyUnicode_DecodeUTF8(buffer, n, NULL);
! PyMem_DEL(buffer);
return v;
}
Index: pythonrun.c
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Python/pythonrun.c,v
retrieving revision 2.95
retrieving revision 2.96
diff -C2 -r2.95 -r2.96
*** pythonrun.c 2000/05/02 19:18:59 2.95
--- pythonrun.c 2000/05/03 23:44:39 2.96
***************
*** 544,548 ****
if (err.error == E_EOF) {
if (err.text)
! free(err.text);
return E_EOF;
}
--- 544,548 ----
if (err.error == E_EOF) {
if (err.text)
! PyMem_DEL(err.text);
return E_EOF;
}
***************
*** 1010,1014 ****
err->lineno, err->offset, err->text);
if (err->text != NULL) {
! free(err->text);
err->text = NULL;
}
--- 1010,1014 ----
err->lineno, err->offset, err->text);
if (err->text != NULL) {
! PyMem_DEL(err->text);
err->text = NULL;
}
Index: traceback.c
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Python/traceback.c,v
retrieving revision 2.26
retrieving revision 2.27
diff -C2 -r2.26 -r2.27
*** traceback.c 2000/03/31 00:39:23 2.26
--- traceback.c 2000/05/03 23:44:39 2.27
***************
*** 72,76 ****
Py_XDECREF(tb->tb_next);
Py_XDECREF(tb->tb_frame);
! PyMem_DEL(tb);
Py_TRASHCAN_SAFE_END(tb)
}
--- 72,76 ----
Py_XDECREF(tb->tb_next);
Py_XDECREF(tb->tb_frame);
! PyObject_DEL(tb);
Py_TRASHCAN_SAFE_END(tb)
}
- Previous message: [Python-checkins] CVS: python/dist/src/Objects bufferobject.c,2.6,2.7 classobject.c,2.85,2.86 cobject.c,2.7,2.8 complexobject.c,2.23,2.24 dictobject.c,2.51,2.52 fileobject.c,2.72,2.73 floatobject.c,2.56,2.57 frameobject.c,2.38,2.39 funcobject.c,2.19,2.20 intobject.c,2.40,2.41 listobject.c,2.68,2.69 longobject.c,1.56,1.57 methodobject.c,2.25,2.26 moduleobject.c,2.24,2.25 object.c,2.69,2.70 rangeobject.c,2.11,2.12 sliceobject.c,2.3,2.4 stringobject.c,2.62,2.63 tupleobject.c,2.32,2.33 unicodeobject.c,2.15,2.16 xxobject.c,2.14,2.15
- Next message: [Python-checkins] CVS: python/dist/src/Objects unicodeobject.c,2.16,2.17
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]