Ticket #5847: remove-epoll.patch

File remove-epoll.patch, 156.4 KB (added by vperic, 4 years ago)
  • twisted/internet/epollreactor.py

    diff --git twisted/internet/epollreactor.py twisted/internet/epollreactor.py
    index f892d6b..c70744f 100644
    listeners or connectors are added):: 
    1212"""
    1313
    1414import errno
     15import select
    1516
    1617from zope.interface import implements
    1718
    from twisted.internet.interfaces import IReactorFDSet 
    2021from twisted.python import log
    2122from twisted.internet import posixbase
    2223
    23 try:
    24     # In Python 2.6+, select.epoll provides epoll functionality. Try to import
    25     # it, and fall back to Twisted's own epoll wrapper if it isn't available
    26     # for any reason.
    27     from select import epoll
    28 except ImportError:
    29     from twisted.python import _epoll
    30 else:
    31     del epoll
    32     import select as _epoll
    33 
    3424
    3525
    3626class _ContinuousPolling(posixbase._PollLikeMixin,
    class EPollReactor(posixbase.PosixReactorBase, posixbase._PollLikeMixin): 
    198188    implements(IReactorFDSet)
    199189
    200190    # Attributes for _PollLikeMixin
    201     _POLL_DISCONNECTED = (_epoll.EPOLLHUP | _epoll.EPOLLERR)
    202     _POLL_IN = _epoll.EPOLLIN
    203     _POLL_OUT = _epoll.EPOLLOUT
     191    _POLL_DISCONNECTED = (select.EPOLLHUP | select.EPOLLERR)
     192    _POLL_IN = select.EPOLLIN
     193    _POLL_OUT = select.EPOLLOUT
    204194
    205195    def __init__(self):
    206196        """
    class EPollReactor(posixbase.PosixReactorBase, posixbase._PollLikeMixin): 
    210200        # Create the poller we're going to use.  The 1024 here is just a hint to
    211201        # the kernel, it is not a hard maximum.  After Linux 2.6.8, the size
    212202        # argument is completely ignored.
    213         self._poller = _epoll.epoll(1024)
     203        self._poller = select.epoll(1024)
    214204        self._reads = {}
    215205        self._writes = {}
    216206        self._selectables = {}
    class EPollReactor(posixbase.PosixReactorBase, posixbase._PollLikeMixin): 
    251241        """
    252242        try:
    253243            self._add(reader, self._reads, self._writes, self._selectables,
    254                       _epoll.EPOLLIN, _epoll.EPOLLOUT)
     244                      select.EPOLLIN, select.EPOLLOUT)
    255245        except IOError, e:
    256246            if e.errno == errno.EPERM:
    257247                # epoll(7) doesn't support certain file descriptors,
    class EPollReactor(posixbase.PosixReactorBase, posixbase._PollLikeMixin): 
    268258        """
    269259        try:
    270260            self._add(writer, self._writes, self._reads, self._selectables,
    271                       _epoll.EPOLLOUT, _epoll.EPOLLIN)
     261                      select.EPOLLOUT, select.EPOLLIN)
    272262        except IOError, e:
    273263            if e.errno == errno.EPERM:
    274264                # epoll(7) doesn't support certain file descriptors,
    class EPollReactor(posixbase.PosixReactorBase, posixbase._PollLikeMixin): 
    313303            self._continuousPolling.removeReader(reader)
    314304            return
    315305        self._remove(reader, self._reads, self._writes, self._selectables,
    316                      _epoll.EPOLLIN, _epoll.EPOLLOUT)
     306                     select.EPOLLIN, select.EPOLLOUT)
    317307
    318308
    319309    def removeWriter(self, writer):
    class EPollReactor(posixbase.PosixReactorBase, posixbase._PollLikeMixin): 
    324314            self._continuousPolling.removeWriter(writer)
    325315            return
    326316        self._remove(writer, self._writes, self._reads, self._selectables,
    327                      _epoll.EPOLLOUT, _epoll.EPOLLIN)
     317                     select.EPOLLOUT, select.EPOLLIN)
    328318
    329319
    330320    def removeAll(self):
  • deleted file twisted/python/_epoll.c

    diff --git twisted/python/_epoll.c twisted/python/_epoll.c
    deleted file mode 100644
    index dffbe25..0000000
    + -  
    1 /* Generated by Cython 0.15.1 on Fri Feb 17 23:33:28 2012 */
    2 
    3 #define PY_SSIZE_T_CLEAN
    4 #include "Python.h"
    5 #ifndef Py_PYTHON_H
    6     #error Python headers needed to compile C extensions, please install development version of Python.
    7 #else
    8 
    9 #include <stddef.h> /* For offsetof */
    10 #ifndef offsetof
    11 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
    12 #endif
    13 
    14 #if !defined(WIN32) && !defined(MS_WINDOWS)
    15   #ifndef __stdcall
    16     #define __stdcall
    17   #endif
    18   #ifndef __cdecl
    19     #define __cdecl
    20   #endif
    21   #ifndef __fastcall
    22     #define __fastcall
    23   #endif
    24 #endif
    25 
    26 #ifndef DL_IMPORT
    27   #define DL_IMPORT(t) t
    28 #endif
    29 #ifndef DL_EXPORT
    30   #define DL_EXPORT(t) t
    31 #endif
    32 
    33 #ifndef PY_LONG_LONG
    34   #define PY_LONG_LONG LONG_LONG
    35 #endif
    36 
    37 #if PY_VERSION_HEX < 0x02040000
    38   #define METH_COEXIST 0
    39   #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
    40   #define PyDict_Contains(d,o)   PySequence_Contains(d,o)
    41 #endif
    42 
    43 #if PY_VERSION_HEX < 0x02050000
    44   typedef int Py_ssize_t;
    45   #define PY_SSIZE_T_MAX INT_MAX
    46   #define PY_SSIZE_T_MIN INT_MIN
    47   #define PY_FORMAT_SIZE_T ""
    48   #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
    49   #define PyInt_AsSsize_t(o)   __Pyx_PyInt_AsInt(o)
    50   #define PyNumber_Index(o)    PyNumber_Int(o)
    51   #define PyIndex_Check(o)     PyNumber_Check(o)
    52   #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
    53 #endif
    54 
    55 #if PY_VERSION_HEX < 0x02060000
    56   #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
    57   #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
    58   #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
    59   #define PyVarObject_HEAD_INIT(type, size) \
    60           PyObject_HEAD_INIT(type) size,
    61   #define PyType_Modified(t)
    62 
    63   typedef struct {
    64      void *buf;
    65      PyObject *obj;
    66      Py_ssize_t len;
    67      Py_ssize_t itemsize;
    68      int readonly;
    69      int ndim;
    70      char *format;
    71      Py_ssize_t *shape;
    72      Py_ssize_t *strides;
    73      Py_ssize_t *suboffsets;
    74      void *internal;
    75   } Py_buffer;
    76 
    77   #define PyBUF_SIMPLE 0
    78   #define PyBUF_WRITABLE 0x0001
    79   #define PyBUF_FORMAT 0x0004
    80   #define PyBUF_ND 0x0008
    81   #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
    82   #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
    83   #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
    84   #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
    85   #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
    86 
    87 #endif
    88 
    89 #if PY_MAJOR_VERSION < 3
    90   #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
    91 #else
    92   #define __Pyx_BUILTIN_MODULE_NAME "builtins"
    93 #endif
    94 
    95 #if PY_MAJOR_VERSION >= 3
    96   #define Py_TPFLAGS_CHECKTYPES 0
    97   #define Py_TPFLAGS_HAVE_INDEX 0
    98 #endif
    99 
    100 #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
    101   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
    102 #endif
    103 
    104 #if PY_MAJOR_VERSION >= 3
    105   #define PyBaseString_Type            PyUnicode_Type
    106   #define PyStringObject               PyUnicodeObject
    107   #define PyString_Type                PyUnicode_Type
    108   #define PyString_Check               PyUnicode_Check
    109   #define PyString_CheckExact          PyUnicode_CheckExact
    110 #endif
    111 
    112 #if PY_VERSION_HEX < 0x02060000
    113   #define PyBytesObject                PyStringObject
    114   #define PyBytes_Type                 PyString_Type
    115   #define PyBytes_Check                PyString_Check
    116   #define PyBytes_CheckExact           PyString_CheckExact
    117   #define PyBytes_FromString           PyString_FromString
    118   #define PyBytes_FromStringAndSize    PyString_FromStringAndSize
    119   #define PyBytes_FromFormat           PyString_FromFormat
    120   #define PyBytes_DecodeEscape         PyString_DecodeEscape
    121   #define PyBytes_AsString             PyString_AsString
    122   #define PyBytes_AsStringAndSize      PyString_AsStringAndSize
    123   #define PyBytes_Size                 PyString_Size
    124   #define PyBytes_AS_STRING            PyString_AS_STRING
    125   #define PyBytes_GET_SIZE             PyString_GET_SIZE
    126   #define PyBytes_Repr                 PyString_Repr
    127   #define PyBytes_Concat               PyString_Concat
    128   #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
    129 #endif
    130 
    131 #if PY_VERSION_HEX < 0x02060000
    132   #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
    133   #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
    134 #endif
    135 #ifndef PySet_CheckExact
    136   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
    137 #endif
    138 
    139 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
    140 
    141 #if PY_MAJOR_VERSION >= 3
    142   #define PyIntObject                  PyLongObject
    143   #define PyInt_Type                   PyLong_Type
    144   #define PyInt_Check(op)              PyLong_Check(op)
    145   #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
    146   #define PyInt_FromString             PyLong_FromString
    147   #define PyInt_FromUnicode            PyLong_FromUnicode
    148   #define PyInt_FromLong               PyLong_FromLong
    149   #define PyInt_FromSize_t             PyLong_FromSize_t
    150   #define PyInt_FromSsize_t            PyLong_FromSsize_t
    151   #define PyInt_AsLong                 PyLong_AsLong
    152   #define PyInt_AS_LONG                PyLong_AS_LONG
    153   #define PyInt_AsSsize_t              PyLong_AsSsize_t
    154   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
    155   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
    156 #endif
    157 
    158 #if PY_MAJOR_VERSION >= 3
    159   #define PyBoolObject                 PyLongObject
    160 #endif
    161 
    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
    170 
    171 
    172 #if PY_MAJOR_VERSION >= 3
    173   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
    174   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
    175 #else
    176   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
    177   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
    178 #endif
    179 
    180 #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
    181   #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
    182   #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
    183   #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
    184 #else
    185   #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
    186         (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
    187         (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
    188             (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
    189   #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
    190         (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
    191         (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
    192             (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
    193   #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
    194         (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
    195         (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
    196             (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
    197 #endif
    198 
    199 #if PY_MAJOR_VERSION >= 3
    200   #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
    201 #endif
    202 
    203 #if PY_VERSION_HEX < 0x02050000
    204   #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
    205   #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
    206   #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),((char *)(n)))
    207 #else
    208   #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),(n))
    209   #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
    210   #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
    211 #endif
    212 
    213 #if PY_VERSION_HEX < 0x02050000
    214   #define __Pyx_NAMESTR(n) ((char *)(n))
    215   #define __Pyx_DOCSTR(n)  ((char *)(n))
    216 #else
    217   #define __Pyx_NAMESTR(n) (n)
    218   #define __Pyx_DOCSTR(n)  (n)
    219 #endif
    220 
    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
    227 #endif
    228 
    229 #if defined(WIN32) || defined(MS_WINDOWS)
    230 #define _USE_MATH_DEFINES
    231 #endif
    232 #include <math.h>
    233 #define __PYX_HAVE__twisted__python___epoll
    234 #define __PYX_HAVE_API__twisted__python___epoll
    235 #include "stdio.h"
    236 #include "errno.h"
    237 #include "string.h"
    238 #include "stdint.h"
    239 #include "sys/epoll.h"
    240 #ifdef _OPENMP
    241 #include <omp.h>
    242 #endif /* _OPENMP */
    243 
    244 #ifdef PYREX_WITHOUT_ASSERTIONS
    245 #define CYTHON_WITHOUT_ASSERTIONS
    246 #endif
    247 
    248 
    249 /* inline attribute */
    250 #ifndef CYTHON_INLINE
    251   #if defined(__GNUC__)
    252     #define CYTHON_INLINE __inline__
    253   #elif defined(_MSC_VER)
    254     #define CYTHON_INLINE __inline
    255   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    256     #define CYTHON_INLINE inline
    257   #else
    258     #define CYTHON_INLINE
    259   #endif
    260 #endif
    261 
    262 /* unused attribute */
    263 #ifndef CYTHON_UNUSED
    264 # if defined(__GNUC__)
    265 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
    266 #     define CYTHON_UNUSED __attribute__ ((__unused__))
    267 #   else
    268 #     define CYTHON_UNUSED
    269 #   endif
    270 # elif defined(__ICC) || defined(__INTEL_COMPILER)
    271 #   define CYTHON_UNUSED __attribute__ ((__unused__))
    272 # else
    273 #   define CYTHON_UNUSED
    274 # endif
    275 #endif
    276 
    277 typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
    278 
    279 
    280 /* Type Conversion Predeclarations */
    281 
    282 #define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
    283 #define __Pyx_PyBytes_AsUString(s)   ((unsigned char*) PyBytes_AsString(s))
    284 
    285 #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
    286 #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
    287 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
    288 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
    289 
    290 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
    291 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
    292 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
    293 
    294 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
    295 
    296 
    297 #ifdef __GNUC__
    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 ... */
    306 #else /* __GNUC__ */
    307   #define likely(x)   (x)
    308   #define unlikely(x) (x)
    309 #endif /* __GNUC__ */
    310    
    311 static PyObject *__pyx_m;
    312 static PyObject *__pyx_b;
    313 static PyObject *__pyx_empty_tuple;
    314 static PyObject *__pyx_empty_bytes;
    315 static int __pyx_lineno;
    316 static int __pyx_clineno = 0;
    317 static const char * __pyx_cfilenm= __FILE__;
    318 static const char *__pyx_filename;
    319 
    320 
    321 static const char *__pyx_f[] = {
    322   "_epoll.pyx",
    323 };
    324 
    325 /*--- Type declarations ---*/
    326 struct __pyx_obj_7twisted_6python_6_epoll_epoll;
    327 
    328 /* "twisted/python/_epoll.pyx":106
    329  *         free(events)
    330  *
    331  * cdef class epoll:             # <<<<<<<<<<<<<<
    332  *     """
    333  *     Represent a set of file descriptors being monitored for events.
    334  */
    335 struct __pyx_obj_7twisted_6python_6_epoll_epoll {
    336   PyObject_HEAD
    337   int fd;
    338   int initialized;
    339 };
    340 
    341 
    342 #ifndef CYTHON_REFNANNY
    343   #define CYTHON_REFNANNY 0
    344 #endif
    345 
    346 #if CYTHON_REFNANNY
    347   typedef struct {
    348     void (*INCREF)(void*, PyObject*, int);
    349     void (*DECREF)(void*, PyObject*, int);
    350     void (*GOTREF)(void*, PyObject*, int);
    351     void (*GIVEREF)(void*, PyObject*, int);
    352     void* (*SetupContext)(const char*, int, const char*);
    353     void (*FinishContext)(void**);
    354   } __Pyx_RefNannyAPIStruct;
    355   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
    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__)
    359   #define __Pyx_RefNannyFinishContext()           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
    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__)
    363   #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
    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)
    368 #else
    369   #define __Pyx_RefNannyDeclarations
    370   #define __Pyx_RefNannySetupContext(name)
    371   #define __Pyx_RefNannyFinishContext()
    372   #define __Pyx_INCREF(r) Py_INCREF(r)
    373   #define __Pyx_DECREF(r) Py_DECREF(r)
    374   #define __Pyx_GOTREF(r)
    375   #define __Pyx_GIVEREF(r)
    376   #define __Pyx_XINCREF(r) Py_XINCREF(r)
    377   #define __Pyx_XDECREF(r) Py_XDECREF(r)
    378   #define __Pyx_XGOTREF(r)
    379   #define __Pyx_XGIVEREF(r)
    380 #endif /* CYTHON_REFNANNY */
    381 
    382 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
    383 
    384 static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
    385 static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
    386 
    387 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/
    388 
    389 static void __Pyx_RaiseDoubleKeywordsError(
    390     const char* func_name, PyObject* kw_name); /*proto*/
    391 
    392 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,     const char* function_name); /*proto*/
    393 
    394 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    395     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
    396 
    397 static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
    398 
    399 static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
    400 
    401 static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
    402 
    403 static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);
    404 
    405 static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);
    406 
    407 static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);
    408 
    409 static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
    410 
    411 static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
    412 
    413 static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
    414 
    415 static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);
    416 
    417 static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
    418 
    419 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
    420 
    421 static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);
    422 
    423 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
    424 
    425 static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
    426 
    427 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
    428 
    429 static int __Pyx_check_binary_version(void);
    430 
    431 static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
    432                                int __pyx_lineno, const char *__pyx_filename); /*proto*/
    433 
    434 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
    435 
    436 /* Module declarations from 'twisted.python._epoll' */
    437 static PyTypeObject *__pyx_ptype_7twisted_6python_6_epoll_epoll = 0;
    438 static PyObject *__pyx_f_7twisted_6python_6_epoll_call_epoll_wait(int, unsigned int, int); /*proto*/
    439 #define __Pyx_MODULE_NAME "twisted.python._epoll"
    440 int __pyx_module_is_main_twisted__python___epoll = 0;
    441 
    442 /* Implementation of 'twisted.python._epoll' */
    443 static PyObject *__pyx_builtin_IOError;
    444 static char __pyx_k_1[] = "\nInterface to epoll I/O event notification facility.\n";
    445 static char __pyx_k__ET[] = "ET";
    446 static char __pyx_k__IN[] = "IN";
    447 static char __pyx_k__fd[] = "fd";
    448 static char __pyx_k__op[] = "op";
    449 static char __pyx_k__ERR[] = "ERR";
    450 static char __pyx_k__HUP[] = "HUP";
    451 static char __pyx_k__MSG[] = "MSG";
    452 static char __pyx_k__OUT[] = "OUT";
    453 static char __pyx_k__PRI[] = "PRI";
    454 static char __pyx_k__size[] = "size";
    455 static char __pyx_k__RDBAND[] = "RDBAND";
    456 static char __pyx_k__RDNORM[] = "RDNORM";
    457 static char __pyx_k__WRBAND[] = "WRBAND";
    458 static char __pyx_k__WRNORM[] = "WRNORM";
    459 static char __pyx_k__events[] = "events";
    460 static char __pyx_k__CTL_ADD[] = "CTL_ADD";
    461 static char __pyx_k__CTL_DEL[] = "CTL_DEL";
    462 static char __pyx_k__CTL_MOD[] = "CTL_MOD";
    463 static char __pyx_k__EPOLLET[] = "EPOLLET";
    464 static char __pyx_k__EPOLLIN[] = "EPOLLIN";
    465 static char __pyx_k__IOError[] = "IOError";
    466 static char __pyx_k__timeout[] = "timeout";
    467 static char __pyx_k__EPOLLERR[] = "EPOLLERR";
    468 static char __pyx_k__EPOLLHUP[] = "EPOLLHUP";
    469 static char __pyx_k__EPOLLMSG[] = "EPOLLMSG";
    470 static char __pyx_k__EPOLLOUT[] = "EPOLLOUT";
    471 static char __pyx_k__EPOLLPRI[] = "EPOLLPRI";
    472 static char __pyx_k____main__[] = "__main__";
    473 static char __pyx_k____test__[] = "__test__";
    474 static char __pyx_k__maxevents[] = "maxevents";
    475 static char __pyx_k__EPOLLRDBAND[] = "EPOLLRDBAND";
    476 static char __pyx_k__EPOLLRDNORM[] = "EPOLLRDNORM";
    477 static char __pyx_k__EPOLLWRBAND[] = "EPOLLWRBAND";
    478 static char __pyx_k__EPOLLWRNORM[] = "EPOLLWRNORM";
    479 static PyObject *__pyx_n_s__CTL_ADD;
    480 static PyObject *__pyx_n_s__CTL_DEL;
    481 static PyObject *__pyx_n_s__CTL_MOD;
    482 static PyObject *__pyx_n_s__EPOLLERR;
    483 static PyObject *__pyx_n_s__EPOLLET;
    484 static PyObject *__pyx_n_s__EPOLLHUP;
    485 static PyObject *__pyx_n_s__EPOLLIN;
    486 static PyObject *__pyx_n_s__EPOLLMSG;
    487 static PyObject *__pyx_n_s__EPOLLOUT;
    488 static PyObject *__pyx_n_s__EPOLLPRI;
    489 static PyObject *__pyx_n_s__EPOLLRDBAND;
    490 static PyObject *__pyx_n_s__EPOLLRDNORM;
    491 static PyObject *__pyx_n_s__EPOLLWRBAND;
    492 static PyObject *__pyx_n_s__EPOLLWRNORM;
    493 static PyObject *__pyx_n_s__ERR;
    494 static PyObject *__pyx_n_s__ET;
    495 static PyObject *__pyx_n_s__HUP;
    496 static PyObject *__pyx_n_s__IN;
    497 static PyObject *__pyx_n_s__IOError;
    498 static PyObject *__pyx_n_s__MSG;
    499 static PyObject *__pyx_n_s__OUT;
    500 static PyObject *__pyx_n_s__PRI;
    501 static PyObject *__pyx_n_s__RDBAND;
    502 static PyObject *__pyx_n_s__RDNORM;
    503 static PyObject *__pyx_n_s__WRBAND;
    504 static PyObject *__pyx_n_s__WRNORM;
    505 static PyObject *__pyx_n_s____main__;
    506 static PyObject *__pyx_n_s____test__;
    507 static PyObject *__pyx_n_s__events;
    508 static PyObject *__pyx_n_s__fd;
    509 static PyObject *__pyx_n_s__maxevents;
    510 static PyObject *__pyx_n_s__op;
    511 static PyObject *__pyx_n_s__size;
    512 static PyObject *__pyx_n_s__timeout;
    513 
    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 
    522 static 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
    760  *     cdef int initialized
    761  *
    762  *     def __init__(self, int size=1023):             # <<<<<<<<<<<<<<
    763  *         """
    764  *         The constructor arguments are compatible with select.poll.__init__.
    765  */
    766 
    767 static int __pyx_pf_7twisted_6python_6_epoll_5epoll___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    768 static char __pyx_doc_7twisted_6python_6_epoll_5epoll___init__[] = "\n        The constructor arguments are compatible with select.poll.__init__.\n        ";
    769 struct wrapperbase __pyx_wrapperbase_7twisted_6python_6_epoll_5epoll___init__;
    770 static int __pyx_pf_7twisted_6python_6_epoll_5epoll___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
    771   int __pyx_v_size;
    772   int __pyx_r;
    773   __Pyx_RefNannyDeclarations
    774   int __pyx_t_1;
    775   PyObject *__pyx_t_2 = NULL;
    776   PyObject *__pyx_t_3 = NULL;
    777   PyObject *__pyx_t_4 = NULL;
    778   int __pyx_lineno = 0;
    779   const char *__pyx_filename = NULL;
    780   int __pyx_clineno = 0;
    781   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,0};
    782   __Pyx_RefNannySetupContext("__init__");
    783   {
    784     PyObject* values[1] = {0};
    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       }
    809     }
    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);
    814     }
    815   }
    816   goto __pyx_L4_argument_unpacking_done;
    817   __pyx_L5_argtuple_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;}
    819   __pyx_L3_error:;
    820   __Pyx_AddTraceback("twisted.python._epoll.epoll.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
    821   __Pyx_RefNannyFinishContext();
    822   return -1;
    823   __pyx_L4_argument_unpacking_done:;
    824 
    825   /* "twisted/python/_epoll.pyx":118
    826  *         The constructor arguments are compatible with select.poll.__init__.
    827  *         """
    828  *         self.fd = epoll_create(size)             # <<<<<<<<<<<<<<
    829  *         if self.fd == -1:
    830  *             raise IOError(errno, strerror(errno))
    831  */
    832   ((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd = epoll_create(__pyx_v_size);
    833 
    834   /* "twisted/python/_epoll.pyx":119
    835  *         """
    836  *         self.fd = epoll_create(size)
    837  *         if self.fd == -1:             # <<<<<<<<<<<<<<
    838  *             raise IOError(errno, strerror(errno))
    839  *         self.initialized = 1
    840  */
    841   __pyx_t_1 = (((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd == -1);
    842   if (__pyx_t_1) {
    843 
    844     /* "twisted/python/_epoll.pyx":120
    845  *         self.fd = epoll_create(size)
    846  *         if self.fd == -1:
    847  *             raise IOError(errno, strerror(errno))             # <<<<<<<<<<<<<<
    848  *         self.initialized = 1
    849  *
    850  */
    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;}
    852     __Pyx_GOTREF(__pyx_t_2);
    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;}
    854     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    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;}
    856     __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    857     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    858     __Pyx_GIVEREF(__pyx_t_2);
    859     PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_t_3));
    860     __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
    861     __pyx_t_2 = 0;
    862     __pyx_t_3 = 0;
    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;}
    864     __Pyx_GOTREF(__pyx_t_3);
    865     __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    866     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    867     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    868     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    869     goto __pyx_L6;
    870   }
    871   __pyx_L6:;
    872 
    873   /* "twisted/python/_epoll.pyx":121
    874  *         if self.fd == -1:
    875  *             raise IOError(errno, strerror(errno))
    876  *         self.initialized = 1             # <<<<<<<<<<<<<<
    877  *
    878  *     def __dealloc__(self):
    879  */
    880   ((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->initialized = 1;
    881 
    882   __pyx_r = 0;
    883   goto __pyx_L0;
    884   __pyx_L1_error:;
    885   __Pyx_XDECREF(__pyx_t_2);
    886   __Pyx_XDECREF(__pyx_t_3);
    887   __Pyx_XDECREF(__pyx_t_4);
    888   __Pyx_AddTraceback("twisted.python._epoll.epoll.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
    889   __pyx_r = -1;
    890   __pyx_L0:;
    891   __Pyx_RefNannyFinishContext();
    892   return __pyx_r;
    893 }
    894 
    895 /* "twisted/python/_epoll.pyx":123
    896  *         self.initialized = 1
    897  *
    898  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
    899  *         if self.initialized:
    900  *             close(self.fd)
    901  */
    902 
    903 static void __pyx_pf_7twisted_6python_6_epoll_5epoll_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
    904 static void __pyx_pf_7twisted_6python_6_epoll_5epoll_1__dealloc__(PyObject *__pyx_v_self) {
    905   __Pyx_RefNannyDeclarations
    906   __Pyx_RefNannySetupContext("__dealloc__");
    907 
    908   /* "twisted/python/_epoll.pyx":124
    909  *
    910  *     def __dealloc__(self):
    911  *         if self.initialized:             # <<<<<<<<<<<<<<
    912  *             close(self.fd)
    913  *             self.initialized = 0
    914  */
    915   if (((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->initialized) {
    916 
    917     /* "twisted/python/_epoll.pyx":125
    918  *     def __dealloc__(self):
    919  *         if self.initialized:
    920  *             close(self.fd)             # <<<<<<<<<<<<<<
    921  *             self.initialized = 0
    922  *
    923  */
    924     close(((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd);
    925 
    926     /* "twisted/python/_epoll.pyx":126
    927  *         if self.initialized:
    928  *             close(self.fd)
    929  *             self.initialized = 0             # <<<<<<<<<<<<<<
    930  *
    931  *     def close(self):
    932  */
    933     ((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->initialized = 0;
    934     goto __pyx_L5;
    935   }
    936   __pyx_L5:;
    937 
    938   __Pyx_RefNannyFinishContext();
    939 }
    940 
    941 /* "twisted/python/_epoll.pyx":128
    942  *             self.initialized = 0
    943  *
    944  *     def close(self):             # <<<<<<<<<<<<<<
    945  *         """
    946  *         Close the epoll file descriptor.
    947  */
    948 
    949 static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_2close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
    950 static char __pyx_doc_7twisted_6python_6_epoll_5epoll_2close[] = "\n        Close the epoll file descriptor.\n        ";
    951 static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_2close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
    952   PyObject *__pyx_r = NULL;
    953   __Pyx_RefNannyDeclarations
    954   int __pyx_t_1;
    955   PyObject *__pyx_t_2 = NULL;
    956   PyObject *__pyx_t_3 = NULL;
    957   PyObject *__pyx_t_4 = NULL;
    958   int __pyx_lineno = 0;
    959   const char *__pyx_filename = NULL;
    960   int __pyx_clineno = 0;
    961   __Pyx_RefNannySetupContext("close");
    962 
    963   /* "twisted/python/_epoll.pyx":132
    964  *         Close the epoll file descriptor.
    965  *         """
    966  *         if self.initialized:             # <<<<<<<<<<<<<<
    967  *             if close(self.fd) == -1:
    968  *                 raise IOError(errno, strerror(errno))
    969  */
    970   if (((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->initialized) {
    971 
    972     /* "twisted/python/_epoll.pyx":133
    973  *         """
    974  *         if self.initialized:
    975  *             if close(self.fd) == -1:             # <<<<<<<<<<<<<<
    976  *                 raise IOError(errno, strerror(errno))
    977  *             self.initialized = 0
    978  */
    979     __pyx_t_1 = (close(((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd) == -1);
    980     if (__pyx_t_1) {
    981 
    982       /* "twisted/python/_epoll.pyx":134
    983  *         if self.initialized:
    984  *             if close(self.fd) == -1:
    985  *                 raise IOError(errno, strerror(errno))             # <<<<<<<<<<<<<<
    986  *             self.initialized = 0
    987  *
    988  */
    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;}
    990       __Pyx_GOTREF(__pyx_t_2);
    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;}
    992       __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    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;}
    994       __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    995       PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    996       __Pyx_GIVEREF(__pyx_t_2);
    997       PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_t_3));
    998       __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
    999       __pyx_t_2 = 0;
    1000       __pyx_t_3 = 0;
    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;}
    1002       __Pyx_GOTREF(__pyx_t_3);
    1003       __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    1004       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    1005       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    1006       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    1007       goto __pyx_L6;
    1008     }
    1009     __pyx_L6:;
    1010 
    1011     /* "twisted/python/_epoll.pyx":135
    1012  *             if close(self.fd) == -1:
    1013  *                 raise IOError(errno, strerror(errno))
    1014  *             self.initialized = 0             # <<<<<<<<<<<<<<
    1015  *
    1016  *     def fileno(self):
    1017  */
    1018     ((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->initialized = 0;
    1019     goto __pyx_L5;
    1020   }
    1021   __pyx_L5:;
    1022 
    1023   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    1024   goto __pyx_L0;
    1025   __pyx_L1_error:;
    1026   __Pyx_XDECREF(__pyx_t_2);
    1027   __Pyx_XDECREF(__pyx_t_3);
    1028   __Pyx_XDECREF(__pyx_t_4);
    1029   __Pyx_AddTraceback("twisted.python._epoll.epoll.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
    1030   __pyx_r = NULL;
    1031   __pyx_L0:;
    1032   __Pyx_XGIVEREF(__pyx_r);
    1033   __Pyx_RefNannyFinishContext();
    1034   return __pyx_r;
    1035 }
    1036 
    1037 /* "twisted/python/_epoll.pyx":137
    1038  *             self.initialized = 0
    1039  *
    1040  *     def fileno(self):             # <<<<<<<<<<<<<<
    1041  *         """
    1042  *         Return the epoll file descriptor number.
    1043  */
    1044 
    1045 static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_3fileno(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
    1046 static char __pyx_doc_7twisted_6python_6_epoll_5epoll_3fileno[] = "\n        Return the epoll file descriptor number.\n        ";
    1047 static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_3fileno(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
    1048   PyObject *__pyx_r = NULL;
    1049   __Pyx_RefNannyDeclarations
    1050   PyObject *__pyx_t_1 = NULL;
    1051   int __pyx_lineno = 0;
    1052   const char *__pyx_filename = NULL;
    1053   int __pyx_clineno = 0;
    1054   __Pyx_RefNannySetupContext("fileno");
    1055 
    1056   /* "twisted/python/_epoll.pyx":141
    1057  *         Return the epoll file descriptor number.
    1058  *         """
    1059  *         return self.fd             # <<<<<<<<<<<<<<
    1060  *
    1061  *     def register(self, int fd, int events):
    1062  */
    1063   __Pyx_XDECREF(__pyx_r);
    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;}
    1065   __Pyx_GOTREF(__pyx_t_1);
    1066   __pyx_r = __pyx_t_1;
    1067   __pyx_t_1 = 0;
    1068   goto __pyx_L0;
    1069 
    1070   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    1071   goto __pyx_L0;
    1072   __pyx_L1_error:;
    1073   __Pyx_XDECREF(__pyx_t_1);
    1074   __Pyx_AddTraceback("twisted.python._epoll.epoll.fileno", __pyx_clineno, __pyx_lineno, __pyx_filename);
    1075   __pyx_r = NULL;
    1076   __pyx_L0:;
    1077   __Pyx_XGIVEREF(__pyx_r);
    1078   __Pyx_RefNannyFinishContext();
    1079   return __pyx_r;
    1080 }
    1081 
    1082 /* "twisted/python/_epoll.pyx":143
    1083  *         return self.fd
    1084  *
    1085  *     def register(self, int fd, int events):             # <<<<<<<<<<<<<<
    1086  *         """
    1087  *         Add (register) a file descriptor to be monitored by self.
    1088  */
    1089 
    1090 static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_4register(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    1091 static 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        ";
    1092 static 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 
    1245 static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_5unregister(PyObject *__pyx_v_self, PyObject *__pyx_arg_fd); /*proto*/
    1246 static 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        ";
    1247 static 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 
    1355 static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_6modify(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    1356 static 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        ";
    1357 static 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  *
    1505  *     def _control(self, int op, int fd, int events):             # <<<<<<<<<<<<<<
    1506  *         """
    1507  *         Modify the monitored state of a particular file descriptor.
    1508  */
    1509 
    1510 static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_7_control(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    1511 static 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        ";
    1512 static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_7_control(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
    1513   int __pyx_v_op;
    1514   int __pyx_v_fd;
    1515   int __pyx_v_events;
    1516   int __pyx_v_result;
    1517   struct epoll_event __pyx_v_evt;
    1518   PyObject *__pyx_r = NULL;
    1519   __Pyx_RefNannyDeclarations
    1520   int __pyx_t_1;
    1521   PyObject *__pyx_t_2 = NULL;
    1522   PyObject *__pyx_t_3 = NULL;
    1523   PyObject *__pyx_t_4 = NULL;
    1524   int __pyx_lineno = 0;
    1525   const char *__pyx_filename = NULL;
    1526   int __pyx_clineno = 0;
    1527   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__op,&__pyx_n_s__fd,&__pyx_n_s__events,0};
    1528   __Pyx_RefNannySetupContext("_control");
    1529   {
    1530     PyObject* values[3] = {0,0,0};
    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;
    1539       }
    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         }
    1558       }
    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);
    1568     }
    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;}
    1572   }
    1573   goto __pyx_L4_argument_unpacking_done;
    1574   __pyx_L5_argtuple_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;}
    1576   __pyx_L3_error:;
    1577   __Pyx_AddTraceback("twisted.python._epoll.epoll._control", __pyx_clineno, __pyx_lineno, __pyx_filename);
    1578   __Pyx_RefNannyFinishContext();
    1579   return NULL;
    1580   __pyx_L4_argument_unpacking_done:;
    1581 
    1582   /* "twisted/python/_epoll.pyx":231
    1583  *         cdef int result
    1584  *         cdef epoll_event evt
    1585  *         evt.events = events             # <<<<<<<<<<<<<<
    1586  *         evt.data.fd = fd
    1587  *         result = epoll_ctl(self.fd, op, fd, &evt)
    1588  */
    1589   __pyx_v_evt.events = __pyx_v_events;
    1590 
    1591   /* "twisted/python/_epoll.pyx":232
    1592  *         cdef epoll_event evt
    1593  *         evt.events = events
    1594  *         evt.data.fd = fd             # <<<<<<<<<<<<<<
    1595  *         result = epoll_ctl(self.fd, op, fd, &evt)
    1596  *         if result == -1:
    1597  */
    1598   __pyx_v_evt.data.fd = __pyx_v_fd;
    1599 
    1600   /* "twisted/python/_epoll.pyx":233
    1601  *         evt.events = events
    1602  *         evt.data.fd = fd
    1603  *         result = epoll_ctl(self.fd, op, fd, &evt)             # <<<<<<<<<<<<<<
    1604  *         if result == -1:
    1605  *             raise IOError(errno, strerror(errno))
    1606  */
    1607   __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));
    1608 
    1609   /* "twisted/python/_epoll.pyx":234
    1610  *         evt.data.fd = fd
    1611  *         result = epoll_ctl(self.fd, op, fd, &evt)
    1612  *         if result == -1:             # <<<<<<<<<<<<<<
    1613  *             raise IOError(errno, strerror(errno))
    1614  *
    1615  */
    1616   __pyx_t_1 = (__pyx_v_result == -1);
    1617   if (__pyx_t_1) {
    1618 
    1619     /* "twisted/python/_epoll.pyx":235
    1620  *         result = epoll_ctl(self.fd, op, fd, &evt)
    1621  *         if result == -1:
    1622  *             raise IOError(errno, strerror(errno))             # <<<<<<<<<<<<<<
    1623  *
    1624  *     def wait(self, unsigned int maxevents, int timeout):
    1625  */
    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;}
    1627     __Pyx_GOTREF(__pyx_t_2);
    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;}
    1629     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    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;}
    1631     __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    1632     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    1633     __Pyx_GIVEREF(__pyx_t_2);
    1634     PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_t_3));
    1635     __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
    1636     __pyx_t_2 = 0;
    1637     __pyx_t_3 = 0;
    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;}
    1639     __Pyx_GOTREF(__pyx_t_3);
    1640     __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    1641     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    1642     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    1643     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    1644     goto __pyx_L6;
    1645   }
    1646   __pyx_L6:;
    1647 
    1648   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    1649   goto __pyx_L0;
    1650   __pyx_L1_error:;
    1651   __Pyx_XDECREF(__pyx_t_2);
    1652   __Pyx_XDECREF(__pyx_t_3);
    1653   __Pyx_XDECREF(__pyx_t_4);
    1654   __Pyx_AddTraceback("twisted.python._epoll.epoll._control", __pyx_clineno, __pyx_lineno, __pyx_filename);
    1655   __pyx_r = NULL;
    1656   __pyx_L0:;
    1657   __Pyx_XGIVEREF(__pyx_r);
    1658   __Pyx_RefNannyFinishContext();
    1659   return __pyx_r;
    1660 }
    1661 
    1662 /* "twisted/python/_epoll.pyx":237
    1663  *             raise IOError(errno, strerror(errno))
    1664  *
    1665  *     def wait(self, unsigned int maxevents, int timeout):             # <<<<<<<<<<<<<<
    1666  *         """
    1667  *         Wait for an I/O event, wrap epoll_wait(2).
    1668  */
    1669 
    1670 static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_8wait(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    1671 static 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        ";
    1672 static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_8wait(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
    1673   unsigned int __pyx_v_maxevents;
    1674   int __pyx_v_timeout;
    1675   PyObject *__pyx_r = NULL;
    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;
    1681   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__maxevents,&__pyx_n_s__timeout,0};
    1682   __Pyx_RefNannySetupContext("wait");
    1683   {
    1684     PyObject* values[2] = {0,0};
    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;
    1692       }
    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);
    1714     }
    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;}
    1717   }
    1718   goto __pyx_L4_argument_unpacking_done;
    1719   __pyx_L5_argtuple_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;}
    1721   __pyx_L3_error:;
    1722   __Pyx_AddTraceback("twisted.python._epoll.epoll.wait", __pyx_clineno, __pyx_lineno, __pyx_filename);
    1723   __Pyx_RefNannyFinishContext();
    1724   return NULL;
    1725   __pyx_L4_argument_unpacking_done:;
    1726 
    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)             # <<<<<<<<<<<<<<
    1731  *
    1732  *     def poll(self, float timeout=-1, unsigned int maxevents=1024):
    1733  */
    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;
    1740 
    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 }
    1752 
    1753 /* "twisted/python/_epoll.pyx":252
    1754  *         return call_epoll_wait(self.fd, maxevents, timeout)
    1755  *
    1756  *     def poll(self, float timeout=-1, unsigned int maxevents=1024):             # <<<<<<<<<<<<<<
    1757  *         """
    1758  *         Wait for an I/O event, wrap epoll_wait(2).
    1759  */
    1760 
    1761 static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_9poll(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    1762 static 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        ";
    1763 static 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;
    1783       }
    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       }
    1807     }
    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     }
    1818   }
    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:;
    1827 
    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))             # <<<<<<<<<<<<<<
    1832  *
    1833  *
    1834  */
    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;
    1841 
    1842   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    1843   goto __pyx_L0;
    1844   __pyx_L1_error:;
    1845   __Pyx_XDECREF(__pyx_t_1);
    1846   __Pyx_AddTraceback("twisted.python._epoll.epoll.poll", __pyx_clineno, __pyx_lineno, __pyx_filename);
    1847   __pyx_r = NULL;
    1848   __pyx_L0:;
    1849   __Pyx_XGIVEREF(__pyx_r);
    1850   __Pyx_RefNannyFinishContext();
    1851   return __pyx_r;
    1852 }
    1853 
    1854 static PyObject *__pyx_tp_new_7twisted_6python_6_epoll_epoll(PyTypeObject *t, PyObject *a, PyObject *k) {
    1855   PyObject *o = (*t->tp_alloc)(t, 0);
    1856   if (!o) return 0;
    1857   return o;
    1858 }
    1859 
    1860 static void __pyx_tp_dealloc_7twisted_6python_6_epoll_epoll(PyObject *o) {
    1861   {
    1862     PyObject *etype, *eval, *etb;
    1863     PyErr_Fetch(&etype, &eval, &etb);
    1864     ++Py_REFCNT(o);
    1865     __pyx_pf_7twisted_6python_6_epoll_5epoll_1__dealloc__(o);
    1866     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    1867     --Py_REFCNT(o);
    1868     PyErr_Restore(etype, eval, etb);
    1869   }
    1870   (*Py_TYPE(o)->tp_free)(o);
    1871 }
    1872 
    1873 static PyMethodDef __pyx_methods_7twisted_6python_6_epoll_epoll[] = {
    1874   {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pf_7twisted_6python_6_epoll_5epoll_2close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_7twisted_6python_6_epoll_5epoll_2close)},
    1875   {__Pyx_NAMESTR("fileno"), (PyCFunction)__pyx_pf_7twisted_6python_6_epoll_5epoll_3fileno, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_7twisted_6python_6_epoll_5epoll_3fileno)},
    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)},
    1882   {0, 0, 0, 0}
    1883 };
    1884 
    1885 static PyNumberMethods __pyx_tp_as_number_epoll = {
    1886   0, /*nb_add*/
    1887   0, /*nb_subtract*/
    1888   0, /*nb_multiply*/
    1889   #if PY_MAJOR_VERSION < 3
    1890   0, /*nb_divide*/
    1891   #endif
    1892   0, /*nb_remainder*/
    1893   0, /*nb_divmod*/
    1894   0, /*nb_power*/
    1895   0, /*nb_negative*/
    1896   0, /*nb_positive*/
    1897   0, /*nb_absolute*/
    1898   0, /*nb_nonzero*/
    1899   0, /*nb_invert*/
    1900   0, /*nb_lshift*/
    1901   0, /*nb_rshift*/
    1902   0, /*nb_and*/
    1903   0, /*nb_xor*/
    1904   0, /*nb_or*/
    1905   #if PY_MAJOR_VERSION < 3
    1906   0, /*nb_coerce*/
    1907   #endif
    1908   0, /*nb_int*/
    1909   #if PY_MAJOR_VERSION < 3
    1910   0, /*nb_long*/
    1911   #else
    1912   0, /*reserved*/
    1913   #endif
    1914   0, /*nb_float*/
    1915   #if PY_MAJOR_VERSION < 3
    1916   0, /*nb_oct*/
    1917   #endif
    1918   #if PY_MAJOR_VERSION < 3
    1919   0, /*nb_hex*/
    1920   #endif
    1921   0, /*nb_inplace_add*/
    1922   0, /*nb_inplace_subtract*/
    1923   0, /*nb_inplace_multiply*/
    1924   #if PY_MAJOR_VERSION < 3
    1925   0, /*nb_inplace_divide*/
    1926   #endif
    1927   0, /*nb_inplace_remainder*/
    1928   0, /*nb_inplace_power*/
    1929   0, /*nb_inplace_lshift*/
    1930   0, /*nb_inplace_rshift*/
    1931   0, /*nb_inplace_and*/
    1932   0, /*nb_inplace_xor*/
    1933   0, /*nb_inplace_or*/
    1934   0, /*nb_floor_divide*/
    1935   0, /*nb_true_divide*/
    1936   0, /*nb_inplace_floor_divide*/
    1937   0, /*nb_inplace_true_divide*/
    1938   #if PY_VERSION_HEX >= 0x02050000
    1939   0, /*nb_index*/
    1940   #endif
    1941 };
    1942 
    1943 static PySequenceMethods __pyx_tp_as_sequence_epoll = {
    1944   0, /*sq_length*/
    1945   0, /*sq_concat*/
    1946   0, /*sq_repeat*/
    1947   0, /*sq_item*/
    1948   0, /*sq_slice*/
    1949   0, /*sq_ass_item*/
    1950   0, /*sq_ass_slice*/
    1951   0, /*sq_contains*/
    1952   0, /*sq_inplace_concat*/
    1953   0, /*sq_inplace_repeat*/
    1954 };
    1955 
    1956 static PyMappingMethods __pyx_tp_as_mapping_epoll = {
    1957   0, /*mp_length*/
    1958   0, /*mp_subscript*/
    1959   0, /*mp_ass_subscript*/
    1960 };
    1961 
    1962 static PyBufferProcs __pyx_tp_as_buffer_epoll = {
    1963   #if PY_MAJOR_VERSION < 3
    1964   0, /*bf_getreadbuffer*/
    1965   #endif
    1966   #if PY_MAJOR_VERSION < 3
    1967   0, /*bf_getwritebuffer*/
    1968   #endif
    1969   #if PY_MAJOR_VERSION < 3
    1970   0, /*bf_getsegcount*/
    1971   #endif
    1972   #if PY_MAJOR_VERSION < 3
    1973   0, /*bf_getcharbuffer*/
    1974   #endif
    1975   #if PY_VERSION_HEX >= 0x02060000
    1976   0, /*bf_getbuffer*/
    1977   #endif
    1978   #if PY_VERSION_HEX >= 0x02060000
    1979   0, /*bf_releasebuffer*/
    1980   #endif
    1981 };
    1982 
    1983 static PyTypeObject __pyx_type_7twisted_6python_6_epoll_epoll = {
    1984   PyVarObject_HEAD_INIT(0, 0)
    1985   __Pyx_NAMESTR("twisted.python._epoll.epoll"), /*tp_name*/
    1986   sizeof(struct __pyx_obj_7twisted_6python_6_epoll_epoll), /*tp_basicsize*/
    1987   0, /*tp_itemsize*/
    1988   __pyx_tp_dealloc_7twisted_6python_6_epoll_epoll, /*tp_dealloc*/
    1989   0, /*tp_print*/
    1990   0, /*tp_getattr*/
    1991   0, /*tp_setattr*/
    1992   #if PY_MAJOR_VERSION < 3
    1993   0, /*tp_compare*/
    1994   #else
    1995   0, /*reserved*/
    1996   #endif
    1997   0, /*tp_repr*/
    1998   &__pyx_tp_as_number_epoll, /*tp_as_number*/
    1999   &__pyx_tp_as_sequence_epoll, /*tp_as_sequence*/
    2000   &__pyx_tp_as_mapping_epoll, /*tp_as_mapping*/
    2001   0, /*tp_hash*/
    2002   0, /*tp_call*/
    2003   0, /*tp_str*/
    2004   0, /*tp_getattro*/
    2005   0, /*tp_setattro*/
    2006   &__pyx_tp_as_buffer_epoll, /*tp_as_buffer*/
    2007   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
    2008   __Pyx_DOCSTR("\n    Represent a set of file descriptors being monitored for events.\n    "), /*tp_doc*/
    2009   0, /*tp_traverse*/
    2010   0, /*tp_clear*/
    2011   0, /*tp_richcompare*/
    2012   0, /*tp_weaklistoffset*/
    2013   0, /*tp_iter*/
    2014   0, /*tp_iternext*/
    2015   __pyx_methods_7twisted_6python_6_epoll_epoll, /*tp_methods*/
    2016   0, /*tp_members*/
    2017   0, /*tp_getset*/
    2018   0, /*tp_base*/
    2019   0, /*tp_dict*/
    2020   0, /*tp_descr_get*/
    2021   0, /*tp_descr_set*/
    2022   0, /*tp_dictoffset*/
    2023   __pyx_pf_7twisted_6python_6_epoll_5epoll___init__, /*tp_init*/
    2024   0, /*tp_alloc*/
    2025   __pyx_tp_new_7twisted_6python_6_epoll_epoll, /*tp_new*/
    2026   0, /*tp_free*/
    2027   0, /*tp_is_gc*/
    2028   0, /*tp_bases*/
    2029   0, /*tp_mro*/
    2030   0, /*tp_cache*/
    2031   0, /*tp_subclasses*/
    2032   0, /*tp_weaklist*/
    2033   0, /*tp_del*/
    2034   #if PY_VERSION_HEX >= 0x02060000
    2035   0, /*tp_version_tag*/
    2036   #endif
    2037 };
    2038 
    2039 static PyMethodDef __pyx_methods[] = {
    2040   {0, 0, 0, 0}
    2041 };
    2042 
    2043 #if PY_MAJOR_VERSION >= 3
    2044 static struct PyModuleDef __pyx_moduledef = {
    2045     PyModuleDef_HEAD_INIT,
    2046     __Pyx_NAMESTR("_epoll"),
    2047     __Pyx_DOCSTR(__pyx_k_1), /* m_doc */
    2048     -1, /* m_size */
    2049     __pyx_methods /* m_methods */,
    2050     NULL, /* m_reload */
    2051     NULL, /* m_traverse */
    2052     NULL, /* m_clear */
    2053     NULL /* m_free */
    2054 };
    2055 #endif
    2056 
    2057 static __Pyx_StringTabEntry __pyx_string_tab[] = {
    2058   {&__pyx_n_s__CTL_ADD, __pyx_k__CTL_ADD, sizeof(__pyx_k__CTL_ADD), 0, 0, 1, 1},
    2059   {&__pyx_n_s__CTL_DEL, __pyx_k__CTL_DEL, sizeof(__pyx_k__CTL_DEL), 0, 0, 1, 1},
    2060   {&__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},
    2072   {&__pyx_n_s__ERR, __pyx_k__ERR, sizeof(__pyx_k__ERR), 0, 0, 1, 1},
    2073   {&__pyx_n_s__ET, __pyx_k__ET, sizeof(__pyx_k__ET), 0, 0, 1, 1},
    2074   {&__pyx_n_s__HUP, __pyx_k__HUP, sizeof(__pyx_k__HUP), 0, 0, 1, 1},
    2075   {&__pyx_n_s__IN, __pyx_k__IN, sizeof(__pyx_k__IN), 0, 0, 1, 1},
    2076   {&__pyx_n_s__IOError, __pyx_k__IOError, sizeof(__pyx_k__IOError), 0, 0, 1, 1},
    2077   {&__pyx_n_s__MSG, __pyx_k__MSG, sizeof(__pyx_k__MSG), 0, 0, 1, 1},
    2078   {&__pyx_n_s__OUT, __pyx_k__OUT, sizeof(__pyx_k__OUT), 0, 0, 1, 1},
    2079   {&__pyx_n_s__PRI, __pyx_k__PRI, sizeof(__pyx_k__PRI), 0, 0, 1, 1},
    2080   {&__pyx_n_s__RDBAND, __pyx_k__RDBAND, sizeof(__pyx_k__RDBAND), 0, 0, 1, 1},
    2081   {&__pyx_n_s__RDNORM, __pyx_k__RDNORM, sizeof(__pyx_k__RDNORM), 0, 0, 1, 1},
    2082   {&__pyx_n_s__WRBAND, __pyx_k__WRBAND, sizeof(__pyx_k__WRBAND), 0, 0, 1, 1},
    2083   {&__pyx_n_s__WRNORM, __pyx_k__WRNORM, sizeof(__pyx_k__WRNORM), 0, 0, 1, 1},
    2084   {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
    2085   {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
    2086   {&__pyx_n_s__events, __pyx_k__events, sizeof(__pyx_k__events), 0, 0, 1, 1},
    2087   {&__pyx_n_s__fd, __pyx_k__fd, sizeof(__pyx_k__fd), 0, 0, 1, 1},
    2088   {&__pyx_n_s__maxevents, __pyx_k__maxevents, sizeof(__pyx_k__maxevents), 0, 0, 1, 1},
    2089   {&__pyx_n_s__op, __pyx_k__op, sizeof(__pyx_k__op), 0, 0, 1, 1},
    2090   {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1},
    2091   {&__pyx_n_s__timeout, __pyx_k__timeout, sizeof(__pyx_k__timeout), 0, 0, 1, 1},
    2092   {0, 0, 0, 0, 0, 0, 0}
    2093 };
    2094 static int __Pyx_InitCachedBuiltins(void) {
    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;}
    2096   return 0;
    2097   __pyx_L1_error:;
    2098   return -1;
    2099 }
    2100 
    2101 static int __Pyx_InitCachedConstants(void) {
    2102   __Pyx_RefNannyDeclarations
    2103   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants");
    2104   __Pyx_RefNannyFinishContext();
    2105   return 0;
    2106 }
    2107 
    2108 static int __Pyx_InitGlobals(void) {
    2109   if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    2110   return 0;
    2111   __pyx_L1_error:;
    2112   return -1;
    2113 }
    2114 
    2115 #if PY_MAJOR_VERSION < 3
    2116 PyMODINIT_FUNC init_epoll(void); /*proto*/
    2117 PyMODINIT_FUNC init_epoll(void)
    2118 #else
    2119 PyMODINIT_FUNC PyInit__epoll(void); /*proto*/
    2120 PyMODINIT_FUNC PyInit__epoll(void)
    2121 #endif
    2122 {
    2123   PyObject *__pyx_t_1 = NULL;
    2124   __Pyx_RefNannyDeclarations
    2125   #if CYTHON_REFNANNY
    2126   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
    2127   if (!__Pyx_RefNanny) {
    2128       PyErr_Clear();
    2129       __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
    2130       if (!__Pyx_RefNanny)
    2131           Py_FatalError("failed to import 'refnanny' module");
    2132   }
    2133   #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;}
    2136   __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;}
    2137   __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;}
    2138   #ifdef __pyx_binding_PyCFunctionType_USED
    2139   if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    2140   #endif
    2141   /*--- Library function declarations ---*/
    2142   /*--- Threads initialization code ---*/
    2143   #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
    2144   #ifdef WITH_THREAD /* Python build with threading support? */
    2145   PyEval_InitThreads();
    2146   #endif
    2147   #endif
    2148   /*--- Module creation code ---*/
    2149   #if PY_MAJOR_VERSION < 3
    2150   __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_epoll"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_1), 0, PYTHON_API_VERSION);
    2151   #else
    2152   __pyx_m = PyModule_Create(&__pyx_moduledef);
    2153   #endif
    2154   if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    2155   #if PY_MAJOR_VERSION < 3
    2156   Py_INCREF(__pyx_m);
    2157   #endif
    2158   __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
    2159   if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    2160   if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    2161   /*--- Initialize various global constants etc. ---*/
    2162   if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    2163   if (__pyx_module_is_main_twisted__python___epoll) {
    2164     if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    2165   }
    2166   /*--- Builtin init code ---*/
    2167   if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    2168   /*--- Constants init code ---*/
    2169   if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    2170   /*--- Global init code ---*/
    2171   /*--- Variable export code ---*/
    2172   /*--- Function export code ---*/
    2173   /*--- Type init code ---*/
    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;}
    2184   __pyx_ptype_7twisted_6python_6_epoll_epoll = &__pyx_type_7twisted_6python_6_epoll_epoll;
    2185   /*--- Type import code ---*/
    2186   /*--- Variable import code ---*/
    2187   /*--- Function import code ---*/
    2188   /*--- Execution code ---*/
    2189 
    2190   /* "twisted/python/_epoll.pyx":270
    2191  *
    2192  *
    2193  * CTL_ADD = EPOLL_CTL_ADD             # <<<<<<<<<<<<<<
    2194  * CTL_DEL = EPOLL_CTL_DEL
    2195  * CTL_MOD = EPOLL_CTL_MOD
    2196  */
    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;}
    2198   __Pyx_GOTREF(__pyx_t_1);
    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;}
    2200   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    2201 
    2202   /* "twisted/python/_epoll.pyx":271
    2203  *
    2204  * CTL_ADD = EPOLL_CTL_ADD
    2205  * CTL_DEL = EPOLL_CTL_DEL             # <<<<<<<<<<<<<<
    2206  * CTL_MOD = EPOLL_CTL_MOD
    2207  *
    2208  */
    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;}
    2210   __Pyx_GOTREF(__pyx_t_1);
    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;}
    2212   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    2213 
    2214   /* "twisted/python/_epoll.pyx":272
    2215  * CTL_ADD = EPOLL_CTL_ADD
    2216  * CTL_DEL = EPOLL_CTL_DEL
    2217  * CTL_MOD = EPOLL_CTL_MOD             # <<<<<<<<<<<<<<
    2218  *
    2219  * IN = EPOLLIN = c_EPOLLIN
    2220  */
    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;}
    2222   __Pyx_GOTREF(__pyx_t_1);
    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;}
    2224   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    2225 
    2226   /* "twisted/python/_epoll.pyx":274
    2227  * CTL_MOD = EPOLL_CTL_MOD
    2228  *
    2229  * IN = EPOLLIN = c_EPOLLIN             # <<<<<<<<<<<<<<
    2230  * OUT = EPOLLOUT = c_EPOLLOUT
    2231  * PRI = EPOLLPRI = c_EPOLLPRI
    2232  */
    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;}
    2234   __Pyx_GOTREF(__pyx_t_1);
    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;}
    2236   __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;
    2241 
    2242   /* "twisted/python/_epoll.pyx":275
    2243  *
    2244  * IN = EPOLLIN = c_EPOLLIN
    2245  * OUT = EPOLLOUT = c_EPOLLOUT             # <<<<<<<<<<<<<<
    2246  * PRI = EPOLLPRI = c_EPOLLPRI
    2247  * ERR = EPOLLERR = c_EPOLLERR
    2248  */
    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;}
    2250   __Pyx_GOTREF(__pyx_t_1);
    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;}
    2252   __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;
    2257 
    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
    2264  */
    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;}
    2266   __Pyx_GOTREF(__pyx_t_1);
    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;}
    2268   __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;
    2273 
    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
    2280  */
    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;}
    2282   __Pyx_GOTREF(__pyx_t_1);
    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;}
    2284   __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;
    2289 
    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
    2295  *
    2296  */
    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;}
    2298   __Pyx_GOTREF(__pyx_t_1);
    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;}
    2300   __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;
    2305 
    2306   /* "twisted/python/_epoll.pyx":279
    2307  * ERR = EPOLLERR = c_EPOLLERR
    2308  * HUP = EPOLLHUP = c_EPOLLHUP
    2309  * ET = EPOLLET = c_EPOLLET             # <<<<<<<<<<<<<<
    2310  *
    2311  * RDNORM = EPOLLRDNORM = c_EPOLLRDNORM
    2312  */
    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;}
    2314   __Pyx_GOTREF(__pyx_t_1);
    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;}
    2316   __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;
    2321 
    2322   /* "twisted/python/_epoll.pyx":281
    2323  * ET = EPOLLET = c_EPOLLET
    2324  *
    2325  * RDNORM = EPOLLRDNORM = c_EPOLLRDNORM             # <<<<<<<<<<<<<<
    2326  * RDBAND = EPOLLRDBAND = c_EPOLLRDBAND
    2327  * WRNORM = EPOLLWRNORM = c_EPOLLWRNORM
    2328  */
    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;}
    2330   __Pyx_GOTREF(__pyx_t_1);
    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;}
    2332   __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;
    2337 
    2338   /* "twisted/python/_epoll.pyx":282
    2339  *
    2340  * RDNORM = EPOLLRDNORM = c_EPOLLRDNORM
    2341  * RDBAND = EPOLLRDBAND = c_EPOLLRDBAND             # <<<<<<<<<<<<<<
    2342  * WRNORM = EPOLLWRNORM = c_EPOLLWRNORM
    2343  * WRBAND = EPOLLWRBAND = c_EPOLLWRBAND
    2344  */
    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;}
    2346   __Pyx_GOTREF(__pyx_t_1);
    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;}
    2348   __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;
    2353 
    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
    2360  */
    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;}
    2362   __Pyx_GOTREF(__pyx_t_1);
    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;}
    2364   __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;
    2369 
    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
    2375  */
    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;}
    2377   __Pyx_GOTREF(__pyx_t_1);
    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;}
    2379   __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;
    2384 
    2385   /* "twisted/python/_epoll.pyx":285
    2386  * WRNORM = EPOLLWRNORM = c_EPOLLWRNORM
    2387  * WRBAND = EPOLLWRBAND = c_EPOLLWRBAND
    2388  * MSG = EPOLLMSG = c_EPOLLMSG             # <<<<<<<<<<<<<<
    2389  */
    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;}
    2391   __Pyx_GOTREF(__pyx_t_1);
    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;}
    2393   __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;
    2398 
    2399   /* "twisted/python/_epoll.pyx":1
    2400  * # Copyright (c) Twisted Matrix Laboratories.             # <<<<<<<<<<<<<<
    2401  * # See LICENSE for details.
    2402  *
    2403  */
    2404   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    2405   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    2406   if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    2407   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    2408   goto __pyx_L0;
    2409   __pyx_L1_error:;
    2410   __Pyx_XDECREF(__pyx_t_1);
    2411   if (__pyx_m) {
    2412     __Pyx_AddTraceback("init twisted.python._epoll", __pyx_clineno, __pyx_lineno, __pyx_filename);
    2413     Py_DECREF(__pyx_m); __pyx_m = 0;
    2414   } else if (!PyErr_Occurred()) {
    2415     PyErr_SetString(PyExc_ImportError, "init twisted.python._epoll");
    2416   }
    2417   __pyx_L0:;
    2418   __Pyx_RefNannyFinishContext();
    2419   #if PY_MAJOR_VERSION < 3
    2420   return;
    2421   #else
    2422   return __pyx_m;
    2423   #endif
    2424 }
    2425 
    2426 /* Runtime support code */
    2427 
    2428 #if CYTHON_REFNANNY
    2429 static __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);
    2437 end:
    2438     Py_XDECREF(p);
    2439     Py_XDECREF(m);
    2440     return (__Pyx_RefNannyAPIStruct *)r;
    2441 }
    2442 #endif /* CYTHON_REFNANNY */
    2443 
    2444 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
    2445     PyObject *result;
    2446     result = PyObject_GetAttr(dict, name);
    2447     if (!result) {
    2448         if (dict != __pyx_b) {
    2449             PyErr_Clear();
    2450             result = PyObject_GetAttr(__pyx_b, name);
    2451         }
    2452         if (!result) {
    2453             PyErr_SetObject(PyExc_NameError, name);
    2454         }
    2455     }
    2456     return result;
    2457 }
    2458 
    2459 static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
    2460     PyObject *tmp_type, *tmp_value, *tmp_tb;
    2461     PyThreadState *tstate = PyThreadState_GET();
    2462 
    2463     tmp_type = tstate->curexc_type;
    2464     tmp_value = tstate->curexc_value;
    2465     tmp_tb = tstate->curexc_traceback;
    2466     tstate->curexc_type = type;
    2467     tstate->curexc_value = value;
    2468     tstate->curexc_traceback = tb;
    2469     Py_XDECREF(tmp_type);
    2470     Py_XDECREF(tmp_value);
    2471     Py_XDECREF(tmp_tb);
    2472 }
    2473 
    2474 static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
    2475     PyThreadState *tstate = PyThreadState_GET();
    2476     *type = tstate->curexc_type;
    2477     *value = tstate->curexc_value;
    2478     *tb = tstate->curexc_traceback;
    2479 
    2480     tstate->curexc_type = 0;
    2481     tstate->curexc_value = 0;
    2482     tstate->curexc_traceback = 0;
    2483 }
    2484 
    2485 
    2486 #if PY_MAJOR_VERSION < 3
    2487 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    2488     /* cause is unused */
    2489     Py_XINCREF(type);
    2490     Py_XINCREF(value);
    2491     Py_XINCREF(tb);
    2492     /* First, check the traceback argument, replacing None with NULL. */
    2493     if (tb == Py_None) {
    2494         Py_DECREF(tb);
    2495         tb = 0;
    2496     }
    2497     else if (tb != NULL && !PyTraceBack_Check(tb)) {
    2498         PyErr_SetString(PyExc_TypeError,
    2499             "raise: arg 3 must be a traceback or None");
    2500         goto raise_error;
    2501     }
    2502     /* Next, replace a missing value with None */
    2503     if (value == NULL) {
    2504         value = Py_None;
    2505         Py_INCREF(value);
    2506     }
    2507     #if PY_VERSION_HEX < 0x02050000
    2508     if (!PyClass_Check(type))
    2509     #else
    2510     if (!PyType_Check(type))
    2511     #endif
    2512     {
    2513         /* Raising an instance.  The value should be a dummy. */
    2514         if (value != Py_None) {
    2515             PyErr_SetString(PyExc_TypeError,
    2516                 "instance exception may not have a separate value");
    2517             goto raise_error;
    2518         }
    2519         /* Normalize to raise <class>, <instance> */
    2520         Py_DECREF(value);
    2521         value = type;
    2522         #if PY_VERSION_HEX < 0x02050000
    2523             if (PyInstance_Check(type)) {
    2524                 type = (PyObject*) ((PyInstanceObject*)type)->in_class;
    2525                 Py_INCREF(type);
    2526             }
    2527             else {
    2528                 type = 0;
    2529                 PyErr_SetString(PyExc_TypeError,
    2530                     "raise: exception must be an old-style class or instance");
    2531                 goto raise_error;
    2532             }
    2533         #else
    2534             type = (PyObject*) Py_TYPE(type);
    2535             Py_INCREF(type);
    2536             if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
    2537                 PyErr_SetString(PyExc_TypeError,
    2538                     "raise: exception class must be a subclass of BaseException");
    2539                 goto raise_error;
    2540             }
    2541         #endif
    2542     }
    2543 
    2544     __Pyx_ErrRestore(type, value, tb);
    2545     return;
    2546 raise_error:
    2547     Py_XDECREF(value);
    2548     Py_XDECREF(type);
    2549     Py_XDECREF(tb);
    2550     return;
    2551 }
    2552 
    2553 #else /* Python 3+ */
    2554 
    2555 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    2556     if (tb == Py_None) {
    2557         tb = 0;
    2558     } else if (tb && !PyTraceBack_Check(tb)) {
    2559         PyErr_SetString(PyExc_TypeError,
    2560             "raise: arg 3 must be a traceback or None");
    2561         goto bad;
    2562     }
    2563     if (value == Py_None)
    2564         value = 0;
    2565 
    2566     if (PyExceptionInstance_Check(type)) {
    2567         if (value) {
    2568             PyErr_SetString(PyExc_TypeError,
    2569                 "instance exception may not have a separate value");
    2570             goto bad;
    2571         }
    2572         value = type;
    2573         type = (PyObject*) Py_TYPE(value);
    2574     } else if (!PyExceptionClass_Check(type)) {
    2575         PyErr_SetString(PyExc_TypeError,
    2576             "raise: exception class must be a subclass of BaseException");
    2577         goto bad;
    2578     }
    2579 
    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 
    2603     PyErr_SetObject(type, value);
    2604 
    2605     if (tb) {
    2606         PyThreadState *tstate = PyThreadState_GET();
    2607         PyObject* tmp_tb = tstate->curexc_traceback;
    2608         if (tb != tmp_tb) {
    2609             Py_INCREF(tb);
    2610             tstate->curexc_traceback = tb;
    2611             Py_XDECREF(tmp_tb);
    2612         }
    2613     }
    2614 
    2615 bad:
    2616     return;
    2617 }
    2618 #endif
    2619 
    2620 static 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 
    2633 static 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;
    2692 arg_passed_twice:
    2693     __Pyx_RaiseDoubleKeywordsError(function_name, **name);
    2694     goto bad;
    2695 invalid_keyword_type:
    2696     PyErr_Format(PyExc_TypeError,
    2697         "%s() keywords must be strings", function_name);
    2698     goto bad;
    2699 invalid_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
    2708 bad:
    2709     return -1;
    2710 }
    2711 
    2712 static 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 
    2738 static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
    2739     const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
    2740     const int is_unsigned = neg_one > const_zero;
    2741     if (sizeof(unsigned char) < sizeof(long)) {
    2742         long val = __Pyx_PyInt_AsLong(x);
    2743         if (unlikely(val != (long)(unsigned char)val)) {
    2744             if (!unlikely(val == -1 && PyErr_Occurred())) {
    2745                 PyErr_SetString(PyExc_OverflowError,
    2746                     (is_unsigned && unlikely(val < 0)) ?
    2747                     "can't convert negative value to unsigned char" :
    2748                     "value too large to convert to unsigned char");
    2749             }
    2750             return (unsigned char)-1;
    2751         }
    2752         return (unsigned char)val;
    2753     }
    2754     return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
    2755 }
    2756 
    2757 static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
    2758     const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
    2759     const int is_unsigned = neg_one > const_zero;
    2760     if (sizeof(unsigned short) < sizeof(long)) {
    2761         long val = __Pyx_PyInt_AsLong(x);
    2762         if (unlikely(val != (long)(unsigned short)val)) {
    2763             if (!unlikely(val == -1 && PyErr_Occurred())) {
    2764                 PyErr_SetString(PyExc_OverflowError,
    2765                     (is_unsigned && unlikely(val < 0)) ?
    2766                     "can't convert negative value to unsigned short" :
    2767                     "value too large to convert to unsigned short");
    2768             }
    2769             return (unsigned short)-1;
    2770         }
    2771         return (unsigned short)val;
    2772     }
    2773     return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
    2774 }
    2775 
    2776 static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
    2777     const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
    2778     const int is_unsigned = neg_one > const_zero;
    2779     if (sizeof(unsigned int) < sizeof(long)) {
    2780         long val = __Pyx_PyInt_AsLong(x);
    2781         if (unlikely(val != (long)(unsigned int)val)) {
    2782             if (!unlikely(val == -1 && PyErr_Occurred())) {
    2783                 PyErr_SetString(PyExc_OverflowError,
    2784                     (is_unsigned && unlikely(val < 0)) ?
    2785                     "can't convert negative value to unsigned int" :
    2786                     "value too large to convert to unsigned int");
    2787             }
    2788             return (unsigned int)-1;
    2789         }
    2790         return (unsigned int)val;
    2791     }
    2792     return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
    2793 }
    2794 
    2795 static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
    2796     const char neg_one = (char)-1, const_zero = 0;
    2797     const int is_unsigned = neg_one > const_zero;
    2798     if (sizeof(char) < sizeof(long)) {
    2799         long val = __Pyx_PyInt_AsLong(x);
    2800         if (unlikely(val != (long)(char)val)) {
    2801             if (!unlikely(val == -1 && PyErr_Occurred())) {
    2802                 PyErr_SetString(PyExc_OverflowError,
    2803                     (is_unsigned && unlikely(val < 0)) ?
    2804                     "can't convert negative value to char" :
    2805                     "value too large to convert to char");
    2806             }
    2807             return (char)-1;
    2808         }
    2809         return (char)val;
    2810     }
    2811     return (char)__Pyx_PyInt_AsLong(x);
    2812 }
    2813 
    2814 static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
    2815     const short neg_one = (short)-1, const_zero = 0;
    2816     const int is_unsigned = neg_one > const_zero;
    2817     if (sizeof(short) < sizeof(long)) {
    2818         long val = __Pyx_PyInt_AsLong(x);
    2819         if (unlikely(val != (long)(short)val)) {
    2820             if (!unlikely(val == -1 && PyErr_Occurred())) {
    2821                 PyErr_SetString(PyExc_OverflowError,
    2822                     (is_unsigned && unlikely(val < 0)) ?
    2823                     "can't convert negative value to short" :
    2824                     "value too large to convert to short");
    2825             }
    2826             return (short)-1;
    2827         }
    2828         return (short)val;
    2829     }
    2830     return (short)__Pyx_PyInt_AsLong(x);
    2831 }
    2832 
    2833 static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
    2834     const int neg_one = (int)-1, const_zero = 0;
    2835     const int is_unsigned = neg_one > const_zero;
    2836     if (sizeof(int) < sizeof(long)) {
    2837         long val = __Pyx_PyInt_AsLong(x);
    2838         if (unlikely(val != (long)(int)val)) {
    2839             if (!unlikely(val == -1 && PyErr_Occurred())) {
    2840                 PyErr_SetString(PyExc_OverflowError,
    2841                     (is_unsigned && unlikely(val < 0)) ?
    2842                     "can't convert negative value to int" :
    2843                     "value too large to convert to int");
    2844             }
    2845             return (int)-1;
    2846         }
    2847         return (int)val;
    2848     }
    2849     return (int)__Pyx_PyInt_AsLong(x);
    2850 }
    2851 
    2852 static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
    2853     const signed char neg_one = (signed char)-1, const_zero = 0;
    2854     const int is_unsigned = neg_one > const_zero;
    2855     if (sizeof(signed char) < sizeof(long)) {
    2856         long val = __Pyx_PyInt_AsLong(x);
    2857         if (unlikely(val != (long)(signed char)val)) {
    2858             if (!unlikely(val == -1 && PyErr_Occurred())) {
    2859                 PyErr_SetString(PyExc_OverflowError,
    2860                     (is_unsigned && unlikely(val < 0)) ?
    2861                     "can't convert negative value to signed char" :
    2862                     "value too large to convert to signed char");
    2863             }
    2864             return (signed char)-1;
    2865         }
    2866         return (signed char)val;
    2867     }
    2868     return (signed char)__Pyx_PyInt_AsSignedLong(x);
    2869 }
    2870 
    2871 static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
    2872     const signed short neg_one = (signed short)-1, const_zero = 0;
    2873     const int is_unsigned = neg_one > const_zero;
    2874     if (sizeof(signed short) < sizeof(long)) {
    2875         long val = __Pyx_PyInt_AsLong(x);
    2876         if (unlikely(val != (long)(signed short)val)) {
    2877             if (!unlikely(val == -1 && PyErr_Occurred())) {
    2878                 PyErr_SetString(PyExc_OverflowError,
    2879                     (is_unsigned && unlikely(val < 0)) ?
    2880                     "can't convert negative value to signed short" :
    2881                     "value too large to convert to signed short");
    2882             }
    2883             return (signed short)-1;
    2884         }
    2885         return (signed short)val;
    2886     }
    2887     return (signed short)__Pyx_PyInt_AsSignedLong(x);
    2888 }
    2889 
    2890 static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
    2891     const signed int neg_one = (signed int)-1, const_zero = 0;
    2892     const int is_unsigned = neg_one > const_zero;
    2893     if (sizeof(signed int) < sizeof(long)) {
    2894         long val = __Pyx_PyInt_AsLong(x);
    2895         if (unlikely(val != (long)(signed int)val)) {
    2896             if (!unlikely(val == -1 && PyErr_Occurred())) {
    2897                 PyErr_SetString(PyExc_OverflowError,
    2898                     (is_unsigned && unlikely(val < 0)) ?
    2899                     "can't convert negative value to signed int" :
    2900                     "value too large to convert to signed int");
    2901             }
    2902             return (signed int)-1;
    2903         }
    2904         return (signed int)val;
    2905     }
    2906     return (signed int)__Pyx_PyInt_AsSignedLong(x);
    2907 }
    2908 
    2909 static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
    2910     const int neg_one = (int)-1, const_zero = 0;
    2911     const int is_unsigned = neg_one > const_zero;
    2912     if (sizeof(int) < sizeof(long)) {
    2913         long val = __Pyx_PyInt_AsLong(x);
    2914         if (unlikely(val != (long)(int)val)) {
    2915             if (!unlikely(val == -1 && PyErr_Occurred())) {
    2916                 PyErr_SetString(PyExc_OverflowError,
    2917                     (is_unsigned && unlikely(val < 0)) ?
    2918                     "can't convert negative value to int" :
    2919                     "value too large to convert to int");
    2920             }
    2921             return (int)-1;
    2922         }
    2923         return (int)val;
    2924     }
    2925     return (int)__Pyx_PyInt_AsLong(x);
    2926 }
    2927 
    2928 static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
    2929     const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
    2930     const int is_unsigned = neg_one > const_zero;
    2931 #if PY_VERSION_HEX < 0x03000000
    2932     if (likely(PyInt_Check(x))) {
    2933         long val = PyInt_AS_LONG(x);
    2934         if (is_unsigned && unlikely(val < 0)) {
    2935             PyErr_SetString(PyExc_OverflowError,
    2936                             "can't convert negative value to unsigned long");
    2937             return (unsigned long)-1;
    2938         }
    2939         return (unsigned long)val;
    2940     } else
    2941 #endif
    2942     if (likely(PyLong_Check(x))) {
    2943         if (is_unsigned) {
    2944             if (unlikely(Py_SIZE(x) < 0)) {
    2945                 PyErr_SetString(PyExc_OverflowError,
    2946                                 "can't convert negative value to unsigned long");
    2947                 return (unsigned long)-1;
    2948             }
    2949             return (unsigned long)PyLong_AsUnsignedLong(x);
    2950         } else {
    2951             return (unsigned long)PyLong_AsLong(x);
    2952         }
    2953     } else {
    2954         unsigned long val;
    2955         PyObject *tmp = __Pyx_PyNumber_Int(x);
    2956         if (!tmp) return (unsigned long)-1;
    2957         val = __Pyx_PyInt_AsUnsignedLong(tmp);
    2958         Py_DECREF(tmp);
    2959         return val;
    2960     }
    2961 }
    2962 
    2963 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
    2964     const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
    2965     const int is_unsigned = neg_one > const_zero;
    2966 #if PY_VERSION_HEX < 0x03000000
    2967     if (likely(PyInt_Check(x))) {
    2968         long val = PyInt_AS_LONG(x);
    2969         if (is_unsigned && unlikely(val < 0)) {
    2970             PyErr_SetString(PyExc_OverflowError,
    2971                             "can't convert negative value to unsigned PY_LONG_LONG");
    2972             return (unsigned PY_LONG_LONG)-1;
    2973         }
    2974         return (unsigned PY_LONG_LONG)val;
    2975     } else
    2976 #endif
    2977     if (likely(PyLong_Check(x))) {
    2978         if (is_unsigned) {
    2979             if (unlikely(Py_SIZE(x) < 0)) {
    2980                 PyErr_SetString(PyExc_OverflowError,
    2981                                 "can't convert negative value to unsigned PY_LONG_LONG");
    2982                 return (unsigned PY_LONG_LONG)-1;
    2983             }
    2984             return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
    2985         } else {
    2986             return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
    2987         }
    2988     } else {
    2989         unsigned PY_LONG_LONG val;
    2990         PyObject *tmp = __Pyx_PyNumber_Int(x);
    2991         if (!tmp) return (unsigned PY_LONG_LONG)-1;
    2992         val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
    2993         Py_DECREF(tmp);
    2994         return val;
    2995     }
    2996 }
    2997 
    2998 static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
    2999     const long neg_one = (long)-1, const_zero = 0;
    3000     const int is_unsigned = neg_one > const_zero;
    3001 #if PY_VERSION_HEX < 0x03000000
    3002     if (likely(PyInt_Check(x))) {
    3003         long val = PyInt_AS_LONG(x);
    3004         if (is_unsigned && unlikely(val < 0)) {
    3005             PyErr_SetString(PyExc_OverflowError,
    3006                             "can't convert negative value to long");
    3007             return (long)-1;
    3008         }
    3009         return (long)val;
    3010     } else
    3011 #endif
    3012     if (likely(PyLong_Check(x))) {
    3013         if (is_unsigned) {
    3014             if (unlikely(Py_SIZE(x) < 0)) {
    3015                 PyErr_SetString(PyExc_OverflowError,
    3016                                 "can't convert negative value to long");
    3017                 return (long)-1;
    3018             }
    3019             return (long)PyLong_AsUnsignedLong(x);
    3020         } else {
    3021             return (long)PyLong_AsLong(x);
    3022         }
    3023     } else {
    3024         long val;
    3025         PyObject *tmp = __Pyx_PyNumber_Int(x);
    3026         if (!tmp) return (long)-1;
    3027         val = __Pyx_PyInt_AsLong(tmp);
    3028         Py_DECREF(tmp);
    3029         return val;
    3030     }
    3031 }
    3032 
    3033 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
    3034     const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
    3035     const int is_unsigned = neg_one > const_zero;
    3036 #if PY_VERSION_HEX < 0x03000000
    3037     if (likely(PyInt_Check(x))) {
    3038         long val = PyInt_AS_LONG(x);
    3039         if (is_unsigned && unlikely(val < 0)) {
    3040             PyErr_SetString(PyExc_OverflowError,
    3041                             "can't convert negative value to PY_LONG_LONG");
    3042             return (PY_LONG_LONG)-1;
    3043         }
    3044         return (PY_LONG_LONG)val;
    3045     } else
    3046 #endif
    3047     if (likely(PyLong_Check(x))) {
    3048         if (is_unsigned) {
    3049             if (unlikely(Py_SIZE(x) < 0)) {
    3050                 PyErr_SetString(PyExc_OverflowError,
    3051                                 "can't convert negative value to PY_LONG_LONG");
    3052                 return (PY_LONG_LONG)-1;
    3053             }
    3054             return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
    3055         } else {
    3056             return (PY_LONG_LONG)PyLong_AsLongLong(x);
    3057         }
    3058     } else {
    3059         PY_LONG_LONG val;
    3060         PyObject *tmp = __Pyx_PyNumber_Int(x);
    3061         if (!tmp) return (PY_LONG_LONG)-1;
    3062         val = __Pyx_PyInt_AsLongLong(tmp);
    3063         Py_DECREF(tmp);
    3064         return val;
    3065     }
    3066 }
    3067 
    3068 static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
    3069     const signed long neg_one = (signed long)-1, const_zero = 0;
    3070     const int is_unsigned = neg_one > const_zero;
    3071 #if PY_VERSION_HEX < 0x03000000
    3072     if (likely(PyInt_Check(x))) {
    3073         long val = PyInt_AS_LONG(x);
    3074         if (is_unsigned && unlikely(val < 0)) {
    3075             PyErr_SetString(PyExc_OverflowError,
    3076                             "can't convert negative value to signed long");
    3077             return (signed long)-1;
    3078         }
    3079         return (signed long)val;
    3080     } else
    3081 #endif
    3082     if (likely(PyLong_Check(x))) {
    3083         if (is_unsigned) {
    3084             if (unlikely(Py_SIZE(x) < 0)) {
    3085                 PyErr_SetString(PyExc_OverflowError,
    3086                                 "can't convert negative value to signed long");
    3087                 return (signed long)-1;
    3088             }
    3089             return (signed long)PyLong_AsUnsignedLong(x);
    3090         } else {
    3091             return (signed long)PyLong_AsLong(x);
    3092         }
    3093     } else {
    3094         signed long val;
    3095         PyObject *tmp = __Pyx_PyNumber_Int(x);
    3096         if (!tmp) return (signed long)-1;
    3097         val = __Pyx_PyInt_AsSignedLong(tmp);
    3098         Py_DECREF(tmp);
    3099         return val;
    3100     }
    3101 }
    3102 
    3103 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
    3104     const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
    3105     const int is_unsigned = neg_one > const_zero;
    3106 #if PY_VERSION_HEX < 0x03000000
    3107     if (likely(PyInt_Check(x))) {
    3108         long val = PyInt_AS_LONG(x);
    3109         if (is_unsigned && unlikely(val < 0)) {
    3110             PyErr_SetString(PyExc_OverflowError,
    3111                             "can't convert negative value to signed PY_LONG_LONG");
    3112             return (signed PY_LONG_LONG)-1;
    3113         }
    3114         return (signed PY_LONG_LONG)val;
    3115     } else
    3116 #endif
    3117     if (likely(PyLong_Check(x))) {
    3118         if (is_unsigned) {
    3119             if (unlikely(Py_SIZE(x) < 0)) {
    3120                 PyErr_SetString(PyExc_OverflowError,
    3121                                 "can't convert negative value to signed PY_LONG_LONG");
    3122                 return (signed PY_LONG_LONG)-1;
    3123             }
    3124             return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
    3125         } else {
    3126             return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
    3127         }
    3128     } else {
    3129         signed PY_LONG_LONG val;
    3130         PyObject *tmp = __Pyx_PyNumber_Int(x);
    3131         if (!tmp) return (signed PY_LONG_LONG)-1;
    3132         val = __Pyx_PyInt_AsSignedLongLong(tmp);
    3133         Py_DECREF(tmp);
    3134         return val;
    3135     }
    3136 }
    3137 
    3138 static 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 
    3157 #include "compile.h"
    3158 #include "frameobject.h"
    3159 #include "traceback.h"
    3160 
    3161 static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
    3162                                int __pyx_lineno, const char *__pyx_filename) {
    3163     PyObject *py_srcfile = 0;
    3164     PyObject *py_funcname = 0;
    3165     PyObject *py_globals = 0;
    3166     PyCodeObject *py_code = 0;
    3167     PyFrameObject *py_frame = 0;
    3168 
    3169     #if PY_MAJOR_VERSION < 3
    3170     py_srcfile = PyString_FromString(__pyx_filename);
    3171     #else
    3172     py_srcfile = PyUnicode_FromString(__pyx_filename);
    3173     #endif
    3174     if (!py_srcfile) goto bad;
    3175     if (__pyx_clineno) {
    3176         #if PY_MAJOR_VERSION < 3
    3177         py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
    3178         #else
    3179         py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
    3180         #endif
    3181     }
    3182     else {
    3183         #if PY_MAJOR_VERSION < 3
    3184         py_funcname = PyString_FromString(funcname);
    3185         #else
    3186         py_funcname = PyUnicode_FromString(funcname);
    3187         #endif
    3188     }
    3189     if (!py_funcname) goto bad;
    3190     py_globals = PyModule_GetDict(__pyx_m);
    3191     if (!py_globals) goto bad;
    3192     py_code = PyCode_New(
    3193         0,            /*int argcount,*/
    3194         #if PY_MAJOR_VERSION >= 3
    3195         0,            /*int kwonlyargcount,*/
    3196         #endif
    3197         0,            /*int nlocals,*/
    3198         0,            /*int stacksize,*/
    3199         0,            /*int flags,*/
    3200         __pyx_empty_bytes, /*PyObject *code,*/
    3201         __pyx_empty_tuple,  /*PyObject *consts,*/
    3202         __pyx_empty_tuple,  /*PyObject *names,*/
    3203         __pyx_empty_tuple,  /*PyObject *varnames,*/
    3204         __pyx_empty_tuple,  /*PyObject *freevars,*/
    3205         __pyx_empty_tuple,  /*PyObject *cellvars,*/
    3206         py_srcfile,   /*PyObject *filename,*/
    3207         py_funcname,  /*PyObject *name,*/
    3208         __pyx_lineno,   /*int firstlineno,*/
    3209         __pyx_empty_bytes  /*PyObject *lnotab*/
    3210     );
    3211     if (!py_code) goto bad;
    3212     py_frame = PyFrame_New(
    3213         PyThreadState_GET(), /*PyThreadState *tstate,*/
    3214         py_code,             /*PyCodeObject *code,*/
    3215         py_globals,          /*PyObject *globals,*/
    3216         0                    /*PyObject *locals*/
    3217     );
    3218     if (!py_frame) goto bad;
    3219     py_frame->f_lineno = __pyx_lineno;
    3220     PyTraceBack_Here(py_frame);
    3221 bad:
    3222     Py_XDECREF(py_srcfile);
    3223     Py_XDECREF(py_funcname);
    3224     Py_XDECREF(py_code);
    3225     Py_XDECREF(py_frame);
    3226 }
    3227 
    3228 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    3229     while (t->p) {
    3230         #if PY_MAJOR_VERSION < 3
    3231         if (t->is_unicode) {
    3232             *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
    3233         } else if (t->intern) {
    3234             *t->p = PyString_InternFromString(t->s);
    3235         } else {
    3236             *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
    3237         }
    3238         #else  /* Python 3+ has unicode identifiers */
    3239         if (t->is_unicode | t->is_str) {
    3240             if (t->intern) {
    3241                 *t->p = PyUnicode_InternFromString(t->s);
    3242             } else if (t->encoding) {
    3243                 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
    3244             } else {
    3245                 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
    3246             }
    3247         } else {
    3248             *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
    3249         }
    3250         #endif
    3251         if (!*t->p)
    3252             return -1;
    3253         ++t;
    3254     }
    3255     return 0;
    3256 }
    3257 
    3258 /* Type Conversion Functions */
    3259 
    3260 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
    3261    int is_true = x == Py_True;
    3262    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
    3263    else return PyObject_IsTrue(x);
    3264 }
    3265 
    3266 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
    3267   PyNumberMethods *m;
    3268   const char *name = NULL;
    3269   PyObject *res = NULL;
    3270 #if PY_VERSION_HEX < 0x03000000
    3271   if (PyInt_Check(x) || PyLong_Check(x))
    3272 #else
    3273   if (PyLong_Check(x))
    3274 #endif
    3275     return Py_INCREF(x), x;
    3276   m = Py_TYPE(x)->tp_as_number;
    3277 #if PY_VERSION_HEX < 0x03000000
    3278   if (m && m->nb_int) {
    3279     name = "int";
    3280     res = PyNumber_Int(x);
    3281   }
    3282   else if (m && m->nb_long) {
    3283     name = "long";
    3284     res = PyNumber_Long(x);
    3285   }
    3286 #else
    3287   if (m && m->nb_int) {
    3288     name = "int";
    3289     res = PyNumber_Long(x);
    3290   }
    3291 #endif
    3292   if (res) {
    3293 #if PY_VERSION_HEX < 0x03000000
    3294     if (!PyInt_Check(res) && !PyLong_Check(res)) {
    3295 #else
    3296     if (!PyLong_Check(res)) {
    3297 #endif
    3298       PyErr_Format(PyExc_TypeError,
    3299                    "__%s__ returned non-%s (type %.200s)",
    3300                    name, name, Py_TYPE(res)->tp_name);
    3301       Py_DECREF(res);
    3302       return NULL;
    3303     }
    3304   }
    3305   else if (!PyErr_Occurred()) {
    3306     PyErr_SetString(PyExc_TypeError,
    3307                     "an integer is required");
    3308   }
    3309   return res;
    3310 }
    3311 
    3312 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
    3313   Py_ssize_t ival;
    3314   PyObject* x = PyNumber_Index(b);
    3315   if (!x) return -1;
    3316   ival = PyInt_AsSsize_t(x);
    3317   Py_DECREF(x);
    3318   return ival;
    3319 }
    3320 
    3321 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    3322 #if PY_VERSION_HEX < 0x02050000
    3323    if (ival <= LONG_MAX)
    3324        return PyInt_FromLong((long)ival);
    3325    else {
    3326        unsigned char *bytes = (unsigned char *) &ival;
    3327        int one = 1; int little = (int)*(unsigned char*)&one;
    3328        return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
    3329    }
    3330 #else
    3331    return PyInt_FromSize_t(ival);
    3332 #endif
    3333 }
    3334 
    3335 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
    3336    unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
    3337    if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
    3338        return (size_t)-1;
    3339    } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
    3340        PyErr_SetString(PyExc_OverflowError,
    3341                        "value too large to convert to size_t");
    3342        return (size_t)-1;
    3343    }
    3344    return (size_t)val;
    3345 }
    3346 
    3347 
    3348 #endif /* Py_PYTHON_H */
  • deleted file twisted/python/_epoll.pyx

    diff --git twisted/python/_epoll.pyx twisted/python/_epoll.pyx
    deleted file mode 100644
    index b8d6aa7..0000000
    + -  
    1 # Copyright (c) Twisted Matrix Laboratories.
    2 # See LICENSE for details.
    3 
    4 """
    5 Interface to epoll I/O event notification facility.
    6 """
    7 
    8 # NOTE: The version of Pyrex you are using probably _does not work_ with
    9 # Python 2.5.  If you need to recompile this file, _make sure you are using
    10 # a version of Pyrex which works with Python 2.5_.  I am using 0.9.4.1 from
    11 # <http://codespeak.net/svn/lxml/pyrex/>. -exarkun
    12 
    13 cdef extern from "stdio.h":
    14     cdef extern void *malloc(int)
    15     cdef extern void free(void *)
    16     cdef extern int close(int)
    17 
    18 cdef extern from "errno.h":
    19     cdef extern int errno
    20     cdef extern char *strerror(int)
    21 
    22 cdef extern from "string.h":
    23     cdef extern void *memset(void* s, int c, int n)
    24 
    25 cdef extern from "stdint.h":
    26     ctypedef unsigned long uint32_t
    27     ctypedef unsigned long long uint64_t
    28 
    29 cdef extern from "sys/epoll.h":
    30 
    31     cdef enum:
    32         EPOLL_CTL_ADD = 1
    33         EPOLL_CTL_DEL = 2
    34         EPOLL_CTL_MOD = 3
    35 
    36     cdef enum EPOLL_EVENTS:
    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)
    48 
    49     ctypedef union epoll_data_t:
    50         void *ptr
    51         int fd
    52         uint32_t u32
    53         uint64_t u64
    54 
    55     cdef struct epoll_event:
    56         uint32_t events
    57         epoll_data_t data
    58 
    59     int epoll_create(int size)
    60     int epoll_ctl(int epfd, int op, int fd, epoll_event *event)
    61     int epoll_wait(int epfd, epoll_event *events, int maxevents, int timeout)
    62 
    63 cdef extern from "Python.h":
    64     ctypedef struct PyThreadState
    65     cdef extern PyThreadState *PyEval_SaveThread()
    66     cdef extern void PyEval_RestoreThread(PyThreadState*)
    67 
    68 cdef 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 
    106 cdef class epoll:
    107     """
    108     Represent a set of file descriptors being monitored for events.
    109     """
    110 
    111     cdef int fd
    112     cdef int initialized
    113 
    114     def __init__(self, int size=1023):
    115         """
    116         The constructor arguments are compatible with select.poll.__init__.
    117         """
    118         self.fd = epoll_create(size)
    119         if self.fd == -1:
    120             raise IOError(errno, strerror(errno))
    121         self.initialized = 1
    122 
    123     def __dealloc__(self):
    124         if self.initialized:
    125             close(self.fd)
    126             self.initialized = 0
    127 
    128     def close(self):
    129         """
    130         Close the epoll file descriptor.
    131         """
    132         if self.initialized:
    133             if close(self.fd) == -1:
    134                 raise IOError(errno, strerror(errno))
    135             self.initialized = 0
    136 
    137     def fileno(self):
    138         """
    139         Return the epoll file descriptor number.
    140         """
    141         return self.fd
    142 
    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 
    212     def _control(self, int op, int fd, int events):
    213         """
    214         Modify the monitored state of a particular file descriptor.
    215 
    216         Wrap epoll_ctl(2).
    217 
    218         @type op: C{int}
    219         @param op: One of CTL_ADD, CTL_DEL, or CTL_MOD
    220 
    221         @type fd: C{int}
    222         @param fd: File descriptor to modify
    223 
    224         @type events: C{int}
    225         @param events: A bit set of IN, OUT, PRI, ERR, HUP, and ET.
    226 
    227         @raise IOError: Raised if the underlying epoll_ctl() call fails.
    228         """
    229         cdef int result
    230         cdef epoll_event evt
    231         evt.events = events
    232         evt.data.fd = fd
    233         result = epoll_ctl(self.fd, op, fd, &evt)
    234         if result == -1:
    235             raise IOError(errno, strerror(errno))
    236 
    237     def wait(self, unsigned int maxevents, int timeout):
    238         """
    239         Wait for an I/O event, wrap epoll_wait(2).
    240 
    241         @type maxevents: C{int}
    242         @param maxevents: Maximum number of events returned.
    243 
    244         @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}
    262         @param timeout: Maximum time waiting for events. 0 makes it return
    263             immediately whereas -1 makes it wait indefinitely.
    264 
    265         @raise IOError: Raised if the underlying epoll_wait() call fails.
    266         """
    267         return call_epoll_wait(self.fd, maxevents, <int>(timeout * 1000.0))
    268 
    269 
    270 CTL_ADD = EPOLL_CTL_ADD
    271 CTL_DEL = EPOLL_CTL_DEL
    272 CTL_MOD = EPOLL_CTL_MOD
    273 
    274 IN = EPOLLIN = c_EPOLLIN
    275 OUT = EPOLLOUT = c_EPOLLOUT
    276 PRI = EPOLLPRI = c_EPOLLPRI
    277 ERR = EPOLLERR = c_EPOLLERR
    278 HUP = EPOLLHUP = c_EPOLLHUP
    279 ET = EPOLLET = c_EPOLLET
    280 
    281 RDNORM = EPOLLRDNORM = c_EPOLLRDNORM
    282 RDBAND = EPOLLRDBAND = c_EPOLLRDBAND
    283 WRNORM = EPOLLWRNORM = c_EPOLLWRNORM
    284 WRBAND = EPOLLWRBAND = c_EPOLLWRBAND
    285 MSG = EPOLLMSG = c_EPOLLMSG
  • twisted/python/dist.py

    diff --git twisted/python/dist.py twisted/python/dist.py
    index 26e5b57..b74148e 100644
    def _checkCPython(sys=sys, platform=platform): 
    417417
    418418_isCPython = _checkCPython()
    419419
    420 
    421 def _hasEpoll(builder):
    422     """
    423     Checks if the header for building epoll (C{sys/epoll.h}) is available.
    424 
    425     @return: C{True} if the header is available, C{False} otherwise.
    426     """
    427     return builder._check_header("sys/epoll.h")
  • deleted file twisted/test/test_epoll.py

    diff --git twisted/test/test_epoll.py twisted/test/test_epoll.py
    deleted file mode 100644
    index b96e06f..0000000
    + -  
    1 # Copyright (c) Twisted Matrix Laboratories.
    2 # See LICENSE for details.
    3 
    4 """
    5 Tests for epoll wrapper.
    6 """
    7 
    8 import socket, errno, time
    9 
    10 from twisted.trial import unittest
    11 from twisted.python.util import untilConcludes
    12 
    13 try:
    14     from twisted.python import _epoll
    15 except ImportError:
    16     _epoll = None
    17 
    18 
    19 class EPoll(unittest.TestCase):
    20     """
    21     Tests for the low-level epoll bindings.
    22     """
    23     def setUp(self):
    24         """
    25         Create a listening server port and a list with which to keep track
    26         of created sockets.
    27         """
    28         self.serverSocket = socket.socket()
    29         self.serverSocket.bind(('127.0.0.1', 0))
    30         self.serverSocket.listen(1)
    31         self.connections = [self.serverSocket]
    32 
    33 
    34     def tearDown(self):
    35         """
    36         Close any sockets which were opened by the test.
    37         """
    38         for skt in self.connections:
    39             skt.close()
    40 
    41 
    42     def _connectedPair(self):
    43         """
    44         Return the two sockets which make up a new TCP connection.
    45         """
    46         client = socket.socket()
    47         client.setblocking(False)
    48         try:
    49             client.connect(('127.0.0.1', self.serverSocket.getsockname()[1]))
    50         except socket.error, e:
    51             self.assertEqual(e.args[0], errno.EINPROGRESS)
    52         else:
    53             raise unittest.FailTest("Connect should have raised EINPROGRESS")
    54         server, addr = self.serverSocket.accept()
    55 
    56         self.connections.extend((client, server))
    57         return client, server
    58 
    59 
    60     def test_create(self):
    61         """
    62         Test the creation of an epoll object.
    63         """
    64         try:
    65             p = _epoll.epoll(16)
    66         except OSError, e:
    67             raise unittest.FailTest(str(e))
    68         else:
    69             p.close()
    70 
    71 
    72     def test_badCreate(self):
    73         """
    74         Test that attempting to create an epoll object with some random
    75         objects raises a TypeError.
    76         """
    77         self.assertRaises(TypeError, _epoll.epoll, 1, 2, 3)
    78         self.assertRaises(TypeError, _epoll.epoll, 'foo')
    79         self.assertRaises(TypeError, _epoll.epoll, None)
    80         self.assertRaises(TypeError, _epoll.epoll, ())
    81         self.assertRaises(TypeError, _epoll.epoll, ['foo'])
    82         self.assertRaises(TypeError, _epoll.epoll, {})
    83 
    84 
    85     def test_add(self):
    86         """
    87         Test adding a socket to an epoll object.
    88         """
    89         server, client = self._connectedPair()
    90 
    91         p = _epoll.epoll(2)
    92         try:
    93             p._control(_epoll.CTL_ADD, server.fileno(), _epoll.IN | _epoll.OUT)
    94             p._control(_epoll.CTL_ADD, client.fileno(), _epoll.IN | _epoll.OUT)
    95         finally:
    96             p.close()
    97 
    98 
    99     def test_controlAndWait(self):
    100         """
    101         Test waiting on an epoll object which has had some sockets added to
    102         it.
    103         """
    104         client, server = self._connectedPair()
    105 
    106         p = _epoll.epoll(16)
    107         p._control(_epoll.CTL_ADD, client.fileno(), _epoll.IN | _epoll.OUT |
    108                    _epoll.ET)
    109         p._control(_epoll.CTL_ADD, server.fileno(), _epoll.IN | _epoll.OUT |
    110                    _epoll.ET)
    111 
    112         now = time.time()
    113         events = untilConcludes(p.wait, 4, 1000)
    114         then = time.time()
    115         self.failIf(then - now > 0.01)
    116 
    117         events.sort()
    118         expected = [(client.fileno(), _epoll.OUT),
    119                     (server.fileno(), _epoll.OUT)]
    120         expected.sort()
    121 
    122         self.assertEqual(events, expected)
    123 
    124         now = time.time()
    125         events = untilConcludes(p.wait, 4, 200)
    126         then = time.time()
    127         self.failUnless(then - now > 0.1)
    128         self.failIf(events)
    129 
    130         client.send("Hello!")
    131         server.send("world!!!")
    132 
    133         now = time.time()
    134         events = untilConcludes(p.wait, 4, 1000)
    135         then = time.time()
    136         self.failIf(then - now > 0.01)
    137 
    138         events.sort()
    139         expected = [(client.fileno(), _epoll.IN | _epoll.OUT),
    140                     (server.fileno(), _epoll.IN | _epoll.OUT)]
    141         expected.sort()
    142 
    143         self.assertEqual(events, expected)
    144 
    145 if _epoll is None:
    146     EPoll.skip = "_epoll module unavailable"
    147 else:
    148     try:
    149         e = _epoll.epoll(16)
    150     except IOError, exc:
    151         if exc.errno == errno.ENOSYS:
    152             del exc
    153             EPoll.skip = "epoll support missing from platform"
    154         else:
    155             raise
    156     else:
    157         e.close()
    158         del e
  • twisted/topfiles/setup.py

    diff --git twisted/topfiles/setup.py twisted/topfiles/setup.py
    index 04c216c..18c7fb9 100644
    if os.path.exists('twisted'): 
    1818from twisted import copyright
    1919from twisted.python.dist import setup, ConditionalExtension as Extension
    2020from twisted.python.dist import getPackages, getDataFiles, getScripts
    21 from twisted.python.dist import twisted_subprojects, _isCPython, _hasEpoll
     21from twisted.python.dist import twisted_subprojects, _isCPython
    2222
    2323
    2424extensions = [
    extensions = [ 
    2626              ["twisted/test/raiser.c"],
    2727              condition=lambda _: _isCPython),
    2828
    29     Extension("twisted.python._epoll",
    30               ["twisted/python/_epoll.c"],
    31               condition=lambda builder: (_isCPython and _hasEpoll(builder) and
    32                                          sys.version_info[:2] < (2, 6))),
    33 
    3429    Extension("twisted.internet.iocpreactor.iocpsupport",
    3530              ["twisted/internet/iocpreactor/iocpsupport/iocpsupport.c",
    3631               "twisted/internet/iocpreactor/iocpsupport/winsock_pointers.c"],