1 /* Generated by Cython 0.15.1 on Fri Feb 17 23:33:28 2012 */
3 #define PY_SSIZE_T_CLEAN
6 #error Python headers needed to compile C extensions, please install development version of Python.
9 #include <stddef.h> /* For offsetof */
11 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
14 #if !defined(WIN32) && !defined(MS_WINDOWS)
27 #define DL_IMPORT(t) t
30 #define DL_EXPORT(t) t
34 #define PY_LONG_LONG LONG_LONG
37 #if PY_VERSION_HEX < 0x02040000
38 #define METH_COEXIST 0
39 #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
40 #define PyDict_Contains(d,o) PySequence_Contains(d,o)
43 #if PY_VERSION_HEX < 0x02050000
44 typedef int Py_ssize_t;
45 #define PY_SSIZE_T_MAX INT_MAX
46 #define PY_SSIZE_T_MIN INT_MIN
47 #define PY_FORMAT_SIZE_T ""
48 #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
49 #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o)
50 #define PyNumber_Index(o) PyNumber_Int(o)
51 #define PyIndex_Check(o) PyNumber_Check(o)
52 #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
55 #if PY_VERSION_HEX < 0x02060000
56 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
57 #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
58 #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
59 #define PyVarObject_HEAD_INIT(type, size) \
60 PyObject_HEAD_INIT(type) size,
61 #define PyType_Modified(t)
73 Py_ssize_t *suboffsets;
77 #define PyBUF_SIMPLE 0
78 #define PyBUF_WRITABLE 0x0001
79 #define PyBUF_FORMAT 0x0004
80 #define PyBUF_ND 0x0008
81 #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
82 #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
83 #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
84 #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
85 #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
89 #if PY_MAJOR_VERSION < 3
90 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
92 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
95 #if PY_MAJOR_VERSION >= 3
96 #define Py_TPFLAGS_CHECKTYPES 0
97 #define Py_TPFLAGS_HAVE_INDEX 0
100 #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
101 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
104 #if PY_MAJOR_VERSION >= 3
105 #define PyBaseString_Type PyUnicode_Type
106 #define PyStringObject PyUnicodeObject
107 #define PyString_Type PyUnicode_Type
108 #define PyString_Check PyUnicode_Check
109 #define PyString_CheckExact PyUnicode_CheckExact
112 #if PY_VERSION_HEX < 0x02060000
113 #define PyBytesObject PyStringObject
114 #define PyBytes_Type PyString_Type
115 #define PyBytes_Check PyString_Check
116 #define PyBytes_CheckExact PyString_CheckExact
117 #define PyBytes_FromString PyString_FromString
118 #define PyBytes_FromStringAndSize PyString_FromStringAndSize
119 #define PyBytes_FromFormat PyString_FromFormat
120 #define PyBytes_DecodeEscape PyString_DecodeEscape
121 #define PyBytes_AsString PyString_AsString
122 #define PyBytes_AsStringAndSize PyString_AsStringAndSize
123 #define PyBytes_Size PyString_Size
124 #define PyBytes_AS_STRING PyString_AS_STRING
125 #define PyBytes_GET_SIZE PyString_GET_SIZE
126 #define PyBytes_Repr PyString_Repr
127 #define PyBytes_Concat PyString_Concat
128 #define PyBytes_ConcatAndDel PyString_ConcatAndDel
131 #if PY_VERSION_HEX < 0x02060000
132 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type)
133 #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type)
135 #ifndef PySet_CheckExact
136 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
139 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
141 #if PY_MAJOR_VERSION >= 3
142 #define PyIntObject PyLongObject
143 #define PyInt_Type PyLong_Type
144 #define PyInt_Check(op) PyLong_Check(op)
145 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
146 #define PyInt_FromString PyLong_FromString
147 #define PyInt_FromUnicode PyLong_FromUnicode
148 #define PyInt_FromLong PyLong_FromLong
149 #define PyInt_FromSize_t PyLong_FromSize_t
150 #define PyInt_FromSsize_t PyLong_FromSsize_t
151 #define PyInt_AsLong PyLong_AsLong
152 #define PyInt_AS_LONG PyLong_AS_LONG
153 #define PyInt_AsSsize_t PyLong_AsSsize_t
154 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
155 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
158 #if PY_MAJOR_VERSION >= 3
159 #define PyBoolObject PyLongObject
162 #if PY_VERSION_HEX < 0x03020000
163 typedef long Py_hash_t;
164 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
165 #define __Pyx_PyInt_AsHash_t PyInt_AsLong
167 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
168 #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
172 #if PY_MAJOR_VERSION >= 3
173 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
174 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
176 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
177 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
180 #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
181 #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
182 #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
183 #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
185 #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
186 (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
187 (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
188 (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
189 #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
190 (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
191 (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
192 (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
193 #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
194 (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
195 (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
196 (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
199 #if PY_MAJOR_VERSION >= 3
200 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
203 #if PY_VERSION_HEX < 0x02050000
204 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n)))
205 #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
206 #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n)))
208 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n))
209 #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
210 #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n))
213 #if PY_VERSION_HEX < 0x02050000
214 #define __Pyx_NAMESTR(n) ((char *)(n))
215 #define __Pyx_DOCSTR(n) ((char *)(n))
217 #define __Pyx_NAMESTR(n) (n)
218 #define __Pyx_DOCSTR(n) (n)
221 #ifndef __PYX_EXTERN_C
223 #define __PYX_EXTERN_C extern "C"
225 #define __PYX_EXTERN_C extern
229 #if defined(WIN32) || defined(MS_WINDOWS)
230 #define _USE_MATH_DEFINES
233 #define __PYX_HAVE__twisted__python___epoll
234 #define __PYX_HAVE_API__twisted__python___epoll
239 #include "sys/epoll.h"
244 #ifdef PYREX_WITHOUT_ASSERTIONS
245 #define CYTHON_WITHOUT_ASSERTIONS
249 /* inline attribute */
250 #ifndef CYTHON_INLINE
251 #if defined(__GNUC__)
252 #define CYTHON_INLINE __inline__
253 #elif defined(_MSC_VER)
254 #define CYTHON_INLINE __inline
255 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
256 #define CYTHON_INLINE inline
258 #define CYTHON_INLINE
262 /* unused attribute */
263 #ifndef CYTHON_UNUSED
264 # if defined(__GNUC__)
265 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
266 # define CYTHON_UNUSED __attribute__ ((__unused__))
268 # define CYTHON_UNUSED
270 # elif defined(__ICC) || defined(__INTEL_COMPILER)
271 # define CYTHON_UNUSED __attribute__ ((__unused__))
273 # define CYTHON_UNUSED
277 typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
280 /* Type Conversion Predeclarations */
282 #define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
283 #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s))
285 #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
286 #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
287 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
288 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
290 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
291 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
292 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
294 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
298 /* Test for GCC > 2.95 */
299 #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
300 #define likely(x) __builtin_expect(!!(x), 1)
301 #define unlikely(x) __builtin_expect(!!(x), 0)
302 #else /* __GNUC__ > 2 ... */
303 #define likely(x) (x)
304 #define unlikely(x) (x)
305 #endif /* __GNUC__ > 2 ... */
307 #define likely(x) (x)
308 #define unlikely(x) (x)
309 #endif /* __GNUC__ */
311 static PyObject *__pyx_m;
312 static PyObject *__pyx_b;
313 static PyObject *__pyx_empty_tuple;
314 static PyObject *__pyx_empty_bytes;
315 static int __pyx_lineno;
316 static int __pyx_clineno = 0;
317 static const char * __pyx_cfilenm= __FILE__;
318 static const char *__pyx_filename;
321 static const char *__pyx_f[] = {
325 /*--- Type declarations ---*/
326 struct __pyx_obj_7twisted_6python_6_epoll_epoll;
328 /* "twisted/python/_epoll.pyx":106
331 * cdef class epoll: # <<<<<<<<<<<<<<
333 * Represent a set of file descriptors being monitored for events.
335 struct __pyx_obj_7twisted_6python_6_epoll_epoll {
342 #ifndef CYTHON_REFNANNY
343 #define CYTHON_REFNANNY 0
348 void (*INCREF)(void*, PyObject*, int);
349 void (*DECREF)(void*, PyObject*, int);
350 void (*GOTREF)(void*, PyObject*, int);
351 void (*GIVEREF)(void*, PyObject*, int);
352 void* (*SetupContext)(const char*, int, const char*);
353 void (*FinishContext)(void**);
354 } __Pyx_RefNannyAPIStruct;
355 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
356 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
357 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
358 #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
359 #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
360 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
361 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
362 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
363 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
364 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
365 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
366 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
367 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
369 #define __Pyx_RefNannyDeclarations
370 #define __Pyx_RefNannySetupContext(name)
371 #define __Pyx_RefNannyFinishContext()
372 #define __Pyx_INCREF(r) Py_INCREF(r)
373 #define __Pyx_DECREF(r) Py_DECREF(r)
374 #define __Pyx_GOTREF(r)
375 #define __Pyx_GIVEREF(r)
376 #define __Pyx_XINCREF(r) Py_XINCREF(r)
377 #define __Pyx_XDECREF(r) Py_XDECREF(r)
378 #define __Pyx_XGOTREF(r)
379 #define __Pyx_XGIVEREF(r)
380 #endif /* CYTHON_REFNANNY */
382 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
384 static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
385 static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
387 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/
389 static void __Pyx_RaiseDoubleKeywordsError(
390 const char* func_name, PyObject* kw_name); /*proto*/
392 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/
394 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
395 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
397 static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
399 static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
401 static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
403 static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);
405 static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);
407 static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);
409 static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
411 static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
413 static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
415 static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);
417 static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
419 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
421 static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);
423 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
425 static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
427 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
429 static int __Pyx_check_binary_version(void);
431 static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
432 int __pyx_lineno, const char *__pyx_filename); /*proto*/
434 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
436 /* Module declarations from 'twisted.python._epoll' */
437 static PyTypeObject *__pyx_ptype_7twisted_6python_6_epoll_epoll = 0;
438 static PyObject *__pyx_f_7twisted_6python_6_epoll_call_epoll_wait(int, unsigned int, int); /*proto*/
439 #define __Pyx_MODULE_NAME "twisted.python._epoll"
440 int __pyx_module_is_main_twisted__python___epoll = 0;
442 /* Implementation of 'twisted.python._epoll' */
443 static PyObject *__pyx_builtin_IOError;
444 static char __pyx_k_1[] = "\nInterface to epoll I/O event notification facility.\n";
445 static char __pyx_k__ET[] = "ET";
446 static char __pyx_k__IN[] = "IN";
447 static char __pyx_k__fd[] = "fd";
448 static char __pyx_k__op[] = "op";
449 static char __pyx_k__ERR[] = "ERR";
450 static char __pyx_k__HUP[] = "HUP";
451 static char __pyx_k__MSG[] = "MSG";
452 static char __pyx_k__OUT[] = "OUT";
453 static char __pyx_k__PRI[] = "PRI";
454 static char __pyx_k__size[] = "size";
455 static char __pyx_k__RDBAND[] = "RDBAND";
456 static char __pyx_k__RDNORM[] = "RDNORM";
457 static char __pyx_k__WRBAND[] = "WRBAND";
458 static char __pyx_k__WRNORM[] = "WRNORM";
459 static char __pyx_k__events[] = "events";
460 static char __pyx_k__CTL_ADD[] = "CTL_ADD";
461 static char __pyx_k__CTL_DEL[] = "CTL_DEL";
462 static char __pyx_k__CTL_MOD[] = "CTL_MOD";
463 static char __pyx_k__EPOLLET[] = "EPOLLET";
464 static char __pyx_k__EPOLLIN[] = "EPOLLIN";
465 static char __pyx_k__IOError[] = "IOError";
466 static char __pyx_k__timeout[] = "timeout";
467 static char __pyx_k__EPOLLERR[] = "EPOLLERR";
468 static char __pyx_k__EPOLLHUP[] = "EPOLLHUP";
469 static char __pyx_k__EPOLLMSG[] = "EPOLLMSG";
470 static char __pyx_k__EPOLLOUT[] = "EPOLLOUT";
471 static char __pyx_k__EPOLLPRI[] = "EPOLLPRI";
472 static char __pyx_k____main__[] = "__main__";
473 static char __pyx_k____test__[] = "__test__";
474 static char __pyx_k__maxevents[] = "maxevents";
475 static char __pyx_k__EPOLLRDBAND[] = "EPOLLRDBAND";
476 static char __pyx_k__EPOLLRDNORM[] = "EPOLLRDNORM";
477 static char __pyx_k__EPOLLWRBAND[] = "EPOLLWRBAND";
478 static char __pyx_k__EPOLLWRNORM[] = "EPOLLWRNORM";
479 static PyObject *__pyx_n_s__CTL_ADD;
480 static PyObject *__pyx_n_s__CTL_DEL;
481 static PyObject *__pyx_n_s__CTL_MOD;
482 static PyObject *__pyx_n_s__EPOLLERR;
483 static PyObject *__pyx_n_s__EPOLLET;
484 static PyObject *__pyx_n_s__EPOLLHUP;
485 static PyObject *__pyx_n_s__EPOLLIN;
486 static PyObject *__pyx_n_s__EPOLLMSG;
487 static PyObject *__pyx_n_s__EPOLLOUT;
488 static PyObject *__pyx_n_s__EPOLLPRI;
489 static PyObject *__pyx_n_s__EPOLLRDBAND;
490 static PyObject *__pyx_n_s__EPOLLRDNORM;
491 static PyObject *__pyx_n_s__EPOLLWRBAND;
492 static PyObject *__pyx_n_s__EPOLLWRNORM;
493 static PyObject *__pyx_n_s__ERR;
494 static PyObject *__pyx_n_s__ET;
495 static PyObject *__pyx_n_s__HUP;
496 static PyObject *__pyx_n_s__IN;
497 static PyObject *__pyx_n_s__IOError;
498 static PyObject *__pyx_n_s__MSG;
499 static PyObject *__pyx_n_s__OUT;
500 static PyObject *__pyx_n_s__PRI;
501 static PyObject *__pyx_n_s__RDBAND;
502 static PyObject *__pyx_n_s__RDNORM;
503 static PyObject *__pyx_n_s__WRBAND;
504 static PyObject *__pyx_n_s__WRNORM;
505 static PyObject *__pyx_n_s____main__;
506 static PyObject *__pyx_n_s____test__;
507 static PyObject *__pyx_n_s__events;
508 static PyObject *__pyx_n_s__fd;
509 static PyObject *__pyx_n_s__maxevents;
510 static PyObject *__pyx_n_s__op;
511 static PyObject *__pyx_n_s__size;
512 static PyObject *__pyx_n_s__timeout;
514 /* "twisted/python/_epoll.pyx":68
515 * cdef extern void PyEval_RestoreThread(PyThreadState*)
517 * cdef call_epoll_wait(int fd, unsigned int maxevents, int timeout_msec): # <<<<<<<<<<<<<<
519 * Wait for an I/O event, wrap epoll_wait(2).
522 static PyObject *__pyx_f_7twisted_6python_6_epoll_call_epoll_wait(int __pyx_v_fd, unsigned int __pyx_v_maxevents, int __pyx_v_timeout_msec) {
523 struct epoll_event *__pyx_v_events;
526 PyThreadState *__pyx_v__save;
527 PyObject *__pyx_v_results = NULL;
529 PyObject *__pyx_r = NULL;
530 __Pyx_RefNannyDeclarations
532 PyObject *__pyx_t_2 = NULL;
533 PyObject *__pyx_t_3 = NULL;
534 PyObject *__pyx_t_4 = NULL;
537 int __pyx_lineno = 0;
538 const char *__pyx_filename = NULL;
539 int __pyx_clineno = 0;
540 __Pyx_RefNannySetupContext("call_epoll_wait");
542 /* "twisted/python/_epoll.pyx":89
543 * cdef PyThreadState *_save
545 * nbytes = sizeof(epoll_event) * maxevents # <<<<<<<<<<<<<<
546 * events = <epoll_event*>malloc(nbytes)
547 * memset(events, 0, nbytes)
549 __pyx_v_nbytes = ((sizeof(struct epoll_event)) * __pyx_v_maxevents);
551 /* "twisted/python/_epoll.pyx":90
553 * nbytes = sizeof(epoll_event) * maxevents
554 * events = <epoll_event*>malloc(nbytes) # <<<<<<<<<<<<<<
555 * memset(events, 0, nbytes)
558 __pyx_v_events = ((struct epoll_event *)malloc(__pyx_v_nbytes));
560 /* "twisted/python/_epoll.pyx":91
561 * nbytes = sizeof(epoll_event) * maxevents
562 * events = <epoll_event*>malloc(nbytes)
563 * memset(events, 0, nbytes) # <<<<<<<<<<<<<<
565 * _save = PyEval_SaveThread()
567 memset(__pyx_v_events, 0, __pyx_v_nbytes);
569 /* "twisted/python/_epoll.pyx":92
570 * events = <epoll_event*>malloc(nbytes)
571 * memset(events, 0, nbytes)
572 * try: # <<<<<<<<<<<<<<
573 * _save = PyEval_SaveThread()
574 * result = epoll_wait(fd, events, maxevents, timeout_msec)
578 /* "twisted/python/_epoll.pyx":93
579 * memset(events, 0, nbytes)
581 * _save = PyEval_SaveThread() # <<<<<<<<<<<<<<
582 * result = epoll_wait(fd, events, maxevents, timeout_msec)
583 * PyEval_RestoreThread(_save)
585 __pyx_v__save = PyEval_SaveThread();
587 /* "twisted/python/_epoll.pyx":94
589 * _save = PyEval_SaveThread()
590 * result = epoll_wait(fd, events, maxevents, timeout_msec) # <<<<<<<<<<<<<<
591 * PyEval_RestoreThread(_save)
594 __pyx_v_result = epoll_wait(__pyx_v_fd, __pyx_v_events, __pyx_v_maxevents, __pyx_v_timeout_msec);
596 /* "twisted/python/_epoll.pyx":95
597 * _save = PyEval_SaveThread()
598 * result = epoll_wait(fd, events, maxevents, timeout_msec)
599 * PyEval_RestoreThread(_save) # <<<<<<<<<<<<<<
603 PyEval_RestoreThread(__pyx_v__save);
605 /* "twisted/python/_epoll.pyx":97
606 * PyEval_RestoreThread(_save)
608 * if result == -1: # <<<<<<<<<<<<<<
609 * raise IOError(errno, strerror(errno))
612 __pyx_t_1 = (__pyx_v_result == -1);
615 /* "twisted/python/_epoll.pyx":98
618 * raise IOError(errno, strerror(errno)) # <<<<<<<<<<<<<<
620 * for i from 0 <= i < result:
622 __pyx_t_2 = PyInt_FromLong(errno); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L4;}
623 __Pyx_GOTREF(__pyx_t_2);
624 __pyx_t_3 = PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L4;}
625 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
626 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L4;}
627 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
628 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
629 __Pyx_GIVEREF(__pyx_t_2);
630 PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_t_3));
631 __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
634 __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L4;}
635 __Pyx_GOTREF(__pyx_t_3);
636 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
637 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
638 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
639 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L4;}
644 /* "twisted/python/_epoll.pyx":99
646 * raise IOError(errno, strerror(errno))
647 * results = [] # <<<<<<<<<<<<<<
648 * for i from 0 <= i < result:
649 * results.append((events[i].data.fd, <int>events[i].events))
651 __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L4;}
652 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
653 __pyx_v_results = __pyx_t_3;
656 /* "twisted/python/_epoll.pyx":100
657 * raise IOError(errno, strerror(errno))
659 * for i from 0 <= i < result: # <<<<<<<<<<<<<<
660 * results.append((events[i].data.fd, <int>events[i].events))
663 __pyx_t_5 = __pyx_v_result;
664 for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {
666 /* "twisted/python/_epoll.pyx":101
668 * for i from 0 <= i < result:
669 * results.append((events[i].data.fd, <int>events[i].events)) # <<<<<<<<<<<<<<
673 if (unlikely(((PyObject *)__pyx_v_results) == Py_None)) {
674 PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L4;}
676 __pyx_t_3 = PyInt_FromLong((__pyx_v_events[__pyx_v_i]).data.fd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L4;}
677 __Pyx_GOTREF(__pyx_t_3);
678 __pyx_t_4 = PyInt_FromLong(((int)(__pyx_v_events[__pyx_v_i]).events)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L4;}
679 __Pyx_GOTREF(__pyx_t_4);
680 __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L4;}
681 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
682 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
683 __Pyx_GIVEREF(__pyx_t_3);
684 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
685 __Pyx_GIVEREF(__pyx_t_4);
688 __pyx_t_6 = PyList_Append(__pyx_v_results, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L4;}
689 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
692 /* "twisted/python/_epoll.pyx":102
693 * for i from 0 <= i < result:
694 * results.append((events[i].data.fd, <int>events[i].events))
695 * return results # <<<<<<<<<<<<<<
699 __Pyx_XDECREF(__pyx_r);
700 __Pyx_INCREF(((PyObject *)__pyx_v_results));
701 __pyx_r = ((PyObject *)__pyx_v_results);
705 /* "twisted/python/_epoll.pyx":104
708 * free(events) # <<<<<<<<<<<<<<
714 PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
715 int __pyx_exc_lineno;
716 __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
717 __pyx_why = 0; goto __pyx_L5;
718 __pyx_L3: __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
719 __pyx_why = 3; goto __pyx_L5;
722 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
723 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
724 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
725 __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
726 __pyx_exc_lineno = __pyx_lineno;
730 free(__pyx_v_events);
732 case 3: goto __pyx_L0;
734 __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
735 __pyx_lineno = __pyx_exc_lineno;
744 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
747 __Pyx_XDECREF(__pyx_t_2);
748 __Pyx_XDECREF(__pyx_t_3);
749 __Pyx_XDECREF(__pyx_t_4);
750 __Pyx_AddTraceback("twisted.python._epoll.call_epoll_wait", __pyx_clineno, __pyx_lineno, __pyx_filename);
753 __Pyx_XDECREF(__pyx_v_results);
754 __Pyx_XGIVEREF(__pyx_r);
755 __Pyx_RefNannyFinishContext();
759 /* "twisted/python/_epoll.pyx":114
760 * cdef int initialized
762 * def __init__(self, int size=1023): # <<<<<<<<<<<<<<
764 * The constructor arguments are compatible with select.poll.__init__.
767 static int __pyx_pf_7twisted_6python_6_epoll_5epoll___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
768 static char __pyx_doc_7twisted_6python_6_epoll_5epoll___init__[] = "\n The constructor arguments are compatible with select.poll.__init__.\n ";
769 struct wrapperbase __pyx_wrapperbase_7twisted_6python_6_epoll_5epoll___init__;
770 static int __pyx_pf_7twisted_6python_6_epoll_5epoll___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
773 __Pyx_RefNannyDeclarations
775 PyObject *__pyx_t_2 = NULL;
776 PyObject *__pyx_t_3 = NULL;
777 PyObject *__pyx_t_4 = NULL;
778 int __pyx_lineno = 0;
779 const char *__pyx_filename = NULL;
780 int __pyx_clineno = 0;
781 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,0};
782 __Pyx_RefNannySetupContext("__init__");
784 PyObject* values[1] = {0};
785 if (unlikely(__pyx_kwds)) {
787 switch (PyTuple_GET_SIZE(__pyx_args)) {
788 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
790 default: goto __pyx_L5_argtuple_error;
792 kw_args = PyDict_Size(__pyx_kwds);
793 switch (PyTuple_GET_SIZE(__pyx_args)) {
796 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
797 if (value) { values[0] = value; kw_args--; }
800 if (unlikely(kw_args > 0)) {
801 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
804 switch (PyTuple_GET_SIZE(__pyx_args)) {
805 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
807 default: goto __pyx_L5_argtuple_error;
811 __pyx_v_size = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
813 __pyx_v_size = ((int)1023);
816 goto __pyx_L4_argument_unpacking_done;
817 __pyx_L5_argtuple_error:;
818 __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
820 __Pyx_AddTraceback("twisted.python._epoll.epoll.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
821 __Pyx_RefNannyFinishContext();
823 __pyx_L4_argument_unpacking_done:;
825 /* "twisted/python/_epoll.pyx":118
826 * The constructor arguments are compatible with select.poll.__init__.
828 * self.fd = epoll_create(size) # <<<<<<<<<<<<<<
830 * raise IOError(errno, strerror(errno))
832 ((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd = epoll_create(__pyx_v_size);
834 /* "twisted/python/_epoll.pyx":119
836 * self.fd = epoll_create(size)
837 * if self.fd == -1: # <<<<<<<<<<<<<<
838 * raise IOError(errno, strerror(errno))
839 * self.initialized = 1
841 __pyx_t_1 = (((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd == -1);
844 /* "twisted/python/_epoll.pyx":120
845 * self.fd = epoll_create(size)
847 * raise IOError(errno, strerror(errno)) # <<<<<<<<<<<<<<
848 * self.initialized = 1
851 __pyx_t_2 = PyInt_FromLong(errno); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
852 __Pyx_GOTREF(__pyx_t_2);
853 __pyx_t_3 = PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
854 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
855 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
856 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
857 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
858 __Pyx_GIVEREF(__pyx_t_2);
859 PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_t_3));
860 __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
863 __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
864 __Pyx_GOTREF(__pyx_t_3);
865 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
866 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
867 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
868 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
873 /* "twisted/python/_epoll.pyx":121
875 * raise IOError(errno, strerror(errno))
876 * self.initialized = 1 # <<<<<<<<<<<<<<
878 * def __dealloc__(self):
880 ((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->initialized = 1;
885 __Pyx_XDECREF(__pyx_t_2);
886 __Pyx_XDECREF(__pyx_t_3);
887 __Pyx_XDECREF(__pyx_t_4);
888 __Pyx_AddTraceback("twisted.python._epoll.epoll.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
891 __Pyx_RefNannyFinishContext();
895 /* "twisted/python/_epoll.pyx":123
896 * self.initialized = 1
898 * def __dealloc__(self): # <<<<<<<<<<<<<<
899 * if self.initialized:
903 static void __pyx_pf_7twisted_6python_6_epoll_5epoll_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
904 static void __pyx_pf_7twisted_6python_6_epoll_5epoll_1__dealloc__(PyObject *__pyx_v_self) {
905 __Pyx_RefNannyDeclarations
906 __Pyx_RefNannySetupContext("__dealloc__");
908 /* "twisted/python/_epoll.pyx":124
910 * def __dealloc__(self):
911 * if self.initialized: # <<<<<<<<<<<<<<
913 * self.initialized = 0
915 if (((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->initialized) {
917 /* "twisted/python/_epoll.pyx":125
918 * def __dealloc__(self):
919 * if self.initialized:
920 * close(self.fd) # <<<<<<<<<<<<<<
921 * self.initialized = 0
924 close(((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd);
926 /* "twisted/python/_epoll.pyx":126
927 * if self.initialized:
929 * self.initialized = 0 # <<<<<<<<<<<<<<
933 ((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->initialized = 0;
938 __Pyx_RefNannyFinishContext();
941 /* "twisted/python/_epoll.pyx":128
942 * self.initialized = 0
944 * def close(self): # <<<<<<<<<<<<<<
946 * Close the epoll file descriptor.
949 static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_2close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
950 static char __pyx_doc_7twisted_6python_6_epoll_5epoll_2close[] = "\n Close the epoll file descriptor.\n ";
951 static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_2close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
952 PyObject *__pyx_r = NULL;
953 __Pyx_RefNannyDeclarations
955 PyObject *__pyx_t_2 = NULL;
956 PyObject *__pyx_t_3 = NULL;
957 PyObject *__pyx_t_4 = NULL;
958 int __pyx_lineno = 0;
959 const char *__pyx_filename = NULL;
960 int __pyx_clineno = 0;
961 __Pyx_RefNannySetupContext("close");
963 /* "twisted/python/_epoll.pyx":132
964 * Close the epoll file descriptor.
966 * if self.initialized: # <<<<<<<<<<<<<<
967 * if close(self.fd) == -1:
968 * raise IOError(errno, strerror(errno))
970 if (((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->initialized) {
972 /* "twisted/python/_epoll.pyx":133
974 * if self.initialized:
975 * if close(self.fd) == -1: # <<<<<<<<<<<<<<
976 * raise IOError(errno, strerror(errno))
977 * self.initialized = 0
979 __pyx_t_1 = (close(((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd) == -1);
982 /* "twisted/python/_epoll.pyx":134
983 * if self.initialized:
984 * if close(self.fd) == -1:
985 * raise IOError(errno, strerror(errno)) # <<<<<<<<<<<<<<
986 * self.initialized = 0
989 __pyx_t_2 = PyInt_FromLong(errno); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
990 __Pyx_GOTREF(__pyx_t_2);
991 __pyx_t_3 = PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
992 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
993 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
994 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
995 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
996 __Pyx_GIVEREF(__pyx_t_2);
997 PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_t_3));
998 __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
1001 __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1002 __Pyx_GOTREF(__pyx_t_3);
1003 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
1004 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
1005 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1006 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1011 /* "twisted/python/_epoll.pyx":135
1012 * if close(self.fd) == -1:
1013 * raise IOError(errno, strerror(errno))
1014 * self.initialized = 0 # <<<<<<<<<<<<<<
1018 ((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->initialized = 0;
1023 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
1026 __Pyx_XDECREF(__pyx_t_2);
1027 __Pyx_XDECREF(__pyx_t_3);
1028 __Pyx_XDECREF(__pyx_t_4);
1029 __Pyx_AddTraceback("twisted.python._epoll.epoll.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
1032 __Pyx_XGIVEREF(__pyx_r);
1033 __Pyx_RefNannyFinishContext();
1037 /* "twisted/python/_epoll.pyx":137
1038 * self.initialized = 0
1040 * def fileno(self): # <<<<<<<<<<<<<<
1042 * Return the epoll file descriptor number.
1045 static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_3fileno(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
1046 static char __pyx_doc_7twisted_6python_6_epoll_5epoll_3fileno[] = "\n Return the epoll file descriptor number.\n ";
1047 static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_3fileno(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
1048 PyObject *__pyx_r = NULL;
1049 __Pyx_RefNannyDeclarations
1050 PyObject *__pyx_t_1 = NULL;
1051 int __pyx_lineno = 0;
1052 const char *__pyx_filename = NULL;
1053 int __pyx_clineno = 0;
1054 __Pyx_RefNannySetupContext("fileno");
1056 /* "twisted/python/_epoll.pyx":141
1057 * Return the epoll file descriptor number.
1059 * return self.fd # <<<<<<<<<<<<<<
1061 * def register(self, int fd, int events):
1063 __Pyx_XDECREF(__pyx_r);
1064 __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1065 __Pyx_GOTREF(__pyx_t_1);
1066 __pyx_r = __pyx_t_1;
1070 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
1073 __Pyx_XDECREF(__pyx_t_1);
1074 __Pyx_AddTraceback("twisted.python._epoll.epoll.fileno", __pyx_clineno, __pyx_lineno, __pyx_filename);
1077 __Pyx_XGIVEREF(__pyx_r);
1078 __Pyx_RefNannyFinishContext();
1082 /* "twisted/python/_epoll.pyx":143
1085 * def register(self, int fd, int events): # <<<<<<<<<<<<<<
1087 * Add (register) a file descriptor to be monitored by self.
1090 static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_4register(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1091 static char __pyx_doc_7twisted_6python_6_epoll_5epoll_4register[] = "\n Add (register) a file descriptor to be monitored by self.\n\n This method is compatible with select.epoll.register in Python 2.6.\n\n Wrap epoll_ctl(2).\n\n @type fd: C{int}\n @param fd: File descriptor to modify\n\n @type events: C{int}\n @param events: A bit set of IN, OUT, PRI, ERR, HUP, and ET.\n\n @raise IOError: Raised if the underlying epoll_ctl() call fails.\n ";
1092 static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_4register(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1096 struct epoll_event __pyx_v_evt;
1097 PyObject *__pyx_r = NULL;
1098 __Pyx_RefNannyDeclarations
1099 PyObject *__pyx_t_1 = NULL;
1102 PyObject *__pyx_t_4 = NULL;
1103 PyObject *__pyx_t_5 = NULL;
1104 int __pyx_lineno = 0;
1105 const char *__pyx_filename = NULL;
1106 int __pyx_clineno = 0;
1107 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fd,&__pyx_n_s__events,0};
1108 __Pyx_RefNannySetupContext("register");
1110 PyObject* values[2] = {0,0};
1111 if (unlikely(__pyx_kwds)) {
1113 switch (PyTuple_GET_SIZE(__pyx_args)) {
1114 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1115 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1117 default: goto __pyx_L5_argtuple_error;
1119 kw_args = PyDict_Size(__pyx_kwds);
1120 switch (PyTuple_GET_SIZE(__pyx_args)) {
1122 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fd);
1123 if (likely(values[0])) kw_args--;
1124 else goto __pyx_L5_argtuple_error;
1126 values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__events);
1127 if (likely(values[1])) kw_args--;
1129 __Pyx_RaiseArgtupleInvalid("register", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1132 if (unlikely(kw_args > 0)) {
1133 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "register") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1135 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
1136 goto __pyx_L5_argtuple_error;
1138 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1139 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1141 __pyx_v_fd = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_fd == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1142 __pyx_v_events = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_events == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1144 goto __pyx_L4_argument_unpacking_done;
1145 __pyx_L5_argtuple_error:;
1146 __Pyx_RaiseArgtupleInvalid("register", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1148 __Pyx_AddTraceback("twisted.python._epoll.epoll.register", __pyx_clineno, __pyx_lineno, __pyx_filename);
1149 __Pyx_RefNannyFinishContext();
1151 __pyx_L4_argument_unpacking_done:;
1153 /* "twisted/python/_epoll.pyx":161
1155 * cdef epoll_event evt
1156 * evt.events = events # <<<<<<<<<<<<<<
1158 * result = epoll_ctl(self.fd, CTL_ADD, fd, &evt)
1160 __pyx_v_evt.events = __pyx_v_events;
1162 /* "twisted/python/_epoll.pyx":162
1163 * cdef epoll_event evt
1164 * evt.events = events
1165 * evt.data.fd = fd # <<<<<<<<<<<<<<
1166 * result = epoll_ctl(self.fd, CTL_ADD, fd, &evt)
1169 __pyx_v_evt.data.fd = __pyx_v_fd;
1171 /* "twisted/python/_epoll.pyx":163
1172 * evt.events = events
1174 * result = epoll_ctl(self.fd, CTL_ADD, fd, &evt) # <<<<<<<<<<<<<<
1176 * raise IOError(errno, strerror(errno))
1178 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__CTL_ADD); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1179 __Pyx_GOTREF(__pyx_t_1);
1180 __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1181 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1182 __pyx_v_result = epoll_ctl(((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd, __pyx_t_2, __pyx_v_fd, (&__pyx_v_evt));
1184 /* "twisted/python/_epoll.pyx":164
1186 * result = epoll_ctl(self.fd, CTL_ADD, fd, &evt)
1187 * if result == -1: # <<<<<<<<<<<<<<
1188 * raise IOError(errno, strerror(errno))
1191 __pyx_t_3 = (__pyx_v_result == -1);
1194 /* "twisted/python/_epoll.pyx":165
1195 * result = epoll_ctl(self.fd, CTL_ADD, fd, &evt)
1197 * raise IOError(errno, strerror(errno)) # <<<<<<<<<<<<<<
1199 * def unregister(self, int fd):
1201 __pyx_t_1 = PyInt_FromLong(errno); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1202 __Pyx_GOTREF(__pyx_t_1);
1203 __pyx_t_4 = PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1204 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
1205 __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1206 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
1207 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
1208 __Pyx_GIVEREF(__pyx_t_1);
1209 PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_t_4));
1210 __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
1213 __pyx_t_4 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1214 __Pyx_GOTREF(__pyx_t_4);
1215 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
1216 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
1217 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1218 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1223 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
1226 __Pyx_XDECREF(__pyx_t_1);
1227 __Pyx_XDECREF(__pyx_t_4);
1228 __Pyx_XDECREF(__pyx_t_5);
1229 __Pyx_AddTraceback("twisted.python._epoll.epoll.register", __pyx_clineno, __pyx_lineno, __pyx_filename);
1232 __Pyx_XGIVEREF(__pyx_r);
1233 __Pyx_RefNannyFinishContext();
1237 /* "twisted/python/_epoll.pyx":167
1238 * raise IOError(errno, strerror(errno))
1240 * def unregister(self, int fd): # <<<<<<<<<<<<<<
1242 * Remove (unregister) a file descriptor monitored by self.
1245 static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_5unregister(PyObject *__pyx_v_self, PyObject *__pyx_arg_fd); /*proto*/
1246 static char __pyx_doc_7twisted_6python_6_epoll_5epoll_5unregister[] = "\n Remove (unregister) a file descriptor monitored by self.\n\n This method is compatible with select.epoll.unregister in Python 2.6.\n\n Wrap epoll_ctl(2).\n\n @type fd: C{int}\n @param fd: File descriptor to modify\n\n @raise IOError: Raised if the underlying epoll_ctl() call fails.\n ";
1247 static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_5unregister(PyObject *__pyx_v_self, PyObject *__pyx_arg_fd) {
1250 struct epoll_event __pyx_v_evt;
1251 PyObject *__pyx_r = NULL;
1252 __Pyx_RefNannyDeclarations
1253 PyObject *__pyx_t_1 = NULL;
1256 PyObject *__pyx_t_4 = NULL;
1257 PyObject *__pyx_t_5 = NULL;
1258 int __pyx_lineno = 0;
1259 const char *__pyx_filename = NULL;
1260 int __pyx_clineno = 0;
1261 __Pyx_RefNannySetupContext("unregister");
1262 assert(__pyx_arg_fd); {
1263 __pyx_v_fd = __Pyx_PyInt_AsInt(__pyx_arg_fd); if (unlikely((__pyx_v_fd == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1265 goto __pyx_L4_argument_unpacking_done;
1267 __Pyx_AddTraceback("twisted.python._epoll.epoll.unregister", __pyx_clineno, __pyx_lineno, __pyx_filename);
1268 __Pyx_RefNannyFinishContext();
1270 __pyx_L4_argument_unpacking_done:;
1272 /* "twisted/python/_epoll.pyx":183
1273 * cdef epoll_event evt
1274 * # We don't have to fill evt.events for CTL_DEL.
1275 * evt.data.fd = fd # <<<<<<<<<<<<<<
1276 * result = epoll_ctl(self.fd, CTL_DEL, fd, &evt)
1279 __pyx_v_evt.data.fd = __pyx_v_fd;
1281 /* "twisted/python/_epoll.pyx":184
1282 * # We don't have to fill evt.events for CTL_DEL.
1284 * result = epoll_ctl(self.fd, CTL_DEL, fd, &evt) # <<<<<<<<<<<<<<
1286 * raise IOError(errno, strerror(errno))
1288 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__CTL_DEL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1289 __Pyx_GOTREF(__pyx_t_1);
1290 __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1291 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1292 __pyx_v_result = epoll_ctl(((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd, __pyx_t_2, __pyx_v_fd, (&__pyx_v_evt));
1294 /* "twisted/python/_epoll.pyx":185
1296 * result = epoll_ctl(self.fd, CTL_DEL, fd, &evt)
1297 * if result == -1: # <<<<<<<<<<<<<<
1298 * raise IOError(errno, strerror(errno))
1301 __pyx_t_3 = (__pyx_v_result == -1);
1304 /* "twisted/python/_epoll.pyx":186
1305 * result = epoll_ctl(self.fd, CTL_DEL, fd, &evt)
1307 * raise IOError(errno, strerror(errno)) # <<<<<<<<<<<<<<
1309 * def modify(self, int fd, int events):
1311 __pyx_t_1 = PyInt_FromLong(errno); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1312 __Pyx_GOTREF(__pyx_t_1);
1313 __pyx_t_4 = PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1314 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
1315 __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1316 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
1317 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
1318 __Pyx_GIVEREF(__pyx_t_1);
1319 PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_t_4));
1320 __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
1323 __pyx_t_4 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1324 __Pyx_GOTREF(__pyx_t_4);
1325 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
1326 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
1327 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1328 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1333 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
1336 __Pyx_XDECREF(__pyx_t_1);
1337 __Pyx_XDECREF(__pyx_t_4);
1338 __Pyx_XDECREF(__pyx_t_5);
1339 __Pyx_AddTraceback("twisted.python._epoll.epoll.unregister", __pyx_clineno, __pyx_lineno, __pyx_filename);
1342 __Pyx_XGIVEREF(__pyx_r);
1343 __Pyx_RefNannyFinishContext();
1347 /* "twisted/python/_epoll.pyx":188
1348 * raise IOError(errno, strerror(errno))
1350 * def modify(self, int fd, int events): # <<<<<<<<<<<<<<
1352 * Modify the modified state of a file descriptor monitored by self.
1355 static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_6modify(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1356 static char __pyx_doc_7twisted_6python_6_epoll_5epoll_6modify[] = "\n Modify the modified state of a file descriptor monitored by self.\n\n This method is compatible with select.epoll.modify in Python 2.6.\n\n Wrap epoll_ctl(2).\n\n @type fd: C{int}\n @param fd: File descriptor to modify\n\n @type events: C{int}\n @param events: A bit set of IN, OUT, PRI, ERR, HUP, and ET.\n\n @raise IOError: Raised if the underlying epoll_ctl() call fails.\n ";
1357 static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_6modify(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1361 struct epoll_event __pyx_v_evt;
1362 PyObject *__pyx_r = NULL;
1363 __Pyx_RefNannyDeclarations
1364 PyObject *__pyx_t_1 = NULL;
1367 PyObject *__pyx_t_4 = NULL;
1368 PyObject *__pyx_t_5 = NULL;
1369 int __pyx_lineno = 0;
1370 const char *__pyx_filename = NULL;
1371 int __pyx_clineno = 0;
1372 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fd,&__pyx_n_s__events,0};
1373 __Pyx_RefNannySetupContext("modify");
1375 PyObject* values[2] = {0,0};
1376 if (unlikely(__pyx_kwds)) {
1378 switch (PyTuple_GET_SIZE(__pyx_args)) {
1379 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1380 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1382 default: goto __pyx_L5_argtuple_error;
1384 kw_args = PyDict_Size(__pyx_kwds);
1385 switch (PyTuple_GET_SIZE(__pyx_args)) {
1387 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fd);
1388 if (likely(values[0])) kw_args--;
1389 else goto __pyx_L5_argtuple_error;
1391 values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__events);
1392 if (likely(values[1])) kw_args--;
1394 __Pyx_RaiseArgtupleInvalid("modify", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1397 if (unlikely(kw_args > 0)) {
1398 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "modify") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1400 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
1401 goto __pyx_L5_argtuple_error;
1403 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1404 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1406 __pyx_v_fd = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_fd == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1407 __pyx_v_events = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_events == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1409 goto __pyx_L4_argument_unpacking_done;
1410 __pyx_L5_argtuple_error:;
1411 __Pyx_RaiseArgtupleInvalid("modify", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1413 __Pyx_AddTraceback("twisted.python._epoll.epoll.modify", __pyx_clineno, __pyx_lineno, __pyx_filename);
1414 __Pyx_RefNannyFinishContext();
1416 __pyx_L4_argument_unpacking_done:;
1418 /* "twisted/python/_epoll.pyx":206
1420 * cdef epoll_event evt
1421 * evt.events = events # <<<<<<<<<<<<<<
1423 * result = epoll_ctl(self.fd, CTL_MOD, fd, &evt)
1425 __pyx_v_evt.events = __pyx_v_events;
1427 /* "twisted/python/_epoll.pyx":207
1428 * cdef epoll_event evt
1429 * evt.events = events
1430 * evt.data.fd = fd # <<<<<<<<<<<<<<
1431 * result = epoll_ctl(self.fd, CTL_MOD, fd, &evt)
1434 __pyx_v_evt.data.fd = __pyx_v_fd;
1436 /* "twisted/python/_epoll.pyx":208
1437 * evt.events = events
1439 * result = epoll_ctl(self.fd, CTL_MOD, fd, &evt) # <<<<<<<<<<<<<<
1441 * raise IOError(errno, strerror(errno))
1443 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__CTL_MOD); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1444 __Pyx_GOTREF(__pyx_t_1);
1445 __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1446 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1447 __pyx_v_result = epoll_ctl(((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd, __pyx_t_2, __pyx_v_fd, (&__pyx_v_evt));
1449 /* "twisted/python/_epoll.pyx":209
1451 * result = epoll_ctl(self.fd, CTL_MOD, fd, &evt)
1452 * if result == -1: # <<<<<<<<<<<<<<
1453 * raise IOError(errno, strerror(errno))
1456 __pyx_t_3 = (__pyx_v_result == -1);
1459 /* "twisted/python/_epoll.pyx":210
1460 * result = epoll_ctl(self.fd, CTL_MOD, fd, &evt)
1462 * raise IOError(errno, strerror(errno)) # <<<<<<<<<<<<<<
1464 * def _control(self, int op, int fd, int events):
1466 __pyx_t_1 = PyInt_FromLong(errno); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1467 __Pyx_GOTREF(__pyx_t_1);
1468 __pyx_t_4 = PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1469 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
1470 __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1471 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
1472 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
1473 __Pyx_GIVEREF(__pyx_t_1);
1474 PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_t_4));
1475 __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
1478 __pyx_t_4 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1479 __Pyx_GOTREF(__pyx_t_4);
1480 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
1481 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
1482 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1483 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1488 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
1491 __Pyx_XDECREF(__pyx_t_1);
1492 __Pyx_XDECREF(__pyx_t_4);
1493 __Pyx_XDECREF(__pyx_t_5);
1494 __Pyx_AddTraceback("twisted.python._epoll.epoll.modify", __pyx_clineno, __pyx_lineno, __pyx_filename);
1497 __Pyx_XGIVEREF(__pyx_r);
1498 __Pyx_RefNannyFinishContext();
1502 /* "twisted/python/_epoll.pyx":212
1503 * raise IOError(errno, strerror(errno))
1505 * def _control(self, int op, int fd, int events): # <<<<<<<<<<<<<<
1507 * Modify the monitored state of a particular file descriptor.
1510 static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_7_control(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1511 static char __pyx_doc_7twisted_6python_6_epoll_5epoll_7_control[] = "\n Modify the monitored state of a particular file descriptor.\n \n Wrap epoll_ctl(2).\n\n @type op: C{int}\n @param op: One of CTL_ADD, CTL_DEL, or CTL_MOD\n\n @type fd: C{int}\n @param fd: File descriptor to modify\n\n @type events: C{int}\n @param events: A bit set of IN, OUT, PRI, ERR, HUP, and ET.\n\n @raise IOError: Raised if the underlying epoll_ctl() call fails.\n ";
1512 static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_7_control(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1517 struct epoll_event __pyx_v_evt;
1518 PyObject *__pyx_r = NULL;
1519 __Pyx_RefNannyDeclarations
1521 PyObject *__pyx_t_2 = NULL;
1522 PyObject *__pyx_t_3 = NULL;
1523 PyObject *__pyx_t_4 = NULL;
1524 int __pyx_lineno = 0;
1525 const char *__pyx_filename = NULL;
1526 int __pyx_clineno = 0;
1527 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__op,&__pyx_n_s__fd,&__pyx_n_s__events,0};
1528 __Pyx_RefNannySetupContext("_control");
1530 PyObject* values[3] = {0,0,0};
1531 if (unlikely(__pyx_kwds)) {
1533 switch (PyTuple_GET_SIZE(__pyx_args)) {
1534 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1535 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1536 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1538 default: goto __pyx_L5_argtuple_error;
1540 kw_args = PyDict_Size(__pyx_kwds);
1541 switch (PyTuple_GET_SIZE(__pyx_args)) {
1543 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__op);
1544 if (likely(values[0])) kw_args--;
1545 else goto __pyx_L5_argtuple_error;
1547 values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fd);
1548 if (likely(values[1])) kw_args--;
1550 __Pyx_RaiseArgtupleInvalid("_control", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1553 values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__events);
1554 if (likely(values[2])) kw_args--;
1556 __Pyx_RaiseArgtupleInvalid("_control", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1559 if (unlikely(kw_args > 0)) {
1560 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_control") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1562 } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
1563 goto __pyx_L5_argtuple_error;
1565 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1566 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1567 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1569 __pyx_v_op = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_op == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1570 __pyx_v_fd = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_fd == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1571 __pyx_v_events = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_events == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1573 goto __pyx_L4_argument_unpacking_done;
1574 __pyx_L5_argtuple_error:;
1575 __Pyx_RaiseArgtupleInvalid("_control", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1577 __Pyx_AddTraceback("twisted.python._epoll.epoll._control", __pyx_clineno, __pyx_lineno, __pyx_filename);
1578 __Pyx_RefNannyFinishContext();
1580 __pyx_L4_argument_unpacking_done:;
1582 /* "twisted/python/_epoll.pyx":231
1584 * cdef epoll_event evt
1585 * evt.events = events # <<<<<<<<<<<<<<
1587 * result = epoll_ctl(self.fd, op, fd, &evt)
1589 __pyx_v_evt.events = __pyx_v_events;
1591 /* "twisted/python/_epoll.pyx":232
1592 * cdef epoll_event evt
1593 * evt.events = events
1594 * evt.data.fd = fd # <<<<<<<<<<<<<<
1595 * result = epoll_ctl(self.fd, op, fd, &evt)
1598 __pyx_v_evt.data.fd = __pyx_v_fd;
1600 /* "twisted/python/_epoll.pyx":233
1601 * evt.events = events
1603 * result = epoll_ctl(self.fd, op, fd, &evt) # <<<<<<<<<<<<<<
1605 * raise IOError(errno, strerror(errno))
1607 __pyx_v_result = epoll_ctl(((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd, __pyx_v_op, __pyx_v_fd, (&__pyx_v_evt));
1609 /* "twisted/python/_epoll.pyx":234
1611 * result = epoll_ctl(self.fd, op, fd, &evt)
1612 * if result == -1: # <<<<<<<<<<<<<<
1613 * raise IOError(errno, strerror(errno))
1616 __pyx_t_1 = (__pyx_v_result == -1);
1619 /* "twisted/python/_epoll.pyx":235
1620 * result = epoll_ctl(self.fd, op, fd, &evt)
1622 * raise IOError(errno, strerror(errno)) # <<<<<<<<<<<<<<
1624 * def wait(self, unsigned int maxevents, int timeout):
1626 __pyx_t_2 = PyInt_FromLong(errno); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1627 __Pyx_GOTREF(__pyx_t_2);
1628 __pyx_t_3 = PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1629 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
1630 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1631 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
1632 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
1633 __Pyx_GIVEREF(__pyx_t_2);
1634 PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_t_3));
1635 __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
1638 __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1639 __Pyx_GOTREF(__pyx_t_3);
1640 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
1641 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
1642 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1643 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1648 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
1651 __Pyx_XDECREF(__pyx_t_2);
1652 __Pyx_XDECREF(__pyx_t_3);
1653 __Pyx_XDECREF(__pyx_t_4);
1654 __Pyx_AddTraceback("twisted.python._epoll.epoll._control", __pyx_clineno, __pyx_lineno, __pyx_filename);
1657 __Pyx_XGIVEREF(__pyx_r);
1658 __Pyx_RefNannyFinishContext();
1662 /* "twisted/python/_epoll.pyx":237
1663 * raise IOError(errno, strerror(errno))
1665 * def wait(self, unsigned int maxevents, int timeout): # <<<<<<<<<<<<<<
1667 * Wait for an I/O event, wrap epoll_wait(2).
1670 static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_8wait(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1671 static char __pyx_doc_7twisted_6python_6_epoll_5epoll_8wait[] = "\n Wait for an I/O event, wrap epoll_wait(2).\n\n @type maxevents: C{int}\n @param maxevents: Maximum number of events returned.\n\n @type timeout: C{int}\n @param timeout: Maximum time in milliseconds waiting for events. 0\n makes it return immediately whereas -1 makes it wait indefinitely.\n \n @raise IOError: Raised if the underlying epoll_wait() call fails.\n ";
1672 static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_8wait(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1673 unsigned int __pyx_v_maxevents;
1674 int __pyx_v_timeout;
1675 PyObject *__pyx_r = NULL;
1676 __Pyx_RefNannyDeclarations
1677 PyObject *__pyx_t_1 = NULL;
1678 int __pyx_lineno = 0;
1679 const char *__pyx_filename = NULL;
1680 int __pyx_clineno = 0;
1681 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__maxevents,&__pyx_n_s__timeout,0};
1682 __Pyx_RefNannySetupContext("wait");
1684 PyObject* values[2] = {0,0};
1685 if (unlikely(__pyx_kwds)) {
1687 switch (PyTuple_GET_SIZE(__pyx_args)) {
1688 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1689 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1691 default: goto __pyx_L5_argtuple_error;
1693 kw_args = PyDict_Size(__pyx_kwds);
1694 switch (PyTuple_GET_SIZE(__pyx_args)) {
1696 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__maxevents);
1697 if (likely(values[0])) kw_args--;
1698 else goto __pyx_L5_argtuple_error;
1700 values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__timeout);
1701 if (likely(values[1])) kw_args--;
1703 __Pyx_RaiseArgtupleInvalid("wait", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1706 if (unlikely(kw_args > 0)) {
1707 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "wait") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1709 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
1710 goto __pyx_L5_argtuple_error;
1712 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1713 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1715 __pyx_v_maxevents = __Pyx_PyInt_AsUnsignedInt(values[0]); if (unlikely((__pyx_v_maxevents == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1716 __pyx_v_timeout = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_timeout == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1718 goto __pyx_L4_argument_unpacking_done;
1719 __pyx_L5_argtuple_error:;
1720 __Pyx_RaiseArgtupleInvalid("wait", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1722 __Pyx_AddTraceback("twisted.python._epoll.epoll.wait", __pyx_clineno, __pyx_lineno, __pyx_filename);
1723 __Pyx_RefNannyFinishContext();
1725 __pyx_L4_argument_unpacking_done:;
1727 /* "twisted/python/_epoll.pyx":250
1728 * @raise IOError: Raised if the underlying epoll_wait() call fails.
1730 * return call_epoll_wait(self.fd, maxevents, timeout) # <<<<<<<<<<<<<<
1732 * def poll(self, float timeout=-1, unsigned int maxevents=1024):
1734 __Pyx_XDECREF(__pyx_r);
1735 __pyx_t_1 = __pyx_f_7twisted_6python_6_epoll_call_epoll_wait(((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd, __pyx_v_maxevents, __pyx_v_timeout); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1736 __Pyx_GOTREF(__pyx_t_1);
1737 __pyx_r = __pyx_t_1;
1741 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
1744 __Pyx_XDECREF(__pyx_t_1);
1745 __Pyx_AddTraceback("twisted.python._epoll.epoll.wait", __pyx_clineno, __pyx_lineno, __pyx_filename);
1748 __Pyx_XGIVEREF(__pyx_r);
1749 __Pyx_RefNannyFinishContext();
1753 /* "twisted/python/_epoll.pyx":252
1754 * return call_epoll_wait(self.fd, maxevents, timeout)
1756 * def poll(self, float timeout=-1, unsigned int maxevents=1024): # <<<<<<<<<<<<<<
1758 * Wait for an I/O event, wrap epoll_wait(2).
1761 static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_9poll(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1762 static char __pyx_doc_7twisted_6python_6_epoll_5epoll_9poll[] = "\n Wait for an I/O event, wrap epoll_wait(2).\n\n This method is compatible with select.epoll.poll in Python 2.6.\n\n @type maxevents: C{int}\n @param maxevents: Maximum number of events returned.\n\n @type timeout: C{int}\n @param timeout: Maximum time waiting for events. 0 makes it return\n immediately whereas -1 makes it wait indefinitely.\n \n @raise IOError: Raised if the underlying epoll_wait() call fails.\n ";
1763 static PyObject *__pyx_pf_7twisted_6python_6_epoll_5epoll_9poll(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1764 float __pyx_v_timeout;
1765 unsigned int __pyx_v_maxevents;
1766 PyObject *__pyx_r = NULL;
1767 __Pyx_RefNannyDeclarations
1768 PyObject *__pyx_t_1 = NULL;
1769 int __pyx_lineno = 0;
1770 const char *__pyx_filename = NULL;
1771 int __pyx_clineno = 0;
1772 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__timeout,&__pyx_n_s__maxevents,0};
1773 __Pyx_RefNannySetupContext("poll");
1775 PyObject* values[2] = {0,0};
1776 if (unlikely(__pyx_kwds)) {
1778 switch (PyTuple_GET_SIZE(__pyx_args)) {
1779 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1780 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1782 default: goto __pyx_L5_argtuple_error;
1784 kw_args = PyDict_Size(__pyx_kwds);
1785 switch (PyTuple_GET_SIZE(__pyx_args)) {
1788 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__timeout);
1789 if (value) { values[0] = value; kw_args--; }
1793 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__maxevents);
1794 if (value) { values[1] = value; kw_args--; }
1797 if (unlikely(kw_args > 0)) {
1798 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "poll") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1801 switch (PyTuple_GET_SIZE(__pyx_args)) {
1802 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1803 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1805 default: goto __pyx_L5_argtuple_error;
1809 __pyx_v_timeout = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_timeout == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1811 __pyx_v_timeout = ((float)-1.0);
1814 __pyx_v_maxevents = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_maxevents == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1816 __pyx_v_maxevents = ((unsigned int)1024);
1819 goto __pyx_L4_argument_unpacking_done;
1820 __pyx_L5_argtuple_error:;
1821 __Pyx_RaiseArgtupleInvalid("poll", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1823 __Pyx_AddTraceback("twisted.python._epoll.epoll.poll", __pyx_clineno, __pyx_lineno, __pyx_filename);
1824 __Pyx_RefNannyFinishContext();
1826 __pyx_L4_argument_unpacking_done:;
1828 /* "twisted/python/_epoll.pyx":267
1829 * @raise IOError: Raised if the underlying epoll_wait() call fails.
1831 * return call_epoll_wait(self.fd, maxevents, <int>(timeout * 1000.0)) # <<<<<<<<<<<<<<
1835 __Pyx_XDECREF(__pyx_r);
1836 __pyx_t_1 = __pyx_f_7twisted_6python_6_epoll_call_epoll_wait(((struct __pyx_obj_7twisted_6python_6_epoll_epoll *)__pyx_v_self)->fd, __pyx_v_maxevents, ((int)(__pyx_v_timeout * 1000.0))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1837 __Pyx_GOTREF(__pyx_t_1);
1838 __pyx_r = __pyx_t_1;
1842 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
1845 __Pyx_XDECREF(__pyx_t_1);
1846 __Pyx_AddTraceback("twisted.python._epoll.epoll.poll", __pyx_clineno, __pyx_lineno, __pyx_filename);
1849 __Pyx_XGIVEREF(__pyx_r);
1850 __Pyx_RefNannyFinishContext();
1854 static PyObject *__pyx_tp_new_7twisted_6python_6_epoll_epoll(PyTypeObject *t, PyObject *a, PyObject *k) {
1855 PyObject *o = (*t->tp_alloc)(t, 0);
1860 static void __pyx_tp_dealloc_7twisted_6python_6_epoll_epoll(PyObject *o) {
1862 PyObject *etype, *eval, *etb;
1863 PyErr_Fetch(&etype, &eval, &etb);
1865 __pyx_pf_7twisted_6python_6_epoll_5epoll_1__dealloc__(o);
1866 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
1868 PyErr_Restore(etype, eval, etb);
1870 (*Py_TYPE(o)->tp_free)(o);
1873 static PyMethodDef __pyx_methods_7twisted_6python_6_epoll_epoll[] = {
1874 {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pf_7twisted_6python_6_epoll_5epoll_2close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_7twisted_6python_6_epoll_5epoll_2close)},
1875 {__Pyx_NAMESTR("fileno"), (PyCFunction)__pyx_pf_7twisted_6python_6_epoll_5epoll_3fileno, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_7twisted_6python_6_epoll_5epoll_3fileno)},
1876 {__Pyx_NAMESTR("register"), (PyCFunction)__pyx_pf_7twisted_6python_6_epoll_5epoll_4register, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7twisted_6python_6_epoll_5epoll_4register)},
1877 {__Pyx_NAMESTR("unregister"), (PyCFunction)__pyx_pf_7twisted_6python_6_epoll_5epoll_5unregister, METH_O, __Pyx_DOCSTR(__pyx_doc_7twisted_6python_6_epoll_5epoll_5unregister)},
1878 {__Pyx_NAMESTR("modify"), (PyCFunction)__pyx_pf_7twisted_6python_6_epoll_5epoll_6modify, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7twisted_6python_6_epoll_5epoll_6modify)},
1879 {__Pyx_NAMESTR("_control"), (PyCFunction)__pyx_pf_7twisted_6python_6_epoll_5epoll_7_control, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7twisted_6python_6_epoll_5epoll_7_control)},
1880 {__Pyx_NAMESTR("wait"), (PyCFunction)__pyx_pf_7twisted_6python_6_epoll_5epoll_8wait, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7twisted_6python_6_epoll_5epoll_8wait)},
1881 {__Pyx_NAMESTR("poll"), (PyCFunction)__pyx_pf_7twisted_6python_6_epoll_5epoll_9poll, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7twisted_6python_6_epoll_5epoll_9poll)},
1885 static PyNumberMethods __pyx_tp_as_number_epoll = {
1889 #if PY_MAJOR_VERSION < 3
1905 #if PY_MAJOR_VERSION < 3
1909 #if PY_MAJOR_VERSION < 3
1915 #if PY_MAJOR_VERSION < 3
1918 #if PY_MAJOR_VERSION < 3
1921 0, /*nb_inplace_add*/
1922 0, /*nb_inplace_subtract*/
1923 0, /*nb_inplace_multiply*/
1924 #if PY_MAJOR_VERSION < 3
1925 0, /*nb_inplace_divide*/
1927 0, /*nb_inplace_remainder*/
1928 0, /*nb_inplace_power*/
1929 0, /*nb_inplace_lshift*/
1930 0, /*nb_inplace_rshift*/
1931 0, /*nb_inplace_and*/
1932 0, /*nb_inplace_xor*/
1933 0, /*nb_inplace_or*/
1934 0, /*nb_floor_divide*/
1935 0, /*nb_true_divide*/
1936 0, /*nb_inplace_floor_divide*/
1937 0, /*nb_inplace_true_divide*/
1938 #if PY_VERSION_HEX >= 0x02050000
1943 static PySequenceMethods __pyx_tp_as_sequence_epoll = {
1952 0, /*sq_inplace_concat*/
1953 0, /*sq_inplace_repeat*/
1956 static PyMappingMethods __pyx_tp_as_mapping_epoll = {
1959 0, /*mp_ass_subscript*/
1962 static PyBufferProcs __pyx_tp_as_buffer_epoll = {
1963 #if PY_MAJOR_VERSION < 3
1964 0, /*bf_getreadbuffer*/
1966 #if PY_MAJOR_VERSION < 3
1967 0, /*bf_getwritebuffer*/
1969 #if PY_MAJOR_VERSION < 3
1970 0, /*bf_getsegcount*/
1972 #if PY_MAJOR_VERSION < 3
1973 0, /*bf_getcharbuffer*/
1975 #if PY_VERSION_HEX >= 0x02060000
1978 #if PY_VERSION_HEX >= 0x02060000
1979 0, /*bf_releasebuffer*/
1983 static PyTypeObject __pyx_type_7twisted_6python_6_epoll_epoll = {
1984 PyVarObject_HEAD_INIT(0, 0)
1985 __Pyx_NAMESTR("twisted.python._epoll.epoll"), /*tp_name*/
1986 sizeof(struct __pyx_obj_7twisted_6python_6_epoll_epoll), /*tp_basicsize*/
1988 __pyx_tp_dealloc_7twisted_6python_6_epoll_epoll, /*tp_dealloc*/
1992 #if PY_MAJOR_VERSION < 3
1998 &__pyx_tp_as_number_epoll, /*tp_as_number*/
1999 &__pyx_tp_as_sequence_epoll, /*tp_as_sequence*/
2000 &__pyx_tp_as_mapping_epoll, /*tp_as_mapping*/
2006 &__pyx_tp_as_buffer_epoll, /*tp_as_buffer*/
2007 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
2008 __Pyx_DOCSTR("\n Represent a set of file descriptors being monitored for events.\n "), /*tp_doc*/
2011 0, /*tp_richcompare*/
2012 0, /*tp_weaklistoffset*/
2015 __pyx_methods_7twisted_6python_6_epoll_epoll, /*tp_methods*/
2022 0, /*tp_dictoffset*/
2023 __pyx_pf_7twisted_6python_6_epoll_5epoll___init__, /*tp_init*/
2025 __pyx_tp_new_7twisted_6python_6_epoll_epoll, /*tp_new*/
2031 0, /*tp_subclasses*/
2034 #if PY_VERSION_HEX >= 0x02060000
2035 0, /*tp_version_tag*/
2039 static PyMethodDef __pyx_methods[] = {
2043 #if PY_MAJOR_VERSION >= 3
2044 static struct PyModuleDef __pyx_moduledef = {
2045 PyModuleDef_HEAD_INIT,
2046 __Pyx_NAMESTR("_epoll"),
2047 __Pyx_DOCSTR(__pyx_k_1), /* m_doc */
2049 __pyx_methods /* m_methods */,
2050 NULL, /* m_reload */
2051 NULL, /* m_traverse */
2057 static __Pyx_StringTabEntry __pyx_string_tab[] = {
2058 {&__pyx_n_s__CTL_ADD, __pyx_k__CTL_ADD, sizeof(__pyx_k__CTL_ADD), 0, 0, 1, 1},
2059 {&__pyx_n_s__CTL_DEL, __pyx_k__CTL_DEL, sizeof(__pyx_k__CTL_DEL), 0, 0, 1, 1},
2060 {&__pyx_n_s__CTL_MOD, __pyx_k__CTL_MOD, sizeof(__pyx_k__CTL_MOD), 0, 0, 1, 1},
2061 {&__pyx_n_s__EPOLLERR, __pyx_k__EPOLLERR, sizeof(__pyx_k__EPOLLERR), 0, 0, 1, 1},
2062 {&__pyx_n_s__EPOLLET, __pyx_k__EPOLLET, sizeof(__pyx_k__EPOLLET), 0, 0, 1, 1},
2063 {&__pyx_n_s__EPOLLHUP, __pyx_k__EPOLLHUP, sizeof(__pyx_k__EPOLLHUP), 0, 0, 1, 1},
2064 {&__pyx_n_s__EPOLLIN, __pyx_k__EPOLLIN, sizeof(__pyx_k__EPOLLIN), 0, 0, 1, 1},
2065 {&__pyx_n_s__EPOLLMSG, __pyx_k__EPOLLMSG, sizeof(__pyx_k__EPOLLMSG), 0, 0, 1, 1},
2066 {&__pyx_n_s__EPOLLOUT, __pyx_k__EPOLLOUT, sizeof(__pyx_k__EPOLLOUT), 0, 0, 1, 1},
2067 {&__pyx_n_s__EPOLLPRI, __pyx_k__EPOLLPRI, sizeof(__pyx_k__EPOLLPRI), 0, 0, 1, 1},
2068 {&__pyx_n_s__EPOLLRDBAND, __pyx_k__EPOLLRDBAND, sizeof(__pyx_k__EPOLLRDBAND), 0, 0, 1, 1},
2069 {&__pyx_n_s__EPOLLRDNORM, __pyx_k__EPOLLRDNORM, sizeof(__pyx_k__EPOLLRDNORM), 0, 0, 1, 1},
2070 {&__pyx_n_s__EPOLLWRBAND, __pyx_k__EPOLLWRBAND, sizeof(__pyx_k__EPOLLWRBAND), 0, 0, 1, 1},
2071 {&__pyx_n_s__EPOLLWRNORM, __pyx_k__EPOLLWRNORM, sizeof(__pyx_k__EPOLLWRNORM), 0, 0, 1, 1},
2072 {&__pyx_n_s__ERR, __pyx_k__ERR, sizeof(__pyx_k__ERR), 0, 0, 1, 1},
2073 {&__pyx_n_s__ET, __pyx_k__ET, sizeof(__pyx_k__ET), 0, 0, 1, 1},
2074 {&__pyx_n_s__HUP, __pyx_k__HUP, sizeof(__pyx_k__HUP), 0, 0, 1, 1},
2075 {&__pyx_n_s__IN, __pyx_k__IN, sizeof(__pyx_k__IN), 0, 0, 1, 1},
2076 {&__pyx_n_s__IOError, __pyx_k__IOError, sizeof(__pyx_k__IOError), 0, 0, 1, 1},
2077 {&__pyx_n_s__MSG, __pyx_k__MSG, sizeof(__pyx_k__MSG), 0, 0, 1, 1},
2078 {&__pyx_n_s__OUT, __pyx_k__OUT, sizeof(__pyx_k__OUT), 0, 0, 1, 1},
2079 {&__pyx_n_s__PRI, __pyx_k__PRI, sizeof(__pyx_k__PRI), 0, 0, 1, 1},
2080 {&__pyx_n_s__RDBAND, __pyx_k__RDBAND, sizeof(__pyx_k__RDBAND), 0, 0, 1, 1},
2081 {&__pyx_n_s__RDNORM, __pyx_k__RDNORM, sizeof(__pyx_k__RDNORM), 0, 0, 1, 1},
2082 {&__pyx_n_s__WRBAND, __pyx_k__WRBAND, sizeof(__pyx_k__WRBAND), 0, 0, 1, 1},
2083 {&__pyx_n_s__WRNORM, __pyx_k__WRNORM, sizeof(__pyx_k__WRNORM), 0, 0, 1, 1},
2084 {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
2085 {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
2086 {&__pyx_n_s__events, __pyx_k__events, sizeof(__pyx_k__events), 0, 0, 1, 1},
2087 {&__pyx_n_s__fd, __pyx_k__fd, sizeof(__pyx_k__fd), 0, 0, 1, 1},
2088 {&__pyx_n_s__maxevents, __pyx_k__maxevents, sizeof(__pyx_k__maxevents), 0, 0, 1, 1},
2089 {&__pyx_n_s__op, __pyx_k__op, sizeof(__pyx_k__op), 0, 0, 1, 1},
2090 {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1},
2091 {&__pyx_n_s__timeout, __pyx_k__timeout, sizeof(__pyx_k__timeout), 0, 0, 1, 1},
2092 {0, 0, 0, 0, 0, 0, 0}
2094 static int __Pyx_InitCachedBuiltins(void) {
2095 __pyx_builtin_IOError = __Pyx_GetName(__pyx_b, __pyx_n_s__IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2101 static int __Pyx_InitCachedConstants(void) {
2102 __Pyx_RefNannyDeclarations
2103 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants");
2104 __Pyx_RefNannyFinishContext();
2108 static int __Pyx_InitGlobals(void) {
2109 if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
2115 #if PY_MAJOR_VERSION < 3
2116 PyMODINIT_FUNC init_epoll(void); /*proto*/
2117 PyMODINIT_FUNC init_epoll(void)
2119 PyMODINIT_FUNC PyInit__epoll(void); /*proto*/
2120 PyMODINIT_FUNC PyInit__epoll(void)
2123 PyObject *__pyx_t_1 = NULL;
2124 __Pyx_RefNannyDeclarations
2126 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
2127 if (!__Pyx_RefNanny) {
2129 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
2130 if (!__Pyx_RefNanny)
2131 Py_FatalError("failed to import 'refnanny' module");
2134 __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__epoll(void)");
2135 if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2136 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2137 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2138 #ifdef __pyx_binding_PyCFunctionType_USED
2139 if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2141 /*--- Library function declarations ---*/
2142 /*--- Threads initialization code ---*/
2143 #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
2144 #ifdef WITH_THREAD /* Python build with threading support? */
2145 PyEval_InitThreads();
2148 /*--- Module creation code ---*/
2149 #if PY_MAJOR_VERSION < 3
2150 __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_epoll"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_1), 0, PYTHON_API_VERSION);
2152 __pyx_m = PyModule_Create(&__pyx_moduledef);
2154 if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
2155 #if PY_MAJOR_VERSION < 3
2158 __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
2159 if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
2160 if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
2161 /*--- Initialize various global constants etc. ---*/
2162 if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2163 if (__pyx_module_is_main_twisted__python___epoll) {
2164 if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
2166 /*--- Builtin init code ---*/
2167 if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2168 /*--- Constants init code ---*/
2169 if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2170 /*--- Global init code ---*/
2171 /*--- Variable export code ---*/
2172 /*--- Function export code ---*/
2173 /*--- Type init code ---*/
2174 if (PyType_Ready(&__pyx_type_7twisted_6python_6_epoll_epoll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2176 PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_7twisted_6python_6_epoll_epoll, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2177 if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
2178 __pyx_wrapperbase_7twisted_6python_6_epoll_5epoll___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
2179 __pyx_wrapperbase_7twisted_6python_6_epoll_5epoll___init__.doc = __pyx_doc_7twisted_6python_6_epoll_5epoll___init__;
2180 ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7twisted_6python_6_epoll_5epoll___init__;
2183 if (__Pyx_SetAttrString(__pyx_m, "epoll", (PyObject *)&__pyx_type_7twisted_6python_6_epoll_epoll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2184 __pyx_ptype_7twisted_6python_6_epoll_epoll = &__pyx_type_7twisted_6python_6_epoll_epoll;
2185 /*--- Type import code ---*/
2186 /*--- Variable import code ---*/
2187 /*--- Function import code ---*/
2188 /*--- Execution code ---*/
2190 /* "twisted/python/_epoll.pyx":270
2193 * CTL_ADD = EPOLL_CTL_ADD # <<<<<<<<<<<<<<
2194 * CTL_DEL = EPOLL_CTL_DEL
2195 * CTL_MOD = EPOLL_CTL_MOD
2197 __pyx_t_1 = PyInt_FromLong(EPOLL_CTL_ADD); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2198 __Pyx_GOTREF(__pyx_t_1);
2199 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__CTL_ADD, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2200 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2202 /* "twisted/python/_epoll.pyx":271
2204 * CTL_ADD = EPOLL_CTL_ADD
2205 * CTL_DEL = EPOLL_CTL_DEL # <<<<<<<<<<<<<<
2206 * CTL_MOD = EPOLL_CTL_MOD
2209 __pyx_t_1 = PyInt_FromLong(EPOLL_CTL_DEL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2210 __Pyx_GOTREF(__pyx_t_1);
2211 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__CTL_DEL, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2212 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2214 /* "twisted/python/_epoll.pyx":272
2215 * CTL_ADD = EPOLL_CTL_ADD
2216 * CTL_DEL = EPOLL_CTL_DEL
2217 * CTL_MOD = EPOLL_CTL_MOD # <<<<<<<<<<<<<<
2219 * IN = EPOLLIN = c_EPOLLIN
2221 __pyx_t_1 = PyInt_FromLong(EPOLL_CTL_MOD); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2222 __Pyx_GOTREF(__pyx_t_1);
2223 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__CTL_MOD, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2224 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2226 /* "twisted/python/_epoll.pyx":274
2227 * CTL_MOD = EPOLL_CTL_MOD
2229 * IN = EPOLLIN = c_EPOLLIN # <<<<<<<<<<<<<<
2230 * OUT = EPOLLOUT = c_EPOLLOUT
2231 * PRI = EPOLLPRI = c_EPOLLPRI
2233 __pyx_t_1 = PyInt_FromLong(EPOLLIN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2234 __Pyx_GOTREF(__pyx_t_1);
2235 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__IN, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2236 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2237 __pyx_t_1 = PyInt_FromLong(EPOLLIN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2238 __Pyx_GOTREF(__pyx_t_1);
2239 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EPOLLIN, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2240 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2242 /* "twisted/python/_epoll.pyx":275
2244 * IN = EPOLLIN = c_EPOLLIN
2245 * OUT = EPOLLOUT = c_EPOLLOUT # <<<<<<<<<<<<<<
2246 * PRI = EPOLLPRI = c_EPOLLPRI
2247 * ERR = EPOLLERR = c_EPOLLERR
2249 __pyx_t_1 = PyInt_FromLong(EPOLLOUT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2250 __Pyx_GOTREF(__pyx_t_1);
2251 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__OUT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2252 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2253 __pyx_t_1 = PyInt_FromLong(EPOLLOUT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2254 __Pyx_GOTREF(__pyx_t_1);
2255 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EPOLLOUT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2256 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2258 /* "twisted/python/_epoll.pyx":276
2259 * IN = EPOLLIN = c_EPOLLIN
2260 * OUT = EPOLLOUT = c_EPOLLOUT
2261 * PRI = EPOLLPRI = c_EPOLLPRI # <<<<<<<<<<<<<<
2262 * ERR = EPOLLERR = c_EPOLLERR
2263 * HUP = EPOLLHUP = c_EPOLLHUP
2265 __pyx_t_1 = PyInt_FromLong(EPOLLPRI); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2266 __Pyx_GOTREF(__pyx_t_1);
2267 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__PRI, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2268 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2269 __pyx_t_1 = PyInt_FromLong(EPOLLPRI); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2270 __Pyx_GOTREF(__pyx_t_1);
2271 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EPOLLPRI, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2272 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2274 /* "twisted/python/_epoll.pyx":277
2275 * OUT = EPOLLOUT = c_EPOLLOUT
2276 * PRI = EPOLLPRI = c_EPOLLPRI
2277 * ERR = EPOLLERR = c_EPOLLERR # <<<<<<<<<<<<<<
2278 * HUP = EPOLLHUP = c_EPOLLHUP
2279 * ET = EPOLLET = c_EPOLLET
2281 __pyx_t_1 = PyInt_FromLong(EPOLLERR); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2282 __Pyx_GOTREF(__pyx_t_1);
2283 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ERR, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2284 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2285 __pyx_t_1 = PyInt_FromLong(EPOLLERR); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2286 __Pyx_GOTREF(__pyx_t_1);
2287 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EPOLLERR, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2288 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2290 /* "twisted/python/_epoll.pyx":278
2291 * PRI = EPOLLPRI = c_EPOLLPRI
2292 * ERR = EPOLLERR = c_EPOLLERR
2293 * HUP = EPOLLHUP = c_EPOLLHUP # <<<<<<<<<<<<<<
2294 * ET = EPOLLET = c_EPOLLET
2297 __pyx_t_1 = PyInt_FromLong(EPOLLHUP); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2298 __Pyx_GOTREF(__pyx_t_1);
2299 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__HUP, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2300 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2301 __pyx_t_1 = PyInt_FromLong(EPOLLHUP); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2302 __Pyx_GOTREF(__pyx_t_1);
2303 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EPOLLHUP, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2304 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2306 /* "twisted/python/_epoll.pyx":279
2307 * ERR = EPOLLERR = c_EPOLLERR
2308 * HUP = EPOLLHUP = c_EPOLLHUP
2309 * ET = EPOLLET = c_EPOLLET # <<<<<<<<<<<<<<
2311 * RDNORM = EPOLLRDNORM = c_EPOLLRDNORM
2313 __pyx_t_1 = PyInt_FromLong(EPOLLET); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2314 __Pyx_GOTREF(__pyx_t_1);
2315 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ET, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2316 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2317 __pyx_t_1 = PyInt_FromLong(EPOLLET); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2318 __Pyx_GOTREF(__pyx_t_1);
2319 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EPOLLET, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2320 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2322 /* "twisted/python/_epoll.pyx":281
2323 * ET = EPOLLET = c_EPOLLET
2325 * RDNORM = EPOLLRDNORM = c_EPOLLRDNORM # <<<<<<<<<<<<<<
2326 * RDBAND = EPOLLRDBAND = c_EPOLLRDBAND
2327 * WRNORM = EPOLLWRNORM = c_EPOLLWRNORM
2329 __pyx_t_1 = PyInt_FromLong(EPOLLRDNORM); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2330 __Pyx_GOTREF(__pyx_t_1);
2331 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__RDNORM, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2332 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2333 __pyx_t_1 = PyInt_FromLong(EPOLLRDNORM); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2334 __Pyx_GOTREF(__pyx_t_1);
2335 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EPOLLRDNORM, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2336 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2338 /* "twisted/python/_epoll.pyx":282
2340 * RDNORM = EPOLLRDNORM = c_EPOLLRDNORM
2341 * RDBAND = EPOLLRDBAND = c_EPOLLRDBAND # <<<<<<<<<<<<<<
2342 * WRNORM = EPOLLWRNORM = c_EPOLLWRNORM
2343 * WRBAND = EPOLLWRBAND = c_EPOLLWRBAND
2345 __pyx_t_1 = PyInt_FromLong(EPOLLRDBAND); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2346 __Pyx_GOTREF(__pyx_t_1);
2347 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__RDBAND, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2348 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2349 __pyx_t_1 = PyInt_FromLong(EPOLLRDBAND); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2350 __Pyx_GOTREF(__pyx_t_1);
2351 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EPOLLRDBAND, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2352 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2354 /* "twisted/python/_epoll.pyx":283
2355 * RDNORM = EPOLLRDNORM = c_EPOLLRDNORM
2356 * RDBAND = EPOLLRDBAND = c_EPOLLRDBAND
2357 * WRNORM = EPOLLWRNORM = c_EPOLLWRNORM # <<<<<<<<<<<<<<
2358 * WRBAND = EPOLLWRBAND = c_EPOLLWRBAND
2359 * MSG = EPOLLMSG = c_EPOLLMSG
2361 __pyx_t_1 = PyInt_FromLong(EPOLLWRNORM); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2362 __Pyx_GOTREF(__pyx_t_1);
2363 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__WRNORM, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2364 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2365 __pyx_t_1 = PyInt_FromLong(EPOLLWRNORM); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2366 __Pyx_GOTREF(__pyx_t_1);
2367 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EPOLLWRNORM, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2368 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2370 /* "twisted/python/_epoll.pyx":284
2371 * RDBAND = EPOLLRDBAND = c_EPOLLRDBAND
2372 * WRNORM = EPOLLWRNORM = c_EPOLLWRNORM
2373 * WRBAND = EPOLLWRBAND = c_EPOLLWRBAND # <<<<<<<<<<<<<<
2374 * MSG = EPOLLMSG = c_EPOLLMSG
2376 __pyx_t_1 = PyInt_FromLong(EPOLLWRBAND); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2377 __Pyx_GOTREF(__pyx_t_1);
2378 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__WRBAND, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2379 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2380 __pyx_t_1 = PyInt_FromLong(EPOLLWRBAND); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2381 __Pyx_GOTREF(__pyx_t_1);
2382 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EPOLLWRBAND, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2383 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2385 /* "twisted/python/_epoll.pyx":285
2386 * WRNORM = EPOLLWRNORM = c_EPOLLWRNORM
2387 * WRBAND = EPOLLWRBAND = c_EPOLLWRBAND
2388 * MSG = EPOLLMSG = c_EPOLLMSG # <<<<<<<<<<<<<<
2390 __pyx_t_1 = PyInt_FromLong(EPOLLMSG); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2391 __Pyx_GOTREF(__pyx_t_1);
2392 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__MSG, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2393 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2394 __pyx_t_1 = PyInt_FromLong(EPOLLMSG); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2395 __Pyx_GOTREF(__pyx_t_1);
2396 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EPOLLMSG, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2397 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2399 /* "twisted/python/_epoll.pyx":1
2400 * # Copyright (c) Twisted Matrix Laboratories. # <<<<<<<<<<<<<<
2401 * # See LICENSE for details.
2404 __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2405 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
2406 if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2407 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
2410 __Pyx_XDECREF(__pyx_t_1);
2412 __Pyx_AddTraceback("init twisted.python._epoll", __pyx_clineno, __pyx_lineno, __pyx_filename);
2413 Py_DECREF(__pyx_m); __pyx_m = 0;
2414 } else if (!PyErr_Occurred()) {
2415 PyErr_SetString(PyExc_ImportError, "init twisted.python._epoll");
2418 __Pyx_RefNannyFinishContext();
2419 #if PY_MAJOR_VERSION < 3
2426 /* Runtime support code */
2429 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
2430 PyObject *m = NULL, *p = NULL;
2432 m = PyImport_ImportModule((char *)modname);
2434 p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
2436 r = PyLong_AsVoidPtr(p);
2440 return (__Pyx_RefNannyAPIStruct *)r;
2442 #endif /* CYTHON_REFNANNY */
2444 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
2446 result = PyObject_GetAttr(dict, name);
2448 if (dict != __pyx_b) {
2450 result = PyObject_GetAttr(__pyx_b, name);
2453 PyErr_SetObject(PyExc_NameError, name);
2459 static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
2460 PyObject *tmp_type, *tmp_value, *tmp_tb;
2461 PyThreadState *tstate = PyThreadState_GET();
2463 tmp_type = tstate->curexc_type;
2464 tmp_value = tstate->curexc_value;
2465 tmp_tb = tstate->curexc_traceback;
2466 tstate->curexc_type = type;
2467 tstate->curexc_value = value;
2468 tstate->curexc_traceback = tb;
2469 Py_XDECREF(tmp_type);
2470 Py_XDECREF(tmp_value);
2474 static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
2475 PyThreadState *tstate = PyThreadState_GET();
2476 *type = tstate->curexc_type;
2477 *value = tstate->curexc_value;
2478 *tb = tstate->curexc_traceback;
2480 tstate->curexc_type = 0;
2481 tstate->curexc_value = 0;
2482 tstate->curexc_traceback = 0;
2486 #if PY_MAJOR_VERSION < 3
2487 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
2488 /* cause is unused */
2492 /* First, check the traceback argument, replacing None with NULL. */
2493 if (tb == Py_None) {
2497 else if (tb != NULL && !PyTraceBack_Check(tb)) {
2498 PyErr_SetString(PyExc_TypeError,
2499 "raise: arg 3 must be a traceback or None");
2502 /* Next, replace a missing value with None */
2503 if (value == NULL) {
2507 #if PY_VERSION_HEX < 0x02050000
2508 if (!PyClass_Check(type))
2510 if (!PyType_Check(type))
2513 /* Raising an instance. The value should be a dummy. */
2514 if (value != Py_None) {
2515 PyErr_SetString(PyExc_TypeError,
2516 "instance exception may not have a separate value");
2519 /* Normalize to raise <class>, <instance> */
2522 #if PY_VERSION_HEX < 0x02050000
2523 if (PyInstance_Check(type)) {
2524 type = (PyObject*) ((PyInstanceObject*)type)->in_class;
2529 PyErr_SetString(PyExc_TypeError,
2530 "raise: exception must be an old-style class or instance");
2534 type = (PyObject*) Py_TYPE(type);
2536 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
2537 PyErr_SetString(PyExc_TypeError,
2538 "raise: exception class must be a subclass of BaseException");
2544 __Pyx_ErrRestore(type, value, tb);
2553 #else /* Python 3+ */
2555 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
2556 if (tb == Py_None) {
2558 } else if (tb && !PyTraceBack_Check(tb)) {
2559 PyErr_SetString(PyExc_TypeError,
2560 "raise: arg 3 must be a traceback or None");
2563 if (value == Py_None)
2566 if (PyExceptionInstance_Check(type)) {
2568 PyErr_SetString(PyExc_TypeError,
2569 "instance exception may not have a separate value");
2573 type = (PyObject*) Py_TYPE(value);
2574 } else if (!PyExceptionClass_Check(type)) {
2575 PyErr_SetString(PyExc_TypeError,
2576 "raise: exception class must be a subclass of BaseException");
2581 PyObject *fixed_cause;
2582 if (PyExceptionClass_Check(cause)) {
2583 fixed_cause = PyObject_CallObject(cause, NULL);
2584 if (fixed_cause == NULL)
2587 else if (PyExceptionInstance_Check(cause)) {
2588 fixed_cause = cause;
2589 Py_INCREF(fixed_cause);
2592 PyErr_SetString(PyExc_TypeError,
2593 "exception causes must derive from "
2598 value = PyObject_CallObject(type, NULL);
2600 PyException_SetCause(value, fixed_cause);
2603 PyErr_SetObject(type, value);
2606 PyThreadState *tstate = PyThreadState_GET();
2607 PyObject* tmp_tb = tstate->curexc_traceback;
2610 tstate->curexc_traceback = tb;
2620 static void __Pyx_RaiseDoubleKeywordsError(
2621 const char* func_name,
2624 PyErr_Format(PyExc_TypeError,
2625 #if PY_MAJOR_VERSION >= 3
2626 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
2628 "%s() got multiple values for keyword argument '%s'", func_name,
2629 PyString_AS_STRING(kw_name));
2633 static int __Pyx_ParseOptionalKeywords(
2635 PyObject **argnames[],
2638 Py_ssize_t num_pos_args,
2639 const char* function_name)
2641 PyObject *key = 0, *value = 0;
2644 PyObject*** first_kw_arg = argnames + num_pos_args;
2646 while (PyDict_Next(kwds, &pos, &key, &value)) {
2647 name = first_kw_arg;
2648 while (*name && (**name != key)) name++;
2650 values[name-argnames] = value;
2652 #if PY_MAJOR_VERSION < 3
2653 if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
2655 if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
2657 goto invalid_keyword_type;
2659 for (name = first_kw_arg; *name; name++) {
2660 #if PY_MAJOR_VERSION >= 3
2661 if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
2662 PyUnicode_Compare(**name, key) == 0) break;
2664 if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
2665 _PyString_Eq(**name, key)) break;
2669 values[name-argnames] = value;
2671 /* unexpected keyword found */
2672 for (name=argnames; name != first_kw_arg; name++) {
2673 if (**name == key) goto arg_passed_twice;
2674 #if PY_MAJOR_VERSION >= 3
2675 if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
2676 PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
2678 if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
2679 _PyString_Eq(**name, key)) goto arg_passed_twice;
2683 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
2685 goto invalid_keyword;
2693 __Pyx_RaiseDoubleKeywordsError(function_name, **name);
2695 invalid_keyword_type:
2696 PyErr_Format(PyExc_TypeError,
2697 "%s() keywords must be strings", function_name);
2700 PyErr_Format(PyExc_TypeError,
2701 #if PY_MAJOR_VERSION < 3
2702 "%s() got an unexpected keyword argument '%s'",
2703 function_name, PyString_AsString(key));
2705 "%s() got an unexpected keyword argument '%U'",
2706 function_name, key);
2712 static void __Pyx_RaiseArgtupleInvalid(
2713 const char* func_name,
2717 Py_ssize_t num_found)
2719 Py_ssize_t num_expected;
2720 const char *more_or_less;
2722 if (num_found < num_min) {
2723 num_expected = num_min;
2724 more_or_less = "at least";
2726 num_expected = num_max;
2727 more_or_less = "at most";
2730 more_or_less = "exactly";
2732 PyErr_Format(PyExc_TypeError,
2733 "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)",
2734 func_name, more_or_less, num_expected,
2735 (num_expected == 1) ? "" : "s", num_found);
2738 static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
2739 const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
2740 const int is_unsigned = neg_one > const_zero;
2741 if (sizeof(unsigned char) < sizeof(long)) {
2742 long val = __Pyx_PyInt_AsLong(x);
2743 if (unlikely(val != (long)(unsigned char)val)) {
2744 if (!unlikely(val == -1 && PyErr_Occurred())) {
2745 PyErr_SetString(PyExc_OverflowError,
2746 (is_unsigned && unlikely(val < 0)) ?
2747 "can't convert negative value to unsigned char" :
2748 "value too large to convert to unsigned char");
2750 return (unsigned char)-1;
2752 return (unsigned char)val;
2754 return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
2757 static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
2758 const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
2759 const int is_unsigned = neg_one > const_zero;
2760 if (sizeof(unsigned short) < sizeof(long)) {
2761 long val = __Pyx_PyInt_AsLong(x);
2762 if (unlikely(val != (long)(unsigned short)val)) {
2763 if (!unlikely(val == -1 && PyErr_Occurred())) {
2764 PyErr_SetString(PyExc_OverflowError,
2765 (is_unsigned && unlikely(val < 0)) ?
2766 "can't convert negative value to unsigned short" :
2767 "value too large to convert to unsigned short");
2769 return (unsigned short)-1;
2771 return (unsigned short)val;
2773 return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
2776 static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
2777 const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
2778 const int is_unsigned = neg_one > const_zero;
2779 if (sizeof(unsigned int) < sizeof(long)) {
2780 long val = __Pyx_PyInt_AsLong(x);
2781 if (unlikely(val != (long)(unsigned int)val)) {
2782 if (!unlikely(val == -1 && PyErr_Occurred())) {
2783 PyErr_SetString(PyExc_OverflowError,
2784 (is_unsigned && unlikely(val < 0)) ?
2785 "can't convert negative value to unsigned int" :
2786 "value too large to convert to unsigned int");
2788 return (unsigned int)-1;
2790 return (unsigned int)val;
2792 return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
2795 static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
2796 const char neg_one = (char)-1, const_zero = 0;
2797 const int is_unsigned = neg_one > const_zero;
2798 if (sizeof(char) < sizeof(long)) {
2799 long val = __Pyx_PyInt_AsLong(x);
2800 if (unlikely(val != (long)(char)val)) {
2801 if (!unlikely(val == -1 && PyErr_Occurred())) {
2802 PyErr_SetString(PyExc_OverflowError,
2803 (is_unsigned && unlikely(val < 0)) ?
2804 "can't convert negative value to char" :
2805 "value too large to convert to char");
2811 return (char)__Pyx_PyInt_AsLong(x);
2814 static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
2815 const short neg_one = (short)-1, const_zero = 0;
2816 const int is_unsigned = neg_one > const_zero;
2817 if (sizeof(short) < sizeof(long)) {
2818 long val = __Pyx_PyInt_AsLong(x);
2819 if (unlikely(val != (long)(short)val)) {
2820 if (!unlikely(val == -1 && PyErr_Occurred())) {
2821 PyErr_SetString(PyExc_OverflowError,
2822 (is_unsigned && unlikely(val < 0)) ?
2823 "can't convert negative value to short" :
2824 "value too large to convert to short");
2830 return (short)__Pyx_PyInt_AsLong(x);
2833 static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
2834 const int neg_one = (int)-1, const_zero = 0;
2835 const int is_unsigned = neg_one > const_zero;
2836 if (sizeof(int) < sizeof(long)) {
2837 long val = __Pyx_PyInt_AsLong(x);
2838 if (unlikely(val != (long)(int)val)) {
2839 if (!unlikely(val == -1 && PyErr_Occurred())) {
2840 PyErr_SetString(PyExc_OverflowError,
2841 (is_unsigned && unlikely(val < 0)) ?
2842 "can't convert negative value to int" :
2843 "value too large to convert to int");
2849 return (int)__Pyx_PyInt_AsLong(x);
2852 static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
2853 const signed char neg_one = (signed char)-1, const_zero = 0;
2854 const int is_unsigned = neg_one > const_zero;
2855 if (sizeof(signed char) < sizeof(long)) {
2856 long val = __Pyx_PyInt_AsLong(x);
2857 if (unlikely(val != (long)(signed char)val)) {
2858 if (!unlikely(val == -1 && PyErr_Occurred())) {
2859 PyErr_SetString(PyExc_OverflowError,
2860 (is_unsigned && unlikely(val < 0)) ?
2861 "can't convert negative value to signed char" :
2862 "value too large to convert to signed char");
2864 return (signed char)-1;
2866 return (signed char)val;
2868 return (signed char)__Pyx_PyInt_AsSignedLong(x);
2871 static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
2872 const signed short neg_one = (signed short)-1, const_zero = 0;
2873 const int is_unsigned = neg_one > const_zero;
2874 if (sizeof(signed short) < sizeof(long)) {
2875 long val = __Pyx_PyInt_AsLong(x);
2876 if (unlikely(val != (long)(signed short)val)) {
2877 if (!unlikely(val == -1 && PyErr_Occurred())) {
2878 PyErr_SetString(PyExc_OverflowError,
2879 (is_unsigned && unlikely(val < 0)) ?
2880 "can't convert negative value to signed short" :
2881 "value too large to convert to signed short");
2883 return (signed short)-1;
2885 return (signed short)val;
2887 return (signed short)__Pyx_PyInt_AsSignedLong(x);
2890 static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
2891 const signed int neg_one = (signed int)-1, const_zero = 0;
2892 const int is_unsigned = neg_one > const_zero;
2893 if (sizeof(signed int) < sizeof(long)) {
2894 long val = __Pyx_PyInt_AsLong(x);
2895 if (unlikely(val != (long)(signed int)val)) {
2896 if (!unlikely(val == -1 && PyErr_Occurred())) {
2897 PyErr_SetString(PyExc_OverflowError,
2898 (is_unsigned && unlikely(val < 0)) ?
2899 "can't convert negative value to signed int" :
2900 "value too large to convert to signed int");
2902 return (signed int)-1;
2904 return (signed int)val;
2906 return (signed int)__Pyx_PyInt_AsSignedLong(x);
2909 static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
2910 const int neg_one = (int)-1, const_zero = 0;
2911 const int is_unsigned = neg_one > const_zero;
2912 if (sizeof(int) < sizeof(long)) {
2913 long val = __Pyx_PyInt_AsLong(x);
2914 if (unlikely(val != (long)(int)val)) {
2915 if (!unlikely(val == -1 && PyErr_Occurred())) {
2916 PyErr_SetString(PyExc_OverflowError,
2917 (is_unsigned && unlikely(val < 0)) ?
2918 "can't convert negative value to int" :
2919 "value too large to convert to int");
2925 return (int)__Pyx_PyInt_AsLong(x);
2928 static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
2929 const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
2930 const int is_unsigned = neg_one > const_zero;
2931 #if PY_VERSION_HEX < 0x03000000
2932 if (likely(PyInt_Check(x))) {
2933 long val = PyInt_AS_LONG(x);
2934 if (is_unsigned && unlikely(val < 0)) {
2935 PyErr_SetString(PyExc_OverflowError,
2936 "can't convert negative value to unsigned long");
2937 return (unsigned long)-1;
2939 return (unsigned long)val;
2942 if (likely(PyLong_Check(x))) {
2944 if (unlikely(Py_SIZE(x) < 0)) {
2945 PyErr_SetString(PyExc_OverflowError,
2946 "can't convert negative value to unsigned long");
2947 return (unsigned long)-1;
2949 return (unsigned long)PyLong_AsUnsignedLong(x);
2951 return (unsigned long)PyLong_AsLong(x);
2955 PyObject *tmp = __Pyx_PyNumber_Int(x);
2956 if (!tmp) return (unsigned long)-1;
2957 val = __Pyx_PyInt_AsUnsignedLong(tmp);
2963 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
2964 const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
2965 const int is_unsigned = neg_one > const_zero;
2966 #if PY_VERSION_HEX < 0x03000000
2967 if (likely(PyInt_Check(x))) {
2968 long val = PyInt_AS_LONG(x);
2969 if (is_unsigned && unlikely(val < 0)) {
2970 PyErr_SetString(PyExc_OverflowError,
2971 "can't convert negative value to unsigned PY_LONG_LONG");
2972 return (unsigned PY_LONG_LONG)-1;
2974 return (unsigned PY_LONG_LONG)val;
2977 if (likely(PyLong_Check(x))) {
2979 if (unlikely(Py_SIZE(x) < 0)) {
2980 PyErr_SetString(PyExc_OverflowError,
2981 "can't convert negative value to unsigned PY_LONG_LONG");
2982 return (unsigned PY_LONG_LONG)-1;
2984 return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
2986 return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
2989 unsigned PY_LONG_LONG val;
2990 PyObject *tmp = __Pyx_PyNumber_Int(x);
2991 if (!tmp) return (unsigned PY_LONG_LONG)-1;
2992 val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
2998 static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
2999 const long neg_one = (long)-1, const_zero = 0;
3000 const int is_unsigned = neg_one > const_zero;
3001 #if PY_VERSION_HEX < 0x03000000
3002 if (likely(PyInt_Check(x))) {
3003 long val = PyInt_AS_LONG(x);
3004 if (is_unsigned && unlikely(val < 0)) {
3005 PyErr_SetString(PyExc_OverflowError,
3006 "can't convert negative value to long");
3012 if (likely(PyLong_Check(x))) {
3014 if (unlikely(Py_SIZE(x) < 0)) {
3015 PyErr_SetString(PyExc_OverflowError,
3016 "can't convert negative value to long");
3019 return (long)PyLong_AsUnsignedLong(x);
3021 return (long)PyLong_AsLong(x);
3025 PyObject *tmp = __Pyx_PyNumber_Int(x);
3026 if (!tmp) return (long)-1;
3027 val = __Pyx_PyInt_AsLong(tmp);
3033 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
3034 const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
3035 const int is_unsigned = neg_one > const_zero;
3036 #if PY_VERSION_HEX < 0x03000000
3037 if (likely(PyInt_Check(x))) {
3038 long val = PyInt_AS_LONG(x);
3039 if (is_unsigned && unlikely(val < 0)) {
3040 PyErr_SetString(PyExc_OverflowError,
3041 "can't convert negative value to PY_LONG_LONG");
3042 return (PY_LONG_LONG)-1;
3044 return (PY_LONG_LONG)val;
3047 if (likely(PyLong_Check(x))) {
3049 if (unlikely(Py_SIZE(x) < 0)) {
3050 PyErr_SetString(PyExc_OverflowError,
3051 "can't convert negative value to PY_LONG_LONG");
3052 return (PY_LONG_LONG)-1;
3054 return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
3056 return (PY_LONG_LONG)PyLong_AsLongLong(x);
3060 PyObject *tmp = __Pyx_PyNumber_Int(x);
3061 if (!tmp) return (PY_LONG_LONG)-1;
3062 val = __Pyx_PyInt_AsLongLong(tmp);
3068 static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
3069 const signed long neg_one = (signed long)-1, const_zero = 0;
3070 const int is_unsigned = neg_one > const_zero;
3071 #if PY_VERSION_HEX < 0x03000000
3072 if (likely(PyInt_Check(x))) {
3073 long val = PyInt_AS_LONG(x);
3074 if (is_unsigned && unlikely(val < 0)) {
3075 PyErr_SetString(PyExc_OverflowError,
3076 "can't convert negative value to signed long");
3077 return (signed long)-1;
3079 return (signed long)val;
3082 if (likely(PyLong_Check(x))) {
3084 if (unlikely(Py_SIZE(x) < 0)) {
3085 PyErr_SetString(PyExc_OverflowError,
3086 "can't convert negative value to signed long");
3087 return (signed long)-1;
3089 return (signed long)PyLong_AsUnsignedLong(x);
3091 return (signed long)PyLong_AsLong(x);
3095 PyObject *tmp = __Pyx_PyNumber_Int(x);
3096 if (!tmp) return (signed long)-1;
3097 val = __Pyx_PyInt_AsSignedLong(tmp);
3103 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
3104 const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
3105 const int is_unsigned = neg_one > const_zero;
3106 #if PY_VERSION_HEX < 0x03000000
3107 if (likely(PyInt_Check(x))) {
3108 long val = PyInt_AS_LONG(x);
3109 if (is_unsigned && unlikely(val < 0)) {
3110 PyErr_SetString(PyExc_OverflowError,
3111 "can't convert negative value to signed PY_LONG_LONG");
3112 return (signed PY_LONG_LONG)-1;
3114 return (signed PY_LONG_LONG)val;
3117 if (likely(PyLong_Check(x))) {
3119 if (unlikely(Py_SIZE(x) < 0)) {
3120 PyErr_SetString(PyExc_OverflowError,
3121 "can't convert negative value to signed PY_LONG_LONG");
3122 return (signed PY_LONG_LONG)-1;
3124 return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
3126 return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
3129 signed PY_LONG_LONG val;
3130 PyObject *tmp = __Pyx_PyNumber_Int(x);
3131 if (!tmp) return (signed PY_LONG_LONG)-1;
3132 val = __Pyx_PyInt_AsSignedLongLong(tmp);
3138 static int __Pyx_check_binary_version(void) {
3139 char ctversion[4], rtversion[4];
3140 PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
3141 PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
3142 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
3144 PyOS_snprintf(message, sizeof(message),
3145 "compiletime version %s of module '%.100s' "
3146 "does not match runtime version %s",
3147 ctversion, __Pyx_MODULE_NAME, rtversion);
3148 #if PY_VERSION_HEX < 0x02050000
3149 return PyErr_Warn(NULL, message);
3151 return PyErr_WarnEx(NULL, message, 1);
3157 #include "compile.h"
3158 #include "frameobject.h"
3159 #include "traceback.h"
3161 static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
3162 int __pyx_lineno, const char *__pyx_filename) {
3163 PyObject *py_srcfile = 0;
3164 PyObject *py_funcname = 0;
3165 PyObject *py_globals = 0;
3166 PyCodeObject *py_code = 0;
3167 PyFrameObject *py_frame = 0;
3169 #if PY_MAJOR_VERSION < 3
3170 py_srcfile = PyString_FromString(__pyx_filename);
3172 py_srcfile = PyUnicode_FromString(__pyx_filename);
3174 if (!py_srcfile) goto bad;
3175 if (__pyx_clineno) {
3176 #if PY_MAJOR_VERSION < 3
3177 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
3179 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
3183 #if PY_MAJOR_VERSION < 3
3184 py_funcname = PyString_FromString(funcname);
3186 py_funcname = PyUnicode_FromString(funcname);
3189 if (!py_funcname) goto bad;
3190 py_globals = PyModule_GetDict(__pyx_m);
3191 if (!py_globals) goto bad;
3192 py_code = PyCode_New(
3193 0, /*int argcount,*/
3194 #if PY_MAJOR_VERSION >= 3
3195 0, /*int kwonlyargcount,*/
3198 0, /*int stacksize,*/
3200 __pyx_empty_bytes, /*PyObject *code,*/
3201 __pyx_empty_tuple, /*PyObject *consts,*/
3202 __pyx_empty_tuple, /*PyObject *names,*/
3203 __pyx_empty_tuple, /*PyObject *varnames,*/
3204 __pyx_empty_tuple, /*PyObject *freevars,*/
3205 __pyx_empty_tuple, /*PyObject *cellvars,*/
3206 py_srcfile, /*PyObject *filename,*/
3207 py_funcname, /*PyObject *name,*/
3208 __pyx_lineno, /*int firstlineno,*/
3209 __pyx_empty_bytes /*PyObject *lnotab*/
3211 if (!py_code) goto bad;
3212 py_frame = PyFrame_New(
3213 PyThreadState_GET(), /*PyThreadState *tstate,*/
3214 py_code, /*PyCodeObject *code,*/
3215 py_globals, /*PyObject *globals,*/
3216 0 /*PyObject *locals*/
3218 if (!py_frame) goto bad;
3219 py_frame->f_lineno = __pyx_lineno;
3220 PyTraceBack_Here(py_frame);
3222 Py_XDECREF(py_srcfile);
3223 Py_XDECREF(py_funcname);
3224 Py_XDECREF(py_code);
3225 Py_XDECREF(py_frame);
3228 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
3230 #if PY_MAJOR_VERSION < 3
3231 if (t->is_unicode) {
3232 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
3233 } else if (t->intern) {
3234 *t->p = PyString_InternFromString(t->s);
3236 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
3238 #else /* Python 3+ has unicode identifiers */
3239 if (t->is_unicode | t->is_str) {
3241 *t->p = PyUnicode_InternFromString(t->s);
3242 } else if (t->encoding) {
3243 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
3245 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
3248 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
3258 /* Type Conversion Functions */
3260 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
3261 int is_true = x == Py_True;
3262 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
3263 else return PyObject_IsTrue(x);
3266 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
3268 const char *name = NULL;
3269 PyObject *res = NULL;
3270 #if PY_VERSION_HEX < 0x03000000
3271 if (PyInt_Check(x) || PyLong_Check(x))
3273 if (PyLong_Check(x))
3275 return Py_INCREF(x), x;
3276 m = Py_TYPE(x)->tp_as_number;
3277 #if PY_VERSION_HEX < 0x03000000
3278 if (m && m->nb_int) {
3280 res = PyNumber_Int(x);
3282 else if (m && m->nb_long) {
3284 res = PyNumber_Long(x);
3287 if (m && m->nb_int) {
3289 res = PyNumber_Long(x);
3293 #if PY_VERSION_HEX < 0x03000000
3294 if (!PyInt_Check(res) && !PyLong_Check(res)) {
3296 if (!PyLong_Check(res)) {
3298 PyErr_Format(PyExc_TypeError,
3299 "__%s__ returned non-%s (type %.200s)",
3300 name, name, Py_TYPE(res)->tp_name);
3305 else if (!PyErr_Occurred()) {
3306 PyErr_SetString(PyExc_TypeError,
3307 "an integer is required");
3312 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
3314 PyObject* x = PyNumber_Index(b);
3316 ival = PyInt_AsSsize_t(x);
3321 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
3322 #if PY_VERSION_HEX < 0x02050000
3323 if (ival <= LONG_MAX)
3324 return PyInt_FromLong((long)ival);
3326 unsigned char *bytes = (unsigned char *) &ival;
3327 int one = 1; int little = (int)*(unsigned char*)&one;
3328 return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
3331 return PyInt_FromSize_t(ival);
3335 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
3336 unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
3337 if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
3339 } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
3340 PyErr_SetString(PyExc_OverflowError,
3341 "value too large to convert to size_t");
3348 #endif /* Py_PYTHON_H */