Ticket #4247: _epoll.diff

File _epoll.diff, 135.6 KB (added by loewis, 7 years ago)
  • twisted/python/_epoll.c

     
    1 /* Generated by Pyrex 0.9.4.1 on Sun Oct 15 15:04:09 2006 */
     1/* Generated by Cython 0.12 on Sat Jan 30 19:12:02 2010 */
    22
    33#define PY_SSIZE_T_CLEAN
    44#include "Python.h"
    55#include "structmember.h"
     6#ifndef Py_PYTHON_H
     7    #error Python headers needed to compile C extensions, please install development version of Python.
     8#else
    69#ifndef PY_LONG_LONG
    710  #define PY_LONG_LONG LONG_LONG
    811#endif
     12#ifndef DL_EXPORT
     13  #define DL_EXPORT(t) t
     14#endif
     15#if PY_VERSION_HEX < 0x02040000
     16  #define METH_COEXIST 0
     17  #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
     18  #define PyDict_Contains(d,o)   PySequence_Contains(d,o)
     19#endif
    920#if PY_VERSION_HEX < 0x02050000
    1021  typedef int Py_ssize_t;
    1122  #define PY_SSIZE_T_MAX INT_MAX
    1223  #define PY_SSIZE_T_MIN INT_MIN
     24  #define PY_FORMAT_SIZE_T ""
    1325  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
    1426  #define PyInt_AsSsize_t(o)   PyInt_AsLong(o)
     27  #define PyNumber_Index(o)    PyNumber_Int(o)
     28  #define PyIndex_Check(o)     PyNumber_Check(o)
    1529#endif
     30#if PY_VERSION_HEX < 0x02060000
     31  #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
     32  #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
     33  #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
     34  #define PyVarObject_HEAD_INIT(type, size) \
     35          PyObject_HEAD_INIT(type) size,
     36  #define PyType_Modified(t)
     37
     38  typedef struct {
     39       void *buf;
     40       PyObject *obj;
     41       Py_ssize_t len;
     42       Py_ssize_t itemsize;
     43       int readonly;
     44       int ndim;
     45       char *format;
     46       Py_ssize_t *shape;
     47       Py_ssize_t *strides;
     48       Py_ssize_t *suboffsets;
     49       void *internal;
     50  } Py_buffer;
     51
     52  #define PyBUF_SIMPLE 0
     53  #define PyBUF_WRITABLE 0x0001
     54  #define PyBUF_FORMAT 0x0004
     55  #define PyBUF_ND 0x0008
     56  #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
     57  #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
     58  #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
     59  #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
     60  #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
     61
     62#endif
     63#if PY_MAJOR_VERSION < 3
     64  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
     65#else
     66  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
     67#endif
     68#if PY_MAJOR_VERSION >= 3
     69  #define Py_TPFLAGS_CHECKTYPES 0
     70  #define Py_TPFLAGS_HAVE_INDEX 0
     71#endif
     72#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
     73  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
     74#endif
     75#if PY_MAJOR_VERSION >= 3
     76  #define PyBaseString_Type            PyUnicode_Type
     77  #define PyString_Type                PyUnicode_Type
     78  #define PyString_CheckExact          PyUnicode_CheckExact
     79#else
     80  #define PyBytes_Type                 PyString_Type
     81  #define PyBytes_CheckExact           PyString_CheckExact
     82#endif
     83#if PY_MAJOR_VERSION >= 3
     84  #define PyInt_Type                   PyLong_Type
     85  #define PyInt_Check(op)              PyLong_Check(op)
     86  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
     87  #define PyInt_FromString             PyLong_FromString
     88  #define PyInt_FromUnicode            PyLong_FromUnicode
     89  #define PyInt_FromLong               PyLong_FromLong
     90  #define PyInt_FromSize_t             PyLong_FromSize_t
     91  #define PyInt_FromSsize_t            PyLong_FromSsize_t
     92  #define PyInt_AsLong                 PyLong_AsLong
     93  #define PyInt_AS_LONG                PyLong_AS_LONG
     94  #define PyInt_AsSsize_t              PyLong_AsSsize_t
     95  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
     96  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
     97  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
     98  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
     99#else
     100  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
     101  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
     102#endif
     103#if PY_MAJOR_VERSION >= 3
     104  #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func)
     105#endif
     106#if !defined(WIN32) && !defined(MS_WINDOWS)
     107  #ifndef __stdcall
     108    #define __stdcall
     109  #endif
     110  #ifndef __cdecl
     111    #define __cdecl
     112  #endif
     113  #ifndef __fastcall
     114    #define __fastcall
     115  #endif
     116#else
     117  #define _USE_MATH_DEFINES
     118#endif
     119#if PY_VERSION_HEX < 0x02050000
     120  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
     121  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
     122  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),((char *)(n)))
     123#else
     124  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),(n))
     125  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
     126  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
     127#endif
     128#if PY_VERSION_HEX < 0x02050000
     129  #define __Pyx_NAMESTR(n) ((char *)(n))
     130  #define __Pyx_DOCSTR(n)  ((char *)(n))
     131#else
     132  #define __Pyx_NAMESTR(n) (n)
     133  #define __Pyx_DOCSTR(n)  (n)
     134#endif
    16135#ifdef __cplusplus
    17136#define __PYX_EXTERN_C extern "C"
    18137#else
    19138#define __PYX_EXTERN_C extern
    20139#endif
    21 __PYX_EXTERN_C double pow(double, double);
     140#include <math.h>
     141#define __PYX_HAVE_API__twisted__python___epoll
    22142#include "stdio.h"
    23143#include "errno.h"
    24144#include "string.h"
    25145#include "stdint.h"
    26146#include "sys/epoll.h"
     147#include "Python.h"
    27148
     149#ifdef __GNUC__
     150#define INLINE __inline__
     151#elif _WIN32
     152#define INLINE __inline
     153#else
     154#define INLINE
     155#endif
    28156
    29 typedef struct {const char *s; const void **p;} __Pyx_CApiTabEntry; /*proto*/
    30 typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/
    31 typedef struct {PyObject **p; char *s; long n;} __Pyx_StringTabEntry; /*proto*/
    32 static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t); /*proto*/
    33 static int __Pyx_EndUnpack(PyObject *, Py_ssize_t); /*proto*/
    34 static int __Pyx_PrintItem(PyObject *); /*proto*/
    35 static int __Pyx_PrintNewline(void); /*proto*/
    36 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
    37 static void __Pyx_ReRaise(void); /*proto*/
    38 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
    39 static PyObject *__Pyx_GetExcValue(void); /*proto*/
    40 static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name); /*proto*/
    41 static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
    42 static int __Pyx_GetStarArgs(PyObject **args, PyObject **kwds, char *kwd_list[], Py_ssize_t nargs, PyObject **args2, PyObject **kwds2); /*proto*/
    43 static void __Pyx_WriteUnraisable(char *name); /*proto*/
    44 static void __Pyx_AddTraceback(char *funcname); /*proto*/
    45 static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, long size);  /*proto*/
    46 static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
    47 static int __Pyx_GetVtable(PyObject *dict, void *vtabptr); /*proto*/
    48 static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, char *modname); /*proto*/
    49 static int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/
    50 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
    51 static int __Pyx_InitCApi(PyObject *module); /*proto*/
    52 static int __Pyx_ImportModuleCApi(__Pyx_CApiTabEntry *t); /*proto*/
    53 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
     157typedef 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*/
    54158
     159
     160/* Type Conversion Predeclarations */
     161
     162#if PY_MAJOR_VERSION < 3
     163#define __Pyx_PyBytes_FromString          PyString_FromString
     164#define __Pyx_PyBytes_FromStringAndSize   PyString_FromStringAndSize
     165#define __Pyx_PyBytes_AsString            PyString_AsString
     166#else
     167#define __Pyx_PyBytes_FromString          PyBytes_FromString
     168#define __Pyx_PyBytes_FromStringAndSize   PyBytes_FromStringAndSize
     169#define __Pyx_PyBytes_AsString            PyBytes_AsString
     170#endif
     171
     172#define __Pyx_PyBytes_FromUString(s)      __Pyx_PyBytes_FromString((char*)s)
     173#define __Pyx_PyBytes_AsUString(s)        ((unsigned char*) __Pyx_PyBytes_AsString(s))
     174
     175#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
     176static INLINE int __Pyx_PyObject_IsTrue(PyObject*);
     177static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
     178
     179#if !defined(T_PYSSIZET)
     180#if PY_VERSION_HEX < 0x02050000
     181#define T_PYSSIZET T_INT
     182#elif !defined(T_LONGLONG)
     183#define T_PYSSIZET \
     184        ((sizeof(Py_ssize_t) == sizeof(int))  ? T_INT  : \
     185        ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1))
     186#else
     187#define T_PYSSIZET \
     188        ((sizeof(Py_ssize_t) == sizeof(int))          ? T_INT      : \
     189        ((sizeof(Py_ssize_t) == sizeof(long))         ? T_LONG     : \
     190        ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1)))
     191#endif
     192#endif
     193
     194
     195#if !defined(T_ULONGLONG)
     196#define __Pyx_T_UNSIGNED_INT(x) \
     197        ((sizeof(x) == sizeof(unsigned char))  ? T_UBYTE : \
     198        ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \
     199        ((sizeof(x) == sizeof(unsigned int))   ? T_UINT : \
     200        ((sizeof(x) == sizeof(unsigned long))  ? T_ULONG : -1))))
     201#else
     202#define __Pyx_T_UNSIGNED_INT(x) \
     203        ((sizeof(x) == sizeof(unsigned char))  ? T_UBYTE : \
     204        ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \
     205        ((sizeof(x) == sizeof(unsigned int))   ? T_UINT : \
     206        ((sizeof(x) == sizeof(unsigned long))  ? T_ULONG : \
     207        ((sizeof(x) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1)))))
     208#endif
     209#if !defined(T_LONGLONG)
     210#define __Pyx_T_SIGNED_INT(x) \
     211        ((sizeof(x) == sizeof(char))  ? T_BYTE : \
     212        ((sizeof(x) == sizeof(short)) ? T_SHORT : \
     213        ((sizeof(x) == sizeof(int))   ? T_INT : \
     214        ((sizeof(x) == sizeof(long))  ? T_LONG : -1))))
     215#else
     216#define __Pyx_T_SIGNED_INT(x) \
     217        ((sizeof(x) == sizeof(char))  ? T_BYTE : \
     218        ((sizeof(x) == sizeof(short)) ? T_SHORT : \
     219        ((sizeof(x) == sizeof(int))   ? T_INT : \
     220        ((sizeof(x) == sizeof(long))  ? T_LONG : \
     221        ((sizeof(x) == sizeof(PY_LONG_LONG))   ? T_LONGLONG : -1)))))
     222#endif
     223
     224#define __Pyx_T_FLOATING(x) \
     225        ((sizeof(x) == sizeof(float)) ? T_FLOAT : \
     226        ((sizeof(x) == sizeof(double)) ? T_DOUBLE : -1))
     227
     228#if !defined(T_SIZET)
     229#if !defined(T_ULONGLONG)
     230#define T_SIZET \
     231        ((sizeof(size_t) == sizeof(unsigned int))  ? T_UINT  : \
     232        ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1))
     233#else
     234#define T_SIZET \
     235        ((sizeof(size_t) == sizeof(unsigned int))          ? T_UINT      : \
     236        ((sizeof(size_t) == sizeof(unsigned long))         ? T_ULONG     : \
     237        ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1)))
     238#endif
     239#endif
     240
     241static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
     242static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
     243static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
     244
     245#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
     246
     247
     248#ifdef __GNUC__
     249/* Test for GCC > 2.95 */
     250#if __GNUC__ > 2 ||               (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
     251#define likely(x)   __builtin_expect(!!(x), 1)
     252#define unlikely(x) __builtin_expect(!!(x), 0)
     253#else /* __GNUC__ > 2 ... */
     254#define likely(x)   (x)
     255#define unlikely(x) (x)
     256#endif /* __GNUC__ > 2 ... */
     257#else /* __GNUC__ */
     258#define likely(x)   (x)
     259#define unlikely(x) (x)
     260#endif /* __GNUC__ */
     261   
    55262static PyObject *__pyx_m;
    56263static PyObject *__pyx_b;
     264static PyObject *__pyx_empty_tuple;
     265static PyObject *__pyx_empty_bytes;
    57266static int __pyx_lineno;
    58 static char *__pyx_filename;
    59 static char **__pyx_f;
     267static int __pyx_clineno = 0;
     268static const char * __pyx_cfilenm= __FILE__;
     269static const char *__pyx_filename;
     270static const char **__pyx_f;
    60271
    61 static char __pyx_mdoc[] = "\nInterface to epoll I/O event notification facility.\n";
    62272
    63 /* Declarations from _epoll */
     273/* Type declarations */
    64274
     275/* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":68
     276 *     cdef extern void PyEval_RestoreThread(PyThreadState*)
     277 *
     278 * cdef class epoll:             # <<<<<<<<<<<<<<
     279 *     """
     280 *     Represent a set of file descriptors being monitored for events.
     281 */
    65282
    66 struct __pyx_obj_6_epoll_epoll {
     283struct __pyx_obj_7twisted_6python_6_epoll_epoll {
    67284  PyObject_HEAD
    68285  int fd;
    69286  int initialized;
    70287};
    71288
    72 static PyTypeObject *__pyx_ptype_6_epoll_epoll = 0;
     289#ifndef CYTHON_REFNANNY
     290  #define CYTHON_REFNANNY 0
     291#endif
    73292
    74 /* Implementation of _epoll */
     293#if CYTHON_REFNANNY
     294  typedef struct {
     295    void (*INCREF)(void*, PyObject*, int);
     296    void (*DECREF)(void*, PyObject*, int);
     297    void (*GOTREF)(void*, PyObject*, int);
     298    void (*GIVEREF)(void*, PyObject*, int);
     299    void* (*SetupContext)(const char*, int, const char*);
     300    void (*FinishContext)(void**);
     301  } __Pyx_RefNannyAPIStruct;
     302  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
     303  static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) {
     304    PyObject *m = NULL, *p = NULL;
     305    void *r = NULL;
     306    m = PyImport_ImportModule((char *)modname);
     307    if (!m) goto end;
     308    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
     309    if (!p) goto end;
     310    r = PyLong_AsVoidPtr(p);
     311  end:
     312    Py_XDECREF(p);
     313    Py_XDECREF(m);
     314    return (__Pyx_RefNannyAPIStruct *)r;
     315  }
     316  #define __Pyx_RefNannySetupContext(name)           void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
     317  #define __Pyx_RefNannyFinishContext()           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
     318  #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
     319  #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
     320  #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
     321  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
     322  #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0)
     323#else
     324  #define __Pyx_RefNannySetupContext(name)
     325  #define __Pyx_RefNannyFinishContext()
     326  #define __Pyx_INCREF(r) Py_INCREF(r)
     327  #define __Pyx_DECREF(r) Py_DECREF(r)
     328  #define __Pyx_GOTREF(r)
     329  #define __Pyx_GIVEREF(r)
     330  #define __Pyx_XDECREF(r) Py_XDECREF(r)
     331#endif /* CYTHON_REFNANNY */
     332#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0)
     333#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0)
    75334
    76 static PyObject *__pyx_n_CTL_ADD;
    77 static PyObject *__pyx_n_CTL_DEL;
    78 static PyObject *__pyx_n_CTL_MOD;
    79 static PyObject *__pyx_n_IN;
    80 static PyObject *__pyx_n_OUT;
    81 static PyObject *__pyx_n_PRI;
    82 static PyObject *__pyx_n_ERR;
    83 static PyObject *__pyx_n_HUP;
    84 static PyObject *__pyx_n_ET;
    85 static PyObject *__pyx_n_RDNORM;
    86 static PyObject *__pyx_n_RDBAND;
    87 static PyObject *__pyx_n_WRNORM;
    88 static PyObject *__pyx_n_WRBAND;
    89 static PyObject *__pyx_n_MSG;
     335static void __Pyx_RaiseDoubleKeywordsError(
     336    const char* func_name, PyObject* kw_name); /*proto*/
    90337
    91 static PyObject *__pyx_n_IOError;
     338static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
     339    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
    92340
    93 static int __pyx_f_6_epoll_5epoll___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    94 static int __pyx_f_6_epoll_5epoll___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
     341static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,     const char* function_name); /*proto*/
     342
     343static INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
     344    if (likely(PyList_CheckExact(L))) {
     345        if (PyList_Append(L, x) < 0) return NULL;
     346        Py_INCREF(Py_None);
     347        return Py_None; /* this is just to have an accurate signature */
     348    }
     349    else {
     350        PyObject *r, *m;
     351        m = __Pyx_GetAttrString(L, "append");
     352        if (!m) return NULL;
     353        r = PyObject_CallFunctionObjArgs(m, x, NULL);
     354        Py_DECREF(m);
     355        return r;
     356    }
     357}
     358
     359static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
     360static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
     361
     362static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
     363
     364static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
     365
     366static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
     367
     368static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
     369
     370static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
     371
     372static INLINE char __Pyx_PyInt_AsChar(PyObject *);
     373
     374static INLINE short __Pyx_PyInt_AsShort(PyObject *);
     375
     376static INLINE int __Pyx_PyInt_AsInt(PyObject *);
     377
     378static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
     379
     380static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
     381
     382static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
     383
     384static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
     385
     386static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
     387
     388static INLINE long __Pyx_PyInt_AsLong(PyObject *);
     389
     390static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
     391
     392static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
     393
     394static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
     395
     396static void __Pyx_AddTraceback(const char *funcname); /*proto*/
     397
     398static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
     399/* Module declarations from b'twisted.python._epoll' */
     400
     401static PyTypeObject *__pyx_ptype_7twisted_6python_6_epoll_epoll = 0;
     402#define __Pyx_MODULE_NAME "twisted.python._epoll"
     403int __pyx_module_is_main_twisted__python___epoll = 0;
     404
     405/* Implementation of twisted.python._epoll */
     406static PyObject *__pyx_builtin_IOError;
     407static char __pyx_k_1[] = "\nInterface to epoll I/O event notification facility.\n";
     408static char __pyx_k_2[] = "epoll.close (line 87)";
     409static char __pyx_k_3[] = "epoll.fileno (line 96)";
     410static char __pyx_k_4[] = "epoll._control (line 102)";
     411static char __pyx_k_5[] = "epoll.wait (line 127)";
     412static char __pyx_k__ET[] = "ET";
     413static char __pyx_k__IN[] = "IN";
     414static char __pyx_k__fd[] = "fd";
     415static char __pyx_k__op[] = "op";
     416static char __pyx_k__ERR[] = "ERR";
     417static char __pyx_k__HUP[] = "HUP";
     418static char __pyx_k__MSG[] = "MSG";
     419static char __pyx_k__OUT[] = "OUT";
     420static char __pyx_k__PRI[] = "PRI";
     421static char __pyx_k__data[] = "data";
     422static char __pyx_k__size[] = "size";
     423static char __pyx_k__wait[] = "wait";
     424static char __pyx_k__close[] = "close";
     425static char __pyx_k__epoll[] = "epoll";
     426static char __pyx_k__RDBAND[] = "RDBAND";
     427static char __pyx_k__RDNORM[] = "RDNORM";
     428static char __pyx_k__WRBAND[] = "WRBAND";
     429static char __pyx_k__WRNORM[] = "WRNORM";
     430static char __pyx_k__events[] = "events";
     431static char __pyx_k__fileno[] = "fileno";
     432static char __pyx_k__CTL_ADD[] = "CTL_ADD";
     433static char __pyx_k__CTL_DEL[] = "CTL_DEL";
     434static char __pyx_k__CTL_MOD[] = "CTL_MOD";
     435static char __pyx_k__IOError[] = "IOError";
     436static char __pyx_k__timeout[] = "timeout";
     437static char __pyx_k____main__[] = "__main__";
     438static char __pyx_k____test__[] = "__test__";
     439static char __pyx_k___control[] = "_control";
     440static char __pyx_k__maxevents[] = "maxevents";
     441static char __pyx_k__initialized[] = "initialized";
     442static PyObject *__pyx_kp_u_2;
     443static PyObject *__pyx_kp_u_3;
     444static PyObject *__pyx_kp_u_4;
     445static PyObject *__pyx_kp_u_5;
     446static PyObject *__pyx_n_s__CTL_ADD;
     447static PyObject *__pyx_n_s__CTL_DEL;
     448static PyObject *__pyx_n_s__CTL_MOD;
     449static PyObject *__pyx_n_s__ERR;
     450static PyObject *__pyx_n_s__ET;
     451static PyObject *__pyx_n_s__HUP;
     452static PyObject *__pyx_n_s__IN;
     453static PyObject *__pyx_n_s__IOError;
     454static PyObject *__pyx_n_s__MSG;
     455static PyObject *__pyx_n_s__OUT;
     456static PyObject *__pyx_n_s__PRI;
     457static PyObject *__pyx_n_s__RDBAND;
     458static PyObject *__pyx_n_s__RDNORM;
     459static PyObject *__pyx_n_s__WRBAND;
     460static PyObject *__pyx_n_s__WRNORM;
     461static PyObject *__pyx_n_s____main__;
     462static PyObject *__pyx_n_s____test__;
     463static PyObject *__pyx_n_s___control;
     464static PyObject *__pyx_n_s__close;
     465static PyObject *__pyx_n_s__data;
     466static PyObject *__pyx_n_s__epoll;
     467static PyObject *__pyx_n_s__events;
     468static PyObject *__pyx_n_s__fd;
     469static PyObject *__pyx_n_s__fileno;
     470static PyObject *__pyx_n_s__initialized;
     471static PyObject *__pyx_n_s__maxevents;
     472static PyObject *__pyx_n_s__op;
     473static PyObject *__pyx_n_s__size;
     474static PyObject *__pyx_n_s__timeout;
     475static PyObject *__pyx_n_s__wait;
     476
     477/* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":76
     478 *     cdef int initialized
     479 *
     480 *     def __init__(self, int size):             # <<<<<<<<<<<<<<
     481 *         self.fd = epoll_create(size)
     482 *         if self.fd == -1:
     483 */
     484
     485static int __pyx_pf_7twisted_6python_6_epoll_5epoll___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
     486static int __pyx_pf_7twisted_6python_6_epoll_5epoll___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
    95487  int __pyx_v_size;
    96488  int __pyx_r;
    97   int __pyx_1;
    98   PyObject *__pyx_2 = 0;
    99   PyObject *__pyx_3 = 0;
    100   PyObject *__pyx_4 = 0;
    101   PyObject *__pyx_5 = 0;
    102   static char *__pyx_argnames[] = {"size",0};
    103   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "i", __pyx_argnames, &__pyx_v_size)) return -1;
    104   Py_INCREF(__pyx_v_self);
     489  int __pyx_t_1;
     490  PyObject *__pyx_t_2 = NULL;
     491  PyObject *__pyx_t_3 = NULL;
     492  PyObject *__pyx_t_4 = NULL;
     493  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,0};
     494  __Pyx_RefNannySetupContext("__init__");
     495  if (unlikely(__pyx_kwds)) {
     496    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
     497    PyObject* values[1] = {0};
     498    switch (PyTuple_GET_SIZE(__pyx_args)) {
     499      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
     500      case  0: break;
     501      default: goto __pyx_L5_argtuple_error;
     502    }
     503    switch (PyTuple_GET_SIZE(__pyx_args)) {
     504      case  0:
     505      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
     506      if (likely(values[0])) kw_args--;
     507      else goto __pyx_L5_argtuple_error;
     508    }
     509    if (unlikely(kw_args > 0)) {
     510      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     511    }
     512    __pyx_v_size = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     513  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
     514    goto __pyx_L5_argtuple_error;
     515  } else {
     516    __pyx_v_size = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     517  }
     518  goto __pyx_L4_argument_unpacking_done;
     519  __pyx_L5_argtuple_error:;
     520  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     521  __pyx_L3_error:;
     522  __Pyx_AddTraceback("twisted.python._epoll.epoll.__init__");
     523  return -1;
     524  __pyx_L4_argument_unpacking_done:;
     525  __Pyx_INCREF((PyObject *)__pyx_v_self);
    105526
    106   /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":77 */
    107   ((struct __pyx_obj_6_epoll_epoll *)__pyx_v_self)->fd = epoll_create(__pyx_v_size);
     527  /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":77
     528 *
     529 *     def __init__(self, int size):
     530 *         self.fd = epoll_create(size)             # <<<<<<<<<<<<<<
     531 *         if self.fd == -1:
     532 *             raise IOError(errno, strerror(errno))
     533 */
     534  ((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd = epoll_create(__pyx_v_size);
    108535
    109   /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":78 */
    110   __pyx_1 = (((struct __pyx_obj_6_epoll_epoll *)__pyx_v_self)->fd == (-1));
    111   if (__pyx_1) {
     536  /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":78
     537 *     def __init__(self, int size):
     538 *         self.fd = epoll_create(size)
     539 *         if self.fd == -1:             # <<<<<<<<<<<<<<
     540 *             raise IOError(errno, strerror(errno))
     541 *         self.initialized = 1
     542 */
     543  __pyx_t_1 = (((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd == -1);
     544  if (__pyx_t_1) {
    112545
    113     /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":79 */
    114     __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_IOError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
    115     __pyx_3 = PyInt_FromLong(errno); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
    116     __pyx_4 = PyString_FromString(strerror(errno)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
    117     __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
    118     PyTuple_SET_ITEM(__pyx_5, 0, __pyx_3);
    119     PyTuple_SET_ITEM(__pyx_5, 1, __pyx_4);
    120     __pyx_3 = 0;
    121     __pyx_4 = 0;
    122     __pyx_3 = PyObject_Call(__pyx_2, __pyx_5, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
    123     Py_DECREF(__pyx_2); __pyx_2 = 0;
    124     Py_DECREF(__pyx_5); __pyx_5 = 0;
    125     __Pyx_Raise(__pyx_3, 0, 0);
    126     Py_DECREF(__pyx_3); __pyx_3 = 0;
    127     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
    128     goto __pyx_L2;
     546    /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":79
     547 *         self.fd = epoll_create(size)
     548 *         if self.fd == -1:
     549 *             raise IOError(errno, strerror(errno))             # <<<<<<<<<<<<<<
     550 *         self.initialized = 1
     551 *
     552 */
     553    __pyx_t_2 = PyInt_FromLong(errno); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     554    __Pyx_GOTREF(__pyx_t_2);
     555    __pyx_t_3 = __Pyx_PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     556    __Pyx_GOTREF(__pyx_t_3);
     557    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     558    __Pyx_GOTREF(__pyx_t_4);
     559    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
     560    __Pyx_GIVEREF(__pyx_t_2);
     561    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
     562    __Pyx_GIVEREF(__pyx_t_3);
     563    __pyx_t_2 = 0;
     564    __pyx_t_3 = 0;
     565    __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     566    __Pyx_GOTREF(__pyx_t_3);
     567    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     568    __Pyx_Raise(__pyx_t_3, 0, 0);
     569    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     570    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     571    goto __pyx_L6;
    129572  }
    130   __pyx_L2:;
     573  __pyx_L6:;
    131574
    132   /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":80 */
    133   ((struct __pyx_obj_6_epoll_epoll *)__pyx_v_self)->initialized = 1;
     575  /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":80
     576 *         if self.fd == -1:
     577 *             raise IOError(errno, strerror(errno))
     578 *         self.initialized = 1             # <<<<<<<<<<<<<<
     579 *
     580 *     def __dealloc__(self):
     581 */
     582  ((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->initialized = 1;
    134583
    135584  __pyx_r = 0;
    136585  goto __pyx_L0;
    137   __pyx_L1:;
    138   Py_XDECREF(__pyx_2);
    139   Py_XDECREF(__pyx_3);
    140   Py_XDECREF(__pyx_4);
    141   Py_XDECREF(__pyx_5);
    142   __Pyx_AddTraceback("_epoll.epoll.__init__");
     586  __pyx_L1_error:;
     587  __Pyx_XDECREF(__pyx_t_2);
     588  __Pyx_XDECREF(__pyx_t_3);
     589  __Pyx_XDECREF(__pyx_t_4);
     590  __Pyx_AddTraceback("twisted.python._epoll.epoll.__init__");
    143591  __pyx_r = -1;
    144592  __pyx_L0:;
    145   Py_DECREF(__pyx_v_self);
     593  __Pyx_DECREF((PyObject *)__pyx_v_self);
     594  __Pyx_RefNannyFinishContext();
    146595  return __pyx_r;
    147596}
    148597
    149 static void __pyx_f_6_epoll_5epoll___dealloc__(PyObject *__pyx_v_self); /*proto*/
    150 static void __pyx_f_6_epoll_5epoll___dealloc__(PyObject *__pyx_v_self) {
    151   int __pyx_1;
    152   Py_INCREF(__pyx_v_self);
     598/* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":82
     599 *         self.initialized = 1
     600 *
     601 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
     602 *         if self.initialized:
     603 *             close(self.fd)
     604 */
    153605
    154   /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":83 */
    155   __pyx_1 = ((struct __pyx_obj_6_epoll_epoll *)__pyx_v_self)->initialized;
    156   if (__pyx_1) {
     606static void __pyx_pf_7twisted_6python_6_epoll_5epoll___dealloc__(PyObject *__pyx_v_self); /*proto*/
     607static void __pyx_pf_7twisted_6python_6_epoll_5epoll___dealloc__(PyObject *__pyx_v_self) {
     608  int __pyx_t_1;
     609  __Pyx_RefNannySetupContext("__dealloc__");
     610  __Pyx_INCREF((PyObject *)__pyx_v_self);
    157611
    158     /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":84 */
    159     close(((struct __pyx_obj_6_epoll_epoll *)__pyx_v_self)->fd);
     612  /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":83
     613 *
     614 *     def __dealloc__(self):
     615 *         if self.initialized:             # <<<<<<<<<<<<<<
     616 *             close(self.fd)
     617 *             self.initialized = 0
     618 */
     619  __pyx_t_1 = ((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->initialized;
     620  if (__pyx_t_1) {
    160621
    161     /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":85 */
    162     ((struct __pyx_obj_6_epoll_epoll *)__pyx_v_self)->initialized = 0;
    163     goto __pyx_L2;
     622    /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":84
     623 *     def __dealloc__(self):
     624 *         if self.initialized:
     625 *             close(self.fd)             # <<<<<<<<<<<<<<
     626 *             self.initialized = 0
     627 *
     628 */
     629    close(((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd);
     630
     631    /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":85
     632 *         if self.initialized:
     633 *             close(self.fd)
     634 *             self.initialized = 0             # <<<<<<<<<<<<<<
     635 *
     636 *     def close(self):
     637 */
     638    ((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->initialized = 0;
     639    goto __pyx_L5;
    164640  }
    165   __pyx_L2:;
     641  __pyx_L5:;
    166642
    167   goto __pyx_L0;
    168   __pyx_L1:;
    169   __Pyx_AddTraceback("_epoll.epoll.__dealloc__");
    170   __pyx_L0:;
    171   Py_DECREF(__pyx_v_self);
     643  __Pyx_DECREF((PyObject *)__pyx_v_self);
     644  __Pyx_RefNannyFinishContext();
    172645}
    173646
    174 static PyObject *__pyx_f_6_epoll_5epoll_close(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    175 static char __pyx_doc_6_epoll_5epoll_close[] = "\n        Close the epoll file descriptor.\n        ";
    176 static PyObject *__pyx_f_6_epoll_5epoll_close(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
    177   PyObject *__pyx_r;
    178   int __pyx_1;
    179   PyObject *__pyx_2 = 0;
    180   PyObject *__pyx_3 = 0;
    181   PyObject *__pyx_4 = 0;
    182   PyObject *__pyx_5 = 0;
    183   static char *__pyx_argnames[] = {0};
    184   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
    185   Py_INCREF(__pyx_v_self);
     647/* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":87
     648 *             self.initialized = 0
     649 *
     650 *     def close(self):             # <<<<<<<<<<<<<<
     651 *         """
     652 *         Close the epoll file descriptor.
     653 */
    186654
    187   /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":91 */
    188   __pyx_1 = ((struct __pyx_obj_6_epoll_epoll *)__pyx_v_self)->initialized;
    189   if (__pyx_1) {
     655static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_close(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
     656static char __pyx_doc_7twisted_6python_6_epoll_5epoll_close[] = "\n        Close the epoll file descriptor.\n        ";
     657static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_close(PyObject *__pyx_v_self, PyObject *unused) {
     658  PyObject *__pyx_r = NULL;
     659  int __pyx_t_1;
     660  int __pyx_t_2;
     661  PyObject *__pyx_t_3 = NULL;
     662  PyObject *__pyx_t_4 = NULL;
     663  PyObject *__pyx_t_5 = NULL;
     664  __Pyx_RefNannySetupContext("close");
     665  __Pyx_INCREF((PyObject *)__pyx_v_self);
    190666
    191     /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":92 */
    192     __pyx_1 = (close(((struct __pyx_obj_6_epoll_epoll *)__pyx_v_self)->fd) == (-1));
    193     if (__pyx_1) {
     667  /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":91
     668 *         Close the epoll file descriptor.
     669 *         """
     670 *         if self.initialized:             # <<<<<<<<<<<<<<
     671 *             if close(self.fd) == -1:
     672 *                 raise IOError(errno, strerror(errno))
     673 */
     674  __pyx_t_1 = ((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->initialized;
     675  if (__pyx_t_1) {
    194676
    195       /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":93 */
    196       __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_IOError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; goto __pyx_L1;}
    197       __pyx_3 = PyInt_FromLong(errno); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; goto __pyx_L1;}
    198       __pyx_4 = PyString_FromString(strerror(errno)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; goto __pyx_L1;}
    199       __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; goto __pyx_L1;}
    200       PyTuple_SET_ITEM(__pyx_5, 0, __pyx_3);
    201       PyTuple_SET_ITEM(__pyx_5, 1, __pyx_4);
    202       __pyx_3 = 0;
    203       __pyx_4 = 0;
    204       __pyx_3 = PyObject_Call(__pyx_2, __pyx_5, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; goto __pyx_L1;}
    205       Py_DECREF(__pyx_2); __pyx_2 = 0;
    206       Py_DECREF(__pyx_5); __pyx_5 = 0;
    207       __Pyx_Raise(__pyx_3, 0, 0);
    208       Py_DECREF(__pyx_3); __pyx_3 = 0;
    209       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; goto __pyx_L1;}
    210       goto __pyx_L3;
     677    /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":92
     678 *         """
     679 *         if self.initialized:
     680 *             if close(self.fd) == -1:             # <<<<<<<<<<<<<<
     681 *                 raise IOError(errno, strerror(errno))
     682 *             self.initialized = 0
     683 */
     684    __pyx_t_2 = (close(((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd) == -1);
     685    if (__pyx_t_2) {
     686
     687      /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":93
     688 *         if self.initialized:
     689 *             if close(self.fd) == -1:
     690 *                 raise IOError(errno, strerror(errno))             # <<<<<<<<<<<<<<
     691 *             self.initialized = 0
     692 *
     693 */
     694      __pyx_t_3 = PyInt_FromLong(errno); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     695      __Pyx_GOTREF(__pyx_t_3);
     696      __pyx_t_4 = __Pyx_PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     697      __Pyx_GOTREF(__pyx_t_4);
     698      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     699      __Pyx_GOTREF(__pyx_t_5);
     700      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
     701      __Pyx_GIVEREF(__pyx_t_3);
     702      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
     703      __Pyx_GIVEREF(__pyx_t_4);
     704      __pyx_t_3 = 0;
     705      __pyx_t_4 = 0;
     706      __pyx_t_4 = PyObject_Call(__pyx_builtin_IOError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     707      __Pyx_GOTREF(__pyx_t_4);
     708      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     709      __Pyx_Raise(__pyx_t_4, 0, 0);
     710      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     711      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     712      goto __pyx_L6;
    211713    }
    212     __pyx_L3:;
     714    __pyx_L6:;
    213715
    214     /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":94 */
    215     ((struct __pyx_obj_6_epoll_epoll *)__pyx_v_self)->initialized = 0;
    216     goto __pyx_L2;
     716    /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":94
     717 *             if close(self.fd) == -1:
     718 *                 raise IOError(errno, strerror(errno))
     719 *             self.initialized = 0             # <<<<<<<<<<<<<<
     720 *
     721 *     def fileno(self):
     722 */
     723    ((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->initialized = 0;
     724    goto __pyx_L5;
    217725  }
    218   __pyx_L2:;
     726  __pyx_L5:;
    219727
    220   __pyx_r = Py_None; Py_INCREF(Py_None);
     728  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    221729  goto __pyx_L0;
    222   __pyx_L1:;
    223   Py_XDECREF(__pyx_2);
    224   Py_XDECREF(__pyx_3);
    225   Py_XDECREF(__pyx_4);
    226   Py_XDECREF(__pyx_5);
    227   __Pyx_AddTraceback("_epoll.epoll.close");
    228   __pyx_r = 0;
     730  __pyx_L1_error:;
     731  __Pyx_XDECREF(__pyx_t_3);
     732  __Pyx_XDECREF(__pyx_t_4);
     733  __Pyx_XDECREF(__pyx_t_5);
     734  __Pyx_AddTraceback("twisted.python._epoll.epoll.close");
     735  __pyx_r = NULL;
    229736  __pyx_L0:;
    230   Py_DECREF(__pyx_v_self);
     737  __Pyx_DECREF((PyObject *)__pyx_v_self);
     738  __Pyx_XGIVEREF(__pyx_r);
     739  __Pyx_RefNannyFinishContext();
    231740  return __pyx_r;
    232741}
    233742
    234 static PyObject *__pyx_f_6_epoll_5epoll_fileno(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    235 static char __pyx_doc_6_epoll_5epoll_fileno[] = "\n        Return the epoll file descriptor number.\n        ";
    236 static PyObject *__pyx_f_6_epoll_5epoll_fileno(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
    237   PyObject *__pyx_r;
    238   PyObject *__pyx_1 = 0;
    239   static char *__pyx_argnames[] = {0};
    240   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
    241   Py_INCREF(__pyx_v_self);
     743/* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":96
     744 *             self.initialized = 0
     745 *
     746 *     def fileno(self):             # <<<<<<<<<<<<<<
     747 *         """
     748 *         Return the epoll file descriptor number.
     749 */
    242750
    243   /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":100 */
    244   __pyx_1 = PyInt_FromLong(((struct __pyx_obj_6_epoll_epoll *)__pyx_v_self)->fd); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; goto __pyx_L1;}
    245   __pyx_r = __pyx_1;
    246   __pyx_1 = 0;
     751static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_fileno(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
     752static char __pyx_doc_7twisted_6python_6_epoll_5epoll_fileno[] = "\n        Return the epoll file descriptor number.\n        ";
     753static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_fileno(PyObject *__pyx_v_self, PyObject *unused) {
     754  PyObject *__pyx_r = NULL;
     755  PyObject *__pyx_t_1 = NULL;
     756  __Pyx_RefNannySetupContext("fileno");
     757
     758  /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":100
     759 *         Return the epoll file descriptor number.
     760 *         """
     761 *         return self.fd             # <<<<<<<<<<<<<<
     762 *
     763 *     def _control(self, int op, int fd, int events):
     764 */
     765  __Pyx_XDECREF(__pyx_r);
     766  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     767  __Pyx_GOTREF(__pyx_t_1);
     768  __pyx_r = __pyx_t_1;
     769  __pyx_t_1 = 0;
    247770  goto __pyx_L0;
    248771
    249   __pyx_r = Py_None; Py_INCREF(Py_None);
     772  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    250773  goto __pyx_L0;
    251   __pyx_L1:;
    252   Py_XDECREF(__pyx_1);
    253   __Pyx_AddTraceback("_epoll.epoll.fileno");
    254   __pyx_r = 0;
     774  __pyx_L1_error:;
     775  __Pyx_XDECREF(__pyx_t_1);
     776  __Pyx_AddTraceback("twisted.python._epoll.epoll.fileno");
     777  __pyx_r = NULL;
    255778  __pyx_L0:;
    256   Py_DECREF(__pyx_v_self);
     779  __Pyx_XGIVEREF(__pyx_r);
     780  __Pyx_RefNannyFinishContext();
    257781  return __pyx_r;
    258782}
    259783
    260 static PyObject *__pyx_f_6_epoll_5epoll__control(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    261 static char __pyx_doc_6_epoll_5epoll__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        ";
    262 static PyObject *__pyx_f_6_epoll_5epoll__control(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
     784/* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":102
     785 *         return self.fd
     786 *
     787 *     def _control(self, int op, int fd, int events):             # <<<<<<<<<<<<<<
     788 *         """
     789 *         Modify the monitored state of a particular file descriptor.
     790 */
     791
     792static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll__control(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
     793static char __pyx_doc_7twisted_6python_6_epoll_5epoll__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        ";
     794static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll__control(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
    263795  int __pyx_v_op;
    264796  int __pyx_v_fd;
    265797  int __pyx_v_events;
    266798  int __pyx_v_result;
    267799  struct epoll_event __pyx_v_evt;
    268   PyObject *__pyx_r;
    269   int __pyx_1;
    270   PyObject *__pyx_2 = 0;
    271   PyObject *__pyx_3 = 0;
    272   PyObject *__pyx_4 = 0;
    273   PyObject *__pyx_5 = 0;
    274   static char *__pyx_argnames[] = {"op","fd","events",0};
    275   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "iii", __pyx_argnames, &__pyx_v_op, &__pyx_v_fd, &__pyx_v_events)) return 0;
    276   Py_INCREF(__pyx_v_self);
     800  PyObject *__pyx_r = NULL;
     801  int __pyx_t_1;
     802  PyObject *__pyx_t_2 = NULL;
     803  PyObject *__pyx_t_3 = NULL;
     804  PyObject *__pyx_t_4 = NULL;
     805  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__op,&__pyx_n_s__fd,&__pyx_n_s__events,0};
     806  __Pyx_RefNannySetupContext("_control");
     807  if (unlikely(__pyx_kwds)) {
     808    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
     809    PyObject* values[3] = {0,0,0};
     810    switch (PyTuple_GET_SIZE(__pyx_args)) {
     811      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
     812      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
     813      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
     814      case  0: break;
     815      default: goto __pyx_L5_argtuple_error;
     816    }
     817    switch (PyTuple_GET_SIZE(__pyx_args)) {
     818      case  0:
     819      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__op);
     820      if (likely(values[0])) kw_args--;
     821      else goto __pyx_L5_argtuple_error;
     822      case  1:
     823      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fd);
     824      if (likely(values[1])) kw_args--;
     825      else {
     826        __Pyx_RaiseArgtupleInvalid("_control", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     827      }
     828      case  2:
     829      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__events);
     830      if (likely(values[2])) kw_args--;
     831      else {
     832        __Pyx_RaiseArgtupleInvalid("_control", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     833      }
     834    }
     835    if (unlikely(kw_args > 0)) {
     836      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_control") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     837    }
     838    __pyx_v_op = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_op == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     839    __pyx_v_fd = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_fd == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     840    __pyx_v_events = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_events == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     841  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
     842    goto __pyx_L5_argtuple_error;
     843  } else {
     844    __pyx_v_op = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_op == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     845    __pyx_v_fd = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_fd == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     846    __pyx_v_events = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_events == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     847  }
     848  goto __pyx_L4_argument_unpacking_done;
     849  __pyx_L5_argtuple_error:;
     850  __Pyx_RaiseArgtupleInvalid("_control", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     851  __pyx_L3_error:;
     852  __Pyx_AddTraceback("twisted.python._epoll.epoll._control");
     853  return NULL;
     854  __pyx_L4_argument_unpacking_done:;
     855  __Pyx_INCREF((PyObject *)__pyx_v_self);
    277856
    278   /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":121 */
     857  /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":121
     858 *         cdef int result
     859 *         cdef epoll_event evt
     860 *         evt.events = events             # <<<<<<<<<<<<<<
     861 *         evt.data.fd = fd
     862 *         result = epoll_ctl(self.fd, op, fd, &evt)
     863 */
    279864  __pyx_v_evt.events = __pyx_v_events;
    280865
    281   /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":122 */
     866  /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":122
     867 *         cdef epoll_event evt
     868 *         evt.events = events
     869 *         evt.data.fd = fd             # <<<<<<<<<<<<<<
     870 *         result = epoll_ctl(self.fd, op, fd, &evt)
     871 *         if result == -1:
     872 */
    282873  __pyx_v_evt.data.fd = __pyx_v_fd;
    283874
    284   /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":123 */
    285   __pyx_v_result = epoll_ctl(((struct __pyx_obj_6_epoll_epoll *)__pyx_v_self)->fd,__pyx_v_op,__pyx_v_fd,(&__pyx_v_evt));
     875  /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":123
     876 *         evt.events = events
     877 *         evt.data.fd = fd
     878 *         result = epoll_ctl(self.fd, op, fd, &evt)             # <<<<<<<<<<<<<<
     879 *         if result == -1:
     880 *             raise IOError(errno, strerror(errno))
     881 */
     882  __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));
    286883
    287   /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":124 */
    288   __pyx_1 = (__pyx_v_result == (-1));
    289   if (__pyx_1) {
     884  /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":124
     885 *         evt.data.fd = fd
     886 *         result = epoll_ctl(self.fd, op, fd, &evt)
     887 *         if result == -1:             # <<<<<<<<<<<<<<
     888 *             raise IOError(errno, strerror(errno))
     889 *
     890 */
     891  __pyx_t_1 = (__pyx_v_result == -1);
     892  if (__pyx_t_1) {
    290893
    291     /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":125 */
    292     __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_IOError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; goto __pyx_L1;}
    293     __pyx_3 = PyInt_FromLong(errno); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; goto __pyx_L1;}
    294     __pyx_4 = PyString_FromString(strerror(errno)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; goto __pyx_L1;}
    295     __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; goto __pyx_L1;}
    296     PyTuple_SET_ITEM(__pyx_5, 0, __pyx_3);
    297     PyTuple_SET_ITEM(__pyx_5, 1, __pyx_4);
    298     __pyx_3 = 0;
    299     __pyx_4 = 0;
    300     __pyx_3 = PyObject_Call(__pyx_2, __pyx_5, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; goto __pyx_L1;}
    301     Py_DECREF(__pyx_2); __pyx_2 = 0;
    302     Py_DECREF(__pyx_5); __pyx_5 = 0;
    303     __Pyx_Raise(__pyx_3, 0, 0);
    304     Py_DECREF(__pyx_3); __pyx_3 = 0;
    305     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; goto __pyx_L1;}
    306     goto __pyx_L2;
     894    /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":125
     895 *         result = epoll_ctl(self.fd, op, fd, &evt)
     896 *         if result == -1:
     897 *             raise IOError(errno, strerror(errno))             # <<<<<<<<<<<<<<
     898 *
     899 *     def wait(self, unsigned int maxevents, int timeout):
     900 */
     901    __pyx_t_2 = PyInt_FromLong(errno); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     902    __Pyx_GOTREF(__pyx_t_2);
     903    __pyx_t_3 = __Pyx_PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     904    __Pyx_GOTREF(__pyx_t_3);
     905    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     906    __Pyx_GOTREF(__pyx_t_4);
     907    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
     908    __Pyx_GIVEREF(__pyx_t_2);
     909    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
     910    __Pyx_GIVEREF(__pyx_t_3);
     911    __pyx_t_2 = 0;
     912    __pyx_t_3 = 0;
     913    __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     914    __Pyx_GOTREF(__pyx_t_3);
     915    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     916    __Pyx_Raise(__pyx_t_3, 0, 0);
     917    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     918    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     919    goto __pyx_L6;
    307920  }
    308   __pyx_L2:;
     921  __pyx_L6:;
    309922
    310   __pyx_r = Py_None; Py_INCREF(Py_None);
     923  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    311924  goto __pyx_L0;
    312   __pyx_L1:;
    313   Py_XDECREF(__pyx_2);
    314   Py_XDECREF(__pyx_3);
    315   Py_XDECREF(__pyx_4);
    316   Py_XDECREF(__pyx_5);
    317   __Pyx_AddTraceback("_epoll.epoll._control");
    318   __pyx_r = 0;
     925  __pyx_L1_error:;
     926  __Pyx_XDECREF(__pyx_t_2);
     927  __Pyx_XDECREF(__pyx_t_3);
     928  __Pyx_XDECREF(__pyx_t_4);
     929  __Pyx_AddTraceback("twisted.python._epoll.epoll._control");
     930  __pyx_r = NULL;
    319931  __pyx_L0:;
    320   Py_DECREF(__pyx_v_self);
     932  __Pyx_DECREF((PyObject *)__pyx_v_self);
     933  __Pyx_XGIVEREF(__pyx_r);
     934  __Pyx_RefNannyFinishContext();
    321935  return __pyx_r;
    322936}
    323937
    324 static PyObject *__pyx_n_append;
     938/* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":127
     939 *             raise IOError(errno, strerror(errno))
     940 *
     941 *     def wait(self, unsigned int maxevents, int timeout):             # <<<<<<<<<<<<<<
     942 *         """
     943 *         Wait for an I/O event, wrap epoll_wait(2).
     944 */
    325945
    326 static PyObject *__pyx_f_6_epoll_5epoll_wait(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    327 static char __pyx_doc_6_epoll_5epoll_wait[] = "\n        Wait for an I/O event, wrap epoll_wait(2).\n\n        @type maxevents: C{int}\n        @param maxevents: Maximum number of events returned.\n\n        @type timeout: C{int}\n        @param timeout: Maximum time waiting for events. 0 makes it return\n            immediately whereas -1 makes it wait indefinitely.\n        \n        @raise IOError: Raised if the underlying epoll_wait() call fails.\n        ";
    328 static PyObject *__pyx_f_6_epoll_5epoll_wait(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
     946static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_wait(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
     947static char __pyx_doc_7twisted_6python_6_epoll_5epoll_wait[] = "\n        Wait for an I/O event, wrap epoll_wait(2).\n\n        @type maxevents: C{int}\n        @param maxevents: Maximum number of events returned.\n\n        @type timeout: C{int}\n        @param timeout: Maximum time waiting for events. 0 makes it return\n            immediately whereas -1 makes it wait indefinitely.\n        \n        @raise IOError: Raised if the underlying epoll_wait() call fails.\n        ";
     948static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_wait(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
    329949  unsigned int __pyx_v_maxevents;
    330950  int __pyx_v_timeout;
    331   struct epoll_event (*__pyx_v_events);
     951  struct epoll_event *__pyx_v_events;
    332952  int __pyx_v_result;
    333953  int __pyx_v_nbytes;
    334954  int __pyx_v_fd;
    335   PyThreadState (*__pyx_v__save);
     955  PyThreadState *__pyx_v__save;
    336956  PyObject *__pyx_v_results;
    337957  PyObject *__pyx_v_i;
    338   PyObject *__pyx_r;
    339   int __pyx_1;
    340   PyObject *__pyx_2 = 0;
    341   PyObject *__pyx_3 = 0;
    342   PyObject *__pyx_4 = 0;
    343   PyObject *__pyx_5 = 0;
    344   long __pyx_6;
    345   Py_ssize_t __pyx_7;
    346   static char *__pyx_argnames[] = {"maxevents","timeout",0};
    347   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "Ii", __pyx_argnames, &__pyx_v_maxevents, &__pyx_v_timeout)) return 0;
    348   Py_INCREF(__pyx_v_self);
    349   __pyx_v_results = Py_None; Py_INCREF(Py_None);
    350   __pyx_v_i = Py_None; Py_INCREF(Py_None);
     958  PyObject *__pyx_r = NULL;
     959  int __pyx_t_1;
     960  PyObject *__pyx_t_2 = NULL;
     961  PyObject *__pyx_t_3 = NULL;
     962  PyObject *__pyx_t_4 = NULL;
     963  int __pyx_t_5;
     964  long __pyx_t_6;
     965  Py_ssize_t __pyx_t_7;
     966  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__maxevents,&__pyx_n_s__timeout,0};
     967  __Pyx_RefNannySetupContext("wait");
     968  if (unlikely(__pyx_kwds)) {
     969    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
     970    PyObject* values[2] = {0,0};
     971    switch (PyTuple_GET_SIZE(__pyx_args)) {
     972      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
     973      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
     974      case  0: break;
     975      default: goto __pyx_L5_argtuple_error;
     976    }
     977    switch (PyTuple_GET_SIZE(__pyx_args)) {
     978      case  0:
     979      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__maxevents);
     980      if (likely(values[0])) kw_args--;
     981      else goto __pyx_L5_argtuple_error;
     982      case  1:
     983      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__timeout);
     984      if (likely(values[1])) kw_args--;
     985      else {
     986        __Pyx_RaiseArgtupleInvalid("wait", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     987      }
     988    }
     989    if (unlikely(kw_args > 0)) {
     990      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "wait") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     991    }
     992    __pyx_v_maxevents = __Pyx_PyInt_AsUnsignedInt(values[0]); if (unlikely((__pyx_v_maxevents == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     993    __pyx_v_timeout = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_timeout == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     994  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
     995    goto __pyx_L5_argtuple_error;
     996  } else {
     997    __pyx_v_maxevents = __Pyx_PyInt_AsUnsignedInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_maxevents == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     998    __pyx_v_timeout = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_timeout == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     999  }
     1000  goto __pyx_L4_argument_unpacking_done;
     1001  __pyx_L5_argtuple_error:;
     1002  __Pyx_RaiseArgtupleInvalid("wait", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     1003  __pyx_L3_error:;
     1004  __Pyx_AddTraceback("twisted.python._epoll.epoll.wait");
     1005  return NULL;
     1006  __pyx_L4_argument_unpacking_done:;
     1007  __Pyx_INCREF((PyObject *)__pyx_v_self);
     1008  __pyx_v_results = Py_None; __Pyx_INCREF(Py_None);
     1009  __pyx_v_i = Py_None; __Pyx_INCREF(Py_None);
    3511010
    352   /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":146 */
    353   __pyx_v_nbytes = ((sizeof(struct epoll_event )) * __pyx_v_maxevents);
     1011  /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":146
     1012 *         cdef PyThreadState *_save
     1013 *
     1014 *         nbytes = sizeof(epoll_event) * maxevents             # <<<<<<<<<<<<<<
     1015 *         events = <epoll_event*>malloc(nbytes)
     1016 *         memset(events, 0, nbytes)
     1017 */
     1018  __pyx_v_nbytes = ((sizeof(struct epoll_event)) * __pyx_v_maxevents);
    3541019
    355   /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":147 */
    356   __pyx_v_events = ((struct epoll_event (*))malloc(__pyx_v_nbytes));
     1020  /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":147
     1021 *
     1022 *         nbytes = sizeof(epoll_event) * maxevents
     1023 *         events = <epoll_event*>malloc(nbytes)             # <<<<<<<<<<<<<<
     1024 *         memset(events, 0, nbytes)
     1025 *         try:
     1026 */
     1027  __pyx_v_events = ((struct epoll_event *)malloc(__pyx_v_nbytes));
    3571028
    358   /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":148 */
    359   memset(__pyx_v_events,0,__pyx_v_nbytes);
     1029  /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":148
     1030 *         nbytes = sizeof(epoll_event) * maxevents
     1031 *         events = <epoll_event*>malloc(nbytes)
     1032 *         memset(events, 0, nbytes)             # <<<<<<<<<<<<<<
     1033 *         try:
     1034 *             fd = self.fd
     1035 */
     1036  memset(__pyx_v_events, 0, __pyx_v_nbytes);
    3601037
    361   /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":149 */
     1038  /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":149
     1039 *         events = <epoll_event*>malloc(nbytes)
     1040 *         memset(events, 0, nbytes)
     1041 *         try:             # <<<<<<<<<<<<<<
     1042 *             fd = self.fd
     1043 *
     1044 */
    3621045  /*try:*/ {
    3631046
    364     /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":150 */
    365     __pyx_v_fd = ((struct __pyx_obj_6_epoll_epoll *)__pyx_v_self)->fd;
     1047    /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":150
     1048 *         memset(events, 0, nbytes)
     1049 *         try:
     1050 *             fd = self.fd             # <<<<<<<<<<<<<<
     1051 *
     1052 *             _save = PyEval_SaveThread()
     1053 */
     1054    __pyx_v_fd = ((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd;
    3661055
    367     /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":152 */
     1056    /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":152
     1057 *             fd = self.fd
     1058 *
     1059 *             _save = PyEval_SaveThread()             # <<<<<<<<<<<<<<
     1060 *             result = epoll_wait(fd, events, maxevents, timeout)
     1061 *             PyEval_RestoreThread(_save)
     1062 */
    3681063    __pyx_v__save = PyEval_SaveThread();
    3691064
    370     /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":153 */
    371     __pyx_v_result = epoll_wait(__pyx_v_fd,__pyx_v_events,__pyx_v_maxevents,__pyx_v_timeout);
     1065    /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":153
     1066 *
     1067 *             _save = PyEval_SaveThread()
     1068 *             result = epoll_wait(fd, events, maxevents, timeout)             # <<<<<<<<<<<<<<
     1069 *             PyEval_RestoreThread(_save)
     1070 *
     1071 */
     1072    __pyx_v_result = epoll_wait(__pyx_v_fd, __pyx_v_events, __pyx_v_maxevents, __pyx_v_timeout);
    3721073
    373     /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":154 */
     1074    /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":154
     1075 *             _save = PyEval_SaveThread()
     1076 *             result = epoll_wait(fd, events, maxevents, timeout)
     1077 *             PyEval_RestoreThread(_save)             # <<<<<<<<<<<<<<
     1078 *
     1079 *             if result == -1:
     1080 */
    3741081    PyEval_RestoreThread(__pyx_v__save);
    3751082
    376     /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":156 */
    377     __pyx_1 = (__pyx_v_result == (-1));
    378     if (__pyx_1) {
     1083    /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":156
     1084 *             PyEval_RestoreThread(_save)
     1085 *
     1086 *             if result == -1:             # <<<<<<<<<<<<<<
     1087 *                 raise IOError(errno, strerror(errno))
     1088 *             results = []
     1089 */
     1090    __pyx_t_1 = (__pyx_v_result == -1);
     1091    if (__pyx_t_1) {
    3791092
    380       /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":157 */
    381       __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_IOError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; goto __pyx_L3;}
    382       __pyx_3 = PyInt_FromLong(errno); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; goto __pyx_L3;}
    383       __pyx_4 = PyString_FromString(strerror(errno)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; goto __pyx_L3;}
    384       __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; goto __pyx_L3;}
    385       PyTuple_SET_ITEM(__pyx_5, 0, __pyx_3);
    386       PyTuple_SET_ITEM(__pyx_5, 1, __pyx_4);
    387       __pyx_3 = 0;
    388       __pyx_4 = 0;
    389       __pyx_3 = PyObject_Call(__pyx_2, __pyx_5, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; goto __pyx_L3;}
    390       Py_DECREF(__pyx_2); __pyx_2 = 0;
    391       Py_DECREF(__pyx_5); __pyx_5 = 0;
    392       __Pyx_Raise(__pyx_3, 0, 0);
    393       Py_DECREF(__pyx_3); __pyx_3 = 0;
    394       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; goto __pyx_L3;}
    395       goto __pyx_L5;
     1093      /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":157
     1094 *
     1095 *             if result == -1:
     1096 *                 raise IOError(errno, strerror(errno))             # <<<<<<<<<<<<<<
     1097 *             results = []
     1098 *             for i from 0 <= i < result:
     1099 */
     1100      __pyx_t_2 = PyInt_FromLong(errno); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L7;}
     1101      __Pyx_GOTREF(__pyx_t_2);
     1102      __pyx_t_3 = __Pyx_PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L7;}
     1103      __Pyx_GOTREF(__pyx_t_3);
     1104      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L7;}
     1105      __Pyx_GOTREF(__pyx_t_4);
     1106      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
     1107      __Pyx_GIVEREF(__pyx_t_2);
     1108      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
     1109      __Pyx_GIVEREF(__pyx_t_3);
     1110      __pyx_t_2 = 0;
     1111      __pyx_t_3 = 0;
     1112      __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L7;}
     1113      __Pyx_GOTREF(__pyx_t_3);
     1114      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     1115      __Pyx_Raise(__pyx_t_3, 0, 0);
     1116      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     1117      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L7;}
     1118      goto __pyx_L9;
    3961119    }
    397     __pyx_L5:;
     1120    __pyx_L9:;
    3981121
    399     /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":158 */
    400     __pyx_4 = PyList_New(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; goto __pyx_L3;}
    401     Py_DECREF(__pyx_v_results);
    402     __pyx_v_results = __pyx_4;
    403     __pyx_4 = 0;
     1122    /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":158
     1123 *             if result == -1:
     1124 *                 raise IOError(errno, strerror(errno))
     1125 *             results = []             # <<<<<<<<<<<<<<
     1126 *             for i from 0 <= i < result:
     1127 *                 results.append((events[i].data.fd, <int>events[i].events))
     1128 */
     1129    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L7;}
     1130    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     1131    __Pyx_DECREF(__pyx_v_results);
     1132    __pyx_v_results = ((PyObject *)__pyx_t_3);
     1133    __pyx_t_3 = 0;
    4041134
    405     /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":159 */
    406     for (__pyx_6 = 0; __pyx_6 < __pyx_v_result; ++__pyx_6) {
    407       __pyx_2 = PyInt_FromLong(__pyx_6); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; goto __pyx_L3;}
    408       Py_DECREF(__pyx_v_i);
    409       __pyx_v_i = __pyx_2;
    410       __pyx_2 = 0;
     1135    /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":159
     1136 *                 raise IOError(errno, strerror(errno))
     1137 *             results = []
     1138 *             for i from 0 <= i < result:             # <<<<<<<<<<<<<<
     1139 *                 results.append((events[i].data.fd, <int>events[i].events))
     1140 *             return results
     1141 */
     1142    __pyx_t_5 = __pyx_v_result;
     1143    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
     1144      __pyx_t_3 = PyInt_FromLong(__pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L7;}
     1145      __Pyx_GOTREF(__pyx_t_3);
     1146      __Pyx_DECREF(__pyx_v_i);
     1147      __pyx_v_i = __pyx_t_3;
     1148      __pyx_t_3 = 0;
    4111149
    412       /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":160 */
    413       __pyx_5 = PyObject_GetAttr(__pyx_v_results, __pyx_n_append); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L3;}
    414       __pyx_7 = PyInt_AsSsize_t(__pyx_v_i); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L3;}
    415       __pyx_3 = PyInt_FromLong((__pyx_v_events[__pyx_7]).data.fd); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L3;}
    416       __pyx_7 = PyInt_AsSsize_t(__pyx_v_i); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L3;}
    417       __pyx_4 = PyInt_FromLong(((int )(__pyx_v_events[__pyx_7]).events)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L3;}
    418       __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L3;}
    419       PyTuple_SET_ITEM(__pyx_2, 0, __pyx_3);
    420       PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);
    421       __pyx_3 = 0;
    422       __pyx_4 = 0;
    423       __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L3;}
    424       PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
    425       __pyx_2 = 0;
    426       __pyx_4 = PyObject_Call(__pyx_5, __pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L3;}
    427       Py_DECREF(__pyx_5); __pyx_5 = 0;
    428       Py_DECREF(__pyx_3); __pyx_3 = 0;
    429       Py_DECREF(__pyx_4); __pyx_4 = 0;
    430       __pyx_L6:;
     1150      /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":160
     1151 *             results = []
     1152 *             for i from 0 <= i < result:
     1153 *                 results.append((events[i].data.fd, <int>events[i].events))             # <<<<<<<<<<<<<<
     1154 *             return results
     1155 *         finally:
     1156 */
     1157      __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L7;}
     1158      __pyx_t_3 = PyInt_FromLong((__pyx_v_events[__pyx_t_7]).data.fd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L7;}
     1159      __Pyx_GOTREF(__pyx_t_3);
     1160      __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L7;}
     1161      __pyx_t_4 = PyInt_FromLong(((int)(__pyx_v_events[__pyx_t_7]).events)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L7;}
     1162      __Pyx_GOTREF(__pyx_t_4);
     1163      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L7;}
     1164      __Pyx_GOTREF(__pyx_t_2);
     1165      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
     1166      __Pyx_GIVEREF(__pyx_t_3);
     1167      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
     1168      __Pyx_GIVEREF(__pyx_t_4);
     1169      __pyx_t_3 = 0;
     1170      __pyx_t_4 = 0;
     1171      __pyx_t_4 = __Pyx_PyObject_Append(__pyx_v_results, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L7;}
     1172      __Pyx_GOTREF(__pyx_t_4);
     1173      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     1174      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     1175      __pyx_t_6 = __Pyx_PyInt_AsLong(__pyx_v_i); if (unlikely((__pyx_t_6 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L7;}
    4311176    }
    432     __pyx_L7:;
    4331177
    434     /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":161 */
    435     Py_INCREF(__pyx_v_results);
     1178    /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":159
     1179 *                 raise IOError(errno, strerror(errno))
     1180 *             results = []
     1181 *             for i from 0 <= i < result:             # <<<<<<<<<<<<<<
     1182 *                 results.append((events[i].data.fd, <int>events[i].events))
     1183 *             return results
     1184 */
     1185    __pyx_t_4 = PyInt_FromLong(__pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L7;}
     1186    __Pyx_GOTREF(__pyx_t_4);
     1187    __Pyx_DECREF(__pyx_v_i);
     1188    __pyx_v_i = __pyx_t_4;
     1189    __pyx_t_4 = 0;
     1190
     1191    /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":161
     1192 *             for i from 0 <= i < result:
     1193 *                 results.append((events[i].data.fd, <int>events[i].events))
     1194 *             return results             # <<<<<<<<<<<<<<
     1195 *         finally:
     1196 *             free(events)
     1197 */
     1198    __Pyx_XDECREF(__pyx_r);
     1199    __Pyx_INCREF(__pyx_v_results);
    4361200    __pyx_r = __pyx_v_results;
    437     goto __pyx_L2;
     1201    goto __pyx_L6;
    4381202  }
    4391203  /*finally:*/ {
    4401204    int __pyx_why;
    441     __pyx_why = 0; goto __pyx_L4;
    442     __pyx_L2: __pyx_why = 3; goto __pyx_L4;
    443     __pyx_L3: {
     1205    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
     1206    int __pyx_exc_lineno;
     1207    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
     1208    __pyx_why = 0; goto __pyx_L8;
     1209    __pyx_L6: __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
     1210    __pyx_why = 3; goto __pyx_L8;
     1211    __pyx_L7: {
    4441212      __pyx_why = 4;
    445       Py_XDECREF(__pyx_2); __pyx_2 = 0;
    446       Py_XDECREF(__pyx_5); __pyx_5 = 0;
    447       Py_XDECREF(__pyx_3); __pyx_3 = 0;
    448       Py_XDECREF(__pyx_4); __pyx_4 = 0;
    449       PyErr_Fetch(&__pyx_2, &__pyx_5, &__pyx_3);
    450       __pyx_1 = __pyx_lineno;
    451       goto __pyx_L4;
     1213      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
     1214      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
     1215      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
     1216      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
     1217      __pyx_exc_lineno = __pyx_lineno;
     1218      goto __pyx_L8;
    4521219    }
    453     __pyx_L4:;
     1220    __pyx_L8:;
    4541221
    455     /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":163 */
     1222    /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":163
     1223 *             return results
     1224 *         finally:
     1225 *             free(events)             # <<<<<<<<<<<<<<
     1226 *
     1227 * CTL_ADD = EPOLL_CTL_ADD
     1228 */
    4561229    free(__pyx_v_events);
    4571230    switch (__pyx_why) {
    4581231      case 3: goto __pyx_L0;
    4591232      case 4: {
    460         PyErr_Restore(__pyx_2, __pyx_5, __pyx_3);
    461         __pyx_lineno = __pyx_1;
    462         __pyx_2 = 0;
    463         __pyx_5 = 0;
    464         __pyx_3 = 0;
    465         goto __pyx_L1;
     1233        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
     1234        __pyx_lineno = __pyx_exc_lineno;
     1235        __pyx_exc_type = 0;
     1236        __pyx_exc_value = 0;
     1237        __pyx_exc_tb = 0;
     1238        goto __pyx_L1_error;
    4661239      }
    4671240    }
    4681241  }
    4691242
    470   __pyx_r = Py_None; Py_INCREF(Py_None);
     1243  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    4711244  goto __pyx_L0;
    472   __pyx_L1:;
    473   Py_XDECREF(__pyx_2);
    474   Py_XDECREF(__pyx_3);
    475   Py_XDECREF(__pyx_4);
    476   Py_XDECREF(__pyx_5);
    477   __Pyx_AddTraceback("_epoll.epoll.wait");
    478   __pyx_r = 0;
     1245  __pyx_L1_error:;
     1246  __Pyx_XDECREF(__pyx_t_2);
     1247  __Pyx_XDECREF(__pyx_t_3);
     1248  __Pyx_XDECREF(__pyx_t_4);
     1249  __Pyx_AddTraceback("twisted.python._epoll.epoll.wait");
     1250  __pyx_r = NULL;
    4791251  __pyx_L0:;
    480   Py_DECREF(__pyx_v_results);
    481   Py_DECREF(__pyx_v_i);
    482   Py_DECREF(__pyx_v_self);
     1252  __Pyx_DECREF(__pyx_v_results);
     1253  __Pyx_DECREF(__pyx_v_i);
     1254  __Pyx_DECREF((PyObject *)__pyx_v_self);
     1255  __Pyx_XGIVEREF(__pyx_r);
     1256  __Pyx_RefNannyFinishContext();
    4831257  return __pyx_r;
    4841258}
    4851259
    486 static __Pyx_InternTabEntry __pyx_intern_tab[] = {
    487   {&__pyx_n_CTL_ADD, "CTL_ADD"},
    488   {&__pyx_n_CTL_DEL, "CTL_DEL"},
    489   {&__pyx_n_CTL_MOD, "CTL_MOD"},
    490   {&__pyx_n_ERR, "ERR"},
    491   {&__pyx_n_ET, "ET"},
    492   {&__pyx_n_HUP, "HUP"},
    493   {&__pyx_n_IN, "IN"},
    494   {&__pyx_n_IOError, "IOError"},
    495   {&__pyx_n_MSG, "MSG"},
    496   {&__pyx_n_OUT, "OUT"},
    497   {&__pyx_n_PRI, "PRI"},
    498   {&__pyx_n_RDBAND, "RDBAND"},
    499   {&__pyx_n_RDNORM, "RDNORM"},
    500   {&__pyx_n_WRBAND, "WRBAND"},
    501   {&__pyx_n_WRNORM, "WRNORM"},
    502   {&__pyx_n_append, "append"},
    503   {0, 0}
    504 };
    505 
    506 static PyObject *__pyx_tp_new_6_epoll_epoll(PyTypeObject *t, PyObject *a, PyObject *k) {
     1260static PyObject *__pyx_tp_new_7twisted_6python_6_epoll_epoll(PyTypeObject *t, PyObject *a, PyObject *k) {
    5071261  PyObject *o = (*t->tp_alloc)(t, 0);
    508   struct __pyx_obj_6_epoll_epoll *p = (struct __pyx_obj_6_epoll_epoll *)o;
     1262  if (!o) return 0;
    5091263  return o;
    5101264}
    5111265
    512 static void __pyx_tp_dealloc_6_epoll_epoll(PyObject *o) {
    513   struct __pyx_obj_6_epoll_epoll *p = (struct __pyx_obj_6_epoll_epoll *)o;
     1266static void __pyx_tp_dealloc_7twisted_6python_6_epoll_epoll(PyObject *o) {
    5141267  {
    5151268    PyObject *etype, *eval, *etb;
    5161269    PyErr_Fetch(&etype, &eval, &etb);
    517     ++o->ob_refcnt;
    518     __pyx_f_6_epoll_5epoll___dealloc__(o);
     1270    ++Py_REFCNT(o);
     1271    __pyx_pf_7twisted_6python_6_epoll_5epoll___dealloc__(o);
    5191272    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    520     --o->ob_refcnt;
     1273    --Py_REFCNT(o);
    5211274    PyErr_Restore(etype, eval, etb);
    5221275  }
    523   (*o->ob_type->tp_free)(o);
     1276  (*Py_TYPE(o)->tp_free)(o);
    5241277}
    5251278
    526 static int __pyx_tp_traverse_6_epoll_epoll(PyObject *o, visitproc v, void *a) {
    527   int e;
    528   struct __pyx_obj_6_epoll_epoll *p = (struct __pyx_obj_6_epoll_epoll *)o;
    529   return 0;
    530 }
    531 
    532 static int __pyx_tp_clear_6_epoll_epoll(PyObject *o) {
    533   struct __pyx_obj_6_epoll_epoll *p = (struct __pyx_obj_6_epoll_epoll *)o;
    534   return 0;
    535 }
    536 
    537 static struct PyMethodDef __pyx_methods_6_epoll_epoll[] = {
    538   {"close", (PyCFunction)__pyx_f_6_epoll_5epoll_close, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6_epoll_5epoll_close},
    539   {"fileno", (PyCFunction)__pyx_f_6_epoll_5epoll_fileno, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6_epoll_5epoll_fileno},
    540   {"_control", (PyCFunction)__pyx_f_6_epoll_5epoll__control, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6_epoll_5epoll__control},
    541   {"wait", (PyCFunction)__pyx_f_6_epoll_5epoll_wait, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6_epoll_5epoll_wait},
     1279static struct PyMethodDef __pyx_methods_7twisted_6python_6_epoll_epoll[] = {
     1280  {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pf_7twisted_6python_6_epoll_5epoll_close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_7twisted_6python_6_epoll_5epoll_close)},
     1281  {__Pyx_NAMESTR("fileno"), (PyCFunction)__pyx_pf_7twisted_6python_6_epoll_5epoll_fileno, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_7twisted_6python_6_epoll_5epoll_fileno)},
     1282  {__Pyx_NAMESTR("_control"), (PyCFunction)__pyx_pf_7twisted_6python_6_epoll_5epoll__control, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7twisted_6python_6_epoll_5epoll__control)},
     1283  {__Pyx_NAMESTR("wait"), (PyCFunction)__pyx_pf_7twisted_6python_6_epoll_5epoll_wait, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7twisted_6python_6_epoll_5epoll_wait)},
    5421284  {0, 0, 0, 0}
    5431285};
    5441286
     
    5461288  0, /*nb_add*/
    5471289  0, /*nb_subtract*/
    5481290  0, /*nb_multiply*/
     1291  #if PY_MAJOR_VERSION < 3
    5491292  0, /*nb_divide*/
     1293  #endif
    5501294  0, /*nb_remainder*/
    5511295  0, /*nb_divmod*/
    5521296  0, /*nb_power*/
     
    5601304  0, /*nb_and*/
    5611305  0, /*nb_xor*/
    5621306  0, /*nb_or*/
     1307  #if PY_MAJOR_VERSION < 3
    5631308  0, /*nb_coerce*/
     1309  #endif
    5641310  0, /*nb_int*/
     1311  #if PY_MAJOR_VERSION >= 3
     1312  0, /*reserved*/
     1313  #else
    5651314  0, /*nb_long*/
     1315  #endif
    5661316  0, /*nb_float*/
     1317  #if PY_MAJOR_VERSION < 3
    5671318  0, /*nb_oct*/
     1319  #endif
     1320  #if PY_MAJOR_VERSION < 3
    5681321  0, /*nb_hex*/
     1322  #endif
    5691323  0, /*nb_inplace_add*/
    5701324  0, /*nb_inplace_subtract*/
    5711325  0, /*nb_inplace_multiply*/
     1326  #if PY_MAJOR_VERSION < 3
    5721327  0, /*nb_inplace_divide*/
     1328  #endif
    5731329  0, /*nb_inplace_remainder*/
    5741330  0, /*nb_inplace_power*/
    5751331  0, /*nb_inplace_lshift*/
     
    5811337  0, /*nb_true_divide*/
    5821338  0, /*nb_inplace_floor_divide*/
    5831339  0, /*nb_inplace_true_divide*/
     1340  #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX)
     1341  0, /*nb_index*/
     1342  #endif
    5841343};
    5851344
    5861345static PySequenceMethods __pyx_tp_as_sequence_epoll = {
     
    6031362};
    6041363
    6051364static PyBufferProcs __pyx_tp_as_buffer_epoll = {
     1365  #if PY_MAJOR_VERSION < 3
    6061366  0, /*bf_getreadbuffer*/
     1367  #endif
     1368  #if PY_MAJOR_VERSION < 3
    6071369  0, /*bf_getwritebuffer*/
     1370  #endif
     1371  #if PY_MAJOR_VERSION < 3
    6081372  0, /*bf_getsegcount*/
     1373  #endif
     1374  #if PY_MAJOR_VERSION < 3
    6091375  0, /*bf_getcharbuffer*/
     1376  #endif
     1377  #if PY_VERSION_HEX >= 0x02060000
     1378  0, /*bf_getbuffer*/
     1379  #endif
     1380  #if PY_VERSION_HEX >= 0x02060000
     1381  0, /*bf_releasebuffer*/
     1382  #endif
    6101383};
    6111384
    612 PyTypeObject __pyx_type_6_epoll_epoll = {
    613   PyObject_HEAD_INIT(0)
    614   0, /*ob_size*/
    615   "_epoll.epoll", /*tp_name*/
    616   sizeof(struct __pyx_obj_6_epoll_epoll), /*tp_basicsize*/
     1385PyTypeObject __pyx_type_7twisted_6python_6_epoll_epoll = {
     1386  PyVarObject_HEAD_INIT(0, 0)
     1387  __Pyx_NAMESTR("twisted.python._epoll.epoll"), /*tp_name*/
     1388  sizeof(struct __pyx_obj_7twisted_6python_6_epoll_epoll), /*tp_basicsize*/
    6171389  0, /*tp_itemsize*/
    618   __pyx_tp_dealloc_6_epoll_epoll, /*tp_dealloc*/
     1390  __pyx_tp_dealloc_7twisted_6python_6_epoll_epoll, /*tp_dealloc*/
    6191391  0, /*tp_print*/
    6201392  0, /*tp_getattr*/
    6211393  0, /*tp_setattr*/
     
    6301402  0, /*tp_getattro*/
    6311403  0, /*tp_setattro*/
    6321404  &__pyx_tp_as_buffer_epoll, /*tp_as_buffer*/
    633   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
    634   "\n    Represent a set of file descriptors being monitored for events.\n    ", /*tp_doc*/
    635   __pyx_tp_traverse_6_epoll_epoll, /*tp_traverse*/
    636   __pyx_tp_clear_6_epoll_epoll, /*tp_clear*/
     1405  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
     1406  __Pyx_DOCSTR("\n    Represent a set of file descriptors being monitored for events.\n    "), /*tp_doc*/
     1407  0, /*tp_traverse*/
     1408  0, /*tp_clear*/
    6371409  0, /*tp_richcompare*/
    6381410  0, /*tp_weaklistoffset*/
    6391411  0, /*tp_iter*/
    6401412  0, /*tp_iternext*/
    641   __pyx_methods_6_epoll_epoll, /*tp_methods*/
     1413  __pyx_methods_7twisted_6python_6_epoll_epoll, /*tp_methods*/
    6421414  0, /*tp_members*/
    6431415  0, /*tp_getset*/
    6441416  0, /*tp_base*/
     
    6461418  0, /*tp_descr_get*/
    6471419  0, /*tp_descr_set*/
    6481420  0, /*tp_dictoffset*/
    649   __pyx_f_6_epoll_5epoll___init__, /*tp_init*/
     1421  __pyx_pf_7twisted_6python_6_epoll_5epoll___init__, /*tp_init*/
    6501422  0, /*tp_alloc*/
    651   __pyx_tp_new_6_epoll_epoll, /*tp_new*/
     1423  __pyx_tp_new_7twisted_6python_6_epoll_epoll, /*tp_new*/
    6521424  0, /*tp_free*/
    6531425  0, /*tp_is_gc*/
    6541426  0, /*tp_bases*/
     
    6561428  0, /*tp_cache*/
    6571429  0, /*tp_subclasses*/
    6581430  0, /*tp_weaklist*/
     1431  0, /*tp_del*/
     1432  #if PY_VERSION_HEX >= 0x02060000
     1433  0, /*tp_version_tag*/
     1434  #endif
    6591435};
    6601436
    6611437static struct PyMethodDef __pyx_methods[] = {
     
    6641440
    6651441static void __pyx_init_filenames(void); /*proto*/
    6661442
     1443#if PY_MAJOR_VERSION >= 3
     1444static struct PyModuleDef __pyx_moduledef = {
     1445    PyModuleDef_HEAD_INIT,
     1446    __Pyx_NAMESTR("_epoll"),
     1447    __Pyx_DOCSTR(__pyx_k_1), /* m_doc */
     1448    -1, /* m_size */
     1449    __pyx_methods /* m_methods */,
     1450    NULL, /* m_reload */
     1451    NULL, /* m_traverse */
     1452    NULL, /* m_clear */
     1453    NULL /* m_free */
     1454};
     1455#endif
     1456
     1457static __Pyx_StringTabEntry __pyx_string_tab[] = {
     1458  {&__pyx_kp_u_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 1, 0, 0},
     1459  {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0},
     1460  {&__pyx_kp_u_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0, 0},
     1461  {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0},
     1462  {&__pyx_n_s__CTL_ADD, __pyx_k__CTL_ADD, sizeof(__pyx_k__CTL_ADD), 0, 0, 1, 1},
     1463  {&__pyx_n_s__CTL_DEL, __pyx_k__CTL_DEL, sizeof(__pyx_k__CTL_DEL), 0, 0, 1, 1},
     1464  {&__pyx_n_s__CTL_MOD, __pyx_k__CTL_MOD, sizeof(__pyx_k__CTL_MOD), 0, 0, 1, 1},
     1465  {&__pyx_n_s__ERR, __pyx_k__ERR, sizeof(__pyx_k__ERR), 0, 0, 1, 1},
     1466  {&__pyx_n_s__ET, __pyx_k__ET, sizeof(__pyx_k__ET), 0, 0, 1, 1},
     1467  {&__pyx_n_s__HUP, __pyx_k__HUP, sizeof(__pyx_k__HUP), 0, 0, 1, 1},
     1468  {&__pyx_n_s__IN, __pyx_k__IN, sizeof(__pyx_k__IN), 0, 0, 1, 1},
     1469  {&__pyx_n_s__IOError, __pyx_k__IOError, sizeof(__pyx_k__IOError), 0, 0, 1, 1},
     1470  {&__pyx_n_s__MSG, __pyx_k__MSG, sizeof(__pyx_k__MSG), 0, 0, 1, 1},
     1471  {&__pyx_n_s__OUT, __pyx_k__OUT, sizeof(__pyx_k__OUT), 0, 0, 1, 1},
     1472  {&__pyx_n_s__PRI, __pyx_k__PRI, sizeof(__pyx_k__PRI), 0, 0, 1, 1},
     1473  {&__pyx_n_s__RDBAND, __pyx_k__RDBAND, sizeof(__pyx_k__RDBAND), 0, 0, 1, 1},
     1474  {&__pyx_n_s__RDNORM, __pyx_k__RDNORM, sizeof(__pyx_k__RDNORM), 0, 0, 1, 1},
     1475  {&__pyx_n_s__WRBAND, __pyx_k__WRBAND, sizeof(__pyx_k__WRBAND), 0, 0, 1, 1},
     1476  {&__pyx_n_s__WRNORM, __pyx_k__WRNORM, sizeof(__pyx_k__WRNORM), 0, 0, 1, 1},
     1477  {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
     1478  {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
     1479  {&__pyx_n_s___control, __pyx_k___control, sizeof(__pyx_k___control), 0, 0, 1, 1},
     1480  {&__pyx_n_s__close, __pyx_k__close, sizeof(__pyx_k__close), 0, 0, 1, 1},
     1481  {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1},
     1482  {&__pyx_n_s__epoll, __pyx_k__epoll, sizeof(__pyx_k__epoll), 0, 0, 1, 1},
     1483  {&__pyx_n_s__events, __pyx_k__events, sizeof(__pyx_k__events), 0, 0, 1, 1},
     1484  {&__pyx_n_s__fd, __pyx_k__fd, sizeof(__pyx_k__fd), 0, 0, 1, 1},
     1485  {&__pyx_n_s__fileno, __pyx_k__fileno, sizeof(__pyx_k__fileno), 0, 0, 1, 1},
     1486  {&__pyx_n_s__initialized, __pyx_k__initialized, sizeof(__pyx_k__initialized), 0, 0, 1, 1},
     1487  {&__pyx_n_s__maxevents, __pyx_k__maxevents, sizeof(__pyx_k__maxevents), 0, 0, 1, 1},
     1488  {&__pyx_n_s__op, __pyx_k__op, sizeof(__pyx_k__op), 0, 0, 1, 1},
     1489  {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1},
     1490  {&__pyx_n_s__timeout, __pyx_k__timeout, sizeof(__pyx_k__timeout), 0, 0, 1, 1},
     1491  {&__pyx_n_s__wait, __pyx_k__wait, sizeof(__pyx_k__wait), 0, 0, 1, 1},
     1492  {0, 0, 0, 0, 0, 0, 0}
     1493};
     1494static int __Pyx_InitCachedBuiltins(void) {
     1495  __pyx_builtin_IOError = __Pyx_GetName(__pyx_b, __pyx_n_s__IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1496  return 0;
     1497  __pyx_L1_error:;
     1498  return -1;
     1499}
     1500
     1501static int __Pyx_InitGlobals(void) {
     1502  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
     1503  return 0;
     1504  __pyx_L1_error:;
     1505  return -1;
     1506}
     1507
     1508#if PY_MAJOR_VERSION < 3
    6671509PyMODINIT_FUNC init_epoll(void); /*proto*/
    668 PyMODINIT_FUNC init_epoll(void) {
    669   PyObject *__pyx_1 = 0;
     1510PyMODINIT_FUNC init_epoll(void)
     1511#else
     1512PyMODINIT_FUNC PyInit__epoll(void); /*proto*/
     1513PyMODINIT_FUNC PyInit__epoll(void)
     1514#endif
     1515{
     1516  PyObject *__pyx_t_1 = NULL;
     1517  PyObject *__pyx_t_2 = NULL;
     1518  PyObject *__pyx_t_3 = NULL;
     1519  #if CYTHON_REFNANNY
     1520  void* __pyx_refnanny = NULL;
     1521  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
     1522  if (!__Pyx_RefNanny) {
     1523      PyErr_Clear();
     1524      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
     1525      if (!__Pyx_RefNanny)
     1526          Py_FatalError("failed to import 'refnanny' module");
     1527  }
     1528  __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit__epoll(void)", __LINE__, __FILE__);
     1529  #endif
    6701530  __pyx_init_filenames();
    671   __pyx_m = Py_InitModule4("_epoll", __pyx_methods, __pyx_mdoc, 0, PYTHON_API_VERSION);
    672   if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;};
    673   __pyx_b = PyImport_AddModule("__builtin__");
    674   if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;};
    675   if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;};
    676   if (__Pyx_InternStrings(__pyx_intern_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;};
    677   if (PyType_Ready(&__pyx_type_6_epoll_epoll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; goto __pyx_L1;}
    678   if (PyObject_SetAttrString(__pyx_m, "epoll", (PyObject *)&__pyx_type_6_epoll_epoll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; goto __pyx_L1;}
    679   __pyx_ptype_6_epoll_epoll = &__pyx_type_6_epoll_epoll;
     1531  __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;}
     1532  #if PY_MAJOR_VERSION < 3
     1533  __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1534  #else
     1535  __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;}
     1536  #endif
     1537  /*--- Library function declarations ---*/
     1538  /*--- Threads initialization code ---*/
     1539  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
     1540  #ifdef WITH_THREAD /* Python build with threading support? */
     1541  PyEval_InitThreads();
     1542  #endif
     1543  #endif
     1544  /*--- Module creation code ---*/
     1545  #if PY_MAJOR_VERSION < 3
     1546  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_epoll"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_1), 0, PYTHON_API_VERSION);
     1547  #else
     1548  __pyx_m = PyModule_Create(&__pyx_moduledef);
     1549  #endif
     1550  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
     1551  #if PY_MAJOR_VERSION < 3
     1552  Py_INCREF(__pyx_m);
     1553  #endif
     1554  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
     1555  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
     1556  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
     1557  /*--- Initialize various global constants etc. ---*/
     1558  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1559  if (__pyx_module_is_main_twisted__python___epoll) {
     1560    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;};
     1561  }
     1562  /*--- Builtin init code ---*/
     1563  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1564  /*--- Global init code ---*/
     1565  /*--- Function export code ---*/
     1566  /*--- Type init code ---*/
     1567  if (PyType_Ready(&__pyx_type_7twisted_6python_6_epoll_epoll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1568  if (__Pyx_SetAttrString(__pyx_m, "epoll", (PyObject *)&__pyx_type_7twisted_6python_6_epoll_epoll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1569  __pyx_ptype_7twisted_6python_6_epoll_epoll = &__pyx_type_7twisted_6python_6_epoll_epoll;
     1570  /*--- Type import code ---*/
     1571  /*--- Function import code ---*/
     1572  /*--- Execution code ---*/
    6801573
    681   /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":165 */
    682   __pyx_1 = PyInt_FromLong(EPOLL_CTL_ADD); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; goto __pyx_L1;}
    683   if (PyObject_SetAttr(__pyx_m, __pyx_n_CTL_ADD, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; goto __pyx_L1;}
    684   Py_DECREF(__pyx_1); __pyx_1 = 0;
     1574  /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":165
     1575 *             free(events)
     1576 *
     1577 * CTL_ADD = EPOLL_CTL_ADD             # <<<<<<<<<<<<<<
     1578 * CTL_DEL = EPOLL_CTL_DEL
     1579 * CTL_MOD = EPOLL_CTL_MOD
     1580 */
     1581  __pyx_t_1 = PyInt_FromLong(EPOLL_CTL_ADD); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1582  __Pyx_GOTREF(__pyx_t_1);
     1583  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__CTL_ADD, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1584  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    6851585
    686   /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":166 */
    687   __pyx_1 = PyInt_FromLong(EPOLL_CTL_DEL); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; goto __pyx_L1;}
    688   if (PyObject_SetAttr(__pyx_m, __pyx_n_CTL_DEL, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; goto __pyx_L1;}
    689   Py_DECREF(__pyx_1); __pyx_1 = 0;
     1586  /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":166
     1587 *
     1588 * CTL_ADD = EPOLL_CTL_ADD
     1589 * CTL_DEL = EPOLL_CTL_DEL             # <<<<<<<<<<<<<<
     1590 * CTL_MOD = EPOLL_CTL_MOD
     1591 *
     1592 */
     1593  __pyx_t_1 = PyInt_FromLong(EPOLL_CTL_DEL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1594  __Pyx_GOTREF(__pyx_t_1);
     1595  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__CTL_DEL, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1596  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    6901597
    691   /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":167 */
    692   __pyx_1 = PyInt_FromLong(EPOLL_CTL_MOD); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; goto __pyx_L1;}
    693   if (PyObject_SetAttr(__pyx_m, __pyx_n_CTL_MOD, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; goto __pyx_L1;}
    694   Py_DECREF(__pyx_1); __pyx_1 = 0;
     1598  /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":167
     1599 * CTL_ADD = EPOLL_CTL_ADD
     1600 * CTL_DEL = EPOLL_CTL_DEL
     1601 * CTL_MOD = EPOLL_CTL_MOD             # <<<<<<<<<<<<<<
     1602 *
     1603 * IN = EPOLLIN
     1604 */
     1605  __pyx_t_1 = PyInt_FromLong(EPOLL_CTL_MOD); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1606  __Pyx_GOTREF(__pyx_t_1);
     1607  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__CTL_MOD, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1608  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    6951609
    696   /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":169 */
    697   __pyx_1 = PyInt_FromLong(EPOLLIN); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; goto __pyx_L1;}
    698   if (PyObject_SetAttr(__pyx_m, __pyx_n_IN, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; goto __pyx_L1;}
    699   Py_DECREF(__pyx_1); __pyx_1 = 0;
     1610  /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":169
     1611 * CTL_MOD = EPOLL_CTL_MOD
     1612 *
     1613 * IN = EPOLLIN             # <<<<<<<<<<<<<<
     1614 * OUT = EPOLLOUT
     1615 * PRI = EPOLLPRI
     1616 */
     1617  __pyx_t_1 = PyInt_FromLong(EPOLLIN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1618  __Pyx_GOTREF(__pyx_t_1);
     1619  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__IN, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1620  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    7001621
    701   /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":170 */
    702   __pyx_1 = PyInt_FromLong(EPOLLOUT); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; goto __pyx_L1;}
    703   if (PyObject_SetAttr(__pyx_m, __pyx_n_OUT, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; goto __pyx_L1;}
    704   Py_DECREF(__pyx_1); __pyx_1 = 0;
     1622  /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":170
     1623 *
     1624 * IN = EPOLLIN
     1625 * OUT = EPOLLOUT             # <<<<<<<<<<<<<<
     1626 * PRI = EPOLLPRI
     1627 * ERR = EPOLLERR
     1628 */
     1629  __pyx_t_1 = PyInt_FromLong(EPOLLOUT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1630  __Pyx_GOTREF(__pyx_t_1);
     1631  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__OUT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1632  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    7051633
    706   /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":171 */
    707   __pyx_1 = PyInt_FromLong(EPOLLPRI); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; goto __pyx_L1;}
    708   if (PyObject_SetAttr(__pyx_m, __pyx_n_PRI, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; goto __pyx_L1;}
    709   Py_DECREF(__pyx_1); __pyx_1 = 0;
     1634  /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":171
     1635 * IN = EPOLLIN
     1636 * OUT = EPOLLOUT
     1637 * PRI = EPOLLPRI             # <<<<<<<<<<<<<<
     1638 * ERR = EPOLLERR
     1639 * HUP = EPOLLHUP
     1640 */
     1641  __pyx_t_1 = PyInt_FromLong(EPOLLPRI); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1642  __Pyx_GOTREF(__pyx_t_1);
     1643  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__PRI, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1644  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    7101645
    711   /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":172 */
    712   __pyx_1 = PyInt_FromLong(EPOLLERR); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; goto __pyx_L1;}
    713   if (PyObject_SetAttr(__pyx_m, __pyx_n_ERR, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; goto __pyx_L1;}
    714   Py_DECREF(__pyx_1); __pyx_1 = 0;
     1646  /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":172
     1647 * OUT = EPOLLOUT
     1648 * PRI = EPOLLPRI
     1649 * ERR = EPOLLERR             # <<<<<<<<<<<<<<
     1650 * HUP = EPOLLHUP
     1651 * ET = EPOLLET
     1652 */
     1653  __pyx_t_1 = PyInt_FromLong(EPOLLERR); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1654  __Pyx_GOTREF(__pyx_t_1);
     1655  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ERR, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1656  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    7151657
    716   /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":173 */
    717   __pyx_1 = PyInt_FromLong(EPOLLHUP); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; goto __pyx_L1;}
    718   if (PyObject_SetAttr(__pyx_m, __pyx_n_HUP, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; goto __pyx_L1;}
    719   Py_DECREF(__pyx_1); __pyx_1 = 0;
     1658  /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":173
     1659 * PRI = EPOLLPRI
     1660 * ERR = EPOLLERR
     1661 * HUP = EPOLLHUP             # <<<<<<<<<<<<<<
     1662 * ET = EPOLLET
     1663 *
     1664 */
     1665  __pyx_t_1 = PyInt_FromLong(EPOLLHUP); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1666  __Pyx_GOTREF(__pyx_t_1);
     1667  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__HUP, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1668  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    7201669
    721   /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":174 */
    722   __pyx_1 = PyInt_FromLong(EPOLLET); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; goto __pyx_L1;}
    723   if (PyObject_SetAttr(__pyx_m, __pyx_n_ET, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; goto __pyx_L1;}
    724   Py_DECREF(__pyx_1); __pyx_1 = 0;
     1670  /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":174
     1671 * ERR = EPOLLERR
     1672 * HUP = EPOLLHUP
     1673 * ET = EPOLLET             # <<<<<<<<<<<<<<
     1674 *
     1675 * RDNORM = EPOLLRDNORM
     1676 */
     1677  __pyx_t_1 = PyInt_FromLong(EPOLLET); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1678  __Pyx_GOTREF(__pyx_t_1);
     1679  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ET, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1680  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    7251681
    726   /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":176 */
    727   __pyx_1 = PyInt_FromLong(EPOLLRDNORM); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;}
    728   if (PyObject_SetAttr(__pyx_m, __pyx_n_RDNORM, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;}
    729   Py_DECREF(__pyx_1); __pyx_1 = 0;
     1682  /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":176
     1683 * ET = EPOLLET
     1684 *
     1685 * RDNORM = EPOLLRDNORM             # <<<<<<<<<<<<<<
     1686 * RDBAND = EPOLLRDBAND
     1687 * WRNORM = EPOLLWRNORM
     1688 */
     1689  __pyx_t_1 = PyInt_FromLong(EPOLLRDNORM); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1690  __Pyx_GOTREF(__pyx_t_1);
     1691  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__RDNORM, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1692  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    7301693
    731   /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":177 */
    732   __pyx_1 = PyInt_FromLong(EPOLLRDBAND); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}
    733   if (PyObject_SetAttr(__pyx_m, __pyx_n_RDBAND, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}
    734   Py_DECREF(__pyx_1); __pyx_1 = 0;
     1694  /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":177
     1695 *
     1696 * RDNORM = EPOLLRDNORM
     1697 * RDBAND = EPOLLRDBAND             # <<<<<<<<<<<<<<
     1698 * WRNORM = EPOLLWRNORM
     1699 * WRBAND = EPOLLWRBAND
     1700 */
     1701  __pyx_t_1 = PyInt_FromLong(EPOLLRDBAND); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1702  __Pyx_GOTREF(__pyx_t_1);
     1703  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__RDBAND, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1704  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    7351705
    736   /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":178 */
    737   __pyx_1 = PyInt_FromLong(EPOLLWRNORM); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}
    738   if (PyObject_SetAttr(__pyx_m, __pyx_n_WRNORM, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}
    739   Py_DECREF(__pyx_1); __pyx_1 = 0;
     1706  /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":178
     1707 * RDNORM = EPOLLRDNORM
     1708 * RDBAND = EPOLLRDBAND
     1709 * WRNORM = EPOLLWRNORM             # <<<<<<<<<<<<<<
     1710 * WRBAND = EPOLLWRBAND
     1711 * MSG = EPOLLMSG
     1712 */
     1713  __pyx_t_1 = PyInt_FromLong(EPOLLWRNORM); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1714  __Pyx_GOTREF(__pyx_t_1);
     1715  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__WRNORM, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1716  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    7401717
    741   /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":179 */
    742   __pyx_1 = PyInt_FromLong(EPOLLWRBAND); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; goto __pyx_L1;}
    743   if (PyObject_SetAttr(__pyx_m, __pyx_n_WRBAND, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; goto __pyx_L1;}
    744   Py_DECREF(__pyx_1); __pyx_1 = 0;
     1718  /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":179
     1719 * RDBAND = EPOLLRDBAND
     1720 * WRNORM = EPOLLWRNORM
     1721 * WRBAND = EPOLLWRBAND             # <<<<<<<<<<<<<<
     1722 * MSG = EPOLLMSG
     1723 *
     1724 */
     1725  __pyx_t_1 = PyInt_FromLong(EPOLLWRBAND); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1726  __Pyx_GOTREF(__pyx_t_1);
     1727  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__WRBAND, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1728  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    7451729
    746   /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":180 */
    747   __pyx_1 = PyInt_FromLong(EPOLLMSG); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; goto __pyx_L1;}
    748   if (PyObject_SetAttr(__pyx_m, __pyx_n_MSG, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; goto __pyx_L1;}
    749   Py_DECREF(__pyx_1); __pyx_1 = 0;
     1730  /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":180
     1731 * WRNORM = EPOLLWRNORM
     1732 * WRBAND = EPOLLWRBAND
     1733 * MSG = EPOLLMSG             # <<<<<<<<<<<<<<
     1734 *
     1735 */
     1736  __pyx_t_1 = PyInt_FromLong(EPOLLMSG); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1737  __Pyx_GOTREF(__pyx_t_1);
     1738  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__MSG, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1739  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     1740
     1741  /* "/home/martin/work/twisted.3k/twisted/python/_epoll.pyx":1
     1742 * # Copyright (c) 2001-2006 Twisted Matrix Laboratories.             # <<<<<<<<<<<<<<
     1743 * # See LICENSE for details.
     1744 *
     1745 */
     1746  __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;}
     1747  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     1748  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__epoll); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1749  __Pyx_GOTREF(__pyx_t_2);
     1750  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__close); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1751  __Pyx_GOTREF(__pyx_t_3);
     1752  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     1753  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
     1754  __Pyx_GOTREF(__pyx_t_2);
     1755  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     1756  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_2), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1757  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     1758  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__epoll); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1759  __Pyx_GOTREF(__pyx_t_2);
     1760  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__fileno); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1761  __Pyx_GOTREF(__pyx_t_3);
     1762  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     1763  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
     1764  __Pyx_GOTREF(__pyx_t_2);
     1765  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     1766  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_3), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1767  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     1768  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__epoll); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1769  __Pyx_GOTREF(__pyx_t_2);
     1770  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s___control); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1771  __Pyx_GOTREF(__pyx_t_3);
     1772  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     1773  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
     1774  __Pyx_GOTREF(__pyx_t_2);
     1775  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     1776  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_4), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1777  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     1778  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__epoll); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1779  __Pyx_GOTREF(__pyx_t_2);
     1780  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__wait); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1781  __Pyx_GOTREF(__pyx_t_3);
     1782  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     1783  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
     1784  __Pyx_GOTREF(__pyx_t_2);
     1785  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     1786  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_5), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     1787  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     1788  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;}
     1789  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
     1790  goto __pyx_L0;
     1791  __pyx_L1_error:;
     1792  __Pyx_XDECREF(__pyx_t_1);
     1793  __Pyx_XDECREF(__pyx_t_2);
     1794  __Pyx_XDECREF(__pyx_t_3);
     1795  if (__pyx_m) {
     1796    __Pyx_AddTraceback("init twisted.python._epoll");
     1797    Py_DECREF(__pyx_m); __pyx_m = 0;
     1798  } else if (!PyErr_Occurred()) {
     1799    PyErr_SetString(PyExc_ImportError, "init twisted.python._epoll");
     1800  }
     1801  __pyx_L0:;
     1802  __Pyx_RefNannyFinishContext();
     1803  #if PY_MAJOR_VERSION < 3
    7501804  return;
    751   __pyx_L1:;
    752   Py_XDECREF(__pyx_1);
    753   __Pyx_AddTraceback("_epoll");
     1805  #else
     1806  return __pyx_m;
     1807  #endif
    7541808}
    7551809
    756 static char *__pyx_filenames[] = {
     1810static const char *__pyx_filenames[] = {
    7571811  "_epoll.pyx",
    7581812};
    7591813
     
    7631817  __pyx_f = __pyx_filenames;
    7641818}
    7651819
     1820static void __Pyx_RaiseDoubleKeywordsError(
     1821    const char* func_name,
     1822    PyObject* kw_name)
     1823{
     1824    PyErr_Format(PyExc_TypeError,
     1825        #if PY_MAJOR_VERSION >= 3
     1826        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
     1827        #else
     1828        "%s() got multiple values for keyword argument '%s'", func_name,
     1829        PyString_AS_STRING(kw_name));
     1830        #endif
     1831}
     1832
     1833static void __Pyx_RaiseArgtupleInvalid(
     1834    const char* func_name,
     1835    int exact,
     1836    Py_ssize_t num_min,
     1837    Py_ssize_t num_max,
     1838    Py_ssize_t num_found)
     1839{
     1840    Py_ssize_t num_expected;
     1841    const char *number, *more_or_less;
     1842
     1843    if (num_found < num_min) {
     1844        num_expected = num_min;
     1845        more_or_less = "at least";
     1846    } else {
     1847        num_expected = num_max;
     1848        more_or_less = "at most";
     1849    }
     1850    if (exact) {
     1851        more_or_less = "exactly";
     1852    }
     1853    number = (num_expected == 1) ? "" : "s";
     1854    PyErr_Format(PyExc_TypeError,
     1855        #if PY_VERSION_HEX < 0x02050000
     1856            "%s() takes %s %d positional argument%s (%d given)",
     1857        #else
     1858            "%s() takes %s %zd positional argument%s (%zd given)",
     1859        #endif
     1860        func_name, more_or_less, num_expected, number, num_found);
     1861}
     1862
     1863static int __Pyx_ParseOptionalKeywords(
     1864    PyObject *kwds,
     1865    PyObject **argnames[],
     1866    PyObject *kwds2,
     1867    PyObject *values[],
     1868    Py_ssize_t num_pos_args,
     1869    const char* function_name)
     1870{
     1871    PyObject *key = 0, *value = 0;
     1872    Py_ssize_t pos = 0;
     1873    PyObject*** name;
     1874    PyObject*** first_kw_arg = argnames + num_pos_args;
     1875
     1876    while (PyDict_Next(kwds, &pos, &key, &value)) {
     1877        name = first_kw_arg;
     1878        while (*name && (**name != key)) name++;
     1879        if (*name) {
     1880            values[name-argnames] = value;
     1881        } else {
     1882            #if PY_MAJOR_VERSION < 3
     1883            if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
     1884            #else
     1885            if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
     1886            #endif
     1887                goto invalid_keyword_type;
     1888            } else {
     1889                for (name = first_kw_arg; *name; name++) {
     1890                    #if PY_MAJOR_VERSION >= 3
     1891                    if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
     1892                        PyUnicode_Compare(**name, key) == 0) break;
     1893                    #else
     1894                    if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
     1895                        _PyString_Eq(**name, key)) break;
     1896                    #endif
     1897                }
     1898                if (*name) {
     1899                    values[name-argnames] = value;
     1900                } else {
     1901                    /* unexpected keyword found */
     1902                    for (name=argnames; name != first_kw_arg; name++) {
     1903                        if (**name == key) goto arg_passed_twice;
     1904                        #if PY_MAJOR_VERSION >= 3
     1905                        if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
     1906                            PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
     1907                        #else
     1908                        if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
     1909                            _PyString_Eq(**name, key)) goto arg_passed_twice;
     1910                        #endif
     1911                    }
     1912                    if (kwds2) {
     1913                        if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
     1914                    } else {
     1915                        goto invalid_keyword;
     1916                    }
     1917                }
     1918            }
     1919        }
     1920    }
     1921    return 0;
     1922arg_passed_twice:
     1923    __Pyx_RaiseDoubleKeywordsError(function_name, **name);
     1924    goto bad;
     1925invalid_keyword_type:
     1926    PyErr_Format(PyExc_TypeError,
     1927        "%s() keywords must be strings", function_name);
     1928    goto bad;
     1929invalid_keyword:
     1930    PyErr_Format(PyExc_TypeError,
     1931    #if PY_MAJOR_VERSION < 3
     1932        "%s() got an unexpected keyword argument '%s'",
     1933        function_name, PyString_AsString(key));
     1934    #else
     1935        "%s() got an unexpected keyword argument '%U'",
     1936        function_name, key);
     1937    #endif
     1938bad:
     1939    return -1;
     1940}
     1941
     1942static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
     1943    PyObject *tmp_type, *tmp_value, *tmp_tb;
     1944    PyThreadState *tstate = PyThreadState_GET();
     1945
     1946    tmp_type = tstate->curexc_type;
     1947    tmp_value = tstate->curexc_value;
     1948    tmp_tb = tstate->curexc_traceback;
     1949    tstate->curexc_type = type;
     1950    tstate->curexc_value = value;
     1951    tstate->curexc_traceback = tb;
     1952    Py_XDECREF(tmp_type);
     1953    Py_XDECREF(tmp_value);
     1954    Py_XDECREF(tmp_tb);
     1955}
     1956
     1957static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
     1958    PyThreadState *tstate = PyThreadState_GET();
     1959    *type = tstate->curexc_type;
     1960    *value = tstate->curexc_value;
     1961    *tb = tstate->curexc_traceback;
     1962
     1963    tstate->curexc_type = 0;
     1964    tstate->curexc_value = 0;
     1965    tstate->curexc_traceback = 0;
     1966}
     1967
     1968
    7661969static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
    7671970    PyObject *result;
    7681971    result = PyObject_GetAttr(dict, name);
     
    7711974    return result;
    7721975}
    7731976
     1977#if PY_MAJOR_VERSION < 3
    7741978static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
    7751979    Py_XINCREF(type);
    7761980    Py_XINCREF(value);
     
    7901994        value = Py_None;
    7911995        Py_INCREF(value);
    7921996    }
    793     /* Next, repeatedly, replace a tuple exception with its first item */
    794     while (PyTuple_Check(type) && PyTuple_Size(type) > 0) {
    795         PyObject *tmp = type;
    796         type = PyTuple_GET_ITEM(type, 0);
    797         Py_INCREF(type);
    798         Py_DECREF(tmp);
    799     }
    800     if (PyString_CheckExact(type)) {
    801         /* Raising builtin string is deprecated but still allowed --
    802          * do nothing.  Raising an instance of a new-style str
    803          * subclass is right out. */
    804         if (PyErr_Warn(PyExc_DeprecationWarning,
    805                    "raising a string exception is deprecated"))
    806                 goto raise_error;
    807     }
    808     else if (PyType_Check(type) || PyClass_Check(type))
    809         ; /* PyErr_NormalizeException(&type, &value, &tb); */
    810     else if (PyInstance_Check(type)) {
     1997    #if PY_VERSION_HEX < 0x02050000
     1998    if (!PyClass_Check(type))
     1999    #else
     2000    if (!PyType_Check(type))
     2001    #endif
     2002    {
    8112003        /* Raising an instance.  The value should be a dummy. */
    8122004        if (value != Py_None) {
    8132005            PyErr_SetString(PyExc_TypeError,
    814               "instance exception may not have a separate value");
     2006                "instance exception may not have a separate value");
    8152007            goto raise_error;
    8162008        }
    817         else {
    818             /* Normalize to raise <class>, <instance> */
    819             Py_DECREF(value);
    820             value = type;
    821             type = (PyObject*) ((PyInstanceObject*)type)->in_class;
     2009        /* Normalize to raise <class>, <instance> */
     2010        Py_DECREF(value);
     2011        value = type;
     2012        #if PY_VERSION_HEX < 0x02050000
     2013            if (PyInstance_Check(type)) {
     2014                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
     2015                Py_INCREF(type);
     2016            }
     2017            else {
     2018                type = 0;
     2019                PyErr_SetString(PyExc_TypeError,
     2020                    "raise: exception must be an old-style class or instance");
     2021                goto raise_error;
     2022            }
     2023        #else
     2024            type = (PyObject*) Py_TYPE(type);
    8222025            Py_INCREF(type);
    823         }
    824     }
    825     else if (PyType_IsSubtype(type->ob_type, (PyTypeObject*)PyExc_Exception)) {
    826         /* Raising a new-style object (in Py2.5).
    827            The value should be a dummy. */
    828         if (value != Py_None) {
     2026            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
    8292027                PyErr_SetString(PyExc_TypeError,
    830                   "instance exception may not have a separate value");
     2028                    "raise: exception class must be a subclass of BaseException");
    8312029                goto raise_error;
    832         }
    833         else {
    834                 /* Normalize to raise <class>, <instance> */
    835                 Py_DECREF(value);
    836                 value = type;
    837                 type = (PyObject*) type->ob_type;
    838                 Py_INCREF(type);
    839         }
     2030            }
     2031        #endif
    8402032    }
    841     else {
    842         /* Not something you can raise.  You get an exception
    843            anyway, just not what you specified :-) */
    844         PyErr_Format(PyExc_TypeError,
    845                      "exceptions must be classes, instances, or "
    846                      "strings (deprecated), not %s",
    847                      type->ob_type->tp_name);
    848         goto raise_error;
    849     }
    850     PyErr_Restore(type, value, tb);
     2033
     2034    __Pyx_ErrRestore(type, value, tb);
    8512035    return;
    8522036raise_error:
    8532037    Py_XDECREF(value);
     
    8562040    return;
    8572041}
    8582042
    859 static int __Pyx_InternStrings(__Pyx_InternTabEntry *t) {
    860     while (t->p) {
    861         *t->p = PyString_InternFromString(t->s);
    862         if (!*t->p)
    863             return -1;
    864         ++t;
     2043#else /* Python 3+ */
     2044
     2045static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
     2046    if (tb == Py_None) {
     2047        tb = 0;
     2048    } else if (tb && !PyTraceBack_Check(tb)) {
     2049        PyErr_SetString(PyExc_TypeError,
     2050            "raise: arg 3 must be a traceback or None");
     2051        goto bad;
    8652052    }
    866     return 0;
     2053    if (value == Py_None)
     2054        value = 0;
     2055
     2056    if (PyExceptionInstance_Check(type)) {
     2057        if (value) {
     2058            PyErr_SetString(PyExc_TypeError,
     2059                "instance exception may not have a separate value");
     2060            goto bad;
     2061        }
     2062        value = type;
     2063        type = (PyObject*) Py_TYPE(value);
     2064    } else if (!PyExceptionClass_Check(type)) {
     2065        PyErr_SetString(PyExc_TypeError,
     2066            "raise: exception class must be a subclass of BaseException");
     2067        goto bad;
     2068    }
     2069
     2070    PyErr_SetObject(type, value);
     2071
     2072    if (tb) {
     2073        PyThreadState *tstate = PyThreadState_GET();
     2074        PyObject* tmp_tb = tstate->curexc_traceback;
     2075        if (tb != tmp_tb) {
     2076            Py_INCREF(tb);
     2077            tstate->curexc_traceback = tb;
     2078            Py_XDECREF(tmp_tb);
     2079        }
     2080    }
     2081
     2082bad:
     2083    return;
    8672084}
     2085#endif
    8682086
     2087static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
     2088    const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
     2089    const int is_unsigned = neg_one > const_zero;
     2090    if (sizeof(unsigned char) < sizeof(long)) {
     2091        long val = __Pyx_PyInt_AsLong(x);
     2092        if (unlikely(val != (long)(unsigned char)val)) {
     2093            if (!unlikely(val == -1 && PyErr_Occurred())) {
     2094                PyErr_SetString(PyExc_OverflowError,
     2095                    (is_unsigned && unlikely(val < 0)) ?
     2096                    "can't convert negative value to unsigned char" :
     2097                    "value too large to convert to unsigned char");
     2098            }
     2099            return (unsigned char)-1;
     2100        }
     2101        return (unsigned char)val;
     2102    }
     2103    return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
     2104}
     2105
     2106static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
     2107    const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
     2108    const int is_unsigned = neg_one > const_zero;
     2109    if (sizeof(unsigned short) < sizeof(long)) {
     2110        long val = __Pyx_PyInt_AsLong(x);
     2111        if (unlikely(val != (long)(unsigned short)val)) {
     2112            if (!unlikely(val == -1 && PyErr_Occurred())) {
     2113                PyErr_SetString(PyExc_OverflowError,
     2114                    (is_unsigned && unlikely(val < 0)) ?
     2115                    "can't convert negative value to unsigned short" :
     2116                    "value too large to convert to unsigned short");
     2117            }
     2118            return (unsigned short)-1;
     2119        }
     2120        return (unsigned short)val;
     2121    }
     2122    return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
     2123}
     2124
     2125static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
     2126    const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
     2127    const int is_unsigned = neg_one > const_zero;
     2128    if (sizeof(unsigned int) < sizeof(long)) {
     2129        long val = __Pyx_PyInt_AsLong(x);
     2130        if (unlikely(val != (long)(unsigned int)val)) {
     2131            if (!unlikely(val == -1 && PyErr_Occurred())) {
     2132                PyErr_SetString(PyExc_OverflowError,
     2133                    (is_unsigned && unlikely(val < 0)) ?
     2134                    "can't convert negative value to unsigned int" :
     2135                    "value too large to convert to unsigned int");
     2136            }
     2137            return (unsigned int)-1;
     2138        }
     2139        return (unsigned int)val;
     2140    }
     2141    return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
     2142}
     2143
     2144static INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
     2145    const char neg_one = (char)-1, const_zero = 0;
     2146    const int is_unsigned = neg_one > const_zero;
     2147    if (sizeof(char) < sizeof(long)) {
     2148        long val = __Pyx_PyInt_AsLong(x);
     2149        if (unlikely(val != (long)(char)val)) {
     2150            if (!unlikely(val == -1 && PyErr_Occurred())) {
     2151                PyErr_SetString(PyExc_OverflowError,
     2152                    (is_unsigned && unlikely(val < 0)) ?
     2153                    "can't convert negative value to char" :
     2154                    "value too large to convert to char");
     2155            }
     2156            return (char)-1;
     2157        }
     2158        return (char)val;
     2159    }
     2160    return (char)__Pyx_PyInt_AsLong(x);
     2161}
     2162
     2163static INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
     2164    const short neg_one = (short)-1, const_zero = 0;
     2165    const int is_unsigned = neg_one > const_zero;
     2166    if (sizeof(short) < sizeof(long)) {
     2167        long val = __Pyx_PyInt_AsLong(x);
     2168        if (unlikely(val != (long)(short)val)) {
     2169            if (!unlikely(val == -1 && PyErr_Occurred())) {
     2170                PyErr_SetString(PyExc_OverflowError,
     2171                    (is_unsigned && unlikely(val < 0)) ?
     2172                    "can't convert negative value to short" :
     2173                    "value too large to convert to short");
     2174            }
     2175            return (short)-1;
     2176        }
     2177        return (short)val;
     2178    }
     2179    return (short)__Pyx_PyInt_AsLong(x);
     2180}
     2181
     2182static INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
     2183    const int neg_one = (int)-1, const_zero = 0;
     2184    const int is_unsigned = neg_one > const_zero;
     2185    if (sizeof(int) < sizeof(long)) {
     2186        long val = __Pyx_PyInt_AsLong(x);
     2187        if (unlikely(val != (long)(int)val)) {
     2188            if (!unlikely(val == -1 && PyErr_Occurred())) {
     2189                PyErr_SetString(PyExc_OverflowError,
     2190                    (is_unsigned && unlikely(val < 0)) ?
     2191                    "can't convert negative value to int" :
     2192                    "value too large to convert to int");
     2193            }
     2194            return (int)-1;
     2195        }
     2196        return (int)val;
     2197    }
     2198    return (int)__Pyx_PyInt_AsLong(x);
     2199}
     2200
     2201static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
     2202    const signed char neg_one = (signed char)-1, const_zero = 0;
     2203    const int is_unsigned = neg_one > const_zero;
     2204    if (sizeof(signed char) < sizeof(long)) {
     2205        long val = __Pyx_PyInt_AsLong(x);
     2206        if (unlikely(val != (long)(signed char)val)) {
     2207            if (!unlikely(val == -1 && PyErr_Occurred())) {
     2208                PyErr_SetString(PyExc_OverflowError,
     2209                    (is_unsigned && unlikely(val < 0)) ?
     2210                    "can't convert negative value to signed char" :
     2211                    "value too large to convert to signed char");
     2212            }
     2213            return (signed char)-1;
     2214        }
     2215        return (signed char)val;
     2216    }
     2217    return (signed char)__Pyx_PyInt_AsSignedLong(x);
     2218}
     2219
     2220static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
     2221    const signed short neg_one = (signed short)-1, const_zero = 0;
     2222    const int is_unsigned = neg_one > const_zero;
     2223    if (sizeof(signed short) < sizeof(long)) {
     2224        long val = __Pyx_PyInt_AsLong(x);
     2225        if (unlikely(val != (long)(signed short)val)) {
     2226            if (!unlikely(val == -1 && PyErr_Occurred())) {
     2227                PyErr_SetString(PyExc_OverflowError,
     2228                    (is_unsigned && unlikely(val < 0)) ?
     2229                    "can't convert negative value to signed short" :
     2230                    "value too large to convert to signed short");
     2231            }
     2232            return (signed short)-1;
     2233        }
     2234        return (signed short)val;
     2235    }
     2236    return (signed short)__Pyx_PyInt_AsSignedLong(x);
     2237}
     2238
     2239static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
     2240    const signed int neg_one = (signed int)-1, const_zero = 0;
     2241    const int is_unsigned = neg_one > const_zero;
     2242    if (sizeof(signed int) < sizeof(long)) {
     2243        long val = __Pyx_PyInt_AsLong(x);
     2244        if (unlikely(val != (long)(signed int)val)) {
     2245            if (!unlikely(val == -1 && PyErr_Occurred())) {
     2246                PyErr_SetString(PyExc_OverflowError,
     2247                    (is_unsigned && unlikely(val < 0)) ?
     2248                    "can't convert negative value to signed int" :
     2249                    "value too large to convert to signed int");
     2250            }
     2251            return (signed int)-1;
     2252        }
     2253        return (signed int)val;
     2254    }
     2255    return (signed int)__Pyx_PyInt_AsSignedLong(x);
     2256}
     2257
     2258static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
     2259    const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
     2260    const int is_unsigned = neg_one > const_zero;
     2261#if PY_VERSION_HEX < 0x03000000
     2262    if (likely(PyInt_Check(x))) {
     2263        long val = PyInt_AS_LONG(x);
     2264        if (is_unsigned && unlikely(val < 0)) {
     2265            PyErr_SetString(PyExc_OverflowError,
     2266                            "can't convert negative value to unsigned long");
     2267            return (unsigned long)-1;
     2268        }
     2269        return (unsigned long)val;
     2270    } else
     2271#endif
     2272    if (likely(PyLong_Check(x))) {
     2273        if (is_unsigned) {
     2274            if (unlikely(Py_SIZE(x) < 0)) {
     2275                PyErr_SetString(PyExc_OverflowError,
     2276                                "can't convert negative value to unsigned long");
     2277                return (unsigned long)-1;
     2278            }
     2279            return PyLong_AsUnsignedLong(x);
     2280        } else {
     2281            return PyLong_AsLong(x);
     2282        }
     2283    } else {
     2284        unsigned long val;
     2285        PyObject *tmp = __Pyx_PyNumber_Int(x);
     2286        if (!tmp) return (unsigned long)-1;
     2287        val = __Pyx_PyInt_AsUnsignedLong(tmp);
     2288        Py_DECREF(tmp);
     2289        return val;
     2290    }
     2291}
     2292
     2293static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
     2294    const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
     2295    const int is_unsigned = neg_one > const_zero;
     2296#if PY_VERSION_HEX < 0x03000000
     2297    if (likely(PyInt_Check(x))) {
     2298        long val = PyInt_AS_LONG(x);
     2299        if (is_unsigned && unlikely(val < 0)) {
     2300            PyErr_SetString(PyExc_OverflowError,
     2301                            "can't convert negative value to unsigned PY_LONG_LONG");
     2302            return (unsigned PY_LONG_LONG)-1;
     2303        }
     2304        return (unsigned PY_LONG_LONG)val;
     2305    } else
     2306#endif
     2307    if (likely(PyLong_Check(x))) {
     2308        if (is_unsigned) {
     2309            if (unlikely(Py_SIZE(x) < 0)) {
     2310                PyErr_SetString(PyExc_OverflowError,
     2311                                "can't convert negative value to unsigned PY_LONG_LONG");
     2312                return (unsigned PY_LONG_LONG)-1;
     2313            }
     2314            return PyLong_AsUnsignedLongLong(x);
     2315        } else {
     2316            return PyLong_AsLongLong(x);
     2317        }
     2318    } else {
     2319        unsigned PY_LONG_LONG val;
     2320        PyObject *tmp = __Pyx_PyNumber_Int(x);
     2321        if (!tmp) return (unsigned PY_LONG_LONG)-1;
     2322        val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
     2323        Py_DECREF(tmp);
     2324        return val;
     2325    }
     2326}
     2327
     2328static INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
     2329    const long neg_one = (long)-1, const_zero = 0;
     2330    const int is_unsigned = neg_one > const_zero;
     2331#if PY_VERSION_HEX < 0x03000000
     2332    if (likely(PyInt_Check(x))) {
     2333        long val = PyInt_AS_LONG(x);
     2334        if (is_unsigned && unlikely(val < 0)) {
     2335            PyErr_SetString(PyExc_OverflowError,
     2336                            "can't convert negative value to long");
     2337            return (long)-1;
     2338        }
     2339        return (long)val;
     2340    } else
     2341#endif
     2342    if (likely(PyLong_Check(x))) {
     2343        if (is_unsigned) {
     2344            if (unlikely(Py_SIZE(x) < 0)) {
     2345                PyErr_SetString(PyExc_OverflowError,
     2346                                "can't convert negative value to long");
     2347                return (long)-1;
     2348            }
     2349            return PyLong_AsUnsignedLong(x);
     2350        } else {
     2351            return PyLong_AsLong(x);
     2352        }
     2353    } else {
     2354        long val;
     2355        PyObject *tmp = __Pyx_PyNumber_Int(x);
     2356        if (!tmp) return (long)-1;
     2357        val = __Pyx_PyInt_AsLong(tmp);
     2358        Py_DECREF(tmp);
     2359        return val;
     2360    }
     2361}
     2362
     2363static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
     2364    const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
     2365    const int is_unsigned = neg_one > const_zero;
     2366#if PY_VERSION_HEX < 0x03000000
     2367    if (likely(PyInt_Check(x))) {
     2368        long val = PyInt_AS_LONG(x);
     2369        if (is_unsigned && unlikely(val < 0)) {
     2370            PyErr_SetString(PyExc_OverflowError,
     2371                            "can't convert negative value to PY_LONG_LONG");
     2372            return (PY_LONG_LONG)-1;
     2373        }
     2374        return (PY_LONG_LONG)val;
     2375    } else
     2376#endif
     2377    if (likely(PyLong_Check(x))) {
     2378        if (is_unsigned) {
     2379            if (unlikely(Py_SIZE(x) < 0)) {
     2380                PyErr_SetString(PyExc_OverflowError,
     2381                                "can't convert negative value to PY_LONG_LONG");
     2382                return (PY_LONG_LONG)-1;
     2383            }
     2384            return PyLong_AsUnsignedLongLong(x);
     2385        } else {
     2386            return PyLong_AsLongLong(x);
     2387        }
     2388    } else {
     2389        PY_LONG_LONG val;
     2390        PyObject *tmp = __Pyx_PyNumber_Int(x);
     2391        if (!tmp) return (PY_LONG_LONG)-1;
     2392        val = __Pyx_PyInt_AsLongLong(tmp);
     2393        Py_DECREF(tmp);
     2394        return val;
     2395    }
     2396}
     2397
     2398static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
     2399    const signed long neg_one = (signed long)-1, const_zero = 0;
     2400    const int is_unsigned = neg_one > const_zero;
     2401#if PY_VERSION_HEX < 0x03000000
     2402    if (likely(PyInt_Check(x))) {
     2403        long val = PyInt_AS_LONG(x);
     2404        if (is_unsigned && unlikely(val < 0)) {
     2405            PyErr_SetString(PyExc_OverflowError,
     2406                            "can't convert negative value to signed long");
     2407            return (signed long)-1;
     2408        }
     2409        return (signed long)val;
     2410    } else
     2411#endif
     2412    if (likely(PyLong_Check(x))) {
     2413        if (is_unsigned) {
     2414            if (unlikely(Py_SIZE(x) < 0)) {
     2415                PyErr_SetString(PyExc_OverflowError,
     2416                                "can't convert negative value to signed long");
     2417                return (signed long)-1;
     2418            }
     2419            return PyLong_AsUnsignedLong(x);
     2420        } else {
     2421            return PyLong_AsLong(x);
     2422        }
     2423    } else {
     2424        signed long val;
     2425        PyObject *tmp = __Pyx_PyNumber_Int(x);
     2426        if (!tmp) return (signed long)-1;
     2427        val = __Pyx_PyInt_AsSignedLong(tmp);
     2428        Py_DECREF(tmp);
     2429        return val;
     2430    }
     2431}
     2432
     2433static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
     2434    const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
     2435    const int is_unsigned = neg_one > const_zero;
     2436#if PY_VERSION_HEX < 0x03000000
     2437    if (likely(PyInt_Check(x))) {
     2438        long val = PyInt_AS_LONG(x);
     2439        if (is_unsigned && unlikely(val < 0)) {
     2440            PyErr_SetString(PyExc_OverflowError,
     2441                            "can't convert negative value to signed PY_LONG_LONG");
     2442            return (signed PY_LONG_LONG)-1;
     2443        }
     2444        return (signed PY_LONG_LONG)val;
     2445    } else
     2446#endif
     2447    if (likely(PyLong_Check(x))) {
     2448        if (is_unsigned) {
     2449            if (unlikely(Py_SIZE(x) < 0)) {
     2450                PyErr_SetString(PyExc_OverflowError,
     2451                                "can't convert negative value to signed PY_LONG_LONG");
     2452                return (signed PY_LONG_LONG)-1;
     2453            }
     2454            return PyLong_AsUnsignedLongLong(x);
     2455        } else {
     2456            return PyLong_AsLongLong(x);
     2457        }
     2458    } else {
     2459        signed PY_LONG_LONG val;
     2460        PyObject *tmp = __Pyx_PyNumber_Int(x);
     2461        if (!tmp) return (signed PY_LONG_LONG)-1;
     2462        val = __Pyx_PyInt_AsSignedLongLong(tmp);
     2463        Py_DECREF(tmp);
     2464        return val;
     2465    }
     2466}
     2467
    8692468#include "compile.h"
    8702469#include "frameobject.h"
    8712470#include "traceback.h"
    8722471
    873 static void __Pyx_AddTraceback(char *funcname) {
     2472static void __Pyx_AddTraceback(const char *funcname) {
    8742473    PyObject *py_srcfile = 0;
    8752474    PyObject *py_funcname = 0;
    8762475    PyObject *py_globals = 0;
    877     PyObject *empty_tuple = 0;
    878     PyObject *empty_string = 0;
    8792476    PyCodeObject *py_code = 0;
    8802477    PyFrameObject *py_frame = 0;
    881    
     2478
     2479    #if PY_MAJOR_VERSION < 3
    8822480    py_srcfile = PyString_FromString(__pyx_filename);
     2481    #else
     2482    py_srcfile = PyUnicode_FromString(__pyx_filename);
     2483    #endif
    8832484    if (!py_srcfile) goto bad;
    884     py_funcname = PyString_FromString(funcname);
     2485    if (__pyx_clineno) {
     2486        #if PY_MAJOR_VERSION < 3
     2487        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
     2488        #else
     2489        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
     2490        #endif
     2491    }
     2492    else {
     2493        #if PY_MAJOR_VERSION < 3
     2494        py_funcname = PyString_FromString(funcname);
     2495        #else
     2496        py_funcname = PyUnicode_FromString(funcname);
     2497        #endif
     2498    }
    8852499    if (!py_funcname) goto bad;
    8862500    py_globals = PyModule_GetDict(__pyx_m);
    8872501    if (!py_globals) goto bad;
    888     empty_tuple = PyTuple_New(0);
    889     if (!empty_tuple) goto bad;
    890     empty_string = PyString_FromString("");
    891     if (!empty_string) goto bad;
    8922502    py_code = PyCode_New(
    8932503        0,            /*int argcount,*/
     2504        #if PY_MAJOR_VERSION >= 3
     2505        0,            /*int kwonlyargcount,*/
     2506        #endif
    8942507        0,            /*int nlocals,*/
    8952508        0,            /*int stacksize,*/
    8962509        0,            /*int flags,*/
    897         empty_string, /*PyObject *code,*/
    898         empty_tuple,  /*PyObject *consts,*/
    899         empty_tuple,  /*PyObject *names,*/
    900         empty_tuple,  /*PyObject *varnames,*/
    901         empty_tuple,  /*PyObject *freevars,*/
    902         empty_tuple,  /*PyObject *cellvars,*/
     2510        __pyx_empty_bytes, /*PyObject *code,*/
     2511        __pyx_empty_tuple,  /*PyObject *consts,*/
     2512        __pyx_empty_tuple,  /*PyObject *names,*/
     2513        __pyx_empty_tuple,  /*PyObject *varnames,*/
     2514        __pyx_empty_tuple,  /*PyObject *freevars,*/
     2515        __pyx_empty_tuple,  /*PyObject *cellvars,*/
    9032516        py_srcfile,   /*PyObject *filename,*/
    9042517        py_funcname,  /*PyObject *name,*/
    9052518        __pyx_lineno,   /*int firstlineno,*/
    906         empty_string  /*PyObject *lnotab*/
     2519        __pyx_empty_bytes  /*PyObject *lnotab*/
    9072520    );
    9082521    if (!py_code) goto bad;
    9092522    py_frame = PyFrame_New(
    910         PyThreadState_Get(), /*PyThreadState *tstate,*/
     2523        PyThreadState_GET(), /*PyThreadState *tstate,*/
    9112524        py_code,             /*PyCodeObject *code,*/
    9122525        py_globals,          /*PyObject *globals,*/
    9132526        0                    /*PyObject *locals*/
     
    9182531bad:
    9192532    Py_XDECREF(py_srcfile);
    9202533    Py_XDECREF(py_funcname);
    921     Py_XDECREF(empty_tuple);
    922     Py_XDECREF(empty_string);
    9232534    Py_XDECREF(py_code);
    9242535    Py_XDECREF(py_frame);
    9252536}
     2537
     2538static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
     2539    while (t->p) {
     2540        #if PY_MAJOR_VERSION < 3
     2541        if (t->is_unicode) {
     2542            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
     2543        } else if (t->intern) {
     2544            *t->p = PyString_InternFromString(t->s);
     2545        } else {
     2546            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
     2547        }
     2548        #else  /* Python 3+ has unicode identifiers */
     2549        if (t->is_unicode | t->is_str) {
     2550            if (t->intern) {
     2551                *t->p = PyUnicode_InternFromString(t->s);
     2552            } else if (t->encoding) {
     2553                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
     2554            } else {
     2555                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
     2556            }
     2557        } else {
     2558            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
     2559        }
     2560        #endif
     2561        if (!*t->p)
     2562            return -1;
     2563        ++t;
     2564    }
     2565    return 0;
     2566}
     2567
     2568/* Type Conversion Functions */
     2569
     2570static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
     2571   if (x == Py_True) return 1;
     2572   else if ((x == Py_False) | (x == Py_None)) return 0;
     2573   else return PyObject_IsTrue(x);
     2574}
     2575
     2576static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
     2577  PyNumberMethods *m;
     2578  const char *name = NULL;
     2579  PyObject *res = NULL;
     2580#if PY_VERSION_HEX < 0x03000000
     2581  if (PyInt_Check(x) || PyLong_Check(x))
     2582#else
     2583  if (PyLong_Check(x))
     2584#endif
     2585    return Py_INCREF(x), x;
     2586  m = Py_TYPE(x)->tp_as_number;
     2587#if PY_VERSION_HEX < 0x03000000
     2588  if (m && m->nb_int) {
     2589    name = "int";
     2590    res = PyNumber_Int(x);
     2591  }
     2592  else if (m && m->nb_long) {
     2593    name = "long";
     2594    res = PyNumber_Long(x);
     2595  }
     2596#else
     2597  if (m && m->nb_int) {
     2598    name = "int";
     2599    res = PyNumber_Long(x);
     2600  }
     2601#endif
     2602  if (res) {
     2603#if PY_VERSION_HEX < 0x03000000
     2604    if (!PyInt_Check(res) && !PyLong_Check(res)) {
     2605#else
     2606    if (!PyLong_Check(res)) {
     2607#endif
     2608      PyErr_Format(PyExc_TypeError,
     2609                   "__%s__ returned non-%s (type %.200s)",
     2610                   name, name, Py_TYPE(res)->tp_name);
     2611      Py_DECREF(res);
     2612      return NULL;
     2613    }
     2614  }
     2615  else if (!PyErr_Occurred()) {
     2616    PyErr_SetString(PyExc_TypeError,
     2617                    "an integer is required");
     2618  }
     2619  return res;
     2620}
     2621
     2622static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
     2623  Py_ssize_t ival;
     2624  PyObject* x = PyNumber_Index(b);
     2625  if (!x) return -1;
     2626  ival = PyInt_AsSsize_t(x);
     2627  Py_DECREF(x);
     2628  return ival;
     2629}
     2630
     2631static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
     2632#if PY_VERSION_HEX < 0x02050000
     2633   if (ival <= LONG_MAX)
     2634       return PyInt_FromLong((long)ival);
     2635   else {
     2636       unsigned char *bytes = (unsigned char *) &ival;
     2637       int one = 1; int little = (int)*(unsigned char*)&one;
     2638       return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
     2639   }
     2640#else
     2641   return PyInt_FromSize_t(ival);
     2642#endif
     2643}
     2644
     2645static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
     2646   unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
     2647   if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
     2648       return (size_t)-1;
     2649   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
     2650       PyErr_SetString(PyExc_OverflowError,
     2651                       "value too large to convert to size_t");
     2652       return (size_t)-1;
     2653   }
     2654   return (size_t)val;
     2655}
     2656
     2657
     2658#endif /* Py_PYTHON_H */