[Python-checkins] cpython: Fix os.confstr(): the result type of the C function is size_t, not int

victor.stinner python-checkins at python.org
Tue Jun 25 23:14:08 CEST 2013


http://hg.python.org/cpython/rev/b0668185dc15
changeset:   84348:b0668185dc15
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Tue Jun 25 23:13:47 2013 +0200
summary:
  Fix os.confstr(): the result type of the C function is size_t, not int

files:
  Modules/posixmodule.c |  4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -9140,7 +9140,7 @@
     PyObject *result = NULL;
     int name;
     char buffer[255];
-    int len;
+    size_t len;
 
     if (!PyArg_ParseTuple(args, "O&:confstr", conv_confstr_confname, &name))
         return NULL;
@@ -9157,7 +9157,7 @@
         }
     }
 
-    if ((unsigned int)len >= sizeof(buffer)) {
+    if (len >= sizeof(buffer)) {
         char *buf = PyMem_Malloc(len);
         if (buf == NULL)
             return PyErr_NoMemory();

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


More information about the Python-checkins mailing list