]> granicus.if.org Git - python/commitdiff
Issue #11707: Fix compilation errors with Visual Studio
authorVictor Stinner <victor.stinner@haypocalc.com>
Tue, 5 Apr 2011 10:21:35 +0000 (12:21 +0200)
committerVictor Stinner <victor.stinner@haypocalc.com>
Tue, 5 Apr 2011 10:21:35 +0000 (12:21 +0200)
Fix also a compiler (gcc) warning.

Modules/_functoolsmodule.c

index c6579069d6a6ed44a798d13feae9d7c7fa7456f0..311c6df82e2f5f330e27fd6179241fa5be0a964b 100644 (file)
@@ -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 */
 };