Skip to content
Myr

[svn] fixed "Deferred" implementation for the c context

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 e98c5f5 · Browse files · 3 files+7 added−9 removed
This commit

State

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

Diff stats

3 files+7 added−9 removed

  • other:+7 added−9 removed

3 files+7 added−9 removed

modified:docs/src/designerdoc.txt+1 added-1 removed
980 unmodified lines
981 {%- endmacro %}982983 {% call makelist([1, 2, 3, 4, 5, 6]) -%}984 [[{{ item }}]]985 {% endcall %}985 {%- endcall %}986987 This will then produce this output:988989 .. sourcecode:: html
12 unmodified lines
modified:jinja/_native.py+1 added
12 unmodified lines
13 :copyright: 2007 by Armin Ronacher.14 :license: BSD, see LICENSE for more details.15"""16from jinja.datastructure import Deferred, Undefined17from jinja.exceptions import TemplateRuntimeError181920class BaseContext(object):21
75 unmodified lines
modified:jinja/_speedups.c+5 added-8 removed
19 unmodified lines
20#include <Python.h>21#include <structmember.h>2223/* Set by init_constants to real values */24static PyObject *Undefined, *TemplateRuntimeError, *FilterNotFound;25static PyTypeObject *DeferredType;24static PyObject *Undefined, *Deferred, *TemplateRuntimeError;2526/**27 * Internal struct used by BaseContext to store the28 * stacked namespaces.
30 unmodified lines
59 Py_DECREF(datastructure);60 return 0;61 }62 Undefined = PyObject_GetAttrString(datastructure, "Undefined");64 PyObject *deferred = PyObject_GetAttrString(datastructure, "Deferred");65 DeferredType = deferred->ob_type;63 Deferred = PyObject_GetAttrString(datastructure, "Deferred");64 TemplateRuntimeError = PyObject_GetAttrString(exceptions, "TemplateRuntimeError");67 FilterNotFound = PyObject_GetAttrString(exceptions, "FilterNotFound");65 Py_DECREF(datastructure);66 Py_DECREF(exceptions);67 return 1;68}
199 unmodified lines
268 current = current->prev;269 continue;270 }271 Py_INCREF(result);275 if (PyObject_TypeCheck(result, DeferredType)) {272 if (PyObject_IsInstance(result, Deferred)) {273 PyObject *args = PyTuple_New(2);277 if (!args || !PyTuple_SetItem(args, 0, (PyObject*)self) ||278 !PyTuple_SetItem(args, 1, item))274 if (!args || PyTuple_SetItem(args, 0, (PyObject*)self) ||275 PyTuple_SetItem(args, 1, item))276 return NULL;277278 PyObject *resolved = PyObject_CallObject(result, args);279 if (!resolved)
185 unmodified lines