Index: Modules/_json.c =================================================================== --- Modules/_json.c (révision 71394) +++ Modules/_json.c (copie de travail) @@ -1844,22 +1844,24 @@ PyEncoderObject *s; PyObject *allow_nan; + int ok; 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)) - return -1; + ok = 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); - Py_INCREF(s->markers); - Py_INCREF(s->defaultfn); - Py_INCREF(s->encoder); - Py_INCREF(s->indent); - Py_INCREF(s->key_separator); - Py_INCREF(s->item_separator); - Py_INCREF(s->sort_keys); - Py_INCREF(s->skipkeys); + Py_XINCREF(s->markers); + Py_XINCREF(s->defaultfn); + Py_XINCREF(s->encoder); + Py_XINCREF(s->indent); + Py_XINCREF(s->key_separator); + Py_XINCREF(s->item_separator); + Py_XINCREF(s->sort_keys); + Py_XINCREF(s->skipkeys); + if (!ok) + return -1; 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;