moved concat to utils, fixed a few docstrings, fixed memory leak in _speedups.escape
--HG--
branch : trunk
diff --git a/jinja2/_speedups.c b/jinja2/_speedups.c
index 10ae6f6..5a7e9aa 100644
--- a/jinja2/_speedups.c
+++ b/jinja2/_speedups.c
@@ -2,7 +2,10 @@
* jinja2._speedups
* ~~~~~~~~~~~~~~~~
*
- * This module implements a few functions in C for better performance.
+ * This module implements a few functions in C for better performance. It
+ * also defines a `tb_set_next` function that is used to patch the debug
+ * traceback. If the speedups module is not compiled a ctypes implementation
+ * is used.
*
* :copyright: 2008 by Armin Ronacher.
* :license: BSD.
@@ -129,15 +132,8 @@
/* we don't have to escape integers, bools or floats */
if (PyInt_CheckExact(text) || PyLong_CheckExact(text) ||
PyFloat_CheckExact(text) || PyBool_Check(text) ||
- text == Py_None) {
- PyObject *args = PyTuple_New(1);
- if (!args) {
- Py_DECREF(s);
- return NULL;
- }
- PyTuple_SET_ITEM(args, 0, text);
- return PyObject_CallObject(markup, args);
- }
+ text == Py_None)
+ return PyObject_CallFunctionObjArgs(markup, text, NULL);
/* if the object has an __html__ method that performs the escaping */
PyObject *html = PyObject_GetAttrString(text, "__html__");
@@ -160,7 +156,9 @@
s = escape_unicode((PyUnicodeObject*)text);
/* convert the unicode string into a markup object. */
- return PyObject_CallFunctionObjArgs(markup, (PyObject*)s, NULL);
+ rv = PyObject_CallFunctionObjArgs(markup, (PyObject*)s, NULL);
+ Py_DECREF(s);
+ return rv;
}