Ticket #3114: 3114-updated.diff

File 3114-updated.diff, 146.1 KB (added by MostAwesomeDude, 4 years ago)

Updated #3114 patch for Twisted 12.0 trunk

  • twisted/python/_epoll.pyx

     
    3434        EPOLL_CTL_MOD = 3
    3535
    3636    cdef enum EPOLL_EVENTS:
    37         EPOLLIN = 0x001
    38         EPOLLPRI = 0x002
    39         EPOLLOUT = 0x004
    40         EPOLLRDNORM = 0x040
    41         EPOLLRDBAND = 0x080
    42         EPOLLWRNORM = 0x100
    43         EPOLLWRBAND = 0x200
    44         EPOLLMSG = 0x400
    45         EPOLLERR = 0x008
    46         EPOLLHUP = 0x010
    47         EPOLLET = (1 << 31)
     37        c_EPOLLIN "EPOLLIN" = 0x001
     38        c_EPOLLPRI "EPOLLPRI" = 0x002
     39        c_EPOLLOUT "EPOLLOUT" = 0x004
     40        c_EPOLLRDNORM "EPOLLRDNORM" = 0x040
     41        c_EPOLLRDBAND "EPOLLRDBAND" = 0x080
     42        c_EPOLLWRNORM "EPOLLWRNORM" = 0x100
     43        c_EPOLLWRBAND "EPOLLWRBAND" = 0x200
     44        c_EPOLLMSG "EPOLLMSG" = 0x400
     45        c_EPOLLERR "EPOLLERR" = 0x008
     46        c_EPOLLHUP "EPOLLHUP" = 0x010
     47        c_EPOLLET "EPOLLET" = (1 << 31)
    4848
    4949    ctypedef union epoll_data_t:
    5050        void *ptr
     
    6565    cdef extern PyThreadState *PyEval_SaveThread()
    6666    cdef extern void PyEval_RestoreThread(PyThreadState*)
    6767
     68cdef call_epoll_wait(int fd, unsigned int maxevents, int timeout_msec):
     69    """
     70    Wait for an I/O event, wrap epoll_wait(2).
     71
     72    @type fd: C{int}
     73    @param fd: The epoll file descriptor number.
     74
     75    @type maxevents: C{int}
     76    @param maxevents: Maximum number of events returned.
     77
     78    @type timeout_msec: C{int}
     79    @param timeout_msec: Maximum time in milliseconds waiting for events. 0
     80        makes it return immediately whereas -1 makes it wait indefinitely.
     81
     82    @raise IOError: Raised if the underlying epoll_wait() call fails.
     83    """
     84    cdef epoll_event *events
     85    cdef int result
     86    cdef int nbytes
     87    cdef PyThreadState *_save
     88
     89    nbytes = sizeof(epoll_event) * maxevents
     90    events = <epoll_event*>malloc(nbytes)
     91    memset(events, 0, nbytes)
     92    try:
     93        _save = PyEval_SaveThread()
     94        result = epoll_wait(fd, events, maxevents, timeout_msec)
     95        PyEval_RestoreThread(_save)
     96
     97        if result == -1:
     98            raise IOError(errno, strerror(errno))
     99        results = []
     100        for i from 0 <= i < result:
     101            results.append((events[i].data.fd, <int>events[i].events))
     102        return results
     103    finally:
     104        free(events)
     105
    68106cdef class epoll:
    69107    """
    70108    Represent a set of file descriptors being monitored for events.
     
    73111    cdef int fd
    74112    cdef int initialized
    75113
    76     def __init__(self, int size):
     114    def __init__(self, int size=1023):
     115        """
     116        The constructor arguments are compatible with select.poll.__init__.
     117        """
    77118        self.fd = epoll_create(size)
    78119        if self.fd == -1:
    79120            raise IOError(errno, strerror(errno))
     
    99140        """
    100141        return self.fd
    101142
     143    def register(self, int fd, int events):
     144        """
     145        Add (register) a file descriptor to be monitored by self.
     146
     147        This method is compatible with select.epoll.register in Python 2.6.
     148
     149        Wrap epoll_ctl(2).
     150
     151        @type fd: C{int}
     152        @param fd: File descriptor to modify
     153
     154        @type events: C{int}
     155        @param events: A bit set of IN, OUT, PRI, ERR, HUP, and ET.
     156
     157        @raise IOError: Raised if the underlying epoll_ctl() call fails.
     158        """
     159        cdef int result
     160        cdef epoll_event evt
     161        evt.events = events
     162        evt.data.fd = fd
     163        result = epoll_ctl(self.fd, CTL_ADD, fd, &evt)
     164        if result == -1:
     165            raise IOError(errno, strerror(errno))
     166
     167    def unregister(self, int fd):
     168        """
     169        Remove (unregister) a file descriptor monitored by self.
     170
     171        This method is compatible with select.epoll.unregister in Python 2.6.
     172
     173        Wrap epoll_ctl(2).
     174
     175        @type fd: C{int}
     176        @param fd: File descriptor to modify
     177
     178        @raise IOError: Raised if the underlying epoll_ctl() call fails.
     179        """
     180        cdef int result
     181        cdef epoll_event evt
     182        # We don't have to fill evt.events for CTL_DEL.
     183        evt.data.fd = fd
     184        result = epoll_ctl(self.fd, CTL_DEL, fd, &evt)
     185        if result == -1:
     186            raise IOError(errno, strerror(errno))
     187
     188    def modify(self, int fd, int events):
     189        """
     190        Modify the modified state of a file descriptor monitored by self.
     191
     192        This method is compatible with select.epoll.modify in Python 2.6.
     193
     194        Wrap epoll_ctl(2).
     195
     196        @type fd: C{int}
     197        @param fd: File descriptor to modify
     198
     199        @type events: C{int}
     200        @param events: A bit set of IN, OUT, PRI, ERR, HUP, and ET.
     201
     202        @raise IOError: Raised if the underlying epoll_ctl() call fails.
     203        """
     204        cdef int result
     205        cdef epoll_event evt
     206        evt.events = events
     207        evt.data.fd = fd
     208        result = epoll_ctl(self.fd, CTL_MOD, fd, &evt)
     209        if result == -1:
     210            raise IOError(errno, strerror(errno))
     211
    102212    def _control(self, int op, int fd, int events):
    103213        """
    104214        Modify the monitored state of a particular file descriptor.
     
    132242        @param maxevents: Maximum number of events returned.
    133243
    134244        @type timeout: C{int}
     245        @param timeout: Maximum time in milliseconds waiting for events. 0
     246            makes it return immediately whereas -1 makes it wait indefinitely.
     247       
     248        @raise IOError: Raised if the underlying epoll_wait() call fails.
     249        """
     250        return call_epoll_wait(self.fd, maxevents, timeout)
     251
     252    def poll(self, float timeout=-1, unsigned int maxevents=1024):
     253        """
     254        Wait for an I/O event, wrap epoll_wait(2).
     255
     256        This method is compatible with select.epoll.poll in Python 2.6.
     257
     258        @type maxevents: C{int}
     259        @param maxevents: Maximum number of events returned.
     260
     261        @type timeout: C{int}
    135262        @param timeout: Maximum time waiting for events. 0 makes it return
    136263            immediately whereas -1 makes it wait indefinitely.
    137264       
    138265        @raise IOError: Raised if the underlying epoll_wait() call fails.
    139266        """
    140         cdef epoll_event *events
    141         cdef int result
    142         cdef int nbytes
    143         cdef int fd
    144         cdef PyThreadState *_save
     267        return call_epoll_wait(self.fd, maxevents, <int>(timeout * 1000.0))
    145268
    146         nbytes = sizeof(epoll_event) * maxevents
    147         events = <epoll_event*>malloc(nbytes)
    148         memset(events, 0, nbytes)
    149         try:
    150             fd = self.fd
    151269
    152             _save = PyEval_SaveThread()
    153             result = epoll_wait(fd, events, maxevents, timeout)
    154             PyEval_RestoreThread(_save)
    155 
    156             if result == -1:
    157                 raise IOError(errno, strerror(errno))
    158             results = []
    159             for i from 0 <= i < result:
    160                 results.append((events[i].data.fd, <int>events[i].events))
    161             return results
    162         finally:
    163             free(events)
    164 
    165270CTL_ADD = EPOLL_CTL_ADD
    166271CTL_DEL = EPOLL_CTL_DEL
    167272CTL_MOD = EPOLL_CTL_MOD
    168273
    169 IN = EPOLLIN
    170 OUT = EPOLLOUT
    171 PRI = EPOLLPRI
    172 ERR = EPOLLERR
    173 HUP = EPOLLHUP
    174 ET = EPOLLET
     274IN = EPOLLIN = c_EPOLLIN
     275OUT = EPOLLOUT = c_EPOLLOUT
     276PRI = EPOLLPRI = c_EPOLLPRI
     277ERR = EPOLLERR = c_EPOLLERR
     278HUP = EPOLLHUP = c_EPOLLHUP
     279ET = EPOLLET = c_EPOLLET
    175280
    176 RDNORM = EPOLLRDNORM
    177 RDBAND = EPOLLRDBAND
    178 WRNORM = EPOLLWRNORM
    179 WRBAND = EPOLLWRBAND
    180 MSG = EPOLLMSG
    181 
     281RDNORM = EPOLLRDNORM = c_EPOLLRDNORM
     282RDBAND = EPOLLRDBAND = c_EPOLLRDBAND
     283WRNORM = EPOLLWRNORM = c_EPOLLWRNORM
     284WRBAND = EPOLLWRBAND = c_EPOLLWRBAND
     285MSG = EPOLLMSG = c_EPOLLMSG
  • twisted/python/_epoll.c

     
    1 /* Generated by Cython 0.14.1 on Tue Mar  8 19:42:56 2011 */
     1/* Generated by Cython 0.15.1 on Fri Feb 17 23:33:28 2012 */
    22
    33#define PY_SSIZE_T_CLEAN
    44#include "Python.h"
     
    4646  #define PY_SSIZE_T_MIN INT_MIN
    4747  #define PY_FORMAT_SIZE_T ""
    4848  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
    49   #define PyInt_AsSsize_t(o)   PyInt_AsLong(o)
     49  #define PyInt_AsSsize_t(o)   __Pyx_PyInt_AsInt(o)
    5050  #define PyNumber_Index(o)    PyNumber_Int(o)
    5151  #define PyIndex_Check(o)     PyNumber_Check(o)
    5252  #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
     
    159159  #define PyBoolObject                 PyLongObject
    160160#endif
    161161
     162#if PY_VERSION_HEX < 0x03020000
     163  typedef long Py_hash_t;
     164  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
     165  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
     166#else
     167  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
     168  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
     169#endif
    162170
     171
    163172#if PY_MAJOR_VERSION >= 3
    164173  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
    165174  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
     
    209218  #define __Pyx_DOCSTR(n)  (n)
    210219#endif
    211220
    212 #ifdef __cplusplus
    213 #define __PYX_EXTERN_C extern "C"
    214 #else
    215 #define __PYX_EXTERN_C extern
     221#ifndef __PYX_EXTERN_C
     222  #ifdef __cplusplus
     223    #define __PYX_EXTERN_C extern "C"
     224  #else
     225    #define __PYX_EXTERN_C extern
     226  #endif
    216227#endif
    217228
    218229#if defined(WIN32) || defined(MS_WINDOWS)
    219230#define _USE_MATH_DEFINES
    220231#endif
    221232#include <math.h>
     233#define __PYX_HAVE__twisted__python___epoll
    222234#define __PYX_HAVE_API__twisted__python___epoll
    223235#include "stdio.h"
    224236#include "errno.h"
    225237#include "string.h"
    226238#include "stdint.h"
    227239#include "sys/epoll.h"
     240#ifdef _OPENMP
     241#include <omp.h>
     242#endif /* _OPENMP */
    228243
    229244#ifdef PYREX_WITHOUT_ASSERTIONS
    230245#define CYTHON_WITHOUT_ASSERTIONS
     
    267282#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
    268283#define __Pyx_PyBytes_AsUString(s)   ((unsigned char*) PyBytes_AsString(s))
    269284
     285#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
    270286#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
    271287static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
    272288static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
     
    279295
    280296
    281297#ifdef __GNUC__
    282 /* Test for GCC > 2.95 */
    283 #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
    284 #define likely(x)   __builtin_expect(!!(x), 1)
    285 #define unlikely(x) __builtin_expect(!!(x), 0)
    286 #else /* __GNUC__ > 2 ... */
    287 #define likely(x)   (x)
    288 #define unlikely(x) (x)
    289 #endif /* __GNUC__ > 2 ... */
     298  /* Test for GCC > 2.95 */
     299  #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
     300    #define likely(x)   __builtin_expect(!!(x), 1)
     301    #define unlikely(x) __builtin_expect(!!(x), 0)
     302  #else /* __GNUC__ > 2 ... */
     303    #define likely(x)   (x)
     304    #define unlikely(x) (x)
     305  #endif /* __GNUC__ > 2 ... */
    290306#else /* __GNUC__ */
    291 #define likely(x)   (x)
    292 #define unlikely(x) (x)
     307  #define likely(x)   (x)
     308  #define unlikely(x) (x)
    293309#endif /* __GNUC__ */
    294310   
    295311static PyObject *__pyx_m;
     
    306322  "_epoll.pyx",
    307323};
    308324
    309 /* Type declarations */
     325/*--- Type declarations ---*/
     326struct __pyx_obj_7twisted_6python_6_epoll_epoll;
    310327
    311 /* "twisted/python/_epoll.pyx":68
    312  *     cdef extern void PyEval_RestoreThread(PyThreadState*)
     328/* "twisted/python/_epoll.pyx":106
     329 *         free(events)
    313330 *
    314331 * cdef class epoll:             # <<<<<<<<<<<<<<
    315332 *     """
    316333 *     Represent a set of file descriptors being monitored for events.
    317334 */
    318 
    319335struct __pyx_obj_7twisted_6python_6_epoll_epoll {
    320336  PyObject_HEAD
    321337  int fd;
    322338  int initialized;
    323339};
    324340
     341
    325342#ifndef CYTHON_REFNANNY
    326343  #define CYTHON_REFNANNY 0
    327344#endif
     
    336353    void (*FinishContext)(void**);
    337354  } __Pyx_RefNannyAPIStruct;
    338355  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
    339   static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) {
    340     PyObject *m = NULL, *p = NULL;
    341     void *r = NULL;
    342     m = PyImport_ImportModule((char *)modname);
    343     if (!m) goto end;
    344     p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    345     if (!p) goto end;
    346     r = PyLong_AsVoidPtr(p);
    347   end:
    348     Py_XDECREF(p);
    349     Py_XDECREF(m);
    350     return (__Pyx_RefNannyAPIStruct *)r;
    351   }
    352   #define __Pyx_RefNannySetupContext(name)           void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
     356  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
     357  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
     358  #define __Pyx_RefNannySetupContext(name)           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
    353359  #define __Pyx_RefNannyFinishContext()           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
    354   #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
    355   #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
    356   #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
     360  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
     361  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
     362  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
    357363  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
    358   #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0)
     364  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
     365  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
     366  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
     367  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
    359368#else
     369  #define __Pyx_RefNannyDeclarations
    360370  #define __Pyx_RefNannySetupContext(name)
    361371  #define __Pyx_RefNannyFinishContext()
    362372  #define __Pyx_INCREF(r) Py_INCREF(r)
    363373  #define __Pyx_DECREF(r) Py_DECREF(r)
    364374  #define __Pyx_GOTREF(r)
    365375  #define __Pyx_GIVEREF(r)
     376  #define __Pyx_XINCREF(r) Py_XINCREF(r)
    366377  #define __Pyx_XDECREF(r) Py_XDECREF(r)
     378  #define __Pyx_XGOTREF(r)
     379  #define __Pyx_XGIVEREF(r)
    367380#endif /* CYTHON_REFNANNY */
    368 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0)
    369 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0)
    370381
    371382static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
    372383
     384static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
     385static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
     386
     387static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/
     388
    373389static void __Pyx_RaiseDoubleKeywordsError(
    374390    const char* func_name, PyObject* kw_name); /*proto*/
    375391
     
    378394static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    379395    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
    380396
    381 static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
    382 static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
    383 
    384 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
    385 
    386397static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
    387398
    388399static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
     
    415426
    416427static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
    417428
    418 static void __Pyx_AddTraceback(const char *funcname); /*proto*/
     429static int __Pyx_check_binary_version(void);
    419430
     431static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
     432                               int __pyx_lineno, const char *__pyx_filename); /*proto*/
     433
    420434static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
    421 /* Module declarations from twisted.python._epoll */
    422435
     436/* Module declarations from 'twisted.python._epoll' */
    423437static PyTypeObject *__pyx_ptype_7twisted_6python_6_epoll_epoll = 0;
     438static PyObject *__pyx_f_7twisted_6python_6_epoll_call_epoll_wait(int, unsigned int, int); /*proto*/
    424439#define __Pyx_MODULE_NAME "twisted.python._epoll"
    425 static int __pyx_module_is_main_twisted__python___epoll = 0;
     440int __pyx_module_is_main_twisted__python___epoll = 0;
    426441
    427 /* Implementation of twisted.python._epoll */
     442/* Implementation of 'twisted.python._epoll' */
    428443static PyObject *__pyx_builtin_IOError;
    429444static char __pyx_k_1[] = "\nInterface to epoll I/O event notification facility.\n";
    430445static char __pyx_k__ET[] = "ET";
     
    436451static char __pyx_k__MSG[] = "MSG";
    437452static char __pyx_k__OUT[] = "OUT";
    438453static char __pyx_k__PRI[] = "PRI";
    439 static char __pyx_k__data[] = "data";
    440454static char __pyx_k__size[] = "size";
    441455static char __pyx_k__RDBAND[] = "RDBAND";
    442456static char __pyx_k__RDNORM[] = "RDNORM";
    443457static char __pyx_k__WRBAND[] = "WRBAND";
    444458static char __pyx_k__WRNORM[] = "WRNORM";
    445 static char __pyx_k__append[] = "append";
    446459static char __pyx_k__events[] = "events";
    447460static char __pyx_k__CTL_ADD[] = "CTL_ADD";
    448461static char __pyx_k__CTL_DEL[] = "CTL_DEL";
    449462static char __pyx_k__CTL_MOD[] = "CTL_MOD";
     463static char __pyx_k__EPOLLET[] = "EPOLLET";
     464static char __pyx_k__EPOLLIN[] = "EPOLLIN";
    450465static char __pyx_k__IOError[] = "IOError";
    451466static char __pyx_k__timeout[] = "timeout";
     467static char __pyx_k__EPOLLERR[] = "EPOLLERR";
     468static char __pyx_k__EPOLLHUP[] = "EPOLLHUP";
     469static char __pyx_k__EPOLLMSG[] = "EPOLLMSG";
     470static char __pyx_k__EPOLLOUT[] = "EPOLLOUT";
     471static char __pyx_k__EPOLLPRI[] = "EPOLLPRI";
    452472static char __pyx_k____main__[] = "__main__";
    453473static char __pyx_k____test__[] = "__test__";
    454474static char __pyx_k__maxevents[] = "maxevents";
    455 static char __pyx_k__initialized[] = "initialized";
     475static char __pyx_k__EPOLLRDBAND[] = "EPOLLRDBAND";
     476static char __pyx_k__EPOLLRDNORM[] = "EPOLLRDNORM";
     477static char __pyx_k__EPOLLWRBAND[] = "EPOLLWRBAND";
     478static char __pyx_k__EPOLLWRNORM[] = "EPOLLWRNORM";
    456479static PyObject *__pyx_n_s__CTL_ADD;
    457480static PyObject *__pyx_n_s__CTL_DEL;
    458481static PyObject *__pyx_n_s__CTL_MOD;
     482static PyObject *__pyx_n_s__EPOLLERR;
     483static PyObject *__pyx_n_s__EPOLLET;
     484static PyObject *__pyx_n_s__EPOLLHUP;
     485static PyObject *__pyx_n_s__EPOLLIN;
     486static PyObject *__pyx_n_s__EPOLLMSG;
     487static PyObject *__pyx_n_s__EPOLLOUT;
     488static PyObject *__pyx_n_s__EPOLLPRI;
     489static PyObject *__pyx_n_s__EPOLLRDBAND;
     490static PyObject *__pyx_n_s__EPOLLRDNORM;
     491static PyObject *__pyx_n_s__EPOLLWRBAND;
     492static PyObject *__pyx_n_s__EPOLLWRNORM;
    459493static PyObject *__pyx_n_s__ERR;
    460494static PyObject *__pyx_n_s__ET;
    461495static PyObject *__pyx_n_s__HUP;
     
    470504static PyObject *__pyx_n_s__WRNORM;
    471505static PyObject *__pyx_n_s____main__;
    472506static PyObject *__pyx_n_s____test__;
    473 static PyObject *__pyx_n_s__append;
    474 static PyObject *__pyx_n_s__data;
    475507static PyObject *__pyx_n_s__events;
    476508static PyObject *__pyx_n_s__fd;
    477 static PyObject *__pyx_n_s__initialized;
    478509static PyObject *__pyx_n_s__maxevents;
    479510static PyObject *__pyx_n_s__op;
    480511static PyObject *__pyx_n_s__size;
    481512static PyObject *__pyx_n_s__timeout;
    482513
    483 /* "twisted/python/_epoll.pyx":76
     514/* "twisted/python/_epoll.pyx":68
     515 *     cdef extern void PyEval_RestoreThread(PyThreadState*)
     516 *
     517 * cdef call_epoll_wait(int fd, unsigned int maxevents, int timeout_msec):             # <<<<<<<<<<<<<<
     518 *     """
     519 *     Wait for an I/O event, wrap epoll_wait(2).
     520 */
     521
     522static PyObject *__pyx_f_7twisted_6python_6_epoll_call_epoll_wait(int __pyx_v_fd, unsigned int __pyx_v_maxevents, int __pyx_v_timeout_msec) {
     523  struct epoll_event *__pyx_v_events;
     524  int __pyx_v_result;
     525  int __pyx_v_nbytes;
     526  PyThreadState *__pyx_v__save;
     527  PyObject *__pyx_v_results = NULL;
     528  long __pyx_v_i;
     529  PyObject *__pyx_r = NULL;
     530  __Pyx_RefNannyDeclarations
     531  int __pyx_t_1;
     532  PyObject *__pyx_t_2 = NULL;
     533  PyObject *__pyx_t_3 = NULL;
     534  PyObject *__pyx_t_4 = NULL;
     535  int __pyx_t_5;
     536  int __pyx_t_6;
     537  int __pyx_lineno = 0;
     538  const char *__pyx_filename = NULL;
     539  int __pyx_clineno = 0;
     540  __Pyx_RefNannySetupContext("call_epoll_wait");
     541
     542  /* "twisted/python/_epoll.pyx":89
     543 *     cdef PyThreadState *_save
     544 *
     545 *     nbytes = sizeof(epoll_event) * maxevents             # <<<<<<<<<<<<<<
     546 *     events = <epoll_event*>malloc(nbytes)
     547 *     memset(events, 0, nbytes)
     548 */
     549  __pyx_v_nbytes = ((sizeof(struct epoll_event)) * __pyx_v_maxevents);
     550
     551  /* "twisted/python/_epoll.pyx":90
     552 *
     553 *     nbytes = sizeof(epoll_event) * maxevents
     554 *     events = <epoll_event*>malloc(nbytes)             # <<<<<<<<<<<<<<
     555 *     memset(events, 0, nbytes)
     556 *     try:
     557 */
     558  __pyx_v_events = ((struct epoll_event *)malloc(__pyx_v_nbytes));
     559
     560  /* "twisted/python/_epoll.pyx":91
     561 *     nbytes = sizeof(epoll_event) * maxevents
     562 *     events = <epoll_event*>malloc(nbytes)
     563 *     memset(events, 0, nbytes)             # <<<<<<<<<<<<<<
     564 *     try:
     565 *         _save = PyEval_SaveThread()
     566 */
     567  memset(__pyx_v_events, 0, __pyx_v_nbytes);
     568
     569  /* "twisted/python/_epoll.pyx":92
     570 *     events = <epoll_event*>malloc(nbytes)
     571 *     memset(events, 0, nbytes)
     572 *     try:             # <<<<<<<<<<<<<<
     573 *         _save = PyEval_SaveThread()
     574 *         result = epoll_wait(fd, events, maxevents, timeout_msec)
     575 */
     576  /*try:*/ {
     577
     578    /* "twisted/python/_epoll.pyx":93
     579 *     memset(events, 0, nbytes)
     580 *     try:
     581 *         _save = PyEval_SaveThread()             # <<<<<<<<<<<<<<
     582 *         result = epoll_wait(fd, events, maxevents, timeout_msec)
     583 *         PyEval_RestoreThread(_save)
     584 */
     585    __pyx_v__save = PyEval_SaveThread();
     586
     587    /* "twisted/python/_epoll.pyx":94
     588 *     try:
     589 *         _save = PyEval_SaveThread()
     590 *         result = epoll_wait(fd, events, maxevents, timeout_msec)             # <<<<<<<<<<<<<<
     591 *         PyEval_RestoreThread(_save)
     592 *
     593 */
     594    __pyx_v_result = epoll_wait(__pyx_v_fd, __pyx_v_events, __pyx_v_maxevents, __pyx_v_timeout_msec);
     595
     596    /* "twisted/python/_epoll.pyx":95
     597 *         _save = PyEval_SaveThread()
     598 *         result = epoll_wait(fd, events, maxevents, timeout_msec)
     599 *         PyEval_RestoreThread(_save)             # <<<<<<<<<<<<<<
     600 *
     601 *         if result == -1:
     602 */
     603    PyEval_RestoreThread(__pyx_v__save);
     604
     605    /* "twisted/python/_epoll.pyx":97
     606 *         PyEval_RestoreThread(_save)
     607 *
     608 *         if result == -1:             # <<<<<<<<<<<<<<
     609 *             raise IOError(errno, strerror(errno))
     610 *         results = []
     611 */
     612    __pyx_t_1 = (__pyx_v_result == -1);
     613    if (__pyx_t_1) {
     614
     615      /* "twisted/python/_epoll.pyx":98
     616 *
     617 *         if result == -1:
     618 *             raise IOError(errno, strerror(errno))             # <<<<<<<<<<<<<<
     619 *         results = []
     620 *         for i from 0 <= i < result:
     621 */
     622      __pyx_t_2 = PyInt_FromLong(errno); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L4;}
     623      __Pyx_GOTREF(__pyx_t_2);
     624      __pyx_t_3 = PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L4;}
     625      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     626      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L4;}
     627      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
     628      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
     629      __Pyx_GIVEREF(__pyx_t_2);
     630      PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_t_3));
     631      __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
     632      __pyx_t_2 = 0;
     633      __pyx_t_3 = 0;
     634      __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L4;}
     635      __Pyx_GOTREF(__pyx_t_3);
     636      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
     637      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
     638      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     639      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L4;}
     640      goto __pyx_L6;
     641    }
     642    __pyx_L6:;
     643
     644    /* "twisted/python/_epoll.pyx":99
     645 *         if result == -1:
     646 *             raise IOError(errno, strerror(errno))
     647 *         results = []             # <<<<<<<<<<<<<<
     648 *         for i from 0 <= i < result:
     649 *             results.append((events[i].data.fd, <int>events[i].events))
     650 */
     651    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L4;}
     652    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     653    __pyx_v_results = __pyx_t_3;
     654    __pyx_t_3 = 0;
     655
     656    /* "twisted/python/_epoll.pyx":100
     657 *             raise IOError(errno, strerror(errno))
     658 *         results = []
     659 *         for i from 0 <= i < result:             # <<<<<<<<<<<<<<
     660 *             results.append((events[i].data.fd, <int>events[i].events))
     661 *         return results
     662 */
     663    __pyx_t_5 = __pyx_v_result;
     664    for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {
     665
     666      /* "twisted/python/_epoll.pyx":101
     667 *         results = []
     668 *         for i from 0 <= i < result:
     669 *             results.append((events[i].data.fd, <int>events[i].events))             # <<<<<<<<<<<<<<
     670 *         return results
     671 *     finally:
     672 */
     673      if (unlikely(((PyObject *)__pyx_v_results) == Py_None)) {
     674        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L4;}
     675      }
     676      __pyx_t_3 = PyInt_FromLong((__pyx_v_events[__pyx_v_i]).data.fd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L4;}
     677      __Pyx_GOTREF(__pyx_t_3);
     678      __pyx_t_4 = PyInt_FromLong(((int)(__pyx_v_events[__pyx_v_i]).events)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L4;}
     679      __Pyx_GOTREF(__pyx_t_4);
     680      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L4;}
     681      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     682      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
     683      __Pyx_GIVEREF(__pyx_t_3);
     684      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
     685      __Pyx_GIVEREF(__pyx_t_4);
     686      __pyx_t_3 = 0;
     687      __pyx_t_4 = 0;
     688      __pyx_t_6 = PyList_Append(__pyx_v_results, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L4;}
     689      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
     690    }
     691
     692    /* "twisted/python/_epoll.pyx":102
     693 *         for i from 0 <= i < result:
     694 *             results.append((events[i].data.fd, <int>events[i].events))
     695 *         return results             # <<<<<<<<<<<<<<
     696 *     finally:
     697 *         free(events)
     698 */
     699    __Pyx_XDECREF(__pyx_r);
     700    __Pyx_INCREF(((PyObject *)__pyx_v_results));
     701    __pyx_r = ((PyObject *)__pyx_v_results);
     702    goto __pyx_L3;
     703  }
     704
     705  /* "twisted/python/_epoll.pyx":104
     706 *         return results
     707 *     finally:
     708 *         free(events)             # <<<<<<<<<<<<<<
     709 *
     710 * cdef class epoll:
     711 */
     712  /*finally:*/ {
     713    int __pyx_why;
     714    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
     715    int __pyx_exc_lineno;
     716    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
     717    __pyx_why = 0; goto __pyx_L5;
     718    __pyx_L3: __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
     719    __pyx_why = 3; goto __pyx_L5;
     720    __pyx_L4: {
     721      __pyx_why = 4;
     722      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
     723      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
     724      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
     725      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
     726      __pyx_exc_lineno = __pyx_lineno;
     727      goto __pyx_L5;
     728    }
     729    __pyx_L5:;
     730    free(__pyx_v_events);
     731    switch (__pyx_why) {
     732      case 3: goto __pyx_L0;
     733      case 4: {
     734        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
     735        __pyx_lineno = __pyx_exc_lineno;
     736        __pyx_exc_type = 0;
     737        __pyx_exc_value = 0;
     738        __pyx_exc_tb = 0;
     739        goto __pyx_L1_error;
     740      }
     741    }
     742  }
     743
     744  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
     745  goto __pyx_L0;
     746  __pyx_L1_error:;
     747  __Pyx_XDECREF(__pyx_t_2);
     748  __Pyx_XDECREF(__pyx_t_3);
     749  __Pyx_XDECREF(__pyx_t_4);
     750  __Pyx_AddTraceback("twisted.python._epoll.call_epoll_wait", __pyx_clineno, __pyx_lineno, __pyx_filename);
     751  __pyx_r = 0;
     752  __pyx_L0:;
     753  __Pyx_XDECREF(__pyx_v_results);
     754  __Pyx_XGIVEREF(__pyx_r);
     755  __Pyx_RefNannyFinishContext();
     756  return __pyx_r;
     757}
     758
     759/* "twisted/python/_epoll.pyx":114
    484760 *     cdef int initialized
    485761 *
    486  *     def __init__(self, int size):             # <<<<<<<<<<<<<<
    487  *         self.fd = epoll_create(size)
    488  *         if self.fd == -1:
     762 *     def __init__(self, int size=1023):             # <<<<<<<<<<<<<<
     763 *         """
     764 *         The constructor arguments are compatible with select.poll.__init__.
    489765 */
    490766
    491767static int __pyx_pf_7twisted_6python_6_epoll_5epoll___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
     768static char __pyx_doc_7twisted_6python_6_epoll_5epoll___init__[] = "\n        The constructor arguments are compatible with select.poll.__init__.\n        ";
     769struct wrapperbase __pyx_wrapperbase_7twisted_6python_6_epoll_5epoll___init__;
    492770static int __pyx_pf_7twisted_6python_6_epoll_5epoll___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
    493771  int __pyx_v_size;
    494772  int __pyx_r;
     773  __Pyx_RefNannyDeclarations
    495774  int __pyx_t_1;
    496775  PyObject *__pyx_t_2 = NULL;
    497776  PyObject *__pyx_t_3 = NULL;
    498777  PyObject *__pyx_t_4 = NULL;
     778  int __pyx_lineno = 0;
     779  const char *__pyx_filename = NULL;
     780  int __pyx_clineno = 0;
    499781  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,0};
    500782  __Pyx_RefNannySetupContext("__init__");
    501   if (unlikely(__pyx_kwds)) {
    502     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
     783  {
    503784    PyObject* values[1] = {0};
    504     switch (PyTuple_GET_SIZE(__pyx_args)) {
    505       case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    506       case  0: break;
    507       default: goto __pyx_L5_argtuple_error;
     785    if (unlikely(__pyx_kwds)) {
     786      Py_ssize_t kw_args;
     787      switch (PyTuple_GET_SIZE(__pyx_args)) {
     788        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
     789        case  0: break;
     790        default: goto __pyx_L5_argtuple_error;
     791      }
     792      kw_args = PyDict_Size(__pyx_kwds);
     793      switch (PyTuple_GET_SIZE(__pyx_args)) {
     794        case  0:
     795        if (kw_args > 0) {
     796          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
     797          if (value) { values[0] = value; kw_args--; }
     798        }
     799      }
     800      if (unlikely(kw_args > 0)) {
     801        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     802      }
     803    } else {
     804      switch (PyTuple_GET_SIZE(__pyx_args)) {
     805        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
     806        case  0: break;
     807        default: goto __pyx_L5_argtuple_error;
     808      }
    508809    }
    509     switch (PyTuple_GET_SIZE(__pyx_args)) {
    510       case  0:
    511       values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
    512       if (likely(values[0])) kw_args--;
    513       else goto __pyx_L5_argtuple_error;
     810    if (values[0]) {
     811      __pyx_v_size = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     812    } else {
     813      __pyx_v_size = ((int)1023);
    514814    }
    515     if (unlikely(kw_args > 0)) {
    516       if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    517     }
    518     __pyx_v_size = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    519   } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    520     goto __pyx_L5_argtuple_error;
    521   } else {
    522     __pyx_v_size = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    523815  }
    524816  goto __pyx_L4_argument_unpacking_done;
    525817  __pyx_L5_argtuple_error:;
    526   __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     818  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    527819  __pyx_L3_error:;
    528   __Pyx_AddTraceback("twisted.python._epoll.epoll.__init__");
     820  __Pyx_AddTraceback("twisted.python._epoll.epoll.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
    529821  __Pyx_RefNannyFinishContext();
    530822  return -1;
    531823  __pyx_L4_argument_unpacking_done:;
    532824
    533   /* "twisted/python/_epoll.pyx":77
    534  *
    535  *     def __init__(self, int size):
     825  /* "twisted/python/_epoll.pyx":118
     826 *         The constructor arguments are compatible with select.poll.__init__.
     827 *         """
    536828 *         self.fd = epoll_create(size)             # <<<<<<<<<<<<<<
    537829 *         if self.fd == -1:
    538830 *             raise IOError(errno, strerror(errno))
    539831 */
    540832  ((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd = epoll_create(__pyx_v_size);
    541833
    542   /* "twisted/python/_epoll.pyx":78
    543  *     def __init__(self, int size):
     834  /* "twisted/python/_epoll.pyx":119
     835 *         """
    544836 *         self.fd = epoll_create(size)
    545837 *         if self.fd == -1:             # <<<<<<<<<<<<<<
    546838 *             raise IOError(errno, strerror(errno))
     
    549841  __pyx_t_1 = (((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd == -1);
    550842  if (__pyx_t_1) {
    551843
    552     /* "twisted/python/_epoll.pyx":79
     844    /* "twisted/python/_epoll.pyx":120
    553845 *         self.fd = epoll_create(size)
    554846 *         if self.fd == -1:
    555847 *             raise IOError(errno, strerror(errno))             # <<<<<<<<<<<<<<
    556848 *         self.initialized = 1
    557849 *
    558850 */
    559     __pyx_t_2 = PyInt_FromLong(errno); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     851    __pyx_t_2 = PyInt_FromLong(errno); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    560852    __Pyx_GOTREF(__pyx_t_2);
    561     __pyx_t_3 = PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     853    __pyx_t_3 = PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    562854    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    563     __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     855    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    564856    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    565857    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    566858    __Pyx_GIVEREF(__pyx_t_2);
     
    568860    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
    569861    __pyx_t_2 = 0;
    570862    __pyx_t_3 = 0;
    571     __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     863    __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    572864    __Pyx_GOTREF(__pyx_t_3);
    573865    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    574     __Pyx_Raise(__pyx_t_3, 0, 0);
     866    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    575867    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    576     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     868    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    577869    goto __pyx_L6;
    578870  }
    579871  __pyx_L6:;
    580872
    581   /* "twisted/python/_epoll.pyx":80
     873  /* "twisted/python/_epoll.pyx":121
    582874 *         if self.fd == -1:
    583875 *             raise IOError(errno, strerror(errno))
    584876 *         self.initialized = 1             # <<<<<<<<<<<<<<
     
    593885  __Pyx_XDECREF(__pyx_t_2);
    594886  __Pyx_XDECREF(__pyx_t_3);
    595887  __Pyx_XDECREF(__pyx_t_4);
    596   __Pyx_AddTraceback("twisted.python._epoll.epoll.__init__");
     888  __Pyx_AddTraceback("twisted.python._epoll.epoll.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
    597889  __pyx_r = -1;
    598890  __pyx_L0:;
    599891  __Pyx_RefNannyFinishContext();
    600892  return __pyx_r;
    601893}
    602894
    603 /* "twisted/python/_epoll.pyx":82
     895/* "twisted/python/_epoll.pyx":123
    604896 *         self.initialized = 1
    605897 *
    606898 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
     
    610902
    611903static void __pyx_pf_7twisted_6python_6_epoll_5epoll_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
    612904static void __pyx_pf_7twisted_6python_6_epoll_5epoll_1__dealloc__(PyObject *__pyx_v_self) {
     905  __Pyx_RefNannyDeclarations
    613906  __Pyx_RefNannySetupContext("__dealloc__");
    614907
    615   /* "twisted/python/_epoll.pyx":83
     908  /* "twisted/python/_epoll.pyx":124
    616909 *
    617910 *     def __dealloc__(self):
    618911 *         if self.initialized:             # <<<<<<<<<<<<<<
     
    621914 */
    622915  if (((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->initialized) {
    623916
    624     /* "twisted/python/_epoll.pyx":84
     917    /* "twisted/python/_epoll.pyx":125
    625918 *     def __dealloc__(self):
    626919 *         if self.initialized:
    627920 *             close(self.fd)             # <<<<<<<<<<<<<<
     
    630923 */
    631924    close(((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd);
    632925
    633     /* "twisted/python/_epoll.pyx":85
     926    /* "twisted/python/_epoll.pyx":126
    634927 *         if self.initialized:
    635928 *             close(self.fd)
    636929 *             self.initialized = 0             # <<<<<<<<<<<<<<
     
    645938  __Pyx_RefNannyFinishContext();
    646939}
    647940
    648 /* "twisted/python/_epoll.pyx":87
     941/* "twisted/python/_epoll.pyx":128
    649942 *             self.initialized = 0
    650943 *
    651944 *     def close(self):             # <<<<<<<<<<<<<<
     
    657950static char __pyx_doc_7twisted_6python_6_epoll_5epoll_2close[] = "\n        Close the epoll file descriptor.\n        ";
    658951static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_2close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
    659952  PyObject *__pyx_r = NULL;
     953  __Pyx_RefNannyDeclarations
    660954  int __pyx_t_1;
    661955  PyObject *__pyx_t_2 = NULL;
    662956  PyObject *__pyx_t_3 = NULL;
    663957  PyObject *__pyx_t_4 = NULL;
     958  int __pyx_lineno = 0;
     959  const char *__pyx_filename = NULL;
     960  int __pyx_clineno = 0;
    664961  __Pyx_RefNannySetupContext("close");
    665962
    666   /* "twisted/python/_epoll.pyx":91
     963  /* "twisted/python/_epoll.pyx":132
    667964 *         Close the epoll file descriptor.
    668965 *         """
    669966 *         if self.initialized:             # <<<<<<<<<<<<<<
     
    672969 */
    673970  if (((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->initialized) {
    674971
    675     /* "twisted/python/_epoll.pyx":92
     972    /* "twisted/python/_epoll.pyx":133
    676973 *         """
    677974 *         if self.initialized:
    678975 *             if close(self.fd) == -1:             # <<<<<<<<<<<<<<
     
    682979    __pyx_t_1 = (close(((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd) == -1);
    683980    if (__pyx_t_1) {
    684981
    685       /* "twisted/python/_epoll.pyx":93
     982      /* "twisted/python/_epoll.pyx":134
    686983 *         if self.initialized:
    687984 *             if close(self.fd) == -1:
    688985 *                 raise IOError(errno, strerror(errno))             # <<<<<<<<<<<<<<
    689986 *             self.initialized = 0
    690987 *
    691988 */
    692       __pyx_t_2 = PyInt_FromLong(errno); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     989      __pyx_t_2 = PyInt_FromLong(errno); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    693990      __Pyx_GOTREF(__pyx_t_2);
    694       __pyx_t_3 = PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     991      __pyx_t_3 = PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    695992      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    696       __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     993      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    697994      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    698995      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    699996      __Pyx_GIVEREF(__pyx_t_2);
     
    701998      __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
    702999      __pyx_t_2 = 0;
    7031000      __pyx_t_3 = 0;
    704       __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1001      __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    7051002      __Pyx_GOTREF(__pyx_t_3);
    7061003      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    707       __Pyx_Raise(__pyx_t_3, 0, 0);
     1004      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    7081005      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    709       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1006      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    7101007      goto __pyx_L6;
    7111008    }
    7121009    __pyx_L6:;
    7131010
    714     /* "twisted/python/_epoll.pyx":94
     1011    /* "twisted/python/_epoll.pyx":135
    7151012 *             if close(self.fd) == -1:
    7161013 *                 raise IOError(errno, strerror(errno))
    7171014 *             self.initialized = 0             # <<<<<<<<<<<<<<
     
    7291026  __Pyx_XDECREF(__pyx_t_2);
    7301027  __Pyx_XDECREF(__pyx_t_3);
    7311028  __Pyx_XDECREF(__pyx_t_4);
    732   __Pyx_AddTraceback("twisted.python._epoll.epoll.close");
     1029  __Pyx_AddTraceback("twisted.python._epoll.epoll.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
    7331030  __pyx_r = NULL;
    7341031  __pyx_L0:;
    7351032  __Pyx_XGIVEREF(__pyx_r);
     
    7371034  return __pyx_r;
    7381035}
    7391036
    740 /* "twisted/python/_epoll.pyx":96
     1037/* "twisted/python/_epoll.pyx":137
    7411038 *             self.initialized = 0
    7421039 *
    7431040 *     def fileno(self):             # <<<<<<<<<<<<<<
     
    7491046static char __pyx_doc_7twisted_6python_6_epoll_5epoll_3fileno[] = "\n        Return the epoll file descriptor number.\n        ";
    7501047static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_3fileno(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
    7511048  PyObject *__pyx_r = NULL;
     1049  __Pyx_RefNannyDeclarations
    7521050  PyObject *__pyx_t_1 = NULL;
     1051  int __pyx_lineno = 0;
     1052  const char *__pyx_filename = NULL;
     1053  int __pyx_clineno = 0;
    7531054  __Pyx_RefNannySetupContext("fileno");
    7541055
    755   /* "twisted/python/_epoll.pyx":100
     1056  /* "twisted/python/_epoll.pyx":141
    7561057 *         Return the epoll file descriptor number.
    7571058 *         """
    7581059 *         return self.fd             # <<<<<<<<<<<<<<
    7591060 *
    760  *     def _control(self, int op, int fd, int events):
     1061 *     def register(self, int fd, int events):
    7611062 */
    7621063  __Pyx_XDECREF(__pyx_r);
    763   __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1064  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    7641065  __Pyx_GOTREF(__pyx_t_1);
    7651066  __pyx_r = __pyx_t_1;
    7661067  __pyx_t_1 = 0;
     
    7701071  goto __pyx_L0;
    7711072  __pyx_L1_error:;
    7721073  __Pyx_XDECREF(__pyx_t_1);
    773   __Pyx_AddTraceback("twisted.python._epoll.epoll.fileno");
     1074  __Pyx_AddTraceback("twisted.python._epoll.epoll.fileno", __pyx_clineno, __pyx_lineno, __pyx_filename);
    7741075  __pyx_r = NULL;
    7751076  __pyx_L0:;
    7761077  __Pyx_XGIVEREF(__pyx_r);
     
    7781079  return __pyx_r;
    7791080}
    7801081
    781 /* "twisted/python/_epoll.pyx":102
     1082/* "twisted/python/_epoll.pyx":143
    7821083 *         return self.fd
    7831084 *
     1085 *     def register(self, int fd, int events):             # <<<<<<<<<<<<<<
     1086 *         """
     1087 *         Add (register) a file descriptor to be monitored by self.
     1088 */
     1089
     1090static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_4register(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
     1091static char __pyx_doc_7twisted_6python_6_epoll_5epoll_4register[] = "\n        Add (register) a file descriptor to be monitored by self.\n\n        This method is compatible with select.epoll.register in Python 2.6.\n\n        Wrap epoll_ctl(2).\n\n        @type fd: C{int}\n        @param fd: File descriptor to modify\n\n        @type events: C{int}\n        @param events: A bit set of IN, OUT, PRI, ERR, HUP, and ET.\n\n        @raise IOError: Raised if the underlying epoll_ctl() call fails.\n        ";
     1092static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_4register(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
     1093  int __pyx_v_fd;
     1094  int __pyx_v_events;
     1095  int __pyx_v_result;
     1096  struct epoll_event __pyx_v_evt;
     1097  PyObject *__pyx_r = NULL;
     1098  __Pyx_RefNannyDeclarations
     1099  PyObject *__pyx_t_1 = NULL;
     1100  int __pyx_t_2;
     1101  int __pyx_t_3;
     1102  PyObject *__pyx_t_4 = NULL;
     1103  PyObject *__pyx_t_5 = NULL;
     1104  int __pyx_lineno = 0;
     1105  const char *__pyx_filename = NULL;
     1106  int __pyx_clineno = 0;
     1107  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fd,&__pyx_n_s__events,0};
     1108  __Pyx_RefNannySetupContext("register");
     1109  {
     1110    PyObject* values[2] = {0,0};
     1111    if (unlikely(__pyx_kwds)) {
     1112      Py_ssize_t kw_args;
     1113      switch (PyTuple_GET_SIZE(__pyx_args)) {
     1114        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
     1115        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
     1116        case  0: break;
     1117        default: goto __pyx_L5_argtuple_error;
     1118      }
     1119      kw_args = PyDict_Size(__pyx_kwds);
     1120      switch (PyTuple_GET_SIZE(__pyx_args)) {
     1121        case  0:
     1122        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fd);
     1123        if (likely(values[0])) kw_args--;
     1124        else goto __pyx_L5_argtuple_error;
     1125        case  1:
     1126        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__events);
     1127        if (likely(values[1])) kw_args--;
     1128        else {
     1129          __Pyx_RaiseArgtupleInvalid("register", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     1130        }
     1131      }
     1132      if (unlikely(kw_args > 0)) {
     1133        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "register") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     1134      }
     1135    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
     1136      goto __pyx_L5_argtuple_error;
     1137    } else {
     1138      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
     1139      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
     1140    }
     1141    __pyx_v_fd = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_fd == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     1142    __pyx_v_events = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_events == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     1143  }
     1144  goto __pyx_L4_argument_unpacking_done;
     1145  __pyx_L5_argtuple_error:;
     1146  __Pyx_RaiseArgtupleInvalid("register", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     1147  __pyx_L3_error:;
     1148  __Pyx_AddTraceback("twisted.python._epoll.epoll.register", __pyx_clineno, __pyx_lineno, __pyx_filename);
     1149  __Pyx_RefNannyFinishContext();
     1150  return NULL;
     1151  __pyx_L4_argument_unpacking_done:;
     1152
     1153  /* "twisted/python/_epoll.pyx":161
     1154 *         cdef int result
     1155 *         cdef epoll_event evt
     1156 *         evt.events = events             # <<<<<<<<<<<<<<
     1157 *         evt.data.fd = fd
     1158 *         result = epoll_ctl(self.fd, CTL_ADD, fd, &evt)
     1159 */
     1160  __pyx_v_evt.events = __pyx_v_events;
     1161
     1162  /* "twisted/python/_epoll.pyx":162
     1163 *         cdef epoll_event evt
     1164 *         evt.events = events
     1165 *         evt.data.fd = fd             # <<<<<<<<<<<<<<
     1166 *         result = epoll_ctl(self.fd, CTL_ADD, fd, &evt)
     1167 *         if result == -1:
     1168 */
     1169  __pyx_v_evt.data.fd = __pyx_v_fd;
     1170
     1171  /* "twisted/python/_epoll.pyx":163
     1172 *         evt.events = events
     1173 *         evt.data.fd = fd
     1174 *         result = epoll_ctl(self.fd, CTL_ADD, fd, &evt)             # <<<<<<<<<<<<<<
     1175 *         if result == -1:
     1176 *             raise IOError(errno, strerror(errno))
     1177 */
     1178  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__CTL_ADD); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1179  __Pyx_GOTREF(__pyx_t_1);
     1180  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1181  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     1182  __pyx_v_result = epoll_ctl(((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd, __pyx_t_2, __pyx_v_fd, (&__pyx_v_evt));
     1183
     1184  /* "twisted/python/_epoll.pyx":164
     1185 *         evt.data.fd = fd
     1186 *         result = epoll_ctl(self.fd, CTL_ADD, fd, &evt)
     1187 *         if result == -1:             # <<<<<<<<<<<<<<
     1188 *             raise IOError(errno, strerror(errno))
     1189 *
     1190 */
     1191  __pyx_t_3 = (__pyx_v_result == -1);
     1192  if (__pyx_t_3) {
     1193
     1194    /* "twisted/python/_epoll.pyx":165
     1195 *         result = epoll_ctl(self.fd, CTL_ADD, fd, &evt)
     1196 *         if result == -1:
     1197 *             raise IOError(errno, strerror(errno))             # <<<<<<<<<<<<<<
     1198 *
     1199 *     def unregister(self, int fd):
     1200 */
     1201    __pyx_t_1 = PyInt_FromLong(errno); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1202    __Pyx_GOTREF(__pyx_t_1);
     1203    __pyx_t_4 = PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1204    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
     1205    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1206    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     1207    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
     1208    __Pyx_GIVEREF(__pyx_t_1);
     1209    PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_t_4));
     1210    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
     1211    __pyx_t_1 = 0;
     1212    __pyx_t_4 = 0;
     1213    __pyx_t_4 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1214    __Pyx_GOTREF(__pyx_t_4);
     1215    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
     1216    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
     1217    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     1218    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1219    goto __pyx_L6;
     1220  }
     1221  __pyx_L6:;
     1222
     1223  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
     1224  goto __pyx_L0;
     1225  __pyx_L1_error:;
     1226  __Pyx_XDECREF(__pyx_t_1);
     1227  __Pyx_XDECREF(__pyx_t_4);
     1228  __Pyx_XDECREF(__pyx_t_5);
     1229  __Pyx_AddTraceback("twisted.python._epoll.epoll.register", __pyx_clineno, __pyx_lineno, __pyx_filename);
     1230  __pyx_r = NULL;
     1231  __pyx_L0:;
     1232  __Pyx_XGIVEREF(__pyx_r);
     1233  __Pyx_RefNannyFinishContext();
     1234  return __pyx_r;
     1235}
     1236
     1237/* "twisted/python/_epoll.pyx":167
     1238 *             raise IOError(errno, strerror(errno))
     1239 *
     1240 *     def unregister(self, int fd):             # <<<<<<<<<<<<<<
     1241 *         """
     1242 *         Remove (unregister) a file descriptor monitored by self.
     1243 */
     1244
     1245static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_5unregister(PyObject *__pyx_v_self, PyObject *__pyx_arg_fd); /*proto*/
     1246static char __pyx_doc_7twisted_6python_6_epoll_5epoll_5unregister[] = "\n        Remove (unregister) a file descriptor monitored by self.\n\n        This method is compatible with select.epoll.unregister in Python 2.6.\n\n        Wrap epoll_ctl(2).\n\n        @type fd: C{int}\n        @param fd: File descriptor to modify\n\n        @raise IOError: Raised if the underlying epoll_ctl() call fails.\n        ";
     1247static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_5unregister(PyObject *__pyx_v_self, PyObject *__pyx_arg_fd) {
     1248  int __pyx_v_fd;
     1249  int __pyx_v_result;
     1250  struct epoll_event __pyx_v_evt;
     1251  PyObject *__pyx_r = NULL;
     1252  __Pyx_RefNannyDeclarations
     1253  PyObject *__pyx_t_1 = NULL;
     1254  int __pyx_t_2;
     1255  int __pyx_t_3;
     1256  PyObject *__pyx_t_4 = NULL;
     1257  PyObject *__pyx_t_5 = NULL;
     1258  int __pyx_lineno = 0;
     1259  const char *__pyx_filename = NULL;
     1260  int __pyx_clineno = 0;
     1261  __Pyx_RefNannySetupContext("unregister");
     1262  assert(__pyx_arg_fd); {
     1263    __pyx_v_fd = __Pyx_PyInt_AsInt(__pyx_arg_fd); if (unlikely((__pyx_v_fd == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     1264  }
     1265  goto __pyx_L4_argument_unpacking_done;
     1266  __pyx_L3_error:;
     1267  __Pyx_AddTraceback("twisted.python._epoll.epoll.unregister", __pyx_clineno, __pyx_lineno, __pyx_filename);
     1268  __Pyx_RefNannyFinishContext();
     1269  return NULL;
     1270  __pyx_L4_argument_unpacking_done:;
     1271
     1272  /* "twisted/python/_epoll.pyx":183
     1273 *         cdef epoll_event evt
     1274 *         # We don't have to fill evt.events for CTL_DEL.
     1275 *         evt.data.fd = fd             # <<<<<<<<<<<<<<
     1276 *         result = epoll_ctl(self.fd, CTL_DEL, fd, &evt)
     1277 *         if result == -1:
     1278 */
     1279  __pyx_v_evt.data.fd = __pyx_v_fd;
     1280
     1281  /* "twisted/python/_epoll.pyx":184
     1282 *         # We don't have to fill evt.events for CTL_DEL.
     1283 *         evt.data.fd = fd
     1284 *         result = epoll_ctl(self.fd, CTL_DEL, fd, &evt)             # <<<<<<<<<<<<<<
     1285 *         if result == -1:
     1286 *             raise IOError(errno, strerror(errno))
     1287 */
     1288  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__CTL_DEL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1289  __Pyx_GOTREF(__pyx_t_1);
     1290  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1291  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     1292  __pyx_v_result = epoll_ctl(((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd, __pyx_t_2, __pyx_v_fd, (&__pyx_v_evt));
     1293
     1294  /* "twisted/python/_epoll.pyx":185
     1295 *         evt.data.fd = fd
     1296 *         result = epoll_ctl(self.fd, CTL_DEL, fd, &evt)
     1297 *         if result == -1:             # <<<<<<<<<<<<<<
     1298 *             raise IOError(errno, strerror(errno))
     1299 *
     1300 */
     1301  __pyx_t_3 = (__pyx_v_result == -1);
     1302  if (__pyx_t_3) {
     1303
     1304    /* "twisted/python/_epoll.pyx":186
     1305 *         result = epoll_ctl(self.fd, CTL_DEL, fd, &evt)
     1306 *         if result == -1:
     1307 *             raise IOError(errno, strerror(errno))             # <<<<<<<<<<<<<<
     1308 *
     1309 *     def modify(self, int fd, int events):
     1310 */
     1311    __pyx_t_1 = PyInt_FromLong(errno); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1312    __Pyx_GOTREF(__pyx_t_1);
     1313    __pyx_t_4 = PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1314    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
     1315    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1316    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     1317    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
     1318    __Pyx_GIVEREF(__pyx_t_1);
     1319    PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_t_4));
     1320    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
     1321    __pyx_t_1 = 0;
     1322    __pyx_t_4 = 0;
     1323    __pyx_t_4 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1324    __Pyx_GOTREF(__pyx_t_4);
     1325    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
     1326    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
     1327    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     1328    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1329    goto __pyx_L5;
     1330  }
     1331  __pyx_L5:;
     1332
     1333  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
     1334  goto __pyx_L0;
     1335  __pyx_L1_error:;
     1336  __Pyx_XDECREF(__pyx_t_1);
     1337  __Pyx_XDECREF(__pyx_t_4);
     1338  __Pyx_XDECREF(__pyx_t_5);
     1339  __Pyx_AddTraceback("twisted.python._epoll.epoll.unregister", __pyx_clineno, __pyx_lineno, __pyx_filename);
     1340  __pyx_r = NULL;
     1341  __pyx_L0:;
     1342  __Pyx_XGIVEREF(__pyx_r);
     1343  __Pyx_RefNannyFinishContext();
     1344  return __pyx_r;
     1345}
     1346
     1347/* "twisted/python/_epoll.pyx":188
     1348 *             raise IOError(errno, strerror(errno))
     1349 *
     1350 *     def modify(self, int fd, int events):             # <<<<<<<<<<<<<<
     1351 *         """
     1352 *         Modify the modified state of a file descriptor monitored by self.
     1353 */
     1354
     1355static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_6modify(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
     1356static char __pyx_doc_7twisted_6python_6_epoll_5epoll_6modify[] = "\n        Modify the modified state of a file descriptor monitored by self.\n\n        This method is compatible with select.epoll.modify in Python 2.6.\n\n        Wrap epoll_ctl(2).\n\n        @type fd: C{int}\n        @param fd: File descriptor to modify\n\n        @type events: C{int}\n        @param events: A bit set of IN, OUT, PRI, ERR, HUP, and ET.\n\n        @raise IOError: Raised if the underlying epoll_ctl() call fails.\n        ";
     1357static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_6modify(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
     1358  int __pyx_v_fd;
     1359  int __pyx_v_events;
     1360  int __pyx_v_result;
     1361  struct epoll_event __pyx_v_evt;
     1362  PyObject *__pyx_r = NULL;
     1363  __Pyx_RefNannyDeclarations
     1364  PyObject *__pyx_t_1 = NULL;
     1365  int __pyx_t_2;
     1366  int __pyx_t_3;
     1367  PyObject *__pyx_t_4 = NULL;
     1368  PyObject *__pyx_t_5 = NULL;
     1369  int __pyx_lineno = 0;
     1370  const char *__pyx_filename = NULL;
     1371  int __pyx_clineno = 0;
     1372  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fd,&__pyx_n_s__events,0};
     1373  __Pyx_RefNannySetupContext("modify");
     1374  {
     1375    PyObject* values[2] = {0,0};
     1376    if (unlikely(__pyx_kwds)) {
     1377      Py_ssize_t kw_args;
     1378      switch (PyTuple_GET_SIZE(__pyx_args)) {
     1379        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
     1380        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
     1381        case  0: break;
     1382        default: goto __pyx_L5_argtuple_error;
     1383      }
     1384      kw_args = PyDict_Size(__pyx_kwds);
     1385      switch (PyTuple_GET_SIZE(__pyx_args)) {
     1386        case  0:
     1387        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fd);
     1388        if (likely(values[0])) kw_args--;
     1389        else goto __pyx_L5_argtuple_error;
     1390        case  1:
     1391        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__events);
     1392        if (likely(values[1])) kw_args--;
     1393        else {
     1394          __Pyx_RaiseArgtupleInvalid("modify", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     1395        }
     1396      }
     1397      if (unlikely(kw_args > 0)) {
     1398        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "modify") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     1399      }
     1400    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
     1401      goto __pyx_L5_argtuple_error;
     1402    } else {
     1403      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
     1404      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
     1405    }
     1406    __pyx_v_fd = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_fd == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     1407    __pyx_v_events = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_events == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     1408  }
     1409  goto __pyx_L4_argument_unpacking_done;
     1410  __pyx_L5_argtuple_error:;
     1411  __Pyx_RaiseArgtupleInvalid("modify", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     1412  __pyx_L3_error:;
     1413  __Pyx_AddTraceback("twisted.python._epoll.epoll.modify", __pyx_clineno, __pyx_lineno, __pyx_filename);
     1414  __Pyx_RefNannyFinishContext();
     1415  return NULL;
     1416  __pyx_L4_argument_unpacking_done:;
     1417
     1418  /* "twisted/python/_epoll.pyx":206
     1419 *         cdef int result
     1420 *         cdef epoll_event evt
     1421 *         evt.events = events             # <<<<<<<<<<<<<<
     1422 *         evt.data.fd = fd
     1423 *         result = epoll_ctl(self.fd, CTL_MOD, fd, &evt)
     1424 */
     1425  __pyx_v_evt.events = __pyx_v_events;
     1426
     1427  /* "twisted/python/_epoll.pyx":207
     1428 *         cdef epoll_event evt
     1429 *         evt.events = events
     1430 *         evt.data.fd = fd             # <<<<<<<<<<<<<<
     1431 *         result = epoll_ctl(self.fd, CTL_MOD, fd, &evt)
     1432 *         if result == -1:
     1433 */
     1434  __pyx_v_evt.data.fd = __pyx_v_fd;
     1435
     1436  /* "twisted/python/_epoll.pyx":208
     1437 *         evt.events = events
     1438 *         evt.data.fd = fd
     1439 *         result = epoll_ctl(self.fd, CTL_MOD, fd, &evt)             # <<<<<<<<<<<<<<
     1440 *         if result == -1:
     1441 *             raise IOError(errno, strerror(errno))
     1442 */
     1443  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__CTL_MOD); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1444  __Pyx_GOTREF(__pyx_t_1);
     1445  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1446  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     1447  __pyx_v_result = epoll_ctl(((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd, __pyx_t_2, __pyx_v_fd, (&__pyx_v_evt));
     1448
     1449  /* "twisted/python/_epoll.pyx":209
     1450 *         evt.data.fd = fd
     1451 *         result = epoll_ctl(self.fd, CTL_MOD, fd, &evt)
     1452 *         if result == -1:             # <<<<<<<<<<<<<<
     1453 *             raise IOError(errno, strerror(errno))
     1454 *
     1455 */
     1456  __pyx_t_3 = (__pyx_v_result == -1);
     1457  if (__pyx_t_3) {
     1458
     1459    /* "twisted/python/_epoll.pyx":210
     1460 *         result = epoll_ctl(self.fd, CTL_MOD, fd, &evt)
     1461 *         if result == -1:
     1462 *             raise IOError(errno, strerror(errno))             # <<<<<<<<<<<<<<
     1463 *
     1464 *     def _control(self, int op, int fd, int events):
     1465 */
     1466    __pyx_t_1 = PyInt_FromLong(errno); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1467    __Pyx_GOTREF(__pyx_t_1);
     1468    __pyx_t_4 = PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1469    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
     1470    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1471    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     1472    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
     1473    __Pyx_GIVEREF(__pyx_t_1);
     1474    PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_t_4));
     1475    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
     1476    __pyx_t_1 = 0;
     1477    __pyx_t_4 = 0;
     1478    __pyx_t_4 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1479    __Pyx_GOTREF(__pyx_t_4);
     1480    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
     1481    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
     1482    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     1483    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1484    goto __pyx_L6;
     1485  }
     1486  __pyx_L6:;
     1487
     1488  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
     1489  goto __pyx_L0;
     1490  __pyx_L1_error:;
     1491  __Pyx_XDECREF(__pyx_t_1);
     1492  __Pyx_XDECREF(__pyx_t_4);
     1493  __Pyx_XDECREF(__pyx_t_5);
     1494  __Pyx_AddTraceback("twisted.python._epoll.epoll.modify", __pyx_clineno, __pyx_lineno, __pyx_filename);
     1495  __pyx_r = NULL;
     1496  __pyx_L0:;
     1497  __Pyx_XGIVEREF(__pyx_r);
     1498  __Pyx_RefNannyFinishContext();
     1499  return __pyx_r;
     1500}
     1501
     1502/* "twisted/python/_epoll.pyx":212
     1503 *             raise IOError(errno, strerror(errno))
     1504 *
    7841505 *     def _control(self, int op, int fd, int events):             # <<<<<<<<<<<<<<
    7851506 *         """
    7861507 *         Modify the monitored state of a particular file descriptor.
    7871508 */
    7881509
    789 static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_4_control(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    790 static char __pyx_doc_7twisted_6python_6_epoll_5epoll_4_control[] = "\n        Modify the monitored state of a particular file descriptor.\n        \n        Wrap epoll_ctl(2).\n\n        @type op: C{int}\n        @param op: One of CTL_ADD, CTL_DEL, or CTL_MOD\n\n        @type fd: C{int}\n        @param fd: File descriptor to modify\n\n        @type events: C{int}\n        @param events: A bit set of IN, OUT, PRI, ERR, HUP, and ET.\n\n        @raise IOError: Raised if the underlying epoll_ctl() call fails.\n        ";
    791 static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_4_control(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
     1510static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_7_control(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
     1511static char __pyx_doc_7twisted_6python_6_epoll_5epoll_7_control[] = "\n        Modify the monitored state of a particular file descriptor.\n        \n        Wrap epoll_ctl(2).\n\n        @type op: C{int}\n        @param op: One of CTL_ADD, CTL_DEL, or CTL_MOD\n\n        @type fd: C{int}\n        @param fd: File descriptor to modify\n\n        @type events: C{int}\n        @param events: A bit set of IN, OUT, PRI, ERR, HUP, and ET.\n\n        @raise IOError: Raised if the underlying epoll_ctl() call fails.\n        ";
     1512static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_7_control(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
    7921513  int __pyx_v_op;
    7931514  int __pyx_v_fd;
    7941515  int __pyx_v_events;
    7951516  int __pyx_v_result;
    7961517  struct epoll_event __pyx_v_evt;
    7971518  PyObject *__pyx_r = NULL;
     1519  __Pyx_RefNannyDeclarations
    7981520  int __pyx_t_1;
    7991521  PyObject *__pyx_t_2 = NULL;
    8001522  PyObject *__pyx_t_3 = NULL;
    8011523  PyObject *__pyx_t_4 = NULL;
     1524  int __pyx_lineno = 0;
     1525  const char *__pyx_filename = NULL;
     1526  int __pyx_clineno = 0;
    8021527  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__op,&__pyx_n_s__fd,&__pyx_n_s__events,0};
    8031528  __Pyx_RefNannySetupContext("_control");
    804   if (unlikely(__pyx_kwds)) {
    805     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
     1529  {
    8061530    PyObject* values[3] = {0,0,0};
    807     switch (PyTuple_GET_SIZE(__pyx_args)) {
    808       case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    809       case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    810       case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    811       case  0: break;
    812       default: goto __pyx_L5_argtuple_error;
    813     }
    814     switch (PyTuple_GET_SIZE(__pyx_args)) {
    815       case  0:
    816       values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__op);
    817       if (likely(values[0])) kw_args--;
    818       else goto __pyx_L5_argtuple_error;
    819       case  1:
    820       values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fd);
    821       if (likely(values[1])) kw_args--;
    822       else {
    823         __Pyx_RaiseArgtupleInvalid("_control", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     1531    if (unlikely(__pyx_kwds)) {
     1532      Py_ssize_t kw_args;
     1533      switch (PyTuple_GET_SIZE(__pyx_args)) {
     1534        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
     1535        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
     1536        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
     1537        case  0: break;
     1538        default: goto __pyx_L5_argtuple_error;
    8241539      }
    825       case  2:
    826       values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__events);
    827       if (likely(values[2])) kw_args--;
    828       else {
    829         __Pyx_RaiseArgtupleInvalid("_control", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     1540      kw_args = PyDict_Size(__pyx_kwds);
     1541      switch (PyTuple_GET_SIZE(__pyx_args)) {
     1542        case  0:
     1543        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__op);
     1544        if (likely(values[0])) kw_args--;
     1545        else goto __pyx_L5_argtuple_error;
     1546        case  1:
     1547        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fd);
     1548        if (likely(values[1])) kw_args--;
     1549        else {
     1550          __Pyx_RaiseArgtupleInvalid("_control", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     1551        }
     1552        case  2:
     1553        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__events);
     1554        if (likely(values[2])) kw_args--;
     1555        else {
     1556          __Pyx_RaiseArgtupleInvalid("_control", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     1557        }
    8301558      }
     1559      if (unlikely(kw_args > 0)) {
     1560        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_control") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     1561      }
     1562    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
     1563      goto __pyx_L5_argtuple_error;
     1564    } else {
     1565      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
     1566      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
     1567      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    8311568    }
    832     if (unlikely(kw_args > 0)) {
    833       if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_control") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    834     }
    835     __pyx_v_op = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_op == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    836     __pyx_v_fd = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_fd == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    837     __pyx_v_events = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_events == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    838   } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
    839     goto __pyx_L5_argtuple_error;
    840   } else {
    841     __pyx_v_op = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_op == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    842     __pyx_v_fd = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_fd == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    843     __pyx_v_events = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_events == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     1569    __pyx_v_op = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_op == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     1570    __pyx_v_fd = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_fd == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     1571    __pyx_v_events = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_events == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    8441572  }
    8451573  goto __pyx_L4_argument_unpacking_done;
    8461574  __pyx_L5_argtuple_error:;
    847   __Pyx_RaiseArgtupleInvalid("_control", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     1575  __Pyx_RaiseArgtupleInvalid("_control", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    8481576  __pyx_L3_error:;
    849   __Pyx_AddTraceback("twisted.python._epoll.epoll._control");
     1577  __Pyx_AddTraceback("twisted.python._epoll.epoll._control", __pyx_clineno, __pyx_lineno, __pyx_filename);
    8501578  __Pyx_RefNannyFinishContext();
    8511579  return NULL;
    8521580  __pyx_L4_argument_unpacking_done:;
    8531581
    854   /* "twisted/python/_epoll.pyx":121
     1582  /* "twisted/python/_epoll.pyx":231
    8551583 *         cdef int result
    8561584 *         cdef epoll_event evt
    8571585 *         evt.events = events             # <<<<<<<<<<<<<<
     
    8601588 */
    8611589  __pyx_v_evt.events = __pyx_v_events;
    8621590
    863   /* "twisted/python/_epoll.pyx":122
     1591  /* "twisted/python/_epoll.pyx":232
    8641592 *         cdef epoll_event evt
    8651593 *         evt.events = events
    8661594 *         evt.data.fd = fd             # <<<<<<<<<<<<<<
     
    8691597 */
    8701598  __pyx_v_evt.data.fd = __pyx_v_fd;
    8711599
    872   /* "twisted/python/_epoll.pyx":123
     1600  /* "twisted/python/_epoll.pyx":233
    8731601 *         evt.events = events
    8741602 *         evt.data.fd = fd
    8751603 *         result = epoll_ctl(self.fd, op, fd, &evt)             # <<<<<<<<<<<<<<
     
    8781606 */
    8791607  __pyx_v_result = epoll_ctl(((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd, __pyx_v_op, __pyx_v_fd, (&__pyx_v_evt));
    8801608
    881   /* "twisted/python/_epoll.pyx":124
     1609  /* "twisted/python/_epoll.pyx":234
    8821610 *         evt.data.fd = fd
    8831611 *         result = epoll_ctl(self.fd, op, fd, &evt)
    8841612 *         if result == -1:             # <<<<<<<<<<<<<<
     
    8881616  __pyx_t_1 = (__pyx_v_result == -1);
    8891617  if (__pyx_t_1) {
    8901618
    891     /* "twisted/python/_epoll.pyx":125
     1619    /* "twisted/python/_epoll.pyx":235
    8921620 *         result = epoll_ctl(self.fd, op, fd, &evt)
    8931621 *         if result == -1:
    8941622 *             raise IOError(errno, strerror(errno))             # <<<<<<<<<<<<<<
    8951623 *
    8961624 *     def wait(self, unsigned int maxevents, int timeout):
    8971625 */
    898     __pyx_t_2 = PyInt_FromLong(errno); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1626    __pyx_t_2 = PyInt_FromLong(errno); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    8991627    __Pyx_GOTREF(__pyx_t_2);
    900     __pyx_t_3 = PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1628    __pyx_t_3 = PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    9011629    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    902     __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1630    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    9031631    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    9041632    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    9051633    __Pyx_GIVEREF(__pyx_t_2);
     
    9071635    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
    9081636    __pyx_t_2 = 0;
    9091637    __pyx_t_3 = 0;
    910     __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1638    __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    9111639    __Pyx_GOTREF(__pyx_t_3);
    9121640    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    913     __Pyx_Raise(__pyx_t_3, 0, 0);
     1641    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    9141642    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    915     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1643    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    9161644    goto __pyx_L6;
    9171645  }
    9181646  __pyx_L6:;
     
    9231651  __Pyx_XDECREF(__pyx_t_2);
    9241652  __Pyx_XDECREF(__pyx_t_3);
    9251653  __Pyx_XDECREF(__pyx_t_4);
    926   __Pyx_AddTraceback("twisted.python._epoll.epoll._control");
     1654  __Pyx_AddTraceback("twisted.python._epoll.epoll._control", __pyx_clineno, __pyx_lineno, __pyx_filename);
    9271655  __pyx_r = NULL;
    9281656  __pyx_L0:;
    9291657  __Pyx_XGIVEREF(__pyx_r);
     
    9311659  return __pyx_r;
    9321660}
    9331661
    934 /* "twisted/python/_epoll.pyx":127
     1662/* "twisted/python/_epoll.pyx":237
    9351663 *             raise IOError(errno, strerror(errno))
    9361664 *
    9371665 *     def wait(self, unsigned int maxevents, int timeout):             # <<<<<<<<<<<<<<
     
    9391667 *         Wait for an I/O event, wrap epoll_wait(2).
    9401668 */
    9411669
    942 static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_5wait(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    943 static char __pyx_doc_7twisted_6python_6_epoll_5epoll_5wait[] = "\n        Wait for an I/O event, wrap epoll_wait(2).\n\n        @type maxevents: C{int}\n        @param maxevents: Maximum number of events returned.\n\n        @type timeout: C{int}\n        @param timeout: Maximum time waiting for events. 0 makes it return\n            immediately whereas -1 makes it wait indefinitely.\n        \n        @raise IOError: Raised if the underlying epoll_wait() call fails.\n        ";
    944 static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_5wait(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
     1670static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_8wait(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
     1671static char __pyx_doc_7twisted_6python_6_epoll_5epoll_8wait[] = "\n        Wait for an I/O event, wrap epoll_wait(2).\n\n        @type maxevents: C{int}\n        @param maxevents: Maximum number of events returned.\n\n        @type timeout: C{int}\n        @param timeout: Maximum time in milliseconds waiting for events. 0\n            makes it return immediately whereas -1 makes it wait indefinitely.\n        \n        @raise IOError: Raised if the underlying epoll_wait() call fails.\n        ";
     1672static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_8wait(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
    9451673  unsigned int __pyx_v_maxevents;
    9461674  int __pyx_v_timeout;
    947   struct epoll_event *__pyx_v_events;
    948   int __pyx_v_result;
    949   int __pyx_v_nbytes;
    950   int __pyx_v_fd;
    951   PyThreadState *__pyx_v__save;
    952   PyObject *__pyx_v_results;
    953   long __pyx_v_i;
    9541675  PyObject *__pyx_r = NULL;
    955   int __pyx_t_1;
    956   PyObject *__pyx_t_2 = NULL;
    957   PyObject *__pyx_t_3 = NULL;
    958   PyObject *__pyx_t_4 = NULL;
    959   int __pyx_t_5;
    960   int __pyx_t_6;
     1676  __Pyx_RefNannyDeclarations
     1677  PyObject *__pyx_t_1 = NULL;
     1678  int __pyx_lineno = 0;
     1679  const char *__pyx_filename = NULL;
     1680  int __pyx_clineno = 0;
    9611681  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__maxevents,&__pyx_n_s__timeout,0};
    9621682  __Pyx_RefNannySetupContext("wait");
    963   if (unlikely(__pyx_kwds)) {
    964     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
     1683  {
    9651684    PyObject* values[2] = {0,0};
    966     switch (PyTuple_GET_SIZE(__pyx_args)) {
    967       case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    968       case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    969       case  0: break;
    970       default: goto __pyx_L5_argtuple_error;
    971     }
    972     switch (PyTuple_GET_SIZE(__pyx_args)) {
    973       case  0:
    974       values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__maxevents);
    975       if (likely(values[0])) kw_args--;
    976       else goto __pyx_L5_argtuple_error;
    977       case  1:
    978       values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__timeout);
    979       if (likely(values[1])) kw_args--;
    980       else {
    981         __Pyx_RaiseArgtupleInvalid("wait", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     1685    if (unlikely(__pyx_kwds)) {
     1686      Py_ssize_t kw_args;
     1687      switch (PyTuple_GET_SIZE(__pyx_args)) {
     1688        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
     1689        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
     1690        case  0: break;
     1691        default: goto __pyx_L5_argtuple_error;
    9821692      }
     1693      kw_args = PyDict_Size(__pyx_kwds);
     1694      switch (PyTuple_GET_SIZE(__pyx_args)) {
     1695        case  0:
     1696        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__maxevents);
     1697        if (likely(values[0])) kw_args--;
     1698        else goto __pyx_L5_argtuple_error;
     1699        case  1:
     1700        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__timeout);
     1701        if (likely(values[1])) kw_args--;
     1702        else {
     1703          __Pyx_RaiseArgtupleInvalid("wait", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     1704        }
     1705      }
     1706      if (unlikely(kw_args > 0)) {
     1707        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "wait") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     1708      }
     1709    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
     1710      goto __pyx_L5_argtuple_error;
     1711    } else {
     1712      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
     1713      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    9831714    }
    984     if (unlikely(kw_args > 0)) {
    985       if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "wait") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    986     }
    987     __pyx_v_maxevents = __Pyx_PyInt_AsUnsignedInt(values[0]); if (unlikely((__pyx_v_maxevents == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    988     __pyx_v_timeout = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_timeout == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    989   } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    990     goto __pyx_L5_argtuple_error;
    991   } else {
    992     __pyx_v_maxevents = __Pyx_PyInt_AsUnsignedInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_maxevents == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    993     __pyx_v_timeout = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_timeout == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     1715    __pyx_v_maxevents = __Pyx_PyInt_AsUnsignedInt(values[0]); if (unlikely((__pyx_v_maxevents == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     1716    __pyx_v_timeout = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_timeout == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    9941717  }
    9951718  goto __pyx_L4_argument_unpacking_done;
    9961719  __pyx_L5_argtuple_error:;
    997   __Pyx_RaiseArgtupleInvalid("wait", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     1720  __Pyx_RaiseArgtupleInvalid("wait", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    9981721  __pyx_L3_error:;
    999   __Pyx_AddTraceback("twisted.python._epoll.epoll.wait");
     1722  __Pyx_AddTraceback("twisted.python._epoll.epoll.wait", __pyx_clineno, __pyx_lineno, __pyx_filename);
    10001723  __Pyx_RefNannyFinishContext();
    10011724  return NULL;
    10021725  __pyx_L4_argument_unpacking_done:;
    1003   __pyx_v_results = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
    10041726
    1005   /* "twisted/python/_epoll.pyx":146
    1006  *         cdef PyThreadState *_save
     1727  /* "twisted/python/_epoll.pyx":250
     1728 *         @raise IOError: Raised if the underlying epoll_wait() call fails.
     1729 *         """
     1730 *         return call_epoll_wait(self.fd, maxevents, timeout)             # <<<<<<<<<<<<<<
    10071731 *
    1008  *         nbytes = sizeof(epoll_event) * maxevents             # <<<<<<<<<<<<<<
    1009  *         events = <epoll_event*>malloc(nbytes)
    1010  *         memset(events, 0, nbytes)
     1732 *     def poll(self, float timeout=-1, unsigned int maxevents=1024):
    10111733 */
    1012   __pyx_v_nbytes = ((sizeof(struct epoll_event)) * __pyx_v_maxevents);
     1734  __Pyx_XDECREF(__pyx_r);
     1735  __pyx_t_1 = __pyx_f_7twisted_6python_6_epoll_call_epoll_wait(((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd, __pyx_v_maxevents, __pyx_v_timeout); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1736  __Pyx_GOTREF(__pyx_t_1);
     1737  __pyx_r = __pyx_t_1;
     1738  __pyx_t_1 = 0;
     1739  goto __pyx_L0;
    10131740
    1014   /* "twisted/python/_epoll.pyx":147
    1015  *
    1016  *         nbytes = sizeof(epoll_event) * maxevents
    1017  *         events = <epoll_event*>malloc(nbytes)             # <<<<<<<<<<<<<<
    1018  *         memset(events, 0, nbytes)
    1019  *         try:
    1020  */
    1021   __pyx_v_events = ((struct epoll_event *)malloc(__pyx_v_nbytes));
     1741  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
     1742  goto __pyx_L0;
     1743  __pyx_L1_error:;
     1744  __Pyx_XDECREF(__pyx_t_1);
     1745  __Pyx_AddTraceback("twisted.python._epoll.epoll.wait", __pyx_clineno, __pyx_lineno, __pyx_filename);
     1746  __pyx_r = NULL;
     1747  __pyx_L0:;
     1748  __Pyx_XGIVEREF(__pyx_r);
     1749  __Pyx_RefNannyFinishContext();
     1750  return __pyx_r;
     1751}
    10221752
    1023   /* "twisted/python/_epoll.pyx":148
    1024  *         nbytes = sizeof(epoll_event) * maxevents
    1025  *         events = <epoll_event*>malloc(nbytes)
    1026  *         memset(events, 0, nbytes)             # <<<<<<<<<<<<<<
    1027  *         try:
    1028  *             fd = self.fd
    1029  */
    1030   memset(__pyx_v_events, 0, __pyx_v_nbytes);
    1031 
    1032   /* "twisted/python/_epoll.pyx":149
    1033  *         events = <epoll_event*>malloc(nbytes)
    1034  *         memset(events, 0, nbytes)
    1035  *         try:             # <<<<<<<<<<<<<<
    1036  *             fd = self.fd
     1753/* "twisted/python/_epoll.pyx":252
     1754 *         return call_epoll_wait(self.fd, maxevents, timeout)
    10371755 *
     1756 *     def poll(self, float timeout=-1, unsigned int maxevents=1024):             # <<<<<<<<<<<<<<
     1757 *         """
     1758 *         Wait for an I/O event, wrap epoll_wait(2).
    10381759 */
    1039   /*try:*/ {
    10401760
    1041     /* "twisted/python/_epoll.pyx":150
    1042  *         memset(events, 0, nbytes)
    1043  *         try:
    1044  *             fd = self.fd             # <<<<<<<<<<<<<<
    1045  *
    1046  *             _save = PyEval_SaveThread()
    1047  */
    1048     __pyx_v_fd = ((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd;
    1049 
    1050     /* "twisted/python/_epoll.pyx":152
    1051  *             fd = self.fd
    1052  *
    1053  *             _save = PyEval_SaveThread()             # <<<<<<<<<<<<<<
    1054  *             result = epoll_wait(fd, events, maxevents, timeout)
    1055  *             PyEval_RestoreThread(_save)
    1056  */
    1057     __pyx_v__save = PyEval_SaveThread();
    1058 
    1059     /* "twisted/python/_epoll.pyx":153
    1060  *
    1061  *             _save = PyEval_SaveThread()
    1062  *             result = epoll_wait(fd, events, maxevents, timeout)             # <<<<<<<<<<<<<<
    1063  *             PyEval_RestoreThread(_save)
    1064  *
    1065  */
    1066     __pyx_v_result = epoll_wait(__pyx_v_fd, __pyx_v_events, __pyx_v_maxevents, __pyx_v_timeout);
    1067 
    1068     /* "twisted/python/_epoll.pyx":154
    1069  *             _save = PyEval_SaveThread()
    1070  *             result = epoll_wait(fd, events, maxevents, timeout)
    1071  *             PyEval_RestoreThread(_save)             # <<<<<<<<<<<<<<
    1072  *
    1073  *             if result == -1:
    1074  */
    1075     PyEval_RestoreThread(__pyx_v__save);
    1076 
    1077     /* "twisted/python/_epoll.pyx":156
    1078  *             PyEval_RestoreThread(_save)
    1079  *
    1080  *             if result == -1:             # <<<<<<<<<<<<<<
    1081  *                 raise IOError(errno, strerror(errno))
    1082  *             results = []
    1083  */
    1084     __pyx_t_1 = (__pyx_v_result == -1);
    1085     if (__pyx_t_1) {
    1086 
    1087       /* "twisted/python/_epoll.pyx":157
    1088  *
    1089  *             if result == -1:
    1090  *                 raise IOError(errno, strerror(errno))             # <<<<<<<<<<<<<<
    1091  *             results = []
    1092  *             for i from 0 <= i < result:
    1093  */
    1094       __pyx_t_2 = PyInt_FromLong(errno); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L7;}
    1095       __Pyx_GOTREF(__pyx_t_2);
    1096       __pyx_t_3 = PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L7;}
    1097       __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    1098       __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L7;}
    1099       __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    1100       PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    1101       __Pyx_GIVEREF(__pyx_t_2);
    1102       PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_t_3));
    1103       __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
    1104       __pyx_t_2 = 0;
    1105       __pyx_t_3 = 0;
    1106       __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L7;}
    1107       __Pyx_GOTREF(__pyx_t_3);
    1108       __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    1109       __Pyx_Raise(__pyx_t_3, 0, 0);
    1110       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    1111       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L7;}
    1112       goto __pyx_L9;
    1113     }
    1114     __pyx_L9:;
    1115 
    1116     /* "twisted/python/_epoll.pyx":158
    1117  *             if result == -1:
    1118  *                 raise IOError(errno, strerror(errno))
    1119  *             results = []             # <<<<<<<<<<<<<<
    1120  *             for i from 0 <= i < result:
    1121  *                 results.append((events[i].data.fd, <int>events[i].events))
    1122  */
    1123     __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L7;}
    1124     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    1125     __Pyx_DECREF(((PyObject *)__pyx_v_results));
    1126     __pyx_v_results = __pyx_t_3;
    1127     __pyx_t_3 = 0;
    1128 
    1129     /* "twisted/python/_epoll.pyx":159
    1130  *                 raise IOError(errno, strerror(errno))
    1131  *             results = []
    1132  *             for i from 0 <= i < result:             # <<<<<<<<<<<<<<
    1133  *                 results.append((events[i].data.fd, <int>events[i].events))
    1134  *             return results
    1135  */
    1136     __pyx_t_5 = __pyx_v_result;
    1137     for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {
    1138 
    1139       /* "twisted/python/_epoll.pyx":160
    1140  *             results = []
    1141  *             for i from 0 <= i < result:
    1142  *                 results.append((events[i].data.fd, <int>events[i].events))             # <<<<<<<<<<<<<<
    1143  *             return results
    1144  *         finally:
    1145  */
    1146       if (unlikely(__pyx_v_results == Py_None)) {
    1147         PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L7;}
     1761static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_9poll(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
     1762static char __pyx_doc_7twisted_6python_6_epoll_5epoll_9poll[] = "\n        Wait for an I/O event, wrap epoll_wait(2).\n\n        This method is compatible with select.epoll.poll in Python 2.6.\n\n        @type maxevents: C{int}\n        @param maxevents: Maximum number of events returned.\n\n        @type timeout: C{int}\n        @param timeout: Maximum time waiting for events. 0 makes it return\n            immediately whereas -1 makes it wait indefinitely.\n        \n        @raise IOError: Raised if the underlying epoll_wait() call fails.\n        ";
     1763static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_9poll(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
     1764  float __pyx_v_timeout;
     1765  unsigned int __pyx_v_maxevents;
     1766  PyObject *__pyx_r = NULL;
     1767  __Pyx_RefNannyDeclarations
     1768  PyObject *__pyx_t_1 = NULL;
     1769  int __pyx_lineno = 0;
     1770  const char *__pyx_filename = NULL;
     1771  int __pyx_clineno = 0;
     1772  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__timeout,&__pyx_n_s__maxevents,0};
     1773  __Pyx_RefNannySetupContext("poll");
     1774  {
     1775    PyObject* values[2] = {0,0};
     1776    if (unlikely(__pyx_kwds)) {
     1777      Py_ssize_t kw_args;
     1778      switch (PyTuple_GET_SIZE(__pyx_args)) {
     1779        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
     1780        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
     1781        case  0: break;
     1782        default: goto __pyx_L5_argtuple_error;
    11481783      }
    1149       __pyx_t_3 = PyInt_FromLong((__pyx_v_events[__pyx_v_i]).data.fd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L7;}
    1150       __Pyx_GOTREF(__pyx_t_3);
    1151       __pyx_t_4 = PyInt_FromLong(((int)(__pyx_v_events[__pyx_v_i]).events)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L7;}
    1152       __Pyx_GOTREF(__pyx_t_4);
    1153       __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L7;}
    1154       __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    1155       PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
    1156       __Pyx_GIVEREF(__pyx_t_3);
    1157       PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
    1158       __Pyx_GIVEREF(__pyx_t_4);
    1159       __pyx_t_3 = 0;
    1160       __pyx_t_4 = 0;
    1161       __pyx_t_6 = PyList_Append(__pyx_v_results, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L7;}
    1162       __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
     1784      kw_args = PyDict_Size(__pyx_kwds);
     1785      switch (PyTuple_GET_SIZE(__pyx_args)) {
     1786        case  0:
     1787        if (kw_args > 0) {
     1788          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__timeout);
     1789          if (value) { values[0] = value; kw_args--; }
     1790        }
     1791        case  1:
     1792        if (kw_args > 0) {
     1793          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__maxevents);
     1794          if (value) { values[1] = value; kw_args--; }
     1795        }
     1796      }
     1797      if (unlikely(kw_args > 0)) {
     1798        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "poll") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     1799      }
     1800    } else {
     1801      switch (PyTuple_GET_SIZE(__pyx_args)) {
     1802        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
     1803        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
     1804        case  0: break;
     1805        default: goto __pyx_L5_argtuple_error;
     1806      }
    11631807    }
    1164 
    1165     /* "twisted/python/_epoll.pyx":161
    1166  *             for i from 0 <= i < result:
    1167  *                 results.append((events[i].data.fd, <int>events[i].events))
    1168  *             return results             # <<<<<<<<<<<<<<
    1169  *         finally:
    1170  *             free(events)
    1171  */
    1172     __Pyx_XDECREF(__pyx_r);
    1173     __Pyx_INCREF(((PyObject *)__pyx_v_results));
    1174     __pyx_r = ((PyObject *)__pyx_v_results);
    1175     goto __pyx_L6;
     1808    if (values[0]) {
     1809      __pyx_v_timeout = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_timeout == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     1810    } else {
     1811      __pyx_v_timeout = ((float)-1.0);
     1812    }
     1813    if (values[1]) {
     1814      __pyx_v_maxevents = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_maxevents == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     1815    } else {
     1816      __pyx_v_maxevents = ((unsigned int)1024);
     1817    }
    11761818  }
     1819  goto __pyx_L4_argument_unpacking_done;
     1820  __pyx_L5_argtuple_error:;
     1821  __Pyx_RaiseArgtupleInvalid("poll", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     1822  __pyx_L3_error:;
     1823  __Pyx_AddTraceback("twisted.python._epoll.epoll.poll", __pyx_clineno, __pyx_lineno, __pyx_filename);
     1824  __Pyx_RefNannyFinishContext();
     1825  return NULL;
     1826  __pyx_L4_argument_unpacking_done:;
    11771827
    1178   /* "twisted/python/_epoll.pyx":163
    1179  *             return results
    1180  *         finally:
    1181  *             free(events)             # <<<<<<<<<<<<<<
     1828  /* "twisted/python/_epoll.pyx":267
     1829 *         @raise IOError: Raised if the underlying epoll_wait() call fails.
     1830 *         """
     1831 *         return call_epoll_wait(self.fd, maxevents, <int>(timeout * 1000.0))             # <<<<<<<<<<<<<<
    11821832 *
    1183  * CTL_ADD = EPOLL_CTL_ADD
     1833 *
    11841834 */
    1185   /*finally:*/ {
    1186     int __pyx_why;
    1187     PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    1188     int __pyx_exc_lineno;
    1189     __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    1190     __pyx_why = 0; goto __pyx_L8;
    1191     __pyx_L6: __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    1192     __pyx_why = 3; goto __pyx_L8;
    1193     __pyx_L7: {
    1194       __pyx_why = 4;
    1195       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    1196       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    1197       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    1198       __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
    1199       __pyx_exc_lineno = __pyx_lineno;
    1200       goto __pyx_L8;
    1201     }
    1202     __pyx_L8:;
    1203     free(__pyx_v_events);
    1204     switch (__pyx_why) {
    1205       case 3: goto __pyx_L0;
    1206       case 4: {
    1207         __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
    1208         __pyx_lineno = __pyx_exc_lineno;
    1209         __pyx_exc_type = 0;
    1210         __pyx_exc_value = 0;
    1211         __pyx_exc_tb = 0;
    1212         goto __pyx_L1_error;
    1213       }
    1214     }
    1215   }
     1835  __Pyx_XDECREF(__pyx_r);
     1836  __pyx_t_1 = __pyx_f_7twisted_6python_6_epoll_call_epoll_wait(((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd, __pyx_v_maxevents, ((int)(__pyx_v_timeout * 1000.0))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1837  __Pyx_GOTREF(__pyx_t_1);
     1838  __pyx_r = __pyx_t_1;
     1839  __pyx_t_1 = 0;
     1840  goto __pyx_L0;
    12161841
    12171842  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    12181843  goto __pyx_L0;
    12191844  __pyx_L1_error:;
    1220   __Pyx_XDECREF(__pyx_t_2);
    1221   __Pyx_XDECREF(__pyx_t_3);
    1222   __Pyx_XDECREF(__pyx_t_4);
    1223   __Pyx_AddTraceback("twisted.python._epoll.epoll.wait");
     1845  __Pyx_XDECREF(__pyx_t_1);
     1846  __Pyx_AddTraceback("twisted.python._epoll.epoll.poll", __pyx_clineno, __pyx_lineno, __pyx_filename);
    12241847  __pyx_r = NULL;
    12251848  __pyx_L0:;
    1226   __Pyx_DECREF(__pyx_v_results);
    12271849  __Pyx_XGIVEREF(__pyx_r);
    12281850  __Pyx_RefNannyFinishContext();
    12291851  return __pyx_r;
     
    12511873static PyMethodDef __pyx_methods_7twisted_6python_6_epoll_epoll[] = {
    12521874  {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pf_7twisted_6python_6_epoll_5epoll_2close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_7twisted_6python_6_epoll_5epoll_2close)},
    12531875  {__Pyx_NAMESTR("fileno"), (PyCFunction)__pyx_pf_7twisted_6python_6_epoll_5epoll_3fileno, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_7twisted_6python_6_epoll_5epoll_3fileno)},
    1254   {__Pyx_NAMESTR("_control"), (PyCFunction)__pyx_pf_7twisted_6python_6_epoll_5epoll_4_control, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7twisted_6python_6_epoll_5epoll_4_control)},
    1255   {__Pyx_NAMESTR("wait"), (PyCFunction)__pyx_pf_7twisted_6python_6_epoll_5epoll_5wait, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7twisted_6python_6_epoll_5epoll_5wait)},
     1876  {__Pyx_NAMESTR("register"), (PyCFunction)__pyx_pf_7twisted_6python_6_epoll_5epoll_4register, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7twisted_6python_6_epoll_5epoll_4register)},
     1877  {__Pyx_NAMESTR("unregister"), (PyCFunction)__pyx_pf_7twisted_6python_6_epoll_5epoll_5unregister, METH_O, __Pyx_DOCSTR(__pyx_doc_7twisted_6python_6_epoll_5epoll_5unregister)},
     1878  {__Pyx_NAMESTR("modify"), (PyCFunction)__pyx_pf_7twisted_6python_6_epoll_5epoll_6modify, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7twisted_6python_6_epoll_5epoll_6modify)},
     1879  {__Pyx_NAMESTR("_control"), (PyCFunction)__pyx_pf_7twisted_6python_6_epoll_5epoll_7_control, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7twisted_6python_6_epoll_5epoll_7_control)},
     1880  {__Pyx_NAMESTR("wait"), (PyCFunction)__pyx_pf_7twisted_6python_6_epoll_5epoll_8wait, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7twisted_6python_6_epoll_5epoll_8wait)},
     1881  {__Pyx_NAMESTR("poll"), (PyCFunction)__pyx_pf_7twisted_6python_6_epoll_5epoll_9poll, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7twisted_6python_6_epoll_5epoll_9poll)},
    12561882  {0, 0, 0, 0}
    12571883};
    12581884
     
    14322058  {&__pyx_n_s__CTL_ADD, __pyx_k__CTL_ADD, sizeof(__pyx_k__CTL_ADD), 0, 0, 1, 1},
    14332059  {&__pyx_n_s__CTL_DEL, __pyx_k__CTL_DEL, sizeof(__pyx_k__CTL_DEL), 0, 0, 1, 1},
    14342060  {&__pyx_n_s__CTL_MOD, __pyx_k__CTL_MOD, sizeof(__pyx_k__CTL_MOD), 0, 0, 1, 1},
     2061  {&__pyx_n_s__EPOLLERR, __pyx_k__EPOLLERR, sizeof(__pyx_k__EPOLLERR), 0, 0, 1, 1},
     2062  {&__pyx_n_s__EPOLLET, __pyx_k__EPOLLET, sizeof(__pyx_k__EPOLLET), 0, 0, 1, 1},
     2063  {&__pyx_n_s__EPOLLHUP, __pyx_k__EPOLLHUP, sizeof(__pyx_k__EPOLLHUP), 0, 0, 1, 1},
     2064  {&__pyx_n_s__EPOLLIN, __pyx_k__EPOLLIN, sizeof(__pyx_k__EPOLLIN), 0, 0, 1, 1},
     2065  {&__pyx_n_s__EPOLLMSG, __pyx_k__EPOLLMSG, sizeof(__pyx_k__EPOLLMSG), 0, 0, 1, 1},
     2066  {&__pyx_n_s__EPOLLOUT, __pyx_k__EPOLLOUT, sizeof(__pyx_k__EPOLLOUT), 0, 0, 1, 1},
     2067  {&__pyx_n_s__EPOLLPRI, __pyx_k__EPOLLPRI, sizeof(__pyx_k__EPOLLPRI), 0, 0, 1, 1},
     2068  {&__pyx_n_s__EPOLLRDBAND, __pyx_k__EPOLLRDBAND, sizeof(__pyx_k__EPOLLRDBAND), 0, 0, 1, 1},
     2069  {&__pyx_n_s__EPOLLRDNORM, __pyx_k__EPOLLRDNORM, sizeof(__pyx_k__EPOLLRDNORM), 0, 0, 1, 1},
     2070  {&__pyx_n_s__EPOLLWRBAND, __pyx_k__EPOLLWRBAND, sizeof(__pyx_k__EPOLLWRBAND), 0, 0, 1, 1},
     2071  {&__pyx_n_s__EPOLLWRNORM, __pyx_k__EPOLLWRNORM, sizeof(__pyx_k__EPOLLWRNORM), 0, 0, 1, 1},
    14352072  {&__pyx_n_s__ERR, __pyx_k__ERR, sizeof(__pyx_k__ERR), 0, 0, 1, 1},
    14362073  {&__pyx_n_s__ET, __pyx_k__ET, sizeof(__pyx_k__ET), 0, 0, 1, 1},
    14372074  {&__pyx_n_s__HUP, __pyx_k__HUP, sizeof(__pyx_k__HUP), 0, 0, 1, 1},
     
    14462083  {&__pyx_n_s__WRNORM, __pyx_k__WRNORM, sizeof(__pyx_k__WRNORM), 0, 0, 1, 1},
    14472084  {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
    14482085  {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
    1449   {&__pyx_n_s__append, __pyx_k__append, sizeof(__pyx_k__append), 0, 0, 1, 1},
    1450   {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1},
    14512086  {&__pyx_n_s__events, __pyx_k__events, sizeof(__pyx_k__events), 0, 0, 1, 1},
    14522087  {&__pyx_n_s__fd, __pyx_k__fd, sizeof(__pyx_k__fd), 0, 0, 1, 1},
    1453   {&__pyx_n_s__initialized, __pyx_k__initialized, sizeof(__pyx_k__initialized), 0, 0, 1, 1},
    14542088  {&__pyx_n_s__maxevents, __pyx_k__maxevents, sizeof(__pyx_k__maxevents), 0, 0, 1, 1},
    14552089  {&__pyx_n_s__op, __pyx_k__op, sizeof(__pyx_k__op), 0, 0, 1, 1},
    14562090  {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1},
     
    14582092  {0, 0, 0, 0, 0, 0, 0}
    14592093};
    14602094static int __Pyx_InitCachedBuiltins(void) {
    1461   __pyx_builtin_IOError = __Pyx_GetName(__pyx_b, __pyx_n_s__IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2095  __pyx_builtin_IOError = __Pyx_GetName(__pyx_b, __pyx_n_s__IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    14622096  return 0;
    14632097  __pyx_L1_error:;
    14642098  return -1;
    14652099}
    14662100
    14672101static int __Pyx_InitCachedConstants(void) {
     2102  __Pyx_RefNannyDeclarations
    14682103  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants");
    14692104  __Pyx_RefNannyFinishContext();
    14702105  return 0;
     
    14862121#endif
    14872122{
    14882123  PyObject *__pyx_t_1 = NULL;
     2124  __Pyx_RefNannyDeclarations
    14892125  #if CYTHON_REFNANNY
    1490   void* __pyx_refnanny = NULL;
    14912126  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
    14922127  if (!__Pyx_RefNanny) {
    14932128      PyErr_Clear();
     
    14952130      if (!__Pyx_RefNanny)
    14962131          Py_FatalError("failed to import 'refnanny' module");
    14972132  }
    1498   __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit__epoll(void)", __LINE__, __FILE__);
    14992133  #endif
     2134  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__epoll(void)");
     2135  if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    15002136  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    15012137  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    15022138  #ifdef __pyx_binding_PyCFunctionType_USED
     
    15322168  /*--- Constants init code ---*/
    15332169  if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    15342170  /*--- Global init code ---*/
     2171  /*--- Variable export code ---*/
    15352172  /*--- Function export code ---*/
    15362173  /*--- Type init code ---*/
    1537   if (PyType_Ready(&__pyx_type_7twisted_6python_6_epoll_epoll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    1538   if (__Pyx_SetAttrString(__pyx_m, "epoll", (PyObject *)&__pyx_type_7twisted_6python_6_epoll_epoll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2174  if (PyType_Ready(&__pyx_type_7twisted_6python_6_epoll_epoll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2175  {
     2176    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_7twisted_6python_6_epoll_epoll, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2177    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
     2178      __pyx_wrapperbase_7twisted_6python_6_epoll_5epoll___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
     2179      __pyx_wrapperbase_7twisted_6python_6_epoll_5epoll___init__.doc = __pyx_doc_7twisted_6python_6_epoll_5epoll___init__;
     2180      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7twisted_6python_6_epoll_5epoll___init__;
     2181    }
     2182  }
     2183  if (__Pyx_SetAttrString(__pyx_m, "epoll", (PyObject *)&__pyx_type_7twisted_6python_6_epoll_epoll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    15392184  __pyx_ptype_7twisted_6python_6_epoll_epoll = &__pyx_type_7twisted_6python_6_epoll_epoll;
    15402185  /*--- Type import code ---*/
     2186  /*--- Variable import code ---*/
    15412187  /*--- Function import code ---*/
    15422188  /*--- Execution code ---*/
    15432189
    1544   /* "twisted/python/_epoll.pyx":165
    1545  *             free(events)
     2190  /* "twisted/python/_epoll.pyx":270
    15462191 *
     2192 *
    15472193 * CTL_ADD = EPOLL_CTL_ADD             # <<<<<<<<<<<<<<
    15482194 * CTL_DEL = EPOLL_CTL_DEL
    15492195 * CTL_MOD = EPOLL_CTL_MOD
    15502196 */
    1551   __pyx_t_1 = PyInt_FromLong(EPOLL_CTL_ADD); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2197  __pyx_t_1 = PyInt_FromLong(EPOLL_CTL_ADD); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    15522198  __Pyx_GOTREF(__pyx_t_1);
    1553   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__CTL_ADD, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2199  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__CTL_ADD, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    15542200  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    15552201
    1556   /* "twisted/python/_epoll.pyx":166
     2202  /* "twisted/python/_epoll.pyx":271
    15572203 *
    15582204 * CTL_ADD = EPOLL_CTL_ADD
    15592205 * CTL_DEL = EPOLL_CTL_DEL             # <<<<<<<<<<<<<<
    15602206 * CTL_MOD = EPOLL_CTL_MOD
    15612207 *
    15622208 */
    1563   __pyx_t_1 = PyInt_FromLong(EPOLL_CTL_DEL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2209  __pyx_t_1 = PyInt_FromLong(EPOLL_CTL_DEL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    15642210  __Pyx_GOTREF(__pyx_t_1);
    1565   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__CTL_DEL, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2211  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__CTL_DEL, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    15662212  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    15672213
    1568   /* "twisted/python/_epoll.pyx":167
     2214  /* "twisted/python/_epoll.pyx":272
    15692215 * CTL_ADD = EPOLL_CTL_ADD
    15702216 * CTL_DEL = EPOLL_CTL_DEL
    15712217 * CTL_MOD = EPOLL_CTL_MOD             # <<<<<<<<<<<<<<
    15722218 *
    1573  * IN = EPOLLIN
     2219 * IN = EPOLLIN = c_EPOLLIN
    15742220 */
    1575   __pyx_t_1 = PyInt_FromLong(EPOLL_CTL_MOD); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2221  __pyx_t_1 = PyInt_FromLong(EPOLL_CTL_MOD); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    15762222  __Pyx_GOTREF(__pyx_t_1);
    1577   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__CTL_MOD, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2223  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__CTL_MOD, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    15782224  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    15792225
    1580   /* "twisted/python/_epoll.pyx":169
     2226  /* "twisted/python/_epoll.pyx":274
    15812227 * CTL_MOD = EPOLL_CTL_MOD
    15822228 *
    1583  * IN = EPOLLIN             # <<<<<<<<<<<<<<
    1584  * OUT = EPOLLOUT
    1585  * PRI = EPOLLPRI
     2229 * IN = EPOLLIN = c_EPOLLIN             # <<<<<<<<<<<<<<
     2230 * OUT = EPOLLOUT = c_EPOLLOUT
     2231 * PRI = EPOLLPRI = c_EPOLLPRI
    15862232 */
    1587   __pyx_t_1 = PyInt_FromLong(EPOLLIN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2233  __pyx_t_1 = PyInt_FromLong(EPOLLIN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    15882234  __Pyx_GOTREF(__pyx_t_1);
    1589   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__IN, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2235  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__IN, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    15902236  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     2237  __pyx_t_1 = PyInt_FromLong(EPOLLIN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2238  __Pyx_GOTREF(__pyx_t_1);
     2239  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EPOLLIN, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2240  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    15912241
    1592   /* "twisted/python/_epoll.pyx":170
     2242  /* "twisted/python/_epoll.pyx":275
    15932243 *
    1594  * IN = EPOLLIN
    1595  * OUT = EPOLLOUT             # <<<<<<<<<<<<<<
    1596  * PRI = EPOLLPRI
    1597  * ERR = EPOLLERR
     2244 * IN = EPOLLIN = c_EPOLLIN
     2245 * OUT = EPOLLOUT = c_EPOLLOUT             # <<<<<<<<<<<<<<
     2246 * PRI = EPOLLPRI = c_EPOLLPRI
     2247 * ERR = EPOLLERR = c_EPOLLERR
    15982248 */
    1599   __pyx_t_1 = PyInt_FromLong(EPOLLOUT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2249  __pyx_t_1 = PyInt_FromLong(EPOLLOUT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    16002250  __Pyx_GOTREF(__pyx_t_1);
    1601   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__OUT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2251  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__OUT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    16022252  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     2253  __pyx_t_1 = PyInt_FromLong(EPOLLOUT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2254  __Pyx_GOTREF(__pyx_t_1);
     2255  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EPOLLOUT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2256  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    16032257
    1604   /* "twisted/python/_epoll.pyx":171
    1605  * IN = EPOLLIN
    1606  * OUT = EPOLLOUT
    1607  * PRI = EPOLLPRI             # <<<<<<<<<<<<<<
    1608  * ERR = EPOLLERR
    1609  * HUP = EPOLLHUP
     2258  /* "twisted/python/_epoll.pyx":276
     2259 * IN = EPOLLIN = c_EPOLLIN
     2260 * OUT = EPOLLOUT = c_EPOLLOUT
     2261 * PRI = EPOLLPRI = c_EPOLLPRI             # <<<<<<<<<<<<<<
     2262 * ERR = EPOLLERR = c_EPOLLERR
     2263 * HUP = EPOLLHUP = c_EPOLLHUP
    16102264 */
    1611   __pyx_t_1 = PyInt_FromLong(EPOLLPRI); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2265  __pyx_t_1 = PyInt_FromLong(EPOLLPRI); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    16122266  __Pyx_GOTREF(__pyx_t_1);
    1613   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__PRI, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2267  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__PRI, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    16142268  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     2269  __pyx_t_1 = PyInt_FromLong(EPOLLPRI); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2270  __Pyx_GOTREF(__pyx_t_1);
     2271  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EPOLLPRI, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2272  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    16152273
    1616   /* "twisted/python/_epoll.pyx":172
    1617  * OUT = EPOLLOUT
    1618  * PRI = EPOLLPRI
    1619  * ERR = EPOLLERR             # <<<<<<<<<<<<<<
    1620  * HUP = EPOLLHUP
    1621  * ET = EPOLLET
     2274  /* "twisted/python/_epoll.pyx":277
     2275 * OUT = EPOLLOUT = c_EPOLLOUT
     2276 * PRI = EPOLLPRI = c_EPOLLPRI
     2277 * ERR = EPOLLERR = c_EPOLLERR             # <<<<<<<<<<<<<<
     2278 * HUP = EPOLLHUP = c_EPOLLHUP
     2279 * ET = EPOLLET = c_EPOLLET
    16222280 */
    1623   __pyx_t_1 = PyInt_FromLong(EPOLLERR); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2281  __pyx_t_1 = PyInt_FromLong(EPOLLERR); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    16242282  __Pyx_GOTREF(__pyx_t_1);
    1625   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ERR, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2283  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ERR, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    16262284  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     2285  __pyx_t_1 = PyInt_FromLong(EPOLLERR); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2286  __Pyx_GOTREF(__pyx_t_1);
     2287  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EPOLLERR, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2288  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    16272289
    1628   /* "twisted/python/_epoll.pyx":173
    1629  * PRI = EPOLLPRI
    1630  * ERR = EPOLLERR
    1631  * HUP = EPOLLHUP             # <<<<<<<<<<<<<<
    1632  * ET = EPOLLET
     2290  /* "twisted/python/_epoll.pyx":278
     2291 * PRI = EPOLLPRI = c_EPOLLPRI
     2292 * ERR = EPOLLERR = c_EPOLLERR
     2293 * HUP = EPOLLHUP = c_EPOLLHUP             # <<<<<<<<<<<<<<
     2294 * ET = EPOLLET = c_EPOLLET
    16332295 *
    16342296 */
    1635   __pyx_t_1 = PyInt_FromLong(EPOLLHUP); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2297  __pyx_t_1 = PyInt_FromLong(EPOLLHUP); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    16362298  __Pyx_GOTREF(__pyx_t_1);
    1637   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__HUP, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2299  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__HUP, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    16382300  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     2301  __pyx_t_1 = PyInt_FromLong(EPOLLHUP); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2302  __Pyx_GOTREF(__pyx_t_1);
     2303  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EPOLLHUP, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2304  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    16392305
    1640   /* "twisted/python/_epoll.pyx":174
    1641  * ERR = EPOLLERR
    1642  * HUP = EPOLLHUP
    1643  * ET = EPOLLET             # <<<<<<<<<<<<<<
     2306  /* "twisted/python/_epoll.pyx":279
     2307 * ERR = EPOLLERR = c_EPOLLERR
     2308 * HUP = EPOLLHUP = c_EPOLLHUP
     2309 * ET = EPOLLET = c_EPOLLET             # <<<<<<<<<<<<<<
    16442310 *
    1645  * RDNORM = EPOLLRDNORM
     2311 * RDNORM = EPOLLRDNORM = c_EPOLLRDNORM
    16462312 */
    1647   __pyx_t_1 = PyInt_FromLong(EPOLLET); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2313  __pyx_t_1 = PyInt_FromLong(EPOLLET); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    16482314  __Pyx_GOTREF(__pyx_t_1);
    1649   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ET, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2315  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ET, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    16502316  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     2317  __pyx_t_1 = PyInt_FromLong(EPOLLET); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2318  __Pyx_GOTREF(__pyx_t_1);
     2319  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EPOLLET, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2320  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    16512321
    1652   /* "twisted/python/_epoll.pyx":176
    1653  * ET = EPOLLET
     2322  /* "twisted/python/_epoll.pyx":281
     2323 * ET = EPOLLET = c_EPOLLET
    16542324 *
    1655  * RDNORM = EPOLLRDNORM             # <<<<<<<<<<<<<<
    1656  * RDBAND = EPOLLRDBAND
    1657  * WRNORM = EPOLLWRNORM
     2325 * RDNORM = EPOLLRDNORM = c_EPOLLRDNORM             # <<<<<<<<<<<<<<
     2326 * RDBAND = EPOLLRDBAND = c_EPOLLRDBAND
     2327 * WRNORM = EPOLLWRNORM = c_EPOLLWRNORM
    16582328 */
    1659   __pyx_t_1 = PyInt_FromLong(EPOLLRDNORM); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2329  __pyx_t_1 = PyInt_FromLong(EPOLLRDNORM); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    16602330  __Pyx_GOTREF(__pyx_t_1);
    1661   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__RDNORM, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2331  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__RDNORM, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    16622332  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     2333  __pyx_t_1 = PyInt_FromLong(EPOLLRDNORM); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2334  __Pyx_GOTREF(__pyx_t_1);
     2335  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EPOLLRDNORM, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2336  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    16632337
    1664   /* "twisted/python/_epoll.pyx":177
     2338  /* "twisted/python/_epoll.pyx":282
    16652339 *
    1666  * RDNORM = EPOLLRDNORM
    1667  * RDBAND = EPOLLRDBAND             # <<<<<<<<<<<<<<
    1668  * WRNORM = EPOLLWRNORM
    1669  * WRBAND = EPOLLWRBAND
     2340 * RDNORM = EPOLLRDNORM = c_EPOLLRDNORM
     2341 * RDBAND = EPOLLRDBAND = c_EPOLLRDBAND             # <<<<<<<<<<<<<<
     2342 * WRNORM = EPOLLWRNORM = c_EPOLLWRNORM
     2343 * WRBAND = EPOLLWRBAND = c_EPOLLWRBAND
    16702344 */
    1671   __pyx_t_1 = PyInt_FromLong(EPOLLRDBAND); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2345  __pyx_t_1 = PyInt_FromLong(EPOLLRDBAND); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    16722346  __Pyx_GOTREF(__pyx_t_1);
    1673   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__RDBAND, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2347  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__RDBAND, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    16742348  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     2349  __pyx_t_1 = PyInt_FromLong(EPOLLRDBAND); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2350  __Pyx_GOTREF(__pyx_t_1);
     2351  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EPOLLRDBAND, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2352  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    16752353
    1676   /* "twisted/python/_epoll.pyx":178
    1677  * RDNORM = EPOLLRDNORM
    1678  * RDBAND = EPOLLRDBAND
    1679  * WRNORM = EPOLLWRNORM             # <<<<<<<<<<<<<<
    1680  * WRBAND = EPOLLWRBAND
    1681  * MSG = EPOLLMSG
     2354  /* "twisted/python/_epoll.pyx":283
     2355 * RDNORM = EPOLLRDNORM = c_EPOLLRDNORM
     2356 * RDBAND = EPOLLRDBAND = c_EPOLLRDBAND
     2357 * WRNORM = EPOLLWRNORM = c_EPOLLWRNORM             # <<<<<<<<<<<<<<
     2358 * WRBAND = EPOLLWRBAND = c_EPOLLWRBAND
     2359 * MSG = EPOLLMSG = c_EPOLLMSG
    16822360 */
    1683   __pyx_t_1 = PyInt_FromLong(EPOLLWRNORM); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2361  __pyx_t_1 = PyInt_FromLong(EPOLLWRNORM); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    16842362  __Pyx_GOTREF(__pyx_t_1);
    1685   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__WRNORM, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2363  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__WRNORM, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    16862364  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     2365  __pyx_t_1 = PyInt_FromLong(EPOLLWRNORM); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2366  __Pyx_GOTREF(__pyx_t_1);
     2367  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EPOLLWRNORM, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2368  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    16872369
    1688   /* "twisted/python/_epoll.pyx":179
    1689  * RDBAND = EPOLLRDBAND
    1690  * WRNORM = EPOLLWRNORM
    1691  * WRBAND = EPOLLWRBAND             # <<<<<<<<<<<<<<
    1692  * MSG = EPOLLMSG
    1693  *
     2370  /* "twisted/python/_epoll.pyx":284
     2371 * RDBAND = EPOLLRDBAND = c_EPOLLRDBAND
     2372 * WRNORM = EPOLLWRNORM = c_EPOLLWRNORM
     2373 * WRBAND = EPOLLWRBAND = c_EPOLLWRBAND             # <<<<<<<<<<<<<<
     2374 * MSG = EPOLLMSG = c_EPOLLMSG
    16942375 */
    1695   __pyx_t_1 = PyInt_FromLong(EPOLLWRBAND); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2376  __pyx_t_1 = PyInt_FromLong(EPOLLWRBAND); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    16962377  __Pyx_GOTREF(__pyx_t_1);
    1697   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__WRBAND, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2378  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__WRBAND, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    16982379  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     2380  __pyx_t_1 = PyInt_FromLong(EPOLLWRBAND); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2381  __Pyx_GOTREF(__pyx_t_1);
     2382  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EPOLLWRBAND, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2383  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    16992384
    1700   /* "twisted/python/_epoll.pyx":180
    1701  * WRNORM = EPOLLWRNORM
    1702  * WRBAND = EPOLLWRBAND
    1703  * MSG = EPOLLMSG             # <<<<<<<<<<<<<<
    1704  *
     2385  /* "twisted/python/_epoll.pyx":285
     2386 * WRNORM = EPOLLWRNORM = c_EPOLLWRNORM
     2387 * WRBAND = EPOLLWRBAND = c_EPOLLWRBAND
     2388 * MSG = EPOLLMSG = c_EPOLLMSG             # <<<<<<<<<<<<<<
    17052389 */
    1706   __pyx_t_1 = PyInt_FromLong(EPOLLMSG); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2390  __pyx_t_1 = PyInt_FromLong(EPOLLMSG); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    17072391  __Pyx_GOTREF(__pyx_t_1);
    1708   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__MSG, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2392  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__MSG, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    17092393  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     2394  __pyx_t_1 = PyInt_FromLong(EPOLLMSG); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2395  __Pyx_GOTREF(__pyx_t_1);
     2396  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EPOLLMSG, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     2397  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    17102398
    17112399  /* "twisted/python/_epoll.pyx":1
    17122400 * # Copyright (c) Twisted Matrix Laboratories.             # <<<<<<<<<<<<<<
     
    17212409  __pyx_L1_error:;
    17222410  __Pyx_XDECREF(__pyx_t_1);
    17232411  if (__pyx_m) {
    1724     __Pyx_AddTraceback("init twisted.python._epoll");
     2412    __Pyx_AddTraceback("init twisted.python._epoll", __pyx_clineno, __pyx_lineno, __pyx_filename);
    17252413    Py_DECREF(__pyx_m); __pyx_m = 0;
    17262414  } else if (!PyErr_Occurred()) {
    17272415    PyErr_SetString(PyExc_ImportError, "init twisted.python._epoll");
     
    17372425
    17382426/* Runtime support code */
    17392427
     2428#if CYTHON_REFNANNY
     2429static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
     2430    PyObject *m = NULL, *p = NULL;
     2431    void *r = NULL;
     2432    m = PyImport_ImportModule((char *)modname);
     2433    if (!m) goto end;
     2434    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
     2435    if (!p) goto end;
     2436    r = PyLong_AsVoidPtr(p);
     2437end:
     2438    Py_XDECREF(p);
     2439    Py_XDECREF(m);
     2440    return (__Pyx_RefNannyAPIStruct *)r;
     2441}
     2442#endif /* CYTHON_REFNANNY */
     2443
    17402444static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
    17412445    PyObject *result;
    17422446    result = PyObject_GetAttr(dict, name);
    1743     if (!result)
    1744         PyErr_SetObject(PyExc_NameError, name);
    1745     return result;
    1746 }
    1747 
    1748 static void __Pyx_RaiseDoubleKeywordsError(
    1749     const char* func_name,
    1750     PyObject* kw_name)
    1751 {
    1752     PyErr_Format(PyExc_TypeError,
    1753         #if PY_MAJOR_VERSION >= 3
    1754         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
    1755         #else
    1756         "%s() got multiple values for keyword argument '%s'", func_name,
    1757         PyString_AS_STRING(kw_name));
    1758         #endif
    1759 }
    1760 
    1761 static int __Pyx_ParseOptionalKeywords(
    1762     PyObject *kwds,
    1763     PyObject **argnames[],
    1764     PyObject *kwds2,
    1765     PyObject *values[],
    1766     Py_ssize_t num_pos_args,
    1767     const char* function_name)
    1768 {
    1769     PyObject *key = 0, *value = 0;
    1770     Py_ssize_t pos = 0;
    1771     PyObject*** name;
    1772     PyObject*** first_kw_arg = argnames + num_pos_args;
    1773 
    1774     while (PyDict_Next(kwds, &pos, &key, &value)) {
    1775         name = first_kw_arg;
    1776         while (*name && (**name != key)) name++;
    1777         if (*name) {
    1778             values[name-argnames] = value;
    1779         } else {
    1780             #if PY_MAJOR_VERSION < 3
    1781             if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
    1782             #else
    1783             if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
    1784             #endif
    1785                 goto invalid_keyword_type;
    1786             } else {
    1787                 for (name = first_kw_arg; *name; name++) {
    1788                     #if PY_MAJOR_VERSION >= 3
    1789                     if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
    1790                         PyUnicode_Compare(**name, key) == 0) break;
    1791                     #else
    1792                     if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
    1793                         _PyString_Eq(**name, key)) break;
    1794                     #endif
    1795                 }
    1796                 if (*name) {
    1797                     values[name-argnames] = value;
    1798                 } else {
    1799                     /* unexpected keyword found */
    1800                     for (name=argnames; name != first_kw_arg; name++) {
    1801                         if (**name == key) goto arg_passed_twice;
    1802                         #if PY_MAJOR_VERSION >= 3
    1803                         if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
    1804                             PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
    1805                         #else
    1806                         if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
    1807                             _PyString_Eq(**name, key)) goto arg_passed_twice;
    1808                         #endif
    1809                     }
    1810                     if (kwds2) {
    1811                         if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
    1812                     } else {
    1813                         goto invalid_keyword;
    1814                     }
    1815                 }
    1816             }
     2447    if (!result) {
     2448        if (dict != __pyx_b) {
     2449            PyErr_Clear();
     2450            result = PyObject_GetAttr(__pyx_b, name);
    18172451        }
     2452        if (!result) {
     2453            PyErr_SetObject(PyExc_NameError, name);
     2454        }
    18182455    }
    1819     return 0;
    1820 arg_passed_twice:
    1821     __Pyx_RaiseDoubleKeywordsError(function_name, **name);
    1822     goto bad;
    1823 invalid_keyword_type:
    1824     PyErr_Format(PyExc_TypeError,
    1825         "%s() keywords must be strings", function_name);
    1826     goto bad;
    1827 invalid_keyword:
    1828     PyErr_Format(PyExc_TypeError,
    1829     #if PY_MAJOR_VERSION < 3
    1830         "%s() got an unexpected keyword argument '%s'",
    1831         function_name, PyString_AsString(key));
    1832     #else
    1833         "%s() got an unexpected keyword argument '%U'",
    1834         function_name, key);
    1835     #endif
    1836 bad:
    1837     return -1;
     2456    return result;
    18382457}
    18392458
    1840 static void __Pyx_RaiseArgtupleInvalid(
    1841     const char* func_name,
    1842     int exact,
    1843     Py_ssize_t num_min,
    1844     Py_ssize_t num_max,
    1845     Py_ssize_t num_found)
    1846 {
    1847     Py_ssize_t num_expected;
    1848     const char *number, *more_or_less;
    1849 
    1850     if (num_found < num_min) {
    1851         num_expected = num_min;
    1852         more_or_less = "at least";
    1853     } else {
    1854         num_expected = num_max;
    1855         more_or_less = "at most";
    1856     }
    1857     if (exact) {
    1858         more_or_less = "exactly";
    1859     }
    1860     number = (num_expected == 1) ? "" : "s";
    1861     PyErr_Format(PyExc_TypeError,
    1862         #if PY_VERSION_HEX < 0x02050000
    1863             "%s() takes %s %d positional argument%s (%d given)",
    1864         #else
    1865             "%s() takes %s %zd positional argument%s (%zd given)",
    1866         #endif
    1867         func_name, more_or_less, num_expected, number, num_found);
    1868 }
    1869 
    18702459static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
    18712460    PyObject *tmp_type, *tmp_value, *tmp_tb;
    18722461    PyThreadState *tstate = PyThreadState_GET();
     
    18952484
    18962485
    18972486#if PY_MAJOR_VERSION < 3
    1898 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
     2487static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
     2488    /* cause is unused */
    18992489    Py_XINCREF(type);
    19002490    Py_XINCREF(value);
    19012491    Py_XINCREF(tb);
     
    19622552
    19632553#else /* Python 3+ */
    19642554
    1965 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
     2555static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    19662556    if (tb == Py_None) {
    19672557        tb = 0;
    19682558    } else if (tb && !PyTraceBack_Check(tb)) {
     
    19872577        goto bad;
    19882578    }
    19892579
     2580    if (cause) {
     2581        PyObject *fixed_cause;
     2582        if (PyExceptionClass_Check(cause)) {
     2583            fixed_cause = PyObject_CallObject(cause, NULL);
     2584            if (fixed_cause == NULL)
     2585                goto bad;
     2586        }
     2587        else if (PyExceptionInstance_Check(cause)) {
     2588            fixed_cause = cause;
     2589            Py_INCREF(fixed_cause);
     2590        }
     2591        else {
     2592            PyErr_SetString(PyExc_TypeError,
     2593                            "exception causes must derive from "
     2594                            "BaseException");
     2595            goto bad;
     2596        }
     2597        if (!value) {
     2598            value = PyObject_CallObject(type, NULL);
     2599        }
     2600        PyException_SetCause(value, fixed_cause);
     2601    }
     2602
    19902603    PyErr_SetObject(type, value);
    19912604
    19922605    if (tb) {
     
    20042617}
    20052618#endif
    20062619
     2620static void __Pyx_RaiseDoubleKeywordsError(
     2621    const char* func_name,
     2622    PyObject* kw_name)
     2623{
     2624    PyErr_Format(PyExc_TypeError,
     2625        #if PY_MAJOR_VERSION >= 3
     2626        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
     2627        #else
     2628        "%s() got multiple values for keyword argument '%s'", func_name,
     2629        PyString_AS_STRING(kw_name));
     2630        #endif
     2631}
     2632
     2633static int __Pyx_ParseOptionalKeywords(
     2634    PyObject *kwds,
     2635    PyObject **argnames[],
     2636    PyObject *kwds2,
     2637    PyObject *values[],
     2638    Py_ssize_t num_pos_args,
     2639    const char* function_name)
     2640{
     2641    PyObject *key = 0, *value = 0;
     2642    Py_ssize_t pos = 0;
     2643    PyObject*** name;
     2644    PyObject*** first_kw_arg = argnames + num_pos_args;
     2645
     2646    while (PyDict_Next(kwds, &pos, &key, &value)) {
     2647        name = first_kw_arg;
     2648        while (*name && (**name != key)) name++;
     2649        if (*name) {
     2650            values[name-argnames] = value;
     2651        } else {
     2652            #if PY_MAJOR_VERSION < 3
     2653            if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
     2654            #else
     2655            if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
     2656            #endif
     2657                goto invalid_keyword_type;
     2658            } else {
     2659                for (name = first_kw_arg; *name; name++) {
     2660                    #if PY_MAJOR_VERSION >= 3
     2661                    if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
     2662                        PyUnicode_Compare(**name, key) == 0) break;
     2663                    #else
     2664                    if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
     2665                        _PyString_Eq(**name, key)) break;
     2666                    #endif
     2667                }
     2668                if (*name) {
     2669                    values[name-argnames] = value;
     2670                } else {
     2671                    /* unexpected keyword found */
     2672                    for (name=argnames; name != first_kw_arg; name++) {
     2673                        if (**name == key) goto arg_passed_twice;
     2674                        #if PY_MAJOR_VERSION >= 3
     2675                        if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
     2676                            PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
     2677                        #else
     2678                        if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
     2679                            _PyString_Eq(**name, key)) goto arg_passed_twice;
     2680                        #endif
     2681                    }
     2682                    if (kwds2) {
     2683                        if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
     2684                    } else {
     2685                        goto invalid_keyword;
     2686                    }
     2687                }
     2688            }
     2689        }
     2690    }
     2691    return 0;
     2692arg_passed_twice:
     2693    __Pyx_RaiseDoubleKeywordsError(function_name, **name);
     2694    goto bad;
     2695invalid_keyword_type:
     2696    PyErr_Format(PyExc_TypeError,
     2697        "%s() keywords must be strings", function_name);
     2698    goto bad;
     2699invalid_keyword:
     2700    PyErr_Format(PyExc_TypeError,
     2701    #if PY_MAJOR_VERSION < 3
     2702        "%s() got an unexpected keyword argument '%s'",
     2703        function_name, PyString_AsString(key));
     2704    #else
     2705        "%s() got an unexpected keyword argument '%U'",
     2706        function_name, key);
     2707    #endif
     2708bad:
     2709    return -1;
     2710}
     2711
     2712static void __Pyx_RaiseArgtupleInvalid(
     2713    const char* func_name,
     2714    int exact,
     2715    Py_ssize_t num_min,
     2716    Py_ssize_t num_max,
     2717    Py_ssize_t num_found)
     2718{
     2719    Py_ssize_t num_expected;
     2720    const char *more_or_less;
     2721
     2722    if (num_found < num_min) {
     2723        num_expected = num_min;
     2724        more_or_less = "at least";
     2725    } else {
     2726        num_expected = num_max;
     2727        more_or_less = "at most";
     2728    }
     2729    if (exact) {
     2730        more_or_less = "exactly";
     2731    }
     2732    PyErr_Format(PyExc_TypeError,
     2733                 "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)",
     2734                 func_name, more_or_less, num_expected,
     2735                 (num_expected == 1) ? "" : "s", num_found);
     2736}
     2737
    20072738static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
    20082739    const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
    20092740    const int is_unsigned = neg_one > const_zero;
     
    22152946                                "can't convert negative value to unsigned long");
    22162947                return (unsigned long)-1;
    22172948            }
    2218             return PyLong_AsUnsignedLong(x);
     2949            return (unsigned long)PyLong_AsUnsignedLong(x);
    22192950        } else {
    2220             return PyLong_AsLong(x);
     2951            return (unsigned long)PyLong_AsLong(x);
    22212952        }
    22222953    } else {
    22232954        unsigned long val;
     
    22502981                                "can't convert negative value to unsigned PY_LONG_LONG");
    22512982                return (unsigned PY_LONG_LONG)-1;
    22522983            }
    2253             return PyLong_AsUnsignedLongLong(x);
     2984            return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
    22542985        } else {
    2255             return PyLong_AsLongLong(x);
     2986            return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
    22562987        }
    22572988    } else {
    22582989        unsigned PY_LONG_LONG val;
     
    22853016                                "can't convert negative value to long");
    22863017                return (long)-1;
    22873018            }
    2288             return PyLong_AsUnsignedLong(x);
     3019            return (long)PyLong_AsUnsignedLong(x);
    22893020        } else {
    2290             return PyLong_AsLong(x);
     3021            return (long)PyLong_AsLong(x);
    22913022        }
    22923023    } else {
    22933024        long val;
     
    23203051                                "can't convert negative value to PY_LONG_LONG");
    23213052                return (PY_LONG_LONG)-1;
    23223053            }
    2323             return PyLong_AsUnsignedLongLong(x);
     3054            return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
    23243055        } else {
    2325             return PyLong_AsLongLong(x);
     3056            return (PY_LONG_LONG)PyLong_AsLongLong(x);
    23263057        }
    23273058    } else {
    23283059        PY_LONG_LONG val;
     
    23553086                                "can't convert negative value to signed long");
    23563087                return (signed long)-1;
    23573088            }
    2358             return PyLong_AsUnsignedLong(x);
     3089            return (signed long)PyLong_AsUnsignedLong(x);
    23593090        } else {
    2360             return PyLong_AsLong(x);
     3091            return (signed long)PyLong_AsLong(x);
    23613092        }
    23623093    } else {
    23633094        signed long val;
     
    23903121                                "can't convert negative value to signed PY_LONG_LONG");
    23913122                return (signed PY_LONG_LONG)-1;
    23923123            }
    2393             return PyLong_AsUnsignedLongLong(x);
     3124            return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
    23943125        } else {
    2395             return PyLong_AsLongLong(x);
     3126            return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
    23963127        }
    23973128    } else {
    23983129        signed PY_LONG_LONG val;
     
    24043135    }
    24053136}
    24063137
     3138static int __Pyx_check_binary_version(void) {
     3139    char ctversion[4], rtversion[4];
     3140    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
     3141    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
     3142    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
     3143        char message[200];
     3144        PyOS_snprintf(message, sizeof(message),
     3145                      "compiletime version %s of module '%.100s' "
     3146                      "does not match runtime version %s",
     3147                      ctversion, __Pyx_MODULE_NAME, rtversion);
     3148        #if PY_VERSION_HEX < 0x02050000
     3149        return PyErr_Warn(NULL, message);
     3150        #else
     3151        return PyErr_WarnEx(NULL, message, 1);
     3152        #endif
     3153    }
     3154    return 0;
     3155}
     3156
    24073157#include "compile.h"
    24083158#include "frameobject.h"
    24093159#include "traceback.h"
    24103160
    2411 static void __Pyx_AddTraceback(const char *funcname) {
     3161static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
     3162                               int __pyx_lineno, const char *__pyx_filename) {
    24123163    PyObject *py_srcfile = 0;
    24133164    PyObject *py_funcname = 0;
    24143165    PyObject *py_globals = 0;
  • twisted/internet/epollreactor.py

     
    1212"""
    1313
    1414import errno
     15import time
    1516
    1617from zope.interface import implements
    1718
    1819from twisted.internet.interfaces import IReactorFDSet
    1920
    20 from twisted.python import log, _epoll
     21from twisted.python import log
    2122from twisted.internet import posixbase
    2223
     24try:
     25    # In Python 2.6+, select.epoll provides epoll functionality. Try to import
     26    # it, and fall back to Twisted's own epoll wrapper if it isn't available
     27    # for any reason.
     28    from select import epoll
     29    del epoll
     30    import select as _epoll
     31except ImportError:
     32    from twisted.python import _epoll
    2333
     34
    2435class EPollReactor(posixbase.PosixReactorBase, posixbase._PollLikeMixin):
    2536    """
    2637    A reactor that uses epoll(4).
     
    4960    implements(IReactorFDSet)
    5061
    5162    # Attributes for _PollLikeMixin
    52     _POLL_DISCONNECTED = (_epoll.HUP | _epoll.ERR)
    53     _POLL_IN = _epoll.IN
    54     _POLL_OUT = _epoll.OUT
     63    _POLL_DISCONNECTED = (_epoll.EPOLLHUP | _epoll.EPOLLERR)
     64    _POLL_IN = _epoll.EPOLLIN
     65    _POLL_OUT = _epoll.EPOLLOUT
    5566
    5667    def __init__(self):
    5768        """
     
    7788        """
    7889        fd = xer.fileno()
    7990        if fd not in primary:
    80             cmd = _epoll.CTL_ADD
    8191            flags = event
    82             if fd in other:
    83                 flags |= antievent
    84                 cmd = _epoll.CTL_MOD
    8592            # epoll_ctl can raise all kinds of IOErrors, and every one
    8693            # indicates a bug either in the reactor or application-code.
    8794            # Let them all through so someone sees a traceback and fixes
    8895            # something.  We'll do the same thing for every other call to
    8996            # this method in this file.
    90             self._poller._control(cmd, fd, flags)
     97            if fd in other:
     98                flags |= antievent
     99                self._poller.modify(fd, flags)
     100            else:
     101                self._poller.register(fd, flags)
    91102
    92103            # Update our own tracking state *only* after the epoll call has
    93104            # succeeded.  Otherwise we may get out of sync.
     
    99110        """
    100111        Add a FileDescriptor for notification of data available to read.
    101112        """
    102         self._add(reader, self._reads, self._writes, self._selectables, _epoll.IN, _epoll.OUT)
     113        self._add(reader, self._reads, self._writes, self._selectables, _epoll.EPOLLIN, _epoll.EPOLLOUT)
    103114
    104115
    105116    def addWriter(self, writer):
    106117        """
    107118        Add a FileDescriptor for notification of data available to write.
    108119        """
    109         self._add(writer, self._writes, self._reads, self._selectables, _epoll.OUT, _epoll.IN)
     120        self._add(writer, self._writes, self._reads, self._selectables, _epoll.EPOLLOUT, _epoll.EPOLLIN)
    110121
    111122
    112123    def _remove(self, xer, primary, other, selectables, event, antievent):
     
    124135            else:
    125136                return
    126137        if fd in primary:
    127             cmd = _epoll.CTL_DEL
    128             flags = event
    129138            if fd in other:
    130139                flags = antievent
    131                 cmd = _epoll.CTL_MOD
     140                # See comment above modify call in _add.
     141                self._poller.modify(fd, flags)
    132142            else:
    133143                del selectables[fd]
     144                # See comment above _control call in _add.
     145                self._poller.unregister(fd)
    134146            del primary[fd]
    135             # See comment above _control call in _add.
    136             self._poller._control(cmd, fd, flags)
    137147
    138148
    139149    def removeReader(self, reader):
    140150        """
    141151        Remove a Selectable for notification of data available to read.
    142152        """
    143         self._remove(reader, self._reads, self._writes, self._selectables, _epoll.IN, _epoll.OUT)
     153        self._remove(reader, self._reads, self._writes, self._selectables, _epoll.EPOLLIN, _epoll.EPOLLOUT)
    144154
    145155
    146156    def removeWriter(self, writer):
    147157        """
    148158        Remove a Selectable for notification of data available to write.
    149159        """
    150         self._remove(writer, self._writes, self._reads, self._selectables, _epoll.OUT, _epoll.IN)
     160        self._remove(writer, self._writes, self._reads, self._selectables, _epoll.EPOLLOUT, _epoll.EPOLLIN)
    151161
    152162    def removeAll(self):
    153163        """
     
    171181        Poll the poller for new events.
    172182        """
    173183        if timeout is None:
    174             timeout = 1
    175         timeout = int(timeout * 1000) # convert seconds to milliseconds
     184            timeout = -1  # Wait indefinitely.
    176185
    177186        try:
    178             # Limit the number of events to the number of io objects we're
    179             # currently tracking (because that's maybe a good heuristic) and
    180             # the amount of time we block to the value specified by our
    181             # caller.
    182             l = self._poller.wait(len(self._selectables), timeout)
     187            if self._selectables:
     188                # Limit the number of events to the number of io objects
     189                # we're currently tracking (because that's maybe a good
     190                # heuristic) and the amount of time we block to the value
     191                # specified by our caller.
     192                l = self._poller.poll(timeout, len(self._selectables))
     193            else:
     194                # select.epoll.poll doesn't let us wait for no filehandle,
     195                # so we just sleep here.
     196                time.sleep(timeout)
    183197        except IOError, err:
    184198            if err.errno == errno.EINTR:
    185199                return