Commit 446c8d59 authored by Victor Stinner's avatar Victor Stinner

Issue #11707: Fix compilation errors with Visual Studio

Fix also a compiler (gcc) warning.
parent 7ab9e22e
...@@ -333,7 +333,7 @@ static PyTypeObject partial_type = { ...@@ -333,7 +333,7 @@ static PyTypeObject partial_type = {
/* cmp_to_key ***************************************************************/ /* cmp_to_key ***************************************************************/
typedef struct { typedef struct {
PyObject_HEAD; PyObject_HEAD
PyObject *cmp; PyObject *cmp;
PyObject *object; PyObject *object;
} keyobject; } keyobject;
...@@ -471,13 +471,15 @@ keyobject_richcompare(PyObject *ko, PyObject *other, int op) ...@@ -471,13 +471,15 @@ keyobject_richcompare(PyObject *ko, PyObject *other, int op)
} }
static PyObject * static PyObject *
functools_cmp_to_key(PyObject *self, PyObject *args, PyObject *kwds){ functools_cmp_to_key(PyObject *self, PyObject *args, PyObject *kwds)
PyObject *cmp; {
PyObject *cmp;
static char *kwargs[] = {"mycmp", NULL}; static char *kwargs[] = {"mycmp", NULL};
keyobject *object;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:cmp_to_key", kwargs, &cmp)) if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:cmp_to_key", kwargs, &cmp))
return NULL; return NULL;
keyobject *object = PyObject_New(keyobject, &keyobject_type); object = PyObject_New(keyobject, &keyobject_type);
if (!object) if (!object)
return NULL; return NULL;
Py_INCREF(cmp); Py_INCREF(cmp);
...@@ -572,8 +574,8 @@ PyDoc_STRVAR(module_doc, ...@@ -572,8 +574,8 @@ PyDoc_STRVAR(module_doc,
static PyMethodDef module_methods[] = { static PyMethodDef module_methods[] = {
{"reduce", functools_reduce, METH_VARARGS, functools_reduce_doc}, {"reduce", functools_reduce, METH_VARARGS, functools_reduce_doc},
{"cmp_to_key", functools_cmp_to_key, METH_VARARGS | METH_KEYWORDS, {"cmp_to_key", (PyCFunction)functools_cmp_to_key,
functools_cmp_to_key_doc}, METH_VARARGS | METH_KEYWORDS, functools_cmp_to_key_doc},
{NULL, NULL} /* sentinel */ {NULL, NULL} /* sentinel */
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment