diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c index 17d73648a71..9bc8f8e0d68 100644 --- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c @@ -911,6 +911,21 @@ devpoll_poll(devpollObject *self, PyObject *args) return NULL; } +static int +devpoll_internal_close(devpollObject *self) +{ + int save_errno = 0; + if (self->fd_devpoll >= 0) { + int fd = self->fd_devpoll; + self->fd_devpoll = -1; + Py_BEGIN_ALLOW_THREADS + if (close(fd) < 0) + save_errno = errno; + Py_END_ALLOW_THREADS + } + return save_errno; +} + static PyObject* devpoll_close(devpollObject *self) { @@ -1022,21 +1037,6 @@ newDevPollObject(void) return self; } -static int -devpoll_internal_close(devpollObject *self) -{ - int save_errno = 0; - if (self->fd_devpoll >= 0) { - int fd = self->fd_devpoll; - self->fd_devpoll = -1; - Py_BEGIN_ALLOW_THREADS - if (close(fd) < 0) - save_errno = errno; - Py_END_ALLOW_THREADS - } - return save_errno; -} - static void devpoll_dealloc(devpollObject *self) {