summaryrefslogtreecommitdiffstats
path: root/Modules/_json.c
diff options
context:
space:
mode:
authorLarry Hastings <larry@hastings.org>2015-07-26 14:59:45 (GMT)
committerLarry Hastings <larry@hastings.org>2015-07-26 14:59:45 (GMT)
commit71427eea74e4d8c5312da94b24dfaefaebe60e82 (patch)
tree0731d87a3412e8b8174cc99e787fdd45f169b296 /Modules/_json.c
parent3d1dc904f438117eaea70dd8b67d81dec4d53b58 (diff)
parentf002225f7e0b82af64f5f524ed870b83a226557c (diff)
downloadcpython-71427eea74e4d8c5312da94b24dfaefaebe60e82.zip
cpython-71427eea74e4d8c5312da94b24dfaefaebe60e82.tar.gz
cpython-71427eea74e4d8c5312da94b24dfaefaebe60e82.tar.bz2
Merge Python 3.5.0b4 changes back with 3.5 branch head.
Diffstat (limited to 'Modules/_json.c')
-rw-r--r--Modules/_json.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/Modules/_json.c b/Modules/_json.c
index 8000f91..f63d758 100644
--- a/Modules/_json.c
+++ b/Modules/_json.c
@@ -1344,11 +1344,19 @@ encoder_init(PyObject *self, PyObject *args, PyObject *kwds)
assert(PyEncoder_Check(self));
s = (PyEncoderObject *)self;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "OOOOOOOOp:make_encoder", kwlist,
- &markers, &defaultfn, &encoder, &indent, &key_separator, &item_separator,
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "OOOOUUOOp:make_encoder", kwlist,
+ &markers, &defaultfn, &encoder, &indent,
+ &key_separator, &item_separator,
&sort_keys, &skipkeys, &allow_nan))
return -1;
+ if (markers != Py_None && !PyDict_Check(markers)) {
+ PyErr_Format(PyExc_TypeError,
+ "make_encoder() argument 1 must be dict or None, "
+ "not %.200s", Py_TYPE(markers)->tp_name);
+ return -1;
+ }
+
s->markers = markers;
s->defaultfn = defaultfn;
s->encoder = encoder;