mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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.)
This commit is contained in:
parent
2808b744e8
commit
b18618dab7
73 changed files with 658 additions and 407 deletions
|
@ -295,7 +295,7 @@ parser_compare(PyAST_Object *left, PyAST_Object *right)
|
|||
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 @@ static void
|
|||
parser_free(PyAST_Object *ast)
|
||||
{
|
||||
PyNode_Free(ast->ast_node);
|
||||
PyMem_DEL(ast);
|
||||
PyObject_Del(ast);
|
||||
}
|
||||
|
||||
|
||||
|
@ -790,10 +790,10 @@ build_node_children(PyObject *tuple, node *root, int *line_num)
|
|||
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue