Skip to content
Myr

added tp_traverse to _speedups module

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 77e2ab5 · Browse files · 2 files+23 added−2 removed
This commit

State

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

Diff stats

2 files+23 added−2 removed

  • other:+23 added−2 removed

2 files+23 added−2 removed

modified:jinja/_speedups.c+21 added-2 removed
74 unmodified lines
75 self->ob_type->tp_free((PyObject*)self);76}7778/**79 * GC Helper80 */81static int82BaseContext_traverse(BaseContext *self, visitproc visit, void *args)83{84 int vret;85 struct StackLayer *layer = self->current;8687 while (layer) {88 vret = visit(layer->dict, args);89 if (vret != 0)90 return vret;91 layer = layer->prev;92 }9394 return 0;95}9697/**98 * Initializes the BaseContext.99 *100 * Like the native python class it takes a reference to the undefined101 * singleton which will be used for undefined values.
303 unmodified lines
405 0, /* sq_item */406 0, /* sq_slice */407 0, /* sq_ass_item */408 0, /* sq_ass_slice */390 (objobjproc)BaseContext_contains, /* sq_contains */409 (objobjproc)BaseContext_contains,/* sq_contains */410 0, /* sq_inplace_concat */411 0 /* sq_inplace_repeat */412};413
25 unmodified lines
439 0, /* tp_setattro */440 0, /* tp_as_buffer */441 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/442 "", /* tp_doc */424 0, /* tp_traverse */443 BaseContext_traverse, /* tp_traverse */444 0, /* tp_clear */445 0, /* tp_richcompare */446 0, /* tp_weaklistoffset */447 0, /* tp_iter */
40 unmodified lines
modified:jinja/datastructure.py+2 added
312 unmodified lines
313 """314 return 'Context(%r)' % self.to_dict()315316 def __pretty__(self, p, cycle):317 if cycle:318 return p.text('Context({...})')319 p.begin_group(9, 'Context({')320 for idx, (key, value) in enumerate(self.to_dict().iteritems()):321 if idx:322 p.text(',')
386 unmodified lines