Ticket #4645: pts-twisted-10.1.0-builtin-epoll.svn.diff

File pts-twisted-10.1.0-builtin-epoll.svn.diff, 89.0 KB (added by Péter Szabó, 8 years ago)

A local copy of pts-twisted-10.1.0-builtin-epoll.svn.diff

  • twisted/internet/epollreactor.py

    pts-twisted-10.1.0-builtin-epoll.svn.diff
    by pts@fazekas.hu at Fri Sep  3 15:08:30 CEST 2010
    
    This patch makes Twisted able to use the built-in select.epoll class
    available in Python 2.6 and later, so Twisted gets fast polling via epoll
    even on systems where C extensions (like Twisted's _epoll.c) cannot be
    compiled.
    
    This patch achieves its goal by adding methods to epoll class defined
    _epoll.pyx which are compatible with the methods of select.epoll, then
    making epollreactor.py use these methods, and finally making epollreactor.py
    import select.epoll if twisted.python._epoll is not available.
    
     
    1111    epollreactor.install()
    1212"""
    1313
    14 import sys, errno
     14import sys, errno, time
    1515
    1616from zope.interface import implements
    1717
    1818from twisted.internet.interfaces import IReactorFDSet
    1919
    20 from twisted.python import _epoll
     20try:
     21  from twisted.python import _epoll
     22except ImportError:
     23  from select import epoll  # Python 2.6 and later.
     24  del epoll
     25  import select as _epoll
    2126from twisted.python import log
    2227from twisted.internet import posixbase, error
    2328from twisted.internet.main import CONNECTION_DONE, CONNECTION_LOST
    2429
    2530
    26 _POLL_DISCONNECTED = (_epoll.HUP | _epoll.ERR)
     31_POLL_DISCONNECTED = (_epoll.EPOLLHUP | _epoll.EPOLLERR)
    2732
    2833class EPollReactor(posixbase.PosixReactorBase):
    2934    """
     
    7580        """
    7681        fd = xer.fileno()
    7782        if fd not in primary:
    78             cmd = _epoll.CTL_ADD
    7983            flags = event
    80             if fd in other:
    81                 flags |= antievent
    82                 cmd = _epoll.CTL_MOD
    8384            # epoll_ctl can raise all kinds of IOErrors, and every one
    8485            # indicates a bug either in the reactor or application-code.
    8586            # Let them all through so someone sees a traceback and fixes
    8687            # something.  We'll do the same thing for every other call to
    8788            # this method in this file.
    88             self._poller._control(cmd, fd, flags)
     89            if fd in other:
     90                flags |= antievent
     91                self._poller.modify(fd, flags)
     92            else:
     93                self._poller.register(fd, flags)
    8994
    9095            # Update our own tracking state *only* after the epoll call has
    9196            # succeeded.  Otherwise we may get out of sync.
     
    97102        """
    98103        Add a FileDescriptor for notification of data available to read.
    99104        """
    100         self._add(reader, self._reads, self._writes, self._selectables, _epoll.IN, _epoll.OUT)
     105        self._add(reader, self._reads, self._writes, self._selectables, _epoll.EPOLLIN, _epoll.EPOLLOUT)
    101106
    102107
    103108    def addWriter(self, writer):
    104109        """
    105110        Add a FileDescriptor for notification of data available to write.
    106111        """
    107         self._add(writer, self._writes, self._reads, self._selectables, _epoll.OUT, _epoll.IN)
     112        self._add(writer, self._writes, self._reads, self._selectables, _epoll.EPOLLOUT, _epoll.EPOLLIN)
    108113
    109114
    110115    def _remove(self, xer, primary, other, selectables, event, antievent):
     
    122127            else:
    123128                return
    124129        if fd in primary:
    125             cmd = _epoll.CTL_DEL
    126             flags = event
    127130            if fd in other:
    128131                flags = antievent
    129                 cmd = _epoll.CTL_MOD
     132                # See comment above modify call in _add.
     133                self._poller.modify(fd, flags)
    130134            else:
    131135                del selectables[fd]
     136                # See comment above _control call in _add.
     137                self._poller.unregister(fd)
    132138            del primary[fd]
    133             # See comment above _control call in _add.
    134             self._poller._control(cmd, fd, flags)
    135139
    136140
    137141    def removeReader(self, reader):
    138142        """
    139143        Remove a Selectable for notification of data available to read.
    140144        """
    141         self._remove(reader, self._reads, self._writes, self._selectables, _epoll.IN, _epoll.OUT)
     145        self._remove(reader, self._reads, self._writes, self._selectables, _epoll.EPOLLIN, _epoll.EPOLLOUT)
    142146
    143147
    144148    def removeWriter(self, writer):
    145149        """
    146150        Remove a Selectable for notification of data available to write.
    147151        """
    148         self._remove(writer, self._writes, self._reads, self._selectables, _epoll.OUT, _epoll.IN)
     152        self._remove(writer, self._writes, self._reads, self._selectables, _epoll.EPOLLOUT, _epoll.EPOLLIN)
    149153
    150154    def removeAll(self):
    151155        """
     
    169173        Poll the poller for new events.
    170174        """
    171175        if timeout is None:
    172             timeout = 1
    173         timeout = int(timeout * 1000) # convert seconds to milliseconds
     176            timeout = -1  # Wait indefinitely.
    174177
    175178        try:
    176             # Limit the number of events to the number of io objects we're
    177             # currently tracking (because that's maybe a good heuristic) and
    178             # the amount of time we block to the value specified by our
    179             # caller.
    180             l = self._poller.wait(len(self._selectables), timeout)
     179            if self._selectables:
     180                # Limit the number of events to the number of io objects
     181                # we're currently tracking (because that's maybe a good
     182                # heuristic) and the amount of time we block to the value
     183                # specified by our caller.
     184                l = self._poller.poll(timeout, len(self._selectables))
     185            else:
     186                # select.epoll.poll doesn't let us wait for no filehandle,
     187                # so we just sleep here.
     188                time.sleep(timeout)
    181189        except IOError, err:
    182190            if err.errno == errno.EINTR:
    183191                return
     
    205213        """
    206214        why = None
    207215        inRead = False
    208         if event & _POLL_DISCONNECTED and not (event & _epoll.IN):
     216        if event & _POLL_DISCONNECTED and not (event & _epoll.EPOLLIN):
    209217            if fd in self._reads:
    210218                inRead = True
    211219                why = CONNECTION_DONE
     
    213221                why = CONNECTION_LOST
    214222        else:
    215223            try:
    216                 if event & _epoll.IN:
     224                if event & _epoll.EPOLLIN:
    217225                    why = selectable.doRead()
    218226                    inRead = True
    219                 if not why and event & _epoll.OUT:
     227                if not why and event & _epoll.EPOLLOUT:
    220228                    why = selectable.doWrite()
    221229                    inRead = False
    222230                if selectable.fileno() != fd:
  • twisted/python/_epoll.pyx

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

     
    1 /* Generated by Pyrex 0.9.4.1 on Sun Oct 15 15:04:09 2006 */
     1/* Generated by Pyrex 0.9.9 on Fri Sep  3 15:02:54 2010 */
    22
    33#define PY_SSIZE_T_CLEAN
    44#include "Python.h"
     
    1111  #define PY_SSIZE_T_MAX INT_MAX
    1212  #define PY_SSIZE_T_MIN INT_MIN
    1313  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
    14   #define PyInt_AsSsize_t(o)   PyInt_AsLong(o)
     14  #define PyInt_AsSsize_t(o)    PyInt_AsLong(o)
    1515#endif
     16#if !defined(WIN32) && !defined(MS_WINDOWS)
     17  #ifndef __stdcall
     18    #define __stdcall
     19  #endif
     20  #ifndef __cdecl
     21    #define __cdecl
     22  #endif
     23#endif
    1624#ifdef __cplusplus
    1725#define __PYX_EXTERN_C extern "C"
    1826#else
    1927#define __PYX_EXTERN_C extern
    2028#endif
    21 __PYX_EXTERN_C double pow(double, double);
     29#include <math.h>
    2230#include "stdio.h"
    2331#include "errno.h"
    2432#include "string.h"
     
    2634#include "sys/epoll.h"
    2735
    2836
    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*/
     37typedef struct {PyObject **p; int i; char *s; long n;} __Pyx_StringTabEntry; /*proto*/
    5438
    5539static PyObject *__pyx_m;
    5640static PyObject *__pyx_b;
     
    6044
    6145static char __pyx_mdoc[] = "\nInterface to epoll I/O event notification facility.\n";
    6246
    63 /* Declarations from _epoll */
     47static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
    6448
     49static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
    6550
    66 struct __pyx_obj_6_epoll_epoll {
     51static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
     52
     53static void __Pyx_AddTraceback(char *funcname); /*proto*/
     54
     55/* Declarations from twisted.python._epoll */
     56
     57
     58/* Declarations from implementation of twisted.python._epoll */
     59
     60struct __pyx_obj_7twisted_6python_6_epoll_epoll {
    6761  PyObject_HEAD
    6862  int fd;
    6963  int initialized;
    7064};
    7165
    72 static PyTypeObject *__pyx_ptype_6_epoll_epoll = 0;
    7366
    74 /* Implementation of _epoll */
     67static PyTypeObject *__pyx_ptype_7twisted_6python_6_epoll_epoll = 0;
     68static PyObject *__pyx_f_7twisted_6python_6_epoll_call_epoll_wait(int,unsigned int,int); /*proto*/
    7569
     70static char __pyx_k1[] = "append";
     71static char __pyx_k2[] = "CTL_ADD";
     72static char __pyx_k3[] = "CTL_DEL";
     73static char __pyx_k4[] = "CTL_MOD";
     74static char __pyx_k5[] = "IN";
     75static char __pyx_k6[] = "EPOLLIN";
     76static char __pyx_k7[] = "OUT";
     77static char __pyx_k8[] = "EPOLLOUT";
     78static char __pyx_k9[] = "PRI";
     79static char __pyx_k10[] = "EPOLLPRI";
     80static char __pyx_k11[] = "ERR";
     81static char __pyx_k12[] = "EPOLLERR";
     82static char __pyx_k13[] = "HUP";
     83static char __pyx_k14[] = "EPOLLHUP";
     84static char __pyx_k15[] = "ET";
     85static char __pyx_k16[] = "EPOLLET";
     86static char __pyx_k17[] = "RDNORM";
     87static char __pyx_k18[] = "EPOLLRDNORM";
     88static char __pyx_k19[] = "RDBAND";
     89static char __pyx_k20[] = "EPOLLRDBAND";
     90static char __pyx_k21[] = "WRNORM";
     91static char __pyx_k22[] = "EPOLLWRNORM";
     92static char __pyx_k23[] = "WRBAND";
     93static char __pyx_k24[] = "EPOLLWRBAND";
     94static char __pyx_k25[] = "MSG";
     95static char __pyx_k26[] = "EPOLLMSG";
     96
    7697static PyObject *__pyx_n_CTL_ADD;
    7798static PyObject *__pyx_n_CTL_DEL;
    7899static PyObject *__pyx_n_CTL_MOD;
     100static PyObject *__pyx_n_EPOLLERR;
     101static PyObject *__pyx_n_EPOLLET;
     102static PyObject *__pyx_n_EPOLLHUP;
     103static PyObject *__pyx_n_EPOLLIN;
     104static PyObject *__pyx_n_EPOLLMSG;
     105static PyObject *__pyx_n_EPOLLOUT;
     106static PyObject *__pyx_n_EPOLLPRI;
     107static PyObject *__pyx_n_EPOLLRDBAND;
     108static PyObject *__pyx_n_EPOLLRDNORM;
     109static PyObject *__pyx_n_EPOLLWRBAND;
     110static PyObject *__pyx_n_EPOLLWRNORM;
     111static PyObject *__pyx_n_ERR;
     112static PyObject *__pyx_n_ET;
     113static PyObject *__pyx_n_HUP;
    79114static PyObject *__pyx_n_IN;
     115static PyObject *__pyx_n_MSG;
    80116static PyObject *__pyx_n_OUT;
    81117static PyObject *__pyx_n_PRI;
    82 static PyObject *__pyx_n_ERR;
    83 static PyObject *__pyx_n_HUP;
    84 static PyObject *__pyx_n_ET;
     118static PyObject *__pyx_n_RDBAND;
    85119static PyObject *__pyx_n_RDNORM;
    86 static PyObject *__pyx_n_RDBAND;
     120static PyObject *__pyx_n_WRBAND;
    87121static PyObject *__pyx_n_WRNORM;
    88 static PyObject *__pyx_n_WRBAND;
    89 static PyObject *__pyx_n_MSG;
     122static PyObject *__pyx_n_append;
    90123
    91 static PyObject *__pyx_n_IOError;
    92124
    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) {
     125static __Pyx_StringTabEntry __pyx_string_tab[] = {
     126  {&__pyx_n_CTL_ADD, 1, __pyx_k2, sizeof(__pyx_k2)},
     127  {&__pyx_n_CTL_DEL, 1, __pyx_k3, sizeof(__pyx_k3)},
     128  {&__pyx_n_CTL_MOD, 1, __pyx_k4, sizeof(__pyx_k4)},
     129  {&__pyx_n_EPOLLERR, 1, __pyx_k12, sizeof(__pyx_k12)},
     130  {&__pyx_n_EPOLLET, 1, __pyx_k16, sizeof(__pyx_k16)},
     131  {&__pyx_n_EPOLLHUP, 1, __pyx_k14, sizeof(__pyx_k14)},
     132  {&__pyx_n_EPOLLIN, 1, __pyx_k6, sizeof(__pyx_k6)},
     133  {&__pyx_n_EPOLLMSG, 1, __pyx_k26, sizeof(__pyx_k26)},
     134  {&__pyx_n_EPOLLOUT, 1, __pyx_k8, sizeof(__pyx_k8)},
     135  {&__pyx_n_EPOLLPRI, 1, __pyx_k10, sizeof(__pyx_k10)},
     136  {&__pyx_n_EPOLLRDBAND, 1, __pyx_k20, sizeof(__pyx_k20)},
     137  {&__pyx_n_EPOLLRDNORM, 1, __pyx_k18, sizeof(__pyx_k18)},
     138  {&__pyx_n_EPOLLWRBAND, 1, __pyx_k24, sizeof(__pyx_k24)},
     139  {&__pyx_n_EPOLLWRNORM, 1, __pyx_k22, sizeof(__pyx_k22)},
     140  {&__pyx_n_ERR, 1, __pyx_k11, sizeof(__pyx_k11)},
     141  {&__pyx_n_ET, 1, __pyx_k15, sizeof(__pyx_k15)},
     142  {&__pyx_n_HUP, 1, __pyx_k13, sizeof(__pyx_k13)},
     143  {&__pyx_n_IN, 1, __pyx_k5, sizeof(__pyx_k5)},
     144  {&__pyx_n_MSG, 1, __pyx_k25, sizeof(__pyx_k25)},
     145  {&__pyx_n_OUT, 1, __pyx_k7, sizeof(__pyx_k7)},
     146  {&__pyx_n_PRI, 1, __pyx_k9, sizeof(__pyx_k9)},
     147  {&__pyx_n_RDBAND, 1, __pyx_k19, sizeof(__pyx_k19)},
     148  {&__pyx_n_RDNORM, 1, __pyx_k17, sizeof(__pyx_k17)},
     149  {&__pyx_n_WRBAND, 1, __pyx_k23, sizeof(__pyx_k23)},
     150  {&__pyx_n_WRNORM, 1, __pyx_k21, sizeof(__pyx_k21)},
     151  {&__pyx_n_append, 1, __pyx_k1, sizeof(__pyx_k1)},
     152  {0, 0, 0, 0}
     153};
     154
     155static int __pyx_d1;
     156static float __pyx_d2;
     157static unsigned int __pyx_d3;
     158
     159
     160/* Implementation of twisted.python._epoll */
     161
     162static PyObject *__pyx_f_7twisted_6python_6_epoll_call_epoll_wait(int __pyx_v_fd,unsigned int __pyx_v_maxevents,int __pyx_v_timeout_msec) {
     163  struct epoll_event *__pyx_v_events;
     164  int __pyx_v_result;
     165  int __pyx_v_nbytes;
     166  PyThreadState *__pyx_v__save;
     167  PyObject *__pyx_v_results;
     168  PyObject *__pyx_v_i;
     169  PyObject *__pyx_r;
     170  int __pyx_1;
     171  PyObject *__pyx_2 = 0;
     172  PyObject *__pyx_3 = 0;
     173  PyObject *__pyx_4 = 0;
     174  long __pyx_5;
     175  Py_ssize_t __pyx_6;
     176  PyObject *__pyx_7 = 0;
     177  __pyx_v_results = Py_None; Py_INCREF(Py_None);
     178  __pyx_v_i = Py_None; Py_INCREF(Py_None);
     179
     180  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":89 */
     181  __pyx_v_nbytes = ((sizeof(struct epoll_event)) * __pyx_v_maxevents);
     182
     183  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":90 */
     184  __pyx_v_events = ((struct epoll_event *)malloc(__pyx_v_nbytes));
     185
     186  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":91 */
     187  memset(__pyx_v_events,0,__pyx_v_nbytes);
     188
     189  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":92 */
     190  /*try:*/ {
     191
     192    /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":93 */
     193    __pyx_v__save = PyEval_SaveThread();
     194
     195    /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":94 */
     196    __pyx_v_result = epoll_wait(__pyx_v_fd,__pyx_v_events,__pyx_v_maxevents,__pyx_v_timeout_msec);
     197
     198    /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":95 */
     199    PyEval_RestoreThread(__pyx_v__save);
     200
     201    /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":97 */
     202    __pyx_1 = (__pyx_v_result == (-1));
     203    if (__pyx_1) {
     204      __pyx_2 = PyInt_FromLong(errno); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; goto __pyx_L3;}
     205      __pyx_3 = PyString_FromString(strerror(errno)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; goto __pyx_L3;}
     206      __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; goto __pyx_L3;}
     207      PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
     208      PyTuple_SET_ITEM(__pyx_4, 1, __pyx_3);
     209      __pyx_2 = 0;
     210      __pyx_3 = 0;
     211      __pyx_2 = PyObject_CallObject(PyExc_IOError, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; goto __pyx_L3;}
     212      Py_DECREF(__pyx_4); __pyx_4 = 0;
     213      __Pyx_Raise(__pyx_2, 0, 0);
     214      Py_DECREF(__pyx_2); __pyx_2 = 0;
     215      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; goto __pyx_L3;}
     216      goto __pyx_L5;
     217    }
     218    __pyx_L5:;
     219
     220    /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":99 */
     221    __pyx_3 = PyList_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; goto __pyx_L3;}
     222    Py_DECREF(__pyx_v_results);
     223    __pyx_v_results = __pyx_3;
     224    __pyx_3 = 0;
     225
     226    /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":100 */
     227    for (__pyx_5 = 0; __pyx_5 < __pyx_v_result; ++__pyx_5) {
     228      __pyx_4 = PyInt_FromLong(__pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; goto __pyx_L3;}
     229      Py_DECREF(__pyx_v_i);
     230      __pyx_v_i = __pyx_4;
     231      __pyx_4 = 0;
     232      __pyx_2 = PyObject_GetAttr(__pyx_v_results, __pyx_n_append); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; goto __pyx_L3;}
     233      __pyx_6 = PyInt_AsSsize_t(__pyx_v_i); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; goto __pyx_L3;}
     234      __pyx_3 = PyInt_FromLong((__pyx_v_events[__pyx_6]).data.fd); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; goto __pyx_L3;}
     235      __pyx_6 = PyInt_AsSsize_t(__pyx_v_i); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; goto __pyx_L3;}
     236      __pyx_4 = PyInt_FromLong(((int)(__pyx_v_events[__pyx_6]).events)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; goto __pyx_L3;}
     237      __pyx_7 = PyTuple_New(2); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; goto __pyx_L3;}
     238      PyTuple_SET_ITEM(__pyx_7, 0, __pyx_3);
     239      PyTuple_SET_ITEM(__pyx_7, 1, __pyx_4);
     240      __pyx_3 = 0;
     241      __pyx_4 = 0;
     242      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; goto __pyx_L3;}
     243      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_7);
     244      __pyx_7 = 0;
     245      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; goto __pyx_L3;}
     246      Py_DECREF(__pyx_2); __pyx_2 = 0;
     247      Py_DECREF(__pyx_3); __pyx_3 = 0;
     248      Py_DECREF(__pyx_4); __pyx_4 = 0;
     249    }
     250
     251    /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":102 */
     252    Py_INCREF(__pyx_v_results);
     253    __pyx_r = __pyx_v_results;
     254    goto __pyx_L2;
     255  }
     256  /*finally:*/ {
     257    int __pyx_why;
     258    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
     259    int __pyx_exc_lineno;
     260    __pyx_why = 0; goto __pyx_L4;
     261    __pyx_L2: __pyx_why = 3; goto __pyx_L4;
     262    __pyx_L3: {
     263      __pyx_why = 4;
     264      Py_XDECREF(__pyx_7); __pyx_7 = 0;
     265      Py_XDECREF(__pyx_2); __pyx_2 = 0;
     266      Py_XDECREF(__pyx_3); __pyx_3 = 0;
     267      Py_XDECREF(__pyx_4); __pyx_4 = 0;
     268      PyErr_Fetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
     269      __pyx_exc_lineno = __pyx_lineno;
     270      goto __pyx_L4;
     271    }
     272    __pyx_L4:;
     273    free(__pyx_v_events);
     274    switch (__pyx_why) {
     275      case 3: goto __pyx_L0;
     276      case 4: {
     277        PyErr_Restore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
     278        __pyx_lineno = __pyx_exc_lineno;
     279        __pyx_exc_type = 0;
     280        __pyx_exc_value = 0;
     281        __pyx_exc_tb = 0;
     282        goto __pyx_L1;
     283      }
     284    }
     285  }
     286
     287  __pyx_r = Py_None; Py_INCREF(Py_None);
     288  goto __pyx_L0;
     289  __pyx_L1:;
     290  Py_XDECREF(__pyx_2);
     291  Py_XDECREF(__pyx_3);
     292  Py_XDECREF(__pyx_4);
     293  Py_XDECREF(__pyx_7);
     294  __Pyx_AddTraceback("twisted.python._epoll.call_epoll_wait");
     295  __pyx_r = 0;
     296  __pyx_L0:;
     297  Py_DECREF(__pyx_v_results);
     298  Py_DECREF(__pyx_v_i);
     299  return __pyx_r;
     300}
     301
     302static int __pyx_f_7twisted_6python_6_epoll_5epoll___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
     303static int __pyx_f_7twisted_6python_6_epoll_5epoll___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
    95304  int __pyx_v_size;
    96305  int __pyx_r;
    97306  int __pyx_1;
    98307  PyObject *__pyx_2 = 0;
    99308  PyObject *__pyx_3 = 0;
    100309  PyObject *__pyx_4 = 0;
    101   PyObject *__pyx_5 = 0;
    102310  static char *__pyx_argnames[] = {"size",0};
    103   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "i", __pyx_argnames, &__pyx_v_size)) return -1;
     311  __pyx_v_size = __pyx_d1;
     312  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|i", __pyx_argnames, &__pyx_v_size)) return -1;
    104313  Py_INCREF(__pyx_v_self);
    105314
    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);
     315  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":118 */
     316  ((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd = epoll_create(__pyx_v_size);
    108317
    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));
     318  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":119 */
     319  __pyx_1 = (((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd == (-1));
    111320  if (__pyx_1) {
    112 
    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);
     321    __pyx_2 = PyInt_FromLong(errno); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L1;}
     322    __pyx_3 = PyString_FromString(strerror(errno)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L1;}
     323    __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L1;}
     324    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
     325    PyTuple_SET_ITEM(__pyx_4, 1, __pyx_3);
     326    __pyx_2 = 0;
    120327    __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;}
     328    __pyx_2 = PyObject_CallObject(PyExc_IOError, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L1;}
     329    Py_DECREF(__pyx_4); __pyx_4 = 0;
     330    __Pyx_Raise(__pyx_2, 0, 0);
    123331    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;}
     332    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L1;}
    128333    goto __pyx_L2;
    129334  }
    130335  __pyx_L2:;
    131336
    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;
     337  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":121 */
     338  ((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->initialized = 1;
    134339
    135340  __pyx_r = 0;
    136341  goto __pyx_L0;
     
    138343  Py_XDECREF(__pyx_2);
    139344  Py_XDECREF(__pyx_3);
    140345  Py_XDECREF(__pyx_4);
    141   Py_XDECREF(__pyx_5);
    142   __Pyx_AddTraceback("_epoll.epoll.__init__");
     346  __Pyx_AddTraceback("twisted.python._epoll.epoll.__init__");
    143347  __pyx_r = -1;
    144348  __pyx_L0:;
    145349  Py_DECREF(__pyx_v_self);
    146350  return __pyx_r;
    147351}
    148352
    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) {
     353static void __pyx_f_7twisted_6python_6_epoll_5epoll___dealloc__(PyObject *__pyx_v_self); /*proto*/
     354static void __pyx_f_7twisted_6python_6_epoll_5epoll___dealloc__(PyObject *__pyx_v_self) {
    151355  int __pyx_1;
    152356  Py_INCREF(__pyx_v_self);
    153 
    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;
     357  __pyx_1 = ((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->initialized;
    156358  if (__pyx_1) {
    157359
    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);
     360    /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":125 */
     361    close(((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd);
    160362
    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;
     363    /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":126 */
     364    ((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->initialized = 0;
    163365    goto __pyx_L2;
    164366  }
    165367  __pyx_L2:;
    166368
    167   goto __pyx_L0;
    168   __pyx_L1:;
    169   __Pyx_AddTraceback("_epoll.epoll.__dealloc__");
    170   __pyx_L0:;
    171369  Py_DECREF(__pyx_v_self);
    172370}
    173371
    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) {
     372static PyObject *__pyx_f_7twisted_6python_6_epoll_5epoll_close(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
     373static char __pyx_doc_7twisted_6python_6_epoll_5epoll_close[] = "\n        Close the epoll file descriptor.\n        ";
     374static PyObject *__pyx_f_7twisted_6python_6_epoll_5epoll_close(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
    177375  PyObject *__pyx_r;
    178376  int __pyx_1;
    179377  PyObject *__pyx_2 = 0;
    180378  PyObject *__pyx_3 = 0;
    181379  PyObject *__pyx_4 = 0;
    182   PyObject *__pyx_5 = 0;
    183380  static char *__pyx_argnames[] = {0};
    184381  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
    185382  Py_INCREF(__pyx_v_self);
    186 
    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;
     383  __pyx_1 = ((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->initialized;
    189384  if (__pyx_1) {
    190385
    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));
     386    /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":133 */
     387    __pyx_1 = (close(((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd) == (-1));
    193388    if (__pyx_1) {
    194 
    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);
     389      __pyx_2 = PyInt_FromLong(errno); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; goto __pyx_L1;}
     390      __pyx_3 = PyString_FromString(strerror(errno)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; goto __pyx_L1;}
     391      __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; goto __pyx_L1;}
     392      PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
     393      PyTuple_SET_ITEM(__pyx_4, 1, __pyx_3);
     394      __pyx_2 = 0;
    202395      __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;}
     396      __pyx_2 = PyObject_CallObject(PyExc_IOError, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; goto __pyx_L1;}
     397      Py_DECREF(__pyx_4); __pyx_4 = 0;
     398      __Pyx_Raise(__pyx_2, 0, 0);
    205399      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;}
     400      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; goto __pyx_L1;}
    210401      goto __pyx_L3;
    211402    }
    212403    __pyx_L3:;
    213404
    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;
     405    /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":135 */
     406    ((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->initialized = 0;
    216407    goto __pyx_L2;
    217408  }
    218409  __pyx_L2:;
     
    223414  Py_XDECREF(__pyx_2);
    224415  Py_XDECREF(__pyx_3);
    225416  Py_XDECREF(__pyx_4);
    226   Py_XDECREF(__pyx_5);
    227   __Pyx_AddTraceback("_epoll.epoll.close");
     417  __Pyx_AddTraceback("twisted.python._epoll.epoll.close");
    228418  __pyx_r = 0;
    229419  __pyx_L0:;
    230420  Py_DECREF(__pyx_v_self);
    231421  return __pyx_r;
    232422}
    233423
    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) {
     424static PyObject *__pyx_f_7twisted_6python_6_epoll_5epoll_fileno(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
     425static char __pyx_doc_7twisted_6python_6_epoll_5epoll_fileno[] = "\n        Return the epoll file descriptor number.\n        ";
     426static PyObject *__pyx_f_7twisted_6python_6_epoll_5epoll_fileno(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
    237427  PyObject *__pyx_r;
    238428  PyObject *__pyx_1 = 0;
    239429  static char *__pyx_argnames[] = {0};
    240430  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
    241431  Py_INCREF(__pyx_v_self);
    242 
    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;}
     432  __pyx_1 = PyInt_FromLong(((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; goto __pyx_L1;}
    245433  __pyx_r = __pyx_1;
    246434  __pyx_1 = 0;
    247435  goto __pyx_L0;
     
    250438  goto __pyx_L0;
    251439  __pyx_L1:;
    252440  Py_XDECREF(__pyx_1);
    253   __Pyx_AddTraceback("_epoll.epoll.fileno");
     441  __Pyx_AddTraceback("twisted.python._epoll.epoll.fileno");
    254442  __pyx_r = 0;
    255443  __pyx_L0:;
    256444  Py_DECREF(__pyx_v_self);
    257445  return __pyx_r;
    258446}
    259447
    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) {
    263   int __pyx_v_op;
     448static PyObject *__pyx_f_7twisted_6python_6_epoll_5epoll_register(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
     449static char __pyx_doc_7twisted_6python_6_epoll_5epoll_register[] = "\n        Add (register) a file descriptor to be monitored by self.\n\n        This method is compatible with select.epoll.register in Python 2.6.\n\n        Wrap epoll_ctl(2).\n\n        @type fd: C{int}\n        @param fd: File descriptor to modify\n\n        @type events: C{int}\n        @param events: A bit set of IN, OUT, PRI, ERR, HUP, and ET.\n\n        @raise IOError: Raised if the underlying epoll_ctl() call fails.\n        ";
     450static PyObject *__pyx_f_7twisted_6python_6_epoll_5epoll_register(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
    264451  int __pyx_v_fd;
    265452  int __pyx_v_events;
    266453  int __pyx_v_result;
    267454  struct epoll_event __pyx_v_evt;
    268455  PyObject *__pyx_r;
    269   int __pyx_1;
    270   PyObject *__pyx_2 = 0;
     456  PyObject *__pyx_1 = 0;
     457  int __pyx_2;
    271458  PyObject *__pyx_3 = 0;
    272459  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;
     460  static char *__pyx_argnames[] = {"fd","events",0};
     461  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "ii", __pyx_argnames, &__pyx_v_fd, &__pyx_v_events)) return 0;
    276462  Py_INCREF(__pyx_v_self);
    277463
    278   /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":121 */
     464  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":161 */
    279465  __pyx_v_evt.events = __pyx_v_events;
    280466
    281   /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":122 */
     467  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":162 */
    282468  __pyx_v_evt.data.fd = __pyx_v_fd;
    283469
    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));
     470  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":163 */
     471  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_CTL_ADD); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; goto __pyx_L1;}
     472  __pyx_2 = PyInt_AsLong(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; goto __pyx_L1;}
     473  Py_DECREF(__pyx_1); __pyx_1 = 0;
     474  __pyx_v_result = epoll_ctl(((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd,__pyx_2,__pyx_v_fd,(&__pyx_v_evt));
    286475
    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) {
    290 
    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);
     476  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":164 */
     477  __pyx_2 = (__pyx_v_result == (-1));
     478  if (__pyx_2) {
     479    __pyx_1 = PyInt_FromLong(errno); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; goto __pyx_L1;}
     480    __pyx_3 = PyString_FromString(strerror(errno)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; goto __pyx_L1;}
     481    __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; goto __pyx_L1;}
     482    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_1);
     483    PyTuple_SET_ITEM(__pyx_4, 1, __pyx_3);
     484    __pyx_1 = 0;
    298485    __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;}
     486    __pyx_1 = PyObject_CallObject(PyExc_IOError, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; goto __pyx_L1;}
     487    Py_DECREF(__pyx_4); __pyx_4 = 0;
     488    __Pyx_Raise(__pyx_1, 0, 0);
     489    Py_DECREF(__pyx_1); __pyx_1 = 0;
     490    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; goto __pyx_L1;}
    306491    goto __pyx_L2;
    307492  }
    308493  __pyx_L2:;
     
    310495  __pyx_r = Py_None; Py_INCREF(Py_None);
    311496  goto __pyx_L0;
    312497  __pyx_L1:;
    313   Py_XDECREF(__pyx_2);
     498  Py_XDECREF(__pyx_1);
    314499  Py_XDECREF(__pyx_3);
    315500  Py_XDECREF(__pyx_4);
    316   Py_XDECREF(__pyx_5);
    317   __Pyx_AddTraceback("_epoll.epoll._control");
     501  __Pyx_AddTraceback("twisted.python._epoll.epoll.register");
    318502  __pyx_r = 0;
    319503  __pyx_L0:;
    320504  Py_DECREF(__pyx_v_self);
    321505  return __pyx_r;
    322506}
    323507
    324 static PyObject *__pyx_n_append;
    325 
    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) {
    329   unsigned int __pyx_v_maxevents;
    330   int __pyx_v_timeout;
    331   struct epoll_event (*__pyx_v_events);
     508static PyObject *__pyx_f_7twisted_6python_6_epoll_5epoll_unregister(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
     509static char __pyx_doc_7twisted_6python_6_epoll_5epoll_unregister[] = "\n        Remove (unregister) a file descriptor monitored by self.\n\n        This method is compatible with select.epoll.unregister in Python 2.6.\n\n        Wrap epoll_ctl(2).\n\n        @type fd: C{int}\n        @param fd: File descriptor to modify\n\n        @raise IOError: Raised if the underlying epoll_ctl() call fails.\n        ";
     510static PyObject *__pyx_f_7twisted_6python_6_epoll_5epoll_unregister(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
     511  int __pyx_v_fd;
    332512  int __pyx_v_result;
    333   int __pyx_v_nbytes;
    334   int __pyx_v_fd;
    335   PyThreadState (*__pyx_v__save);
    336   PyObject *__pyx_v_results;
    337   PyObject *__pyx_v_i;
     513  struct epoll_event __pyx_v_evt;
    338514  PyObject *__pyx_r;
    339   int __pyx_1;
    340   PyObject *__pyx_2 = 0;
     515  PyObject *__pyx_1 = 0;
     516  int __pyx_2;
    341517  PyObject *__pyx_3 = 0;
    342518  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;
     519  static char *__pyx_argnames[] = {"fd",0};
     520  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "i", __pyx_argnames, &__pyx_v_fd)) return 0;
    348521  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);
    351522
    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);
     523  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":183 */
     524  __pyx_v_evt.data.fd = __pyx_v_fd;
    354525
    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));
     526  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":184 */
     527  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_CTL_DEL); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; goto __pyx_L1;}
     528  __pyx_2 = PyInt_AsLong(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; goto __pyx_L1;}
     529  Py_DECREF(__pyx_1); __pyx_1 = 0;
     530  __pyx_v_result = epoll_ctl(((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd,__pyx_2,__pyx_v_fd,(&__pyx_v_evt));
    357531
    358   /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":148 */
    359   memset(__pyx_v_events,0,__pyx_v_nbytes);
     532  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":185 */
     533  __pyx_2 = (__pyx_v_result == (-1));
     534  if (__pyx_2) {
     535    __pyx_1 = PyInt_FromLong(errno); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; goto __pyx_L1;}
     536    __pyx_3 = PyString_FromString(strerror(errno)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; goto __pyx_L1;}
     537    __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; goto __pyx_L1;}
     538    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_1);
     539    PyTuple_SET_ITEM(__pyx_4, 1, __pyx_3);
     540    __pyx_1 = 0;
     541    __pyx_3 = 0;
     542    __pyx_1 = PyObject_CallObject(PyExc_IOError, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; goto __pyx_L1;}
     543    Py_DECREF(__pyx_4); __pyx_4 = 0;
     544    __Pyx_Raise(__pyx_1, 0, 0);
     545    Py_DECREF(__pyx_1); __pyx_1 = 0;
     546    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; goto __pyx_L1;}
     547    goto __pyx_L2;
     548  }
     549  __pyx_L2:;
    360550
    361   /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":149 */
    362   /*try:*/ {
     551  __pyx_r = Py_None; Py_INCREF(Py_None);
     552  goto __pyx_L0;
     553  __pyx_L1:;
     554  Py_XDECREF(__pyx_1);
     555  Py_XDECREF(__pyx_3);
     556  Py_XDECREF(__pyx_4);
     557  __Pyx_AddTraceback("twisted.python._epoll.epoll.unregister");
     558  __pyx_r = 0;
     559  __pyx_L0:;
     560  Py_DECREF(__pyx_v_self);
     561  return __pyx_r;
     562}
    363563
    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;
     564static PyObject *__pyx_f_7twisted_6python_6_epoll_5epoll_modify(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
     565static char __pyx_doc_7twisted_6python_6_epoll_5epoll_modify[] = "\n        Modify the modified state of a file descriptor monitored by self.\n\n        This method is compatible with select.epoll.modify in Python 2.6.\n\n        Wrap epoll_ctl(2).\n\n        @type fd: C{int}\n        @param fd: File descriptor to modify\n\n        @type events: C{int}\n        @param events: A bit set of IN, OUT, PRI, ERR, HUP, and ET.\n\n        @raise IOError: Raised if the underlying epoll_ctl() call fails.\n        ";
     566static PyObject *__pyx_f_7twisted_6python_6_epoll_5epoll_modify(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
     567  int __pyx_v_fd;
     568  int __pyx_v_events;
     569  int __pyx_v_result;
     570  struct epoll_event __pyx_v_evt;
     571  PyObject *__pyx_r;
     572  PyObject *__pyx_1 = 0;
     573  int __pyx_2;
     574  PyObject *__pyx_3 = 0;
     575  PyObject *__pyx_4 = 0;
     576  static char *__pyx_argnames[] = {"fd","events",0};
     577  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "ii", __pyx_argnames, &__pyx_v_fd, &__pyx_v_events)) return 0;
     578  Py_INCREF(__pyx_v_self);
    366579
    367     /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":152 */
    368     __pyx_v__save = PyEval_SaveThread();
     580  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":206 */
     581  __pyx_v_evt.events = __pyx_v_events;
    369582
    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);
     583  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":207 */
     584  __pyx_v_evt.data.fd = __pyx_v_fd;
    372585
    373     /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":154 */
    374     PyEval_RestoreThread(__pyx_v__save);
     586  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":208 */
     587  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_CTL_MOD); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; goto __pyx_L1;}
     588  __pyx_2 = PyInt_AsLong(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; goto __pyx_L1;}
     589  Py_DECREF(__pyx_1); __pyx_1 = 0;
     590  __pyx_v_result = epoll_ctl(((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd,__pyx_2,__pyx_v_fd,(&__pyx_v_evt));
    375591
    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) {
     592  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":209 */
     593  __pyx_2 = (__pyx_v_result == (-1));
     594  if (__pyx_2) {
     595    __pyx_1 = PyInt_FromLong(errno); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}
     596    __pyx_3 = PyString_FromString(strerror(errno)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}
     597    __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}
     598    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_1);
     599    PyTuple_SET_ITEM(__pyx_4, 1, __pyx_3);
     600    __pyx_1 = 0;
     601    __pyx_3 = 0;
     602    __pyx_1 = PyObject_CallObject(PyExc_IOError, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}
     603    Py_DECREF(__pyx_4); __pyx_4 = 0;
     604    __Pyx_Raise(__pyx_1, 0, 0);
     605    Py_DECREF(__pyx_1); __pyx_1 = 0;
     606    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}
     607    goto __pyx_L2;
     608  }
     609  __pyx_L2:;
    379610
    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;
    396     }
    397     __pyx_L5:;
     611  __pyx_r = Py_None; Py_INCREF(Py_None);
     612  goto __pyx_L0;
     613  __pyx_L1:;
     614  Py_XDECREF(__pyx_1);
     615  Py_XDECREF(__pyx_3);
     616  Py_XDECREF(__pyx_4);
     617  __Pyx_AddTraceback("twisted.python._epoll.epoll.modify");
     618  __pyx_r = 0;
     619  __pyx_L0:;
     620  Py_DECREF(__pyx_v_self);
     621  return __pyx_r;
     622}
    398623
    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;
     624static PyObject *__pyx_f_7twisted_6python_6_epoll_5epoll__control(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
     625static 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        ";
     626static PyObject *__pyx_f_7twisted_6python_6_epoll_5epoll__control(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
     627  int __pyx_v_op;
     628  int __pyx_v_fd;
     629  int __pyx_v_events;
     630  int __pyx_v_result;
     631  struct epoll_event __pyx_v_evt;
     632  PyObject *__pyx_r;
     633  int __pyx_1;
     634  PyObject *__pyx_2 = 0;
     635  PyObject *__pyx_3 = 0;
     636  PyObject *__pyx_4 = 0;
     637  static char *__pyx_argnames[] = {"op","fd","events",0};
     638  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "iii", __pyx_argnames, &__pyx_v_op, &__pyx_v_fd, &__pyx_v_events)) return 0;
     639  Py_INCREF(__pyx_v_self);
    404640
    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;
     641  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":231 */
     642  __pyx_v_evt.events = __pyx_v_events;
    411643
    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:;
    431     }
    432     __pyx_L7:;
     644  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":232 */
     645  __pyx_v_evt.data.fd = __pyx_v_fd;
    433646
    434     /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":161 */
    435     Py_INCREF(__pyx_v_results);
    436     __pyx_r = __pyx_v_results;
     647  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":233 */
     648  __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));
     649
     650  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":234 */
     651  __pyx_1 = (__pyx_v_result == (-1));
     652  if (__pyx_1) {
     653    __pyx_2 = PyInt_FromLong(errno); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; goto __pyx_L1;}
     654    __pyx_3 = PyString_FromString(strerror(errno)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; goto __pyx_L1;}
     655    __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; goto __pyx_L1;}
     656    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
     657    PyTuple_SET_ITEM(__pyx_4, 1, __pyx_3);
     658    __pyx_2 = 0;
     659    __pyx_3 = 0;
     660    __pyx_2 = PyObject_CallObject(PyExc_IOError, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; goto __pyx_L1;}
     661    Py_DECREF(__pyx_4); __pyx_4 = 0;
     662    __Pyx_Raise(__pyx_2, 0, 0);
     663    Py_DECREF(__pyx_2); __pyx_2 = 0;
     664    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; goto __pyx_L1;}
    437665    goto __pyx_L2;
    438666  }
    439   /*finally:*/ {
    440     int __pyx_why;
    441     __pyx_why = 0; goto __pyx_L4;
    442     __pyx_L2: __pyx_why = 3; goto __pyx_L4;
    443     __pyx_L3: {
    444       __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;
    452     }
    453     __pyx_L4:;
     667  __pyx_L2:;
    454668
    455     /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python/_epoll.pyx":163 */
    456     free(__pyx_v_events);
    457     switch (__pyx_why) {
    458       case 3: goto __pyx_L0;
    459       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;
    466       }
    467     }
    468   }
    469 
    470669  __pyx_r = Py_None; Py_INCREF(Py_None);
    471670  goto __pyx_L0;
    472671  __pyx_L1:;
    473672  Py_XDECREF(__pyx_2);
    474673  Py_XDECREF(__pyx_3);
    475674  Py_XDECREF(__pyx_4);
    476   Py_XDECREF(__pyx_5);
    477   __Pyx_AddTraceback("_epoll.epoll.wait");
     675  __Pyx_AddTraceback("twisted.python._epoll.epoll._control");
    478676  __pyx_r = 0;
    479677  __pyx_L0:;
    480   Py_DECREF(__pyx_v_results);
    481   Py_DECREF(__pyx_v_i);
    482678  Py_DECREF(__pyx_v_self);
    483679  return __pyx_r;
    484680}
    485681
    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 };
     682static PyObject *__pyx_f_7twisted_6python_6_epoll_5epoll_wait(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
     683static 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 in milliseconds waiting for events. 0\n            makes it return immediately whereas -1 makes it wait indefinitely.\n        \n        @raise IOError: Raised if the underlying epoll_wait() call fails.\n        ";
     684static PyObject *__pyx_f_7twisted_6python_6_epoll_5epoll_wait(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
     685  unsigned int __pyx_v_maxevents;
     686  int __pyx_v_timeout;
     687  PyObject *__pyx_r;
     688  PyObject *__pyx_1 = 0;
     689  static char *__pyx_argnames[] = {"maxevents","timeout",0};
     690  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "Ii", __pyx_argnames, &__pyx_v_maxevents, &__pyx_v_timeout)) return 0;
     691  Py_INCREF(__pyx_v_self);
     692  __pyx_1 = __pyx_f_7twisted_6python_6_epoll_call_epoll_wait(((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd,__pyx_v_maxevents,__pyx_v_timeout); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; goto __pyx_L1;}
     693  __pyx_r = __pyx_1;
     694  __pyx_1 = 0;
     695  goto __pyx_L0;
    505696
    506 static PyObject *__pyx_tp_new_6_epoll_epoll(PyTypeObject *t, PyObject *a, PyObject *k) {
     697  __pyx_r = Py_None; Py_INCREF(Py_None);
     698  goto __pyx_L0;
     699  __pyx_L1:;
     700  Py_XDECREF(__pyx_1);
     701  __Pyx_AddTraceback("twisted.python._epoll.epoll.wait");
     702  __pyx_r = 0;
     703  __pyx_L0:;
     704  Py_DECREF(__pyx_v_self);
     705  return __pyx_r;
     706}
     707
     708static PyObject *__pyx_f_7twisted_6python_6_epoll_5epoll_poll(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
     709static char __pyx_doc_7twisted_6python_6_epoll_5epoll_poll[] = "\n        Wait for an I/O event, wrap epoll_wait(2).\n\n        This method is compatible with select.epoll.poll in Python 2.6.\n\n        @type maxevents: C{int}\n        @param maxevents: Maximum number of events returned.\n\n        @type timeout: C{int}\n        @param timeout: Maximum time waiting for events. 0 makes it return\n            immediately whereas -1 makes it wait indefinitely.\n        \n        @raise IOError: Raised if the underlying epoll_wait() call fails.\n        ";
     710static PyObject *__pyx_f_7twisted_6python_6_epoll_5epoll_poll(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
     711  float __pyx_v_timeout;
     712  unsigned int __pyx_v_maxevents;
     713  PyObject *__pyx_r;
     714  PyObject *__pyx_1 = 0;
     715  static char *__pyx_argnames[] = {"timeout","maxevents",0};
     716  __pyx_v_timeout = __pyx_d2;
     717  __pyx_v_maxevents = __pyx_d3;
     718  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|fI", __pyx_argnames, &__pyx_v_timeout, &__pyx_v_maxevents)) return 0;
     719  Py_INCREF(__pyx_v_self);
     720  __pyx_1 = __pyx_f_7twisted_6python_6_epoll_call_epoll_wait(((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd,__pyx_v_maxevents,((int)(__pyx_v_timeout * 1000.0))); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; goto __pyx_L1;}
     721  __pyx_r = __pyx_1;
     722  __pyx_1 = 0;
     723  goto __pyx_L0;
     724
     725  __pyx_r = Py_None; Py_INCREF(Py_None);
     726  goto __pyx_L0;
     727  __pyx_L1:;
     728  Py_XDECREF(__pyx_1);
     729  __Pyx_AddTraceback("twisted.python._epoll.epoll.poll");
     730  __pyx_r = 0;
     731  __pyx_L0:;
     732  Py_DECREF(__pyx_v_self);
     733  return __pyx_r;
     734}
     735
     736static PyObject *__pyx_tp_new_7twisted_6python_6_epoll_epoll(PyTypeObject *t, PyObject *a, PyObject *k) {
    507737  PyObject *o = (*t->tp_alloc)(t, 0);
    508   struct __pyx_obj_6_epoll_epoll *p = (struct __pyx_obj_6_epoll_epoll *)o;
     738  if (!o) return 0;
    509739  return o;
    510740}
    511741
    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;
     742static void __pyx_tp_dealloc_7twisted_6python_6_epoll_epoll(PyObject *o) {
    514743  {
    515744    PyObject *etype, *eval, *etb;
    516745    PyErr_Fetch(&etype, &eval, &etb);
    517746    ++o->ob_refcnt;
    518     __pyx_f_6_epoll_5epoll___dealloc__(o);
     747    __pyx_f_7twisted_6python_6_epoll_5epoll___dealloc__(o);
    519748    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    520749    --o->ob_refcnt;
    521750    PyErr_Restore(etype, eval, etb);
     
    523752  (*o->ob_type->tp_free)(o);
    524753}
    525754
    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},
     755static struct PyMethodDef __pyx_methods_7twisted_6python_6_epoll_epoll[] = {
     756  {"close", (PyCFunction)__pyx_f_7twisted_6python_6_epoll_5epoll_close, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7twisted_6python_6_epoll_5epoll_close},
     757  {"fileno", (PyCFunction)__pyx_f_7twisted_6python_6_epoll_5epoll_fileno, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7twisted_6python_6_epoll_5epoll_fileno},
     758  {"register", (PyCFunction)__pyx_f_7twisted_6python_6_epoll_5epoll_register, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7twisted_6python_6_epoll_5epoll_register},
     759  {"unregister", (PyCFunction)__pyx_f_7twisted_6python_6_epoll_5epoll_unregister, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7twisted_6python_6_epoll_5epoll_unregister},
     760  {"modify", (PyCFunction)__pyx_f_7twisted_6python_6_epoll_5epoll_modify, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7twisted_6python_6_epoll_5epoll_modify},
     761  {"_control", (PyCFunction)__pyx_f_7twisted_6python_6_epoll_5epoll__control, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7twisted_6python_6_epoll_5epoll__control},
     762  {"wait", (PyCFunction)__pyx_f_7twisted_6python_6_epoll_5epoll_wait, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7twisted_6python_6_epoll_5epoll_wait},
     763  {"poll", (PyCFunction)__pyx_f_7twisted_6python_6_epoll_5epoll_poll, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7twisted_6python_6_epoll_5epoll_poll},
    542764  {0, 0, 0, 0}
    543765};
    544766
     
    581803  0, /*nb_true_divide*/
    582804  0, /*nb_inplace_floor_divide*/
    583805  0, /*nb_inplace_true_divide*/
     806  #if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
     807  0, /*nb_index*/
     808  #endif
    584809};
    585810
    586811static PySequenceMethods __pyx_tp_as_sequence_epoll = {
     
    609834  0, /*bf_getcharbuffer*/
    610835};
    611836
    612 PyTypeObject __pyx_type_6_epoll_epoll = {
     837PyTypeObject __pyx_type_7twisted_6python_6_epoll_epoll = {
    613838  PyObject_HEAD_INIT(0)
    614839  0, /*ob_size*/
    615   "_epoll.epoll", /*tp_name*/
    616   sizeof(struct __pyx_obj_6_epoll_epoll), /*tp_basicsize*/
     840  "twisted.python._epoll.epoll", /*tp_name*/
     841  sizeof(struct __pyx_obj_7twisted_6python_6_epoll_epoll), /*tp_basicsize*/
    617842  0, /*tp_itemsize*/
    618   __pyx_tp_dealloc_6_epoll_epoll, /*tp_dealloc*/
     843  __pyx_tp_dealloc_7twisted_6python_6_epoll_epoll, /*tp_dealloc*/
    619844  0, /*tp_print*/
    620845  0, /*tp_getattr*/
    621846  0, /*tp_setattr*/
     
    630855  0, /*tp_getattro*/
    631856  0, /*tp_setattro*/
    632857  &__pyx_tp_as_buffer_epoll, /*tp_as_buffer*/
    633   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
     858  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE, /*tp_flags*/
    634859  "\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*/
     860  0, /*tp_traverse*/
     861  0, /*tp_clear*/
    637862  0, /*tp_richcompare*/
    638863  0, /*tp_weaklistoffset*/
    639864  0, /*tp_iter*/
    640865  0, /*tp_iternext*/
    641   __pyx_methods_6_epoll_epoll, /*tp_methods*/
     866  __pyx_methods_7twisted_6python_6_epoll_epoll, /*tp_methods*/
    642867  0, /*tp_members*/
    643868  0, /*tp_getset*/
    644869  0, /*tp_base*/
     
    646871  0, /*tp_descr_get*/
    647872  0, /*tp_descr_set*/
    648873  0, /*tp_dictoffset*/
    649   __pyx_f_6_epoll_5epoll___init__, /*tp_init*/
     874  __pyx_f_7twisted_6python_6_epoll_5epoll___init__, /*tp_init*/
    650875  0, /*tp_alloc*/
    651   __pyx_tp_new_6_epoll_epoll, /*tp_new*/
     876  __pyx_tp_new_7twisted_6python_6_epoll_epoll, /*tp_new*/
    652877  0, /*tp_free*/
    653878  0, /*tp_is_gc*/
    654879  0, /*tp_bases*/
     
    670895  __pyx_init_filenames();
    671896  __pyx_m = Py_InitModule4("_epoll", __pyx_methods, __pyx_mdoc, 0, PYTHON_API_VERSION);
    672897  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;};
     898  Py_INCREF(__pyx_m);
    673899  __pyx_b = PyImport_AddModule("__builtin__");
    674900  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;};
    675901  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;
     902  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;};
     903  if (PyType_Ready(&__pyx_type_7twisted_6python_6_epoll_epoll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; goto __pyx_L1;}
     904  if (PyObject_SetAttrString(__pyx_m, "epoll", (PyObject *)&__pyx_type_7twisted_6python_6_epoll_epoll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; goto __pyx_L1;}
     905  __pyx_ptype_7twisted_6python_6_epoll_epoll = &__pyx_type_7twisted_6python_6_epoll_epoll;
    680906
    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;}
     907  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":114 */
     908  __pyx_d1 = 1023;
     909
     910  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":252 */
     911  __pyx_d2 = (-1);
     912  __pyx_d3 = 1024;
     913
     914  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":270 */
     915  __pyx_1 = PyInt_FromLong(EPOLL_CTL_ADD); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; goto __pyx_L1;}
     916  if (PyObject_SetAttr(__pyx_m, __pyx_n_CTL_ADD, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; goto __pyx_L1;}
    684917  Py_DECREF(__pyx_1); __pyx_1 = 0;
    685918
    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;}
     919  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":271 */
     920  __pyx_1 = PyInt_FromLong(EPOLL_CTL_DEL); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; goto __pyx_L1;}
     921  if (PyObject_SetAttr(__pyx_m, __pyx_n_CTL_DEL, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; goto __pyx_L1;}
    689922  Py_DECREF(__pyx_1); __pyx_1 = 0;
    690923
    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;}
     924  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":272 */
     925  __pyx_1 = PyInt_FromLong(EPOLL_CTL_MOD); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; goto __pyx_L1;}
     926  if (PyObject_SetAttr(__pyx_m, __pyx_n_CTL_MOD, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; goto __pyx_L1;}
    694927  Py_DECREF(__pyx_1); __pyx_1 = 0;
    695928
    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;}
     929  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":274 */
     930  __pyx_1 = PyInt_FromLong(EPOLLIN); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; goto __pyx_L1;}
     931  if (PyObject_SetAttr(__pyx_m, __pyx_n_IN, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; goto __pyx_L1;}
    699932  Py_DECREF(__pyx_1); __pyx_1 = 0;
     933  __pyx_1 = PyInt_FromLong(EPOLLIN); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; goto __pyx_L1;}
     934  if (PyObject_SetAttr(__pyx_m, __pyx_n_EPOLLIN, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; goto __pyx_L1;}
     935  Py_DECREF(__pyx_1); __pyx_1 = 0;
    700936
    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;}
     937  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":275 */
     938  __pyx_1 = PyInt_FromLong(EPOLLOUT); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; goto __pyx_L1;}
     939  if (PyObject_SetAttr(__pyx_m, __pyx_n_OUT, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; goto __pyx_L1;}
    704940  Py_DECREF(__pyx_1); __pyx_1 = 0;
     941  __pyx_1 = PyInt_FromLong(EPOLLOUT); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; goto __pyx_L1;}
     942  if (PyObject_SetAttr(__pyx_m, __pyx_n_EPOLLOUT, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; goto __pyx_L1;}
     943  Py_DECREF(__pyx_1); __pyx_1 = 0;
    705944
    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;}
     945  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":276 */
     946  __pyx_1 = PyInt_FromLong(EPOLLPRI); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; goto __pyx_L1;}
     947  if (PyObject_SetAttr(__pyx_m, __pyx_n_PRI, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; goto __pyx_L1;}
    709948  Py_DECREF(__pyx_1); __pyx_1 = 0;
     949  __pyx_1 = PyInt_FromLong(EPOLLPRI); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; goto __pyx_L1;}
     950  if (PyObject_SetAttr(__pyx_m, __pyx_n_EPOLLPRI, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; goto __pyx_L1;}
     951  Py_DECREF(__pyx_1); __pyx_1 = 0;
    710952
    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;}
     953  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":277 */
     954  __pyx_1 = PyInt_FromLong(EPOLLERR); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; goto __pyx_L1;}
     955  if (PyObject_SetAttr(__pyx_m, __pyx_n_ERR, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; goto __pyx_L1;}
    714956  Py_DECREF(__pyx_1); __pyx_1 = 0;
     957  __pyx_1 = PyInt_FromLong(EPOLLERR); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; goto __pyx_L1;}
     958  if (PyObject_SetAttr(__pyx_m, __pyx_n_EPOLLERR, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; goto __pyx_L1;}
     959  Py_DECREF(__pyx_1); __pyx_1 = 0;
    715960
    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;}
     961  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":278 */
     962  __pyx_1 = PyInt_FromLong(EPOLLHUP); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; goto __pyx_L1;}
     963  if (PyObject_SetAttr(__pyx_m, __pyx_n_HUP, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; goto __pyx_L1;}
    719964  Py_DECREF(__pyx_1); __pyx_1 = 0;
     965  __pyx_1 = PyInt_FromLong(EPOLLHUP); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; goto __pyx_L1;}
     966  if (PyObject_SetAttr(__pyx_m, __pyx_n_EPOLLHUP, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; goto __pyx_L1;}
     967  Py_DECREF(__pyx_1); __pyx_1 = 0;
    720968
    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;}
     969  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":279 */
     970  __pyx_1 = PyInt_FromLong(EPOLLET); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; goto __pyx_L1;}
     971  if (PyObject_SetAttr(__pyx_m, __pyx_n_ET, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; goto __pyx_L1;}
    724972  Py_DECREF(__pyx_1); __pyx_1 = 0;
     973  __pyx_1 = PyInt_FromLong(EPOLLET); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; goto __pyx_L1;}
     974  if (PyObject_SetAttr(__pyx_m, __pyx_n_EPOLLET, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; goto __pyx_L1;}
     975  Py_DECREF(__pyx_1); __pyx_1 = 0;
    725976
    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;}
     977  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":281 */
     978  __pyx_1 = PyInt_FromLong(EPOLLRDNORM); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; goto __pyx_L1;}
     979  if (PyObject_SetAttr(__pyx_m, __pyx_n_RDNORM, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; goto __pyx_L1;}
    729980  Py_DECREF(__pyx_1); __pyx_1 = 0;
     981  __pyx_1 = PyInt_FromLong(EPOLLRDNORM); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; goto __pyx_L1;}
     982  if (PyObject_SetAttr(__pyx_m, __pyx_n_EPOLLRDNORM, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; goto __pyx_L1;}
     983  Py_DECREF(__pyx_1); __pyx_1 = 0;
    730984
    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;}
     985  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":282 */
     986  __pyx_1 = PyInt_FromLong(EPOLLRDBAND); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; goto __pyx_L1;}
     987  if (PyObject_SetAttr(__pyx_m, __pyx_n_RDBAND, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; goto __pyx_L1;}
    734988  Py_DECREF(__pyx_1); __pyx_1 = 0;
     989  __pyx_1 = PyInt_FromLong(EPOLLRDBAND); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; goto __pyx_L1;}
     990  if (PyObject_SetAttr(__pyx_m, __pyx_n_EPOLLRDBAND, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; goto __pyx_L1;}
     991  Py_DECREF(__pyx_1); __pyx_1 = 0;
    735992
    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;}
     993  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":283 */
     994  __pyx_1 = PyInt_FromLong(EPOLLWRNORM); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; goto __pyx_L1;}
     995  if (PyObject_SetAttr(__pyx_m, __pyx_n_WRNORM, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; goto __pyx_L1;}
    739996  Py_DECREF(__pyx_1); __pyx_1 = 0;
     997  __pyx_1 = PyInt_FromLong(EPOLLWRNORM); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; goto __pyx_L1;}
     998  if (PyObject_SetAttr(__pyx_m, __pyx_n_EPOLLWRNORM, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; goto __pyx_L1;}
     999  Py_DECREF(__pyx_1); __pyx_1 = 0;
    7401000
    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;}
     1001  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":284 */
     1002  __pyx_1 = PyInt_FromLong(EPOLLWRBAND); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; goto __pyx_L1;}
     1003  if (PyObject_SetAttr(__pyx_m, __pyx_n_WRBAND, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; goto __pyx_L1;}
    7441004  Py_DECREF(__pyx_1); __pyx_1 = 0;
     1005  __pyx_1 = PyInt_FromLong(EPOLLWRBAND); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; goto __pyx_L1;}
     1006  if (PyObject_SetAttr(__pyx_m, __pyx_n_EPOLLWRBAND, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; goto __pyx_L1;}
     1007  Py_DECREF(__pyx_1); __pyx_1 = 0;
    7451008
    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;}
     1009  /* "/usr/local/google/twisted/twisted/python/_epoll.pyx":285 */
     1010  __pyx_1 = PyInt_FromLong(EPOLLMSG); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}
     1011  if (PyObject_SetAttr(__pyx_m, __pyx_n_MSG, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}
    7491012  Py_DECREF(__pyx_1); __pyx_1 = 0;
     1013  __pyx_1 = PyInt_FromLong(EPOLLMSG); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}
     1014  if (PyObject_SetAttr(__pyx_m, __pyx_n_EPOLLMSG, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}
     1015  Py_DECREF(__pyx_1); __pyx_1 = 0;
    7501016  return;
    7511017  __pyx_L1:;
    7521018  Py_XDECREF(__pyx_1);
    753   __Pyx_AddTraceback("_epoll");
     1019  __Pyx_AddTraceback("twisted.python._epoll");
    7541020}
    7551021
    7561022static char *__pyx_filenames[] = {
     
    7631029  __pyx_f = __pyx_filenames;
    7641030}
    7651031
    766 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
    767     PyObject *result;
    768     result = PyObject_GetAttr(dict, name);
    769     if (!result)
    770         PyErr_SetObject(PyExc_NameError, name);
    771     return result;
    772 }
    773 
    7741032static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
     1033    if (value == Py_None)
     1034        value = NULL;
     1035    if (tb == Py_None)
     1036        tb = NULL;
    7751037    Py_XINCREF(type);
    7761038    Py_XINCREF(value);
    7771039    Py_XINCREF(tb);
    778     /* First, check the traceback argument, replacing None with NULL. */
    779     if (tb == Py_None) {
    780         Py_DECREF(tb);
    781         tb = 0;
    782     }
    783     else if (tb != NULL && !PyTraceBack_Check(tb)) {
     1040    if (tb && !PyTraceBack_Check(tb)) {
    7841041        PyErr_SetString(PyExc_TypeError,
    7851042            "raise: arg 3 must be a traceback or None");
    7861043        goto raise_error;
    7871044    }
    788     /* Next, replace a missing value with None */
    789     if (value == NULL) {
    790         value = Py_None;
    791         Py_INCREF(value);
    792     }
    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)) {
     1045    #if PY_VERSION_HEX < 0x02050000
     1046    if (!PyClass_Check(type))
     1047    #else
     1048    if (!PyType_Check(type))
     1049    #endif
     1050    {
    8111051        /* Raising an instance.  The value should be a dummy. */
    812         if (value != Py_None) {
     1052        if (value) {
    8131053            PyErr_SetString(PyExc_TypeError,
    814               "instance exception may not have a separate value");
     1054                "instance exception may not have a separate value");
    8151055            goto raise_error;
    8161056        }
    817         else {
    818             /* Normalize to raise <class>, <instance> */
    819             Py_DECREF(value);
    820             value = type;
    821             type = (PyObject*) ((PyInstanceObject*)type)->in_class;
     1057        /* Normalize to raise <class>, <instance> */
     1058        value = type;
     1059        #if PY_VERSION_HEX < 0x02050000
     1060            if (PyInstance_Check(type)) {
     1061                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
     1062                Py_INCREF(type);
     1063            }
     1064            else {
     1065                PyErr_SetString(PyExc_TypeError,
     1066                    "raise: exception must be an old-style class or instance");
     1067                goto raise_error;
     1068            }
     1069        #else
     1070            type = (PyObject*) type->ob_type;
    8221071            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) {
     1072            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
    8291073                PyErr_SetString(PyExc_TypeError,
    830                   "instance exception may not have a separate value");
     1074                    "raise: exception class must be a subclass of BaseException");
    8311075                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         }
     1076            }
     1077        #endif
    8401078    }
    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     }
    8501079    PyErr_Restore(type, value, tb);
    8511080    return;
    8521081raise_error:
     
    8561085    return;
    8571086}
    8581087
    859 static int __Pyx_InternStrings(__Pyx_InternTabEntry *t) {
     1088static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
     1089    PyObject *result;
     1090    result = PyObject_GetAttr(dict, name);
     1091    if (!result)
     1092        PyErr_SetObject(PyExc_NameError, name);
     1093    return result;
     1094}
     1095
     1096static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    8601097    while (t->p) {
    861         *t->p = PyString_InternFromString(t->s);
     1098        *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
    8621099        if (!*t->p)
    8631100            return -1;
     1101        if (t->i)
     1102            PyString_InternInPlace(t->p);
    8641103        ++t;
    8651104    }
    8661105    return 0;