Fix os.confstr(): the result type of the C function is size_t, not int

This commit is contained in:
Victor Stinner 2013-06-25 23:13:47 +02:00
parent 93037498d1
commit dd3a6a5533

View file

@ -9140,7 +9140,7 @@ posix_confstr(PyObject *self, PyObject *args)
PyObject *result = NULL; PyObject *result = NULL;
int name; int name;
char buffer[255]; char buffer[255];
int len; size_t len;
if (!PyArg_ParseTuple(args, "O&:confstr", conv_confstr_confname, &name)) if (!PyArg_ParseTuple(args, "O&:confstr", conv_confstr_confname, &name))
return NULL; return NULL;
@ -9157,7 +9157,7 @@ posix_confstr(PyObject *self, PyObject *args)
} }
} }
if ((unsigned int)len >= sizeof(buffer)) { if (len >= sizeof(buffer)) {
char *buf = PyMem_Malloc(len); char *buf = PyMem_Malloc(len);
if (buf == NULL) if (buf == NULL)
return PyErr_NoMemory(); return PyErr_NoMemory();