summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Ippolito <bob@redivi.com>2014-05-20 20:25:32 -0700
committerBob Ippolito <bob@redivi.com>2014-05-20 20:25:32 -0700
commit9fa5a3d591e270df40d241ac767e90a16a9caf0e (patch)
treefa9d876d8000e538bb7be375708f40763e7a4e17
parent72b03f213ec0def34930f1b04f66f71a27f27665 (diff)
downloadsimplejson-9fa5a3d591e270df40d241ac767e90a16a9caf0e.tar.gz
fix arg check for item_sort_key
-rw-r--r--simplejson/_speedups.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/simplejson/_speedups.c b/simplejson/_speedups.c
index e888873..f3957db 100644
--- a/simplejson/_speedups.c
+++ b/simplejson/_speedups.c
@@ -2616,8 +2616,10 @@ encoder_init(PyObject *self, PyObject *args, PyObject *kwds)
s->tuple_as_array = PyObject_IsTrue(tuple_as_array);
s->bigint_as_string = PyObject_IsTrue(bigint_as_string);
if (item_sort_key != Py_None) {
- if (!PyCallable_Check(item_sort_key))
+ if (!PyCallable_Check(item_sort_key)) {
PyErr_SetString(PyExc_TypeError, "item_sort_key must be None or callable");
+ return -1;
+ }
}
else if (PyObject_IsTrue(sort_keys)) {
static PyObject *itemgetter0 = NULL;