Mailing List Archive

python/dist/src/Python compile.c,2.240,2.241
Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv24773/python/Python

Modified Files:
compile.c
Log Message:
Moving pymalloc along.

+ Redirect PyMem_{Del, DEL} to the object allocator's free() when
pymalloc is enabled. Needed so old extensions can continue to
mix PyObject_New with PyMem_DEL.

+ This implies that pgen needs to be able to see the PyObject_XYZ
declarations too. pgenheaders.h now includes Python.h. An
implication is that I expect obmalloc.o needs to get linked into
pgen on non-Windows boxes.

+ When PYMALLOC_DEBUG is defined, *all* Py memory API functions
now funnel through the debug allocator wrapper around pymalloc.
This is the default in a debug build.

+ That caused compile.c to fail: it indirectly mixed PyMem_Malloc
with raw platform free() in one place. This is verbotten.


Index: compile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v
retrieving revision 2.240
retrieving revision 2.241
diff -C2 -d -r2.240 -r2.241
*** compile.c 14 Apr 2002 09:53:49 -0000 2.240
--- compile.c 22 Apr 2002 02:33:27 -0000 2.241
***************
*** 1955,1959 ****
}
if (childtype == MINUS) {
! char *s = malloc(strlen(STR(pnum)) + 2);
if (s == NULL) {
com_error(c, PyExc_MemoryError, "");
--- 1955,1959 ----
}
if (childtype == MINUS) {
! char *s = PyMem_Malloc(strlen(STR(pnum)) + 2);
if (s == NULL) {
com_error(c, PyExc_MemoryError, "");
***************
*** 1963,1967 ****
s[0] = '-';
strcpy(s + 1, STR(pnum));
! free(STR(pnum));
STR(pnum) = s;
}
--- 1963,1967 ----
s[0] = '-';
strcpy(s + 1, STR(pnum));
! PyMem_Free(STR(pnum));
STR(pnum) = s;
}