summaryrefslogtreecommitdiffstats
path: root/Modules/_json.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2009-12-08 16:00:03 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2009-12-08 16:00:03 (GMT)
commit4fad6bdde98e182d95eb2033eb8dd78344556727 (patch)
treef98513851ca9f94f69186c169ab1ed552879145e /Modules/_json.c
parent60a32c8c0b2e58fa96d9d6417526446b922d79e3 (diff)
downloadcpython-4fad6bdde98e182d95eb2033eb8dd78344556727.zip
cpython-4fad6bdde98e182d95eb2033eb8dd78344556727.tar.gz
cpython-4fad6bdde98e182d95eb2033eb8dd78344556727.tar.bz2
Merged revisions 76710 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r76710 | antoine.pitrou | 2009-12-08 16:57:31 +0100 (mar., 08 déc. 2009) | 10 lines Merged revisions 76708 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r76708 | antoine.pitrou | 2009-12-08 16:40:51 +0100 (mar., 08 déc. 2009) | 4 lines Issue #6986: Fix crash in the JSON C accelerator when called with the wrong parameter types. Patch by Victor Stinner. ........ ................
Diffstat (limited to 'Modules/_json.c')
-rw-r--r--Modules/_json.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/Modules/_json.c b/Modules/_json.c
index a012560..e555439 100644
--- a/Modules/_json.c
+++ b/Modules/_json.c
@@ -1123,15 +1123,28 @@ encoder_init(PyObject *self, PyObject *args, PyObject *kwds)
static char *kwlist[] = {"markers", "default", "encoder", "indent", "key_separator", "item_separator", "sort_keys", "skipkeys", "allow_nan", NULL};
PyEncoderObject *s;
- PyObject *allow_nan;
+ PyObject *markers, *defaultfn, *encoder, *indent, *key_separator;
+ PyObject *item_separator, *sort_keys, *skipkeys, *allow_nan;
assert(PyEncoder_Check(self));
s = (PyEncoderObject *)self;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "OOOOOOOOO:make_encoder", kwlist,
- &s->markers, &s->defaultfn, &s->encoder, &s->indent, &s->key_separator, &s->item_separator, &s->sort_keys, &s->skipkeys, &allow_nan))
+ &markers, &defaultfn, &encoder, &indent, &key_separator, &item_separator,
+ &sort_keys, &skipkeys, &allow_nan))
return -1;
+ s->markers = markers;
+ s->defaultfn = defaultfn;
+ s->encoder = encoder;
+ s->indent = indent;
+ s->key_separator = key_separator;
+ s->item_separator = item_separator;
+ s->sort_keys = sort_keys;
+ s->skipkeys = skipkeys;
+ s->fast_encode = (PyCFunction_Check(s->encoder) && PyCFunction_GetFunction(s->encoder) == (PyCFunction)py_encode_basestring_ascii);
+ s->allow_nan = PyObject_IsTrue(allow_nan);
+
Py_INCREF(s->markers);
Py_INCREF(s->defaultfn);
Py_INCREF(s->encoder);
@@ -1140,8 +1153,6 @@ encoder_init(PyObject *self, PyObject *args, PyObject *kwds)
Py_INCREF(s->item_separator);
Py_INCREF(s->sort_keys);
Py_INCREF(s->skipkeys);
- s->fast_encode = (PyCFunction_Check(s->encoder) && PyCFunction_GetFunction(s->encoder) == (PyCFunction)py_encode_basestring_ascii);
- s->allow_nan = PyObject_IsTrue(allow_nan);
return 0;
}