summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorR. Tyler Ballance <tyler@slide.com>2009-06-28 13:51:35 +0800
committerJames Abbatiello <abbeyj@gmail.com>2009-06-29 00:39:16 +0800
commit23214cb3dec524e2452faf508597f5b1e498fe16 (patch)
tree7c285e8c95c814961cd4c97d88dc284f8d8f5d6e
parentbc455c8979b01fe394196c4fc783a3be63f9f1db (diff)
downloadpython-cheetah-23214cb3dec524e2452faf508597f5b1e498fe16.tar.gz
Correct the SIGSEGV I left in the valOrDefault implementation
Signed-off-by: James Abbatiello <abbeyj@gmail.com>
-rw-r--r--src/c/_template.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/c/_template.c b/src/c/_template.c
index 146871c..04fced1 100644
--- a/src/c/_template.c
+++ b/src/c/_template.c
@@ -19,8 +19,11 @@ static PyObject *py_valordefault(PyObject *self, PyObject *args, PyObject *kwarg
if (!PyArg_ParseTuple(args, "OO", &value, &def))
return NULL;
- if (value == unspecified)
+ if (value == unspecified) {
+ Py_XINCREF(def);
return def;
+ }
+ Py_XINCREF(value);
return value;
}