Skip to content
Myr

BaseContext should be garbage collected properly now

Before adoption: this commit came in with the history the project adopted, so no landing records it.

--HG-- branch : trunk

authored by Armin Ronacher · committed by Armin Ronacher · parent 8efb7ee · Browse files · 1 file+18 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+18 added−7 removed

  • other:+18 added−7 removed

1 file+18 added−7 removed

modified:jinja/_speedups.c+18 added-7 removed
55 unmodified lines
56 return 1;57}5859/**60 * Deallocator for BaseContext.61 *62 * Frees the memory for the stack layers before freeing the object.60 * GC Helper61 */64static void65BaseContext_dealloc(BaseContext *self)62static int63BaseContext_clear(BaseContext *self)64{65 struct StackLayer *current = self->current, *tmp;66 while (current) {67 tmp = current;
1 unmodified line
69 current->dict = NULL;70 current = tmp->prev;71 PyMem_Free(tmp);72 }73 return 0;74}7576/**77 * Deallocator for BaseContext.78 *79 * Frees the memory for the stack layers before freeing the object.80 */81static void82BaseContext_dealloc(BaseContext *self)83{84 BaseContext_clear(self);85 self->ob_type->tp_free((PyObject*)self);86}8788/**
358 unmodified lines
447 0, /* tp_str */448 0, /* tp_getattro */449 0, /* tp_setattro */450 0, /* tp_as_buffer */441 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/451 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC,452 /*tp_flags*/453 "", /* tp_doc */454 (traverseproc)BaseContext_traverse, /* tp_traverse */444 0, /* tp_clear */455 (inquiry)BaseContext_clear, /* tp_clear */456 0, /* tp_richcompare */457 0, /* tp_weaklistoffset */458 0, /* tp_iter */459 0, /* tp_iternext */
39 unmodified lines