From 51e7f5cabaef2ed6e36412ce933061cfc89a766d Mon Sep 17 00:00:00 2001 From: Tim Peters Date: Mon, 22 Apr 2002 02:33:27 +0000 Subject: 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. --- Python/compile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Python/compile.c') diff --git a/Python/compile.c b/Python/compile.c index 4340522fd8..373363fb68 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1954,7 +1954,7 @@ com_factor(struct compiling *c, node *n) return; } if (childtype == MINUS) { - char *s = malloc(strlen(STR(pnum)) + 2); + char *s = PyMem_Malloc(strlen(STR(pnum)) + 2); if (s == NULL) { com_error(c, PyExc_MemoryError, ""); com_addbyte(c, 255); @@ -1962,7 +1962,7 @@ com_factor(struct compiling *c, node *n) } s[0] = '-'; strcpy(s + 1, STR(pnum)); - free(STR(pnum)); + PyMem_Free(STR(pnum)); STR(pnum) = s; } com_atom(c, patom); -- cgit v1.2.1