diff options
Diffstat (limited to 'Modules')
| -rw-r--r-- | Modules/selectmodule.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c index a366d1b..6976fb5 100644 --- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c @@ -1297,14 +1297,17 @@ newPyEpoll_Object(PyTypeObject *type, int sizehint, SOCKET fd) static PyObject * pyepoll_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - int flags = 0, sizehint = FD_SETSIZE - 1; + int flags = 0, sizehint = -1; static char *kwlist[] = {"sizehint", "flags", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "|ii:epoll", kwlist, &sizehint, &flags)) return NULL; - if (sizehint < 0) { - PyErr_SetString(PyExc_ValueError, "negative sizehint"); + if (sizehint == -1) { + sizehint = FD_SETSIZE - 1; + } + else if (sizehint <= 0) { + PyErr_SetString(PyExc_ValueError, "sizehint must be positive or -1"); return NULL; } @@ -1314,7 +1317,6 @@ pyepoll_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return NULL; } #endif - return newPyEpoll_Object(type, sizehint, -1); } |
