@@ -1252,7 +1252,7 @@ pyepoll_internal_close(pyEpoll_Object *self)
12521252}
12531253
12541254static PyObject *
1255- newPyEpoll_Object (PyTypeObject * type , int sizehint , int flags , SOCKET fd )
1255+ newPyEpoll_Object (PyTypeObject * type , int sizehint , SOCKET fd )
12561256{
12571257 pyEpoll_Object * self ;
12581258
@@ -1264,12 +1264,10 @@ newPyEpoll_Object(PyTypeObject *type, int sizehint, int flags, SOCKET fd)
12641264 if (fd == -1 ) {
12651265 Py_BEGIN_ALLOW_THREADS
12661266#ifdef HAVE_EPOLL_CREATE1
1267- flags |= EPOLL_CLOEXEC ;
1268- if (flags )
1269- self -> epfd = epoll_create1 (flags );
1270- else
1271- #endif
1267+ self -> epfd = epoll_create1 (EPOLL_CLOEXEC );
1268+ #else
12721269 self -> epfd = epoll_create (sizehint );
1270+ #endif
12731271 Py_END_ALLOW_THREADS
12741272 }
12751273 else {
@@ -1305,8 +1303,12 @@ pyepoll_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
13051303 PyErr_SetString (PyExc_ValueError , "negative sizehint" );
13061304 return NULL ;
13071305 }
1306+ if (flags && flags != EPOLL_CLOEXEC ) {
1307+ PyErr_SetString (PyExc_OSError , "invalid flags" );
1308+ return NULL ;
1309+ }
13081310
1309- return newPyEpoll_Object (type , sizehint , flags , -1 );
1311+ return newPyEpoll_Object (type , sizehint , -1 );
13101312}
13111313
13121314
@@ -1364,7 +1366,7 @@ pyepoll_fromfd(PyObject *cls, PyObject *args)
13641366 if (!PyArg_ParseTuple (args , "i:fromfd" , & fd ))
13651367 return NULL ;
13661368
1367- return newPyEpoll_Object ((PyTypeObject * )cls , FD_SETSIZE - 1 , 0 , fd );
1369+ return newPyEpoll_Object ((PyTypeObject * )cls , FD_SETSIZE - 1 , fd );
13681370}
13691371
13701372PyDoc_STRVAR (pyepoll_fromfd_doc ,
0 commit comments