diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-04-05 10:21:35 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-04-05 10:21:35 (GMT) |
commit | 446c8d59c5353db220a263b345c7012ba5435654 (patch) | |
tree | ac07dd91bba76e5f02ee20631b1b42b97a703355 /Modules/_functoolsmodule.c | |
parent | 7ab9e22e341603a1bf2fddd2eafa613bcd71b5cf (diff) | |
download | cpython-446c8d59c5353db220a263b345c7012ba5435654.zip cpython-446c8d59c5353db220a263b345c7012ba5435654.tar.gz cpython-446c8d59c5353db220a263b345c7012ba5435654.tar.bz2 |
Issue #11707: Fix compilation errors with Visual Studio
Fix also a compiler (gcc) warning.
Diffstat (limited to 'Modules/_functoolsmodule.c')
-rw-r--r-- | Modules/_functoolsmodule.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c index c657906..311c6df 100644 --- a/Modules/_functoolsmodule.c +++ b/Modules/_functoolsmodule.c @@ -333,7 +333,7 @@ static PyTypeObject partial_type = { /* cmp_to_key ***************************************************************/ typedef struct { - PyObject_HEAD; + PyObject_HEAD PyObject *cmp; PyObject *object; } keyobject; @@ -471,13 +471,15 @@ keyobject_richcompare(PyObject *ko, PyObject *other, int op) } static PyObject * -functools_cmp_to_key(PyObject *self, PyObject *args, PyObject *kwds){ - PyObject *cmp; +functools_cmp_to_key(PyObject *self, PyObject *args, PyObject *kwds) +{ + PyObject *cmp; static char *kwargs[] = {"mycmp", NULL}; + keyobject *object; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:cmp_to_key", kwargs, &cmp)) return NULL; - keyobject *object = PyObject_New(keyobject, &keyobject_type); + object = PyObject_New(keyobject, &keyobject_type); if (!object) return NULL; Py_INCREF(cmp); @@ -572,8 +574,8 @@ PyDoc_STRVAR(module_doc, static PyMethodDef module_methods[] = { {"reduce", functools_reduce, METH_VARARGS, functools_reduce_doc}, - {"cmp_to_key", functools_cmp_to_key, METH_VARARGS | METH_KEYWORDS, - functools_cmp_to_key_doc}, + {"cmp_to_key", (PyCFunction)functools_cmp_to_key, + METH_VARARGS | METH_KEYWORDS, functools_cmp_to_key_doc}, {NULL, NULL} /* sentinel */ }; |