LCOV - code coverage report
Current view: top level - Modules/clinic - selectmodule.c.h (source / functions) Hit Total Coverage
Test: CPython lcov report Lines: 161 182 88.5 %
Date: 2022-07-07 18:19:46 Functions: 16 16 100.0 %

          Line data    Source code
       1             : /*[clinic input]
       2             : preserve
       3             : [clinic start generated code]*/
       4             : 
       5             : PyDoc_STRVAR(select_select__doc__,
       6             : "select($module, rlist, wlist, xlist, timeout=None, /)\n"
       7             : "--\n"
       8             : "\n"
       9             : "Wait until one or more file descriptors are ready for some kind of I/O.\n"
      10             : "\n"
      11             : "The first three arguments are iterables of file descriptors to be waited for:\n"
      12             : "rlist -- wait until ready for reading\n"
      13             : "wlist -- wait until ready for writing\n"
      14             : "xlist -- wait for an \"exceptional condition\"\n"
      15             : "If only one kind of condition is required, pass [] for the other lists.\n"
      16             : "\n"
      17             : "A file descriptor is either a socket or file object, or a small integer\n"
      18             : "gotten from a fileno() method call on one of those.\n"
      19             : "\n"
      20             : "The optional 4th argument specifies a timeout in seconds; it may be\n"
      21             : "a floating point number to specify fractions of seconds.  If it is absent\n"
      22             : "or None, the call will never time out.\n"
      23             : "\n"
      24             : "The return value is a tuple of three lists corresponding to the first three\n"
      25             : "arguments; each contains the subset of the corresponding file descriptors\n"
      26             : "that are ready.\n"
      27             : "\n"
      28             : "*** IMPORTANT NOTICE ***\n"
      29             : "On Windows, only sockets are supported; on Unix, all file\n"
      30             : "descriptors can be used.");
      31             : 
      32             : #define SELECT_SELECT_METHODDEF    \
      33             :     {"select", _PyCFunction_CAST(select_select), METH_FASTCALL, select_select__doc__},
      34             : 
      35             : static PyObject *
      36             : select_select_impl(PyObject *module, PyObject *rlist, PyObject *wlist,
      37             :                    PyObject *xlist, PyObject *timeout_obj);
      38             : 
      39             : static PyObject *
      40       24947 : select_select(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
      41             : {
      42       24947 :     PyObject *return_value = NULL;
      43             :     PyObject *rlist;
      44             :     PyObject *wlist;
      45             :     PyObject *xlist;
      46       24947 :     PyObject *timeout_obj = Py_None;
      47             : 
      48       24947 :     if (!_PyArg_CheckPositional("select", nargs, 3, 4)) {
      49           0 :         goto exit;
      50             :     }
      51       24947 :     rlist = args[0];
      52       24947 :     wlist = args[1];
      53       24947 :     xlist = args[2];
      54       24947 :     if (nargs < 4) {
      55           9 :         goto skip_optional;
      56             :     }
      57       24938 :     timeout_obj = args[3];
      58       24947 : skip_optional:
      59       24947 :     return_value = select_select_impl(module, rlist, wlist, xlist, timeout_obj);
      60             : 
      61       24947 : exit:
      62       24947 :     return return_value;
      63             : }
      64             : 
      65             : #if (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL))
      66             : 
      67             : PyDoc_STRVAR(select_poll_register__doc__,
      68             : "register($self, fd,\n"
      69             : "         eventmask=select.POLLIN | select.POLLPRI | select.POLLOUT, /)\n"
      70             : "--\n"
      71             : "\n"
      72             : "Register a file descriptor with the polling object.\n"
      73             : "\n"
      74             : "  fd\n"
      75             : "    either an integer, or an object with a fileno() method returning an int\n"
      76             : "  eventmask\n"
      77             : "    an optional bitmask describing the type of events to check for");
      78             : 
      79             : #define SELECT_POLL_REGISTER_METHODDEF    \
      80             :     {"register", _PyCFunction_CAST(select_poll_register), METH_FASTCALL, select_poll_register__doc__},
      81             : 
      82             : static PyObject *
      83             : select_poll_register_impl(pollObject *self, int fd, unsigned short eventmask);
      84             : 
      85             : static PyObject *
      86      186603 : select_poll_register(pollObject *self, PyObject *const *args, Py_ssize_t nargs)
      87             : {
      88      186603 :     PyObject *return_value = NULL;
      89             :     int fd;
      90      186603 :     unsigned short eventmask = POLLIN | POLLPRI | POLLOUT;
      91             : 
      92      186603 :     if (!_PyArg_CheckPositional("register", nargs, 1, 2)) {
      93           0 :         goto exit;
      94             :     }
      95      186603 :     if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
      96           3 :         goto exit;
      97             :     }
      98      186600 :     if (nargs < 2) {
      99          16 :         goto skip_optional;
     100             :     }
     101      186584 :     if (!_PyLong_UnsignedShort_Converter(args[1], &eventmask)) {
     102           3 :         goto exit;
     103             :     }
     104      186581 : skip_optional:
     105      186597 :     return_value = select_poll_register_impl(self, fd, eventmask);
     106             : 
     107      186603 : exit:
     108      186603 :     return return_value;
     109             : }
     110             : 
     111             : #endif /* (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) */
     112             : 
     113             : #if (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL))
     114             : 
     115             : PyDoc_STRVAR(select_poll_modify__doc__,
     116             : "modify($self, fd, eventmask, /)\n"
     117             : "--\n"
     118             : "\n"
     119             : "Modify an already registered file descriptor.\n"
     120             : "\n"
     121             : "  fd\n"
     122             : "    either an integer, or an object with a fileno() method returning\n"
     123             : "    an int\n"
     124             : "  eventmask\n"
     125             : "    a bitmask describing the type of events to check for");
     126             : 
     127             : #define SELECT_POLL_MODIFY_METHODDEF    \
     128             :     {"modify", _PyCFunction_CAST(select_poll_modify), METH_FASTCALL, select_poll_modify__doc__},
     129             : 
     130             : static PyObject *
     131             : select_poll_modify_impl(pollObject *self, int fd, unsigned short eventmask);
     132             : 
     133             : static PyObject *
     134          30 : select_poll_modify(pollObject *self, PyObject *const *args, Py_ssize_t nargs)
     135             : {
     136          30 :     PyObject *return_value = NULL;
     137             :     int fd;
     138             :     unsigned short eventmask;
     139             : 
     140          30 :     if (!_PyArg_CheckPositional("modify", nargs, 2, 2)) {
     141           0 :         goto exit;
     142             :     }
     143          30 :     if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
     144           0 :         goto exit;
     145             :     }
     146          30 :     if (!_PyLong_UnsignedShort_Converter(args[1], &eventmask)) {
     147           3 :         goto exit;
     148             :     }
     149          27 :     return_value = select_poll_modify_impl(self, fd, eventmask);
     150             : 
     151          30 : exit:
     152          30 :     return return_value;
     153             : }
     154             : 
     155             : #endif /* (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) */
     156             : 
     157             : #if (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL))
     158             : 
     159             : PyDoc_STRVAR(select_poll_unregister__doc__,
     160             : "unregister($self, fd, /)\n"
     161             : "--\n"
     162             : "\n"
     163             : "Remove a file descriptor being tracked by the polling object.");
     164             : 
     165             : #define SELECT_POLL_UNREGISTER_METHODDEF    \
     166             :     {"unregister", (PyCFunction)select_poll_unregister, METH_O, select_poll_unregister__doc__},
     167             : 
     168             : static PyObject *
     169             : select_poll_unregister_impl(pollObject *self, int fd);
     170             : 
     171             : static PyObject *
     172        3590 : select_poll_unregister(pollObject *self, PyObject *arg)
     173             : {
     174        3590 :     PyObject *return_value = NULL;
     175             :     int fd;
     176             : 
     177        3590 :     if (!_PyLong_FileDescriptor_Converter(arg, &fd)) {
     178           1 :         goto exit;
     179             :     }
     180        3589 :     return_value = select_poll_unregister_impl(self, fd);
     181             : 
     182        3590 : exit:
     183        3590 :     return return_value;
     184             : }
     185             : 
     186             : #endif /* (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) */
     187             : 
     188             : #if (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL))
     189             : 
     190             : PyDoc_STRVAR(select_poll_poll__doc__,
     191             : "poll($self, timeout=None, /)\n"
     192             : "--\n"
     193             : "\n"
     194             : "Polls the set of registered file descriptors.\n"
     195             : "\n"
     196             : "  timeout\n"
     197             : "    The maximum time to wait in milliseconds, or else None (or a negative\n"
     198             : "    value) to wait indefinitely.\n"
     199             : "\n"
     200             : "Returns a list containing any descriptors that have events or errors to\n"
     201             : "report, as a list of (fd, event) 2-tuples.");
     202             : 
     203             : #define SELECT_POLL_POLL_METHODDEF    \
     204             :     {"poll", _PyCFunction_CAST(select_poll_poll), METH_FASTCALL, select_poll_poll__doc__},
     205             : 
     206             : static PyObject *
     207             : select_poll_poll_impl(pollObject *self, PyObject *timeout_obj);
     208             : 
     209             : static PyObject *
     210       75644 : select_poll_poll(pollObject *self, PyObject *const *args, Py_ssize_t nargs)
     211             : {
     212       75644 :     PyObject *return_value = NULL;
     213       75644 :     PyObject *timeout_obj = Py_None;
     214             : 
     215       75644 :     if (!_PyArg_CheckPositional("poll", nargs, 0, 1)) {
     216           0 :         goto exit;
     217             :     }
     218       75644 :     if (nargs < 1) {
     219          29 :         goto skip_optional;
     220             :     }
     221       75615 :     timeout_obj = args[0];
     222       75644 : skip_optional:
     223       75644 :     return_value = select_poll_poll_impl(self, timeout_obj);
     224             : 
     225       75644 : exit:
     226       75644 :     return return_value;
     227             : }
     228             : 
     229             : #endif /* (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) */
     230             : 
     231             : #if (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) && defined(HAVE_SYS_DEVPOLL_H)
     232             : 
     233             : PyDoc_STRVAR(select_devpoll_register__doc__,
     234             : "register($self, fd,\n"
     235             : "         eventmask=select.POLLIN | select.POLLPRI | select.POLLOUT, /)\n"
     236             : "--\n"
     237             : "\n"
     238             : "Register a file descriptor with the polling object.\n"
     239             : "\n"
     240             : "  fd\n"
     241             : "    either an integer, or an object with a fileno() method returning\n"
     242             : "    an int\n"
     243             : "  eventmask\n"
     244             : "    an optional bitmask describing the type of events to check for");
     245             : 
     246             : #define SELECT_DEVPOLL_REGISTER_METHODDEF    \
     247             :     {"register", _PyCFunction_CAST(select_devpoll_register), METH_FASTCALL, select_devpoll_register__doc__},
     248             : 
     249             : static PyObject *
     250             : select_devpoll_register_impl(devpollObject *self, int fd,
     251             :                              unsigned short eventmask);
     252             : 
     253             : static PyObject *
     254             : select_devpoll_register(devpollObject *self, PyObject *const *args, Py_ssize_t nargs)
     255             : {
     256             :     PyObject *return_value = NULL;
     257             :     int fd;
     258             :     unsigned short eventmask = POLLIN | POLLPRI | POLLOUT;
     259             : 
     260             :     if (!_PyArg_CheckPositional("register", nargs, 1, 2)) {
     261             :         goto exit;
     262             :     }
     263             :     if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
     264             :         goto exit;
     265             :     }
     266             :     if (nargs < 2) {
     267             :         goto skip_optional;
     268             :     }
     269             :     if (!_PyLong_UnsignedShort_Converter(args[1], &eventmask)) {
     270             :         goto exit;
     271             :     }
     272             : skip_optional:
     273             :     return_value = select_devpoll_register_impl(self, fd, eventmask);
     274             : 
     275             : exit:
     276             :     return return_value;
     277             : }
     278             : 
     279             : #endif /* (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) && defined(HAVE_SYS_DEVPOLL_H) */
     280             : 
     281             : #if (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) && defined(HAVE_SYS_DEVPOLL_H)
     282             : 
     283             : PyDoc_STRVAR(select_devpoll_modify__doc__,
     284             : "modify($self, fd,\n"
     285             : "       eventmask=select.POLLIN | select.POLLPRI | select.POLLOUT, /)\n"
     286             : "--\n"
     287             : "\n"
     288             : "Modify a possible already registered file descriptor.\n"
     289             : "\n"
     290             : "  fd\n"
     291             : "    either an integer, or an object with a fileno() method returning\n"
     292             : "    an int\n"
     293             : "  eventmask\n"
     294             : "    an optional bitmask describing the type of events to check for");
     295             : 
     296             : #define SELECT_DEVPOLL_MODIFY_METHODDEF    \
     297             :     {"modify", _PyCFunction_CAST(select_devpoll_modify), METH_FASTCALL, select_devpoll_modify__doc__},
     298             : 
     299             : static PyObject *
     300             : select_devpoll_modify_impl(devpollObject *self, int fd,
     301             :                            unsigned short eventmask);
     302             : 
     303             : static PyObject *
     304             : select_devpoll_modify(devpollObject *self, PyObject *const *args, Py_ssize_t nargs)
     305             : {
     306             :     PyObject *return_value = NULL;
     307             :     int fd;
     308             :     unsigned short eventmask = POLLIN | POLLPRI | POLLOUT;
     309             : 
     310             :     if (!_PyArg_CheckPositional("modify", nargs, 1, 2)) {
     311             :         goto exit;
     312             :     }
     313             :     if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
     314             :         goto exit;
     315             :     }
     316             :     if (nargs < 2) {
     317             :         goto skip_optional;
     318             :     }
     319             :     if (!_PyLong_UnsignedShort_Converter(args[1], &eventmask)) {
     320             :         goto exit;
     321             :     }
     322             : skip_optional:
     323             :     return_value = select_devpoll_modify_impl(self, fd, eventmask);
     324             : 
     325             : exit:
     326             :     return return_value;
     327             : }
     328             : 
     329             : #endif /* (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) && defined(HAVE_SYS_DEVPOLL_H) */
     330             : 
     331             : #if (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) && defined(HAVE_SYS_DEVPOLL_H)
     332             : 
     333             : PyDoc_STRVAR(select_devpoll_unregister__doc__,
     334             : "unregister($self, fd, /)\n"
     335             : "--\n"
     336             : "\n"
     337             : "Remove a file descriptor being tracked by the polling object.");
     338             : 
     339             : #define SELECT_DEVPOLL_UNREGISTER_METHODDEF    \
     340             :     {"unregister", (PyCFunction)select_devpoll_unregister, METH_O, select_devpoll_unregister__doc__},
     341             : 
     342             : static PyObject *
     343             : select_devpoll_unregister_impl(devpollObject *self, int fd);
     344             : 
     345             : static PyObject *
     346             : select_devpoll_unregister(devpollObject *self, PyObject *arg)
     347             : {
     348             :     PyObject *return_value = NULL;
     349             :     int fd;
     350             : 
     351             :     if (!_PyLong_FileDescriptor_Converter(arg, &fd)) {
     352             :         goto exit;
     353             :     }
     354             :     return_value = select_devpoll_unregister_impl(self, fd);
     355             : 
     356             : exit:
     357             :     return return_value;
     358             : }
     359             : 
     360             : #endif /* (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) && defined(HAVE_SYS_DEVPOLL_H) */
     361             : 
     362             : #if (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) && defined(HAVE_SYS_DEVPOLL_H)
     363             : 
     364             : PyDoc_STRVAR(select_devpoll_poll__doc__,
     365             : "poll($self, timeout=None, /)\n"
     366             : "--\n"
     367             : "\n"
     368             : "Polls the set of registered file descriptors.\n"
     369             : "\n"
     370             : "  timeout\n"
     371             : "    The maximum time to wait in milliseconds, or else None (or a negative\n"
     372             : "    value) to wait indefinitely.\n"
     373             : "\n"
     374             : "Returns a list containing any descriptors that have events or errors to\n"
     375             : "report, as a list of (fd, event) 2-tuples.");
     376             : 
     377             : #define SELECT_DEVPOLL_POLL_METHODDEF    \
     378             :     {"poll", _PyCFunction_CAST(select_devpoll_poll), METH_FASTCALL, select_devpoll_poll__doc__},
     379             : 
     380             : static PyObject *
     381             : select_devpoll_poll_impl(devpollObject *self, PyObject *timeout_obj);
     382             : 
     383             : static PyObject *
     384             : select_devpoll_poll(devpollObject *self, PyObject *const *args, Py_ssize_t nargs)
     385             : {
     386             :     PyObject *return_value = NULL;
     387             :     PyObject *timeout_obj = Py_None;
     388             : 
     389             :     if (!_PyArg_CheckPositional("poll", nargs, 0, 1)) {
     390             :         goto exit;
     391             :     }
     392             :     if (nargs < 1) {
     393             :         goto skip_optional;
     394             :     }
     395             :     timeout_obj = args[0];
     396             : skip_optional:
     397             :     return_value = select_devpoll_poll_impl(self, timeout_obj);
     398             : 
     399             : exit:
     400             :     return return_value;
     401             : }
     402             : 
     403             : #endif /* (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) && defined(HAVE_SYS_DEVPOLL_H) */
     404             : 
     405             : #if (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) && defined(HAVE_SYS_DEVPOLL_H)
     406             : 
     407             : PyDoc_STRVAR(select_devpoll_close__doc__,
     408             : "close($self, /)\n"
     409             : "--\n"
     410             : "\n"
     411             : "Close the devpoll file descriptor.\n"
     412             : "\n"
     413             : "Further operations on the devpoll object will raise an exception.");
     414             : 
     415             : #define SELECT_DEVPOLL_CLOSE_METHODDEF    \
     416             :     {"close", (PyCFunction)select_devpoll_close, METH_NOARGS, select_devpoll_close__doc__},
     417             : 
     418             : static PyObject *
     419             : select_devpoll_close_impl(devpollObject *self);
     420             : 
     421             : static PyObject *
     422             : select_devpoll_close(devpollObject *self, PyObject *Py_UNUSED(ignored))
     423             : {
     424             :     return select_devpoll_close_impl(self);
     425             : }
     426             : 
     427             : #endif /* (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) && defined(HAVE_SYS_DEVPOLL_H) */
     428             : 
     429             : #if (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) && defined(HAVE_SYS_DEVPOLL_H)
     430             : 
     431             : PyDoc_STRVAR(select_devpoll_fileno__doc__,
     432             : "fileno($self, /)\n"
     433             : "--\n"
     434             : "\n"
     435             : "Return the file descriptor.");
     436             : 
     437             : #define SELECT_DEVPOLL_FILENO_METHODDEF    \
     438             :     {"fileno", (PyCFunction)select_devpoll_fileno, METH_NOARGS, select_devpoll_fileno__doc__},
     439             : 
     440             : static PyObject *
     441             : select_devpoll_fileno_impl(devpollObject *self);
     442             : 
     443             : static PyObject *
     444             : select_devpoll_fileno(devpollObject *self, PyObject *Py_UNUSED(ignored))
     445             : {
     446             :     return select_devpoll_fileno_impl(self);
     447             : }
     448             : 
     449             : #endif /* (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) && defined(HAVE_SYS_DEVPOLL_H) */
     450             : 
     451             : #if (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL))
     452             : 
     453             : PyDoc_STRVAR(select_poll__doc__,
     454             : "poll($module, /)\n"
     455             : "--\n"
     456             : "\n"
     457             : "Returns a polling object.\n"
     458             : "\n"
     459             : "This object supports registering and unregistering file descriptors, and then\n"
     460             : "polling them for I/O events.");
     461             : 
     462             : #define SELECT_POLL_METHODDEF    \
     463             :     {"poll", (PyCFunction)select_poll, METH_NOARGS, select_poll__doc__},
     464             : 
     465             : static PyObject *
     466             : select_poll_impl(PyObject *module);
     467             : 
     468             : static PyObject *
     469       51405 : select_poll(PyObject *module, PyObject *Py_UNUSED(ignored))
     470             : {
     471       51405 :     return select_poll_impl(module);
     472             : }
     473             : 
     474             : #endif /* (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) */
     475             : 
     476             : #if (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) && defined(HAVE_SYS_DEVPOLL_H)
     477             : 
     478             : PyDoc_STRVAR(select_devpoll__doc__,
     479             : "devpoll($module, /)\n"
     480             : "--\n"
     481             : "\n"
     482             : "Returns a polling object.\n"
     483             : "\n"
     484             : "This object supports registering and unregistering file descriptors, and then\n"
     485             : "polling them for I/O events.");
     486             : 
     487             : #define SELECT_DEVPOLL_METHODDEF    \
     488             :     {"devpoll", (PyCFunction)select_devpoll, METH_NOARGS, select_devpoll__doc__},
     489             : 
     490             : static PyObject *
     491             : select_devpoll_impl(PyObject *module);
     492             : 
     493             : static PyObject *
     494             : select_devpoll(PyObject *module, PyObject *Py_UNUSED(ignored))
     495             : {
     496             :     return select_devpoll_impl(module);
     497             : }
     498             : 
     499             : #endif /* (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) && defined(HAVE_SYS_DEVPOLL_H) */
     500             : 
     501             : #if defined(HAVE_EPOLL)
     502             : 
     503             : PyDoc_STRVAR(select_epoll__doc__,
     504             : "epoll(sizehint=-1, flags=0)\n"
     505             : "--\n"
     506             : "\n"
     507             : "Returns an epolling object.\n"
     508             : "\n"
     509             : "  sizehint\n"
     510             : "    The expected number of events to be registered.  It must be positive,\n"
     511             : "    or -1 to use the default.  It is only used on older systems where\n"
     512             : "    epoll_create1() is not available; otherwise it has no effect (though its\n"
     513             : "    value is still checked).\n"
     514             : "  flags\n"
     515             : "    Deprecated and completely ignored.  However, when supplied, its value\n"
     516             : "    must be 0 or select.EPOLL_CLOEXEC, otherwise OSError is raised.");
     517             : 
     518             : static PyObject *
     519             : select_epoll_impl(PyTypeObject *type, int sizehint, int flags);
     520             : 
     521             : static PyObject *
     522        2545 : select_epoll(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     523             : {
     524        2545 :     PyObject *return_value = NULL;
     525             :     static const char * const _keywords[] = {"sizehint", "flags", NULL};
     526             :     static _PyArg_Parser _parser = {NULL, _keywords, "epoll", 0};
     527             :     PyObject *argsbuf[2];
     528             :     PyObject * const *fastargs;
     529        2545 :     Py_ssize_t nargs = PyTuple_GET_SIZE(args);
     530        2545 :     Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 0;
     531        2545 :     int sizehint = -1;
     532        2545 :     int flags = 0;
     533             : 
     534        2545 :     fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 2, 0, argsbuf);
     535        2545 :     if (!fastargs) {
     536           1 :         goto exit;
     537             :     }
     538        2544 :     if (!noptargs) {
     539        2523 :         goto skip_optional_pos;
     540             :     }
     541          21 :     if (fastargs[0]) {
     542          18 :         sizehint = _PyLong_AsInt(fastargs[0]);
     543          18 :         if (sizehint == -1 && PyErr_Occurred()) {
     544           5 :             goto exit;
     545             :         }
     546          13 :         if (!--noptargs) {
     547          12 :             goto skip_optional_pos;
     548             :         }
     549             :     }
     550           4 :     flags = _PyLong_AsInt(fastargs[1]);
     551           4 :     if (flags == -1 && PyErr_Occurred()) {
     552           0 :         goto exit;
     553             :     }
     554           4 : skip_optional_pos:
     555        2539 :     return_value = select_epoll_impl(type, sizehint, flags);
     556             : 
     557        2545 : exit:
     558        2545 :     return return_value;
     559             : }
     560             : 
     561             : #endif /* defined(HAVE_EPOLL) */
     562             : 
     563             : #if defined(HAVE_EPOLL)
     564             : 
     565             : PyDoc_STRVAR(select_epoll_close__doc__,
     566             : "close($self, /)\n"
     567             : "--\n"
     568             : "\n"
     569             : "Close the epoll control file descriptor.\n"
     570             : "\n"
     571             : "Further operations on the epoll object will raise an exception.");
     572             : 
     573             : #define SELECT_EPOLL_CLOSE_METHODDEF    \
     574             :     {"close", (PyCFunction)select_epoll_close, METH_NOARGS, select_epoll_close__doc__},
     575             : 
     576             : static PyObject *
     577             : select_epoll_close_impl(pyEpoll_Object *self);
     578             : 
     579             : static PyObject *
     580        2528 : select_epoll_close(pyEpoll_Object *self, PyObject *Py_UNUSED(ignored))
     581             : {
     582        2528 :     return select_epoll_close_impl(self);
     583             : }
     584             : 
     585             : #endif /* defined(HAVE_EPOLL) */
     586             : 
     587             : #if defined(HAVE_EPOLL)
     588             : 
     589             : PyDoc_STRVAR(select_epoll_fileno__doc__,
     590             : "fileno($self, /)\n"
     591             : "--\n"
     592             : "\n"
     593             : "Return the epoll control file descriptor.");
     594             : 
     595             : #define SELECT_EPOLL_FILENO_METHODDEF    \
     596             :     {"fileno", (PyCFunction)select_epoll_fileno, METH_NOARGS, select_epoll_fileno__doc__},
     597             : 
     598             : static PyObject *
     599             : select_epoll_fileno_impl(pyEpoll_Object *self);
     600             : 
     601             : static PyObject *
     602          11 : select_epoll_fileno(pyEpoll_Object *self, PyObject *Py_UNUSED(ignored))
     603             : {
     604          11 :     return select_epoll_fileno_impl(self);
     605             : }
     606             : 
     607             : #endif /* defined(HAVE_EPOLL) */
     608             : 
     609             : #if defined(HAVE_EPOLL)
     610             : 
     611             : PyDoc_STRVAR(select_epoll_fromfd__doc__,
     612             : "fromfd($type, fd, /)\n"
     613             : "--\n"
     614             : "\n"
     615             : "Create an epoll object from a given control fd.");
     616             : 
     617             : #define SELECT_EPOLL_FROMFD_METHODDEF    \
     618             :     {"fromfd", (PyCFunction)select_epoll_fromfd, METH_O|METH_CLASS, select_epoll_fromfd__doc__},
     619             : 
     620             : static PyObject *
     621             : select_epoll_fromfd_impl(PyTypeObject *type, int fd);
     622             : 
     623             : static PyObject *
     624           1 : select_epoll_fromfd(PyTypeObject *type, PyObject *arg)
     625             : {
     626           1 :     PyObject *return_value = NULL;
     627             :     int fd;
     628             : 
     629           1 :     fd = _PyLong_AsInt(arg);
     630           1 :     if (fd == -1 && PyErr_Occurred()) {
     631           0 :         goto exit;
     632             :     }
     633           1 :     return_value = select_epoll_fromfd_impl(type, fd);
     634             : 
     635           1 : exit:
     636           1 :     return return_value;
     637             : }
     638             : 
     639             : #endif /* defined(HAVE_EPOLL) */
     640             : 
     641             : #if defined(HAVE_EPOLL)
     642             : 
     643             : PyDoc_STRVAR(select_epoll_register__doc__,
     644             : "register($self, /, fd,\n"
     645             : "         eventmask=select.EPOLLIN | select.EPOLLPRI | select.EPOLLOUT)\n"
     646             : "--\n"
     647             : "\n"
     648             : "Registers a new fd or raises an OSError if the fd is already registered.\n"
     649             : "\n"
     650             : "  fd\n"
     651             : "    the target file descriptor of the operation\n"
     652             : "  eventmask\n"
     653             : "    a bit set composed of the various EPOLL constants\n"
     654             : "\n"
     655             : "The epoll interface supports all file descriptors that support poll.");
     656             : 
     657             : #define SELECT_EPOLL_REGISTER_METHODDEF    \
     658             :     {"register", _PyCFunction_CAST(select_epoll_register), METH_FASTCALL|METH_KEYWORDS, select_epoll_register__doc__},
     659             : 
     660             : static PyObject *
     661             : select_epoll_register_impl(pyEpoll_Object *self, int fd,
     662             :                            unsigned int eventmask);
     663             : 
     664             : static PyObject *
     665       67932 : select_epoll_register(pyEpoll_Object *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
     666             : {
     667       67932 :     PyObject *return_value = NULL;
     668             :     static const char * const _keywords[] = {"fd", "eventmask", NULL};
     669             :     static _PyArg_Parser _parser = {NULL, _keywords, "register", 0};
     670             :     PyObject *argsbuf[2];
     671       67932 :     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
     672             :     int fd;
     673       67932 :     unsigned int eventmask = EPOLLIN | EPOLLPRI | EPOLLOUT;
     674             : 
     675       67932 :     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
     676       67932 :     if (!args) {
     677           0 :         goto exit;
     678             :     }
     679       67932 :     if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
     680           4 :         goto exit;
     681             :     }
     682       67928 :     if (!noptargs) {
     683           1 :         goto skip_optional_pos;
     684             :     }
     685       67927 :     eventmask = (unsigned int)PyLong_AsUnsignedLongMask(args[1]);
     686       67927 :     if (eventmask == (unsigned int)-1 && PyErr_Occurred()) {
     687           0 :         goto exit;
     688             :     }
     689       67927 : skip_optional_pos:
     690       67928 :     return_value = select_epoll_register_impl(self, fd, eventmask);
     691             : 
     692       67932 : exit:
     693       67932 :     return return_value;
     694             : }
     695             : 
     696             : #endif /* defined(HAVE_EPOLL) */
     697             : 
     698             : #if defined(HAVE_EPOLL)
     699             : 
     700             : PyDoc_STRVAR(select_epoll_modify__doc__,
     701             : "modify($self, /, fd, eventmask)\n"
     702             : "--\n"
     703             : "\n"
     704             : "Modify event mask for a registered file descriptor.\n"
     705             : "\n"
     706             : "  fd\n"
     707             : "    the target file descriptor of the operation\n"
     708             : "  eventmask\n"
     709             : "    a bit set composed of the various EPOLL constants");
     710             : 
     711             : #define SELECT_EPOLL_MODIFY_METHODDEF    \
     712             :     {"modify", _PyCFunction_CAST(select_epoll_modify), METH_FASTCALL|METH_KEYWORDS, select_epoll_modify__doc__},
     713             : 
     714             : static PyObject *
     715             : select_epoll_modify_impl(pyEpoll_Object *self, int fd,
     716             :                          unsigned int eventmask);
     717             : 
     718             : static PyObject *
     719          42 : select_epoll_modify(pyEpoll_Object *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
     720             : {
     721          42 :     PyObject *return_value = NULL;
     722             :     static const char * const _keywords[] = {"fd", "eventmask", NULL};
     723             :     static _PyArg_Parser _parser = {NULL, _keywords, "modify", 0};
     724             :     PyObject *argsbuf[2];
     725             :     int fd;
     726             :     unsigned int eventmask;
     727             : 
     728          42 :     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
     729          42 :     if (!args) {
     730           0 :         goto exit;
     731             :     }
     732          42 :     if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
     733           0 :         goto exit;
     734             :     }
     735          42 :     eventmask = (unsigned int)PyLong_AsUnsignedLongMask(args[1]);
     736          42 :     if (eventmask == (unsigned int)-1 && PyErr_Occurred()) {
     737           0 :         goto exit;
     738             :     }
     739          42 :     return_value = select_epoll_modify_impl(self, fd, eventmask);
     740             : 
     741          42 : exit:
     742          42 :     return return_value;
     743             : }
     744             : 
     745             : #endif /* defined(HAVE_EPOLL) */
     746             : 
     747             : #if defined(HAVE_EPOLL)
     748             : 
     749             : PyDoc_STRVAR(select_epoll_unregister__doc__,
     750             : "unregister($self, /, fd)\n"
     751             : "--\n"
     752             : "\n"
     753             : "Remove a registered file descriptor from the epoll object.\n"
     754             : "\n"
     755             : "  fd\n"
     756             : "    the target file descriptor of the operation");
     757             : 
     758             : #define SELECT_EPOLL_UNREGISTER_METHODDEF    \
     759             :     {"unregister", _PyCFunction_CAST(select_epoll_unregister), METH_FASTCALL|METH_KEYWORDS, select_epoll_unregister__doc__},
     760             : 
     761             : static PyObject *
     762             : select_epoll_unregister_impl(pyEpoll_Object *self, int fd);
     763             : 
     764             : static PyObject *
     765        2274 : select_epoll_unregister(pyEpoll_Object *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
     766             : {
     767        2274 :     PyObject *return_value = NULL;
     768             :     static const char * const _keywords[] = {"fd", NULL};
     769             :     static _PyArg_Parser _parser = {NULL, _keywords, "unregister", 0};
     770             :     PyObject *argsbuf[1];
     771             :     int fd;
     772             : 
     773        2274 :     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
     774        2274 :     if (!args) {
     775           0 :         goto exit;
     776             :     }
     777        2274 :     if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
     778           0 :         goto exit;
     779             :     }
     780        2274 :     return_value = select_epoll_unregister_impl(self, fd);
     781             : 
     782        2274 : exit:
     783        2274 :     return return_value;
     784             : }
     785             : 
     786             : #endif /* defined(HAVE_EPOLL) */
     787             : 
     788             : #if defined(HAVE_EPOLL)
     789             : 
     790             : PyDoc_STRVAR(select_epoll_poll__doc__,
     791             : "poll($self, /, timeout=None, maxevents=-1)\n"
     792             : "--\n"
     793             : "\n"
     794             : "Wait for events on the epoll file descriptor.\n"
     795             : "\n"
     796             : "  timeout\n"
     797             : "    the maximum time to wait in seconds (as float);\n"
     798             : "    a timeout of None or -1 makes poll wait indefinitely\n"
     799             : "  maxevents\n"
     800             : "    the maximum number of events returned; -1 means no limit\n"
     801             : "\n"
     802             : "Returns a list containing any descriptors that have events to report,\n"
     803             : "as a list of (fd, events) 2-tuples.");
     804             : 
     805             : #define SELECT_EPOLL_POLL_METHODDEF    \
     806             :     {"poll", _PyCFunction_CAST(select_epoll_poll), METH_FASTCALL|METH_KEYWORDS, select_epoll_poll__doc__},
     807             : 
     808             : static PyObject *
     809             : select_epoll_poll_impl(pyEpoll_Object *self, PyObject *timeout_obj,
     810             :                        int maxevents);
     811             : 
     812             : static PyObject *
     813       15106 : select_epoll_poll(pyEpoll_Object *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
     814             : {
     815       15106 :     PyObject *return_value = NULL;
     816             :     static const char * const _keywords[] = {"timeout", "maxevents", NULL};
     817             :     static _PyArg_Parser _parser = {NULL, _keywords, "poll", 0};
     818             :     PyObject *argsbuf[2];
     819       15106 :     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
     820       15106 :     PyObject *timeout_obj = Py_None;
     821       15106 :     int maxevents = -1;
     822             : 
     823       15106 :     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 2, 0, argsbuf);
     824       15106 :     if (!args) {
     825           0 :         goto exit;
     826             :     }
     827       15106 :     if (!noptargs) {
     828           0 :         goto skip_optional_pos;
     829             :     }
     830       15106 :     if (args[0]) {
     831       15106 :         timeout_obj = args[0];
     832       15106 :         if (!--noptargs) {
     833           2 :             goto skip_optional_pos;
     834             :         }
     835             :     }
     836       15104 :     maxevents = _PyLong_AsInt(args[1]);
     837       15104 :     if (maxevents == -1 && PyErr_Occurred()) {
     838           0 :         goto exit;
     839             :     }
     840       15104 : skip_optional_pos:
     841       15106 :     return_value = select_epoll_poll_impl(self, timeout_obj, maxevents);
     842             : 
     843       15106 : exit:
     844       15106 :     return return_value;
     845             : }
     846             : 
     847             : #endif /* defined(HAVE_EPOLL) */
     848             : 
     849             : #if defined(HAVE_EPOLL)
     850             : 
     851             : PyDoc_STRVAR(select_epoll___enter____doc__,
     852             : "__enter__($self, /)\n"
     853             : "--\n"
     854             : "\n");
     855             : 
     856             : #define SELECT_EPOLL___ENTER___METHODDEF    \
     857             :     {"__enter__", (PyCFunction)select_epoll___enter__, METH_NOARGS, select_epoll___enter____doc__},
     858             : 
     859             : static PyObject *
     860             : select_epoll___enter___impl(pyEpoll_Object *self);
     861             : 
     862             : static PyObject *
     863           2 : select_epoll___enter__(pyEpoll_Object *self, PyObject *Py_UNUSED(ignored))
     864             : {
     865           2 :     return select_epoll___enter___impl(self);
     866             : }
     867             : 
     868             : #endif /* defined(HAVE_EPOLL) */
     869             : 
     870             : #if defined(HAVE_EPOLL)
     871             : 
     872             : PyDoc_STRVAR(select_epoll___exit____doc__,
     873             : "__exit__($self, exc_type=None, exc_value=None, exc_tb=None, /)\n"
     874             : "--\n"
     875             : "\n");
     876             : 
     877             : #define SELECT_EPOLL___EXIT___METHODDEF    \
     878             :     {"__exit__", _PyCFunction_CAST(select_epoll___exit__), METH_FASTCALL, select_epoll___exit____doc__},
     879             : 
     880             : static PyObject *
     881             : select_epoll___exit___impl(pyEpoll_Object *self, PyObject *exc_type,
     882             :                            PyObject *exc_value, PyObject *exc_tb);
     883             : 
     884             : static PyObject *
     885           2 : select_epoll___exit__(pyEpoll_Object *self, PyObject *const *args, Py_ssize_t nargs)
     886             : {
     887           2 :     PyObject *return_value = NULL;
     888           2 :     PyObject *exc_type = Py_None;
     889           2 :     PyObject *exc_value = Py_None;
     890           2 :     PyObject *exc_tb = Py_None;
     891             : 
     892           2 :     if (!_PyArg_CheckPositional("__exit__", nargs, 0, 3)) {
     893           0 :         goto exit;
     894             :     }
     895           2 :     if (nargs < 1) {
     896           0 :         goto skip_optional;
     897             :     }
     898           2 :     exc_type = args[0];
     899           2 :     if (nargs < 2) {
     900           0 :         goto skip_optional;
     901             :     }
     902           2 :     exc_value = args[1];
     903           2 :     if (nargs < 3) {
     904           0 :         goto skip_optional;
     905             :     }
     906           2 :     exc_tb = args[2];
     907           2 : skip_optional:
     908           2 :     return_value = select_epoll___exit___impl(self, exc_type, exc_value, exc_tb);
     909             : 
     910           2 : exit:
     911           2 :     return return_value;
     912             : }
     913             : 
     914             : #endif /* defined(HAVE_EPOLL) */
     915             : 
     916             : #if defined(HAVE_KQUEUE)
     917             : 
     918             : PyDoc_STRVAR(select_kqueue__doc__,
     919             : "kqueue()\n"
     920             : "--\n"
     921             : "\n"
     922             : "Kqueue syscall wrapper.\n"
     923             : "\n"
     924             : "For example, to start watching a socket for input:\n"
     925             : ">>> kq = kqueue()\n"
     926             : ">>> sock = socket()\n"
     927             : ">>> sock.connect((host, port))\n"
     928             : ">>> kq.control([kevent(sock, KQ_FILTER_WRITE, KQ_EV_ADD)], 0)\n"
     929             : "\n"
     930             : "To wait one second for it to become writeable:\n"
     931             : ">>> kq.control(None, 1, 1000)\n"
     932             : "\n"
     933             : "To stop listening:\n"
     934             : ">>> kq.control([kevent(sock, KQ_FILTER_WRITE, KQ_EV_DELETE)], 0)");
     935             : 
     936             : static PyObject *
     937             : select_kqueue_impl(PyTypeObject *type);
     938             : 
     939             : static PyObject *
     940             : select_kqueue(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     941             : {
     942             :     PyObject *return_value = NULL;
     943             : 
     944             :     if ((type == _selectstate_by_type(type)->kqueue_queue_Type ||
     945             :          type->tp_init == _selectstate_by_type(type)->kqueue_queue_Type->tp_init) &&
     946             :         !_PyArg_NoPositional("kqueue", args)) {
     947             :         goto exit;
     948             :     }
     949             :     if ((type == _selectstate_by_type(type)->kqueue_queue_Type ||
     950             :          type->tp_init == _selectstate_by_type(type)->kqueue_queue_Type->tp_init) &&
     951             :         !_PyArg_NoKeywords("kqueue", kwargs)) {
     952             :         goto exit;
     953             :     }
     954             :     return_value = select_kqueue_impl(type);
     955             : 
     956             : exit:
     957             :     return return_value;
     958             : }
     959             : 
     960             : #endif /* defined(HAVE_KQUEUE) */
     961             : 
     962             : #if defined(HAVE_KQUEUE)
     963             : 
     964             : PyDoc_STRVAR(select_kqueue_close__doc__,
     965             : "close($self, /)\n"
     966             : "--\n"
     967             : "\n"
     968             : "Close the kqueue control file descriptor.\n"
     969             : "\n"
     970             : "Further operations on the kqueue object will raise an exception.");
     971             : 
     972             : #define SELECT_KQUEUE_CLOSE_METHODDEF    \
     973             :     {"close", (PyCFunction)select_kqueue_close, METH_NOARGS, select_kqueue_close__doc__},
     974             : 
     975             : static PyObject *
     976             : select_kqueue_close_impl(kqueue_queue_Object *self);
     977             : 
     978             : static PyObject *
     979             : select_kqueue_close(kqueue_queue_Object *self, PyObject *Py_UNUSED(ignored))
     980             : {
     981             :     return select_kqueue_close_impl(self);
     982             : }
     983             : 
     984             : #endif /* defined(HAVE_KQUEUE) */
     985             : 
     986             : #if defined(HAVE_KQUEUE)
     987             : 
     988             : PyDoc_STRVAR(select_kqueue_fileno__doc__,
     989             : "fileno($self, /)\n"
     990             : "--\n"
     991             : "\n"
     992             : "Return the kqueue control file descriptor.");
     993             : 
     994             : #define SELECT_KQUEUE_FILENO_METHODDEF    \
     995             :     {"fileno", (PyCFunction)select_kqueue_fileno, METH_NOARGS, select_kqueue_fileno__doc__},
     996             : 
     997             : static PyObject *
     998             : select_kqueue_fileno_impl(kqueue_queue_Object *self);
     999             : 
    1000             : static PyObject *
    1001             : select_kqueue_fileno(kqueue_queue_Object *self, PyObject *Py_UNUSED(ignored))
    1002             : {
    1003             :     return select_kqueue_fileno_impl(self);
    1004             : }
    1005             : 
    1006             : #endif /* defined(HAVE_KQUEUE) */
    1007             : 
    1008             : #if defined(HAVE_KQUEUE)
    1009             : 
    1010             : PyDoc_STRVAR(select_kqueue_fromfd__doc__,
    1011             : "fromfd($type, fd, /)\n"
    1012             : "--\n"
    1013             : "\n"
    1014             : "Create a kqueue object from a given control fd.");
    1015             : 
    1016             : #define SELECT_KQUEUE_FROMFD_METHODDEF    \
    1017             :     {"fromfd", (PyCFunction)select_kqueue_fromfd, METH_O|METH_CLASS, select_kqueue_fromfd__doc__},
    1018             : 
    1019             : static PyObject *
    1020             : select_kqueue_fromfd_impl(PyTypeObject *type, int fd);
    1021             : 
    1022             : static PyObject *
    1023             : select_kqueue_fromfd(PyTypeObject *type, PyObject *arg)
    1024             : {
    1025             :     PyObject *return_value = NULL;
    1026             :     int fd;
    1027             : 
    1028             :     fd = _PyLong_AsInt(arg);
    1029             :     if (fd == -1 && PyErr_Occurred()) {
    1030             :         goto exit;
    1031             :     }
    1032             :     return_value = select_kqueue_fromfd_impl(type, fd);
    1033             : 
    1034             : exit:
    1035             :     return return_value;
    1036             : }
    1037             : 
    1038             : #endif /* defined(HAVE_KQUEUE) */
    1039             : 
    1040             : #if defined(HAVE_KQUEUE)
    1041             : 
    1042             : PyDoc_STRVAR(select_kqueue_control__doc__,
    1043             : "control($self, changelist, maxevents, timeout=None, /)\n"
    1044             : "--\n"
    1045             : "\n"
    1046             : "Calls the kernel kevent function.\n"
    1047             : "\n"
    1048             : "  changelist\n"
    1049             : "    Must be an iterable of kevent objects describing the changes to be made\n"
    1050             : "    to the kernel\'s watch list or None.\n"
    1051             : "  maxevents\n"
    1052             : "    The maximum number of events that the kernel will return.\n"
    1053             : "  timeout\n"
    1054             : "    The maximum time to wait in seconds, or else None to wait forever.\n"
    1055             : "    This accepts floats for smaller timeouts, too.");
    1056             : 
    1057             : #define SELECT_KQUEUE_CONTROL_METHODDEF    \
    1058             :     {"control", _PyCFunction_CAST(select_kqueue_control), METH_FASTCALL, select_kqueue_control__doc__},
    1059             : 
    1060             : static PyObject *
    1061             : select_kqueue_control_impl(kqueue_queue_Object *self, PyObject *changelist,
    1062             :                            int maxevents, PyObject *otimeout);
    1063             : 
    1064             : static PyObject *
    1065             : select_kqueue_control(kqueue_queue_Object *self, PyObject *const *args, Py_ssize_t nargs)
    1066             : {
    1067             :     PyObject *return_value = NULL;
    1068             :     PyObject *changelist;
    1069             :     int maxevents;
    1070             :     PyObject *otimeout = Py_None;
    1071             : 
    1072             :     if (!_PyArg_CheckPositional("control", nargs, 2, 3)) {
    1073             :         goto exit;
    1074             :     }
    1075             :     changelist = args[0];
    1076             :     maxevents = _PyLong_AsInt(args[1]);
    1077             :     if (maxevents == -1 && PyErr_Occurred()) {
    1078             :         goto exit;
    1079             :     }
    1080             :     if (nargs < 3) {
    1081             :         goto skip_optional;
    1082             :     }
    1083             :     otimeout = args[2];
    1084             : skip_optional:
    1085             :     return_value = select_kqueue_control_impl(self, changelist, maxevents, otimeout);
    1086             : 
    1087             : exit:
    1088             :     return return_value;
    1089             : }
    1090             : 
    1091             : #endif /* defined(HAVE_KQUEUE) */
    1092             : 
    1093             : #ifndef SELECT_POLL_REGISTER_METHODDEF
    1094             :     #define SELECT_POLL_REGISTER_METHODDEF
    1095             : #endif /* !defined(SELECT_POLL_REGISTER_METHODDEF) */
    1096             : 
    1097             : #ifndef SELECT_POLL_MODIFY_METHODDEF
    1098             :     #define SELECT_POLL_MODIFY_METHODDEF
    1099             : #endif /* !defined(SELECT_POLL_MODIFY_METHODDEF) */
    1100             : 
    1101             : #ifndef SELECT_POLL_UNREGISTER_METHODDEF
    1102             :     #define SELECT_POLL_UNREGISTER_METHODDEF
    1103             : #endif /* !defined(SELECT_POLL_UNREGISTER_METHODDEF) */
    1104             : 
    1105             : #ifndef SELECT_POLL_POLL_METHODDEF
    1106             :     #define SELECT_POLL_POLL_METHODDEF
    1107             : #endif /* !defined(SELECT_POLL_POLL_METHODDEF) */
    1108             : 
    1109             : #ifndef SELECT_DEVPOLL_REGISTER_METHODDEF
    1110             :     #define SELECT_DEVPOLL_REGISTER_METHODDEF
    1111             : #endif /* !defined(SELECT_DEVPOLL_REGISTER_METHODDEF) */
    1112             : 
    1113             : #ifndef SELECT_DEVPOLL_MODIFY_METHODDEF
    1114             :     #define SELECT_DEVPOLL_MODIFY_METHODDEF
    1115             : #endif /* !defined(SELECT_DEVPOLL_MODIFY_METHODDEF) */
    1116             : 
    1117             : #ifndef SELECT_DEVPOLL_UNREGISTER_METHODDEF
    1118             :     #define SELECT_DEVPOLL_UNREGISTER_METHODDEF
    1119             : #endif /* !defined(SELECT_DEVPOLL_UNREGISTER_METHODDEF) */
    1120             : 
    1121             : #ifndef SELECT_DEVPOLL_POLL_METHODDEF
    1122             :     #define SELECT_DEVPOLL_POLL_METHODDEF
    1123             : #endif /* !defined(SELECT_DEVPOLL_POLL_METHODDEF) */
    1124             : 
    1125             : #ifndef SELECT_DEVPOLL_CLOSE_METHODDEF
    1126             :     #define SELECT_DEVPOLL_CLOSE_METHODDEF
    1127             : #endif /* !defined(SELECT_DEVPOLL_CLOSE_METHODDEF) */
    1128             : 
    1129             : #ifndef SELECT_DEVPOLL_FILENO_METHODDEF
    1130             :     #define SELECT_DEVPOLL_FILENO_METHODDEF
    1131             : #endif /* !defined(SELECT_DEVPOLL_FILENO_METHODDEF) */
    1132             : 
    1133             : #ifndef SELECT_POLL_METHODDEF
    1134             :     #define SELECT_POLL_METHODDEF
    1135             : #endif /* !defined(SELECT_POLL_METHODDEF) */
    1136             : 
    1137             : #ifndef SELECT_DEVPOLL_METHODDEF
    1138             :     #define SELECT_DEVPOLL_METHODDEF
    1139             : #endif /* !defined(SELECT_DEVPOLL_METHODDEF) */
    1140             : 
    1141             : #ifndef SELECT_EPOLL_CLOSE_METHODDEF
    1142             :     #define SELECT_EPOLL_CLOSE_METHODDEF
    1143             : #endif /* !defined(SELECT_EPOLL_CLOSE_METHODDEF) */
    1144             : 
    1145             : #ifndef SELECT_EPOLL_FILENO_METHODDEF
    1146             :     #define SELECT_EPOLL_FILENO_METHODDEF
    1147             : #endif /* !defined(SELECT_EPOLL_FILENO_METHODDEF) */
    1148             : 
    1149             : #ifndef SELECT_EPOLL_FROMFD_METHODDEF
    1150             :     #define SELECT_EPOLL_FROMFD_METHODDEF
    1151             : #endif /* !defined(SELECT_EPOLL_FROMFD_METHODDEF) */
    1152             : 
    1153             : #ifndef SELECT_EPOLL_REGISTER_METHODDEF
    1154             :     #define SELECT_EPOLL_REGISTER_METHODDEF
    1155             : #endif /* !defined(SELECT_EPOLL_REGISTER_METHODDEF) */
    1156             : 
    1157             : #ifndef SELECT_EPOLL_MODIFY_METHODDEF
    1158             :     #define SELECT_EPOLL_MODIFY_METHODDEF
    1159             : #endif /* !defined(SELECT_EPOLL_MODIFY_METHODDEF) */
    1160             : 
    1161             : #ifndef SELECT_EPOLL_UNREGISTER_METHODDEF
    1162             :     #define SELECT_EPOLL_UNREGISTER_METHODDEF
    1163             : #endif /* !defined(SELECT_EPOLL_UNREGISTER_METHODDEF) */
    1164             : 
    1165             : #ifndef SELECT_EPOLL_POLL_METHODDEF
    1166             :     #define SELECT_EPOLL_POLL_METHODDEF
    1167             : #endif /* !defined(SELECT_EPOLL_POLL_METHODDEF) */
    1168             : 
    1169             : #ifndef SELECT_EPOLL___ENTER___METHODDEF
    1170             :     #define SELECT_EPOLL___ENTER___METHODDEF
    1171             : #endif /* !defined(SELECT_EPOLL___ENTER___METHODDEF) */
    1172             : 
    1173             : #ifndef SELECT_EPOLL___EXIT___METHODDEF
    1174             :     #define SELECT_EPOLL___EXIT___METHODDEF
    1175             : #endif /* !defined(SELECT_EPOLL___EXIT___METHODDEF) */
    1176             : 
    1177             : #ifndef SELECT_KQUEUE_CLOSE_METHODDEF
    1178             :     #define SELECT_KQUEUE_CLOSE_METHODDEF
    1179             : #endif /* !defined(SELECT_KQUEUE_CLOSE_METHODDEF) */
    1180             : 
    1181             : #ifndef SELECT_KQUEUE_FILENO_METHODDEF
    1182             :     #define SELECT_KQUEUE_FILENO_METHODDEF
    1183             : #endif /* !defined(SELECT_KQUEUE_FILENO_METHODDEF) */
    1184             : 
    1185             : #ifndef SELECT_KQUEUE_FROMFD_METHODDEF
    1186             :     #define SELECT_KQUEUE_FROMFD_METHODDEF
    1187             : #endif /* !defined(SELECT_KQUEUE_FROMFD_METHODDEF) */
    1188             : 
    1189             : #ifndef SELECT_KQUEUE_CONTROL_METHODDEF
    1190             :     #define SELECT_KQUEUE_CONTROL_METHODDEF
    1191             : #endif /* !defined(SELECT_KQUEUE_CONTROL_METHODDEF) */
    1192             : /*[clinic end generated code: output=e77cc5c8a6c77860 input=a9049054013a1b77]*/

Generated by: LCOV version 1.14