[Python-checkins] cpython: Issue #11707: Fix compilation errors with Visual Studio

victor.stinner python-checkins at python.org
Tue Apr 5 12:21:51 CEST 2011


http://hg.python.org/cpython/rev/76ed6a061ebe
changeset:   69151:76ed6a061ebe
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Tue Apr 05 12:21:35 2011 +0200
summary:
  Issue #11707: Fix compilation errors with Visual Studio

Fix also a compiler (gcc) warning.

files:
  Modules/_functoolsmodule.c |  14 ++++++++------
  1 files changed, 8 insertions(+), 6 deletions(-)


diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c
--- a/Modules/_functoolsmodule.c
+++ b/Modules/_functoolsmodule.c
@@ -333,7 +333,7 @@
 /* cmp_to_key ***************************************************************/
 
 typedef struct {
-    PyObject_HEAD;
+    PyObject_HEAD
     PyObject *cmp;
     PyObject *object;
 } keyobject;
@@ -471,13 +471,15 @@
 }
 
 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 @@
 
 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 */
 };
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list