コード例 #1
0
ファイル: node.c プロジェクト: GuardianRG/static-python
void
PyNode_Free(node *n)
{
    if (n != NULL) {
        freechildren(n);
        PyObject_FREE(n);
    }
}
コード例 #2
0
ファイル: node.c プロジェクト: GuardianRG/static-python
static void
freechildren(node *n)
{
    int i;
    for (i = NCH(n); --i >= 0; )
        freechildren(CHILD(n, i));
    if (n->n_child != NULL)
        PyObject_FREE(n->n_child);
    if (STR(n) != NULL)
        PyObject_FREE(STR(n));
}
コード例 #3
0
ファイル: node.c プロジェクト: dany74q/Awesome-Python-3
static void
freechildren(node *n)
{
    int i;
    for (i = NCH(n); --i >= 0; )
        freechildren(CHILD(n, i));
    if (n->n_child != NULL)
        PyObject_FREE(n->n_child);
	/*
		Print statement modification :
		Free all nodes except those marked modified.
		Those are virtual nodes in the parse three that don't actually reside in the statement's memory,
		Freeing them is dangerous.
	*/
    if (STR(n) != NULL && (!n->n_wasModified))
        PyObject_FREE(STR(n));
}