Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: third_party/twisted_8_1/twisted/python/_epoll.c

Issue 12261012: Remove third_party/twisted_8_1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /* Generated by Pyrex 0.9.4.1 on Sun Oct 15 15:04:09 2006 */
2
3 #define PY_SSIZE_T_CLEAN
4 #include "Python.h"
5 #include "structmember.h"
6 #ifndef PY_LONG_LONG
7 #define PY_LONG_LONG LONG_LONG
8 #endif
9 #if PY_VERSION_HEX < 0x02050000
10 typedef int Py_ssize_t;
11 #define PY_SSIZE_T_MAX INT_MAX
12 #define PY_SSIZE_T_MIN INT_MIN
13 #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
14 #define PyInt_AsSsize_t(o) PyInt_AsLong(o)
15 #endif
16 #ifdef __cplusplus
17 #define __PYX_EXTERN_C extern "C"
18 #else
19 #define __PYX_EXTERN_C extern
20 #endif
21 __PYX_EXTERN_C double pow(double, double);
22 #include "stdio.h"
23 #include "errno.h"
24 #include "string.h"
25 #include "stdint.h"
26 #include "sys/epoll.h"
27
28
29 typedef struct {const char *s; const void **p;} __Pyx_CApiTabEntry; /*proto*/
30 typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/
31 typedef struct {PyObject **p; char *s; long n;} __Pyx_StringTabEntry; /*proto*/
32 static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t); /*proto*/
33 static int __Pyx_EndUnpack(PyObject *, Py_ssize_t); /*proto*/
34 static int __Pyx_PrintItem(PyObject *); /*proto*/
35 static int __Pyx_PrintNewline(void); /*proto*/
36 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto* /
37 static void __Pyx_ReRaise(void); /*proto*/
38 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
39 static PyObject *__Pyx_GetExcValue(void); /*proto*/
40 static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed , char *name); /*proto*/
41 static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
42 static int __Pyx_GetStarArgs(PyObject **args, PyObject **kwds, char *kwd_list[], Py_ssize_t nargs, PyObject **args2, PyObject **kwds2); /*proto*/
43 static void __Pyx_WriteUnraisable(char *name); /*proto*/
44 static void __Pyx_AddTraceback(char *funcname); /*proto*/
45 static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, long size); /*proto*/
46 static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
47 static int __Pyx_GetVtable(PyObject *dict, void *vtabptr); /*proto*/
48 static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *na me, char *modname); /*proto*/
49 static int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/
50 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
51 static int __Pyx_InitCApi(PyObject *module); /*proto*/
52 static int __Pyx_ImportModuleCApi(__Pyx_CApiTabEntry *t); /*proto*/
53 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
54
55 static PyObject *__pyx_m;
56 static PyObject *__pyx_b;
57 static int __pyx_lineno;
58 static char *__pyx_filename;
59 static char **__pyx_f;
60
61 static char __pyx_mdoc[] = "\nInterface to epoll I/O event notification facility .\n";
62
63 /* Declarations from _epoll */
64
65
66 struct __pyx_obj_6_epoll_epoll {
67 PyObject_HEAD
68 int fd;
69 int initialized;
70 };
71
72 static PyTypeObject *__pyx_ptype_6_epoll_epoll = 0;
73
74 /* Implementation of _epoll */
75
76 static PyObject *__pyx_n_CTL_ADD;
77 static PyObject *__pyx_n_CTL_DEL;
78 static PyObject *__pyx_n_CTL_MOD;
79 static PyObject *__pyx_n_IN;
80 static PyObject *__pyx_n_OUT;
81 static PyObject *__pyx_n_PRI;
82 static PyObject *__pyx_n_ERR;
83 static PyObject *__pyx_n_HUP;
84 static PyObject *__pyx_n_ET;
85 static PyObject *__pyx_n_RDNORM;
86 static PyObject *__pyx_n_RDBAND;
87 static PyObject *__pyx_n_WRNORM;
88 static PyObject *__pyx_n_WRBAND;
89 static PyObject *__pyx_n_MSG;
90
91 static PyObject *__pyx_n_IOError;
92
93 static int __pyx_f_6_epoll_5epoll___init__(PyObject *__pyx_v_self, PyObject *__p yx_args, PyObject *__pyx_kwds); /*proto*/
94 static int __pyx_f_6_epoll_5epoll___init__(PyObject *__pyx_v_self, PyObject *__p yx_args, PyObject *__pyx_kwds) {
95 int __pyx_v_size;
96 int __pyx_r;
97 int __pyx_1;
98 PyObject *__pyx_2 = 0;
99 PyObject *__pyx_3 = 0;
100 PyObject *__pyx_4 = 0;
101 PyObject *__pyx_5 = 0;
102 static char *__pyx_argnames[] = {"size",0};
103 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "i", __pyx_argnames, &__pyx_v_size)) return -1;
104 Py_INCREF(__pyx_v_self);
105
106 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python /_epoll.pyx":77 */
107 ((struct __pyx_obj_6_epoll_epoll *)__pyx_v_self)->fd = epoll_create(__pyx_v_si ze);
108
109 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python /_epoll.pyx":78 */
110 __pyx_1 = (((struct __pyx_obj_6_epoll_epoll *)__pyx_v_self)->fd == (-1));
111 if (__pyx_1) {
112
113 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/pyth on/_epoll.pyx":79 */
114 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_IOError); if (!__pyx_2) {__pyx_file name = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
115 __pyx_3 = PyInt_FromLong(errno); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
116 __pyx_4 = PyString_FromString(strerror(errno)); if (!__pyx_4) {__pyx_filenam e = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
117 __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_ lineno = 79; goto __pyx_L1;}
118 PyTuple_SET_ITEM(__pyx_5, 0, __pyx_3);
119 PyTuple_SET_ITEM(__pyx_5, 1, __pyx_4);
120 __pyx_3 = 0;
121 __pyx_4 = 0;
122 __pyx_3 = PyObject_Call(__pyx_2, __pyx_5, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
123 Py_DECREF(__pyx_2); __pyx_2 = 0;
124 Py_DECREF(__pyx_5); __pyx_5 = 0;
125 __Pyx_Raise(__pyx_3, 0, 0);
126 Py_DECREF(__pyx_3); __pyx_3 = 0;
127 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
128 goto __pyx_L2;
129 }
130 __pyx_L2:;
131
132 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python /_epoll.pyx":80 */
133 ((struct __pyx_obj_6_epoll_epoll *)__pyx_v_self)->initialized = 1;
134
135 __pyx_r = 0;
136 goto __pyx_L0;
137 __pyx_L1:;
138 Py_XDECREF(__pyx_2);
139 Py_XDECREF(__pyx_3);
140 Py_XDECREF(__pyx_4);
141 Py_XDECREF(__pyx_5);
142 __Pyx_AddTraceback("_epoll.epoll.__init__");
143 __pyx_r = -1;
144 __pyx_L0:;
145 Py_DECREF(__pyx_v_self);
146 return __pyx_r;
147 }
148
149 static void __pyx_f_6_epoll_5epoll___dealloc__(PyObject *__pyx_v_self); /*proto* /
150 static void __pyx_f_6_epoll_5epoll___dealloc__(PyObject *__pyx_v_self) {
151 int __pyx_1;
152 Py_INCREF(__pyx_v_self);
153
154 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python /_epoll.pyx":83 */
155 __pyx_1 = ((struct __pyx_obj_6_epoll_epoll *)__pyx_v_self)->initialized;
156 if (__pyx_1) {
157
158 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/pyth on/_epoll.pyx":84 */
159 close(((struct __pyx_obj_6_epoll_epoll *)__pyx_v_self)->fd);
160
161 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/pyth on/_epoll.pyx":85 */
162 ((struct __pyx_obj_6_epoll_epoll *)__pyx_v_self)->initialized = 0;
163 goto __pyx_L2;
164 }
165 __pyx_L2:;
166
167 goto __pyx_L0;
168 __pyx_L1:;
169 __Pyx_AddTraceback("_epoll.epoll.__dealloc__");
170 __pyx_L0:;
171 Py_DECREF(__pyx_v_self);
172 }
173
174 static PyObject *__pyx_f_6_epoll_5epoll_close(PyObject *__pyx_v_self, PyObject * __pyx_args, PyObject *__pyx_kwds); /*proto*/
175 static char __pyx_doc_6_epoll_5epoll_close[] = "\n Close the epoll file d escriptor.\n ";
176 static PyObject *__pyx_f_6_epoll_5epoll_close(PyObject *__pyx_v_self, PyObject * __pyx_args, PyObject *__pyx_kwds) {
177 PyObject *__pyx_r;
178 int __pyx_1;
179 PyObject *__pyx_2 = 0;
180 PyObject *__pyx_3 = 0;
181 PyObject *__pyx_4 = 0;
182 PyObject *__pyx_5 = 0;
183 static char *__pyx_argnames[] = {0};
184 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
185 Py_INCREF(__pyx_v_self);
186
187 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python /_epoll.pyx":91 */
188 __pyx_1 = ((struct __pyx_obj_6_epoll_epoll *)__pyx_v_self)->initialized;
189 if (__pyx_1) {
190
191 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/pyth on/_epoll.pyx":92 */
192 __pyx_1 = (close(((struct __pyx_obj_6_epoll_epoll *)__pyx_v_self)->fd) == (- 1));
193 if (__pyx_1) {
194
195 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/py thon/_epoll.pyx":93 */
196 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_IOError); if (!__pyx_2) {__pyx_fi lename = __pyx_f[0]; __pyx_lineno = 93; goto __pyx_L1;}
197 __pyx_3 = PyInt_FromLong(errno); if (!__pyx_3) {__pyx_filename = __pyx_f[0 ]; __pyx_lineno = 93; goto __pyx_L1;}
198 __pyx_4 = PyString_FromString(strerror(errno)); if (!__pyx_4) {__pyx_filen ame = __pyx_f[0]; __pyx_lineno = 93; goto __pyx_L1;}
199 __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __py x_lineno = 93; goto __pyx_L1;}
200 PyTuple_SET_ITEM(__pyx_5, 0, __pyx_3);
201 PyTuple_SET_ITEM(__pyx_5, 1, __pyx_4);
202 __pyx_3 = 0;
203 __pyx_4 = 0;
204 __pyx_3 = PyObject_Call(__pyx_2, __pyx_5, 0); if (!__pyx_3) {__pyx_filenam e = __pyx_f[0]; __pyx_lineno = 93; goto __pyx_L1;}
205 Py_DECREF(__pyx_2); __pyx_2 = 0;
206 Py_DECREF(__pyx_5); __pyx_5 = 0;
207 __Pyx_Raise(__pyx_3, 0, 0);
208 Py_DECREF(__pyx_3); __pyx_3 = 0;
209 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; goto __pyx_L1;}
210 goto __pyx_L3;
211 }
212 __pyx_L3:;
213
214 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/pyth on/_epoll.pyx":94 */
215 ((struct __pyx_obj_6_epoll_epoll *)__pyx_v_self)->initialized = 0;
216 goto __pyx_L2;
217 }
218 __pyx_L2:;
219
220 __pyx_r = Py_None; Py_INCREF(Py_None);
221 goto __pyx_L0;
222 __pyx_L1:;
223 Py_XDECREF(__pyx_2);
224 Py_XDECREF(__pyx_3);
225 Py_XDECREF(__pyx_4);
226 Py_XDECREF(__pyx_5);
227 __Pyx_AddTraceback("_epoll.epoll.close");
228 __pyx_r = 0;
229 __pyx_L0:;
230 Py_DECREF(__pyx_v_self);
231 return __pyx_r;
232 }
233
234 static PyObject *__pyx_f_6_epoll_5epoll_fileno(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
235 static char __pyx_doc_6_epoll_5epoll_fileno[] = "\n Return the epoll file descriptor number.\n ";
236 static PyObject *__pyx_f_6_epoll_5epoll_fileno(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
237 PyObject *__pyx_r;
238 PyObject *__pyx_1 = 0;
239 static char *__pyx_argnames[] = {0};
240 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
241 Py_INCREF(__pyx_v_self);
242
243 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python /_epoll.pyx":100 */
244 __pyx_1 = PyInt_FromLong(((struct __pyx_obj_6_epoll_epoll *)__pyx_v_self)->fd) ; if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; goto __pyx_L1; }
245 __pyx_r = __pyx_1;
246 __pyx_1 = 0;
247 goto __pyx_L0;
248
249 __pyx_r = Py_None; Py_INCREF(Py_None);
250 goto __pyx_L0;
251 __pyx_L1:;
252 Py_XDECREF(__pyx_1);
253 __Pyx_AddTraceback("_epoll.epoll.fileno");
254 __pyx_r = 0;
255 __pyx_L0:;
256 Py_DECREF(__pyx_v_self);
257 return __pyx_r;
258 }
259
260 static PyObject *__pyx_f_6_epoll_5epoll__control(PyObject *__pyx_v_self, PyObjec t *__pyx_args, PyObject *__pyx_kwds); /*proto*/
261 static char __pyx_doc_6_epoll_5epoll__control[] = "\n Modify the monitore d 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_M OD\n\n @type fd: C{int}\n @param fd: File descriptor to modify\n\n @type events: C{int}\n @param events: A bit set of IN, OUT, PRI, ERR, HUP, and ET.\n\n @raise IOError: Raised if the underlying epoll_ctl( ) call fails.\n ";
262 static PyObject *__pyx_f_6_epoll_5epoll__control(PyObject *__pyx_v_self, PyObjec t *__pyx_args, PyObject *__pyx_kwds) {
263 int __pyx_v_op;
264 int __pyx_v_fd;
265 int __pyx_v_events;
266 int __pyx_v_result;
267 struct epoll_event __pyx_v_evt;
268 PyObject *__pyx_r;
269 int __pyx_1;
270 PyObject *__pyx_2 = 0;
271 PyObject *__pyx_3 = 0;
272 PyObject *__pyx_4 = 0;
273 PyObject *__pyx_5 = 0;
274 static char *__pyx_argnames[] = {"op","fd","events",0};
275 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "iii", __pyx_argnames , &__pyx_v_op, &__pyx_v_fd, &__pyx_v_events)) return 0;
276 Py_INCREF(__pyx_v_self);
277
278 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python /_epoll.pyx":121 */
279 __pyx_v_evt.events = __pyx_v_events;
280
281 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python /_epoll.pyx":122 */
282 __pyx_v_evt.data.fd = __pyx_v_fd;
283
284 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python /_epoll.pyx":123 */
285 __pyx_v_result = epoll_ctl(((struct __pyx_obj_6_epoll_epoll *)__pyx_v_self)->f d,__pyx_v_op,__pyx_v_fd,(&__pyx_v_evt));
286
287 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python /_epoll.pyx":124 */
288 __pyx_1 = (__pyx_v_result == (-1));
289 if (__pyx_1) {
290
291 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/pyth on/_epoll.pyx":125 */
292 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_IOError); if (!__pyx_2) {__pyx_file name = __pyx_f[0]; __pyx_lineno = 125; goto __pyx_L1;}
293 __pyx_3 = PyInt_FromLong(errno); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; goto __pyx_L1;}
294 __pyx_4 = PyString_FromString(strerror(errno)); if (!__pyx_4) {__pyx_filenam e = __pyx_f[0]; __pyx_lineno = 125; goto __pyx_L1;}
295 __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_ lineno = 125; goto __pyx_L1;}
296 PyTuple_SET_ITEM(__pyx_5, 0, __pyx_3);
297 PyTuple_SET_ITEM(__pyx_5, 1, __pyx_4);
298 __pyx_3 = 0;
299 __pyx_4 = 0;
300 __pyx_3 = PyObject_Call(__pyx_2, __pyx_5, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; goto __pyx_L1;}
301 Py_DECREF(__pyx_2); __pyx_2 = 0;
302 Py_DECREF(__pyx_5); __pyx_5 = 0;
303 __Pyx_Raise(__pyx_3, 0, 0);
304 Py_DECREF(__pyx_3); __pyx_3 = 0;
305 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; goto __pyx_L1;}
306 goto __pyx_L2;
307 }
308 __pyx_L2:;
309
310 __pyx_r = Py_None; Py_INCREF(Py_None);
311 goto __pyx_L0;
312 __pyx_L1:;
313 Py_XDECREF(__pyx_2);
314 Py_XDECREF(__pyx_3);
315 Py_XDECREF(__pyx_4);
316 Py_XDECREF(__pyx_5);
317 __Pyx_AddTraceback("_epoll.epoll._control");
318 __pyx_r = 0;
319 __pyx_L0:;
320 Py_DECREF(__pyx_v_self);
321 return __pyx_r;
322 }
323
324 static PyObject *__pyx_n_append;
325
326 static PyObject *__pyx_f_6_epoll_5epoll_wait(PyObject *__pyx_v_self, PyObject *_ _pyx_args, PyObject *__pyx_kwds); /*proto*/
327 static char __pyx_doc_6_epoll_5epoll_wait[] = "\n Wait for an I/O event, wrap epoll_wait(2).\n\n @type maxevents: C{int}\n @param maxevents : Maximum number of events returned.\n\n @type timeout: C{int}\n @ param timeout: Maximum time waiting for events. 0 makes it return\n i mmediately whereas -1 makes it wait indefinitely.\n \n @raise IOEr ror: Raised if the underlying epoll_wait() call fails.\n ";
328 static PyObject *__pyx_f_6_epoll_5epoll_wait(PyObject *__pyx_v_self, PyObject *_ _pyx_args, PyObject *__pyx_kwds) {
329 unsigned int __pyx_v_maxevents;
330 int __pyx_v_timeout;
331 struct epoll_event (*__pyx_v_events);
332 int __pyx_v_result;
333 int __pyx_v_nbytes;
334 int __pyx_v_fd;
335 PyThreadState (*__pyx_v__save);
336 PyObject *__pyx_v_results;
337 PyObject *__pyx_v_i;
338 PyObject *__pyx_r;
339 int __pyx_1;
340 PyObject *__pyx_2 = 0;
341 PyObject *__pyx_3 = 0;
342 PyObject *__pyx_4 = 0;
343 PyObject *__pyx_5 = 0;
344 long __pyx_6;
345 Py_ssize_t __pyx_7;
346 static char *__pyx_argnames[] = {"maxevents","timeout",0};
347 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "Ii", __pyx_argnames, &__pyx_v_maxevents, &__pyx_v_timeout)) return 0;
348 Py_INCREF(__pyx_v_self);
349 __pyx_v_results = Py_None; Py_INCREF(Py_None);
350 __pyx_v_i = Py_None; Py_INCREF(Py_None);
351
352 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python /_epoll.pyx":146 */
353 __pyx_v_nbytes = ((sizeof(struct epoll_event )) * __pyx_v_maxevents);
354
355 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python /_epoll.pyx":147 */
356 __pyx_v_events = ((struct epoll_event (*))malloc(__pyx_v_nbytes));
357
358 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python /_epoll.pyx":148 */
359 memset(__pyx_v_events,0,__pyx_v_nbytes);
360
361 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python /_epoll.pyx":149 */
362 /*try:*/ {
363
364 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/pyth on/_epoll.pyx":150 */
365 __pyx_v_fd = ((struct __pyx_obj_6_epoll_epoll *)__pyx_v_self)->fd;
366
367 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/pyth on/_epoll.pyx":152 */
368 __pyx_v__save = PyEval_SaveThread();
369
370 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/pyth on/_epoll.pyx":153 */
371 __pyx_v_result = epoll_wait(__pyx_v_fd,__pyx_v_events,__pyx_v_maxevents,__py x_v_timeout);
372
373 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/pyth on/_epoll.pyx":154 */
374 PyEval_RestoreThread(__pyx_v__save);
375
376 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/pyth on/_epoll.pyx":156 */
377 __pyx_1 = (__pyx_v_result == (-1));
378 if (__pyx_1) {
379
380 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/py thon/_epoll.pyx":157 */
381 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_IOError); if (!__pyx_2) {__pyx_fi lename = __pyx_f[0]; __pyx_lineno = 157; goto __pyx_L3;}
382 __pyx_3 = PyInt_FromLong(errno); if (!__pyx_3) {__pyx_filename = __pyx_f[0 ]; __pyx_lineno = 157; goto __pyx_L3;}
383 __pyx_4 = PyString_FromString(strerror(errno)); if (!__pyx_4) {__pyx_filen ame = __pyx_f[0]; __pyx_lineno = 157; goto __pyx_L3;}
384 __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __py x_lineno = 157; goto __pyx_L3;}
385 PyTuple_SET_ITEM(__pyx_5, 0, __pyx_3);
386 PyTuple_SET_ITEM(__pyx_5, 1, __pyx_4);
387 __pyx_3 = 0;
388 __pyx_4 = 0;
389 __pyx_3 = PyObject_Call(__pyx_2, __pyx_5, 0); if (!__pyx_3) {__pyx_filenam e = __pyx_f[0]; __pyx_lineno = 157; goto __pyx_L3;}
390 Py_DECREF(__pyx_2); __pyx_2 = 0;
391 Py_DECREF(__pyx_5); __pyx_5 = 0;
392 __Pyx_Raise(__pyx_3, 0, 0);
393 Py_DECREF(__pyx_3); __pyx_3 = 0;
394 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; goto __pyx_L3;}
395 goto __pyx_L5;
396 }
397 __pyx_L5:;
398
399 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/pyth on/_epoll.pyx":158 */
400 __pyx_4 = PyList_New(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_l ineno = 158; goto __pyx_L3;}
401 Py_DECREF(__pyx_v_results);
402 __pyx_v_results = __pyx_4;
403 __pyx_4 = 0;
404
405 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/pyth on/_epoll.pyx":159 */
406 for (__pyx_6 = 0; __pyx_6 < __pyx_v_result; ++__pyx_6) {
407 __pyx_2 = PyInt_FromLong(__pyx_6); if (!__pyx_2) {__pyx_filename = __pyx_f [0]; __pyx_lineno = 159; goto __pyx_L3;}
408 Py_DECREF(__pyx_v_i);
409 __pyx_v_i = __pyx_2;
410 __pyx_2 = 0;
411
412 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/py thon/_epoll.pyx":160 */
413 __pyx_5 = PyObject_GetAttr(__pyx_v_results, __pyx_n_append); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L3;}
414 __pyx_7 = PyInt_AsSsize_t(__pyx_v_i); if (PyErr_Occurred()) {__pyx_filenam e = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L3;}
415 __pyx_3 = PyInt_FromLong((__pyx_v_events[__pyx_7]).data.fd); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L3;}
416 __pyx_7 = PyInt_AsSsize_t(__pyx_v_i); if (PyErr_Occurred()) {__pyx_filenam e = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L3;}
417 __pyx_4 = PyInt_FromLong(((int )(__pyx_v_events[__pyx_7]).events)); if (!_ _pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L3;}
418 __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __py x_lineno = 160; goto __pyx_L3;}
419 PyTuple_SET_ITEM(__pyx_2, 0, __pyx_3);
420 PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);
421 __pyx_3 = 0;
422 __pyx_4 = 0;
423 __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __py x_lineno = 160; goto __pyx_L3;}
424 PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
425 __pyx_2 = 0;
426 __pyx_4 = PyObject_Call(__pyx_5, __pyx_3, 0); if (!__pyx_4) {__pyx_filenam e = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L3;}
427 Py_DECREF(__pyx_5); __pyx_5 = 0;
428 Py_DECREF(__pyx_3); __pyx_3 = 0;
429 Py_DECREF(__pyx_4); __pyx_4 = 0;
430 __pyx_L6:;
431 }
432 __pyx_L7:;
433
434 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/pyth on/_epoll.pyx":161 */
435 Py_INCREF(__pyx_v_results);
436 __pyx_r = __pyx_v_results;
437 goto __pyx_L2;
438 }
439 /*finally:*/ {
440 int __pyx_why;
441 __pyx_why = 0; goto __pyx_L4;
442 __pyx_L2: __pyx_why = 3; goto __pyx_L4;
443 __pyx_L3: {
444 __pyx_why = 4;
445 Py_XDECREF(__pyx_2); __pyx_2 = 0;
446 Py_XDECREF(__pyx_5); __pyx_5 = 0;
447 Py_XDECREF(__pyx_3); __pyx_3 = 0;
448 Py_XDECREF(__pyx_4); __pyx_4 = 0;
449 PyErr_Fetch(&__pyx_2, &__pyx_5, &__pyx_3);
450 __pyx_1 = __pyx_lineno;
451 goto __pyx_L4;
452 }
453 __pyx_L4:;
454
455 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/pyth on/_epoll.pyx":163 */
456 free(__pyx_v_events);
457 switch (__pyx_why) {
458 case 3: goto __pyx_L0;
459 case 4: {
460 PyErr_Restore(__pyx_2, __pyx_5, __pyx_3);
461 __pyx_lineno = __pyx_1;
462 __pyx_2 = 0;
463 __pyx_5 = 0;
464 __pyx_3 = 0;
465 goto __pyx_L1;
466 }
467 }
468 }
469
470 __pyx_r = Py_None; Py_INCREF(Py_None);
471 goto __pyx_L0;
472 __pyx_L1:;
473 Py_XDECREF(__pyx_2);
474 Py_XDECREF(__pyx_3);
475 Py_XDECREF(__pyx_4);
476 Py_XDECREF(__pyx_5);
477 __Pyx_AddTraceback("_epoll.epoll.wait");
478 __pyx_r = 0;
479 __pyx_L0:;
480 Py_DECREF(__pyx_v_results);
481 Py_DECREF(__pyx_v_i);
482 Py_DECREF(__pyx_v_self);
483 return __pyx_r;
484 }
485
486 static __Pyx_InternTabEntry __pyx_intern_tab[] = {
487 {&__pyx_n_CTL_ADD, "CTL_ADD"},
488 {&__pyx_n_CTL_DEL, "CTL_DEL"},
489 {&__pyx_n_CTL_MOD, "CTL_MOD"},
490 {&__pyx_n_ERR, "ERR"},
491 {&__pyx_n_ET, "ET"},
492 {&__pyx_n_HUP, "HUP"},
493 {&__pyx_n_IN, "IN"},
494 {&__pyx_n_IOError, "IOError"},
495 {&__pyx_n_MSG, "MSG"},
496 {&__pyx_n_OUT, "OUT"},
497 {&__pyx_n_PRI, "PRI"},
498 {&__pyx_n_RDBAND, "RDBAND"},
499 {&__pyx_n_RDNORM, "RDNORM"},
500 {&__pyx_n_WRBAND, "WRBAND"},
501 {&__pyx_n_WRNORM, "WRNORM"},
502 {&__pyx_n_append, "append"},
503 {0, 0}
504 };
505
506 static PyObject *__pyx_tp_new_6_epoll_epoll(PyTypeObject *t, PyObject *a, PyObje ct *k) {
507 PyObject *o = (*t->tp_alloc)(t, 0);
508 struct __pyx_obj_6_epoll_epoll *p = (struct __pyx_obj_6_epoll_epoll *)o;
509 return o;
510 }
511
512 static void __pyx_tp_dealloc_6_epoll_epoll(PyObject *o) {
513 struct __pyx_obj_6_epoll_epoll *p = (struct __pyx_obj_6_epoll_epoll *)o;
514 {
515 PyObject *etype, *eval, *etb;
516 PyErr_Fetch(&etype, &eval, &etb);
517 ++o->ob_refcnt;
518 __pyx_f_6_epoll_5epoll___dealloc__(o);
519 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
520 --o->ob_refcnt;
521 PyErr_Restore(etype, eval, etb);
522 }
523 (*o->ob_type->tp_free)(o);
524 }
525
526 static int __pyx_tp_traverse_6_epoll_epoll(PyObject *o, visitproc v, void *a) {
527 int e;
528 struct __pyx_obj_6_epoll_epoll *p = (struct __pyx_obj_6_epoll_epoll *)o;
529 return 0;
530 }
531
532 static int __pyx_tp_clear_6_epoll_epoll(PyObject *o) {
533 struct __pyx_obj_6_epoll_epoll *p = (struct __pyx_obj_6_epoll_epoll *)o;
534 return 0;
535 }
536
537 static struct PyMethodDef __pyx_methods_6_epoll_epoll[] = {
538 {"close", (PyCFunction)__pyx_f_6_epoll_5epoll_close, METH_VARARGS|METH_KEYWORD S, __pyx_doc_6_epoll_5epoll_close},
539 {"fileno", (PyCFunction)__pyx_f_6_epoll_5epoll_fileno, METH_VARARGS|METH_KEYWO RDS, __pyx_doc_6_epoll_5epoll_fileno},
540 {"_control", (PyCFunction)__pyx_f_6_epoll_5epoll__control, METH_VARARGS|METH_K EYWORDS, __pyx_doc_6_epoll_5epoll__control},
541 {"wait", (PyCFunction)__pyx_f_6_epoll_5epoll_wait, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6_epoll_5epoll_wait},
542 {0, 0, 0, 0}
543 };
544
545 static PyNumberMethods __pyx_tp_as_number_epoll = {
546 0, /*nb_add*/
547 0, /*nb_subtract*/
548 0, /*nb_multiply*/
549 0, /*nb_divide*/
550 0, /*nb_remainder*/
551 0, /*nb_divmod*/
552 0, /*nb_power*/
553 0, /*nb_negative*/
554 0, /*nb_positive*/
555 0, /*nb_absolute*/
556 0, /*nb_nonzero*/
557 0, /*nb_invert*/
558 0, /*nb_lshift*/
559 0, /*nb_rshift*/
560 0, /*nb_and*/
561 0, /*nb_xor*/
562 0, /*nb_or*/
563 0, /*nb_coerce*/
564 0, /*nb_int*/
565 0, /*nb_long*/
566 0, /*nb_float*/
567 0, /*nb_oct*/
568 0, /*nb_hex*/
569 0, /*nb_inplace_add*/
570 0, /*nb_inplace_subtract*/
571 0, /*nb_inplace_multiply*/
572 0, /*nb_inplace_divide*/
573 0, /*nb_inplace_remainder*/
574 0, /*nb_inplace_power*/
575 0, /*nb_inplace_lshift*/
576 0, /*nb_inplace_rshift*/
577 0, /*nb_inplace_and*/
578 0, /*nb_inplace_xor*/
579 0, /*nb_inplace_or*/
580 0, /*nb_floor_divide*/
581 0, /*nb_true_divide*/
582 0, /*nb_inplace_floor_divide*/
583 0, /*nb_inplace_true_divide*/
584 };
585
586 static PySequenceMethods __pyx_tp_as_sequence_epoll = {
587 0, /*sq_length*/
588 0, /*sq_concat*/
589 0, /*sq_repeat*/
590 0, /*sq_item*/
591 0, /*sq_slice*/
592 0, /*sq_ass_item*/
593 0, /*sq_ass_slice*/
594 0, /*sq_contains*/
595 0, /*sq_inplace_concat*/
596 0, /*sq_inplace_repeat*/
597 };
598
599 static PyMappingMethods __pyx_tp_as_mapping_epoll = {
600 0, /*mp_length*/
601 0, /*mp_subscript*/
602 0, /*mp_ass_subscript*/
603 };
604
605 static PyBufferProcs __pyx_tp_as_buffer_epoll = {
606 0, /*bf_getreadbuffer*/
607 0, /*bf_getwritebuffer*/
608 0, /*bf_getsegcount*/
609 0, /*bf_getcharbuffer*/
610 };
611
612 PyTypeObject __pyx_type_6_epoll_epoll = {
613 PyObject_HEAD_INIT(0)
614 0, /*ob_size*/
615 "_epoll.epoll", /*tp_name*/
616 sizeof(struct __pyx_obj_6_epoll_epoll), /*tp_basicsize*/
617 0, /*tp_itemsize*/
618 __pyx_tp_dealloc_6_epoll_epoll, /*tp_dealloc*/
619 0, /*tp_print*/
620 0, /*tp_getattr*/
621 0, /*tp_setattr*/
622 0, /*tp_compare*/
623 0, /*tp_repr*/
624 &__pyx_tp_as_number_epoll, /*tp_as_number*/
625 &__pyx_tp_as_sequence_epoll, /*tp_as_sequence*/
626 &__pyx_tp_as_mapping_epoll, /*tp_as_mapping*/
627 0, /*tp_hash*/
628 0, /*tp_call*/
629 0, /*tp_str*/
630 0, /*tp_getattro*/
631 0, /*tp_setattro*/
632 &__pyx_tp_as_buffer_epoll, /*tp_as_buffer*/
633 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_G C, /*tp_flags*/
634 "\n Represent a set of file descriptors being monitored for events.\n ", /*tp_doc*/
635 __pyx_tp_traverse_6_epoll_epoll, /*tp_traverse*/
636 __pyx_tp_clear_6_epoll_epoll, /*tp_clear*/
637 0, /*tp_richcompare*/
638 0, /*tp_weaklistoffset*/
639 0, /*tp_iter*/
640 0, /*tp_iternext*/
641 __pyx_methods_6_epoll_epoll, /*tp_methods*/
642 0, /*tp_members*/
643 0, /*tp_getset*/
644 0, /*tp_base*/
645 0, /*tp_dict*/
646 0, /*tp_descr_get*/
647 0, /*tp_descr_set*/
648 0, /*tp_dictoffset*/
649 __pyx_f_6_epoll_5epoll___init__, /*tp_init*/
650 0, /*tp_alloc*/
651 __pyx_tp_new_6_epoll_epoll, /*tp_new*/
652 0, /*tp_free*/
653 0, /*tp_is_gc*/
654 0, /*tp_bases*/
655 0, /*tp_mro*/
656 0, /*tp_cache*/
657 0, /*tp_subclasses*/
658 0, /*tp_weaklist*/
659 };
660
661 static struct PyMethodDef __pyx_methods[] = {
662 {0, 0, 0, 0}
663 };
664
665 static void __pyx_init_filenames(void); /*proto*/
666
667 PyMODINIT_FUNC init_epoll(void); /*proto*/
668 PyMODINIT_FUNC init_epoll(void) {
669 PyObject *__pyx_1 = 0;
670 __pyx_init_filenames();
671 __pyx_m = Py_InitModule4("_epoll", __pyx_methods, __pyx_mdoc, 0, PYTHON_API_VE RSION);
672 if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;};
673 __pyx_b = PyImport_AddModule("__builtin__");
674 if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;};
675 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filen ame = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;};
676 if (__Pyx_InternStrings(__pyx_intern_tab) < 0) {__pyx_filename = __pyx_f[0]; _ _pyx_lineno = 4; goto __pyx_L1;};
677 if (PyType_Ready(&__pyx_type_6_epoll_epoll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; goto __pyx_L1;}
678 if (PyObject_SetAttrString(__pyx_m, "epoll", (PyObject *)&__pyx_type_6_epoll_e poll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; goto __pyx_L1;}
679 __pyx_ptype_6_epoll_epoll = &__pyx_type_6_epoll_epoll;
680
681 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python /_epoll.pyx":165 */
682 __pyx_1 = PyInt_FromLong(EPOLL_CTL_ADD); if (!__pyx_1) {__pyx_filename = __pyx _f[0]; __pyx_lineno = 165; goto __pyx_L1;}
683 if (PyObject_SetAttr(__pyx_m, __pyx_n_CTL_ADD, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; goto __pyx_L1;}
684 Py_DECREF(__pyx_1); __pyx_1 = 0;
685
686 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python /_epoll.pyx":166 */
687 __pyx_1 = PyInt_FromLong(EPOLL_CTL_DEL); if (!__pyx_1) {__pyx_filename = __pyx _f[0]; __pyx_lineno = 166; goto __pyx_L1;}
688 if (PyObject_SetAttr(__pyx_m, __pyx_n_CTL_DEL, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; goto __pyx_L1;}
689 Py_DECREF(__pyx_1); __pyx_1 = 0;
690
691 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python /_epoll.pyx":167 */
692 __pyx_1 = PyInt_FromLong(EPOLL_CTL_MOD); if (!__pyx_1) {__pyx_filename = __pyx _f[0]; __pyx_lineno = 167; goto __pyx_L1;}
693 if (PyObject_SetAttr(__pyx_m, __pyx_n_CTL_MOD, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; goto __pyx_L1;}
694 Py_DECREF(__pyx_1); __pyx_1 = 0;
695
696 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python /_epoll.pyx":169 */
697 __pyx_1 = PyInt_FromLong(EPOLLIN); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; goto __pyx_L1;}
698 if (PyObject_SetAttr(__pyx_m, __pyx_n_IN, __pyx_1) < 0) {__pyx_filename = __py x_f[0]; __pyx_lineno = 169; goto __pyx_L1;}
699 Py_DECREF(__pyx_1); __pyx_1 = 0;
700
701 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python /_epoll.pyx":170 */
702 __pyx_1 = PyInt_FromLong(EPOLLOUT); if (!__pyx_1) {__pyx_filename = __pyx_f[0] ; __pyx_lineno = 170; goto __pyx_L1;}
703 if (PyObject_SetAttr(__pyx_m, __pyx_n_OUT, __pyx_1) < 0) {__pyx_filename = __p yx_f[0]; __pyx_lineno = 170; goto __pyx_L1;}
704 Py_DECREF(__pyx_1); __pyx_1 = 0;
705
706 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python /_epoll.pyx":171 */
707 __pyx_1 = PyInt_FromLong(EPOLLPRI); if (!__pyx_1) {__pyx_filename = __pyx_f[0] ; __pyx_lineno = 171; goto __pyx_L1;}
708 if (PyObject_SetAttr(__pyx_m, __pyx_n_PRI, __pyx_1) < 0) {__pyx_filename = __p yx_f[0]; __pyx_lineno = 171; goto __pyx_L1;}
709 Py_DECREF(__pyx_1); __pyx_1 = 0;
710
711 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python /_epoll.pyx":172 */
712 __pyx_1 = PyInt_FromLong(EPOLLERR); if (!__pyx_1) {__pyx_filename = __pyx_f[0] ; __pyx_lineno = 172; goto __pyx_L1;}
713 if (PyObject_SetAttr(__pyx_m, __pyx_n_ERR, __pyx_1) < 0) {__pyx_filename = __p yx_f[0]; __pyx_lineno = 172; goto __pyx_L1;}
714 Py_DECREF(__pyx_1); __pyx_1 = 0;
715
716 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python /_epoll.pyx":173 */
717 __pyx_1 = PyInt_FromLong(EPOLLHUP); if (!__pyx_1) {__pyx_filename = __pyx_f[0] ; __pyx_lineno = 173; goto __pyx_L1;}
718 if (PyObject_SetAttr(__pyx_m, __pyx_n_HUP, __pyx_1) < 0) {__pyx_filename = __p yx_f[0]; __pyx_lineno = 173; goto __pyx_L1;}
719 Py_DECREF(__pyx_1); __pyx_1 = 0;
720
721 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python /_epoll.pyx":174 */
722 __pyx_1 = PyInt_FromLong(EPOLLET); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; goto __pyx_L1;}
723 if (PyObject_SetAttr(__pyx_m, __pyx_n_ET, __pyx_1) < 0) {__pyx_filename = __py x_f[0]; __pyx_lineno = 174; goto __pyx_L1;}
724 Py_DECREF(__pyx_1); __pyx_1 = 0;
725
726 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python /_epoll.pyx":176 */
727 __pyx_1 = PyInt_FromLong(EPOLLRDNORM); if (!__pyx_1) {__pyx_filename = __pyx_f [0]; __pyx_lineno = 176; goto __pyx_L1;}
728 if (PyObject_SetAttr(__pyx_m, __pyx_n_RDNORM, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;}
729 Py_DECREF(__pyx_1); __pyx_1 = 0;
730
731 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python /_epoll.pyx":177 */
732 __pyx_1 = PyInt_FromLong(EPOLLRDBAND); if (!__pyx_1) {__pyx_filename = __pyx_f [0]; __pyx_lineno = 177; goto __pyx_L1;}
733 if (PyObject_SetAttr(__pyx_m, __pyx_n_RDBAND, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}
734 Py_DECREF(__pyx_1); __pyx_1 = 0;
735
736 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python /_epoll.pyx":178 */
737 __pyx_1 = PyInt_FromLong(EPOLLWRNORM); if (!__pyx_1) {__pyx_filename = __pyx_f [0]; __pyx_lineno = 178; goto __pyx_L1;}
738 if (PyObject_SetAttr(__pyx_m, __pyx_n_WRNORM, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}
739 Py_DECREF(__pyx_1); __pyx_1 = 0;
740
741 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python /_epoll.pyx":179 */
742 __pyx_1 = PyInt_FromLong(EPOLLWRBAND); if (!__pyx_1) {__pyx_filename = __pyx_f [0]; __pyx_lineno = 179; goto __pyx_L1;}
743 if (PyObject_SetAttr(__pyx_m, __pyx_n_WRBAND, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; goto __pyx_L1;}
744 Py_DECREF(__pyx_1); __pyx_1 = 0;
745
746 /* "/home/exarkun/Projects/Twisted/branches/epollreactor-1953-2/twisted/python /_epoll.pyx":180 */
747 __pyx_1 = PyInt_FromLong(EPOLLMSG); if (!__pyx_1) {__pyx_filename = __pyx_f[0] ; __pyx_lineno = 180; goto __pyx_L1;}
748 if (PyObject_SetAttr(__pyx_m, __pyx_n_MSG, __pyx_1) < 0) {__pyx_filename = __p yx_f[0]; __pyx_lineno = 180; goto __pyx_L1;}
749 Py_DECREF(__pyx_1); __pyx_1 = 0;
750 return;
751 __pyx_L1:;
752 Py_XDECREF(__pyx_1);
753 __Pyx_AddTraceback("_epoll");
754 }
755
756 static char *__pyx_filenames[] = {
757 "_epoll.pyx",
758 };
759
760 /* Runtime support code */
761
762 static void __pyx_init_filenames(void) {
763 __pyx_f = __pyx_filenames;
764 }
765
766 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
767 PyObject *result;
768 result = PyObject_GetAttr(dict, name);
769 if (!result)
770 PyErr_SetObject(PyExc_NameError, name);
771 return result;
772 }
773
774 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
775 Py_XINCREF(type);
776 Py_XINCREF(value);
777 Py_XINCREF(tb);
778 /* First, check the traceback argument, replacing None with NULL. */
779 if (tb == Py_None) {
780 Py_DECREF(tb);
781 tb = 0;
782 }
783 else if (tb != NULL && !PyTraceBack_Check(tb)) {
784 PyErr_SetString(PyExc_TypeError,
785 "raise: arg 3 must be a traceback or None");
786 goto raise_error;
787 }
788 /* Next, replace a missing value with None */
789 if (value == NULL) {
790 value = Py_None;
791 Py_INCREF(value);
792 }
793 /* Next, repeatedly, replace a tuple exception with its first item */
794 while (PyTuple_Check(type) && PyTuple_Size(type) > 0) {
795 PyObject *tmp = type;
796 type = PyTuple_GET_ITEM(type, 0);
797 Py_INCREF(type);
798 Py_DECREF(tmp);
799 }
800 if (PyString_CheckExact(type)) {
801 /* Raising builtin string is deprecated but still allowed --
802 * do nothing. Raising an instance of a new-style str
803 * subclass is right out. */
804 if (PyErr_Warn(PyExc_DeprecationWarning,
805 "raising a string exception is deprecated"))
806 goto raise_error;
807 }
808 else if (PyType_Check(type) || PyClass_Check(type))
809 ; /* PyErr_NormalizeException(&type, &value, &tb); */
810 else if (PyInstance_Check(type)) {
811 /* Raising an instance. The value should be a dummy. */
812 if (value != Py_None) {
813 PyErr_SetString(PyExc_TypeError,
814 "instance exception may not have a separate value");
815 goto raise_error;
816 }
817 else {
818 /* Normalize to raise <class>, <instance> */
819 Py_DECREF(value);
820 value = type;
821 type = (PyObject*) ((PyInstanceObject*)type)->in_class;
822 Py_INCREF(type);
823 }
824 }
825 else if (PyType_IsSubtype(type->ob_type, (PyTypeObject*)PyExc_Exception)) {
826 /* Raising a new-style object (in Py2.5).
827 The value should be a dummy. */
828 if (value != Py_None) {
829 PyErr_SetString(PyExc_TypeError,
830 "instance exception may not have a separate value");
831 goto raise_error;
832 }
833 else {
834 /* Normalize to raise <class>, <instance> */
835 Py_DECREF(value);
836 value = type;
837 type = (PyObject*) type->ob_type;
838 Py_INCREF(type);
839 }
840 }
841 else {
842 /* Not something you can raise. You get an exception
843 anyway, just not what you specified :-) */
844 PyErr_Format(PyExc_TypeError,
845 "exceptions must be classes, instances, or "
846 "strings (deprecated), not %s",
847 type->ob_type->tp_name);
848 goto raise_error;
849 }
850 PyErr_Restore(type, value, tb);
851 return;
852 raise_error:
853 Py_XDECREF(value);
854 Py_XDECREF(type);
855 Py_XDECREF(tb);
856 return;
857 }
858
859 static int __Pyx_InternStrings(__Pyx_InternTabEntry *t) {
860 while (t->p) {
861 *t->p = PyString_InternFromString(t->s);
862 if (!*t->p)
863 return -1;
864 ++t;
865 }
866 return 0;
867 }
868
869 #include "compile.h"
870 #include "frameobject.h"
871 #include "traceback.h"
872
873 static void __Pyx_AddTraceback(char *funcname) {
874 PyObject *py_srcfile = 0;
875 PyObject *py_funcname = 0;
876 PyObject *py_globals = 0;
877 PyObject *empty_tuple = 0;
878 PyObject *empty_string = 0;
879 PyCodeObject *py_code = 0;
880 PyFrameObject *py_frame = 0;
881
882 py_srcfile = PyString_FromString(__pyx_filename);
883 if (!py_srcfile) goto bad;
884 py_funcname = PyString_FromString(funcname);
885 if (!py_funcname) goto bad;
886 py_globals = PyModule_GetDict(__pyx_m);
887 if (!py_globals) goto bad;
888 empty_tuple = PyTuple_New(0);
889 if (!empty_tuple) goto bad;
890 empty_string = PyString_FromString("");
891 if (!empty_string) goto bad;
892 py_code = PyCode_New(
893 0, /*int argcount,*/
894 0, /*int nlocals,*/
895 0, /*int stacksize,*/
896 0, /*int flags,*/
897 empty_string, /*PyObject *code,*/
898 empty_tuple, /*PyObject *consts,*/
899 empty_tuple, /*PyObject *names,*/
900 empty_tuple, /*PyObject *varnames,*/
901 empty_tuple, /*PyObject *freevars,*/
902 empty_tuple, /*PyObject *cellvars,*/
903 py_srcfile, /*PyObject *filename,*/
904 py_funcname, /*PyObject *name,*/
905 __pyx_lineno, /*int firstlineno,*/
906 empty_string /*PyObject *lnotab*/
907 );
908 if (!py_code) goto bad;
909 py_frame = PyFrame_New(
910 PyThreadState_Get(), /*PyThreadState *tstate,*/
911 py_code, /*PyCodeObject *code,*/
912 py_globals, /*PyObject *globals,*/
913 0 /*PyObject *locals*/
914 );
915 if (!py_frame) goto bad;
916 py_frame->f_lineno = __pyx_lineno;
917 PyTraceBack_Here(py_frame);
918 bad:
919 Py_XDECREF(py_srcfile);
920 Py_XDECREF(py_funcname);
921 Py_XDECREF(empty_tuple);
922 Py_XDECREF(empty_string);
923 Py_XDECREF(py_code);
924 Py_XDECREF(py_frame);
925 }
OLDNEW
« no previous file with comments | « third_party/twisted_8_1/twisted/python/__init__.py ('k') | third_party/twisted_8_1/twisted/python/_epoll.pyx » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698