Commit dd3a6a55 authored by Victor Stinner's avatar Victor Stinner

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

parent 93037498
...@@ -9140,7 +9140,7 @@ posix_confstr(PyObject *self, PyObject *args) ...@@ -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) ...@@ -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();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment