self->ob_type->tp_free((PyObject*)self);
}
+/**
+ * GC Helper
+ */
+static int
+BaseContext_traverse(BaseContext *self, visitproc visit, void *args)
+{
+ int vret;
+ struct StackLayer *layer = self->current;
+
+ while (layer) {
+ vret = visit(layer->dict, args);
+ if (vret != 0)
+ return vret;
+ layer = layer->prev;
+ }
+
+ return 0;
+}
+
/**
* Initializes the BaseContext.
*
0, /* sq_slice */
0, /* sq_ass_item */
0, /* sq_ass_slice */
- (objobjproc)BaseContext_contains, /* sq_contains */
+ (objobjproc)BaseContext_contains,/* sq_contains */
0, /* sq_inplace_concat */
0 /* sq_inplace_repeat */
};
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
"", /* tp_doc */
- 0, /* tp_traverse */
+ BaseContext_traverse, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
return 'Context(%r)' % self.to_dict()
def __pretty__(self, p, cycle):
+ if cycle:
+ return p.text('Context({...})')
p.begin_group(9, 'Context({')
for idx, (key, value) in enumerate(self.to_dict().iteritems()):
if idx: