Mercurial > cpython-lru_cache-weakref
diff Modules/parsermodule.c @ 12576:1c7c2dd1beb1 legacy-trunk
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.)
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Wed, 03 May 2000 23:44:39 +0000 |
| parents | f1e867ad7d85 |
| children | 916fb024ce94 |
line wrap: on
line diff
--- a/Modules/parsermodule.c Wed May 03 22:34:12 2000 +0000 +++ b/Modules/parsermodule.c Wed May 03 23:44:39 2000 +0000 @@ -295,7 +295,7 @@ static PyObject* parser_newastobject(node *ast, int type) { - PyAST_Object* o = PyObject_NEW(PyAST_Object, &PyAST_Type); + PyAST_Object* o = PyObject_New(PyAST_Object, &PyAST_Type); if (o != 0) { o->ast_node = ast; @@ -317,7 +317,7 @@ parser_free(PyAST_Object *ast) { PyNode_Free(ast->ast_node); - PyMem_DEL(ast); + PyObject_Del(ast); } @@ -790,10 +790,10 @@ PyObject *temp = PySequence_GetItem(elem, 1); /* check_terminal_tuple() already verified it's a string */ - strn = (char *)malloc(PyString_GET_SIZE(temp) + 1); + strn = (char *)PyMem_MALLOC(PyString_GET_SIZE(temp) + 1); if (strn != NULL) (void) strcpy(strn, PyString_AS_STRING(temp)); - Py_XDECREF(temp); + Py_DECREF(temp); if (PyObject_Length(elem) == 3) { PyObject* temp = PySequence_GetItem(elem, 2);
