static int
init_constants(void)
{
+ PyObject *module;
/* happing of characters to replace */
escaped_chars_repl['"'] = UNICHR(""");
escaped_chars_repl['\''] = UNICHR("'");
escaped_chars_delta_len['<'] = escaped_chars_delta_len['>'] = 3;
/* import markup type so that we can mark the return value */
- PyObject *module = PyImport_ImportModule("jinja2.utils");
+ module = PyImport_ImportModule("jinja2.utils");
if (!module)
return 0;
markup = PyObject_GetAttrString(module, "Markup");
static PyObject*
escape(PyObject *self, PyObject *text)
{
- PyObject *s = NULL, *rv = NULL;
+ PyObject *s = NULL, *rv = NULL, *html;
/* we don't have to escape integers, bools or floats */
if (PyInt_CheckExact(text) || PyLong_CheckExact(text) ||
return PyObject_CallFunctionObjArgs(markup, text, NULL);
/* if the object has an __html__ method that performs the escaping */
- PyObject *html = PyObject_GetAttrString(text, "__html__");
+ html = PyObject_GetAttrString(text, "__html__");
if (html) {
rv = PyObject_CallObject(html, NULL);
Py_DECREF(html);