1
/* Generated by Cython 0.11.2 on Fri Jan 08 20:14:16 2010 */
3
#define PY_SSIZE_T_CLEAN
5
#include "structmember.h"
7
#error Python headers needed to compile C extensions, please install development version of Python.
10
#define PY_LONG_LONG LONG_LONG
13
#define DL_EXPORT(t) t
15
#if PY_VERSION_HEX < 0x02040000
16
#define METH_COEXIST 0
17
#define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
19
#if PY_VERSION_HEX < 0x02050000
20
typedef int Py_ssize_t;
21
#define PY_SSIZE_T_MAX INT_MAX
22
#define PY_SSIZE_T_MIN INT_MIN
23
#define PY_FORMAT_SIZE_T ""
24
#define PyInt_FromSsize_t(z) PyInt_FromLong(z)
25
#define PyInt_AsSsize_t(o) PyInt_AsLong(o)
26
#define PyNumber_Index(o) PyNumber_Int(o)
27
#define PyIndex_Check(o) PyNumber_Check(o)
29
#if PY_VERSION_HEX < 0x02060000
30
#define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
31
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
32
#define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
33
#define PyVarObject_HEAD_INIT(type, size) \
34
PyObject_HEAD_INIT(type) size,
35
#define PyType_Modified(t)
47
Py_ssize_t *suboffsets;
51
#define PyBUF_SIMPLE 0
52
#define PyBUF_WRITABLE 0x0001
53
#define PyBUF_FORMAT 0x0004
54
#define PyBUF_ND 0x0008
55
#define PyBUF_STRIDES (0x0010 | PyBUF_ND)
56
#define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
57
#define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
58
#define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
59
#define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
62
#if PY_MAJOR_VERSION < 3
63
#define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
65
#define __Pyx_BUILTIN_MODULE_NAME "builtins"
67
#if PY_MAJOR_VERSION >= 3
68
#define Py_TPFLAGS_CHECKTYPES 0
69
#define Py_TPFLAGS_HAVE_INDEX 0
71
#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
72
#define Py_TPFLAGS_HAVE_NEWBUFFER 0
74
#if PY_MAJOR_VERSION >= 3
75
#define PyBaseString_Type PyUnicode_Type
76
#define PyString_Type PyBytes_Type
77
#define PyString_CheckExact PyBytes_CheckExact
78
#define PyInt_Type PyLong_Type
79
#define PyInt_Check(op) PyLong_Check(op)
80
#define PyInt_CheckExact(op) PyLong_CheckExact(op)
81
#define PyInt_FromString PyLong_FromString
82
#define PyInt_FromUnicode PyLong_FromUnicode
83
#define PyInt_FromLong PyLong_FromLong
84
#define PyInt_FromSize_t PyLong_FromSize_t
85
#define PyInt_FromSsize_t PyLong_FromSsize_t
86
#define PyInt_AsLong PyLong_AsLong
87
#define PyInt_AS_LONG PyLong_AS_LONG
88
#define PyInt_AsSsize_t PyLong_AsSsize_t
89
#define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
90
#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
91
#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
93
#define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
94
#define PyBytes_Type PyString_Type
96
#if PY_MAJOR_VERSION >= 3
97
#define PyMethod_New(func, self, klass) PyInstanceMethod_New(func)
99
#if !defined(WIN32) && !defined(MS_WINDOWS)
110
#define _USE_MATH_DEFINES
112
#if PY_VERSION_HEX < 0x02050000
113
#define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n)))
114
#define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
115
#define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n)))
117
#define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n))
118
#define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
119
#define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n))
121
#if PY_VERSION_HEX < 0x02050000
122
#define __Pyx_NAMESTR(n) ((char *)(n))
123
#define __Pyx_DOCSTR(n) ((char *)(n))
125
#define __Pyx_NAMESTR(n) (n)
126
#define __Pyx_DOCSTR(n) (n)
129
#define __PYX_EXTERN_C extern "C"
131
#define __PYX_EXTERN_C extern
134
#define __PYX_HAVE_API__iocpsupport
137
#include "winsock2.h"
141
#include "winsock_pointers.h"
142
#define __PYX_USE_C99_COMPLEX defined(_Complex_I)
146
#define INLINE __inline__
148
#define INLINE __inline
153
typedef struct {PyObject **p; char *s; long n; char is_unicode; char intern; char is_identifier;} __Pyx_StringTabEntry; /*proto*/
157
static int __pyx_skip_dispatch = 0;
160
/* Type Conversion Predeclarations */
162
#if PY_MAJOR_VERSION < 3
163
#define __Pyx_PyBytes_FromString PyString_FromString
164
#define __Pyx_PyBytes_FromStringAndSize PyString_FromStringAndSize
165
#define __Pyx_PyBytes_AsString PyString_AsString
167
#define __Pyx_PyBytes_FromString PyBytes_FromString
168
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
169
#define __Pyx_PyBytes_AsString PyBytes_AsString
172
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
173
static INLINE int __Pyx_PyObject_IsTrue(PyObject*);
174
static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
176
#if !defined(T_PYSSIZET)
177
#if PY_VERSION_HEX < 0x02050000
178
#define T_PYSSIZET T_INT
179
#elif !defined(T_LONGLONG)
181
((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \
182
((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1))
185
((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \
186
((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : \
187
((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1)))
191
#if !defined(T_SIZET)
192
#if !defined(T_ULONGLONG)
194
((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \
195
((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1))
198
((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \
199
((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : \
200
((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1)))
204
static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
205
static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
206
static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
208
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
212
/* Test for GCC > 2.95 */
213
#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
214
#define likely(x) __builtin_expect(!!(x), 1)
215
#define unlikely(x) __builtin_expect(!!(x), 0)
216
#else /* __GNUC__ > 2 ... */
217
#define likely(x) (x)
218
#define unlikely(x) (x)
219
#endif /* __GNUC__ > 2 ... */
221
#define likely(x) (x)
222
#define unlikely(x) (x)
223
#endif /* __GNUC__ */
225
static PyObject *__pyx_m;
226
static PyObject *__pyx_b;
227
static PyObject *__pyx_empty_tuple;
228
static int __pyx_lineno;
229
static int __pyx_clineno = 0;
230
static const char * __pyx_cfilenm= __FILE__;
231
static const char *__pyx_filename;
232
static const char **__pyx_f;
235
#ifdef CYTHON_REFNANNY
237
void (*INCREF)(void*, PyObject*, int);
238
void (*DECREF)(void*, PyObject*, int);
239
void (*GOTREF)(void*, PyObject*, int);
240
void (*GIVEREF)(void*, PyObject*, int);
241
void* (*NewContext)(const char*, int, const char*);
242
void (*FinishContext)(void**);
243
} __Pyx_RefnannyAPIStruct;
244
static __Pyx_RefnannyAPIStruct *__Pyx_Refnanny = NULL;
245
#define __Pyx_ImportRefcountAPI(name) (__Pyx_RefnannyAPIStruct *) PyCObject_Import((char *)name, (char *)"RefnannyAPI")
246
#define __Pyx_INCREF(r) __Pyx_Refnanny->INCREF(__pyx_refchk, (PyObject *)(r), __LINE__)
247
#define __Pyx_DECREF(r) __Pyx_Refnanny->DECREF(__pyx_refchk, (PyObject *)(r), __LINE__)
248
#define __Pyx_GOTREF(r) __Pyx_Refnanny->GOTREF(__pyx_refchk, (PyObject *)(r), __LINE__)
249
#define __Pyx_GIVEREF(r) __Pyx_Refnanny->GIVEREF(__pyx_refchk, (PyObject *)(r), __LINE__)
250
#define __Pyx_XDECREF(r) if((r) == NULL) ; else __Pyx_DECREF(r)
251
#define __Pyx_SetupRefcountContext(name) void* __pyx_refchk = __Pyx_Refnanny->NewContext((name), __LINE__, __FILE__)
252
#define __Pyx_FinishRefcountContext() __Pyx_Refnanny->FinishContext(&__pyx_refchk)
254
#define __Pyx_INCREF(r) Py_INCREF(r)
255
#define __Pyx_DECREF(r) Py_DECREF(r)
256
#define __Pyx_GOTREF(r)
257
#define __Pyx_GIVEREF(r)
258
#define __Pyx_XDECREF(r) Py_XDECREF(r)
259
#define __Pyx_SetupRefcountContext(name)
260
#define __Pyx_FinishRefcountContext()
261
#endif /* CYTHON_REFNANNY */
262
#define __Pyx_XGIVEREF(r) if((r) == NULL) ; else __Pyx_GIVEREF(r)
263
#define __Pyx_XGOTREF(r) if((r) == NULL) ; else __Pyx_GOTREF(r)
265
static void __Pyx_RaiseDoubleKeywordsError(
266
const char* func_name, PyObject* kw_name); /*proto*/
268
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
269
Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
271
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/
273
static INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict,
274
const char* function_name, int kw_allowed); /*proto*/
276
static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
277
static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
279
static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, const char *modname); /*proto*/
281
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
283
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
285
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
287
static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
289
static INLINE void __Pyx_RaiseTooManyValuesError(void);
291
static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/
292
static int __Pyx_EndUnpack(PyObject *); /*proto*/
294
static INLINE int __Pyx_StrEq(const char *, const char *); /*proto*/
296
static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
298
static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
300
static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
302
static INLINE char __Pyx_PyInt_AsChar(PyObject *);
304
static INLINE short __Pyx_PyInt_AsShort(PyObject *);
306
static INLINE int __Pyx_PyInt_AsInt(PyObject *);
308
static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
310
static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
312
static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
314
static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
316
static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
318
static INLINE long __Pyx_PyInt_AsLong(PyObject *);
320
static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
322
static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
324
static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
326
static void __Pyx_AddTraceback(const char *funcname); /*proto*/
328
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
330
/* Type declarations */
332
typedef int __pyx_t_11iocpsupport_size_t;
334
typedef unsigned long __pyx_t_11iocpsupport_HANDLE;
336
typedef unsigned long __pyx_t_11iocpsupport_SOCKET;
338
typedef unsigned long __pyx_t_11iocpsupport_DWORD;
340
typedef unsigned long __pyx_t_11iocpsupport_ULONG_PTR;
342
typedef int __pyx_t_11iocpsupport_BOOL;
344
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":104
345
* # BOOL (*lpTransmitFile)(SOCKET s, HANDLE hFile, DWORD size, DWORD buffer_size, OVERLAPPED *ov, TRANSMIT_FILE_BUFFERS *buff, DWORD flags)
347
* cdef struct myOVERLAPPED: # <<<<<<<<<<<<<<
352
struct __pyx_t_11iocpsupport_myOVERLAPPED {
354
struct PyObject *obj;
357
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":129
358
* setattr(self, k, v)
360
* cdef class CompletionPort: # <<<<<<<<<<<<<<
362
* def __init__(self):
365
struct __pyx_obj_11iocpsupport_CompletionPort {
367
__pyx_t_11iocpsupport_HANDLE port;
369
/* Module declarations from iocpsupport */
371
static PyTypeObject *__pyx_ptype_11iocpsupport_CompletionPort = 0;
372
static struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_f_11iocpsupport_makeOV(void); /*proto*/
373
static void __pyx_f_11iocpsupport_raise_error(int, PyObject *); /*proto*/
374
static PyObject *__pyx_f_11iocpsupport__makesockaddr(struct sockaddr *, int); /*proto*/
375
static PyObject *__pyx_f_11iocpsupport_fillinetaddr(struct sockaddr_in *, PyObject *); /*proto*/
376
static int __pyx_f_11iocpsupport_getAddrFamily(__pyx_t_11iocpsupport_SOCKET); /*proto*/
377
#define __Pyx_MODULE_NAME "iocpsupport"
378
int __pyx_module_is_main_iocpsupport = 0;
380
/* Implementation of iocpsupport */
381
static char __pyx_k_1[] = "Failed to initialize Winsock function vectors";
382
static PyObject *__pyx_int_0;
383
static char __pyx_k___main__[] = "__main__";
384
static PyObject *__pyx_kp___main__;
385
static char __pyx_k___init__[] = "__init__";
386
static PyObject *__pyx_kp___init__;
387
static char __pyx_k_addHandle[] = "addHandle";
388
static PyObject *__pyx_kp_addHandle;
389
static char __pyx_k_getEvent[] = "getEvent";
390
static PyObject *__pyx_kp_getEvent;
391
static char __pyx_k_postEvent[] = "postEvent";
392
static PyObject *__pyx_kp_postEvent;
393
static char __pyx_k___del__[] = "__del__";
394
static PyObject *__pyx_kp___del__;
395
static char __pyx_k_self[] = "self";
396
static PyObject *__pyx_kp_self;
397
static char __pyx_k_callback[] = "callback";
398
static PyObject *__pyx_kp_callback;
399
static char __pyx_k_owner[] = "owner";
400
static PyObject *__pyx_kp_owner;
401
static char __pyx_k_handle[] = "handle";
402
static PyObject *__pyx_kp_handle;
403
static char __pyx_k_key[] = "key";
404
static PyObject *__pyx_kp_key;
405
static char __pyx_k_timeout[] = "timeout";
406
static PyObject *__pyx_kp_timeout;
407
static char __pyx_k_bytes[] = "bytes";
408
static PyObject *__pyx_kp_bytes;
409
static char __pyx_k_obj[] = "obj";
410
static PyObject *__pyx_kp_obj;
411
static char __pyx_k_buff[] = "buff";
412
static PyObject *__pyx_kp_buff;
413
static char __pyx_k_size[] = "size";
414
static PyObject *__pyx_kp_size;
415
static char __pyx_k_s[] = "s";
416
static PyObject *__pyx_kp_s;
417
static char __pyx_k_listening[] = "listening";
418
static PyObject *__pyx_kp_listening;
419
static char __pyx_k_accepting[] = "accepting";
420
static PyObject *__pyx_kp_accepting;
421
static char __pyx_k_addr[] = "addr";
422
static PyObject *__pyx_kp_addr;
423
static char __pyx_k_bufflist[] = "bufflist";
424
static PyObject *__pyx_kp_bufflist;
425
static char __pyx_k_flags[] = "flags";
426
static PyObject *__pyx_kp_flags;
427
static char __pyx_k_addr_buff[] = "addr_buff";
428
static PyObject *__pyx_kp_addr_buff;
429
static char __pyx_k_addr_len_buff[] = "addr_len_buff";
430
static PyObject *__pyx_kp_addr_len_buff;
431
static char __pyx_k_Event[] = "Event";
432
static PyObject *__pyx_kp_Event;
433
static char __pyx_k_socket[] = "socket";
434
static PyObject *__pyx_kp_socket;
435
static char __pyx_k_ValueError[] = "ValueError";
436
static PyObject *__pyx_kp_ValueError;
437
static char __pyx_k_have_connectex[] = "have_connectex";
438
static PyObject *__pyx_kp_have_connectex;
439
static char __pyx_k_MemoryError[] = "MemoryError";
440
static PyObject *__pyx_kp_MemoryError;
441
static char __pyx_k_WindowsError[] = "WindowsError";
442
static PyObject *__pyx_kp_WindowsError;
443
static char __pyx_k_ignore[] = "ignore";
444
static PyObject *__pyx_kp_ignore;
445
static char __pyx_k_items[] = "items";
446
static PyObject *__pyx_kp_items;
447
static char __pyx_k_2[] = "CreateIoCompletionPort";
448
static PyObject *__pyx_kp_2;
449
static char __pyx_k_3[] = "CreateIoCompletionPort";
450
static PyObject *__pyx_kp_3;
451
static char __pyx_k_4[] = "PostQueuedCompletionStatus";
452
static PyObject *__pyx_kp_4;
453
static char __pyx_k_6[] = "getsockopt";
454
static PyObject *__pyx_kp_6;
455
static char __pyx_k_7[] = "getsockopt";
456
static PyObject *__pyx_kp_7;
457
static PyObject *__pyx_kp_1;
458
static PyObject *__pyx_builtin_ValueError;
459
static PyObject *__pyx_builtin_MemoryError;
460
static PyObject *__pyx_builtin_WindowsError;
461
static PyObject *__pyx_kp_5;
462
static char __pyx_k_5[] = "invalid IP address";
463
static PyObject *__pyx_kp_8;
464
static PyObject *__pyx_kp_9;
465
static char __pyx_k_8[] = "ConnectEx is not available on this system";
466
static char __pyx_k_9[] = "unsupported address family";
467
static char __pyx_k_10[] = "second argument needs to be a list";
468
static PyObject *__pyx_kp_11;
469
static char __pyx_k_11[] = "length of address length buffer needs to be sizeof(int)";
471
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":108
474
* cdef myOVERLAPPED *makeOV() except NULL: # <<<<<<<<<<<<<<
475
* cdef myOVERLAPPED *res
476
* res = <myOVERLAPPED *>PyMem_Malloc(sizeof(myOVERLAPPED))
479
static struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_f_11iocpsupport_makeOV(void) {
480
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_res;
481
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_r;
484
__Pyx_SetupRefcountContext("makeOV");
486
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":110
487
* cdef myOVERLAPPED *makeOV() except NULL:
488
* cdef myOVERLAPPED *res
489
* res = <myOVERLAPPED *>PyMem_Malloc(sizeof(myOVERLAPPED)) # <<<<<<<<<<<<<<
493
__pyx_t_1 = PyMem_Malloc((sizeof(struct __pyx_t_11iocpsupport_myOVERLAPPED))); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
494
__pyx_v_res = ((struct __pyx_t_11iocpsupport_myOVERLAPPED *)__pyx_t_1);
496
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":111
497
* cdef myOVERLAPPED *res
498
* res = <myOVERLAPPED *>PyMem_Malloc(sizeof(myOVERLAPPED))
499
* if not res: # <<<<<<<<<<<<<<
501
* memset(res, 0, sizeof(myOVERLAPPED))
503
__pyx_t_2 = (!(__pyx_v_res != 0));
506
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":112
507
* res = <myOVERLAPPED *>PyMem_Malloc(sizeof(myOVERLAPPED))
509
* raise MemoryError # <<<<<<<<<<<<<<
510
* memset(res, 0, sizeof(myOVERLAPPED))
513
__Pyx_Raise(__pyx_builtin_MemoryError, 0, 0);
514
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
519
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":113
522
* memset(res, 0, sizeof(myOVERLAPPED)) # <<<<<<<<<<<<<<
526
memset(__pyx_v_res, 0, (sizeof(struct __pyx_t_11iocpsupport_myOVERLAPPED)));
528
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":114
530
* memset(res, 0, sizeof(myOVERLAPPED))
531
* return res # <<<<<<<<<<<<<<
533
* cdef void raise_error(int err, object message) except *:
535
__pyx_r = __pyx_v_res;
541
__Pyx_AddTraceback("iocpsupport.makeOV");
544
__Pyx_FinishRefcountContext();
548
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":116
551
* cdef void raise_error(int err, object message) except *: # <<<<<<<<<<<<<<
553
* err = GetLastError()
556
static void __pyx_f_11iocpsupport_raise_error(int __pyx_v_err, PyObject *__pyx_v_message) {
558
PyObject *__pyx_t_2 = NULL;
559
PyObject *__pyx_t_3 = NULL;
560
__Pyx_SetupRefcountContext("raise_error");
562
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":117
564
* cdef void raise_error(int err, object message) except *:
565
* if not err: # <<<<<<<<<<<<<<
566
* err = GetLastError()
567
* raise WindowsError(message, err)
569
__pyx_t_1 = (!__pyx_v_err);
572
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":118
573
* cdef void raise_error(int err, object message) except *:
575
* err = GetLastError() # <<<<<<<<<<<<<<
576
* raise WindowsError(message, err)
579
__pyx_v_err = GetLastError();
584
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":119
586
* err = GetLastError()
587
* raise WindowsError(message, err) # <<<<<<<<<<<<<<
591
__pyx_t_2 = PyInt_FromLong(__pyx_v_err); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
592
__Pyx_GOTREF(__pyx_t_2);
593
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
594
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
595
__Pyx_INCREF(__pyx_v_message);
596
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_message);
597
__Pyx_GIVEREF(__pyx_v_message);
598
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
599
__Pyx_GIVEREF(__pyx_t_2);
601
__pyx_t_2 = PyObject_Call(__pyx_builtin_WindowsError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
602
__Pyx_GOTREF(__pyx_t_2);
603
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
604
__Pyx_Raise(__pyx_t_2, 0, 0);
605
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
606
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
610
__Pyx_XDECREF(__pyx_t_2);
611
__Pyx_XDECREF(__pyx_t_3);
612
__Pyx_AddTraceback("iocpsupport.raise_error");
614
__Pyx_FinishRefcountContext();
617
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":122
620
* def __init__(self, callback, owner, **kw): # <<<<<<<<<<<<<<
621
* self.callback = callback
625
static PyObject *__pyx_pf_11iocpsupport_5Event___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
626
static PyMethodDef __pyx_mdef_11iocpsupport_5Event___init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pf_11iocpsupport_5Event___init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
627
static PyObject *__pyx_pf_11iocpsupport_5Event___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
628
PyObject *__pyx_v_self = 0;
629
PyObject *__pyx_v_callback = 0;
630
PyObject *__pyx_v_owner = 0;
631
PyObject *__pyx_v_kw = 0;
634
PyObject *__pyx_r = NULL;
635
PyObject *__pyx_1 = 0;
636
PyObject *__pyx_2 = 0;
637
PyObject *__pyx_3 = 0;
638
PyObject *__pyx_t_1 = NULL;
639
Py_ssize_t __pyx_t_2;
640
PyObject *__pyx_t_3 = NULL;
642
static PyObject **__pyx_pyargnames[] = {&__pyx_kp_self,&__pyx_kp_callback,&__pyx_kp_owner,0};
643
__Pyx_SetupRefcountContext("__init__");
644
__pyx_self = __pyx_self;
645
__pyx_v_kw = PyDict_New(); if (unlikely(!__pyx_v_kw)) return NULL;
646
__Pyx_GOTREF(__pyx_v_kw);
647
if (unlikely(__pyx_kwds)) {
648
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
649
PyObject* values[3] = {0,0,0};
650
switch (PyTuple_GET_SIZE(__pyx_args)) {
651
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
652
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
653
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
655
default: goto __pyx_L5_argtuple_error;
657
switch (PyTuple_GET_SIZE(__pyx_args)) {
659
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_self);
660
if (likely(values[0])) kw_args--;
661
else goto __pyx_L5_argtuple_error;
663
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_callback);
664
if (likely(values[1])) kw_args--;
666
__Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
669
values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_owner);
670
if (likely(values[2])) kw_args--;
672
__Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
675
if (unlikely(kw_args > 0)) {
676
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kw, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
678
__pyx_v_self = values[0];
679
__pyx_v_callback = values[1];
680
__pyx_v_owner = values[2];
681
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
682
goto __pyx_L5_argtuple_error;
684
__pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0);
685
__pyx_v_callback = PyTuple_GET_ITEM(__pyx_args, 1);
686
__pyx_v_owner = PyTuple_GET_ITEM(__pyx_args, 2);
688
goto __pyx_L4_argument_unpacking_done;
689
__pyx_L5_argtuple_error:;
690
__Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
692
__Pyx_DECREF(__pyx_v_kw);
693
__Pyx_AddTraceback("iocpsupport.Event.__init__");
695
__pyx_L4_argument_unpacking_done:;
696
__pyx_v_k = Py_None; __Pyx_INCREF(Py_None);
697
__pyx_v_v = Py_None; __Pyx_INCREF(Py_None);
699
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":123
701
* def __init__(self, callback, owner, **kw):
702
* self.callback = callback # <<<<<<<<<<<<<<
704
* self.ignore = False
706
if (PyObject_SetAttr(__pyx_v_self, __pyx_kp_callback, __pyx_v_callback) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
708
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":124
709
* def __init__(self, callback, owner, **kw):
710
* self.callback = callback
711
* self.owner = owner # <<<<<<<<<<<<<<
712
* self.ignore = False
713
* for k, v in kw.items():
715
if (PyObject_SetAttr(__pyx_v_self, __pyx_kp_owner, __pyx_v_owner) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
717
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":125
718
* self.callback = callback
720
* self.ignore = False # <<<<<<<<<<<<<<
721
* for k, v in kw.items():
722
* setattr(self, k, v)
724
__pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
725
__Pyx_GOTREF(__pyx_t_1);
726
if (PyObject_SetAttr(__pyx_v_self, __pyx_kp_ignore, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
727
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
729
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":126
731
* self.ignore = False
732
* for k, v in kw.items(): # <<<<<<<<<<<<<<
733
* setattr(self, k, v)
736
__pyx_t_1 = PyObject_GetAttr(__pyx_v_kw, __pyx_kp_items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
737
__Pyx_GOTREF(__pyx_t_1);
738
__pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
739
__Pyx_GOTREF(__pyx_t_3);
740
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
741
if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
742
__pyx_t_2 = 0; __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1);
744
__pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
745
__Pyx_GOTREF(__pyx_t_1);
747
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
749
if (likely(PyList_CheckExact(__pyx_t_1))) {
750
if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
751
__pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
752
} else if (likely(PyTuple_CheckExact(__pyx_t_1))) {
753
if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
754
__pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
756
__pyx_t_3 = PyIter_Next(__pyx_t_1);
758
if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
761
__Pyx_GOTREF(__pyx_t_3);
763
if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 2)) {
764
PyObject* tuple = __pyx_t_3;
765
__pyx_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2);
766
__pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3);
767
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
768
__Pyx_DECREF(__pyx_v_k);
771
__Pyx_DECREF(__pyx_v_v);
775
__pyx_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
776
__Pyx_GOTREF(__pyx_1);
777
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
778
__pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
779
__Pyx_GOTREF(__pyx_2);
780
__pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
781
__Pyx_GOTREF(__pyx_3);
782
if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
783
__Pyx_DECREF(__pyx_1); __pyx_1 = 0;
784
__Pyx_DECREF(__pyx_v_k);
787
__Pyx_DECREF(__pyx_v_v);
792
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":127
793
* self.ignore = False
794
* for k, v in kw.items():
795
* setattr(self, k, v) # <<<<<<<<<<<<<<
797
* cdef class CompletionPort:
799
__pyx_t_4 = PyObject_SetAttr(__pyx_v_self, __pyx_v_k, __pyx_v_v); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
801
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
803
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
806
__Pyx_XDECREF(__pyx_1);
807
__Pyx_XDECREF(__pyx_2);
808
__Pyx_XDECREF(__pyx_3);
809
__Pyx_XDECREF(__pyx_t_1);
810
__Pyx_XDECREF(__pyx_t_3);
811
__Pyx_AddTraceback("iocpsupport.Event.__init__");
814
__Pyx_DECREF(__pyx_v_kw);
815
__Pyx_DECREF(__pyx_v_k);
816
__Pyx_DECREF(__pyx_v_v);
817
__Pyx_XGIVEREF(__pyx_r);
818
__Pyx_FinishRefcountContext();
822
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":131
823
* cdef class CompletionPort:
825
* def __init__(self): # <<<<<<<<<<<<<<
827
* res = CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0)
830
static int __pyx_pf_11iocpsupport_14CompletionPort___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
831
static int __pyx_pf_11iocpsupport_14CompletionPort___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
832
__pyx_t_11iocpsupport_HANDLE __pyx_v_res;
835
__Pyx_SetupRefcountContext("__init__");
836
if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
837
__Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
838
if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
840
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":133
841
* def __init__(self):
843
* res = CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0) # <<<<<<<<<<<<<<
845
* raise_error(0, 'CreateIoCompletionPort')
847
__pyx_v_res = CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0);
849
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":134
851
* res = CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0)
852
* if not res: # <<<<<<<<<<<<<<
853
* raise_error(0, 'CreateIoCompletionPort')
856
__pyx_t_1 = (!__pyx_v_res);
859
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":135
860
* res = CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0)
862
* raise_error(0, 'CreateIoCompletionPort') # <<<<<<<<<<<<<<
866
__pyx_f_11iocpsupport_raise_error(0, __pyx_kp_2); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
871
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":136
873
* raise_error(0, 'CreateIoCompletionPort')
874
* self.port = res # <<<<<<<<<<<<<<
876
* def addHandle(self, long handle, long key=0):
878
((struct __pyx_obj_11iocpsupport_CompletionPort *)__pyx_v_self)->port = __pyx_v_res;
883
__Pyx_AddTraceback("iocpsupport.CompletionPort.__init__");
886
__Pyx_FinishRefcountContext();
890
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":138
893
* def addHandle(self, long handle, long key=0): # <<<<<<<<<<<<<<
895
* res = CreateIoCompletionPort(handle, self.port, key, 0)
898
static PyObject *__pyx_pf_11iocpsupport_14CompletionPort_addHandle(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
899
static PyObject *__pyx_pf_11iocpsupport_14CompletionPort_addHandle(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
902
__pyx_t_11iocpsupport_HANDLE __pyx_v_res;
903
PyObject *__pyx_r = NULL;
905
static PyObject **__pyx_pyargnames[] = {&__pyx_kp_handle,&__pyx_kp_key,0};
906
__Pyx_SetupRefcountContext("addHandle");
907
if (unlikely(__pyx_kwds)) {
908
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
909
PyObject* values[2] = {0,0};
910
switch (PyTuple_GET_SIZE(__pyx_args)) {
911
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
912
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
914
default: goto __pyx_L5_argtuple_error;
916
switch (PyTuple_GET_SIZE(__pyx_args)) {
918
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_handle);
919
if (likely(values[0])) kw_args--;
920
else goto __pyx_L5_argtuple_error;
923
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_key);
924
if (unlikely(value)) { values[1] = value; kw_args--; }
927
if (unlikely(kw_args > 0)) {
928
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "addHandle") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
930
__pyx_v_handle = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_handle == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
932
__pyx_v_key = __Pyx_PyInt_AsLong(values[1]); if (unlikely((__pyx_v_key == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
938
switch (PyTuple_GET_SIZE(__pyx_args)) {
939
case 2: __pyx_v_key = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_key == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
940
case 1: __pyx_v_handle = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_handle == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
942
default: goto __pyx_L5_argtuple_error;
945
goto __pyx_L4_argument_unpacking_done;
946
__pyx_L5_argtuple_error:;
947
__Pyx_RaiseArgtupleInvalid("addHandle", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
949
__Pyx_AddTraceback("iocpsupport.CompletionPort.addHandle");
951
__pyx_L4_argument_unpacking_done:;
953
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":140
954
* def addHandle(self, long handle, long key=0):
956
* res = CreateIoCompletionPort(handle, self.port, key, 0) # <<<<<<<<<<<<<<
958
* raise_error(0, 'CreateIoCompletionPort')
960
__pyx_v_res = CreateIoCompletionPort(__pyx_v_handle, ((struct __pyx_obj_11iocpsupport_CompletionPort *)__pyx_v_self)->port, __pyx_v_key, 0);
962
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":141
964
* res = CreateIoCompletionPort(handle, self.port, key, 0)
965
* if not res: # <<<<<<<<<<<<<<
966
* raise_error(0, 'CreateIoCompletionPort')
969
__pyx_t_1 = (!__pyx_v_res);
972
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":142
973
* res = CreateIoCompletionPort(handle, self.port, key, 0)
975
* raise_error(0, 'CreateIoCompletionPort') # <<<<<<<<<<<<<<
977
* def getEvent(self, long timeout):
979
__pyx_f_11iocpsupport_raise_error(0, __pyx_kp_3); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
984
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
987
__Pyx_AddTraceback("iocpsupport.CompletionPort.addHandle");
990
__Pyx_XGIVEREF(__pyx_r);
991
__Pyx_FinishRefcountContext();
995
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":144
996
* raise_error(0, 'CreateIoCompletionPort')
998
* def getEvent(self, long timeout): # <<<<<<<<<<<<<<
999
* cdef PyThreadState *_save
1000
* cdef unsigned long bytes, key, rc
1003
static PyObject *__pyx_pf_11iocpsupport_14CompletionPort_getEvent(PyObject *__pyx_v_self, PyObject *__pyx_arg_timeout); /*proto*/
1004
static PyObject *__pyx_pf_11iocpsupport_14CompletionPort_getEvent(PyObject *__pyx_v_self, PyObject *__pyx_arg_timeout) {
1005
long __pyx_v_timeout;
1006
struct PyThreadState *__pyx_v__save;
1007
unsigned long __pyx_v_bytes;
1008
unsigned long __pyx_v_key;
1009
unsigned long __pyx_v_rc;
1010
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov;
1011
PyObject *__pyx_v_obj;
1012
PyObject *__pyx_r = NULL;
1014
PyObject *__pyx_t_2 = NULL;
1015
PyObject *__pyx_t_3 = NULL;
1016
PyObject *__pyx_t_4 = NULL;
1017
PyObject *__pyx_t_5 = NULL;
1018
__Pyx_SetupRefcountContext("getEvent");
1019
assert(__pyx_arg_timeout); {
1020
__pyx_v_timeout = __Pyx_PyInt_AsLong(__pyx_arg_timeout); if (unlikely((__pyx_v_timeout == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1022
goto __pyx_L4_argument_unpacking_done;
1024
__Pyx_AddTraceback("iocpsupport.CompletionPort.getEvent");
1026
__pyx_L4_argument_unpacking_done:;
1027
__pyx_v_obj = Py_None; __Pyx_INCREF(Py_None);
1029
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":149
1030
* cdef myOVERLAPPED *ov
1032
* _save = PyEval_SaveThread() # <<<<<<<<<<<<<<
1033
* rc = GetQueuedCompletionStatus(self.port, &bytes, &key, <OVERLAPPED **>&ov, timeout)
1034
* PyEval_RestoreThread(_save)
1036
__pyx_v__save = PyEval_SaveThread();
1038
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":150
1040
* _save = PyEval_SaveThread()
1041
* rc = GetQueuedCompletionStatus(self.port, &bytes, &key, <OVERLAPPED **>&ov, timeout) # <<<<<<<<<<<<<<
1042
* PyEval_RestoreThread(_save)
1045
__pyx_v_rc = GetQueuedCompletionStatus(((struct __pyx_obj_11iocpsupport_CompletionPort *)__pyx_v_self)->port, (&__pyx_v_bytes), (&__pyx_v_key), ((OVERLAPPED **)(&__pyx_v_ov)), __pyx_v_timeout);
1047
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":151
1048
* _save = PyEval_SaveThread()
1049
* rc = GetQueuedCompletionStatus(self.port, &bytes, &key, <OVERLAPPED **>&ov, timeout)
1050
* PyEval_RestoreThread(_save) # <<<<<<<<<<<<<<
1054
PyEval_RestoreThread(__pyx_v__save);
1056
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":153
1057
* PyEval_RestoreThread(_save)
1059
* if not rc: # <<<<<<<<<<<<<<
1060
* rc = GetLastError()
1063
__pyx_t_1 = (!__pyx_v_rc);
1066
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":154
1069
* rc = GetLastError() # <<<<<<<<<<<<<<
1073
__pyx_v_rc = GetLastError();
1078
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":156
1079
* rc = GetLastError()
1081
* rc = 0 # <<<<<<<<<<<<<<
1089
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":158
1092
* obj = None # <<<<<<<<<<<<<<
1096
__Pyx_INCREF(Py_None);
1097
__Pyx_DECREF(__pyx_v_obj);
1098
__pyx_v_obj = Py_None;
1100
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":159
1103
* if ov: # <<<<<<<<<<<<<<
1105
* obj = <object>ov.obj
1107
__pyx_t_1 = (__pyx_v_ov != 0);
1110
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":160
1113
* if ov.obj: # <<<<<<<<<<<<<<
1114
* obj = <object>ov.obj
1115
* Py_DECREF(obj) # we are stealing a reference here
1117
__pyx_t_1 = (__pyx_v_ov->obj != 0);
1120
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":161
1123
* obj = <object>ov.obj # <<<<<<<<<<<<<<
1124
* Py_DECREF(obj) # we are stealing a reference here
1127
__Pyx_INCREF(((PyObject *)__pyx_v_ov->obj));
1128
__Pyx_DECREF(__pyx_v_obj);
1129
__pyx_v_obj = ((PyObject *)__pyx_v_ov->obj);
1131
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":162
1133
* obj = <object>ov.obj
1134
* Py_DECREF(obj) # we are stealing a reference here # <<<<<<<<<<<<<<
1138
Py_DECREF(__pyx_v_obj);
1143
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":163
1144
* obj = <object>ov.obj
1145
* Py_DECREF(obj) # we are stealing a reference here
1146
* PyMem_Free(ov) # <<<<<<<<<<<<<<
1148
* return (rc, bytes, key, obj)
1150
PyMem_Free(__pyx_v_ov);
1155
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":165
1158
* return (rc, bytes, key, obj) # <<<<<<<<<<<<<<
1160
* def postEvent(self, unsigned long bytes, unsigned long key, obj):
1162
__Pyx_XDECREF(__pyx_r);
1163
__pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_rc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1164
__Pyx_GOTREF(__pyx_t_2);
1165
__pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_bytes); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1166
__Pyx_GOTREF(__pyx_t_3);
1167
__pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_key); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1168
__Pyx_GOTREF(__pyx_t_4);
1169
__pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1170
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
1171
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
1172
__Pyx_GIVEREF(__pyx_t_2);
1173
PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
1174
__Pyx_GIVEREF(__pyx_t_3);
1175
PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
1176
__Pyx_GIVEREF(__pyx_t_4);
1177
__Pyx_INCREF(__pyx_v_obj);
1178
PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_obj);
1179
__Pyx_GIVEREF(__pyx_v_obj);
1183
__pyx_r = ((PyObject *)__pyx_t_5);
1187
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
1190
__Pyx_XDECREF(__pyx_t_2);
1191
__Pyx_XDECREF(__pyx_t_3);
1192
__Pyx_XDECREF(__pyx_t_4);
1193
__Pyx_XDECREF(__pyx_t_5);
1194
__Pyx_AddTraceback("iocpsupport.CompletionPort.getEvent");
1197
__Pyx_DECREF(__pyx_v_obj);
1198
__Pyx_XGIVEREF(__pyx_r);
1199
__Pyx_FinishRefcountContext();
1203
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":167
1204
* return (rc, bytes, key, obj)
1206
* def postEvent(self, unsigned long bytes, unsigned long key, obj): # <<<<<<<<<<<<<<
1207
* cdef myOVERLAPPED *ov
1208
* cdef unsigned long rc
1211
static PyObject *__pyx_pf_11iocpsupport_14CompletionPort_postEvent(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1212
static PyObject *__pyx_pf_11iocpsupport_14CompletionPort_postEvent(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1213
unsigned long __pyx_v_bytes;
1214
unsigned long __pyx_v_key;
1215
PyObject *__pyx_v_obj = 0;
1216
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov;
1217
unsigned long __pyx_v_rc;
1218
PyObject *__pyx_r = NULL;
1220
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_t_2;
1221
static PyObject **__pyx_pyargnames[] = {&__pyx_kp_bytes,&__pyx_kp_key,&__pyx_kp_obj,0};
1222
__Pyx_SetupRefcountContext("postEvent");
1223
if (unlikely(__pyx_kwds)) {
1224
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
1225
PyObject* values[3] = {0,0,0};
1226
switch (PyTuple_GET_SIZE(__pyx_args)) {
1227
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1228
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1229
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1231
default: goto __pyx_L5_argtuple_error;
1233
switch (PyTuple_GET_SIZE(__pyx_args)) {
1235
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_bytes);
1236
if (likely(values[0])) kw_args--;
1237
else goto __pyx_L5_argtuple_error;
1239
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_key);
1240
if (likely(values[1])) kw_args--;
1242
__Pyx_RaiseArgtupleInvalid("postEvent", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1245
values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_obj);
1246
if (likely(values[2])) kw_args--;
1248
__Pyx_RaiseArgtupleInvalid("postEvent", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1251
if (unlikely(kw_args > 0)) {
1252
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "postEvent") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1254
__pyx_v_bytes = __Pyx_PyInt_AsUnsignedLong(values[0]); if (unlikely((__pyx_v_bytes == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1255
__pyx_v_key = __Pyx_PyInt_AsUnsignedLong(values[1]); if (unlikely((__pyx_v_key == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1256
__pyx_v_obj = values[2];
1257
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
1258
goto __pyx_L5_argtuple_error;
1260
__pyx_v_bytes = __Pyx_PyInt_AsUnsignedLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_bytes == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1261
__pyx_v_key = __Pyx_PyInt_AsUnsignedLong(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_key == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1262
__pyx_v_obj = PyTuple_GET_ITEM(__pyx_args, 2);
1264
goto __pyx_L4_argument_unpacking_done;
1265
__pyx_L5_argtuple_error:;
1266
__Pyx_RaiseArgtupleInvalid("postEvent", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1268
__Pyx_AddTraceback("iocpsupport.CompletionPort.postEvent");
1270
__pyx_L4_argument_unpacking_done:;
1272
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":171
1273
* cdef unsigned long rc
1275
* if obj is not None: # <<<<<<<<<<<<<<
1277
* Py_INCREF(obj) # give ov its own reference to obj
1279
__pyx_t_1 = (__pyx_v_obj != Py_None);
1282
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":172
1284
* if obj is not None:
1285
* ov = makeOV() # <<<<<<<<<<<<<<
1286
* Py_INCREF(obj) # give ov its own reference to obj
1287
* ov.obj = <PyObject *>obj
1289
__pyx_t_2 = __pyx_f_11iocpsupport_makeOV(); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1290
__pyx_v_ov = __pyx_t_2;
1292
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":173
1293
* if obj is not None:
1295
* Py_INCREF(obj) # give ov its own reference to obj # <<<<<<<<<<<<<<
1296
* ov.obj = <PyObject *>obj
1299
Py_INCREF(__pyx_v_obj);
1301
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":174
1303
* Py_INCREF(obj) # give ov its own reference to obj
1304
* ov.obj = <PyObject *>obj # <<<<<<<<<<<<<<
1308
__pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj);
1313
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":176
1314
* ov.obj = <PyObject *>obj
1316
* ov = NULL # <<<<<<<<<<<<<<
1318
* rc = PostQueuedCompletionStatus(self.port, bytes, key, <OVERLAPPED *>ov)
1324
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":178
1327
* rc = PostQueuedCompletionStatus(self.port, bytes, key, <OVERLAPPED *>ov) # <<<<<<<<<<<<<<
1329
* raise_error(0, 'PostQueuedCompletionStatus')
1331
__pyx_v_rc = PostQueuedCompletionStatus(((struct __pyx_obj_11iocpsupport_CompletionPort *)__pyx_v_self)->port, __pyx_v_bytes, __pyx_v_key, ((OVERLAPPED *)__pyx_v_ov));
1333
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":179
1335
* rc = PostQueuedCompletionStatus(self.port, bytes, key, <OVERLAPPED *>ov)
1336
* if not rc: # <<<<<<<<<<<<<<
1337
* raise_error(0, 'PostQueuedCompletionStatus')
1340
__pyx_t_1 = (!__pyx_v_rc);
1343
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":180
1344
* rc = PostQueuedCompletionStatus(self.port, bytes, key, <OVERLAPPED *>ov)
1346
* raise_error(0, 'PostQueuedCompletionStatus') # <<<<<<<<<<<<<<
1348
* def __del__(self):
1350
__pyx_f_11iocpsupport_raise_error(0, __pyx_kp_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1355
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
1358
__Pyx_AddTraceback("iocpsupport.CompletionPort.postEvent");
1361
__Pyx_XGIVEREF(__pyx_r);
1362
__Pyx_FinishRefcountContext();
1366
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":182
1367
* raise_error(0, 'PostQueuedCompletionStatus')
1369
* def __del__(self): # <<<<<<<<<<<<<<
1370
* CloseHandle(self.port)
1374
static PyObject *__pyx_pf_11iocpsupport_14CompletionPort___del__(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
1375
static PyObject *__pyx_pf_11iocpsupport_14CompletionPort___del__(PyObject *__pyx_v_self, PyObject *unused) {
1376
PyObject *__pyx_r = NULL;
1377
__Pyx_SetupRefcountContext("__del__");
1379
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":183
1381
* def __del__(self):
1382
* CloseHandle(self.port) # <<<<<<<<<<<<<<
1384
* def makesockaddr(object buff):
1386
CloseHandle(((struct __pyx_obj_11iocpsupport_CompletionPort *)__pyx_v_self)->port);
1388
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
1389
__Pyx_XGIVEREF(__pyx_r);
1390
__Pyx_FinishRefcountContext();
1394
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":185
1395
* CloseHandle(self.port)
1397
* def makesockaddr(object buff): # <<<<<<<<<<<<<<
1398
* cdef void *mem_buffer
1402
static PyObject *__pyx_pf_11iocpsupport_makesockaddr(PyObject *__pyx_self, PyObject *__pyx_v_buff); /*proto*/
1403
static PyObject *__pyx_pf_11iocpsupport_makesockaddr(PyObject *__pyx_self, PyObject *__pyx_v_buff) {
1404
void *__pyx_v_mem_buffer;
1406
PyObject *__pyx_r = NULL;
1408
PyObject *__pyx_t_2 = NULL;
1409
__Pyx_SetupRefcountContext("makesockaddr");
1410
__pyx_self = __pyx_self;
1412
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":189
1415
* PyObject_AsReadBuffer(buff, &mem_buffer, &size) # <<<<<<<<<<<<<<
1416
* # XXX: this should really return the address family as well
1417
* return _makesockaddr(<sockaddr *>mem_buffer, size)
1419
__pyx_t_1 = PyObject_AsReadBuffer(__pyx_v_buff, (&__pyx_v_mem_buffer), (&__pyx_v_size)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1421
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":191
1422
* PyObject_AsReadBuffer(buff, &mem_buffer, &size)
1423
* # XXX: this should really return the address family as well
1424
* return _makesockaddr(<sockaddr *>mem_buffer, size) # <<<<<<<<<<<<<<
1426
* cdef object _makesockaddr(sockaddr *addr, int len):
1428
__Pyx_XDECREF(__pyx_r);
1429
__pyx_t_2 = __pyx_f_11iocpsupport__makesockaddr(((struct sockaddr *)__pyx_v_mem_buffer), __pyx_v_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1430
__Pyx_GOTREF(__pyx_t_2);
1431
__pyx_r = __pyx_t_2;
1435
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
1438
__Pyx_XDECREF(__pyx_t_2);
1439
__Pyx_AddTraceback("iocpsupport.makesockaddr");
1442
__Pyx_XGIVEREF(__pyx_r);
1443
__Pyx_FinishRefcountContext();
1447
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":193
1448
* return _makesockaddr(<sockaddr *>mem_buffer, size)
1450
* cdef object _makesockaddr(sockaddr *addr, int len): # <<<<<<<<<<<<<<
1451
* cdef sockaddr_in *sin
1455
static PyObject *__pyx_f_11iocpsupport__makesockaddr(struct sockaddr *__pyx_v_addr, int __pyx_v_len) {
1456
struct sockaddr_in *__pyx_v_sin;
1457
PyObject *__pyx_r = NULL;
1459
PyObject *__pyx_t_2 = NULL;
1460
PyObject *__pyx_t_3 = NULL;
1461
PyObject *__pyx_t_4 = NULL;
1462
__Pyx_SetupRefcountContext("_makesockaddr");
1464
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":195
1465
* cdef object _makesockaddr(sockaddr *addr, int len):
1466
* cdef sockaddr_in *sin
1467
* if not len: # <<<<<<<<<<<<<<
1469
* if addr.sa_family == AF_INET:
1471
__pyx_t_1 = (!__pyx_v_len);
1474
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":196
1475
* cdef sockaddr_in *sin
1477
* return None # <<<<<<<<<<<<<<
1478
* if addr.sa_family == AF_INET:
1479
* sin = <sockaddr_in *>addr
1481
__Pyx_XDECREF(__pyx_r);
1482
__Pyx_INCREF(Py_None);
1489
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":197
1492
* if addr.sa_family == AF_INET: # <<<<<<<<<<<<<<
1493
* sin = <sockaddr_in *>addr
1494
* return PyString_FromString(inet_ntoa(sin.sin_addr)), ntohs(sin.sin_port)
1496
__pyx_t_1 = (__pyx_v_addr->sa_family == AF_INET);
1499
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":198
1501
* if addr.sa_family == AF_INET:
1502
* sin = <sockaddr_in *>addr # <<<<<<<<<<<<<<
1503
* return PyString_FromString(inet_ntoa(sin.sin_addr)), ntohs(sin.sin_port)
1506
__pyx_v_sin = ((struct sockaddr_in *)__pyx_v_addr);
1508
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":199
1509
* if addr.sa_family == AF_INET:
1510
* sin = <sockaddr_in *>addr
1511
* return PyString_FromString(inet_ntoa(sin.sin_addr)), ntohs(sin.sin_port) # <<<<<<<<<<<<<<
1513
* return PyString_FromStringAndSize(addr.sa_data, sizeof(addr.sa_data))
1515
__Pyx_XDECREF(__pyx_r);
1516
__pyx_t_2 = PyString_FromString(inet_ntoa(__pyx_v_sin->sin_addr)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1517
__Pyx_GOTREF(__pyx_t_2);
1518
__pyx_t_3 = PyInt_FromLong(ntohs(__pyx_v_sin->sin_port)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1519
__Pyx_GOTREF(__pyx_t_3);
1520
__pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1521
__Pyx_GOTREF(((PyObject *)__pyx_t_4));
1522
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
1523
__Pyx_GIVEREF(__pyx_t_2);
1524
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
1525
__Pyx_GIVEREF(__pyx_t_3);
1528
__pyx_r = ((PyObject *)__pyx_t_4);
1535
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":201
1536
* return PyString_FromString(inet_ntoa(sin.sin_addr)), ntohs(sin.sin_port)
1538
* return PyString_FromStringAndSize(addr.sa_data, sizeof(addr.sa_data)) # <<<<<<<<<<<<<<
1540
* cdef object fillinetaddr(sockaddr_in *dest, object addr):
1542
__Pyx_XDECREF(__pyx_r);
1543
__pyx_t_4 = PyString_FromStringAndSize(__pyx_v_addr->sa_data, (sizeof(__pyx_v_addr->sa_data))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1544
__Pyx_GOTREF(__pyx_t_4);
1545
__pyx_r = __pyx_t_4;
1551
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
1554
__Pyx_XDECREF(__pyx_t_2);
1555
__Pyx_XDECREF(__pyx_t_3);
1556
__Pyx_XDECREF(__pyx_t_4);
1557
__Pyx_AddTraceback("iocpsupport._makesockaddr");
1560
__Pyx_XGIVEREF(__pyx_r);
1561
__Pyx_FinishRefcountContext();
1565
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":203
1566
* return PyString_FromStringAndSize(addr.sa_data, sizeof(addr.sa_data))
1568
* cdef object fillinetaddr(sockaddr_in *dest, object addr): # <<<<<<<<<<<<<<
1569
* cdef unsigned short port
1570
* cdef unsigned long res
1573
static PyObject *__pyx_f_11iocpsupport_fillinetaddr(struct sockaddr_in *__pyx_v_dest, PyObject *__pyx_v_addr) {
1574
unsigned short __pyx_v_port;
1575
unsigned long __pyx_v_res;
1576
char *__pyx_v_hoststr;
1577
PyObject *__pyx_v_host;
1578
PyObject *__pyx_r = NULL;
1579
PyObject *__pyx_1 = 0;
1580
PyObject *__pyx_2 = 0;
1581
PyObject *__pyx_3 = 0;
1582
unsigned short __pyx_t_1;
1585
__Pyx_SetupRefcountContext("fillinetaddr");
1586
__pyx_v_host = Py_None; __Pyx_INCREF(Py_None);
1588
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":207
1589
* cdef unsigned long res
1590
* cdef char *hoststr
1591
* host, port = addr # <<<<<<<<<<<<<<
1593
* hoststr = PyString_AsString(host)
1595
if (PyTuple_CheckExact(__pyx_v_addr) && likely(PyTuple_GET_SIZE(__pyx_v_addr) == 2)) {
1596
PyObject* tuple = __pyx_v_addr;
1597
__pyx_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2);
1598
__pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3);
1599
__pyx_t_1 = __Pyx_PyInt_AsUnsignedShort(__pyx_3); if (unlikely((__pyx_t_1 == (unsigned short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1600
__Pyx_DECREF(__pyx_3); __pyx_3 = 0;
1601
__Pyx_DECREF(__pyx_v_host);
1602
__pyx_v_host = __pyx_2;
1604
__pyx_v_port = __pyx_t_1;
1606
__pyx_1 = PyObject_GetIter(__pyx_v_addr); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1607
__Pyx_GOTREF(__pyx_1);
1608
__pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1609
__Pyx_GOTREF(__pyx_2);
1610
__pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1611
__Pyx_GOTREF(__pyx_3);
1612
__pyx_t_1 = __Pyx_PyInt_AsUnsignedShort(__pyx_3); if (unlikely((__pyx_t_1 == (unsigned short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1613
__Pyx_DECREF(__pyx_3); __pyx_3 = 0;
1614
if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1615
__Pyx_DECREF(__pyx_1); __pyx_1 = 0;
1616
__Pyx_DECREF(__pyx_v_host);
1617
__pyx_v_host = __pyx_2;
1619
__pyx_v_port = __pyx_t_1;
1622
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":209
1625
* hoststr = PyString_AsString(host) # <<<<<<<<<<<<<<
1626
* res = inet_addr(hoststr)
1627
* if res == INADDR_ANY:
1629
__pyx_t_2 = PyString_AsString(__pyx_v_host); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1630
__pyx_v_hoststr = __pyx_t_2;
1632
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":210
1634
* hoststr = PyString_AsString(host)
1635
* res = inet_addr(hoststr) # <<<<<<<<<<<<<<
1636
* if res == INADDR_ANY:
1637
* raise ValueError, 'invalid IP address'
1639
__pyx_v_res = inet_addr(__pyx_v_hoststr);
1641
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":211
1642
* hoststr = PyString_AsString(host)
1643
* res = inet_addr(hoststr)
1644
* if res == INADDR_ANY: # <<<<<<<<<<<<<<
1645
* raise ValueError, 'invalid IP address'
1646
* dest.sin_addr.s_addr = res
1648
__pyx_t_3 = (__pyx_v_res == INADDR_ANY);
1651
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":212
1652
* res = inet_addr(hoststr)
1653
* if res == INADDR_ANY:
1654
* raise ValueError, 'invalid IP address' # <<<<<<<<<<<<<<
1655
* dest.sin_addr.s_addr = res
1658
__Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_5, 0);
1659
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1664
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":213
1665
* if res == INADDR_ANY:
1666
* raise ValueError, 'invalid IP address'
1667
* dest.sin_addr.s_addr = res # <<<<<<<<<<<<<<
1669
* dest.sin_port = htons(port)
1671
__pyx_v_dest->sin_addr.s_addr = __pyx_v_res;
1673
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":215
1674
* dest.sin_addr.s_addr = res
1676
* dest.sin_port = htons(port) # <<<<<<<<<<<<<<
1678
* def AllocateReadBuffer(int size):
1680
__pyx_v_dest->sin_port = htons(__pyx_v_port);
1682
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
1685
__Pyx_XDECREF(__pyx_1);
1686
__Pyx_XDECREF(__pyx_2);
1687
__Pyx_XDECREF(__pyx_3);
1688
__Pyx_AddTraceback("iocpsupport.fillinetaddr");
1691
__Pyx_DECREF(__pyx_v_host);
1692
__Pyx_XGIVEREF(__pyx_r);
1693
__Pyx_FinishRefcountContext();
1697
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":217
1698
* dest.sin_port = htons(port)
1700
* def AllocateReadBuffer(int size): # <<<<<<<<<<<<<<
1701
* return PyBuffer_New(size)
1705
static PyObject *__pyx_pf_11iocpsupport_AllocateReadBuffer(PyObject *__pyx_self, PyObject *__pyx_arg_size); /*proto*/
1706
static PyObject *__pyx_pf_11iocpsupport_AllocateReadBuffer(PyObject *__pyx_self, PyObject *__pyx_arg_size) {
1708
PyObject *__pyx_r = NULL;
1709
PyObject *__pyx_t_1 = NULL;
1710
__Pyx_SetupRefcountContext("AllocateReadBuffer");
1711
__pyx_self = __pyx_self;
1712
assert(__pyx_arg_size); {
1713
__pyx_v_size = __Pyx_PyInt_AsInt(__pyx_arg_size); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1715
goto __pyx_L4_argument_unpacking_done;
1717
__Pyx_AddTraceback("iocpsupport.AllocateReadBuffer");
1719
__pyx_L4_argument_unpacking_done:;
1721
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":218
1723
* def AllocateReadBuffer(int size):
1724
* return PyBuffer_New(size) # <<<<<<<<<<<<<<
1726
* def maxAddrLen(long s):
1728
__Pyx_XDECREF(__pyx_r);
1729
__pyx_t_1 = PyBuffer_New(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1730
__Pyx_GOTREF(__pyx_t_1);
1731
__pyx_r = __pyx_t_1;
1735
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
1738
__Pyx_XDECREF(__pyx_t_1);
1739
__Pyx_AddTraceback("iocpsupport.AllocateReadBuffer");
1742
__Pyx_XGIVEREF(__pyx_r);
1743
__Pyx_FinishRefcountContext();
1747
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":220
1748
* return PyBuffer_New(size)
1750
* def maxAddrLen(long s): # <<<<<<<<<<<<<<
1751
* cdef WSAPROTOCOL_INFO wsa_pi
1755
static PyObject *__pyx_pf_11iocpsupport_maxAddrLen(PyObject *__pyx_self, PyObject *__pyx_arg_s); /*proto*/
1756
static PyObject *__pyx_pf_11iocpsupport_maxAddrLen(PyObject *__pyx_self, PyObject *__pyx_arg_s) {
1758
WSAPROTOCOL_INFO __pyx_v_wsa_pi;
1761
PyObject *__pyx_r = NULL;
1763
PyObject *__pyx_t_2 = NULL;
1764
__Pyx_SetupRefcountContext("maxAddrLen");
1765
__pyx_self = __pyx_self;
1766
assert(__pyx_arg_s); {
1767
__pyx_v_s = __Pyx_PyInt_AsLong(__pyx_arg_s); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1769
goto __pyx_L4_argument_unpacking_done;
1771
__Pyx_AddTraceback("iocpsupport.maxAddrLen");
1773
__pyx_L4_argument_unpacking_done:;
1775
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":224
1778
* size = sizeof(wsa_pi) # <<<<<<<<<<<<<<
1779
* rc = getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, <char *>&wsa_pi, &size)
1780
* if rc == SOCKET_ERROR:
1782
__pyx_v_size = (sizeof(__pyx_v_wsa_pi));
1784
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":225
1786
* size = sizeof(wsa_pi)
1787
* rc = getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, <char *>&wsa_pi, &size) # <<<<<<<<<<<<<<
1788
* if rc == SOCKET_ERROR:
1789
* raise_error(WSAGetLastError(), 'getsockopt')
1791
__pyx_v_rc = getsockopt(__pyx_v_s, SOL_SOCKET, SO_PROTOCOL_INFO, ((char *)(&__pyx_v_wsa_pi)), (&__pyx_v_size));
1793
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":226
1794
* size = sizeof(wsa_pi)
1795
* rc = getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, <char *>&wsa_pi, &size)
1796
* if rc == SOCKET_ERROR: # <<<<<<<<<<<<<<
1797
* raise_error(WSAGetLastError(), 'getsockopt')
1798
* return wsa_pi.iMaxSockAddr
1800
__pyx_t_1 = (__pyx_v_rc == SOCKET_ERROR);
1803
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":227
1804
* rc = getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, <char *>&wsa_pi, &size)
1805
* if rc == SOCKET_ERROR:
1806
* raise_error(WSAGetLastError(), 'getsockopt') # <<<<<<<<<<<<<<
1807
* return wsa_pi.iMaxSockAddr
1810
__pyx_f_11iocpsupport_raise_error(WSAGetLastError(), __pyx_kp_6); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1815
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":228
1816
* if rc == SOCKET_ERROR:
1817
* raise_error(WSAGetLastError(), 'getsockopt')
1818
* return wsa_pi.iMaxSockAddr # <<<<<<<<<<<<<<
1820
* cdef int getAddrFamily(SOCKET s) except *:
1822
__Pyx_XDECREF(__pyx_r);
1823
__pyx_t_2 = PyInt_FromLong(__pyx_v_wsa_pi.iMaxSockAddr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1824
__Pyx_GOTREF(__pyx_t_2);
1825
__pyx_r = __pyx_t_2;
1829
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
1832
__Pyx_XDECREF(__pyx_t_2);
1833
__Pyx_AddTraceback("iocpsupport.maxAddrLen");
1836
__Pyx_XGIVEREF(__pyx_r);
1837
__Pyx_FinishRefcountContext();
1841
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":230
1842
* return wsa_pi.iMaxSockAddr
1844
* cdef int getAddrFamily(SOCKET s) except *: # <<<<<<<<<<<<<<
1845
* cdef WSAPROTOCOL_INFO wsa_pi
1849
static int __pyx_f_11iocpsupport_getAddrFamily(__pyx_t_11iocpsupport_SOCKET __pyx_v_s) {
1850
WSAPROTOCOL_INFO __pyx_v_wsa_pi;
1855
__Pyx_SetupRefcountContext("getAddrFamily");
1857
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":234
1860
* size = sizeof(wsa_pi) # <<<<<<<<<<<<<<
1861
* rc = getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, <char *>&wsa_pi, &size)
1862
* if rc == SOCKET_ERROR:
1864
__pyx_v_size = (sizeof(__pyx_v_wsa_pi));
1866
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":235
1868
* size = sizeof(wsa_pi)
1869
* rc = getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, <char *>&wsa_pi, &size) # <<<<<<<<<<<<<<
1870
* if rc == SOCKET_ERROR:
1871
* raise_error(WSAGetLastError(), 'getsockopt')
1873
__pyx_v_rc = getsockopt(__pyx_v_s, SOL_SOCKET, SO_PROTOCOL_INFO, ((char *)(&__pyx_v_wsa_pi)), (&__pyx_v_size));
1875
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":236
1876
* size = sizeof(wsa_pi)
1877
* rc = getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, <char *>&wsa_pi, &size)
1878
* if rc == SOCKET_ERROR: # <<<<<<<<<<<<<<
1879
* raise_error(WSAGetLastError(), 'getsockopt')
1880
* return wsa_pi.iAddressFamily
1882
__pyx_t_1 = (__pyx_v_rc == SOCKET_ERROR);
1885
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":237
1886
* rc = getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, <char *>&wsa_pi, &size)
1887
* if rc == SOCKET_ERROR:
1888
* raise_error(WSAGetLastError(), 'getsockopt') # <<<<<<<<<<<<<<
1889
* return wsa_pi.iAddressFamily
1892
__pyx_f_11iocpsupport_raise_error(WSAGetLastError(), __pyx_kp_7); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1897
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":238
1898
* if rc == SOCKET_ERROR:
1899
* raise_error(WSAGetLastError(), 'getsockopt')
1900
* return wsa_pi.iAddressFamily # <<<<<<<<<<<<<<
1902
* import socket # for WSAStartup
1904
__pyx_r = __pyx_v_wsa_pi.iAddressFamily;
1910
__Pyx_AddTraceback("iocpsupport.getAddrFamily");
1913
__Pyx_FinishRefcountContext();
1917
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":5
1920
* def accept(long listening, long accepting, object buff, object obj): # <<<<<<<<<<<<<<
1921
* cdef unsigned long bytes
1925
static PyObject *__pyx_pf_11iocpsupport_accept(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1926
static PyObject *__pyx_pf_11iocpsupport_accept(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1927
long __pyx_v_listening;
1928
long __pyx_v_accepting;
1929
PyObject *__pyx_v_buff = 0;
1930
PyObject *__pyx_v_obj = 0;
1931
unsigned long __pyx_v_bytes;
1934
void *__pyx_v_mem_buffer;
1935
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov;
1936
PyObject *__pyx_r = NULL;
1938
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_t_2;
1940
PyObject *__pyx_t_4 = NULL;
1941
static PyObject **__pyx_pyargnames[] = {&__pyx_kp_listening,&__pyx_kp_accepting,&__pyx_kp_buff,&__pyx_kp_obj,0};
1942
__Pyx_SetupRefcountContext("accept");
1943
__pyx_self = __pyx_self;
1944
if (unlikely(__pyx_kwds)) {
1945
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
1946
PyObject* values[4] = {0,0,0,0};
1947
switch (PyTuple_GET_SIZE(__pyx_args)) {
1948
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
1949
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1950
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1951
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1953
default: goto __pyx_L5_argtuple_error;
1955
switch (PyTuple_GET_SIZE(__pyx_args)) {
1957
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_listening);
1958
if (likely(values[0])) kw_args--;
1959
else goto __pyx_L5_argtuple_error;
1961
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_accepting);
1962
if (likely(values[1])) kw_args--;
1964
__Pyx_RaiseArgtupleInvalid("accept", 1, 4, 4, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1967
values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_buff);
1968
if (likely(values[2])) kw_args--;
1970
__Pyx_RaiseArgtupleInvalid("accept", 1, 4, 4, 2); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1973
values[3] = PyDict_GetItem(__pyx_kwds, __pyx_kp_obj);
1974
if (likely(values[3])) kw_args--;
1976
__Pyx_RaiseArgtupleInvalid("accept", 1, 4, 4, 3); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1979
if (unlikely(kw_args > 0)) {
1980
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "accept") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1982
__pyx_v_listening = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_listening == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1983
__pyx_v_accepting = __Pyx_PyInt_AsLong(values[1]); if (unlikely((__pyx_v_accepting == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1984
__pyx_v_buff = values[2];
1985
__pyx_v_obj = values[3];
1986
} else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
1987
goto __pyx_L5_argtuple_error;
1989
__pyx_v_listening = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_listening == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1990
__pyx_v_accepting = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_accepting == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1991
__pyx_v_buff = PyTuple_GET_ITEM(__pyx_args, 2);
1992
__pyx_v_obj = PyTuple_GET_ITEM(__pyx_args, 3);
1994
goto __pyx_L4_argument_unpacking_done;
1995
__pyx_L5_argtuple_error:;
1996
__Pyx_RaiseArgtupleInvalid("accept", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1998
__Pyx_AddTraceback("iocpsupport.accept");
2000
__pyx_L4_argument_unpacking_done:;
2002
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":11
2003
* cdef myOVERLAPPED *ov
2005
* PyObject_AsWriteBuffer(buff, &mem_buffer, &size) # <<<<<<<<<<<<<<
2009
__pyx_t_1 = PyObject_AsWriteBuffer(__pyx_v_buff, (&__pyx_v_mem_buffer), (&__pyx_v_size)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2011
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":13
2012
* PyObject_AsWriteBuffer(buff, &mem_buffer, &size)
2014
* ov = makeOV() # <<<<<<<<<<<<<<
2015
* if obj is not None:
2016
* ov.obj = <PyObject *>obj
2018
__pyx_t_2 = __pyx_f_11iocpsupport_makeOV(); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2019
__pyx_v_ov = __pyx_t_2;
2021
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":14
2024
* if obj is not None: # <<<<<<<<<<<<<<
2025
* ov.obj = <PyObject *>obj
2028
__pyx_t_3 = (__pyx_v_obj != Py_None);
2031
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":15
2033
* if obj is not None:
2034
* ov.obj = <PyObject *>obj # <<<<<<<<<<<<<<
2036
* rc = lpAcceptEx(listening, accepting, mem_buffer, 0, size / 2, size / 2,
2038
__pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj);
2043
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":18
2045
* rc = lpAcceptEx(listening, accepting, mem_buffer, 0, size / 2, size / 2,
2046
* &bytes, <OVERLAPPED *>ov) # <<<<<<<<<<<<<<
2048
* rc = WSAGetLastError()
2050
__pyx_v_rc = lpAcceptEx(__pyx_v_listening, __pyx_v_accepting, __pyx_v_mem_buffer, 0, (__pyx_v_size / 2), (__pyx_v_size / 2), (&__pyx_v_bytes), ((OVERLAPPED *)__pyx_v_ov));
2052
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":19
2053
* rc = lpAcceptEx(listening, accepting, mem_buffer, 0, size / 2, size / 2,
2054
* &bytes, <OVERLAPPED *>ov)
2055
* if not rc: # <<<<<<<<<<<<<<
2056
* rc = WSAGetLastError()
2057
* if rc != ERROR_IO_PENDING:
2059
__pyx_t_3 = (!__pyx_v_rc);
2062
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":20
2063
* &bytes, <OVERLAPPED *>ov)
2065
* rc = WSAGetLastError() # <<<<<<<<<<<<<<
2066
* if rc != ERROR_IO_PENDING:
2069
__pyx_v_rc = WSAGetLastError();
2071
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":21
2073
* rc = WSAGetLastError()
2074
* if rc != ERROR_IO_PENDING: # <<<<<<<<<<<<<<
2078
__pyx_t_3 = (__pyx_v_rc != ERROR_IO_PENDING);
2081
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":22
2082
* rc = WSAGetLastError()
2083
* if rc != ERROR_IO_PENDING:
2084
* return rc # <<<<<<<<<<<<<<
2086
* # operation is in progress
2088
__Pyx_XDECREF(__pyx_r);
2089
__pyx_t_4 = PyInt_FromLong(__pyx_v_rc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2090
__Pyx_GOTREF(__pyx_t_4);
2091
__pyx_r = __pyx_t_4;
2101
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":25
2103
* # operation is in progress
2104
* Py_XINCREF(obj) # <<<<<<<<<<<<<<
2108
Py_XINCREF(__pyx_v_obj);
2110
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":26
2111
* # operation is in progress
2113
* return rc # <<<<<<<<<<<<<<
2115
* def get_accept_addrs(long s, object buff):
2117
__Pyx_XDECREF(__pyx_r);
2118
__pyx_t_4 = PyInt_FromLong(__pyx_v_rc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2119
__Pyx_GOTREF(__pyx_t_4);
2120
__pyx_r = __pyx_t_4;
2124
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
2127
__Pyx_XDECREF(__pyx_t_4);
2128
__Pyx_AddTraceback("iocpsupport.accept");
2131
__Pyx_XGIVEREF(__pyx_r);
2132
__Pyx_FinishRefcountContext();
2136
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":28
2139
* def get_accept_addrs(long s, object buff): # <<<<<<<<<<<<<<
2140
* cdef WSAPROTOCOL_INFO wsa_pi
2141
* cdef int size, locallen, remotelen
2144
static PyObject *__pyx_pf_11iocpsupport_get_accept_addrs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2145
static PyObject *__pyx_pf_11iocpsupport_get_accept_addrs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2147
PyObject *__pyx_v_buff = 0;
2149
int __pyx_v_locallen;
2150
int __pyx_v_remotelen;
2151
void *__pyx_v_mem_buffer;
2152
struct sockaddr *__pyx_v_localaddr;
2153
struct sockaddr *__pyx_v_remoteaddr;
2154
PyObject *__pyx_r = NULL;
2156
PyObject *__pyx_t_2 = NULL;
2157
PyObject *__pyx_t_3 = NULL;
2158
PyObject *__pyx_t_4 = NULL;
2159
PyObject *__pyx_t_5 = NULL;
2160
static PyObject **__pyx_pyargnames[] = {&__pyx_kp_s,&__pyx_kp_buff,0};
2161
__Pyx_SetupRefcountContext("get_accept_addrs");
2162
__pyx_self = __pyx_self;
2163
if (unlikely(__pyx_kwds)) {
2164
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
2165
PyObject* values[2] = {0,0};
2166
switch (PyTuple_GET_SIZE(__pyx_args)) {
2167
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2168
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2170
default: goto __pyx_L5_argtuple_error;
2172
switch (PyTuple_GET_SIZE(__pyx_args)) {
2174
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_s);
2175
if (likely(values[0])) kw_args--;
2176
else goto __pyx_L5_argtuple_error;
2178
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_buff);
2179
if (likely(values[1])) kw_args--;
2181
__Pyx_RaiseArgtupleInvalid("get_accept_addrs", 1, 2, 2, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2184
if (unlikely(kw_args > 0)) {
2185
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "get_accept_addrs") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2187
__pyx_v_s = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2188
__pyx_v_buff = values[1];
2189
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
2190
goto __pyx_L5_argtuple_error;
2192
__pyx_v_s = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2193
__pyx_v_buff = PyTuple_GET_ITEM(__pyx_args, 1);
2195
goto __pyx_L4_argument_unpacking_done;
2196
__pyx_L5_argtuple_error:;
2197
__Pyx_RaiseArgtupleInvalid("get_accept_addrs", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2199
__Pyx_AddTraceback("iocpsupport.get_accept_addrs");
2201
__pyx_L4_argument_unpacking_done:;
2203
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":34
2204
* cdef sockaddr *localaddr, *remoteaddr
2206
* PyObject_AsReadBuffer(buff, &mem_buffer, &size) # <<<<<<<<<<<<<<
2208
* lpGetAcceptExSockaddrs(mem_buffer, 0, size / 2, size / 2, &localaddr, &locallen, &remoteaddr, &remotelen)
2210
__pyx_t_1 = PyObject_AsReadBuffer(__pyx_v_buff, (&__pyx_v_mem_buffer), (&__pyx_v_size)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2212
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":36
2213
* PyObject_AsReadBuffer(buff, &mem_buffer, &size)
2215
* lpGetAcceptExSockaddrs(mem_buffer, 0, size / 2, size / 2, &localaddr, &locallen, &remoteaddr, &remotelen) # <<<<<<<<<<<<<<
2216
* return remoteaddr.sa_family, _makesockaddr(localaddr, locallen), _makesockaddr(remoteaddr, remotelen)
2219
lpGetAcceptExSockaddrs(__pyx_v_mem_buffer, 0, (__pyx_v_size / 2), (__pyx_v_size / 2), (&__pyx_v_localaddr), (&__pyx_v_locallen), (&__pyx_v_remoteaddr), (&__pyx_v_remotelen));
2221
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":37
2223
* lpGetAcceptExSockaddrs(mem_buffer, 0, size / 2, size / 2, &localaddr, &locallen, &remoteaddr, &remotelen)
2224
* return remoteaddr.sa_family, _makesockaddr(localaddr, locallen), _makesockaddr(remoteaddr, remotelen) # <<<<<<<<<<<<<<
2227
__Pyx_XDECREF(__pyx_r);
2228
__pyx_t_2 = PyInt_FromLong(__pyx_v_remoteaddr->sa_family); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2229
__Pyx_GOTREF(__pyx_t_2);
2230
__pyx_t_3 = __pyx_f_11iocpsupport__makesockaddr(__pyx_v_localaddr, __pyx_v_locallen); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2231
__Pyx_GOTREF(__pyx_t_3);
2232
__pyx_t_4 = __pyx_f_11iocpsupport__makesockaddr(__pyx_v_remoteaddr, __pyx_v_remotelen); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2233
__Pyx_GOTREF(__pyx_t_4);
2234
__pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2235
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
2236
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
2237
__Pyx_GIVEREF(__pyx_t_2);
2238
PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
2239
__Pyx_GIVEREF(__pyx_t_3);
2240
PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
2241
__Pyx_GIVEREF(__pyx_t_4);
2245
__pyx_r = ((PyObject *)__pyx_t_5);
2249
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
2252
__Pyx_XDECREF(__pyx_t_2);
2253
__Pyx_XDECREF(__pyx_t_3);
2254
__Pyx_XDECREF(__pyx_t_4);
2255
__Pyx_XDECREF(__pyx_t_5);
2256
__Pyx_AddTraceback("iocpsupport.get_accept_addrs");
2259
__Pyx_XGIVEREF(__pyx_r);
2260
__Pyx_FinishRefcountContext();
2264
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":5
2267
* def connect(long s, object addr, object obj): # <<<<<<<<<<<<<<
2268
* cdef int family, rc
2269
* cdef myOVERLAPPED *ov
2272
static PyObject *__pyx_pf_11iocpsupport_connect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2273
static PyObject *__pyx_pf_11iocpsupport_connect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2275
PyObject *__pyx_v_addr = 0;
2276
PyObject *__pyx_v_obj = 0;
2279
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov;
2280
struct sockaddr __pyx_v_name;
2281
PyObject *__pyx_r = NULL;
2282
PyObject *__pyx_1 = 0;
2286
PyObject *__pyx_t_4 = NULL;
2287
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_t_5;
2288
static PyObject **__pyx_pyargnames[] = {&__pyx_kp_s,&__pyx_kp_addr,&__pyx_kp_obj,0};
2289
__Pyx_SetupRefcountContext("connect");
2290
__pyx_self = __pyx_self;
2291
if (unlikely(__pyx_kwds)) {
2292
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
2293
PyObject* values[3] = {0,0,0};
2294
switch (PyTuple_GET_SIZE(__pyx_args)) {
2295
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2296
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2297
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2299
default: goto __pyx_L5_argtuple_error;
2301
switch (PyTuple_GET_SIZE(__pyx_args)) {
2303
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_s);
2304
if (likely(values[0])) kw_args--;
2305
else goto __pyx_L5_argtuple_error;
2307
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_addr);
2308
if (likely(values[1])) kw_args--;
2310
__Pyx_RaiseArgtupleInvalid("connect", 1, 3, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2313
values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_obj);
2314
if (likely(values[2])) kw_args--;
2316
__Pyx_RaiseArgtupleInvalid("connect", 1, 3, 3, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2319
if (unlikely(kw_args > 0)) {
2320
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "connect") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2322
__pyx_v_s = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2323
__pyx_v_addr = values[1];
2324
__pyx_v_obj = values[2];
2325
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
2326
goto __pyx_L5_argtuple_error;
2328
__pyx_v_s = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2329
__pyx_v_addr = PyTuple_GET_ITEM(__pyx_args, 1);
2330
__pyx_v_obj = PyTuple_GET_ITEM(__pyx_args, 2);
2332
goto __pyx_L4_argument_unpacking_done;
2333
__pyx_L5_argtuple_error:;
2334
__Pyx_RaiseArgtupleInvalid("connect", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2336
__Pyx_AddTraceback("iocpsupport.connect");
2338
__pyx_L4_argument_unpacking_done:;
2340
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":10
2341
* cdef sockaddr name
2343
* if not have_connectex: # <<<<<<<<<<<<<<
2344
* raise ValueError, 'ConnectEx is not available on this system'
2347
__pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_have_connectex); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2348
__Pyx_GOTREF(__pyx_1);
2349
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_1); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2350
__Pyx_DECREF(__pyx_1); __pyx_1 = 0;
2351
__pyx_t_2 = (!__pyx_t_1);
2354
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":11
2356
* if not have_connectex:
2357
* raise ValueError, 'ConnectEx is not available on this system' # <<<<<<<<<<<<<<
2359
* family = getAddrFamily(s)
2361
__Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_8, 0);
2362
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2367
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":13
2368
* raise ValueError, 'ConnectEx is not available on this system'
2370
* family = getAddrFamily(s) # <<<<<<<<<<<<<<
2371
* if family == AF_INET:
2372
* fillinetaddr(<sockaddr_in *>&name, addr)
2374
__pyx_t_3 = __pyx_f_11iocpsupport_getAddrFamily(__pyx_v_s); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2375
__pyx_v_family = __pyx_t_3;
2377
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":14
2379
* family = getAddrFamily(s)
2380
* if family == AF_INET: # <<<<<<<<<<<<<<
2381
* fillinetaddr(<sockaddr_in *>&name, addr)
2384
__pyx_t_2 = (__pyx_v_family == AF_INET);
2387
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":15
2388
* family = getAddrFamily(s)
2389
* if family == AF_INET:
2390
* fillinetaddr(<sockaddr_in *>&name, addr) # <<<<<<<<<<<<<<
2392
* raise ValueError, 'unsupported address family'
2394
__pyx_t_4 = __pyx_f_11iocpsupport_fillinetaddr(((struct sockaddr_in *)(&__pyx_v_name)), __pyx_v_addr); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2395
__Pyx_GOTREF(__pyx_t_4);
2396
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2401
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":17
2402
* fillinetaddr(<sockaddr_in *>&name, addr)
2404
* raise ValueError, 'unsupported address family' # <<<<<<<<<<<<<<
2405
* name.sa_family = family
2408
__Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_9, 0);
2409
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2413
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":18
2415
* raise ValueError, 'unsupported address family'
2416
* name.sa_family = family # <<<<<<<<<<<<<<
2420
__pyx_v_name.sa_family = __pyx_v_family;
2422
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":20
2423
* name.sa_family = family
2425
* ov = makeOV() # <<<<<<<<<<<<<<
2426
* if obj is not None:
2427
* ov.obj = <PyObject *>obj
2429
__pyx_t_5 = __pyx_f_11iocpsupport_makeOV(); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2430
__pyx_v_ov = __pyx_t_5;
2432
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":21
2435
* if obj is not None: # <<<<<<<<<<<<<<
2436
* ov.obj = <PyObject *>obj
2439
__pyx_t_2 = (__pyx_v_obj != Py_None);
2442
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":22
2444
* if obj is not None:
2445
* ov.obj = <PyObject *>obj # <<<<<<<<<<<<<<
2447
* rc = lpConnectEx(s, &name, sizeof(name), NULL, 0, NULL, <OVERLAPPED *>ov)
2449
__pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj);
2454
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":24
2455
* ov.obj = <PyObject *>obj
2457
* rc = lpConnectEx(s, &name, sizeof(name), NULL, 0, NULL, <OVERLAPPED *>ov) # <<<<<<<<<<<<<<
2461
__pyx_v_rc = lpConnectEx(__pyx_v_s, (&__pyx_v_name), (sizeof(__pyx_v_name)), NULL, 0, NULL, ((OVERLAPPED *)__pyx_v_ov));
2463
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":26
2464
* rc = lpConnectEx(s, &name, sizeof(name), NULL, 0, NULL, <OVERLAPPED *>ov)
2466
* if not rc: # <<<<<<<<<<<<<<
2467
* rc = WSAGetLastError()
2468
* if rc != ERROR_IO_PENDING:
2470
__pyx_t_2 = (!__pyx_v_rc);
2473
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":27
2476
* rc = WSAGetLastError() # <<<<<<<<<<<<<<
2477
* if rc != ERROR_IO_PENDING:
2480
__pyx_v_rc = WSAGetLastError();
2482
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":28
2484
* rc = WSAGetLastError()
2485
* if rc != ERROR_IO_PENDING: # <<<<<<<<<<<<<<
2489
__pyx_t_2 = (__pyx_v_rc != ERROR_IO_PENDING);
2492
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":29
2493
* rc = WSAGetLastError()
2494
* if rc != ERROR_IO_PENDING:
2495
* return rc # <<<<<<<<<<<<<<
2497
* # operation is in progress
2499
__Pyx_XDECREF(__pyx_r);
2500
__pyx_t_4 = PyInt_FromLong(__pyx_v_rc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2501
__Pyx_GOTREF(__pyx_t_4);
2502
__pyx_r = __pyx_t_4;
2512
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":32
2514
* # operation is in progress
2515
* Py_XINCREF(obj) # <<<<<<<<<<<<<<
2519
Py_XINCREF(__pyx_v_obj);
2521
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":33
2522
* # operation is in progress
2524
* return rc # <<<<<<<<<<<<<<
2527
__Pyx_XDECREF(__pyx_r);
2528
__pyx_t_4 = PyInt_FromLong(__pyx_v_rc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2529
__Pyx_GOTREF(__pyx_t_4);
2530
__pyx_r = __pyx_t_4;
2534
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
2537
__Pyx_XDECREF(__pyx_1);
2538
__Pyx_XDECREF(__pyx_t_4);
2539
__Pyx_AddTraceback("iocpsupport.connect");
2542
__Pyx_XGIVEREF(__pyx_r);
2543
__Pyx_FinishRefcountContext();
2547
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":5
2550
* def recv(long s, object bufflist, object obj, unsigned long flags = 0): # <<<<<<<<<<<<<<
2551
* cdef int rc, buffcount, i, res
2552
* cdef myOVERLAPPED *ov
2555
static PyObject *__pyx_pf_11iocpsupport_recv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2556
static PyObject *__pyx_pf_11iocpsupport_recv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2558
PyObject *__pyx_v_bufflist = 0;
2559
PyObject *__pyx_v_obj = 0;
2560
unsigned long __pyx_v_flags;
2562
int __pyx_v_buffcount;
2564
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov;
2565
WSABUF *__pyx_v_ws_buf;
2566
unsigned long __pyx_v_bytes;
2567
struct PyObject **__pyx_v_buffers;
2568
PyObject *__pyx_r = NULL;
2569
PyObject *__pyx_t_1 = NULL;
2572
struct PyObject *__pyx_t_4;
2574
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_t_6;
2576
PyObject *__pyx_t_8 = NULL;
2577
PyObject *__pyx_t_9 = NULL;
2578
static PyObject **__pyx_pyargnames[] = {&__pyx_kp_s,&__pyx_kp_bufflist,&__pyx_kp_obj,&__pyx_kp_flags,0};
2579
__Pyx_SetupRefcountContext("recv");
2580
__pyx_self = __pyx_self;
2581
if (unlikely(__pyx_kwds)) {
2582
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
2583
PyObject* values[4] = {0,0,0,0};
2584
switch (PyTuple_GET_SIZE(__pyx_args)) {
2585
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2586
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2587
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2588
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2590
default: goto __pyx_L5_argtuple_error;
2592
switch (PyTuple_GET_SIZE(__pyx_args)) {
2594
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_s);
2595
if (likely(values[0])) kw_args--;
2596
else goto __pyx_L5_argtuple_error;
2598
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_bufflist);
2599
if (likely(values[1])) kw_args--;
2601
__Pyx_RaiseArgtupleInvalid("recv", 0, 3, 4, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2604
values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_obj);
2605
if (likely(values[2])) kw_args--;
2607
__Pyx_RaiseArgtupleInvalid("recv", 0, 3, 4, 2); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2611
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_flags);
2612
if (unlikely(value)) { values[3] = value; kw_args--; }
2615
if (unlikely(kw_args > 0)) {
2616
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "recv") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2618
__pyx_v_s = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2619
__pyx_v_bufflist = values[1];
2620
__pyx_v_obj = values[2];
2622
__pyx_v_flags = __Pyx_PyInt_AsUnsignedLong(values[3]); if (unlikely((__pyx_v_flags == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2628
switch (PyTuple_GET_SIZE(__pyx_args)) {
2630
__pyx_v_flags = __Pyx_PyInt_AsUnsignedLong(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_flags == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2632
__pyx_v_obj = PyTuple_GET_ITEM(__pyx_args, 2);
2633
__pyx_v_bufflist = PyTuple_GET_ITEM(__pyx_args, 1);
2634
__pyx_v_s = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2636
default: goto __pyx_L5_argtuple_error;
2639
goto __pyx_L4_argument_unpacking_done;
2640
__pyx_L5_argtuple_error:;
2641
__Pyx_RaiseArgtupleInvalid("recv", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2643
__Pyx_AddTraceback("iocpsupport.recv");
2645
__pyx_L4_argument_unpacking_done:;
2646
__Pyx_INCREF(__pyx_v_bufflist);
2648
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":12
2649
* cdef PyObject **buffers
2651
* bufflist = PySequence_Fast(bufflist, 'second argument needs to be a list') # <<<<<<<<<<<<<<
2652
* buffcount = PySequence_Fast_GET_SIZE(bufflist)
2653
* buffers = PySequence_Fast_ITEMS(bufflist)
2655
__pyx_t_1 = PySequence_Fast(__pyx_v_bufflist, __pyx_k_10); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2656
__Pyx_GOTREF(__pyx_t_1);
2657
__Pyx_DECREF(__pyx_v_bufflist);
2658
__pyx_v_bufflist = __pyx_t_1;
2661
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":13
2663
* bufflist = PySequence_Fast(bufflist, 'second argument needs to be a list')
2664
* buffcount = PySequence_Fast_GET_SIZE(bufflist) # <<<<<<<<<<<<<<
2665
* buffers = PySequence_Fast_ITEMS(bufflist)
2668
__pyx_v_buffcount = PySequence_Fast_GET_SIZE(__pyx_v_bufflist);
2670
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":14
2671
* bufflist = PySequence_Fast(bufflist, 'second argument needs to be a list')
2672
* buffcount = PySequence_Fast_GET_SIZE(bufflist)
2673
* buffers = PySequence_Fast_ITEMS(bufflist) # <<<<<<<<<<<<<<
2675
* ws_buf = <WSABUF *>PyMem_Malloc(buffcount*sizeof(WSABUF))
2677
__pyx_v_buffers = PySequence_Fast_ITEMS(__pyx_v_bufflist);
2679
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":16
2680
* buffers = PySequence_Fast_ITEMS(bufflist)
2682
* ws_buf = <WSABUF *>PyMem_Malloc(buffcount*sizeof(WSABUF)) # <<<<<<<<<<<<<<
2686
__pyx_t_2 = PyMem_Malloc((__pyx_v_buffcount * (sizeof(WSABUF)))); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2687
__pyx_v_ws_buf = ((WSABUF *)__pyx_t_2);
2689
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":18
2690
* ws_buf = <WSABUF *>PyMem_Malloc(buffcount*sizeof(WSABUF))
2692
* try: # <<<<<<<<<<<<<<
2693
* for i from 0 <= i < buffcount:
2694
* PyObject_AsWriteBuffer(<object>buffers[i], <void **>&ws_buf[i].buf, <int *>&ws_buf[i].len)
2698
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":19
2701
* for i from 0 <= i < buffcount: # <<<<<<<<<<<<<<
2702
* PyObject_AsWriteBuffer(<object>buffers[i], <void **>&ws_buf[i].buf, <int *>&ws_buf[i].len)
2705
__pyx_t_3 = __pyx_v_buffcount;
2706
for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {
2708
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":20
2710
* for i from 0 <= i < buffcount:
2711
* PyObject_AsWriteBuffer(<object>buffers[i], <void **>&ws_buf[i].buf, <int *>&ws_buf[i].len) # <<<<<<<<<<<<<<
2715
__pyx_t_4 = (__pyx_v_buffers[__pyx_v_i]);
2716
__pyx_t_5 = PyObject_AsWriteBuffer(((PyObject *)__pyx_t_4), ((void **)(&(__pyx_v_ws_buf[__pyx_v_i]).buf)), ((int *)(&(__pyx_v_ws_buf[__pyx_v_i]).len))); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L7;}
2719
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":22
2720
* PyObject_AsWriteBuffer(<object>buffers[i], <void **>&ws_buf[i].buf, <int *>&ws_buf[i].len)
2722
* ov = makeOV() # <<<<<<<<<<<<<<
2723
* if obj is not None:
2724
* ov.obj = <PyObject *>obj
2726
__pyx_t_6 = __pyx_f_11iocpsupport_makeOV(); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L7;}
2727
__pyx_v_ov = __pyx_t_6;
2729
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":23
2732
* if obj is not None: # <<<<<<<<<<<<<<
2733
* ov.obj = <PyObject *>obj
2736
__pyx_t_7 = (__pyx_v_obj != Py_None);
2739
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":24
2741
* if obj is not None:
2742
* ov.obj = <PyObject *>obj # <<<<<<<<<<<<<<
2744
* rc = WSARecv(s, ws_buf, buffcount, &bytes, &flags, <OVERLAPPED *>ov, NULL)
2746
__pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj);
2751
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":26
2752
* ov.obj = <PyObject *>obj
2754
* rc = WSARecv(s, ws_buf, buffcount, &bytes, &flags, <OVERLAPPED *>ov, NULL) # <<<<<<<<<<<<<<
2756
* if rc == SOCKET_ERROR:
2758
__pyx_v_rc = WSARecv(__pyx_v_s, __pyx_v_ws_buf, __pyx_v_buffcount, (&__pyx_v_bytes), (&__pyx_v_flags), ((OVERLAPPED *)__pyx_v_ov), NULL);
2760
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":28
2761
* rc = WSARecv(s, ws_buf, buffcount, &bytes, &flags, <OVERLAPPED *>ov, NULL)
2763
* if rc == SOCKET_ERROR: # <<<<<<<<<<<<<<
2764
* rc = WSAGetLastError()
2765
* if rc != ERROR_IO_PENDING:
2767
__pyx_t_7 = (__pyx_v_rc == SOCKET_ERROR);
2770
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":29
2772
* if rc == SOCKET_ERROR:
2773
* rc = WSAGetLastError() # <<<<<<<<<<<<<<
2774
* if rc != ERROR_IO_PENDING:
2777
__pyx_v_rc = WSAGetLastError();
2779
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":30
2780
* if rc == SOCKET_ERROR:
2781
* rc = WSAGetLastError()
2782
* if rc != ERROR_IO_PENDING: # <<<<<<<<<<<<<<
2786
__pyx_t_7 = (__pyx_v_rc != ERROR_IO_PENDING);
2789
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":31
2790
* rc = WSAGetLastError()
2791
* if rc != ERROR_IO_PENDING:
2792
* return rc, 0 # <<<<<<<<<<<<<<
2796
__Pyx_XDECREF(__pyx_r);
2797
__pyx_t_1 = PyInt_FromLong(__pyx_v_rc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L7;}
2798
__Pyx_GOTREF(__pyx_t_1);
2799
__pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L7;}
2800
__Pyx_GOTREF(((PyObject *)__pyx_t_8));
2801
PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1);
2802
__Pyx_GIVEREF(__pyx_t_1);
2803
__Pyx_INCREF(__pyx_int_0);
2804
PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_int_0);
2805
__Pyx_GIVEREF(__pyx_int_0);
2807
__pyx_r = ((PyObject *)__pyx_t_8);
2817
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":33
2820
* Py_XINCREF(obj) # <<<<<<<<<<<<<<
2824
Py_XINCREF(__pyx_v_obj);
2826
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":34
2829
* return rc, bytes # <<<<<<<<<<<<<<
2831
* PyMem_Free(ws_buf)
2833
__Pyx_XDECREF(__pyx_r);
2834
__pyx_t_8 = PyInt_FromLong(__pyx_v_rc); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L7;}
2835
__Pyx_GOTREF(__pyx_t_8);
2836
__pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_bytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L7;}
2837
__Pyx_GOTREF(__pyx_t_1);
2838
__pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L7;}
2839
__Pyx_GOTREF(((PyObject *)__pyx_t_9));
2840
PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
2841
__Pyx_GIVEREF(__pyx_t_8);
2842
PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1);
2843
__Pyx_GIVEREF(__pyx_t_1);
2846
__pyx_r = ((PyObject *)__pyx_t_9);
2852
PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
2853
int __pyx_exc_lineno;
2854
__pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
2855
__pyx_why = 0; goto __pyx_L8;
2856
__pyx_L6: __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
2857
__pyx_why = 3; goto __pyx_L8;
2860
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
2861
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
2862
__Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
2863
__Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
2864
__pyx_exc_lineno = __pyx_lineno;
2869
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":36
2872
* PyMem_Free(ws_buf) # <<<<<<<<<<<<<<
2874
* def recvfrom(long s, object buff, object addr_buff, object addr_len_buff, object obj, unsigned long flags = 0):
2876
PyMem_Free(__pyx_v_ws_buf);
2877
switch (__pyx_why) {
2878
case 3: goto __pyx_L0;
2880
__Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
2881
__pyx_lineno = __pyx_exc_lineno;
2883
__pyx_exc_value = 0;
2885
goto __pyx_L1_error;
2890
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
2893
__Pyx_XDECREF(__pyx_t_1);
2894
__Pyx_XDECREF(__pyx_t_8);
2895
__Pyx_XDECREF(__pyx_t_9);
2896
__Pyx_AddTraceback("iocpsupport.recv");
2899
__Pyx_DECREF(__pyx_v_bufflist);
2900
__Pyx_XGIVEREF(__pyx_r);
2901
__Pyx_FinishRefcountContext();
2905
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":38
2906
* PyMem_Free(ws_buf)
2908
* def recvfrom(long s, object buff, object addr_buff, object addr_len_buff, object obj, unsigned long flags = 0): # <<<<<<<<<<<<<<
2909
* cdef int rc, c_addr_buff_len, c_addr_len_buff_len
2910
* cdef myOVERLAPPED *ov
2913
static PyObject *__pyx_pf_11iocpsupport_recvfrom(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2914
static PyObject *__pyx_pf_11iocpsupport_recvfrom(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2916
PyObject *__pyx_v_buff = 0;
2917
PyObject *__pyx_v_addr_buff = 0;
2918
PyObject *__pyx_v_addr_len_buff = 0;
2919
PyObject *__pyx_v_obj = 0;
2920
unsigned long __pyx_v_flags;
2922
int __pyx_v_c_addr_buff_len;
2923
int __pyx_v_c_addr_len_buff_len;
2924
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov;
2925
WSABUF __pyx_v_ws_buf;
2926
unsigned long __pyx_v_bytes;
2927
struct sockaddr *__pyx_v_c_addr_buff;
2928
int *__pyx_v_c_addr_len_buff;
2929
PyObject *__pyx_r = NULL;
2932
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_t_3;
2933
PyObject *__pyx_t_4 = NULL;
2934
PyObject *__pyx_t_5 = NULL;
2935
PyObject *__pyx_t_6 = NULL;
2936
static PyObject **__pyx_pyargnames[] = {&__pyx_kp_s,&__pyx_kp_buff,&__pyx_kp_addr_buff,&__pyx_kp_addr_len_buff,&__pyx_kp_obj,&__pyx_kp_flags,0};
2937
__Pyx_SetupRefcountContext("recvfrom");
2938
__pyx_self = __pyx_self;
2939
if (unlikely(__pyx_kwds)) {
2940
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
2941
PyObject* values[6] = {0,0,0,0,0,0};
2942
switch (PyTuple_GET_SIZE(__pyx_args)) {
2943
case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2944
case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2945
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2946
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2947
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2948
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2950
default: goto __pyx_L5_argtuple_error;
2952
switch (PyTuple_GET_SIZE(__pyx_args)) {
2954
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_s);
2955
if (likely(values[0])) kw_args--;
2956
else goto __pyx_L5_argtuple_error;
2958
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_buff);
2959
if (likely(values[1])) kw_args--;
2961
__Pyx_RaiseArgtupleInvalid("recvfrom", 0, 5, 6, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2964
values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_addr_buff);
2965
if (likely(values[2])) kw_args--;
2967
__Pyx_RaiseArgtupleInvalid("recvfrom", 0, 5, 6, 2); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2970
values[3] = PyDict_GetItem(__pyx_kwds, __pyx_kp_addr_len_buff);
2971
if (likely(values[3])) kw_args--;
2973
__Pyx_RaiseArgtupleInvalid("recvfrom", 0, 5, 6, 3); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2976
values[4] = PyDict_GetItem(__pyx_kwds, __pyx_kp_obj);
2977
if (likely(values[4])) kw_args--;
2979
__Pyx_RaiseArgtupleInvalid("recvfrom", 0, 5, 6, 4); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2983
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_flags);
2984
if (unlikely(value)) { values[5] = value; kw_args--; }
2987
if (unlikely(kw_args > 0)) {
2988
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "recvfrom") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2990
__pyx_v_s = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2991
__pyx_v_buff = values[1];
2992
__pyx_v_addr_buff = values[2];
2993
__pyx_v_addr_len_buff = values[3];
2994
__pyx_v_obj = values[4];
2996
__pyx_v_flags = __Pyx_PyInt_AsUnsignedLong(values[5]); if (unlikely((__pyx_v_flags == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3002
switch (PyTuple_GET_SIZE(__pyx_args)) {
3004
__pyx_v_flags = __Pyx_PyInt_AsUnsignedLong(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_flags == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3006
__pyx_v_obj = PyTuple_GET_ITEM(__pyx_args, 4);
3007
__pyx_v_addr_len_buff = PyTuple_GET_ITEM(__pyx_args, 3);
3008
__pyx_v_addr_buff = PyTuple_GET_ITEM(__pyx_args, 2);
3009
__pyx_v_buff = PyTuple_GET_ITEM(__pyx_args, 1);
3010
__pyx_v_s = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3012
default: goto __pyx_L5_argtuple_error;
3015
goto __pyx_L4_argument_unpacking_done;
3016
__pyx_L5_argtuple_error:;
3017
__Pyx_RaiseArgtupleInvalid("recvfrom", 0, 5, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3019
__Pyx_AddTraceback("iocpsupport.recvfrom");
3021
__pyx_L4_argument_unpacking_done:;
3023
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":46
3024
* cdef int *c_addr_len_buff
3026
* PyObject_AsWriteBuffer(buff, <void **>&ws_buf.buf, <int *>&ws_buf.len) # <<<<<<<<<<<<<<
3027
* PyObject_AsWriteBuffer(addr_buff, <void **>&c_addr_buff, &c_addr_buff_len)
3028
* PyObject_AsWriteBuffer(addr_len_buff, <void **>&c_addr_len_buff, &c_addr_len_buff_len)
3030
__pyx_t_1 = PyObject_AsWriteBuffer(__pyx_v_buff, ((void **)(&__pyx_v_ws_buf.buf)), ((int *)(&__pyx_v_ws_buf.len))); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3032
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":47
3034
* PyObject_AsWriteBuffer(buff, <void **>&ws_buf.buf, <int *>&ws_buf.len)
3035
* PyObject_AsWriteBuffer(addr_buff, <void **>&c_addr_buff, &c_addr_buff_len) # <<<<<<<<<<<<<<
3036
* PyObject_AsWriteBuffer(addr_len_buff, <void **>&c_addr_len_buff, &c_addr_len_buff_len)
3039
__pyx_t_1 = PyObject_AsWriteBuffer(__pyx_v_addr_buff, ((void **)(&__pyx_v_c_addr_buff)), (&__pyx_v_c_addr_buff_len)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3041
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":48
3042
* PyObject_AsWriteBuffer(buff, <void **>&ws_buf.buf, <int *>&ws_buf.len)
3043
* PyObject_AsWriteBuffer(addr_buff, <void **>&c_addr_buff, &c_addr_buff_len)
3044
* PyObject_AsWriteBuffer(addr_len_buff, <void **>&c_addr_len_buff, &c_addr_len_buff_len) # <<<<<<<<<<<<<<
3046
* if c_addr_len_buff_len != sizeof(int):
3048
__pyx_t_1 = PyObject_AsWriteBuffer(__pyx_v_addr_len_buff, ((void **)(&__pyx_v_c_addr_len_buff)), (&__pyx_v_c_addr_len_buff_len)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3050
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":50
3051
* PyObject_AsWriteBuffer(addr_len_buff, <void **>&c_addr_len_buff, &c_addr_len_buff_len)
3053
* if c_addr_len_buff_len != sizeof(int): # <<<<<<<<<<<<<<
3054
* raise ValueError, 'length of address length buffer needs to be sizeof(int)'
3057
__pyx_t_2 = (__pyx_v_c_addr_len_buff_len != (sizeof(int)));
3060
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":51
3062
* if c_addr_len_buff_len != sizeof(int):
3063
* raise ValueError, 'length of address length buffer needs to be sizeof(int)' # <<<<<<<<<<<<<<
3065
* c_addr_len_buff[0] = c_addr_buff_len
3067
__Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_11, 0);
3068
{__pyx_filename = __pyx_f[3]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3073
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":53
3074
* raise ValueError, 'length of address length buffer needs to be sizeof(int)'
3076
* c_addr_len_buff[0] = c_addr_buff_len # <<<<<<<<<<<<<<
3080
(__pyx_v_c_addr_len_buff[0]) = __pyx_v_c_addr_buff_len;
3082
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":55
3083
* c_addr_len_buff[0] = c_addr_buff_len
3085
* ov = makeOV() # <<<<<<<<<<<<<<
3086
* if obj is not None:
3087
* ov.obj = <PyObject *>obj
3089
__pyx_t_3 = __pyx_f_11iocpsupport_makeOV(); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3090
__pyx_v_ov = __pyx_t_3;
3092
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":56
3095
* if obj is not None: # <<<<<<<<<<<<<<
3096
* ov.obj = <PyObject *>obj
3099
__pyx_t_2 = (__pyx_v_obj != Py_None);
3102
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":57
3104
* if obj is not None:
3105
* ov.obj = <PyObject *>obj # <<<<<<<<<<<<<<
3107
* rc = WSARecvFrom(s, &ws_buf, 1, &bytes, &flags, c_addr_buff, c_addr_len_buff, <OVERLAPPED *>ov, NULL)
3109
__pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj);
3114
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":59
3115
* ov.obj = <PyObject *>obj
3117
* rc = WSARecvFrom(s, &ws_buf, 1, &bytes, &flags, c_addr_buff, c_addr_len_buff, <OVERLAPPED *>ov, NULL) # <<<<<<<<<<<<<<
3119
* if rc == SOCKET_ERROR:
3121
__pyx_v_rc = WSARecvFrom(__pyx_v_s, (&__pyx_v_ws_buf), 1, (&__pyx_v_bytes), (&__pyx_v_flags), __pyx_v_c_addr_buff, __pyx_v_c_addr_len_buff, ((OVERLAPPED *)__pyx_v_ov), NULL);
3123
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":61
3124
* rc = WSARecvFrom(s, &ws_buf, 1, &bytes, &flags, c_addr_buff, c_addr_len_buff, <OVERLAPPED *>ov, NULL)
3126
* if rc == SOCKET_ERROR: # <<<<<<<<<<<<<<
3127
* rc = WSAGetLastError()
3128
* if rc != ERROR_IO_PENDING:
3130
__pyx_t_2 = (__pyx_v_rc == SOCKET_ERROR);
3133
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":62
3135
* if rc == SOCKET_ERROR:
3136
* rc = WSAGetLastError() # <<<<<<<<<<<<<<
3137
* if rc != ERROR_IO_PENDING:
3140
__pyx_v_rc = WSAGetLastError();
3142
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":63
3143
* if rc == SOCKET_ERROR:
3144
* rc = WSAGetLastError()
3145
* if rc != ERROR_IO_PENDING: # <<<<<<<<<<<<<<
3149
__pyx_t_2 = (__pyx_v_rc != ERROR_IO_PENDING);
3152
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":64
3153
* rc = WSAGetLastError()
3154
* if rc != ERROR_IO_PENDING:
3155
* return rc, 0 # <<<<<<<<<<<<<<
3159
__Pyx_XDECREF(__pyx_r);
3160
__pyx_t_4 = PyInt_FromLong(__pyx_v_rc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3161
__Pyx_GOTREF(__pyx_t_4);
3162
__pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3163
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
3164
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
3165
__Pyx_GIVEREF(__pyx_t_4);
3166
__Pyx_INCREF(__pyx_int_0);
3167
PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_0);
3168
__Pyx_GIVEREF(__pyx_int_0);
3170
__pyx_r = ((PyObject *)__pyx_t_5);
3180
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":66
3183
* Py_XINCREF(obj) # <<<<<<<<<<<<<<
3187
Py_XINCREF(__pyx_v_obj);
3189
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":67
3192
* return rc, bytes # <<<<<<<<<<<<<<
3195
__Pyx_XDECREF(__pyx_r);
3196
__pyx_t_5 = PyInt_FromLong(__pyx_v_rc); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3197
__Pyx_GOTREF(__pyx_t_5);
3198
__pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_bytes); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3199
__Pyx_GOTREF(__pyx_t_4);
3200
__pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3201
__Pyx_GOTREF(((PyObject *)__pyx_t_6));
3202
PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
3203
__Pyx_GIVEREF(__pyx_t_5);
3204
PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4);
3205
__Pyx_GIVEREF(__pyx_t_4);
3208
__pyx_r = ((PyObject *)__pyx_t_6);
3212
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
3215
__Pyx_XDECREF(__pyx_t_4);
3216
__Pyx_XDECREF(__pyx_t_5);
3217
__Pyx_XDECREF(__pyx_t_6);
3218
__Pyx_AddTraceback("iocpsupport.recvfrom");
3221
__Pyx_XGIVEREF(__pyx_r);
3222
__Pyx_FinishRefcountContext();
3226
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":5
3229
* def send(long s, object buff, object obj, unsigned long flags = 0): # <<<<<<<<<<<<<<
3231
* cdef myOVERLAPPED *ov
3234
static PyObject *__pyx_pf_11iocpsupport_send(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3235
static PyObject *__pyx_pf_11iocpsupport_send(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3237
PyObject *__pyx_v_buff = 0;
3238
PyObject *__pyx_v_obj = 0;
3239
unsigned long __pyx_v_flags;
3241
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov;
3242
WSABUF __pyx_v_ws_buf;
3243
unsigned long __pyx_v_bytes;
3244
PyObject *__pyx_r = NULL;
3246
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_t_2;
3248
PyObject *__pyx_t_4 = NULL;
3249
PyObject *__pyx_t_5 = NULL;
3250
PyObject *__pyx_t_6 = NULL;
3251
static PyObject **__pyx_pyargnames[] = {&__pyx_kp_s,&__pyx_kp_buff,&__pyx_kp_obj,&__pyx_kp_flags,0};
3252
__Pyx_SetupRefcountContext("send");
3253
__pyx_self = __pyx_self;
3254
if (unlikely(__pyx_kwds)) {
3255
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
3256
PyObject* values[4] = {0,0,0,0};
3257
switch (PyTuple_GET_SIZE(__pyx_args)) {
3258
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3259
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3260
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3261
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3263
default: goto __pyx_L5_argtuple_error;
3265
switch (PyTuple_GET_SIZE(__pyx_args)) {
3267
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_s);
3268
if (likely(values[0])) kw_args--;
3269
else goto __pyx_L5_argtuple_error;
3271
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_buff);
3272
if (likely(values[1])) kw_args--;
3274
__Pyx_RaiseArgtupleInvalid("send", 0, 3, 4, 1); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3277
values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_obj);
3278
if (likely(values[2])) kw_args--;
3280
__Pyx_RaiseArgtupleInvalid("send", 0, 3, 4, 2); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3284
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_flags);
3285
if (unlikely(value)) { values[3] = value; kw_args--; }
3288
if (unlikely(kw_args > 0)) {
3289
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "send") < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3291
__pyx_v_s = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3292
__pyx_v_buff = values[1];
3293
__pyx_v_obj = values[2];
3295
__pyx_v_flags = __Pyx_PyInt_AsUnsignedLong(values[3]); if (unlikely((__pyx_v_flags == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3301
switch (PyTuple_GET_SIZE(__pyx_args)) {
3303
__pyx_v_flags = __Pyx_PyInt_AsUnsignedLong(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_flags == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3305
__pyx_v_obj = PyTuple_GET_ITEM(__pyx_args, 2);
3306
__pyx_v_buff = PyTuple_GET_ITEM(__pyx_args, 1);
3307
__pyx_v_s = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3309
default: goto __pyx_L5_argtuple_error;
3312
goto __pyx_L4_argument_unpacking_done;
3313
__pyx_L5_argtuple_error:;
3314
__Pyx_RaiseArgtupleInvalid("send", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3316
__Pyx_AddTraceback("iocpsupport.send");
3318
__pyx_L4_argument_unpacking_done:;
3320
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":11
3321
* cdef unsigned long bytes
3323
* PyObject_AsReadBuffer(buff, <void **>&ws_buf.buf, <int *>&ws_buf.len) # <<<<<<<<<<<<<<
3327
__pyx_t_1 = PyObject_AsReadBuffer(__pyx_v_buff, ((void **)(&__pyx_v_ws_buf.buf)), ((int *)(&__pyx_v_ws_buf.len))); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3329
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":13
3330
* PyObject_AsReadBuffer(buff, <void **>&ws_buf.buf, <int *>&ws_buf.len)
3332
* ov = makeOV() # <<<<<<<<<<<<<<
3333
* if obj is not None:
3334
* ov.obj = <PyObject *>obj
3336
__pyx_t_2 = __pyx_f_11iocpsupport_makeOV(); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3337
__pyx_v_ov = __pyx_t_2;
3339
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":14
3342
* if obj is not None: # <<<<<<<<<<<<<<
3343
* ov.obj = <PyObject *>obj
3346
__pyx_t_3 = (__pyx_v_obj != Py_None);
3349
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":15
3351
* if obj is not None:
3352
* ov.obj = <PyObject *>obj # <<<<<<<<<<<<<<
3354
* rc = WSASend(s, &ws_buf, 1, &bytes, flags, <OVERLAPPED *>ov, NULL)
3356
__pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj);
3361
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":17
3362
* ov.obj = <PyObject *>obj
3364
* rc = WSASend(s, &ws_buf, 1, &bytes, flags, <OVERLAPPED *>ov, NULL) # <<<<<<<<<<<<<<
3366
* if rc == SOCKET_ERROR:
3368
__pyx_v_rc = WSASend(__pyx_v_s, (&__pyx_v_ws_buf), 1, (&__pyx_v_bytes), __pyx_v_flags, ((OVERLAPPED *)__pyx_v_ov), NULL);
3370
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":19
3371
* rc = WSASend(s, &ws_buf, 1, &bytes, flags, <OVERLAPPED *>ov, NULL)
3373
* if rc == SOCKET_ERROR: # <<<<<<<<<<<<<<
3374
* rc = WSAGetLastError()
3375
* if rc != ERROR_IO_PENDING:
3377
__pyx_t_3 = (__pyx_v_rc == SOCKET_ERROR);
3380
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":20
3382
* if rc == SOCKET_ERROR:
3383
* rc = WSAGetLastError() # <<<<<<<<<<<<<<
3384
* if rc != ERROR_IO_PENDING:
3387
__pyx_v_rc = WSAGetLastError();
3389
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":21
3390
* if rc == SOCKET_ERROR:
3391
* rc = WSAGetLastError()
3392
* if rc != ERROR_IO_PENDING: # <<<<<<<<<<<<<<
3396
__pyx_t_3 = (__pyx_v_rc != ERROR_IO_PENDING);
3399
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":22
3400
* rc = WSAGetLastError()
3401
* if rc != ERROR_IO_PENDING:
3402
* return rc, bytes # <<<<<<<<<<<<<<
3406
__Pyx_XDECREF(__pyx_r);
3407
__pyx_t_4 = PyInt_FromLong(__pyx_v_rc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3408
__Pyx_GOTREF(__pyx_t_4);
3409
__pyx_t_5 = PyLong_FromUnsignedLong(__pyx_v_bytes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3410
__Pyx_GOTREF(__pyx_t_5);
3411
__pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3412
__Pyx_GOTREF(((PyObject *)__pyx_t_6));
3413
PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
3414
__Pyx_GIVEREF(__pyx_t_4);
3415
PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
3416
__Pyx_GIVEREF(__pyx_t_5);
3419
__pyx_r = ((PyObject *)__pyx_t_6);
3429
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":24
3432
* Py_XINCREF(obj) # <<<<<<<<<<<<<<
3436
Py_XINCREF(__pyx_v_obj);
3438
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":25
3441
* return rc, bytes # <<<<<<<<<<<<<<
3445
__Pyx_XDECREF(__pyx_r);
3446
__pyx_t_6 = PyInt_FromLong(__pyx_v_rc); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3447
__Pyx_GOTREF(__pyx_t_6);
3448
__pyx_t_5 = PyLong_FromUnsignedLong(__pyx_v_bytes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3449
__Pyx_GOTREF(__pyx_t_5);
3450
__pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3451
__Pyx_GOTREF(((PyObject *)__pyx_t_4));
3452
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
3453
__Pyx_GIVEREF(__pyx_t_6);
3454
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
3455
__Pyx_GIVEREF(__pyx_t_5);
3458
__pyx_r = ((PyObject *)__pyx_t_4);
3462
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
3465
__Pyx_XDECREF(__pyx_t_4);
3466
__Pyx_XDECREF(__pyx_t_5);
3467
__Pyx_XDECREF(__pyx_t_6);
3468
__Pyx_AddTraceback("iocpsupport.send");
3471
__Pyx_XGIVEREF(__pyx_r);
3472
__Pyx_FinishRefcountContext();
3476
static PyObject *__pyx_tp_new_11iocpsupport_CompletionPort(PyTypeObject *t, PyObject *a, PyObject *k) {
3477
PyObject *o = (*t->tp_alloc)(t, 0);
3482
static void __pyx_tp_dealloc_11iocpsupport_CompletionPort(PyObject *o) {
3483
(*Py_TYPE(o)->tp_free)(o);
3486
static struct PyMethodDef __pyx_methods_11iocpsupport_CompletionPort[] = {
3487
{__Pyx_NAMESTR("addHandle"), (PyCFunction)__pyx_pf_11iocpsupport_14CompletionPort_addHandle, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
3488
{__Pyx_NAMESTR("getEvent"), (PyCFunction)__pyx_pf_11iocpsupport_14CompletionPort_getEvent, METH_O, __Pyx_DOCSTR(0)},
3489
{__Pyx_NAMESTR("postEvent"), (PyCFunction)__pyx_pf_11iocpsupport_14CompletionPort_postEvent, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
3490
{__Pyx_NAMESTR("__del__"), (PyCFunction)__pyx_pf_11iocpsupport_14CompletionPort___del__, METH_NOARGS, __Pyx_DOCSTR(0)},
3494
static PyNumberMethods __pyx_tp_as_number_CompletionPort = {
3498
#if PY_MAJOR_VERSION < 3
3514
#if PY_MAJOR_VERSION < 3
3518
#if PY_MAJOR_VERSION >= 3
3524
#if PY_MAJOR_VERSION < 3
3527
#if PY_MAJOR_VERSION < 3
3530
0, /*nb_inplace_add*/
3531
0, /*nb_inplace_subtract*/
3532
0, /*nb_inplace_multiply*/
3533
#if PY_MAJOR_VERSION < 3
3534
0, /*nb_inplace_divide*/
3536
0, /*nb_inplace_remainder*/
3537
0, /*nb_inplace_power*/
3538
0, /*nb_inplace_lshift*/
3539
0, /*nb_inplace_rshift*/
3540
0, /*nb_inplace_and*/
3541
0, /*nb_inplace_xor*/
3542
0, /*nb_inplace_or*/
3543
0, /*nb_floor_divide*/
3544
0, /*nb_true_divide*/
3545
0, /*nb_inplace_floor_divide*/
3546
0, /*nb_inplace_true_divide*/
3547
#if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX)
3552
static PySequenceMethods __pyx_tp_as_sequence_CompletionPort = {
3561
0, /*sq_inplace_concat*/
3562
0, /*sq_inplace_repeat*/
3565
static PyMappingMethods __pyx_tp_as_mapping_CompletionPort = {
3568
0, /*mp_ass_subscript*/
3571
static PyBufferProcs __pyx_tp_as_buffer_CompletionPort = {
3572
#if PY_MAJOR_VERSION < 3
3573
0, /*bf_getreadbuffer*/
3575
#if PY_MAJOR_VERSION < 3
3576
0, /*bf_getwritebuffer*/
3578
#if PY_MAJOR_VERSION < 3
3579
0, /*bf_getsegcount*/
3581
#if PY_MAJOR_VERSION < 3
3582
0, /*bf_getcharbuffer*/
3584
#if PY_VERSION_HEX >= 0x02060000
3587
#if PY_VERSION_HEX >= 0x02060000
3588
0, /*bf_releasebuffer*/
3592
PyTypeObject __pyx_type_11iocpsupport_CompletionPort = {
3593
PyVarObject_HEAD_INIT(0, 0)
3594
__Pyx_NAMESTR("iocpsupport.CompletionPort"), /*tp_name*/
3595
sizeof(struct __pyx_obj_11iocpsupport_CompletionPort), /*tp_basicsize*/
3597
__pyx_tp_dealloc_11iocpsupport_CompletionPort, /*tp_dealloc*/
3603
&__pyx_tp_as_number_CompletionPort, /*tp_as_number*/
3604
&__pyx_tp_as_sequence_CompletionPort, /*tp_as_sequence*/
3605
&__pyx_tp_as_mapping_CompletionPort, /*tp_as_mapping*/
3611
&__pyx_tp_as_buffer_CompletionPort, /*tp_as_buffer*/
3612
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
3616
0, /*tp_richcompare*/
3617
0, /*tp_weaklistoffset*/
3620
__pyx_methods_11iocpsupport_CompletionPort, /*tp_methods*/
3627
0, /*tp_dictoffset*/
3628
__pyx_pf_11iocpsupport_14CompletionPort___init__, /*tp_init*/
3630
__pyx_tp_new_11iocpsupport_CompletionPort, /*tp_new*/
3636
0, /*tp_subclasses*/
3640
static struct PyMethodDef __pyx_methods[] = {
3641
{__Pyx_NAMESTR("makesockaddr"), (PyCFunction)__pyx_pf_11iocpsupport_makesockaddr, METH_O, __Pyx_DOCSTR(0)},
3642
{__Pyx_NAMESTR("AllocateReadBuffer"), (PyCFunction)__pyx_pf_11iocpsupport_AllocateReadBuffer, METH_O, __Pyx_DOCSTR(0)},
3643
{__Pyx_NAMESTR("maxAddrLen"), (PyCFunction)__pyx_pf_11iocpsupport_maxAddrLen, METH_O, __Pyx_DOCSTR(0)},
3644
{__Pyx_NAMESTR("accept"), (PyCFunction)__pyx_pf_11iocpsupport_accept, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
3645
{__Pyx_NAMESTR("get_accept_addrs"), (PyCFunction)__pyx_pf_11iocpsupport_get_accept_addrs, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
3646
{__Pyx_NAMESTR("connect"), (PyCFunction)__pyx_pf_11iocpsupport_connect, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
3647
{__Pyx_NAMESTR("recv"), (PyCFunction)__pyx_pf_11iocpsupport_recv, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
3648
{__Pyx_NAMESTR("recvfrom"), (PyCFunction)__pyx_pf_11iocpsupport_recvfrom, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
3649
{__Pyx_NAMESTR("send"), (PyCFunction)__pyx_pf_11iocpsupport_send, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
3653
static void __pyx_init_filenames(void); /*proto*/
3655
#if PY_MAJOR_VERSION >= 3
3656
static struct PyModuleDef __pyx_moduledef = {
3657
PyModuleDef_HEAD_INIT,
3658
__Pyx_NAMESTR("iocpsupport"),
3661
__pyx_methods /* m_methods */,
3662
NULL, /* m_reload */
3663
NULL, /* m_traverse */
3669
static __Pyx_StringTabEntry __pyx_string_tab[] = {
3670
{&__pyx_kp___main__, __pyx_k___main__, sizeof(__pyx_k___main__), 1, 1, 1},
3671
{&__pyx_kp___init__, __pyx_k___init__, sizeof(__pyx_k___init__), 1, 1, 1},
3672
{&__pyx_kp_addHandle, __pyx_k_addHandle, sizeof(__pyx_k_addHandle), 1, 1, 1},
3673
{&__pyx_kp_getEvent, __pyx_k_getEvent, sizeof(__pyx_k_getEvent), 1, 1, 1},
3674
{&__pyx_kp_postEvent, __pyx_k_postEvent, sizeof(__pyx_k_postEvent), 1, 1, 1},
3675
{&__pyx_kp___del__, __pyx_k___del__, sizeof(__pyx_k___del__), 1, 1, 1},
3676
{&__pyx_kp_self, __pyx_k_self, sizeof(__pyx_k_self), 1, 1, 1},
3677
{&__pyx_kp_callback, __pyx_k_callback, sizeof(__pyx_k_callback), 1, 1, 1},
3678
{&__pyx_kp_owner, __pyx_k_owner, sizeof(__pyx_k_owner), 1, 1, 1},
3679
{&__pyx_kp_handle, __pyx_k_handle, sizeof(__pyx_k_handle), 1, 1, 1},
3680
{&__pyx_kp_key, __pyx_k_key, sizeof(__pyx_k_key), 1, 1, 1},
3681
{&__pyx_kp_timeout, __pyx_k_timeout, sizeof(__pyx_k_timeout), 1, 1, 1},
3682
{&__pyx_kp_bytes, __pyx_k_bytes, sizeof(__pyx_k_bytes), 1, 1, 1},
3683
{&__pyx_kp_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 1, 1, 1},
3684
{&__pyx_kp_buff, __pyx_k_buff, sizeof(__pyx_k_buff), 1, 1, 1},
3685
{&__pyx_kp_size, __pyx_k_size, sizeof(__pyx_k_size), 1, 1, 1},
3686
{&__pyx_kp_s, __pyx_k_s, sizeof(__pyx_k_s), 1, 1, 1},
3687
{&__pyx_kp_listening, __pyx_k_listening, sizeof(__pyx_k_listening), 1, 1, 1},
3688
{&__pyx_kp_accepting, __pyx_k_accepting, sizeof(__pyx_k_accepting), 1, 1, 1},
3689
{&__pyx_kp_addr, __pyx_k_addr, sizeof(__pyx_k_addr), 1, 1, 1},
3690
{&__pyx_kp_bufflist, __pyx_k_bufflist, sizeof(__pyx_k_bufflist), 1, 1, 1},
3691
{&__pyx_kp_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 1, 1, 1},
3692
{&__pyx_kp_addr_buff, __pyx_k_addr_buff, sizeof(__pyx_k_addr_buff), 1, 1, 1},
3693
{&__pyx_kp_addr_len_buff, __pyx_k_addr_len_buff, sizeof(__pyx_k_addr_len_buff), 1, 1, 1},
3694
{&__pyx_kp_Event, __pyx_k_Event, sizeof(__pyx_k_Event), 0, 1, 1},
3695
{&__pyx_kp_socket, __pyx_k_socket, sizeof(__pyx_k_socket), 1, 1, 1},
3696
{&__pyx_kp_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 1, 1, 1},
3697
{&__pyx_kp_have_connectex, __pyx_k_have_connectex, sizeof(__pyx_k_have_connectex), 1, 1, 1},
3698
{&__pyx_kp_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 1, 1, 1},
3699
{&__pyx_kp_WindowsError, __pyx_k_WindowsError, sizeof(__pyx_k_WindowsError), 1, 1, 1},
3700
{&__pyx_kp_ignore, __pyx_k_ignore, sizeof(__pyx_k_ignore), 1, 1, 1},
3701
{&__pyx_kp_items, __pyx_k_items, sizeof(__pyx_k_items), 1, 1, 1},
3702
{&__pyx_kp_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 1, 0},
3703
{&__pyx_kp_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0},
3704
{&__pyx_kp_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0},
3705
{&__pyx_kp_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0},
3706
{&__pyx_kp_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0},
3707
{&__pyx_kp_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 0},
3708
{&__pyx_kp_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 0},
3709
{&__pyx_kp_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 0},
3710
{&__pyx_kp_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 0},
3711
{&__pyx_kp_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 0},
3714
static int __Pyx_InitCachedBuiltins(void) {
3715
__pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_kp_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3716
__pyx_builtin_MemoryError = __Pyx_GetName(__pyx_b, __pyx_kp_MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3717
__pyx_builtin_WindowsError = __Pyx_GetName(__pyx_b, __pyx_kp_WindowsError); if (!__pyx_builtin_WindowsError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3723
static int __Pyx_InitGlobals(void) {
3724
__pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
3725
if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
3731
#if PY_MAJOR_VERSION < 3
3732
PyMODINIT_FUNC initiocpsupport(void); /*proto*/
3733
PyMODINIT_FUNC initiocpsupport(void)
3735
PyMODINIT_FUNC PyInit_iocpsupport(void); /*proto*/
3736
PyMODINIT_FUNC PyInit_iocpsupport(void)
3739
PyObject *__pyx_1 = 0;
3740
PyObject *__pyx_2 = 0;
3741
PyObject *__pyx_3 = 0;
3742
PyObject *__pyx_t_1 = NULL;
3744
#ifdef CYTHON_REFNANNY
3745
void* __pyx_refchk = NULL;
3746
__Pyx_Refnanny = __Pyx_ImportRefcountAPI("refnanny");
3747
if (!__Pyx_Refnanny) {
3749
__Pyx_Refnanny = __Pyx_ImportRefcountAPI("Cython.Runtime.refnanny");
3750
if (!__Pyx_Refnanny)
3751
Py_FatalError("failed to import refnanny module");
3753
__pyx_refchk = __Pyx_Refnanny->NewContext("PyMODINIT_FUNC PyInit_iocpsupport(void)", __LINE__, __FILE__);
3755
__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;}
3756
/*--- Library function declarations ---*/
3757
__pyx_init_filenames();
3758
/*--- Threads initialization code ---*/
3759
#if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
3760
#ifdef WITH_THREAD /* Python build with threading support? */
3761
PyEval_InitThreads();
3764
/*--- Initialize various global constants etc. ---*/
3765
if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3766
/*--- Module creation code ---*/
3767
#if PY_MAJOR_VERSION < 3
3768
__pyx_m = Py_InitModule4(__Pyx_NAMESTR("iocpsupport"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
3770
__pyx_m = PyModule_Create(&__pyx_moduledef);
3772
if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
3773
#if PY_MAJOR_VERSION < 3
3776
__pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
3777
if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
3778
if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
3779
if (__pyx_module_is_main_iocpsupport) {
3780
if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_kp___main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
3782
/*--- Builtin init code ---*/
3783
if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3784
__pyx_skip_dispatch = 0;
3785
/*--- Global init code ---*/
3786
/*--- Function export code ---*/
3787
/*--- Type init code ---*/
3788
if (PyType_Ready(&__pyx_type_11iocpsupport_CompletionPort) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3789
if (__Pyx_SetAttrString(__pyx_m, "CompletionPort", (PyObject *)&__pyx_type_11iocpsupport_CompletionPort) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3790
__pyx_ptype_11iocpsupport_CompletionPort = &__pyx_type_11iocpsupport_CompletionPort;
3791
/*--- Type import code ---*/
3792
/*--- Function import code ---*/
3793
/*--- Execution code ---*/
3795
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":121
3796
* raise WindowsError(message, err)
3798
* class Event: # <<<<<<<<<<<<<<
3799
* def __init__(self, callback, owner, **kw):
3800
* self.callback = callback
3802
__pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3803
__Pyx_GOTREF(((PyObject *)__pyx_1));
3804
__pyx_2 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_1), __pyx_kp_Event, "iocpsupport"); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3805
__Pyx_GOTREF(__pyx_2);
3807
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":122
3810
* def __init__(self, callback, owner, **kw): # <<<<<<<<<<<<<<
3811
* self.callback = callback
3812
* self.owner = owner
3814
__pyx_t_1 = PyCFunction_New(&__pyx_mdef_11iocpsupport_5Event___init__, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3815
__Pyx_GOTREF(__pyx_t_1);
3816
__pyx_3 = PyMethod_New(__pyx_t_1, 0, __pyx_2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3817
__Pyx_GOTREF(__pyx_3);
3818
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3819
if (PyObject_SetAttr(__pyx_2, __pyx_kp___init__, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3820
__Pyx_DECREF(__pyx_3); __pyx_3 = 0;
3821
if (PyObject_SetAttr(__pyx_m, __pyx_kp_Event, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3822
__Pyx_DECREF(__pyx_2); __pyx_2 = 0;
3823
__Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
3825
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":240
3826
* return wsa_pi.iAddressFamily
3828
* import socket # for WSAStartup # <<<<<<<<<<<<<<
3829
* if not initWinsockPointers():
3830
* raise ValueError, 'Failed to initialize Winsock function vectors'
3832
__pyx_3 = __Pyx_Import(__pyx_kp_socket, 0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3833
__Pyx_GOTREF(__pyx_3);
3834
if (PyObject_SetAttr(__pyx_m, __pyx_kp_socket, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3835
__Pyx_DECREF(__pyx_3); __pyx_3 = 0;
3837
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":241
3839
* import socket # for WSAStartup
3840
* if not initWinsockPointers(): # <<<<<<<<<<<<<<
3841
* raise ValueError, 'Failed to initialize Winsock function vectors'
3844
__pyx_t_2 = (!initWinsockPointers());
3847
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":242
3848
* import socket # for WSAStartup
3849
* if not initWinsockPointers():
3850
* raise ValueError, 'Failed to initialize Winsock function vectors' # <<<<<<<<<<<<<<
3852
* have_connectex = (lpConnectEx != NULL)
3854
__Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_1, 0);
3855
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3860
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":244
3861
* raise ValueError, 'Failed to initialize Winsock function vectors'
3863
* have_connectex = (lpConnectEx != NULL) # <<<<<<<<<<<<<<
3865
* include 'acceptex.pxi'
3867
__pyx_t_1 = __Pyx_PyBool_FromLong((lpConnectEx != NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3868
__Pyx_GOTREF(__pyx_t_1);
3869
if (PyObject_SetAttr(__pyx_m, __pyx_kp_have_connectex, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3870
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3872
/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":5
3875
* def send(long s, object buff, object obj, unsigned long flags = 0): # <<<<<<<<<<<<<<
3877
* cdef myOVERLAPPED *ov
3881
__Pyx_XDECREF(__pyx_1);
3882
__Pyx_XDECREF(__pyx_2);
3883
__Pyx_XDECREF(__pyx_3);
3884
__Pyx_XDECREF(__pyx_t_1);
3885
__Pyx_AddTraceback("iocpsupport");
3886
Py_DECREF(__pyx_m); __pyx_m = 0;
3888
__Pyx_FinishRefcountContext();
3889
#if PY_MAJOR_VERSION < 3
3896
static const char *__pyx_filenames[] = {
3904
/* Runtime support code */
3906
static void __pyx_init_filenames(void) {
3907
__pyx_f = __pyx_filenames;
3910
static void __Pyx_RaiseDoubleKeywordsError(
3911
const char* func_name,
3914
PyErr_Format(PyExc_TypeError,
3915
#if PY_MAJOR_VERSION >= 3
3916
"%s() got multiple values for keyword argument '%U'", func_name, kw_name);
3918
"%s() got multiple values for keyword argument '%s'", func_name,
3919
PyString_AS_STRING(kw_name));
3923
static void __Pyx_RaiseArgtupleInvalid(
3924
const char* func_name,
3928
Py_ssize_t num_found)
3930
Py_ssize_t num_expected;
3931
const char *number, *more_or_less;
3933
if (num_found < num_min) {
3934
num_expected = num_min;
3935
more_or_less = "at least";
3937
num_expected = num_max;
3938
more_or_less = "at most";
3941
more_or_less = "exactly";
3943
number = (num_expected == 1) ? "" : "s";
3944
PyErr_Format(PyExc_TypeError,
3945
#if PY_VERSION_HEX < 0x02050000
3946
"%s() takes %s %d positional argument%s (%d given)",
3948
"%s() takes %s %zd positional argument%s (%zd given)",
3950
func_name, more_or_less, num_expected, number, num_found);
3953
static int __Pyx_ParseOptionalKeywords(
3955
PyObject **argnames[],
3958
Py_ssize_t num_pos_args,
3959
const char* function_name)
3961
PyObject *key = 0, *value = 0;
3964
PyObject*** first_kw_arg = argnames + num_pos_args;
3966
while (PyDict_Next(kwds, &pos, &key, &value)) {
3967
name = first_kw_arg;
3968
while (*name && (**name != key)) name++;
3970
values[name-argnames] = value;
3972
#if PY_MAJOR_VERSION < 3
3973
if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
3975
if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
3977
goto invalid_keyword_type;
3979
for (name = first_kw_arg; *name; name++) {
3980
#if PY_MAJOR_VERSION >= 3
3981
if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
3982
PyUnicode_Compare(**name, key) == 0) break;
3984
if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
3985
_PyString_Eq(**name, key)) break;
3989
values[name-argnames] = value;
3991
/* unexpected keyword found */
3992
for (name=argnames; name != first_kw_arg; name++) {
3993
if (**name == key) goto arg_passed_twice;
3994
#if PY_MAJOR_VERSION >= 3
3995
if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
3996
PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
3998
if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
3999
_PyString_Eq(**name, key)) goto arg_passed_twice;
4003
if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
4005
goto invalid_keyword;
4013
__Pyx_RaiseDoubleKeywordsError(function_name, **name);
4015
invalid_keyword_type:
4016
PyErr_Format(PyExc_TypeError,
4017
"%s() keywords must be strings", function_name);
4020
PyErr_Format(PyExc_TypeError,
4021
#if PY_MAJOR_VERSION < 3
4022
"%s() got an unexpected keyword argument '%s'",
4023
function_name, PyString_AsString(key));
4025
"%s() got an unexpected keyword argument '%U'",
4026
function_name, key);
4032
static INLINE int __Pyx_CheckKeywordStrings(
4034
const char* function_name,
4039
while (PyDict_Next(kwdict, &pos, &key, 0)) {
4040
#if PY_MAJOR_VERSION < 3
4041
if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
4043
if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key)))
4045
goto invalid_keyword_type;
4047
if ((!kw_allowed) && unlikely(key))
4048
goto invalid_keyword;
4050
invalid_keyword_type:
4051
PyErr_Format(PyExc_TypeError,
4052
"%s() keywords must be strings", function_name);
4055
PyErr_Format(PyExc_TypeError,
4056
#if PY_MAJOR_VERSION < 3
4057
"%s() got an unexpected keyword argument '%s'",
4058
function_name, PyString_AsString(key));
4060
"%s() got an unexpected keyword argument '%U'",
4061
function_name, key);
4066
static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
4067
PyObject *tmp_type, *tmp_value, *tmp_tb;
4068
PyThreadState *tstate = PyThreadState_GET();
4070
#if PY_MAJOR_VERSION >= 3
4071
/* Note: this is a temporary work-around to prevent crashes in Python 3.0 */
4072
if ((tstate->exc_type != NULL) & (tstate->exc_type != Py_None)) {
4073
tmp_type = tstate->exc_type;
4074
tmp_value = tstate->exc_value;
4075
tmp_tb = tstate->exc_traceback;
4076
PyErr_NormalizeException(&type, &value, &tb);
4077
PyErr_NormalizeException(&tmp_type, &tmp_value, &tmp_tb);
4078
tstate->exc_type = 0;
4079
tstate->exc_value = 0;
4080
tstate->exc_traceback = 0;
4081
PyException_SetContext(value, tmp_value);
4082
Py_DECREF(tmp_type);
4087
tmp_type = tstate->curexc_type;
4088
tmp_value = tstate->curexc_value;
4089
tmp_tb = tstate->curexc_traceback;
4090
tstate->curexc_type = type;
4091
tstate->curexc_value = value;
4092
tstate->curexc_traceback = tb;
4093
Py_XDECREF(tmp_type);
4094
Py_XDECREF(tmp_value);
4098
static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
4099
PyThreadState *tstate = PyThreadState_GET();
4100
*type = tstate->curexc_type;
4101
*value = tstate->curexc_value;
4102
*tb = tstate->curexc_traceback;
4104
tstate->curexc_type = 0;
4105
tstate->curexc_value = 0;
4106
tstate->curexc_traceback = 0;
4110
static PyObject *__Pyx_CreateClass(
4111
PyObject *bases, PyObject *dict, PyObject *name, const char *modname)
4113
PyObject *py_modname;
4114
PyObject *result = 0;
4116
#if PY_MAJOR_VERSION < 3
4117
py_modname = PyString_FromString(modname);
4119
py_modname = PyUnicode_FromString(modname);
4123
if (PyDict_SetItemString(dict, "__module__", py_modname) < 0)
4125
#if PY_MAJOR_VERSION < 3
4126
result = PyClass_New(bases, dict, name);
4128
result = PyObject_CallFunctionObjArgs((PyObject *)&PyType_Type, name, bases, dict, NULL);
4131
Py_XDECREF(py_modname);
4135
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
4136
PyObject *__import__ = 0;
4137
PyObject *empty_list = 0;
4138
PyObject *module = 0;
4139
PyObject *global_dict = 0;
4140
PyObject *empty_dict = 0;
4142
__import__ = __Pyx_GetAttrString(__pyx_b, "__import__");
4148
empty_list = PyList_New(0);
4153
global_dict = PyModule_GetDict(__pyx_m);
4156
empty_dict = PyDict_New();
4159
module = PyObject_CallFunctionObjArgs(__import__,
4160
name, global_dict, empty_dict, list, NULL);
4162
Py_XDECREF(empty_list);
4163
Py_XDECREF(__import__);
4164
Py_XDECREF(empty_dict);
4168
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
4170
result = PyObject_GetAttr(dict, name);
4172
PyErr_SetObject(PyExc_NameError, name);
4176
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
4180
/* First, check the traceback argument, replacing None with NULL. */
4181
if (tb == Py_None) {
4185
else if (tb != NULL && !PyTraceBack_Check(tb)) {
4186
PyErr_SetString(PyExc_TypeError,
4187
"raise: arg 3 must be a traceback or None");
4190
/* Next, replace a missing value with None */
4191
if (value == NULL) {
4195
#if PY_VERSION_HEX < 0x02050000
4196
if (!PyClass_Check(type))
4198
if (!PyType_Check(type))
4201
/* Raising an instance. The value should be a dummy. */
4202
if (value != Py_None) {
4203
PyErr_SetString(PyExc_TypeError,
4204
"instance exception may not have a separate value");
4207
/* Normalize to raise <class>, <instance> */
4210
#if PY_VERSION_HEX < 0x02050000
4211
if (PyInstance_Check(type)) {
4212
type = (PyObject*) ((PyInstanceObject*)type)->in_class;
4217
PyErr_SetString(PyExc_TypeError,
4218
"raise: exception must be an old-style class or instance");
4222
type = (PyObject*) Py_TYPE(type);
4224
if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
4225
PyErr_SetString(PyExc_TypeError,
4226
"raise: exception class must be a subclass of BaseException");
4231
__Pyx_ErrRestore(type, value, tb);
4240
static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
4241
PyErr_Format(PyExc_ValueError,
4242
#if PY_VERSION_HEX < 0x02050000
4243
"need more than %d value%s to unpack", (int)index,
4245
"need more than %zd value%s to unpack", index,
4247
(index == 1) ? "" : "s");
4250
static INLINE void __Pyx_RaiseTooManyValuesError(void) {
4251
PyErr_SetString(PyExc_ValueError, "too many values to unpack");
4254
static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) {
4256
if (!(item = PyIter_Next(iter))) {
4257
if (!PyErr_Occurred()) {
4258
__Pyx_RaiseNeedMoreValuesError(index);
4264
static int __Pyx_EndUnpack(PyObject *iter) {
4266
if ((item = PyIter_Next(iter))) {
4268
__Pyx_RaiseTooManyValuesError();
4271
else if (!PyErr_Occurred())
4277
static INLINE int __Pyx_StrEq(const char *s1, const char *s2) {
4278
while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
4282
static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
4283
if (sizeof(unsigned char) < sizeof(long)) {
4284
long val = __Pyx_PyInt_AsLong(x);
4285
if (unlikely(val != (long)(unsigned char)val)) {
4286
if (unlikely(val == -1 && PyErr_Occurred()))
4287
return (unsigned char)-1;
4288
if (unlikely(val < 0)) {
4289
PyErr_SetString(PyExc_OverflowError,
4290
"can't convert negative value to unsigned char");
4291
return (unsigned char)-1;
4293
PyErr_SetString(PyExc_OverflowError,
4294
"value too large to convert to unsigned char");
4295
return (unsigned char)-1;
4297
return (unsigned char)val;
4299
return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
4302
static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
4303
if (sizeof(unsigned short) < sizeof(long)) {
4304
long val = __Pyx_PyInt_AsLong(x);
4305
if (unlikely(val != (long)(unsigned short)val)) {
4306
if (unlikely(val == -1 && PyErr_Occurred()))
4307
return (unsigned short)-1;
4308
if (unlikely(val < 0)) {
4309
PyErr_SetString(PyExc_OverflowError,
4310
"can't convert negative value to unsigned short");
4311
return (unsigned short)-1;
4313
PyErr_SetString(PyExc_OverflowError,
4314
"value too large to convert to unsigned short");
4315
return (unsigned short)-1;
4317
return (unsigned short)val;
4319
return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
4322
static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
4323
if (sizeof(unsigned int) < sizeof(long)) {
4324
long val = __Pyx_PyInt_AsLong(x);
4325
if (unlikely(val != (long)(unsigned int)val)) {
4326
if (unlikely(val == -1 && PyErr_Occurred()))
4327
return (unsigned int)-1;
4328
if (unlikely(val < 0)) {
4329
PyErr_SetString(PyExc_OverflowError,
4330
"can't convert negative value to unsigned int");
4331
return (unsigned int)-1;
4333
PyErr_SetString(PyExc_OverflowError,
4334
"value too large to convert to unsigned int");
4335
return (unsigned int)-1;
4337
return (unsigned int)val;
4339
return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
4342
static INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
4343
if (sizeof(char) < sizeof(long)) {
4344
long val = __Pyx_PyInt_AsLong(x);
4345
if (unlikely(val != (long)(char)val)) {
4346
if (unlikely(val == -1 && PyErr_Occurred()))
4348
PyErr_SetString(PyExc_OverflowError,
4349
"value too large to convert to char");
4354
return (char)__Pyx_PyInt_AsLong(x);
4357
static INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
4358
if (sizeof(short) < sizeof(long)) {
4359
long val = __Pyx_PyInt_AsLong(x);
4360
if (unlikely(val != (long)(short)val)) {
4361
if (unlikely(val == -1 && PyErr_Occurred()))
4363
PyErr_SetString(PyExc_OverflowError,
4364
"value too large to convert to short");
4369
return (short)__Pyx_PyInt_AsLong(x);
4372
static INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
4373
if (sizeof(int) < sizeof(long)) {
4374
long val = __Pyx_PyInt_AsLong(x);
4375
if (unlikely(val != (long)(int)val)) {
4376
if (unlikely(val == -1 && PyErr_Occurred()))
4378
PyErr_SetString(PyExc_OverflowError,
4379
"value too large to convert to int");
4384
return (int)__Pyx_PyInt_AsLong(x);
4387
static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
4388
if (sizeof(signed char) < sizeof(long)) {
4389
long val = __Pyx_PyInt_AsLong(x);
4390
if (unlikely(val != (long)(signed char)val)) {
4391
if (unlikely(val == -1 && PyErr_Occurred()))
4392
return (signed char)-1;
4393
PyErr_SetString(PyExc_OverflowError,
4394
"value too large to convert to signed char");
4395
return (signed char)-1;
4397
return (signed char)val;
4399
return (signed char)__Pyx_PyInt_AsSignedLong(x);
4402
static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
4403
if (sizeof(signed short) < sizeof(long)) {
4404
long val = __Pyx_PyInt_AsLong(x);
4405
if (unlikely(val != (long)(signed short)val)) {
4406
if (unlikely(val == -1 && PyErr_Occurred()))
4407
return (signed short)-1;
4408
PyErr_SetString(PyExc_OverflowError,
4409
"value too large to convert to signed short");
4410
return (signed short)-1;
4412
return (signed short)val;
4414
return (signed short)__Pyx_PyInt_AsSignedLong(x);
4417
static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
4418
if (sizeof(signed int) < sizeof(long)) {
4419
long val = __Pyx_PyInt_AsLong(x);
4420
if (unlikely(val != (long)(signed int)val)) {
4421
if (unlikely(val == -1 && PyErr_Occurred()))
4422
return (signed int)-1;
4423
PyErr_SetString(PyExc_OverflowError,
4424
"value too large to convert to signed int");
4425
return (signed int)-1;
4427
return (signed int)val;
4429
return (signed int)__Pyx_PyInt_AsSignedLong(x);
4432
static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
4433
#if PY_VERSION_HEX < 0x03000000
4434
if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) {
4435
long val = PyInt_AS_LONG(x);
4436
if (unlikely(val < 0)) {
4437
PyErr_SetString(PyExc_OverflowError,
4438
"can't convert negative value to unsigned long");
4439
return (unsigned long)-1;
4441
return (unsigned long)val;
4444
if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) {
4445
if (unlikely(Py_SIZE(x) < 0)) {
4446
PyErr_SetString(PyExc_OverflowError,
4447
"can't convert negative value to unsigned long");
4448
return (unsigned long)-1;
4450
return PyLong_AsUnsignedLong(x);
4453
PyObject *tmp = __Pyx_PyNumber_Int(x);
4454
if (!tmp) return (unsigned long)-1;
4455
val = __Pyx_PyInt_AsUnsignedLong(tmp);
4461
static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
4462
#if PY_VERSION_HEX < 0x03000000
4463
if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) {
4464
long val = PyInt_AS_LONG(x);
4465
if (unlikely(val < 0)) {
4466
PyErr_SetString(PyExc_OverflowError,
4467
"can't convert negative value to unsigned PY_LONG_LONG");
4468
return (unsigned PY_LONG_LONG)-1;
4470
return (unsigned PY_LONG_LONG)val;
4473
if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) {
4474
if (unlikely(Py_SIZE(x) < 0)) {
4475
PyErr_SetString(PyExc_OverflowError,
4476
"can't convert negative value to unsigned PY_LONG_LONG");
4477
return (unsigned PY_LONG_LONG)-1;
4479
return PyLong_AsUnsignedLongLong(x);
4481
unsigned PY_LONG_LONG val;
4482
PyObject *tmp = __Pyx_PyNumber_Int(x);
4483
if (!tmp) return (unsigned PY_LONG_LONG)-1;
4484
val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
4490
static INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
4491
#if PY_VERSION_HEX < 0x03000000
4492
if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) {
4493
long val = PyInt_AS_LONG(x);
4497
if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) {
4498
return PyLong_AsLong(x);
4501
PyObject *tmp = __Pyx_PyNumber_Int(x);
4502
if (!tmp) return (long)-1;
4503
val = __Pyx_PyInt_AsLong(tmp);
4509
static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
4510
#if PY_VERSION_HEX < 0x03000000
4511
if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) {
4512
long val = PyInt_AS_LONG(x);
4513
return (PY_LONG_LONG)val;
4516
if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) {
4517
return PyLong_AsLongLong(x);
4520
PyObject *tmp = __Pyx_PyNumber_Int(x);
4521
if (!tmp) return (PY_LONG_LONG)-1;
4522
val = __Pyx_PyInt_AsLongLong(tmp);
4528
static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
4529
#if PY_VERSION_HEX < 0x03000000
4530
if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) {
4531
long val = PyInt_AS_LONG(x);
4532
return (signed long)val;
4535
if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) {
4536
return PyLong_AsLong(x);
4539
PyObject *tmp = __Pyx_PyNumber_Int(x);
4540
if (!tmp) return (signed long)-1;
4541
val = __Pyx_PyInt_AsSignedLong(tmp);
4547
static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
4548
#if PY_VERSION_HEX < 0x03000000
4549
if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) {
4550
long val = PyInt_AS_LONG(x);
4551
return (signed PY_LONG_LONG)val;
4554
if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) {
4555
return PyLong_AsLongLong(x);
4557
signed PY_LONG_LONG val;
4558
PyObject *tmp = __Pyx_PyNumber_Int(x);
4559
if (!tmp) return (signed PY_LONG_LONG)-1;
4560
val = __Pyx_PyInt_AsSignedLongLong(tmp);
4566
#include "compile.h"
4567
#include "frameobject.h"
4568
#include "traceback.h"
4570
static void __Pyx_AddTraceback(const char *funcname) {
4571
PyObject *py_srcfile = 0;
4572
PyObject *py_funcname = 0;
4573
PyObject *py_globals = 0;
4574
PyObject *empty_string = 0;
4575
PyCodeObject *py_code = 0;
4576
PyFrameObject *py_frame = 0;
4578
#if PY_MAJOR_VERSION < 3
4579
py_srcfile = PyString_FromString(__pyx_filename);
4581
py_srcfile = PyUnicode_FromString(__pyx_filename);
4583
if (!py_srcfile) goto bad;
4584
if (__pyx_clineno) {
4585
#if PY_MAJOR_VERSION < 3
4586
py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
4588
py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
4592
#if PY_MAJOR_VERSION < 3
4593
py_funcname = PyString_FromString(funcname);
4595
py_funcname = PyUnicode_FromString(funcname);
4598
if (!py_funcname) goto bad;
4599
py_globals = PyModule_GetDict(__pyx_m);
4600
if (!py_globals) goto bad;
4601
#if PY_MAJOR_VERSION < 3
4602
empty_string = PyString_FromStringAndSize("", 0);
4604
empty_string = PyBytes_FromStringAndSize("", 0);
4606
if (!empty_string) goto bad;
4607
py_code = PyCode_New(
4608
0, /*int argcount,*/
4609
#if PY_MAJOR_VERSION >= 3
4610
0, /*int kwonlyargcount,*/
4613
0, /*int stacksize,*/
4615
empty_string, /*PyObject *code,*/
4616
__pyx_empty_tuple, /*PyObject *consts,*/
4617
__pyx_empty_tuple, /*PyObject *names,*/
4618
__pyx_empty_tuple, /*PyObject *varnames,*/
4619
__pyx_empty_tuple, /*PyObject *freevars,*/
4620
__pyx_empty_tuple, /*PyObject *cellvars,*/
4621
py_srcfile, /*PyObject *filename,*/
4622
py_funcname, /*PyObject *name,*/
4623
__pyx_lineno, /*int firstlineno,*/
4624
empty_string /*PyObject *lnotab*/
4626
if (!py_code) goto bad;
4627
py_frame = PyFrame_New(
4628
PyThreadState_GET(), /*PyThreadState *tstate,*/
4629
py_code, /*PyCodeObject *code,*/
4630
py_globals, /*PyObject *globals,*/
4631
0 /*PyObject *locals*/
4633
if (!py_frame) goto bad;
4634
py_frame->f_lineno = __pyx_lineno;
4635
PyTraceBack_Here(py_frame);
4637
Py_XDECREF(py_srcfile);
4638
Py_XDECREF(py_funcname);
4639
Py_XDECREF(empty_string);
4640
Py_XDECREF(py_code);
4641
Py_XDECREF(py_frame);
4644
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
4646
#if PY_MAJOR_VERSION < 3
4647
if (t->is_unicode && (!t->is_identifier)) {
4648
*t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
4649
} else if (t->intern) {
4650
*t->p = PyString_InternFromString(t->s);
4652
*t->p = PyString_FromStringAndSize(t->s, t->n - 1);
4654
#else /* Python 3+ has unicode identifiers */
4655
if (t->is_identifier || (t->is_unicode && t->intern)) {
4656
*t->p = PyUnicode_InternFromString(t->s);
4657
} else if (t->is_unicode) {
4658
*t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
4660
*t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
4670
/* Type Conversion Functions */
4672
static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
4673
if (x == Py_True) return 1;
4674
else if ((x == Py_False) | (x == Py_None)) return 0;
4675
else return PyObject_IsTrue(x);
4678
static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
4680
const char *name = NULL;
4681
PyObject *res = NULL;
4682
#if PY_VERSION_HEX < 0x03000000
4683
if (PyInt_Check(x) || PyLong_Check(x))
4685
if (PyLong_Check(x))
4687
return Py_INCREF(x), x;
4688
m = Py_TYPE(x)->tp_as_number;
4689
#if PY_VERSION_HEX < 0x03000000
4690
if (m && m->nb_int) {
4692
res = PyNumber_Int(x);
4694
else if (m && m->nb_long) {
4696
res = PyNumber_Long(x);
4699
if (m && m->nb_int) {
4701
res = PyNumber_Long(x);
4705
#if PY_VERSION_HEX < 0x03000000
4706
if (!PyInt_Check(res) && !PyLong_Check(res)) {
4708
if (!PyLong_Check(res)) {
4710
PyErr_Format(PyExc_TypeError,
4711
"__%s__ returned non-%s (type %.200s)",
4712
name, name, Py_TYPE(res)->tp_name);
4717
else if (!PyErr_Occurred()) {
4718
PyErr_SetString(PyExc_TypeError,
4719
"an integer is required");
4724
static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
4726
PyObject* x = PyNumber_Index(b);
4728
ival = PyInt_AsSsize_t(x);
4733
static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
4734
#if PY_VERSION_HEX < 0x02050000
4735
if (ival <= LONG_MAX)
4736
return PyInt_FromLong((long)ival);
4738
unsigned char *bytes = (unsigned char *) &ival;
4739
int one = 1; int little = (int)*(unsigned char*)&one;
4740
return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
4743
return PyInt_FromSize_t(ival);
4747
static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
4748
unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
4749
if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
4751
} else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
4752
PyErr_SetString(PyExc_OverflowError,
4753
"value too large to convert to size_t");
1
/* Generated by Cython 0.14.1 on Wed Mar 16 15:58:08 2011 */
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) PyInt_AsLong(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
163
#if PY_MAJOR_VERSION >= 3
164
#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
165
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
167
#define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
168
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
171
#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
172
#define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
173
#define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
174
#define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
176
#define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
177
(PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
178
(likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
179
(PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
180
#define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
181
(PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
182
(likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
183
(PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
184
#define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
185
(PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
186
(likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
187
(PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
190
#if PY_MAJOR_VERSION >= 3
191
#define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
194
#if PY_VERSION_HEX < 0x02050000
195
#define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n)))
196
#define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
197
#define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n)))
199
#define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n))
200
#define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
201
#define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n))
204
#if PY_VERSION_HEX < 0x02050000
205
#define __Pyx_NAMESTR(n) ((char *)(n))
206
#define __Pyx_DOCSTR(n) ((char *)(n))
208
#define __Pyx_NAMESTR(n) (n)
209
#define __Pyx_DOCSTR(n) (n)
213
#define __PYX_EXTERN_C extern "C"
215
#define __PYX_EXTERN_C extern
218
#if defined(WIN32) || defined(MS_WINDOWS)
219
#define _USE_MATH_DEFINES
222
#define __PYX_HAVE_API__iocpsupport
225
#include "winsock2.h"
229
#include "winsock_pointers.h"
231
#ifdef PYREX_WITHOUT_ASSERTIONS
232
#define CYTHON_WITHOUT_ASSERTIONS
236
/* inline attribute */
237
#ifndef CYTHON_INLINE
238
#if defined(__GNUC__)
239
#define CYTHON_INLINE __inline__
240
#elif defined(_MSC_VER)
241
#define CYTHON_INLINE __inline
242
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
243
#define CYTHON_INLINE inline
245
#define CYTHON_INLINE
249
/* unused attribute */
250
#ifndef CYTHON_UNUSED
251
# if defined(__GNUC__)
252
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
253
# define CYTHON_UNUSED __attribute__ ((__unused__))
255
# define CYTHON_UNUSED
257
# elif defined(__ICC) || defined(__INTEL_COMPILER)
258
# define CYTHON_UNUSED __attribute__ ((__unused__))
260
# define CYTHON_UNUSED
264
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*/
267
/* Type Conversion Predeclarations */
269
#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
270
#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s))
272
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
273
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
274
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
276
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
277
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
278
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
280
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
284
/* Test for GCC > 2.95 */
285
#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
286
#define likely(x) __builtin_expect(!!(x), 1)
287
#define unlikely(x) __builtin_expect(!!(x), 0)
288
#else /* __GNUC__ > 2 ... */
289
#define likely(x) (x)
290
#define unlikely(x) (x)
291
#endif /* __GNUC__ > 2 ... */
293
#define likely(x) (x)
294
#define unlikely(x) (x)
295
#endif /* __GNUC__ */
297
static PyObject *__pyx_m;
298
static PyObject *__pyx_b;
299
static PyObject *__pyx_empty_tuple;
300
static PyObject *__pyx_empty_bytes;
301
static int __pyx_lineno;
302
static int __pyx_clineno = 0;
303
static const char * __pyx_cfilenm= __FILE__;
304
static const char *__pyx_filename;
307
static const char *__pyx_f[] = {
315
typedef int __pyx_t_11iocpsupport_size_t;
317
typedef unsigned long __pyx_t_11iocpsupport_HANDLE;
319
typedef unsigned long __pyx_t_11iocpsupport_SOCKET;
321
typedef unsigned long __pyx_t_11iocpsupport_DWORD;
323
typedef unsigned long __pyx_t_11iocpsupport_ULONG_PTR;
325
typedef int __pyx_t_11iocpsupport_BOOL;
327
/* Type declarations */
329
/* "iocpsupport.pyx":104
330
* # BOOL (*lpTransmitFile)(SOCKET s, HANDLE hFile, DWORD size, DWORD buffer_size, OVERLAPPED *ov, TRANSMIT_FILE_BUFFERS *buff, DWORD flags)
332
* cdef struct myOVERLAPPED: # <<<<<<<<<<<<<<
337
struct __pyx_t_11iocpsupport_myOVERLAPPED {
339
struct PyObject *obj;
342
/* "iocpsupport.pyx":128
343
* setattr(self, k, v)
345
* cdef class CompletionPort: # <<<<<<<<<<<<<<
347
* def __init__(self):
350
struct __pyx_obj_11iocpsupport_CompletionPort {
352
__pyx_t_11iocpsupport_HANDLE port;
355
#ifndef CYTHON_REFNANNY
356
#define CYTHON_REFNANNY 0
361
void (*INCREF)(void*, PyObject*, int);
362
void (*DECREF)(void*, PyObject*, int);
363
void (*GOTREF)(void*, PyObject*, int);
364
void (*GIVEREF)(void*, PyObject*, int);
365
void* (*SetupContext)(const char*, int, const char*);
366
void (*FinishContext)(void**);
367
} __Pyx_RefNannyAPIStruct;
368
static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
369
static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) {
370
PyObject *m = NULL, *p = NULL;
372
m = PyImport_ImportModule((char *)modname);
374
p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
376
r = PyLong_AsVoidPtr(p);
380
return (__Pyx_RefNannyAPIStruct *)r;
382
#define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
383
#define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
384
#define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
385
#define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
386
#define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
387
#define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
388
#define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0)
390
#define __Pyx_RefNannySetupContext(name)
391
#define __Pyx_RefNannyFinishContext()
392
#define __Pyx_INCREF(r) Py_INCREF(r)
393
#define __Pyx_DECREF(r) Py_DECREF(r)
394
#define __Pyx_GOTREF(r)
395
#define __Pyx_GIVEREF(r)
396
#define __Pyx_XDECREF(r) Py_XDECREF(r)
397
#endif /* CYTHON_REFNANNY */
398
#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0)
399
#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0)
401
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
403
static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
404
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
406
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
408
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
409
Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
411
static void __Pyx_RaiseDoubleKeywordsError(
412
const char* func_name, PyObject* kw_name); /*proto*/
414
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/
416
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
418
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
420
static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/
421
static int __Pyx_EndUnpack(PyObject *, Py_ssize_t expected); /*proto*/
423
static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict,
424
const char* function_name, int kw_allowed); /*proto*/
426
static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */
428
static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/
430
static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
431
PyObject *modname); /*proto*/
433
#define __pyx_binding_PyCFunctionType_USED 1
436
PyCFunctionObject func;
437
} __pyx_binding_PyCFunctionType_object;
439
static PyTypeObject __pyx_binding_PyCFunctionType_type;
440
static PyTypeObject *__pyx_binding_PyCFunctionType = NULL;
442
static PyObject *__pyx_binding_PyCFunctionType_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module); /* proto */
443
#define __pyx_binding_PyCFunctionType_New(ml, self) __pyx_binding_PyCFunctionType_NewEx(ml, self, NULL)
445
static int __pyx_binding_PyCFunctionType_init(void); /* proto */
447
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
449
static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
451
static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
453
static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
455
static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);
457
static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);
459
static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);
461
static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
463
static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
465
static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
467
static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);
469
static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
471
static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
473
static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);
475
static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
477
static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
479
static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
481
static void __Pyx_AddTraceback(const char *funcname); /*proto*/
483
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
484
/* Module declarations from iocpsupport */
486
static PyTypeObject *__pyx_ptype_11iocpsupport_CompletionPort = 0;
487
static struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_f_11iocpsupport_makeOV(void); /*proto*/
488
static void __pyx_f_11iocpsupport_raise_error(int, PyObject *); /*proto*/
489
static PyObject *__pyx_f_11iocpsupport__makesockaddr(struct sockaddr *, int); /*proto*/
490
static PyObject *__pyx_f_11iocpsupport_fillinetaddr(struct sockaddr_in *, PyObject *); /*proto*/
491
static int __pyx_f_11iocpsupport_getAddrFamily(__pyx_t_11iocpsupport_SOCKET); /*proto*/
492
#define __Pyx_MODULE_NAME "iocpsupport"
493
static int __pyx_module_is_main_iocpsupport = 0;
495
/* Implementation of iocpsupport */
496
static PyObject *__pyx_builtin_ValueError;
497
static PyObject *__pyx_builtin_MemoryError;
498
static PyObject *__pyx_builtin_WindowsError;
499
static char __pyx_k_1[] = "CreateIoCompletionPort";
500
static char __pyx_k_2[] = "PostQueuedCompletionStatus";
501
static char __pyx_k_3[] = "invalid IP address";
502
static char __pyx_k_4[] = "ConnectEx is not available on this system";
503
static char __pyx_k_5[] = "unsupported address family";
504
static char __pyx_k_6[] = "second argument needs to be a list";
505
static char __pyx_k_7[] = "length of address length buffer needs to be sizeof(int)";
506
static char __pyx_k_8[] = "Failed to initialize Winsock function vectors";
507
static char __pyx_k__s[] = "s";
508
static char __pyx_k__buf[] = "buf";
509
static char __pyx_k__key[] = "key";
510
static char __pyx_k__len[] = "len";
511
static char __pyx_k__obj[] = "obj";
512
static char __pyx_k__addr[] = "addr";
513
static char __pyx_k__buff[] = "buff";
514
static char __pyx_k__port[] = "port";
515
static char __pyx_k__recv[] = "recv";
516
static char __pyx_k__self[] = "self";
517
static char __pyx_k__send[] = "send";
518
static char __pyx_k__Event[] = "Event";
519
static char __pyx_k__bytes[] = "bytes";
520
static char __pyx_k__flags[] = "flags";
521
static char __pyx_k__items[] = "items";
522
static char __pyx_k__owner[] = "owner";
523
static char __pyx_k__accept[] = "accept";
524
static char __pyx_k__handle[] = "handle";
525
static char __pyx_k__s_addr[] = "s_addr";
526
static char __pyx_k__socket[] = "socket";
527
static char __pyx_k__connect[] = "connect";
528
static char __pyx_k__sa_data[] = "sa_data";
529
static char __pyx_k____init__[] = "__init__";
530
static char __pyx_k____main__[] = "__main__";
531
static char __pyx_k____test__[] = "__test__";
532
static char __pyx_k__bufflist[] = "bufflist";
533
static char __pyx_k__callback[] = "callback";
534
static char __pyx_k__recvfrom[] = "recvfrom";
535
static char __pyx_k__sin_addr[] = "sin_addr";
536
static char __pyx_k__sin_port[] = "sin_port";
537
static char __pyx_k__accepting[] = "accepting";
538
static char __pyx_k__addr_buff[] = "addr_buff";
539
static char __pyx_k__listening[] = "listening";
540
static char __pyx_k__sa_family[] = "sa_family";
541
static char __pyx_k__ValueError[] = "ValueError";
542
static char __pyx_k__getsockopt[] = "getsockopt";
543
static char __pyx_k__maxAddrLen[] = "maxAddrLen";
544
static char __pyx_k__MemoryError[] = "MemoryError";
545
static char __pyx_k__iocpsupport[] = "iocpsupport";
546
static char __pyx_k__WindowsError[] = "WindowsError";
547
static char __pyx_k__iMaxSockAddr[] = "iMaxSockAddr";
548
static char __pyx_k__makesockaddr[] = "makesockaddr";
549
static char __pyx_k__addr_len_buff[] = "addr_len_buff";
550
static char __pyx_k__have_connectex[] = "have_connectex";
551
static char __pyx_k__iAddressFamily[] = "iAddressFamily";
552
static char __pyx_k__get_accept_addrs[] = "get_accept_addrs";
553
static char __pyx_k__AllocateReadBuffer[] = "AllocateReadBuffer";
554
static PyObject *__pyx_n_s_1;
555
static PyObject *__pyx_n_s_2;
556
static PyObject *__pyx_kp_s_3;
557
static PyObject *__pyx_kp_s_4;
558
static PyObject *__pyx_kp_s_5;
559
static PyObject *__pyx_kp_s_7;
560
static PyObject *__pyx_kp_s_8;
561
static PyObject *__pyx_n_s__AllocateReadBuffer;
562
static PyObject *__pyx_n_s__Event;
563
static PyObject *__pyx_n_s__MemoryError;
564
static PyObject *__pyx_n_s__ValueError;
565
static PyObject *__pyx_n_s__WindowsError;
566
static PyObject *__pyx_n_s____init__;
567
static PyObject *__pyx_n_s____main__;
568
static PyObject *__pyx_n_s____test__;
569
static PyObject *__pyx_n_s__accept;
570
static PyObject *__pyx_n_s__accepting;
571
static PyObject *__pyx_n_s__addr;
572
static PyObject *__pyx_n_s__addr_buff;
573
static PyObject *__pyx_n_s__addr_len_buff;
574
static PyObject *__pyx_n_s__buf;
575
static PyObject *__pyx_n_s__buff;
576
static PyObject *__pyx_n_s__bufflist;
577
static PyObject *__pyx_n_s__bytes;
578
static PyObject *__pyx_n_s__callback;
579
static PyObject *__pyx_n_s__connect;
580
static PyObject *__pyx_n_s__flags;
581
static PyObject *__pyx_n_s__get_accept_addrs;
582
static PyObject *__pyx_n_s__getsockopt;
583
static PyObject *__pyx_n_s__handle;
584
static PyObject *__pyx_n_s__have_connectex;
585
static PyObject *__pyx_n_s__iAddressFamily;
586
static PyObject *__pyx_n_s__iMaxSockAddr;
587
static PyObject *__pyx_n_s__iocpsupport;
588
static PyObject *__pyx_n_s__items;
589
static PyObject *__pyx_n_s__key;
590
static PyObject *__pyx_n_s__len;
591
static PyObject *__pyx_n_s__listening;
592
static PyObject *__pyx_n_s__makesockaddr;
593
static PyObject *__pyx_n_s__maxAddrLen;
594
static PyObject *__pyx_n_s__obj;
595
static PyObject *__pyx_n_s__owner;
596
static PyObject *__pyx_n_s__port;
597
static PyObject *__pyx_n_s__recv;
598
static PyObject *__pyx_n_s__recvfrom;
599
static PyObject *__pyx_n_s__s;
600
static PyObject *__pyx_n_s__s_addr;
601
static PyObject *__pyx_n_s__sa_data;
602
static PyObject *__pyx_n_s__sa_family;
603
static PyObject *__pyx_n_s__self;
604
static PyObject *__pyx_n_s__send;
605
static PyObject *__pyx_n_s__sin_addr;
606
static PyObject *__pyx_n_s__sin_port;
607
static PyObject *__pyx_n_s__socket;
608
static PyObject *__pyx_int_0;
610
/* "iocpsupport.pyx":108
613
* cdef myOVERLAPPED *makeOV() except NULL: # <<<<<<<<<<<<<<
614
* cdef myOVERLAPPED *res
615
* res = <myOVERLAPPED *>PyMem_Malloc(sizeof(myOVERLAPPED))
618
static struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_f_11iocpsupport_makeOV(void) {
619
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_res;
620
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_r;
623
__Pyx_RefNannySetupContext("makeOV");
625
/* "iocpsupport.pyx":110
626
* cdef myOVERLAPPED *makeOV() except NULL:
627
* cdef myOVERLAPPED *res
628
* res = <myOVERLAPPED *>PyMem_Malloc(sizeof(myOVERLAPPED)) # <<<<<<<<<<<<<<
632
__pyx_t_1 = PyMem_Malloc((sizeof(struct __pyx_t_11iocpsupport_myOVERLAPPED))); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
633
__pyx_v_res = ((struct __pyx_t_11iocpsupport_myOVERLAPPED *)__pyx_t_1);
635
/* "iocpsupport.pyx":111
636
* cdef myOVERLAPPED *res
637
* res = <myOVERLAPPED *>PyMem_Malloc(sizeof(myOVERLAPPED))
638
* if not res: # <<<<<<<<<<<<<<
640
* memset(res, 0, sizeof(myOVERLAPPED))
642
__pyx_t_2 = (!(__pyx_v_res != 0));
645
/* "iocpsupport.pyx":112
646
* res = <myOVERLAPPED *>PyMem_Malloc(sizeof(myOVERLAPPED))
648
* raise MemoryError # <<<<<<<<<<<<<<
649
* memset(res, 0, sizeof(myOVERLAPPED))
652
PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
657
/* "iocpsupport.pyx":113
660
* memset(res, 0, sizeof(myOVERLAPPED)) # <<<<<<<<<<<<<<
664
memset(__pyx_v_res, 0, (sizeof(struct __pyx_t_11iocpsupport_myOVERLAPPED)));
666
/* "iocpsupport.pyx":114
668
* memset(res, 0, sizeof(myOVERLAPPED))
669
* return res # <<<<<<<<<<<<<<
671
* cdef void raise_error(int err, object message) except *:
673
__pyx_r = __pyx_v_res;
679
__Pyx_AddTraceback("iocpsupport.makeOV");
682
__Pyx_RefNannyFinishContext();
686
/* "iocpsupport.pyx":116
689
* cdef void raise_error(int err, object message) except *: # <<<<<<<<<<<<<<
691
* err = GetLastError()
694
static void __pyx_f_11iocpsupport_raise_error(int __pyx_v_err, PyObject *__pyx_v_message) {
696
PyObject *__pyx_t_2 = NULL;
697
PyObject *__pyx_t_3 = NULL;
698
__Pyx_RefNannySetupContext("raise_error");
700
/* "iocpsupport.pyx":117
702
* cdef void raise_error(int err, object message) except *:
703
* if not err: # <<<<<<<<<<<<<<
704
* err = GetLastError()
705
* raise WindowsError(message, err)
707
__pyx_t_1 = (!__pyx_v_err);
710
/* "iocpsupport.pyx":118
711
* cdef void raise_error(int err, object message) except *:
713
* err = GetLastError() # <<<<<<<<<<<<<<
714
* raise WindowsError(message, err)
717
__pyx_v_err = GetLastError();
722
/* "iocpsupport.pyx":119
724
* err = GetLastError()
725
* raise WindowsError(message, err) # <<<<<<<<<<<<<<
729
__pyx_t_2 = PyInt_FromLong(__pyx_v_err); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
730
__Pyx_GOTREF(__pyx_t_2);
731
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
732
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
733
__Pyx_INCREF(__pyx_v_message);
734
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_message);
735
__Pyx_GIVEREF(__pyx_v_message);
736
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
737
__Pyx_GIVEREF(__pyx_t_2);
739
__pyx_t_2 = PyObject_Call(__pyx_builtin_WindowsError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
740
__Pyx_GOTREF(__pyx_t_2);
741
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
742
__Pyx_Raise(__pyx_t_2, 0, 0);
743
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
744
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
748
__Pyx_XDECREF(__pyx_t_2);
749
__Pyx_XDECREF(__pyx_t_3);
750
__Pyx_AddTraceback("iocpsupport.raise_error");
752
__Pyx_RefNannyFinishContext();
755
/* "iocpsupport.pyx":122
758
* def __init__(self, callback, owner, **kw): # <<<<<<<<<<<<<<
759
* self.callback = callback
763
static PyObject *__pyx_pf_11iocpsupport_5Event___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
764
static PyMethodDef __pyx_mdef_11iocpsupport_5Event___init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pf_11iocpsupport_5Event___init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
765
static PyObject *__pyx_pf_11iocpsupport_5Event___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
766
PyObject *__pyx_v_self = 0;
767
PyObject *__pyx_v_callback = 0;
768
PyObject *__pyx_v_owner = 0;
769
PyObject *__pyx_v_kw = 0;
772
PyObject *__pyx_r = NULL;
773
Py_ssize_t __pyx_t_1;
774
PyObject *__pyx_t_2 = NULL;
775
PyObject *__pyx_t_3 = NULL;
776
PyObject *__pyx_t_4 = NULL;
777
PyObject *__pyx_t_5 = NULL;
778
PyObject *__pyx_t_6 = NULL;
780
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__callback,&__pyx_n_s__owner,0};
781
__Pyx_RefNannySetupContext("__init__");
782
__pyx_self = __pyx_self;
783
__pyx_v_kw = PyDict_New(); if (unlikely(!__pyx_v_kw)) return NULL;
784
__Pyx_GOTREF(__pyx_v_kw);
785
if (unlikely(__pyx_kwds)) {
786
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
787
PyObject* values[3] = {0,0,0};
788
switch (PyTuple_GET_SIZE(__pyx_args)) {
789
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
790
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
791
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
793
default: goto __pyx_L5_argtuple_error;
795
switch (PyTuple_GET_SIZE(__pyx_args)) {
797
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
798
if (likely(values[0])) kw_args--;
799
else goto __pyx_L5_argtuple_error;
801
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback);
802
if (likely(values[1])) kw_args--;
804
__Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
807
values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__owner);
808
if (likely(values[2])) kw_args--;
810
__Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
813
if (unlikely(kw_args > 0)) {
814
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kw, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
816
__pyx_v_self = values[0];
817
__pyx_v_callback = values[1];
818
__pyx_v_owner = values[2];
819
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
820
goto __pyx_L5_argtuple_error;
822
__pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0);
823
__pyx_v_callback = PyTuple_GET_ITEM(__pyx_args, 1);
824
__pyx_v_owner = PyTuple_GET_ITEM(__pyx_args, 2);
826
goto __pyx_L4_argument_unpacking_done;
827
__pyx_L5_argtuple_error:;
828
__Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
830
__Pyx_DECREF(__pyx_v_kw);
831
__Pyx_AddTraceback("iocpsupport.Event.__init__");
832
__Pyx_RefNannyFinishContext();
834
__pyx_L4_argument_unpacking_done:;
835
__pyx_v_k = Py_None; __Pyx_INCREF(Py_None);
836
__pyx_v_v = Py_None; __Pyx_INCREF(Py_None);
838
/* "iocpsupport.pyx":123
840
* def __init__(self, callback, owner, **kw):
841
* self.callback = callback # <<<<<<<<<<<<<<
843
* for k, v in kw.items():
845
if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__callback, __pyx_v_callback) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
847
/* "iocpsupport.pyx":124
848
* def __init__(self, callback, owner, **kw):
849
* self.callback = callback
850
* self.owner = owner # <<<<<<<<<<<<<<
851
* for k, v in kw.items():
852
* setattr(self, k, v)
854
if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__owner, __pyx_v_owner) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
856
/* "iocpsupport.pyx":125
857
* self.callback = callback
859
* for k, v in kw.items(): # <<<<<<<<<<<<<<
860
* setattr(self, k, v)
863
if (unlikely(__pyx_v_kw == Py_None)) {
864
PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'items'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
866
__pyx_t_2 = PyDict_Items(__pyx_v_kw); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
867
__Pyx_GOTREF(__pyx_t_2);
868
if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
869
__pyx_t_1 = 0; __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3);
871
__pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
872
__Pyx_GOTREF(__pyx_t_3);
874
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
876
if (likely(PyList_CheckExact(__pyx_t_3))) {
877
if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break;
878
__pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++;
879
} else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
880
if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
881
__pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++;
883
__pyx_t_2 = PyIter_Next(__pyx_t_3);
885
if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
888
__Pyx_GOTREF(__pyx_t_2);
890
if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) {
891
PyObject* tuple = __pyx_t_2;
892
__pyx_t_4 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_4);
893
__pyx_t_5 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_5);
894
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
895
__Pyx_DECREF(__pyx_v_k);
896
__pyx_v_k = __pyx_t_4;
898
__Pyx_DECREF(__pyx_v_v);
899
__pyx_v_v = __pyx_t_5;
902
__pyx_t_6 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
903
__Pyx_GOTREF(__pyx_t_6);
904
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
905
__pyx_t_4 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
906
__Pyx_GOTREF(__pyx_t_4);
907
__pyx_t_5 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
908
__Pyx_GOTREF(__pyx_t_5);
909
if (__Pyx_EndUnpack(__pyx_t_6, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
910
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
911
__Pyx_DECREF(__pyx_v_k);
912
__pyx_v_k = __pyx_t_4;
914
__Pyx_DECREF(__pyx_v_v);
915
__pyx_v_v = __pyx_t_5;
919
/* "iocpsupport.pyx":126
921
* for k, v in kw.items():
922
* setattr(self, k, v) # <<<<<<<<<<<<<<
924
* cdef class CompletionPort:
926
__pyx_t_2 = __pyx_v_self;
927
__Pyx_INCREF(__pyx_t_2);
928
__pyx_t_7 = PyObject_SetAttr(__pyx_t_2, __pyx_v_k, __pyx_v_v); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
929
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
931
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
933
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
936
__Pyx_XDECREF(__pyx_t_2);
937
__Pyx_XDECREF(__pyx_t_3);
938
__Pyx_XDECREF(__pyx_t_4);
939
__Pyx_XDECREF(__pyx_t_5);
940
__Pyx_XDECREF(__pyx_t_6);
941
__Pyx_AddTraceback("iocpsupport.Event.__init__");
944
__Pyx_DECREF(__pyx_v_kw);
945
__Pyx_DECREF(__pyx_v_k);
946
__Pyx_DECREF(__pyx_v_v);
947
__Pyx_XGIVEREF(__pyx_r);
948
__Pyx_RefNannyFinishContext();
952
/* "iocpsupport.pyx":130
953
* cdef class CompletionPort:
955
* def __init__(self): # <<<<<<<<<<<<<<
957
* res = CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0)
960
static int __pyx_pf_11iocpsupport_14CompletionPort___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
961
static int __pyx_pf_11iocpsupport_14CompletionPort___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
962
__pyx_t_11iocpsupport_HANDLE __pyx_v_res;
966
PyObject *__pyx_t_3 = NULL;
967
__Pyx_RefNannySetupContext("__init__");
968
if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
969
__Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
970
if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
972
/* "iocpsupport.pyx":132
973
* def __init__(self):
975
* res = CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0) # <<<<<<<<<<<<<<
977
* raise_error(0, 'CreateIoCompletionPort')
979
__pyx_v_res = CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0);
981
/* "iocpsupport.pyx":133
983
* res = CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0)
984
* if not res: # <<<<<<<<<<<<<<
985
* raise_error(0, 'CreateIoCompletionPort')
988
__pyx_t_1 = (!__pyx_v_res);
991
/* "iocpsupport.pyx":134
992
* res = CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0)
994
* raise_error(0, 'CreateIoCompletionPort') # <<<<<<<<<<<<<<
999
__pyx_t_3 = ((PyObject *)__pyx_n_s_1);
1000
__Pyx_INCREF(__pyx_t_3);
1001
__pyx_f_11iocpsupport_raise_error(__pyx_t_2, __pyx_t_3); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1002
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1007
/* "iocpsupport.pyx":135
1009
* raise_error(0, 'CreateIoCompletionPort')
1010
* self.port = res # <<<<<<<<<<<<<<
1012
* def addHandle(self, long handle, long key=0):
1014
((struct __pyx_obj_11iocpsupport_CompletionPort *)__pyx_v_self)->port = __pyx_v_res;
1019
__Pyx_XDECREF(__pyx_t_3);
1020
__Pyx_AddTraceback("iocpsupport.CompletionPort.__init__");
1023
__Pyx_RefNannyFinishContext();
1027
/* "iocpsupport.pyx":137
1030
* def addHandle(self, long handle, long key=0): # <<<<<<<<<<<<<<
1032
* res = CreateIoCompletionPort(handle, self.port, key, 0)
1035
static PyObject *__pyx_pf_11iocpsupport_14CompletionPort_1addHandle(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1036
static PyObject *__pyx_pf_11iocpsupport_14CompletionPort_1addHandle(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1037
long __pyx_v_handle;
1039
__pyx_t_11iocpsupport_HANDLE __pyx_v_res;
1040
PyObject *__pyx_r = NULL;
1043
PyObject *__pyx_t_3 = NULL;
1044
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__handle,&__pyx_n_s__key,0};
1045
__Pyx_RefNannySetupContext("addHandle");
1046
if (unlikely(__pyx_kwds)) {
1047
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
1048
PyObject* values[2] = {0,0};
1049
switch (PyTuple_GET_SIZE(__pyx_args)) {
1050
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1051
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1053
default: goto __pyx_L5_argtuple_error;
1055
switch (PyTuple_GET_SIZE(__pyx_args)) {
1057
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__handle);
1058
if (likely(values[0])) kw_args--;
1059
else goto __pyx_L5_argtuple_error;
1062
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key);
1063
if (value) { values[1] = value; kw_args--; }
1066
if (unlikely(kw_args > 0)) {
1067
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "addHandle") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1069
__pyx_v_handle = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_handle == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1071
__pyx_v_key = __Pyx_PyInt_AsLong(values[1]); if (unlikely((__pyx_v_key == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1073
__pyx_v_key = ((long)0);
1076
__pyx_v_key = ((long)0);
1077
switch (PyTuple_GET_SIZE(__pyx_args)) {
1078
case 2: __pyx_v_key = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_key == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1079
case 1: __pyx_v_handle = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_handle == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1081
default: goto __pyx_L5_argtuple_error;
1084
goto __pyx_L4_argument_unpacking_done;
1085
__pyx_L5_argtuple_error:;
1086
__Pyx_RaiseArgtupleInvalid("addHandle", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1088
__Pyx_AddTraceback("iocpsupport.CompletionPort.addHandle");
1089
__Pyx_RefNannyFinishContext();
1091
__pyx_L4_argument_unpacking_done:;
1093
/* "iocpsupport.pyx":139
1094
* def addHandle(self, long handle, long key=0):
1096
* res = CreateIoCompletionPort(handle, self.port, key, 0) # <<<<<<<<<<<<<<
1098
* raise_error(0, 'CreateIoCompletionPort')
1100
__pyx_v_res = CreateIoCompletionPort(__pyx_v_handle, ((struct __pyx_obj_11iocpsupport_CompletionPort *)__pyx_v_self)->port, __pyx_v_key, 0);
1102
/* "iocpsupport.pyx":140
1104
* res = CreateIoCompletionPort(handle, self.port, key, 0)
1105
* if not res: # <<<<<<<<<<<<<<
1106
* raise_error(0, 'CreateIoCompletionPort')
1109
__pyx_t_1 = (!__pyx_v_res);
1112
/* "iocpsupport.pyx":141
1113
* res = CreateIoCompletionPort(handle, self.port, key, 0)
1115
* raise_error(0, 'CreateIoCompletionPort') # <<<<<<<<<<<<<<
1117
* def getEvent(self, long timeout):
1120
__pyx_t_3 = ((PyObject *)__pyx_n_s_1);
1121
__Pyx_INCREF(__pyx_t_3);
1122
__pyx_f_11iocpsupport_raise_error(__pyx_t_2, __pyx_t_3); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1123
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1128
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
1131
__Pyx_XDECREF(__pyx_t_3);
1132
__Pyx_AddTraceback("iocpsupport.CompletionPort.addHandle");
1135
__Pyx_XGIVEREF(__pyx_r);
1136
__Pyx_RefNannyFinishContext();
1140
/* "iocpsupport.pyx":143
1141
* raise_error(0, 'CreateIoCompletionPort')
1143
* def getEvent(self, long timeout): # <<<<<<<<<<<<<<
1144
* cdef PyThreadState *_save
1145
* cdef unsigned long bytes, key, rc
1148
static PyObject *__pyx_pf_11iocpsupport_14CompletionPort_2getEvent(PyObject *__pyx_v_self, PyObject *__pyx_arg_timeout); /*proto*/
1149
static PyObject *__pyx_pf_11iocpsupport_14CompletionPort_2getEvent(PyObject *__pyx_v_self, PyObject *__pyx_arg_timeout) {
1150
long __pyx_v_timeout;
1151
struct PyThreadState *__pyx_v__save;
1152
unsigned long __pyx_v_bytes;
1153
unsigned long __pyx_v_key;
1154
unsigned long __pyx_v_rc;
1155
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov;
1156
PyObject *__pyx_v_obj;
1157
PyObject *__pyx_r = NULL;
1159
PyObject *__pyx_t_2 = NULL;
1160
PyObject *__pyx_t_3 = NULL;
1161
PyObject *__pyx_t_4 = NULL;
1162
PyObject *__pyx_t_5 = NULL;
1163
__Pyx_RefNannySetupContext("getEvent");
1164
assert(__pyx_arg_timeout); {
1165
__pyx_v_timeout = __Pyx_PyInt_AsLong(__pyx_arg_timeout); if (unlikely((__pyx_v_timeout == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1167
goto __pyx_L4_argument_unpacking_done;
1169
__Pyx_AddTraceback("iocpsupport.CompletionPort.getEvent");
1170
__Pyx_RefNannyFinishContext();
1172
__pyx_L4_argument_unpacking_done:;
1173
__pyx_v_obj = Py_None; __Pyx_INCREF(Py_None);
1175
/* "iocpsupport.pyx":148
1176
* cdef myOVERLAPPED *ov
1178
* _save = PyEval_SaveThread() # <<<<<<<<<<<<<<
1179
* rc = GetQueuedCompletionStatus(self.port, &bytes, &key, <OVERLAPPED **>&ov, timeout)
1180
* PyEval_RestoreThread(_save)
1182
__pyx_v__save = PyEval_SaveThread();
1184
/* "iocpsupport.pyx":149
1186
* _save = PyEval_SaveThread()
1187
* rc = GetQueuedCompletionStatus(self.port, &bytes, &key, <OVERLAPPED **>&ov, timeout) # <<<<<<<<<<<<<<
1188
* PyEval_RestoreThread(_save)
1191
__pyx_v_rc = GetQueuedCompletionStatus(((struct __pyx_obj_11iocpsupport_CompletionPort *)__pyx_v_self)->port, (&__pyx_v_bytes), (&__pyx_v_key), ((OVERLAPPED **)(&__pyx_v_ov)), __pyx_v_timeout);
1193
/* "iocpsupport.pyx":150
1194
* _save = PyEval_SaveThread()
1195
* rc = GetQueuedCompletionStatus(self.port, &bytes, &key, <OVERLAPPED **>&ov, timeout)
1196
* PyEval_RestoreThread(_save) # <<<<<<<<<<<<<<
1200
PyEval_RestoreThread(__pyx_v__save);
1202
/* "iocpsupport.pyx":152
1203
* PyEval_RestoreThread(_save)
1205
* if not rc: # <<<<<<<<<<<<<<
1206
* rc = GetLastError()
1209
__pyx_t_1 = (!__pyx_v_rc);
1212
/* "iocpsupport.pyx":153
1215
* rc = GetLastError() # <<<<<<<<<<<<<<
1219
__pyx_v_rc = GetLastError();
1224
/* "iocpsupport.pyx":155
1225
* rc = GetLastError()
1227
* rc = 0 # <<<<<<<<<<<<<<
1235
/* "iocpsupport.pyx":157
1238
* obj = None # <<<<<<<<<<<<<<
1242
__Pyx_INCREF(Py_None);
1243
__Pyx_DECREF(__pyx_v_obj);
1244
__pyx_v_obj = Py_None;
1246
/* "iocpsupport.pyx":158
1249
* if ov: # <<<<<<<<<<<<<<
1251
* obj = <object>ov.obj
1253
__pyx_t_1 = (__pyx_v_ov != 0);
1256
/* "iocpsupport.pyx":159
1259
* if ov.obj: # <<<<<<<<<<<<<<
1260
* obj = <object>ov.obj
1261
* Py_DECREF(obj) # we are stealing a reference here
1263
__pyx_t_1 = (__pyx_v_ov->obj != 0);
1266
/* "iocpsupport.pyx":160
1269
* obj = <object>ov.obj # <<<<<<<<<<<<<<
1270
* Py_DECREF(obj) # we are stealing a reference here
1273
__Pyx_INCREF(((PyObject *)__pyx_v_ov->obj));
1274
__Pyx_DECREF(__pyx_v_obj);
1275
__pyx_v_obj = ((PyObject *)__pyx_v_ov->obj);
1277
/* "iocpsupport.pyx":161
1279
* obj = <object>ov.obj
1280
* Py_DECREF(obj) # we are stealing a reference here # <<<<<<<<<<<<<<
1284
Py_DECREF(__pyx_v_obj);
1289
/* "iocpsupport.pyx":162
1290
* obj = <object>ov.obj
1291
* Py_DECREF(obj) # we are stealing a reference here
1292
* PyMem_Free(ov) # <<<<<<<<<<<<<<
1294
* return (rc, bytes, key, obj)
1296
PyMem_Free(__pyx_v_ov);
1301
/* "iocpsupport.pyx":164
1304
* return (rc, bytes, key, obj) # <<<<<<<<<<<<<<
1306
* def postEvent(self, unsigned long bytes, unsigned long key, obj):
1308
__Pyx_XDECREF(__pyx_r);
1309
__pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_rc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1310
__Pyx_GOTREF(__pyx_t_2);
1311
__pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_bytes); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1312
__Pyx_GOTREF(__pyx_t_3);
1313
__pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_key); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1314
__Pyx_GOTREF(__pyx_t_4);
1315
__pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1316
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
1317
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
1318
__Pyx_GIVEREF(__pyx_t_2);
1319
PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
1320
__Pyx_GIVEREF(__pyx_t_3);
1321
PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
1322
__Pyx_GIVEREF(__pyx_t_4);
1323
__Pyx_INCREF(__pyx_v_obj);
1324
PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_obj);
1325
__Pyx_GIVEREF(__pyx_v_obj);
1329
__pyx_r = ((PyObject *)__pyx_t_5);
1333
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
1336
__Pyx_XDECREF(__pyx_t_2);
1337
__Pyx_XDECREF(__pyx_t_3);
1338
__Pyx_XDECREF(__pyx_t_4);
1339
__Pyx_XDECREF(__pyx_t_5);
1340
__Pyx_AddTraceback("iocpsupport.CompletionPort.getEvent");
1343
__Pyx_DECREF(__pyx_v_obj);
1344
__Pyx_XGIVEREF(__pyx_r);
1345
__Pyx_RefNannyFinishContext();
1349
/* "iocpsupport.pyx":166
1350
* return (rc, bytes, key, obj)
1352
* def postEvent(self, unsigned long bytes, unsigned long key, obj): # <<<<<<<<<<<<<<
1353
* cdef myOVERLAPPED *ov
1354
* cdef unsigned long rc
1357
static PyObject *__pyx_pf_11iocpsupport_14CompletionPort_3postEvent(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1358
static PyObject *__pyx_pf_11iocpsupport_14CompletionPort_3postEvent(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1359
unsigned long __pyx_v_bytes;
1360
unsigned long __pyx_v_key;
1361
PyObject *__pyx_v_obj = 0;
1362
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov;
1363
unsigned long __pyx_v_rc;
1364
PyObject *__pyx_r = NULL;
1366
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_t_2;
1367
PyObject *__pyx_t_3 = NULL;
1369
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__bytes,&__pyx_n_s__key,&__pyx_n_s__obj,0};
1370
__Pyx_RefNannySetupContext("postEvent");
1371
if (unlikely(__pyx_kwds)) {
1372
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
1373
PyObject* values[3] = {0,0,0};
1374
switch (PyTuple_GET_SIZE(__pyx_args)) {
1375
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1376
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1377
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1379
default: goto __pyx_L5_argtuple_error;
1381
switch (PyTuple_GET_SIZE(__pyx_args)) {
1383
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bytes);
1384
if (likely(values[0])) kw_args--;
1385
else goto __pyx_L5_argtuple_error;
1387
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key);
1388
if (likely(values[1])) kw_args--;
1390
__Pyx_RaiseArgtupleInvalid("postEvent", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1393
values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__obj);
1394
if (likely(values[2])) kw_args--;
1396
__Pyx_RaiseArgtupleInvalid("postEvent", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1399
if (unlikely(kw_args > 0)) {
1400
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "postEvent") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1402
__pyx_v_bytes = __Pyx_PyInt_AsUnsignedLong(values[0]); if (unlikely((__pyx_v_bytes == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1403
__pyx_v_key = __Pyx_PyInt_AsUnsignedLong(values[1]); if (unlikely((__pyx_v_key == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1404
__pyx_v_obj = values[2];
1405
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
1406
goto __pyx_L5_argtuple_error;
1408
__pyx_v_bytes = __Pyx_PyInt_AsUnsignedLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_bytes == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1409
__pyx_v_key = __Pyx_PyInt_AsUnsignedLong(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_key == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1410
__pyx_v_obj = PyTuple_GET_ITEM(__pyx_args, 2);
1412
goto __pyx_L4_argument_unpacking_done;
1413
__pyx_L5_argtuple_error:;
1414
__Pyx_RaiseArgtupleInvalid("postEvent", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1416
__Pyx_AddTraceback("iocpsupport.CompletionPort.postEvent");
1417
__Pyx_RefNannyFinishContext();
1419
__pyx_L4_argument_unpacking_done:;
1421
/* "iocpsupport.pyx":170
1422
* cdef unsigned long rc
1424
* if obj is not None: # <<<<<<<<<<<<<<
1426
* Py_INCREF(obj) # give ov its own reference to obj
1428
__pyx_t_1 = (__pyx_v_obj != Py_None);
1431
/* "iocpsupport.pyx":171
1433
* if obj is not None:
1434
* ov = makeOV() # <<<<<<<<<<<<<<
1435
* Py_INCREF(obj) # give ov its own reference to obj
1436
* ov.obj = <PyObject *>obj
1438
__pyx_t_2 = __pyx_f_11iocpsupport_makeOV(); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1439
__pyx_v_ov = __pyx_t_2;
1441
/* "iocpsupport.pyx":172
1442
* if obj is not None:
1444
* Py_INCREF(obj) # give ov its own reference to obj # <<<<<<<<<<<<<<
1445
* ov.obj = <PyObject *>obj
1448
__pyx_t_3 = __pyx_v_obj;
1449
__Pyx_INCREF(__pyx_t_3);
1450
Py_INCREF(__pyx_t_3);
1451
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1453
/* "iocpsupport.pyx":173
1455
* Py_INCREF(obj) # give ov its own reference to obj
1456
* ov.obj = <PyObject *>obj # <<<<<<<<<<<<<<
1460
__pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj);
1465
/* "iocpsupport.pyx":175
1466
* ov.obj = <PyObject *>obj
1468
* ov = NULL # <<<<<<<<<<<<<<
1470
* rc = PostQueuedCompletionStatus(self.port, bytes, key, <OVERLAPPED *>ov)
1476
/* "iocpsupport.pyx":177
1479
* rc = PostQueuedCompletionStatus(self.port, bytes, key, <OVERLAPPED *>ov) # <<<<<<<<<<<<<<
1481
* raise_error(0, 'PostQueuedCompletionStatus')
1483
__pyx_v_rc = PostQueuedCompletionStatus(((struct __pyx_obj_11iocpsupport_CompletionPort *)__pyx_v_self)->port, __pyx_v_bytes, __pyx_v_key, ((OVERLAPPED *)__pyx_v_ov));
1485
/* "iocpsupport.pyx":178
1487
* rc = PostQueuedCompletionStatus(self.port, bytes, key, <OVERLAPPED *>ov)
1488
* if not rc: # <<<<<<<<<<<<<<
1489
* raise_error(0, 'PostQueuedCompletionStatus')
1492
__pyx_t_1 = (!__pyx_v_rc);
1495
/* "iocpsupport.pyx":179
1496
* rc = PostQueuedCompletionStatus(self.port, bytes, key, <OVERLAPPED *>ov)
1498
* raise_error(0, 'PostQueuedCompletionStatus') # <<<<<<<<<<<<<<
1500
* def __del__(self):
1503
__pyx_t_3 = ((PyObject *)__pyx_n_s_2);
1504
__Pyx_INCREF(__pyx_t_3);
1505
__pyx_f_11iocpsupport_raise_error(__pyx_t_4, __pyx_t_3); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1506
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1511
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
1514
__Pyx_XDECREF(__pyx_t_3);
1515
__Pyx_AddTraceback("iocpsupport.CompletionPort.postEvent");
1518
__Pyx_XGIVEREF(__pyx_r);
1519
__Pyx_RefNannyFinishContext();
1523
/* "iocpsupport.pyx":181
1524
* raise_error(0, 'PostQueuedCompletionStatus')
1526
* def __del__(self): # <<<<<<<<<<<<<<
1527
* CloseHandle(self.port)
1531
static PyObject *__pyx_pf_11iocpsupport_14CompletionPort_4__del__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
1532
static PyObject *__pyx_pf_11iocpsupport_14CompletionPort_4__del__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
1533
PyObject *__pyx_r = NULL;
1534
__Pyx_RefNannySetupContext("__del__");
1536
/* "iocpsupport.pyx":182
1538
* def __del__(self):
1539
* CloseHandle(self.port) # <<<<<<<<<<<<<<
1541
* def makesockaddr(object buff):
1543
CloseHandle(((struct __pyx_obj_11iocpsupport_CompletionPort *)__pyx_v_self)->port);
1545
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
1546
__Pyx_XGIVEREF(__pyx_r);
1547
__Pyx_RefNannyFinishContext();
1551
/* "iocpsupport.pyx":184
1552
* CloseHandle(self.port)
1554
* def makesockaddr(object buff): # <<<<<<<<<<<<<<
1555
* cdef void *mem_buffer
1559
static PyObject *__pyx_pf_11iocpsupport_makesockaddr(PyObject *__pyx_self, PyObject *__pyx_v_buff); /*proto*/
1560
static PyMethodDef __pyx_mdef_11iocpsupport_makesockaddr = {__Pyx_NAMESTR("makesockaddr"), (PyCFunction)__pyx_pf_11iocpsupport_makesockaddr, METH_O, __Pyx_DOCSTR(0)};
1561
static PyObject *__pyx_pf_11iocpsupport_makesockaddr(PyObject *__pyx_self, PyObject *__pyx_v_buff) {
1562
void *__pyx_v_mem_buffer;
1564
PyObject *__pyx_r = NULL;
1565
PyObject *__pyx_t_1 = NULL;
1567
__Pyx_RefNannySetupContext("makesockaddr");
1568
__pyx_self = __pyx_self;
1570
/* "iocpsupport.pyx":188
1573
* PyObject_AsReadBuffer(buff, &mem_buffer, &size) # <<<<<<<<<<<<<<
1574
* # XXX: this should really return the address family as well
1575
* return _makesockaddr(<sockaddr *>mem_buffer, size)
1577
__pyx_t_1 = __pyx_v_buff;
1578
__Pyx_INCREF(__pyx_t_1);
1579
__pyx_t_2 = PyObject_AsReadBuffer(__pyx_t_1, (&__pyx_v_mem_buffer), (&__pyx_v_size)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1580
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1582
/* "iocpsupport.pyx":190
1583
* PyObject_AsReadBuffer(buff, &mem_buffer, &size)
1584
* # XXX: this should really return the address family as well
1585
* return _makesockaddr(<sockaddr *>mem_buffer, size) # <<<<<<<<<<<<<<
1587
* cdef object _makesockaddr(sockaddr *addr, int len):
1589
__Pyx_XDECREF(__pyx_r);
1590
__pyx_t_1 = __pyx_f_11iocpsupport__makesockaddr(((struct sockaddr *)__pyx_v_mem_buffer), __pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1591
__Pyx_GOTREF(__pyx_t_1);
1592
__pyx_r = __pyx_t_1;
1596
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
1599
__Pyx_XDECREF(__pyx_t_1);
1600
__Pyx_AddTraceback("iocpsupport.makesockaddr");
1603
__Pyx_XGIVEREF(__pyx_r);
1604
__Pyx_RefNannyFinishContext();
1608
/* "iocpsupport.pyx":192
1609
* return _makesockaddr(<sockaddr *>mem_buffer, size)
1611
* cdef object _makesockaddr(sockaddr *addr, int len): # <<<<<<<<<<<<<<
1612
* cdef sockaddr_in *sin
1616
static PyObject *__pyx_f_11iocpsupport__makesockaddr(struct sockaddr *__pyx_v_addr, int __pyx_v_len) {
1617
struct sockaddr_in *__pyx_v_sin;
1618
PyObject *__pyx_r = NULL;
1620
PyObject *__pyx_t_2 = NULL;
1621
PyObject *__pyx_t_3 = NULL;
1622
PyObject *__pyx_t_4 = NULL;
1623
__Pyx_RefNannySetupContext("_makesockaddr");
1625
/* "iocpsupport.pyx":194
1626
* cdef object _makesockaddr(sockaddr *addr, int len):
1627
* cdef sockaddr_in *sin
1628
* if not len: # <<<<<<<<<<<<<<
1630
* if addr.sa_family == AF_INET:
1632
__pyx_t_1 = (!__pyx_v_len);
1635
/* "iocpsupport.pyx":195
1636
* cdef sockaddr_in *sin
1638
* return None # <<<<<<<<<<<<<<
1639
* if addr.sa_family == AF_INET:
1640
* sin = <sockaddr_in *>addr
1642
__Pyx_XDECREF(__pyx_r);
1643
__Pyx_INCREF(Py_None);
1650
/* "iocpsupport.pyx":196
1653
* if addr.sa_family == AF_INET: # <<<<<<<<<<<<<<
1654
* sin = <sockaddr_in *>addr
1655
* return PyString_FromString(inet_ntoa(sin.sin_addr)), ntohs(sin.sin_port)
1657
__pyx_t_1 = (__pyx_v_addr->sa_family == AF_INET);
1660
/* "iocpsupport.pyx":197
1662
* if addr.sa_family == AF_INET:
1663
* sin = <sockaddr_in *>addr # <<<<<<<<<<<<<<
1664
* return PyString_FromString(inet_ntoa(sin.sin_addr)), ntohs(sin.sin_port)
1667
__pyx_v_sin = ((struct sockaddr_in *)__pyx_v_addr);
1669
/* "iocpsupport.pyx":198
1670
* if addr.sa_family == AF_INET:
1671
* sin = <sockaddr_in *>addr
1672
* return PyString_FromString(inet_ntoa(sin.sin_addr)), ntohs(sin.sin_port) # <<<<<<<<<<<<<<
1674
* return PyString_FromStringAndSize(addr.sa_data, sizeof(addr.sa_data))
1676
__Pyx_XDECREF(__pyx_r);
1677
__pyx_t_2 = PyString_FromString(inet_ntoa(__pyx_v_sin->sin_addr)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1678
__Pyx_GOTREF(__pyx_t_2);
1679
__pyx_t_3 = PyInt_FromLong(ntohs(__pyx_v_sin->sin_port)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1680
__Pyx_GOTREF(__pyx_t_3);
1681
__pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1682
__Pyx_GOTREF(((PyObject *)__pyx_t_4));
1683
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
1684
__Pyx_GIVEREF(__pyx_t_2);
1685
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
1686
__Pyx_GIVEREF(__pyx_t_3);
1689
__pyx_r = ((PyObject *)__pyx_t_4);
1696
/* "iocpsupport.pyx":200
1697
* return PyString_FromString(inet_ntoa(sin.sin_addr)), ntohs(sin.sin_port)
1699
* return PyString_FromStringAndSize(addr.sa_data, sizeof(addr.sa_data)) # <<<<<<<<<<<<<<
1701
* cdef object fillinetaddr(sockaddr_in *dest, object addr):
1703
__Pyx_XDECREF(__pyx_r);
1704
__pyx_t_4 = PyString_FromStringAndSize(__pyx_v_addr->sa_data, (sizeof(__pyx_v_addr->sa_data))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1705
__Pyx_GOTREF(__pyx_t_4);
1706
__pyx_r = __pyx_t_4;
1712
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
1715
__Pyx_XDECREF(__pyx_t_2);
1716
__Pyx_XDECREF(__pyx_t_3);
1717
__Pyx_XDECREF(__pyx_t_4);
1718
__Pyx_AddTraceback("iocpsupport._makesockaddr");
1721
__Pyx_XGIVEREF(__pyx_r);
1722
__Pyx_RefNannyFinishContext();
1726
/* "iocpsupport.pyx":202
1727
* return PyString_FromStringAndSize(addr.sa_data, sizeof(addr.sa_data))
1729
* cdef object fillinetaddr(sockaddr_in *dest, object addr): # <<<<<<<<<<<<<<
1730
* cdef unsigned short port
1731
* cdef unsigned long res
1734
static PyObject *__pyx_f_11iocpsupport_fillinetaddr(struct sockaddr_in *__pyx_v_dest, PyObject *__pyx_v_addr) {
1735
unsigned short __pyx_v_port;
1736
unsigned long __pyx_v_res;
1737
char *__pyx_v_hoststr;
1738
PyObject *__pyx_v_host;
1739
PyObject *__pyx_r = NULL;
1740
PyObject *__pyx_t_1 = NULL;
1741
PyObject *__pyx_t_2 = NULL;
1742
unsigned short __pyx_t_3;
1743
PyObject *__pyx_t_4 = NULL;
1746
__Pyx_RefNannySetupContext("fillinetaddr");
1747
__pyx_v_host = Py_None; __Pyx_INCREF(Py_None);
1749
/* "iocpsupport.pyx":206
1750
* cdef unsigned long res
1751
* cdef char *hoststr
1752
* host, port = addr # <<<<<<<<<<<<<<
1754
* hoststr = PyString_AsString(host)
1756
if (PyTuple_CheckExact(__pyx_v_addr) && likely(PyTuple_GET_SIZE(__pyx_v_addr) == 2)) {
1757
PyObject* tuple = __pyx_v_addr;
1758
__pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1);
1759
__pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_2);
1760
__pyx_t_3 = __Pyx_PyInt_AsUnsignedShort(__pyx_t_2); if (unlikely((__pyx_t_3 == (unsigned short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1761
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1762
__Pyx_DECREF(__pyx_v_host);
1763
__pyx_v_host = __pyx_t_1;
1765
__pyx_v_port = __pyx_t_3;
1767
__pyx_t_4 = PyObject_GetIter(__pyx_v_addr); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1768
__Pyx_GOTREF(__pyx_t_4);
1769
__pyx_t_1 = __Pyx_UnpackItem(__pyx_t_4, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1770
__Pyx_GOTREF(__pyx_t_1);
1771
__pyx_t_2 = __Pyx_UnpackItem(__pyx_t_4, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1772
__Pyx_GOTREF(__pyx_t_2);
1773
__pyx_t_3 = __Pyx_PyInt_AsUnsignedShort(__pyx_t_2); if (unlikely((__pyx_t_3 == (unsigned short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1774
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1775
if (__Pyx_EndUnpack(__pyx_t_4, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1776
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1777
__Pyx_DECREF(__pyx_v_host);
1778
__pyx_v_host = __pyx_t_1;
1780
__pyx_v_port = __pyx_t_3;
1783
/* "iocpsupport.pyx":208
1786
* hoststr = PyString_AsString(host) # <<<<<<<<<<<<<<
1787
* res = inet_addr(hoststr)
1788
* if res == INADDR_ANY:
1790
__pyx_t_5 = PyString_AsString(__pyx_v_host); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1791
__pyx_v_hoststr = __pyx_t_5;
1793
/* "iocpsupport.pyx":209
1795
* hoststr = PyString_AsString(host)
1796
* res = inet_addr(hoststr) # <<<<<<<<<<<<<<
1797
* if res == INADDR_ANY:
1798
* raise ValueError, 'invalid IP address'
1800
__pyx_v_res = inet_addr(__pyx_v_hoststr);
1802
/* "iocpsupport.pyx":210
1803
* hoststr = PyString_AsString(host)
1804
* res = inet_addr(hoststr)
1805
* if res == INADDR_ANY: # <<<<<<<<<<<<<<
1806
* raise ValueError, 'invalid IP address'
1807
* dest.sin_addr.s_addr = res
1809
__pyx_t_6 = (__pyx_v_res == INADDR_ANY);
1812
/* "iocpsupport.pyx":211
1813
* res = inet_addr(hoststr)
1814
* if res == INADDR_ANY:
1815
* raise ValueError, 'invalid IP address' # <<<<<<<<<<<<<<
1816
* dest.sin_addr.s_addr = res
1819
__Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_3), 0);
1820
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1825
/* "iocpsupport.pyx":212
1826
* if res == INADDR_ANY:
1827
* raise ValueError, 'invalid IP address'
1828
* dest.sin_addr.s_addr = res # <<<<<<<<<<<<<<
1830
* dest.sin_port = htons(port)
1832
__pyx_v_dest->sin_addr.s_addr = __pyx_v_res;
1834
/* "iocpsupport.pyx":214
1835
* dest.sin_addr.s_addr = res
1837
* dest.sin_port = htons(port) # <<<<<<<<<<<<<<
1839
* def AllocateReadBuffer(int size):
1841
__pyx_v_dest->sin_port = htons(__pyx_v_port);
1843
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
1846
__Pyx_XDECREF(__pyx_t_1);
1847
__Pyx_XDECREF(__pyx_t_2);
1848
__Pyx_XDECREF(__pyx_t_4);
1849
__Pyx_AddTraceback("iocpsupport.fillinetaddr");
1852
__Pyx_DECREF(__pyx_v_host);
1853
__Pyx_XGIVEREF(__pyx_r);
1854
__Pyx_RefNannyFinishContext();
1858
/* "iocpsupport.pyx":216
1859
* dest.sin_port = htons(port)
1861
* def AllocateReadBuffer(int size): # <<<<<<<<<<<<<<
1862
* return PyBuffer_New(size)
1866
static PyObject *__pyx_pf_11iocpsupport_1AllocateReadBuffer(PyObject *__pyx_self, PyObject *__pyx_arg_size); /*proto*/
1867
static PyMethodDef __pyx_mdef_11iocpsupport_1AllocateReadBuffer = {__Pyx_NAMESTR("AllocateReadBuffer"), (PyCFunction)__pyx_pf_11iocpsupport_1AllocateReadBuffer, METH_O, __Pyx_DOCSTR(0)};
1868
static PyObject *__pyx_pf_11iocpsupport_1AllocateReadBuffer(PyObject *__pyx_self, PyObject *__pyx_arg_size) {
1870
PyObject *__pyx_r = NULL;
1871
PyObject *__pyx_t_1 = NULL;
1872
__Pyx_RefNannySetupContext("AllocateReadBuffer");
1873
__pyx_self = __pyx_self;
1874
assert(__pyx_arg_size); {
1875
__pyx_v_size = __Pyx_PyInt_AsInt(__pyx_arg_size); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1877
goto __pyx_L4_argument_unpacking_done;
1879
__Pyx_AddTraceback("iocpsupport.AllocateReadBuffer");
1880
__Pyx_RefNannyFinishContext();
1882
__pyx_L4_argument_unpacking_done:;
1884
/* "iocpsupport.pyx":217
1886
* def AllocateReadBuffer(int size):
1887
* return PyBuffer_New(size) # <<<<<<<<<<<<<<
1889
* def maxAddrLen(long s):
1891
__Pyx_XDECREF(__pyx_r);
1892
__pyx_t_1 = PyBuffer_New(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1893
__Pyx_GOTREF(__pyx_t_1);
1894
__pyx_r = __pyx_t_1;
1898
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
1901
__Pyx_XDECREF(__pyx_t_1);
1902
__Pyx_AddTraceback("iocpsupport.AllocateReadBuffer");
1905
__Pyx_XGIVEREF(__pyx_r);
1906
__Pyx_RefNannyFinishContext();
1910
/* "iocpsupport.pyx":219
1911
* return PyBuffer_New(size)
1913
* def maxAddrLen(long s): # <<<<<<<<<<<<<<
1914
* cdef WSAPROTOCOL_INFO wsa_pi
1918
static PyObject *__pyx_pf_11iocpsupport_2maxAddrLen(PyObject *__pyx_self, PyObject *__pyx_arg_s); /*proto*/
1919
static PyMethodDef __pyx_mdef_11iocpsupport_2maxAddrLen = {__Pyx_NAMESTR("maxAddrLen"), (PyCFunction)__pyx_pf_11iocpsupport_2maxAddrLen, METH_O, __Pyx_DOCSTR(0)};
1920
static PyObject *__pyx_pf_11iocpsupport_2maxAddrLen(PyObject *__pyx_self, PyObject *__pyx_arg_s) {
1922
WSAPROTOCOL_INFO __pyx_v_wsa_pi;
1925
PyObject *__pyx_r = NULL;
1928
PyObject *__pyx_t_3 = NULL;
1929
__Pyx_RefNannySetupContext("maxAddrLen");
1930
__pyx_self = __pyx_self;
1931
assert(__pyx_arg_s); {
1932
__pyx_v_s = __Pyx_PyInt_AsLong(__pyx_arg_s); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1934
goto __pyx_L4_argument_unpacking_done;
1936
__Pyx_AddTraceback("iocpsupport.maxAddrLen");
1937
__Pyx_RefNannyFinishContext();
1939
__pyx_L4_argument_unpacking_done:;
1941
/* "iocpsupport.pyx":223
1944
* size = sizeof(wsa_pi) # <<<<<<<<<<<<<<
1945
* rc = getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, <char *>&wsa_pi, &size)
1946
* if rc == SOCKET_ERROR:
1948
__pyx_v_size = (sizeof(__pyx_v_wsa_pi));
1950
/* "iocpsupport.pyx":224
1952
* size = sizeof(wsa_pi)
1953
* rc = getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, <char *>&wsa_pi, &size) # <<<<<<<<<<<<<<
1954
* if rc == SOCKET_ERROR:
1955
* raise_error(WSAGetLastError(), 'getsockopt')
1957
__pyx_v_rc = getsockopt(__pyx_v_s, SOL_SOCKET, SO_PROTOCOL_INFO, ((char *)(&__pyx_v_wsa_pi)), (&__pyx_v_size));
1959
/* "iocpsupport.pyx":225
1960
* size = sizeof(wsa_pi)
1961
* rc = getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, <char *>&wsa_pi, &size)
1962
* if rc == SOCKET_ERROR: # <<<<<<<<<<<<<<
1963
* raise_error(WSAGetLastError(), 'getsockopt')
1964
* return wsa_pi.iMaxSockAddr
1966
__pyx_t_1 = (__pyx_v_rc == SOCKET_ERROR);
1969
/* "iocpsupport.pyx":226
1970
* rc = getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, <char *>&wsa_pi, &size)
1971
* if rc == SOCKET_ERROR:
1972
* raise_error(WSAGetLastError(), 'getsockopt') # <<<<<<<<<<<<<<
1973
* return wsa_pi.iMaxSockAddr
1976
__pyx_t_2 = WSAGetLastError();
1977
__pyx_t_3 = ((PyObject *)__pyx_n_s__getsockopt);
1978
__Pyx_INCREF(__pyx_t_3);
1979
__pyx_f_11iocpsupport_raise_error(__pyx_t_2, __pyx_t_3); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1980
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1985
/* "iocpsupport.pyx":227
1986
* if rc == SOCKET_ERROR:
1987
* raise_error(WSAGetLastError(), 'getsockopt')
1988
* return wsa_pi.iMaxSockAddr # <<<<<<<<<<<<<<
1990
* cdef int getAddrFamily(SOCKET s) except *:
1992
__Pyx_XDECREF(__pyx_r);
1993
__pyx_t_3 = PyInt_FromLong(__pyx_v_wsa_pi.iMaxSockAddr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1994
__Pyx_GOTREF(__pyx_t_3);
1995
__pyx_r = __pyx_t_3;
1999
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
2002
__Pyx_XDECREF(__pyx_t_3);
2003
__Pyx_AddTraceback("iocpsupport.maxAddrLen");
2006
__Pyx_XGIVEREF(__pyx_r);
2007
__Pyx_RefNannyFinishContext();
2011
/* "iocpsupport.pyx":229
2012
* return wsa_pi.iMaxSockAddr
2014
* cdef int getAddrFamily(SOCKET s) except *: # <<<<<<<<<<<<<<
2015
* cdef WSAPROTOCOL_INFO wsa_pi
2019
static int __pyx_f_11iocpsupport_getAddrFamily(__pyx_t_11iocpsupport_SOCKET __pyx_v_s) {
2020
WSAPROTOCOL_INFO __pyx_v_wsa_pi;
2026
PyObject *__pyx_t_3 = NULL;
2027
__Pyx_RefNannySetupContext("getAddrFamily");
2029
/* "iocpsupport.pyx":233
2032
* size = sizeof(wsa_pi) # <<<<<<<<<<<<<<
2033
* rc = getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, <char *>&wsa_pi, &size)
2034
* if rc == SOCKET_ERROR:
2036
__pyx_v_size = (sizeof(__pyx_v_wsa_pi));
2038
/* "iocpsupport.pyx":234
2040
* size = sizeof(wsa_pi)
2041
* rc = getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, <char *>&wsa_pi, &size) # <<<<<<<<<<<<<<
2042
* if rc == SOCKET_ERROR:
2043
* raise_error(WSAGetLastError(), 'getsockopt')
2045
__pyx_v_rc = getsockopt(__pyx_v_s, SOL_SOCKET, SO_PROTOCOL_INFO, ((char *)(&__pyx_v_wsa_pi)), (&__pyx_v_size));
2047
/* "iocpsupport.pyx":235
2048
* size = sizeof(wsa_pi)
2049
* rc = getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, <char *>&wsa_pi, &size)
2050
* if rc == SOCKET_ERROR: # <<<<<<<<<<<<<<
2051
* raise_error(WSAGetLastError(), 'getsockopt')
2052
* return wsa_pi.iAddressFamily
2054
__pyx_t_1 = (__pyx_v_rc == SOCKET_ERROR);
2057
/* "iocpsupport.pyx":236
2058
* rc = getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, <char *>&wsa_pi, &size)
2059
* if rc == SOCKET_ERROR:
2060
* raise_error(WSAGetLastError(), 'getsockopt') # <<<<<<<<<<<<<<
2061
* return wsa_pi.iAddressFamily
2064
__pyx_t_2 = WSAGetLastError();
2065
__pyx_t_3 = ((PyObject *)__pyx_n_s__getsockopt);
2066
__Pyx_INCREF(__pyx_t_3);
2067
__pyx_f_11iocpsupport_raise_error(__pyx_t_2, __pyx_t_3); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2068
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2073
/* "iocpsupport.pyx":237
2074
* if rc == SOCKET_ERROR:
2075
* raise_error(WSAGetLastError(), 'getsockopt')
2076
* return wsa_pi.iAddressFamily # <<<<<<<<<<<<<<
2078
* import socket # for WSAStartup
2080
__pyx_r = __pyx_v_wsa_pi.iAddressFamily;
2086
__Pyx_XDECREF(__pyx_t_3);
2087
__Pyx_AddTraceback("iocpsupport.getAddrFamily");
2090
__Pyx_RefNannyFinishContext();
2094
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":5
2097
* def accept(long listening, long accepting, object buff, object obj): # <<<<<<<<<<<<<<
2099
* CAUTION: unlike system AcceptEx(), this function returns 0 on success
2102
static PyObject *__pyx_pf_11iocpsupport_3accept(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2103
static char __pyx_doc_11iocpsupport_3accept[] = "\n CAUTION: unlike system AcceptEx(), this function returns 0 on success\n ";
2104
static PyMethodDef __pyx_mdef_11iocpsupport_3accept = {__Pyx_NAMESTR("accept"), (PyCFunction)__pyx_pf_11iocpsupport_3accept, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_11iocpsupport_3accept)};
2105
static PyObject *__pyx_pf_11iocpsupport_3accept(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2106
long __pyx_v_listening;
2107
long __pyx_v_accepting;
2108
PyObject *__pyx_v_buff = 0;
2109
PyObject *__pyx_v_obj = 0;
2110
unsigned long __pyx_v_bytes;
2113
void *__pyx_v_mem_buffer;
2114
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov;
2115
PyObject *__pyx_r = NULL;
2116
PyObject *__pyx_t_1 = NULL;
2118
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_t_3;
2120
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__listening,&__pyx_n_s__accepting,&__pyx_n_s__buff,&__pyx_n_s__obj,0};
2121
__Pyx_RefNannySetupContext("accept");
2122
__pyx_self = __pyx_self;
2123
if (unlikely(__pyx_kwds)) {
2124
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
2125
PyObject* values[4] = {0,0,0,0};
2126
switch (PyTuple_GET_SIZE(__pyx_args)) {
2127
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2128
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2129
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2130
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2132
default: goto __pyx_L5_argtuple_error;
2134
switch (PyTuple_GET_SIZE(__pyx_args)) {
2136
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__listening);
2137
if (likely(values[0])) kw_args--;
2138
else goto __pyx_L5_argtuple_error;
2140
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__accepting);
2141
if (likely(values[1])) kw_args--;
2143
__Pyx_RaiseArgtupleInvalid("accept", 1, 4, 4, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2146
values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buff);
2147
if (likely(values[2])) kw_args--;
2149
__Pyx_RaiseArgtupleInvalid("accept", 1, 4, 4, 2); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2152
values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__obj);
2153
if (likely(values[3])) kw_args--;
2155
__Pyx_RaiseArgtupleInvalid("accept", 1, 4, 4, 3); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2158
if (unlikely(kw_args > 0)) {
2159
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "accept") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2161
__pyx_v_listening = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_listening == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2162
__pyx_v_accepting = __Pyx_PyInt_AsLong(values[1]); if (unlikely((__pyx_v_accepting == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2163
__pyx_v_buff = values[2];
2164
__pyx_v_obj = values[3];
2165
} else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
2166
goto __pyx_L5_argtuple_error;
2168
__pyx_v_listening = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_listening == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2169
__pyx_v_accepting = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_accepting == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2170
__pyx_v_buff = PyTuple_GET_ITEM(__pyx_args, 2);
2171
__pyx_v_obj = PyTuple_GET_ITEM(__pyx_args, 3);
2173
goto __pyx_L4_argument_unpacking_done;
2174
__pyx_L5_argtuple_error:;
2175
__Pyx_RaiseArgtupleInvalid("accept", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2177
__Pyx_AddTraceback("iocpsupport.accept");
2178
__Pyx_RefNannyFinishContext();
2180
__pyx_L4_argument_unpacking_done:;
2182
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":14
2183
* cdef myOVERLAPPED *ov
2185
* PyObject_AsWriteBuffer(buff, &mem_buffer, &size) # <<<<<<<<<<<<<<
2189
__pyx_t_1 = __pyx_v_buff;
2190
__Pyx_INCREF(__pyx_t_1);
2191
__pyx_t_2 = PyObject_AsWriteBuffer(__pyx_t_1, (&__pyx_v_mem_buffer), (&__pyx_v_size)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2192
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2194
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":16
2195
* PyObject_AsWriteBuffer(buff, &mem_buffer, &size)
2197
* ov = makeOV() # <<<<<<<<<<<<<<
2198
* if obj is not None:
2199
* ov.obj = <PyObject *>obj
2201
__pyx_t_3 = __pyx_f_11iocpsupport_makeOV(); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2202
__pyx_v_ov = __pyx_t_3;
2204
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":17
2207
* if obj is not None: # <<<<<<<<<<<<<<
2208
* ov.obj = <PyObject *>obj
2211
__pyx_t_4 = (__pyx_v_obj != Py_None);
2214
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":18
2216
* if obj is not None:
2217
* ov.obj = <PyObject *>obj # <<<<<<<<<<<<<<
2219
* rc = lpAcceptEx(listening, accepting, mem_buffer, 0, size / 2, size / 2,
2221
__pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj);
2226
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":21
2228
* rc = lpAcceptEx(listening, accepting, mem_buffer, 0, size / 2, size / 2,
2229
* &bytes, <OVERLAPPED *>ov) # <<<<<<<<<<<<<<
2231
* rc = WSAGetLastError()
2233
__pyx_v_rc = lpAcceptEx(__pyx_v_listening, __pyx_v_accepting, __pyx_v_mem_buffer, 0, __Pyx_div_long(__pyx_v_size, 2), __Pyx_div_long(__pyx_v_size, 2), (&__pyx_v_bytes), ((OVERLAPPED *)__pyx_v_ov));
2235
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":22
2236
* rc = lpAcceptEx(listening, accepting, mem_buffer, 0, size / 2, size / 2,
2237
* &bytes, <OVERLAPPED *>ov)
2238
* if not rc: # <<<<<<<<<<<<<<
2239
* rc = WSAGetLastError()
2240
* if rc != ERROR_IO_PENDING:
2242
__pyx_t_4 = (!__pyx_v_rc);
2245
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":23
2246
* &bytes, <OVERLAPPED *>ov)
2248
* rc = WSAGetLastError() # <<<<<<<<<<<<<<
2249
* if rc != ERROR_IO_PENDING:
2252
__pyx_v_rc = WSAGetLastError();
2254
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":24
2256
* rc = WSAGetLastError()
2257
* if rc != ERROR_IO_PENDING: # <<<<<<<<<<<<<<
2261
__pyx_t_4 = (__pyx_v_rc != ERROR_IO_PENDING);
2264
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":25
2265
* rc = WSAGetLastError()
2266
* if rc != ERROR_IO_PENDING:
2267
* return rc # <<<<<<<<<<<<<<
2269
* # operation is in progress
2271
__Pyx_XDECREF(__pyx_r);
2272
__pyx_t_1 = PyInt_FromLong(__pyx_v_rc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2273
__Pyx_GOTREF(__pyx_t_1);
2274
__pyx_r = __pyx_t_1;
2284
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":28
2286
* # operation is in progress
2287
* Py_XINCREF(obj) # <<<<<<<<<<<<<<
2291
__pyx_t_1 = __pyx_v_obj;
2292
__Pyx_INCREF(__pyx_t_1);
2293
Py_XINCREF(__pyx_t_1);
2294
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2296
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":29
2297
* # operation is in progress
2299
* return 0 # <<<<<<<<<<<<<<
2301
* def get_accept_addrs(long s, object buff):
2303
__Pyx_XDECREF(__pyx_r);
2304
__Pyx_INCREF(__pyx_int_0);
2305
__pyx_r = __pyx_int_0;
2308
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
2311
__Pyx_XDECREF(__pyx_t_1);
2312
__Pyx_AddTraceback("iocpsupport.accept");
2315
__Pyx_XGIVEREF(__pyx_r);
2316
__Pyx_RefNannyFinishContext();
2320
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":31
2323
* def get_accept_addrs(long s, object buff): # <<<<<<<<<<<<<<
2324
* cdef WSAPROTOCOL_INFO wsa_pi
2325
* cdef int size, locallen, remotelen
2328
static PyObject *__pyx_pf_11iocpsupport_4get_accept_addrs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2329
static PyMethodDef __pyx_mdef_11iocpsupport_4get_accept_addrs = {__Pyx_NAMESTR("get_accept_addrs"), (PyCFunction)__pyx_pf_11iocpsupport_4get_accept_addrs, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
2330
static PyObject *__pyx_pf_11iocpsupport_4get_accept_addrs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2332
PyObject *__pyx_v_buff = 0;
2334
int __pyx_v_locallen;
2335
int __pyx_v_remotelen;
2336
void *__pyx_v_mem_buffer;
2337
struct sockaddr *__pyx_v_localaddr;
2338
struct sockaddr *__pyx_v_remoteaddr;
2339
PyObject *__pyx_r = NULL;
2340
PyObject *__pyx_t_1 = NULL;
2342
PyObject *__pyx_t_3 = NULL;
2343
PyObject *__pyx_t_4 = NULL;
2344
PyObject *__pyx_t_5 = NULL;
2345
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__s,&__pyx_n_s__buff,0};
2346
__Pyx_RefNannySetupContext("get_accept_addrs");
2347
__pyx_self = __pyx_self;
2348
if (unlikely(__pyx_kwds)) {
2349
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
2350
PyObject* values[2] = {0,0};
2351
switch (PyTuple_GET_SIZE(__pyx_args)) {
2352
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2353
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2355
default: goto __pyx_L5_argtuple_error;
2357
switch (PyTuple_GET_SIZE(__pyx_args)) {
2359
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__s);
2360
if (likely(values[0])) kw_args--;
2361
else goto __pyx_L5_argtuple_error;
2363
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buff);
2364
if (likely(values[1])) kw_args--;
2366
__Pyx_RaiseArgtupleInvalid("get_accept_addrs", 1, 2, 2, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2369
if (unlikely(kw_args > 0)) {
2370
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "get_accept_addrs") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2372
__pyx_v_s = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2373
__pyx_v_buff = values[1];
2374
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
2375
goto __pyx_L5_argtuple_error;
2377
__pyx_v_s = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2378
__pyx_v_buff = PyTuple_GET_ITEM(__pyx_args, 1);
2380
goto __pyx_L4_argument_unpacking_done;
2381
__pyx_L5_argtuple_error:;
2382
__Pyx_RaiseArgtupleInvalid("get_accept_addrs", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2384
__Pyx_AddTraceback("iocpsupport.get_accept_addrs");
2385
__Pyx_RefNannyFinishContext();
2387
__pyx_L4_argument_unpacking_done:;
2389
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":37
2390
* cdef sockaddr *localaddr, *remoteaddr
2392
* PyObject_AsReadBuffer(buff, &mem_buffer, &size) # <<<<<<<<<<<<<<
2394
* lpGetAcceptExSockaddrs(mem_buffer, 0, size / 2, size / 2, &localaddr, &locallen, &remoteaddr, &remotelen)
2396
__pyx_t_1 = __pyx_v_buff;
2397
__Pyx_INCREF(__pyx_t_1);
2398
__pyx_t_2 = PyObject_AsReadBuffer(__pyx_t_1, (&__pyx_v_mem_buffer), (&__pyx_v_size)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2399
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2401
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":39
2402
* PyObject_AsReadBuffer(buff, &mem_buffer, &size)
2404
* lpGetAcceptExSockaddrs(mem_buffer, 0, size / 2, size / 2, &localaddr, &locallen, &remoteaddr, &remotelen) # <<<<<<<<<<<<<<
2405
* return remoteaddr.sa_family, _makesockaddr(localaddr, locallen), _makesockaddr(remoteaddr, remotelen)
2408
lpGetAcceptExSockaddrs(__pyx_v_mem_buffer, 0, __Pyx_div_long(__pyx_v_size, 2), __Pyx_div_long(__pyx_v_size, 2), (&__pyx_v_localaddr), (&__pyx_v_locallen), (&__pyx_v_remoteaddr), (&__pyx_v_remotelen));
2410
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":40
2412
* lpGetAcceptExSockaddrs(mem_buffer, 0, size / 2, size / 2, &localaddr, &locallen, &remoteaddr, &remotelen)
2413
* return remoteaddr.sa_family, _makesockaddr(localaddr, locallen), _makesockaddr(remoteaddr, remotelen) # <<<<<<<<<<<<<<
2416
__Pyx_XDECREF(__pyx_r);
2417
__pyx_t_1 = PyInt_FromLong(__pyx_v_remoteaddr->sa_family); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2418
__Pyx_GOTREF(__pyx_t_1);
2419
__pyx_t_3 = __pyx_f_11iocpsupport__makesockaddr(__pyx_v_localaddr, __pyx_v_locallen); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2420
__Pyx_GOTREF(__pyx_t_3);
2421
__pyx_t_4 = __pyx_f_11iocpsupport__makesockaddr(__pyx_v_remoteaddr, __pyx_v_remotelen); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2422
__Pyx_GOTREF(__pyx_t_4);
2423
__pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2424
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
2425
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
2426
__Pyx_GIVEREF(__pyx_t_1);
2427
PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
2428
__Pyx_GIVEREF(__pyx_t_3);
2429
PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
2430
__Pyx_GIVEREF(__pyx_t_4);
2434
__pyx_r = ((PyObject *)__pyx_t_5);
2438
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
2441
__Pyx_XDECREF(__pyx_t_1);
2442
__Pyx_XDECREF(__pyx_t_3);
2443
__Pyx_XDECREF(__pyx_t_4);
2444
__Pyx_XDECREF(__pyx_t_5);
2445
__Pyx_AddTraceback("iocpsupport.get_accept_addrs");
2448
__Pyx_XGIVEREF(__pyx_r);
2449
__Pyx_RefNannyFinishContext();
2453
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":5
2456
* def connect(long s, object addr, object obj): # <<<<<<<<<<<<<<
2458
* CAUTION: unlike system ConnectEx(), this function returns 0 on success
2461
static PyObject *__pyx_pf_11iocpsupport_5connect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2462
static char __pyx_doc_11iocpsupport_5connect[] = "\n CAUTION: unlike system ConnectEx(), this function returns 0 on success\n ";
2463
static PyMethodDef __pyx_mdef_11iocpsupport_5connect = {__Pyx_NAMESTR("connect"), (PyCFunction)__pyx_pf_11iocpsupport_5connect, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_11iocpsupport_5connect)};
2464
static PyObject *__pyx_pf_11iocpsupport_5connect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2466
PyObject *__pyx_v_addr = 0;
2467
PyObject *__pyx_v_obj = 0;
2470
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov;
2471
struct sockaddr __pyx_v_name;
2472
PyObject *__pyx_r = NULL;
2473
PyObject *__pyx_t_1 = NULL;
2477
struct sockaddr_in *__pyx_t_5;
2478
PyObject *__pyx_t_6 = NULL;
2479
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_t_7;
2480
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__s,&__pyx_n_s__addr,&__pyx_n_s__obj,0};
2481
__Pyx_RefNannySetupContext("connect");
2482
__pyx_self = __pyx_self;
2483
if (unlikely(__pyx_kwds)) {
2484
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
2485
PyObject* values[3] = {0,0,0};
2486
switch (PyTuple_GET_SIZE(__pyx_args)) {
2487
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2488
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2489
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2491
default: goto __pyx_L5_argtuple_error;
2493
switch (PyTuple_GET_SIZE(__pyx_args)) {
2495
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__s);
2496
if (likely(values[0])) kw_args--;
2497
else goto __pyx_L5_argtuple_error;
2499
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__addr);
2500
if (likely(values[1])) kw_args--;
2502
__Pyx_RaiseArgtupleInvalid("connect", 1, 3, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2505
values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__obj);
2506
if (likely(values[2])) kw_args--;
2508
__Pyx_RaiseArgtupleInvalid("connect", 1, 3, 3, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2511
if (unlikely(kw_args > 0)) {
2512
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "connect") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2514
__pyx_v_s = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2515
__pyx_v_addr = values[1];
2516
__pyx_v_obj = values[2];
2517
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
2518
goto __pyx_L5_argtuple_error;
2520
__pyx_v_s = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2521
__pyx_v_addr = PyTuple_GET_ITEM(__pyx_args, 1);
2522
__pyx_v_obj = PyTuple_GET_ITEM(__pyx_args, 2);
2524
goto __pyx_L4_argument_unpacking_done;
2525
__pyx_L5_argtuple_error:;
2526
__Pyx_RaiseArgtupleInvalid("connect", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2528
__Pyx_AddTraceback("iocpsupport.connect");
2529
__Pyx_RefNannyFinishContext();
2531
__pyx_L4_argument_unpacking_done:;
2533
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":13
2534
* cdef sockaddr name
2536
* if not have_connectex: # <<<<<<<<<<<<<<
2537
* raise ValueError, 'ConnectEx is not available on this system'
2540
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__have_connectex); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2541
__Pyx_GOTREF(__pyx_t_1);
2542
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2543
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2544
__pyx_t_3 = (!__pyx_t_2);
2547
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":14
2549
* if not have_connectex:
2550
* raise ValueError, 'ConnectEx is not available on this system' # <<<<<<<<<<<<<<
2552
* family = getAddrFamily(s)
2554
__Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_4), 0);
2555
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2560
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":16
2561
* raise ValueError, 'ConnectEx is not available on this system'
2563
* family = getAddrFamily(s) # <<<<<<<<<<<<<<
2564
* if family == AF_INET:
2565
* fillinetaddr(<sockaddr_in *>&name, addr)
2567
__pyx_t_4 = __pyx_f_11iocpsupport_getAddrFamily(__pyx_v_s); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2568
__pyx_v_family = __pyx_t_4;
2570
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":17
2572
* family = getAddrFamily(s)
2573
* if family == AF_INET: # <<<<<<<<<<<<<<
2574
* fillinetaddr(<sockaddr_in *>&name, addr)
2577
__pyx_t_3 = (__pyx_v_family == AF_INET);
2580
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":18
2581
* family = getAddrFamily(s)
2582
* if family == AF_INET:
2583
* fillinetaddr(<sockaddr_in *>&name, addr) # <<<<<<<<<<<<<<
2585
* raise ValueError, 'unsupported address family'
2587
__pyx_t_5 = ((struct sockaddr_in *)(&__pyx_v_name));
2588
__pyx_t_1 = __pyx_v_addr;
2589
__Pyx_INCREF(__pyx_t_1);
2590
__pyx_t_6 = __pyx_f_11iocpsupport_fillinetaddr(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2591
__Pyx_GOTREF(__pyx_t_6);
2592
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2593
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2598
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":20
2599
* fillinetaddr(<sockaddr_in *>&name, addr)
2601
* raise ValueError, 'unsupported address family' # <<<<<<<<<<<<<<
2602
* name.sa_family = family
2605
__Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_5), 0);
2606
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2610
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":21
2612
* raise ValueError, 'unsupported address family'
2613
* name.sa_family = family # <<<<<<<<<<<<<<
2617
__pyx_v_name.sa_family = __pyx_v_family;
2619
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":23
2620
* name.sa_family = family
2622
* ov = makeOV() # <<<<<<<<<<<<<<
2623
* if obj is not None:
2624
* ov.obj = <PyObject *>obj
2626
__pyx_t_7 = __pyx_f_11iocpsupport_makeOV(); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2627
__pyx_v_ov = __pyx_t_7;
2629
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":24
2632
* if obj is not None: # <<<<<<<<<<<<<<
2633
* ov.obj = <PyObject *>obj
2636
__pyx_t_3 = (__pyx_v_obj != Py_None);
2639
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":25
2641
* if obj is not None:
2642
* ov.obj = <PyObject *>obj # <<<<<<<<<<<<<<
2644
* rc = lpConnectEx(s, &name, sizeof(name), NULL, 0, NULL, <OVERLAPPED *>ov)
2646
__pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj);
2651
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":27
2652
* ov.obj = <PyObject *>obj
2654
* rc = lpConnectEx(s, &name, sizeof(name), NULL, 0, NULL, <OVERLAPPED *>ov) # <<<<<<<<<<<<<<
2658
__pyx_v_rc = lpConnectEx(__pyx_v_s, (&__pyx_v_name), (sizeof(__pyx_v_name)), NULL, 0, NULL, ((OVERLAPPED *)__pyx_v_ov));
2660
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":29
2661
* rc = lpConnectEx(s, &name, sizeof(name), NULL, 0, NULL, <OVERLAPPED *>ov)
2663
* if not rc: # <<<<<<<<<<<<<<
2664
* rc = WSAGetLastError()
2665
* if rc != ERROR_IO_PENDING:
2667
__pyx_t_3 = (!__pyx_v_rc);
2670
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":30
2673
* rc = WSAGetLastError() # <<<<<<<<<<<<<<
2674
* if rc != ERROR_IO_PENDING:
2677
__pyx_v_rc = WSAGetLastError();
2679
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":31
2681
* rc = WSAGetLastError()
2682
* if rc != ERROR_IO_PENDING: # <<<<<<<<<<<<<<
2686
__pyx_t_3 = (__pyx_v_rc != ERROR_IO_PENDING);
2689
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":32
2690
* rc = WSAGetLastError()
2691
* if rc != ERROR_IO_PENDING:
2692
* return rc # <<<<<<<<<<<<<<
2694
* # operation is in progress
2696
__Pyx_XDECREF(__pyx_r);
2697
__pyx_t_6 = PyInt_FromLong(__pyx_v_rc); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2698
__Pyx_GOTREF(__pyx_t_6);
2699
__pyx_r = __pyx_t_6;
2709
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":35
2711
* # operation is in progress
2712
* Py_XINCREF(obj) # <<<<<<<<<<<<<<
2716
__pyx_t_6 = __pyx_v_obj;
2717
__Pyx_INCREF(__pyx_t_6);
2718
Py_XINCREF(__pyx_t_6);
2719
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2721
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":36
2722
* # operation is in progress
2724
* return 0 # <<<<<<<<<<<<<<
2727
__Pyx_XDECREF(__pyx_r);
2728
__Pyx_INCREF(__pyx_int_0);
2729
__pyx_r = __pyx_int_0;
2732
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
2735
__Pyx_XDECREF(__pyx_t_1);
2736
__Pyx_XDECREF(__pyx_t_6);
2737
__Pyx_AddTraceback("iocpsupport.connect");
2740
__Pyx_XGIVEREF(__pyx_r);
2741
__Pyx_RefNannyFinishContext();
2745
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":5
2748
* def recv(long s, object bufflist, object obj, unsigned long flags = 0): # <<<<<<<<<<<<<<
2749
* cdef int rc, buffcount, i, res
2750
* cdef myOVERLAPPED *ov
2753
static PyObject *__pyx_pf_11iocpsupport_6recv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2754
static PyMethodDef __pyx_mdef_11iocpsupport_6recv = {__Pyx_NAMESTR("recv"), (PyCFunction)__pyx_pf_11iocpsupport_6recv, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
2755
static PyObject *__pyx_pf_11iocpsupport_6recv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2757
PyObject *__pyx_v_bufflist = 0;
2758
PyObject *__pyx_v_obj = 0;
2759
unsigned long __pyx_v_flags;
2761
int __pyx_v_buffcount;
2763
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov;
2764
WSABUF *__pyx_v_ws_buf;
2765
unsigned long __pyx_v_bytes;
2766
struct PyObject **__pyx_v_buffers;
2767
PyObject *__pyx_r = NULL;
2768
PyObject *__pyx_t_1 = NULL;
2769
PyObject *__pyx_t_2 = NULL;
2773
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_t_6;
2775
PyObject *__pyx_t_8 = NULL;
2776
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__s,&__pyx_n_s__bufflist,&__pyx_n_s__obj,&__pyx_n_s__flags,0};
2777
__Pyx_RefNannySetupContext("recv");
2778
__pyx_self = __pyx_self;
2779
if (unlikely(__pyx_kwds)) {
2780
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
2781
PyObject* values[4] = {0,0,0,0};
2782
switch (PyTuple_GET_SIZE(__pyx_args)) {
2783
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2784
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2785
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2786
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2788
default: goto __pyx_L5_argtuple_error;
2790
switch (PyTuple_GET_SIZE(__pyx_args)) {
2792
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__s);
2793
if (likely(values[0])) kw_args--;
2794
else goto __pyx_L5_argtuple_error;
2796
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bufflist);
2797
if (likely(values[1])) kw_args--;
2799
__Pyx_RaiseArgtupleInvalid("recv", 0, 3, 4, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2802
values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__obj);
2803
if (likely(values[2])) kw_args--;
2805
__Pyx_RaiseArgtupleInvalid("recv", 0, 3, 4, 2); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2809
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
2810
if (value) { values[3] = value; kw_args--; }
2813
if (unlikely(kw_args > 0)) {
2814
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "recv") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2816
__pyx_v_s = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2817
__pyx_v_bufflist = values[1];
2818
__pyx_v_obj = values[2];
2820
__pyx_v_flags = __Pyx_PyInt_AsUnsignedLong(values[3]); if (unlikely((__pyx_v_flags == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2822
__pyx_v_flags = ((unsigned long)0);
2825
__pyx_v_flags = ((unsigned long)0);
2826
switch (PyTuple_GET_SIZE(__pyx_args)) {
2828
__pyx_v_flags = __Pyx_PyInt_AsUnsignedLong(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_flags == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2830
__pyx_v_obj = PyTuple_GET_ITEM(__pyx_args, 2);
2831
__pyx_v_bufflist = PyTuple_GET_ITEM(__pyx_args, 1);
2832
__pyx_v_s = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2834
default: goto __pyx_L5_argtuple_error;
2837
goto __pyx_L4_argument_unpacking_done;
2838
__pyx_L5_argtuple_error:;
2839
__Pyx_RaiseArgtupleInvalid("recv", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2841
__Pyx_AddTraceback("iocpsupport.recv");
2842
__Pyx_RefNannyFinishContext();
2844
__pyx_L4_argument_unpacking_done:;
2845
__Pyx_INCREF(__pyx_v_bufflist);
2847
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":12
2848
* cdef PyObject **buffers
2850
* bufflist = PySequence_Fast(bufflist, 'second argument needs to be a list') # <<<<<<<<<<<<<<
2851
* buffcount = PySequence_Fast_GET_SIZE(bufflist)
2852
* buffers = PySequence_Fast_ITEMS(bufflist)
2854
__pyx_t_1 = __pyx_v_bufflist;
2855
__Pyx_INCREF(__pyx_t_1);
2856
__pyx_t_2 = PySequence_Fast(__pyx_t_1, __pyx_k_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2857
__Pyx_GOTREF(__pyx_t_2);
2858
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2859
__Pyx_DECREF(__pyx_v_bufflist);
2860
__pyx_v_bufflist = __pyx_t_2;
2863
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":13
2865
* bufflist = PySequence_Fast(bufflist, 'second argument needs to be a list')
2866
* buffcount = PySequence_Fast_GET_SIZE(bufflist) # <<<<<<<<<<<<<<
2867
* buffers = PySequence_Fast_ITEMS(bufflist)
2870
__pyx_t_2 = __pyx_v_bufflist;
2871
__Pyx_INCREF(__pyx_t_2);
2872
__pyx_v_buffcount = PySequence_Fast_GET_SIZE(__pyx_t_2);
2873
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2875
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":14
2876
* bufflist = PySequence_Fast(bufflist, 'second argument needs to be a list')
2877
* buffcount = PySequence_Fast_GET_SIZE(bufflist)
2878
* buffers = PySequence_Fast_ITEMS(bufflist) # <<<<<<<<<<<<<<
2880
* ws_buf = <WSABUF *>PyMem_Malloc(buffcount*sizeof(WSABUF))
2882
__pyx_t_2 = __pyx_v_bufflist;
2883
__Pyx_INCREF(__pyx_t_2);
2884
__pyx_v_buffers = PySequence_Fast_ITEMS(__pyx_t_2);
2885
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2887
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":16
2888
* buffers = PySequence_Fast_ITEMS(bufflist)
2890
* ws_buf = <WSABUF *>PyMem_Malloc(buffcount*sizeof(WSABUF)) # <<<<<<<<<<<<<<
2894
__pyx_t_3 = PyMem_Malloc((__pyx_v_buffcount * (sizeof(WSABUF)))); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2895
__pyx_v_ws_buf = ((WSABUF *)__pyx_t_3);
2897
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":18
2898
* ws_buf = <WSABUF *>PyMem_Malloc(buffcount*sizeof(WSABUF))
2900
* try: # <<<<<<<<<<<<<<
2901
* for i from 0 <= i < buffcount:
2902
* PyObject_AsWriteBuffer(<object>buffers[i], <void **>&ws_buf[i].buf, <int *>&ws_buf[i].len)
2906
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":19
2909
* for i from 0 <= i < buffcount: # <<<<<<<<<<<<<<
2910
* PyObject_AsWriteBuffer(<object>buffers[i], <void **>&ws_buf[i].buf, <int *>&ws_buf[i].len)
2913
__pyx_t_4 = __pyx_v_buffcount;
2914
for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_4; __pyx_v_i++) {
2916
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":20
2918
* for i from 0 <= i < buffcount:
2919
* PyObject_AsWriteBuffer(<object>buffers[i], <void **>&ws_buf[i].buf, <int *>&ws_buf[i].len) # <<<<<<<<<<<<<<
2923
__pyx_t_2 = ((PyObject *)(__pyx_v_buffers[__pyx_v_i]));
2924
__Pyx_INCREF(__pyx_t_2);
2925
__pyx_t_5 = PyObject_AsWriteBuffer(__pyx_t_2, ((void **)(&(__pyx_v_ws_buf[__pyx_v_i]).buf)), ((int *)(&(__pyx_v_ws_buf[__pyx_v_i]).len))); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L7;}
2926
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2929
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":22
2930
* PyObject_AsWriteBuffer(<object>buffers[i], <void **>&ws_buf[i].buf, <int *>&ws_buf[i].len)
2932
* ov = makeOV() # <<<<<<<<<<<<<<
2933
* if obj is not None:
2934
* ov.obj = <PyObject *>obj
2936
__pyx_t_6 = __pyx_f_11iocpsupport_makeOV(); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L7;}
2937
__pyx_v_ov = __pyx_t_6;
2939
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":23
2942
* if obj is not None: # <<<<<<<<<<<<<<
2943
* ov.obj = <PyObject *>obj
2946
__pyx_t_7 = (__pyx_v_obj != Py_None);
2949
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":24
2951
* if obj is not None:
2952
* ov.obj = <PyObject *>obj # <<<<<<<<<<<<<<
2954
* rc = WSARecv(s, ws_buf, buffcount, &bytes, &flags, <OVERLAPPED *>ov, NULL)
2956
__pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj);
2961
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":26
2962
* ov.obj = <PyObject *>obj
2964
* rc = WSARecv(s, ws_buf, buffcount, &bytes, &flags, <OVERLAPPED *>ov, NULL) # <<<<<<<<<<<<<<
2966
* if rc == SOCKET_ERROR:
2968
__pyx_v_rc = WSARecv(__pyx_v_s, __pyx_v_ws_buf, __pyx_v_buffcount, (&__pyx_v_bytes), (&__pyx_v_flags), ((OVERLAPPED *)__pyx_v_ov), NULL);
2970
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":28
2971
* rc = WSARecv(s, ws_buf, buffcount, &bytes, &flags, <OVERLAPPED *>ov, NULL)
2973
* if rc == SOCKET_ERROR: # <<<<<<<<<<<<<<
2974
* rc = WSAGetLastError()
2975
* if rc != ERROR_IO_PENDING:
2977
__pyx_t_7 = (__pyx_v_rc == SOCKET_ERROR);
2980
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":29
2982
* if rc == SOCKET_ERROR:
2983
* rc = WSAGetLastError() # <<<<<<<<<<<<<<
2984
* if rc != ERROR_IO_PENDING:
2987
__pyx_v_rc = WSAGetLastError();
2989
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":30
2990
* if rc == SOCKET_ERROR:
2991
* rc = WSAGetLastError()
2992
* if rc != ERROR_IO_PENDING: # <<<<<<<<<<<<<<
2996
__pyx_t_7 = (__pyx_v_rc != ERROR_IO_PENDING);
2999
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":31
3000
* rc = WSAGetLastError()
3001
* if rc != ERROR_IO_PENDING:
3002
* return rc, 0 # <<<<<<<<<<<<<<
3006
__Pyx_XDECREF(__pyx_r);
3007
__pyx_t_2 = PyInt_FromLong(__pyx_v_rc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L7;}
3008
__Pyx_GOTREF(__pyx_t_2);
3009
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L7;}
3010
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
3011
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
3012
__Pyx_GIVEREF(__pyx_t_2);
3013
__Pyx_INCREF(__pyx_int_0);
3014
PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_0);
3015
__Pyx_GIVEREF(__pyx_int_0);
3017
__pyx_r = ((PyObject *)__pyx_t_1);
3027
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":33
3030
* Py_XINCREF(obj) # <<<<<<<<<<<<<<
3034
__pyx_t_1 = __pyx_v_obj;
3035
__Pyx_INCREF(__pyx_t_1);
3036
Py_XINCREF(__pyx_t_1);
3037
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3039
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":34
3042
* return rc, bytes # <<<<<<<<<<<<<<
3044
* PyMem_Free(ws_buf)
3046
__Pyx_XDECREF(__pyx_r);
3047
__pyx_t_1 = PyInt_FromLong(__pyx_v_rc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L7;}
3048
__Pyx_GOTREF(__pyx_t_1);
3049
__pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_bytes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L7;}
3050
__Pyx_GOTREF(__pyx_t_2);
3051
__pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L7;}
3052
__Pyx_GOTREF(((PyObject *)__pyx_t_8));
3053
PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1);
3054
__Pyx_GIVEREF(__pyx_t_1);
3055
PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2);
3056
__Pyx_GIVEREF(__pyx_t_2);
3059
__pyx_r = ((PyObject *)__pyx_t_8);
3064
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":36
3067
* PyMem_Free(ws_buf) # <<<<<<<<<<<<<<
3069
* def recvfrom(long s, object buff, object addr_buff, object addr_len_buff, object obj, unsigned long flags = 0):
3073
PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
3074
int __pyx_exc_lineno;
3075
__pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
3076
__pyx_why = 0; goto __pyx_L8;
3077
__pyx_L6: __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
3078
__pyx_why = 3; goto __pyx_L8;
3081
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3082
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
3083
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
3084
__Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
3085
__pyx_exc_lineno = __pyx_lineno;
3089
PyMem_Free(__pyx_v_ws_buf);
3090
switch (__pyx_why) {
3091
case 3: goto __pyx_L0;
3093
__Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
3094
__pyx_lineno = __pyx_exc_lineno;
3096
__pyx_exc_value = 0;
3098
goto __pyx_L1_error;
3103
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
3106
__Pyx_XDECREF(__pyx_t_1);
3107
__Pyx_XDECREF(__pyx_t_2);
3108
__Pyx_XDECREF(__pyx_t_8);
3109
__Pyx_AddTraceback("iocpsupport.recv");
3112
__Pyx_DECREF(__pyx_v_bufflist);
3113
__Pyx_XGIVEREF(__pyx_r);
3114
__Pyx_RefNannyFinishContext();
3118
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":38
3119
* PyMem_Free(ws_buf)
3121
* def recvfrom(long s, object buff, object addr_buff, object addr_len_buff, object obj, unsigned long flags = 0): # <<<<<<<<<<<<<<
3122
* cdef int rc, c_addr_buff_len, c_addr_len_buff_len
3123
* cdef myOVERLAPPED *ov
3126
static PyObject *__pyx_pf_11iocpsupport_7recvfrom(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3127
static PyMethodDef __pyx_mdef_11iocpsupport_7recvfrom = {__Pyx_NAMESTR("recvfrom"), (PyCFunction)__pyx_pf_11iocpsupport_7recvfrom, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
3128
static PyObject *__pyx_pf_11iocpsupport_7recvfrom(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3130
PyObject *__pyx_v_buff = 0;
3131
PyObject *__pyx_v_addr_buff = 0;
3132
PyObject *__pyx_v_addr_len_buff = 0;
3133
PyObject *__pyx_v_obj = 0;
3134
unsigned long __pyx_v_flags;
3136
int __pyx_v_c_addr_buff_len;
3137
int __pyx_v_c_addr_len_buff_len;
3138
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov;
3139
WSABUF __pyx_v_ws_buf;
3140
unsigned long __pyx_v_bytes;
3141
struct sockaddr *__pyx_v_c_addr_buff;
3142
int *__pyx_v_c_addr_len_buff;
3143
PyObject *__pyx_r = NULL;
3144
PyObject *__pyx_t_1 = NULL;
3147
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_t_4;
3148
PyObject *__pyx_t_5 = NULL;
3149
PyObject *__pyx_t_6 = NULL;
3150
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__s,&__pyx_n_s__buff,&__pyx_n_s__addr_buff,&__pyx_n_s__addr_len_buff,&__pyx_n_s__obj,&__pyx_n_s__flags,0};
3151
__Pyx_RefNannySetupContext("recvfrom");
3152
__pyx_self = __pyx_self;
3153
if (unlikely(__pyx_kwds)) {
3154
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
3155
PyObject* values[6] = {0,0,0,0,0,0};
3156
switch (PyTuple_GET_SIZE(__pyx_args)) {
3157
case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
3158
case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3159
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3160
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3161
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3162
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3164
default: goto __pyx_L5_argtuple_error;
3166
switch (PyTuple_GET_SIZE(__pyx_args)) {
3168
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__s);
3169
if (likely(values[0])) kw_args--;
3170
else goto __pyx_L5_argtuple_error;
3172
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buff);
3173
if (likely(values[1])) kw_args--;
3175
__Pyx_RaiseArgtupleInvalid("recvfrom", 0, 5, 6, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3178
values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__addr_buff);
3179
if (likely(values[2])) kw_args--;
3181
__Pyx_RaiseArgtupleInvalid("recvfrom", 0, 5, 6, 2); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3184
values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__addr_len_buff);
3185
if (likely(values[3])) kw_args--;
3187
__Pyx_RaiseArgtupleInvalid("recvfrom", 0, 5, 6, 3); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3190
values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__obj);
3191
if (likely(values[4])) kw_args--;
3193
__Pyx_RaiseArgtupleInvalid("recvfrom", 0, 5, 6, 4); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3197
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
3198
if (value) { values[5] = value; kw_args--; }
3201
if (unlikely(kw_args > 0)) {
3202
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "recvfrom") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3204
__pyx_v_s = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3205
__pyx_v_buff = values[1];
3206
__pyx_v_addr_buff = values[2];
3207
__pyx_v_addr_len_buff = values[3];
3208
__pyx_v_obj = values[4];
3210
__pyx_v_flags = __Pyx_PyInt_AsUnsignedLong(values[5]); if (unlikely((__pyx_v_flags == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3212
__pyx_v_flags = ((unsigned long)0);
3215
__pyx_v_flags = ((unsigned long)0);
3216
switch (PyTuple_GET_SIZE(__pyx_args)) {
3218
__pyx_v_flags = __Pyx_PyInt_AsUnsignedLong(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_flags == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3220
__pyx_v_obj = PyTuple_GET_ITEM(__pyx_args, 4);
3221
__pyx_v_addr_len_buff = PyTuple_GET_ITEM(__pyx_args, 3);
3222
__pyx_v_addr_buff = PyTuple_GET_ITEM(__pyx_args, 2);
3223
__pyx_v_buff = PyTuple_GET_ITEM(__pyx_args, 1);
3224
__pyx_v_s = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3226
default: goto __pyx_L5_argtuple_error;
3229
goto __pyx_L4_argument_unpacking_done;
3230
__pyx_L5_argtuple_error:;
3231
__Pyx_RaiseArgtupleInvalid("recvfrom", 0, 5, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3233
__Pyx_AddTraceback("iocpsupport.recvfrom");
3234
__Pyx_RefNannyFinishContext();
3236
__pyx_L4_argument_unpacking_done:;
3238
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":46
3239
* cdef int *c_addr_len_buff
3241
* PyObject_AsWriteBuffer(buff, <void **>&ws_buf.buf, <int *>&ws_buf.len) # <<<<<<<<<<<<<<
3242
* PyObject_AsWriteBuffer(addr_buff, <void **>&c_addr_buff, &c_addr_buff_len)
3243
* PyObject_AsWriteBuffer(addr_len_buff, <void **>&c_addr_len_buff, &c_addr_len_buff_len)
3245
__pyx_t_1 = __pyx_v_buff;
3246
__Pyx_INCREF(__pyx_t_1);
3247
__pyx_t_2 = PyObject_AsWriteBuffer(__pyx_t_1, ((void **)(&__pyx_v_ws_buf.buf)), ((int *)(&__pyx_v_ws_buf.len))); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3248
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3250
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":47
3252
* PyObject_AsWriteBuffer(buff, <void **>&ws_buf.buf, <int *>&ws_buf.len)
3253
* PyObject_AsWriteBuffer(addr_buff, <void **>&c_addr_buff, &c_addr_buff_len) # <<<<<<<<<<<<<<
3254
* PyObject_AsWriteBuffer(addr_len_buff, <void **>&c_addr_len_buff, &c_addr_len_buff_len)
3257
__pyx_t_1 = __pyx_v_addr_buff;
3258
__Pyx_INCREF(__pyx_t_1);
3259
__pyx_t_2 = PyObject_AsWriteBuffer(__pyx_t_1, ((void **)(&__pyx_v_c_addr_buff)), (&__pyx_v_c_addr_buff_len)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3260
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3262
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":48
3263
* PyObject_AsWriteBuffer(buff, <void **>&ws_buf.buf, <int *>&ws_buf.len)
3264
* PyObject_AsWriteBuffer(addr_buff, <void **>&c_addr_buff, &c_addr_buff_len)
3265
* PyObject_AsWriteBuffer(addr_len_buff, <void **>&c_addr_len_buff, &c_addr_len_buff_len) # <<<<<<<<<<<<<<
3267
* if c_addr_len_buff_len != sizeof(int):
3269
__pyx_t_1 = __pyx_v_addr_len_buff;
3270
__Pyx_INCREF(__pyx_t_1);
3271
__pyx_t_2 = PyObject_AsWriteBuffer(__pyx_t_1, ((void **)(&__pyx_v_c_addr_len_buff)), (&__pyx_v_c_addr_len_buff_len)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3272
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3274
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":50
3275
* PyObject_AsWriteBuffer(addr_len_buff, <void **>&c_addr_len_buff, &c_addr_len_buff_len)
3277
* if c_addr_len_buff_len != sizeof(int): # <<<<<<<<<<<<<<
3278
* raise ValueError, 'length of address length buffer needs to be sizeof(int)'
3281
__pyx_t_3 = (__pyx_v_c_addr_len_buff_len != (sizeof(int)));
3284
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":51
3286
* if c_addr_len_buff_len != sizeof(int):
3287
* raise ValueError, 'length of address length buffer needs to be sizeof(int)' # <<<<<<<<<<<<<<
3289
* c_addr_len_buff[0] = c_addr_buff_len
3291
__Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_7), 0);
3292
{__pyx_filename = __pyx_f[3]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3297
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":53
3298
* raise ValueError, 'length of address length buffer needs to be sizeof(int)'
3300
* c_addr_len_buff[0] = c_addr_buff_len # <<<<<<<<<<<<<<
3304
(__pyx_v_c_addr_len_buff[0]) = __pyx_v_c_addr_buff_len;
3306
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":55
3307
* c_addr_len_buff[0] = c_addr_buff_len
3309
* ov = makeOV() # <<<<<<<<<<<<<<
3310
* if obj is not None:
3311
* ov.obj = <PyObject *>obj
3313
__pyx_t_4 = __pyx_f_11iocpsupport_makeOV(); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3314
__pyx_v_ov = __pyx_t_4;
3316
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":56
3319
* if obj is not None: # <<<<<<<<<<<<<<
3320
* ov.obj = <PyObject *>obj
3323
__pyx_t_3 = (__pyx_v_obj != Py_None);
3326
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":57
3328
* if obj is not None:
3329
* ov.obj = <PyObject *>obj # <<<<<<<<<<<<<<
3331
* rc = WSARecvFrom(s, &ws_buf, 1, &bytes, &flags, c_addr_buff, c_addr_len_buff, <OVERLAPPED *>ov, NULL)
3333
__pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj);
3338
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":59
3339
* ov.obj = <PyObject *>obj
3341
* rc = WSARecvFrom(s, &ws_buf, 1, &bytes, &flags, c_addr_buff, c_addr_len_buff, <OVERLAPPED *>ov, NULL) # <<<<<<<<<<<<<<
3343
* if rc == SOCKET_ERROR:
3345
__pyx_v_rc = WSARecvFrom(__pyx_v_s, (&__pyx_v_ws_buf), 1, (&__pyx_v_bytes), (&__pyx_v_flags), __pyx_v_c_addr_buff, __pyx_v_c_addr_len_buff, ((OVERLAPPED *)__pyx_v_ov), NULL);
3347
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":61
3348
* rc = WSARecvFrom(s, &ws_buf, 1, &bytes, &flags, c_addr_buff, c_addr_len_buff, <OVERLAPPED *>ov, NULL)
3350
* if rc == SOCKET_ERROR: # <<<<<<<<<<<<<<
3351
* rc = WSAGetLastError()
3352
* if rc != ERROR_IO_PENDING:
3354
__pyx_t_3 = (__pyx_v_rc == SOCKET_ERROR);
3357
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":62
3359
* if rc == SOCKET_ERROR:
3360
* rc = WSAGetLastError() # <<<<<<<<<<<<<<
3361
* if rc != ERROR_IO_PENDING:
3364
__pyx_v_rc = WSAGetLastError();
3366
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":63
3367
* if rc == SOCKET_ERROR:
3368
* rc = WSAGetLastError()
3369
* if rc != ERROR_IO_PENDING: # <<<<<<<<<<<<<<
3373
__pyx_t_3 = (__pyx_v_rc != ERROR_IO_PENDING);
3376
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":64
3377
* rc = WSAGetLastError()
3378
* if rc != ERROR_IO_PENDING:
3379
* return rc, 0 # <<<<<<<<<<<<<<
3383
__Pyx_XDECREF(__pyx_r);
3384
__pyx_t_1 = PyInt_FromLong(__pyx_v_rc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3385
__Pyx_GOTREF(__pyx_t_1);
3386
__pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3387
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
3388
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
3389
__Pyx_GIVEREF(__pyx_t_1);
3390
__Pyx_INCREF(__pyx_int_0);
3391
PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_0);
3392
__Pyx_GIVEREF(__pyx_int_0);
3394
__pyx_r = ((PyObject *)__pyx_t_5);
3404
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":66
3407
* Py_XINCREF(obj) # <<<<<<<<<<<<<<
3411
__pyx_t_5 = __pyx_v_obj;
3412
__Pyx_INCREF(__pyx_t_5);
3413
Py_XINCREF(__pyx_t_5);
3414
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3416
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":67
3419
* return rc, bytes # <<<<<<<<<<<<<<
3422
__Pyx_XDECREF(__pyx_r);
3423
__pyx_t_5 = PyInt_FromLong(__pyx_v_rc); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3424
__Pyx_GOTREF(__pyx_t_5);
3425
__pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_bytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3426
__Pyx_GOTREF(__pyx_t_1);
3427
__pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3428
__Pyx_GOTREF(((PyObject *)__pyx_t_6));
3429
PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
3430
__Pyx_GIVEREF(__pyx_t_5);
3431
PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
3432
__Pyx_GIVEREF(__pyx_t_1);
3435
__pyx_r = ((PyObject *)__pyx_t_6);
3439
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
3442
__Pyx_XDECREF(__pyx_t_1);
3443
__Pyx_XDECREF(__pyx_t_5);
3444
__Pyx_XDECREF(__pyx_t_6);
3445
__Pyx_AddTraceback("iocpsupport.recvfrom");
3448
__Pyx_XGIVEREF(__pyx_r);
3449
__Pyx_RefNannyFinishContext();
3453
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":5
3456
* def send(long s, object buff, object obj, unsigned long flags = 0): # <<<<<<<<<<<<<<
3458
* cdef myOVERLAPPED *ov
3461
static PyObject *__pyx_pf_11iocpsupport_8send(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3462
static PyMethodDef __pyx_mdef_11iocpsupport_8send = {__Pyx_NAMESTR("send"), (PyCFunction)__pyx_pf_11iocpsupport_8send, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
3463
static PyObject *__pyx_pf_11iocpsupport_8send(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3465
PyObject *__pyx_v_buff = 0;
3466
PyObject *__pyx_v_obj = 0;
3467
unsigned long __pyx_v_flags;
3469
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov;
3470
WSABUF __pyx_v_ws_buf;
3471
unsigned long __pyx_v_bytes;
3472
PyObject *__pyx_r = NULL;
3473
PyObject *__pyx_t_1 = NULL;
3475
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_t_3;
3477
PyObject *__pyx_t_5 = NULL;
3478
PyObject *__pyx_t_6 = NULL;
3479
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__s,&__pyx_n_s__buff,&__pyx_n_s__obj,&__pyx_n_s__flags,0};
3480
__Pyx_RefNannySetupContext("send");
3481
__pyx_self = __pyx_self;
3482
if (unlikely(__pyx_kwds)) {
3483
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
3484
PyObject* values[4] = {0,0,0,0};
3485
switch (PyTuple_GET_SIZE(__pyx_args)) {
3486
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3487
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3488
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3489
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3491
default: goto __pyx_L5_argtuple_error;
3493
switch (PyTuple_GET_SIZE(__pyx_args)) {
3495
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__s);
3496
if (likely(values[0])) kw_args--;
3497
else goto __pyx_L5_argtuple_error;
3499
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buff);
3500
if (likely(values[1])) kw_args--;
3502
__Pyx_RaiseArgtupleInvalid("send", 0, 3, 4, 1); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3505
values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__obj);
3506
if (likely(values[2])) kw_args--;
3508
__Pyx_RaiseArgtupleInvalid("send", 0, 3, 4, 2); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3512
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
3513
if (value) { values[3] = value; kw_args--; }
3516
if (unlikely(kw_args > 0)) {
3517
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "send") < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3519
__pyx_v_s = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3520
__pyx_v_buff = values[1];
3521
__pyx_v_obj = values[2];
3523
__pyx_v_flags = __Pyx_PyInt_AsUnsignedLong(values[3]); if (unlikely((__pyx_v_flags == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3525
__pyx_v_flags = ((unsigned long)0);
3528
__pyx_v_flags = ((unsigned long)0);
3529
switch (PyTuple_GET_SIZE(__pyx_args)) {
3531
__pyx_v_flags = __Pyx_PyInt_AsUnsignedLong(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_flags == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3533
__pyx_v_obj = PyTuple_GET_ITEM(__pyx_args, 2);
3534
__pyx_v_buff = PyTuple_GET_ITEM(__pyx_args, 1);
3535
__pyx_v_s = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3537
default: goto __pyx_L5_argtuple_error;
3540
goto __pyx_L4_argument_unpacking_done;
3541
__pyx_L5_argtuple_error:;
3542
__Pyx_RaiseArgtupleInvalid("send", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3544
__Pyx_AddTraceback("iocpsupport.send");
3545
__Pyx_RefNannyFinishContext();
3547
__pyx_L4_argument_unpacking_done:;
3549
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":11
3550
* cdef unsigned long bytes
3552
* PyObject_AsReadBuffer(buff, <void **>&ws_buf.buf, <int *>&ws_buf.len) # <<<<<<<<<<<<<<
3556
__pyx_t_1 = __pyx_v_buff;
3557
__Pyx_INCREF(__pyx_t_1);
3558
__pyx_t_2 = PyObject_AsReadBuffer(__pyx_t_1, ((void **)(&__pyx_v_ws_buf.buf)), ((int *)(&__pyx_v_ws_buf.len))); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3559
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3561
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":13
3562
* PyObject_AsReadBuffer(buff, <void **>&ws_buf.buf, <int *>&ws_buf.len)
3564
* ov = makeOV() # <<<<<<<<<<<<<<
3565
* if obj is not None:
3566
* ov.obj = <PyObject *>obj
3568
__pyx_t_3 = __pyx_f_11iocpsupport_makeOV(); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3569
__pyx_v_ov = __pyx_t_3;
3571
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":14
3574
* if obj is not None: # <<<<<<<<<<<<<<
3575
* ov.obj = <PyObject *>obj
3578
__pyx_t_4 = (__pyx_v_obj != Py_None);
3581
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":15
3583
* if obj is not None:
3584
* ov.obj = <PyObject *>obj # <<<<<<<<<<<<<<
3586
* rc = WSASend(s, &ws_buf, 1, &bytes, flags, <OVERLAPPED *>ov, NULL)
3588
__pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj);
3593
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":17
3594
* ov.obj = <PyObject *>obj
3596
* rc = WSASend(s, &ws_buf, 1, &bytes, flags, <OVERLAPPED *>ov, NULL) # <<<<<<<<<<<<<<
3598
* if rc == SOCKET_ERROR:
3600
__pyx_v_rc = WSASend(__pyx_v_s, (&__pyx_v_ws_buf), 1, (&__pyx_v_bytes), __pyx_v_flags, ((OVERLAPPED *)__pyx_v_ov), NULL);
3602
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":19
3603
* rc = WSASend(s, &ws_buf, 1, &bytes, flags, <OVERLAPPED *>ov, NULL)
3605
* if rc == SOCKET_ERROR: # <<<<<<<<<<<<<<
3606
* rc = WSAGetLastError()
3607
* if rc != ERROR_IO_PENDING:
3609
__pyx_t_4 = (__pyx_v_rc == SOCKET_ERROR);
3612
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":20
3614
* if rc == SOCKET_ERROR:
3615
* rc = WSAGetLastError() # <<<<<<<<<<<<<<
3616
* if rc != ERROR_IO_PENDING:
3619
__pyx_v_rc = WSAGetLastError();
3621
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":21
3622
* if rc == SOCKET_ERROR:
3623
* rc = WSAGetLastError()
3624
* if rc != ERROR_IO_PENDING: # <<<<<<<<<<<<<<
3628
__pyx_t_4 = (__pyx_v_rc != ERROR_IO_PENDING);
3631
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":22
3632
* rc = WSAGetLastError()
3633
* if rc != ERROR_IO_PENDING:
3634
* return rc, bytes # <<<<<<<<<<<<<<
3638
__Pyx_XDECREF(__pyx_r);
3639
__pyx_t_1 = PyInt_FromLong(__pyx_v_rc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3640
__Pyx_GOTREF(__pyx_t_1);
3641
__pyx_t_5 = PyLong_FromUnsignedLong(__pyx_v_bytes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3642
__Pyx_GOTREF(__pyx_t_5);
3643
__pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3644
__Pyx_GOTREF(((PyObject *)__pyx_t_6));
3645
PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
3646
__Pyx_GIVEREF(__pyx_t_1);
3647
PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
3648
__Pyx_GIVEREF(__pyx_t_5);
3651
__pyx_r = ((PyObject *)__pyx_t_6);
3661
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":24
3664
* Py_XINCREF(obj) # <<<<<<<<<<<<<<
3668
__pyx_t_6 = __pyx_v_obj;
3669
__Pyx_INCREF(__pyx_t_6);
3670
Py_XINCREF(__pyx_t_6);
3671
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3673
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":25
3676
* return rc, bytes # <<<<<<<<<<<<<<
3680
__Pyx_XDECREF(__pyx_r);
3681
__pyx_t_6 = PyInt_FromLong(__pyx_v_rc); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3682
__Pyx_GOTREF(__pyx_t_6);
3683
__pyx_t_5 = PyLong_FromUnsignedLong(__pyx_v_bytes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3684
__Pyx_GOTREF(__pyx_t_5);
3685
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3686
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
3687
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6);
3688
__Pyx_GIVEREF(__pyx_t_6);
3689
PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5);
3690
__Pyx_GIVEREF(__pyx_t_5);
3693
__pyx_r = ((PyObject *)__pyx_t_1);
3697
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
3700
__Pyx_XDECREF(__pyx_t_1);
3701
__Pyx_XDECREF(__pyx_t_5);
3702
__Pyx_XDECREF(__pyx_t_6);
3703
__Pyx_AddTraceback("iocpsupport.send");
3706
__Pyx_XGIVEREF(__pyx_r);
3707
__Pyx_RefNannyFinishContext();
3711
static PyObject *__pyx_tp_new_11iocpsupport_CompletionPort(PyTypeObject *t, PyObject *a, PyObject *k) {
3712
PyObject *o = (*t->tp_alloc)(t, 0);
3717
static void __pyx_tp_dealloc_11iocpsupport_CompletionPort(PyObject *o) {
3718
(*Py_TYPE(o)->tp_free)(o);
3721
static PyMethodDef __pyx_methods_11iocpsupport_CompletionPort[] = {
3722
{__Pyx_NAMESTR("addHandle"), (PyCFunction)__pyx_pf_11iocpsupport_14CompletionPort_1addHandle, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
3723
{__Pyx_NAMESTR("getEvent"), (PyCFunction)__pyx_pf_11iocpsupport_14CompletionPort_2getEvent, METH_O, __Pyx_DOCSTR(0)},
3724
{__Pyx_NAMESTR("postEvent"), (PyCFunction)__pyx_pf_11iocpsupport_14CompletionPort_3postEvent, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
3725
{__Pyx_NAMESTR("__del__"), (PyCFunction)__pyx_pf_11iocpsupport_14CompletionPort_4__del__, METH_NOARGS, __Pyx_DOCSTR(0)},
3729
static PyNumberMethods __pyx_tp_as_number_CompletionPort = {
3733
#if PY_MAJOR_VERSION < 3
3749
#if PY_MAJOR_VERSION < 3
3753
#if PY_MAJOR_VERSION < 3
3759
#if PY_MAJOR_VERSION < 3
3762
#if PY_MAJOR_VERSION < 3
3765
0, /*nb_inplace_add*/
3766
0, /*nb_inplace_subtract*/
3767
0, /*nb_inplace_multiply*/
3768
#if PY_MAJOR_VERSION < 3
3769
0, /*nb_inplace_divide*/
3771
0, /*nb_inplace_remainder*/
3772
0, /*nb_inplace_power*/
3773
0, /*nb_inplace_lshift*/
3774
0, /*nb_inplace_rshift*/
3775
0, /*nb_inplace_and*/
3776
0, /*nb_inplace_xor*/
3777
0, /*nb_inplace_or*/
3778
0, /*nb_floor_divide*/
3779
0, /*nb_true_divide*/
3780
0, /*nb_inplace_floor_divide*/
3781
0, /*nb_inplace_true_divide*/
3782
#if PY_VERSION_HEX >= 0x02050000
3787
static PySequenceMethods __pyx_tp_as_sequence_CompletionPort = {
3796
0, /*sq_inplace_concat*/
3797
0, /*sq_inplace_repeat*/
3800
static PyMappingMethods __pyx_tp_as_mapping_CompletionPort = {
3803
0, /*mp_ass_subscript*/
3806
static PyBufferProcs __pyx_tp_as_buffer_CompletionPort = {
3807
#if PY_MAJOR_VERSION < 3
3808
0, /*bf_getreadbuffer*/
3810
#if PY_MAJOR_VERSION < 3
3811
0, /*bf_getwritebuffer*/
3813
#if PY_MAJOR_VERSION < 3
3814
0, /*bf_getsegcount*/
3816
#if PY_MAJOR_VERSION < 3
3817
0, /*bf_getcharbuffer*/
3819
#if PY_VERSION_HEX >= 0x02060000
3822
#if PY_VERSION_HEX >= 0x02060000
3823
0, /*bf_releasebuffer*/
3827
static PyTypeObject __pyx_type_11iocpsupport_CompletionPort = {
3828
PyVarObject_HEAD_INIT(0, 0)
3829
__Pyx_NAMESTR("iocpsupport.CompletionPort"), /*tp_name*/
3830
sizeof(struct __pyx_obj_11iocpsupport_CompletionPort), /*tp_basicsize*/
3832
__pyx_tp_dealloc_11iocpsupport_CompletionPort, /*tp_dealloc*/
3836
#if PY_MAJOR_VERSION < 3
3842
&__pyx_tp_as_number_CompletionPort, /*tp_as_number*/
3843
&__pyx_tp_as_sequence_CompletionPort, /*tp_as_sequence*/
3844
&__pyx_tp_as_mapping_CompletionPort, /*tp_as_mapping*/
3850
&__pyx_tp_as_buffer_CompletionPort, /*tp_as_buffer*/
3851
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
3855
0, /*tp_richcompare*/
3856
0, /*tp_weaklistoffset*/
3859
__pyx_methods_11iocpsupport_CompletionPort, /*tp_methods*/
3866
0, /*tp_dictoffset*/
3867
__pyx_pf_11iocpsupport_14CompletionPort___init__, /*tp_init*/
3869
__pyx_tp_new_11iocpsupport_CompletionPort, /*tp_new*/
3875
0, /*tp_subclasses*/
3878
#if PY_VERSION_HEX >= 0x02060000
3879
0, /*tp_version_tag*/
3883
static PyMethodDef __pyx_methods[] = {
3887
#if PY_MAJOR_VERSION >= 3
3888
static struct PyModuleDef __pyx_moduledef = {
3889
PyModuleDef_HEAD_INIT,
3890
__Pyx_NAMESTR("iocpsupport"),
3893
__pyx_methods /* m_methods */,
3894
NULL, /* m_reload */
3895
NULL, /* m_traverse */
3901
static __Pyx_StringTabEntry __pyx_string_tab[] = {
3902
{&__pyx_n_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 1},
3903
{&__pyx_n_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 1},
3904
{&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
3905
{&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
3906
{&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0},
3907
{&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0},
3908
{&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0},
3909
{&__pyx_n_s__AllocateReadBuffer, __pyx_k__AllocateReadBuffer, sizeof(__pyx_k__AllocateReadBuffer), 0, 0, 1, 1},
3910
{&__pyx_n_s__Event, __pyx_k__Event, sizeof(__pyx_k__Event), 0, 0, 1, 1},
3911
{&__pyx_n_s__MemoryError, __pyx_k__MemoryError, sizeof(__pyx_k__MemoryError), 0, 0, 1, 1},
3912
{&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
3913
{&__pyx_n_s__WindowsError, __pyx_k__WindowsError, sizeof(__pyx_k__WindowsError), 0, 0, 1, 1},
3914
{&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1},
3915
{&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
3916
{&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
3917
{&__pyx_n_s__accept, __pyx_k__accept, sizeof(__pyx_k__accept), 0, 0, 1, 1},
3918
{&__pyx_n_s__accepting, __pyx_k__accepting, sizeof(__pyx_k__accepting), 0, 0, 1, 1},
3919
{&__pyx_n_s__addr, __pyx_k__addr, sizeof(__pyx_k__addr), 0, 0, 1, 1},
3920
{&__pyx_n_s__addr_buff, __pyx_k__addr_buff, sizeof(__pyx_k__addr_buff), 0, 0, 1, 1},
3921
{&__pyx_n_s__addr_len_buff, __pyx_k__addr_len_buff, sizeof(__pyx_k__addr_len_buff), 0, 0, 1, 1},
3922
{&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1},
3923
{&__pyx_n_s__buff, __pyx_k__buff, sizeof(__pyx_k__buff), 0, 0, 1, 1},
3924
{&__pyx_n_s__bufflist, __pyx_k__bufflist, sizeof(__pyx_k__bufflist), 0, 0, 1, 1},
3925
{&__pyx_n_s__bytes, __pyx_k__bytes, sizeof(__pyx_k__bytes), 0, 0, 1, 1},
3926
{&__pyx_n_s__callback, __pyx_k__callback, sizeof(__pyx_k__callback), 0, 0, 1, 1},
3927
{&__pyx_n_s__connect, __pyx_k__connect, sizeof(__pyx_k__connect), 0, 0, 1, 1},
3928
{&__pyx_n_s__flags, __pyx_k__flags, sizeof(__pyx_k__flags), 0, 0, 1, 1},
3929
{&__pyx_n_s__get_accept_addrs, __pyx_k__get_accept_addrs, sizeof(__pyx_k__get_accept_addrs), 0, 0, 1, 1},
3930
{&__pyx_n_s__getsockopt, __pyx_k__getsockopt, sizeof(__pyx_k__getsockopt), 0, 0, 1, 1},
3931
{&__pyx_n_s__handle, __pyx_k__handle, sizeof(__pyx_k__handle), 0, 0, 1, 1},
3932
{&__pyx_n_s__have_connectex, __pyx_k__have_connectex, sizeof(__pyx_k__have_connectex), 0, 0, 1, 1},
3933
{&__pyx_n_s__iAddressFamily, __pyx_k__iAddressFamily, sizeof(__pyx_k__iAddressFamily), 0, 0, 1, 1},
3934
{&__pyx_n_s__iMaxSockAddr, __pyx_k__iMaxSockAddr, sizeof(__pyx_k__iMaxSockAddr), 0, 0, 1, 1},
3935
{&__pyx_n_s__iocpsupport, __pyx_k__iocpsupport, sizeof(__pyx_k__iocpsupport), 0, 0, 1, 1},
3936
{&__pyx_n_s__items, __pyx_k__items, sizeof(__pyx_k__items), 0, 0, 1, 1},
3937
{&__pyx_n_s__key, __pyx_k__key, sizeof(__pyx_k__key), 0, 0, 1, 1},
3938
{&__pyx_n_s__len, __pyx_k__len, sizeof(__pyx_k__len), 0, 0, 1, 1},
3939
{&__pyx_n_s__listening, __pyx_k__listening, sizeof(__pyx_k__listening), 0, 0, 1, 1},
3940
{&__pyx_n_s__makesockaddr, __pyx_k__makesockaddr, sizeof(__pyx_k__makesockaddr), 0, 0, 1, 1},
3941
{&__pyx_n_s__maxAddrLen, __pyx_k__maxAddrLen, sizeof(__pyx_k__maxAddrLen), 0, 0, 1, 1},
3942
{&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1},
3943
{&__pyx_n_s__owner, __pyx_k__owner, sizeof(__pyx_k__owner), 0, 0, 1, 1},
3944
{&__pyx_n_s__port, __pyx_k__port, sizeof(__pyx_k__port), 0, 0, 1, 1},
3945
{&__pyx_n_s__recv, __pyx_k__recv, sizeof(__pyx_k__recv), 0, 0, 1, 1},
3946
{&__pyx_n_s__recvfrom, __pyx_k__recvfrom, sizeof(__pyx_k__recvfrom), 0, 0, 1, 1},
3947
{&__pyx_n_s__s, __pyx_k__s, sizeof(__pyx_k__s), 0, 0, 1, 1},
3948
{&__pyx_n_s__s_addr, __pyx_k__s_addr, sizeof(__pyx_k__s_addr), 0, 0, 1, 1},
3949
{&__pyx_n_s__sa_data, __pyx_k__sa_data, sizeof(__pyx_k__sa_data), 0, 0, 1, 1},
3950
{&__pyx_n_s__sa_family, __pyx_k__sa_family, sizeof(__pyx_k__sa_family), 0, 0, 1, 1},
3951
{&__pyx_n_s__self, __pyx_k__self, sizeof(__pyx_k__self), 0, 0, 1, 1},
3952
{&__pyx_n_s__send, __pyx_k__send, sizeof(__pyx_k__send), 0, 0, 1, 1},
3953
{&__pyx_n_s__sin_addr, __pyx_k__sin_addr, sizeof(__pyx_k__sin_addr), 0, 0, 1, 1},
3954
{&__pyx_n_s__sin_port, __pyx_k__sin_port, sizeof(__pyx_k__sin_port), 0, 0, 1, 1},
3955
{&__pyx_n_s__socket, __pyx_k__socket, sizeof(__pyx_k__socket), 0, 0, 1, 1},
3956
{0, 0, 0, 0, 0, 0, 0}
3958
static int __Pyx_InitCachedBuiltins(void) {
3959
__pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3960
__pyx_builtin_MemoryError = __Pyx_GetName(__pyx_b, __pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3961
__pyx_builtin_WindowsError = __Pyx_GetName(__pyx_b, __pyx_n_s__WindowsError); if (!__pyx_builtin_WindowsError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3967
static int __Pyx_InitCachedConstants(void) {
3968
__Pyx_RefNannySetupContext("__Pyx_InitCachedConstants");
3969
__Pyx_RefNannyFinishContext();
3973
static int __Pyx_InitGlobals(void) {
3974
if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
3975
__pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
3981
#if PY_MAJOR_VERSION < 3
3982
PyMODINIT_FUNC initiocpsupport(void); /*proto*/
3983
PyMODINIT_FUNC initiocpsupport(void)
3985
PyMODINIT_FUNC PyInit_iocpsupport(void); /*proto*/
3986
PyMODINIT_FUNC PyInit_iocpsupport(void)
3989
PyObject *__pyx_t_1 = NULL;
3990
PyObject *__pyx_t_2 = NULL;
3993
void* __pyx_refnanny = NULL;
3994
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
3995
if (!__Pyx_RefNanny) {
3997
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
3998
if (!__Pyx_RefNanny)
3999
Py_FatalError("failed to import 'refnanny' module");
4001
__pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_iocpsupport(void)", __LINE__, __FILE__);
4003
__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;}
4004
__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;}
4005
#ifdef __pyx_binding_PyCFunctionType_USED
4006
if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4008
/*--- Library function declarations ---*/
4009
/*--- Threads initialization code ---*/
4010
#if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
4011
#ifdef WITH_THREAD /* Python build with threading support? */
4012
PyEval_InitThreads();
4015
/*--- Module creation code ---*/
4016
#if PY_MAJOR_VERSION < 3
4017
__pyx_m = Py_InitModule4(__Pyx_NAMESTR("iocpsupport"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
4019
__pyx_m = PyModule_Create(&__pyx_moduledef);
4021
if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
4022
#if PY_MAJOR_VERSION < 3
4025
__pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
4026
if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
4027
if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
4028
/*--- Initialize various global constants etc. ---*/
4029
if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4030
if (__pyx_module_is_main_iocpsupport) {
4031
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;};
4033
/*--- Builtin init code ---*/
4034
if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4035
/*--- Constants init code ---*/
4036
if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4037
/*--- Global init code ---*/
4038
/*--- Function export code ---*/
4039
/*--- Type init code ---*/
4040
if (PyType_Ready(&__pyx_type_11iocpsupport_CompletionPort) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4041
if (__Pyx_SetAttrString(__pyx_m, "CompletionPort", (PyObject *)&__pyx_type_11iocpsupport_CompletionPort) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4042
__pyx_ptype_11iocpsupport_CompletionPort = &__pyx_type_11iocpsupport_CompletionPort;
4043
/*--- Type import code ---*/
4044
/*--- Function import code ---*/
4045
/*--- Execution code ---*/
4047
/* "iocpsupport.pyx":121
4048
* raise WindowsError(message, err)
4050
* class Event: # <<<<<<<<<<<<<<
4051
* def __init__(self, callback, owner, **kw):
4052
* self.callback = callback
4054
__pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4055
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
4057
/* "iocpsupport.pyx":122
4060
* def __init__(self, callback, owner, **kw): # <<<<<<<<<<<<<<
4061
* self.callback = callback
4062
* self.owner = owner
4064
__pyx_t_2 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_11iocpsupport_5Event___init__, NULL, __pyx_n_s__iocpsupport); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4065
__Pyx_GOTREF(__pyx_t_2);
4066
if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____init__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4067
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4069
/* "iocpsupport.pyx":121
4070
* raise WindowsError(message, err)
4072
* class Event: # <<<<<<<<<<<<<<
4073
* def __init__(self, callback, owner, **kw):
4074
* self.callback = callback
4076
__pyx_t_2 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1), __pyx_n_s__Event, __pyx_n_s__iocpsupport); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4077
__Pyx_GOTREF(__pyx_t_2);
4078
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Event, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4079
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4080
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
4082
/* "iocpsupport.pyx":184
4083
* CloseHandle(self.port)
4085
* def makesockaddr(object buff): # <<<<<<<<<<<<<<
4086
* cdef void *mem_buffer
4089
__pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11iocpsupport_makesockaddr, NULL, __pyx_n_s__iocpsupport); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4090
__Pyx_GOTREF(__pyx_t_1);
4091
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__makesockaddr, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4092
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4094
/* "iocpsupport.pyx":216
4095
* dest.sin_port = htons(port)
4097
* def AllocateReadBuffer(int size): # <<<<<<<<<<<<<<
4098
* return PyBuffer_New(size)
4101
__pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11iocpsupport_1AllocateReadBuffer, NULL, __pyx_n_s__iocpsupport); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4102
__Pyx_GOTREF(__pyx_t_1);
4103
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__AllocateReadBuffer, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4104
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4106
/* "iocpsupport.pyx":219
4107
* return PyBuffer_New(size)
4109
* def maxAddrLen(long s): # <<<<<<<<<<<<<<
4110
* cdef WSAPROTOCOL_INFO wsa_pi
4113
__pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11iocpsupport_2maxAddrLen, NULL, __pyx_n_s__iocpsupport); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4114
__Pyx_GOTREF(__pyx_t_1);
4115
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__maxAddrLen, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4116
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4118
/* "iocpsupport.pyx":239
4119
* return wsa_pi.iAddressFamily
4121
* import socket # for WSAStartup # <<<<<<<<<<<<<<
4122
* if not initWinsockPointers():
4123
* raise ValueError, 'Failed to initialize Winsock function vectors'
4125
__pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__socket), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4126
__Pyx_GOTREF(__pyx_t_1);
4127
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__socket, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4128
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4130
/* "iocpsupport.pyx":240
4132
* import socket # for WSAStartup
4133
* if not initWinsockPointers(): # <<<<<<<<<<<<<<
4134
* raise ValueError, 'Failed to initialize Winsock function vectors'
4137
__pyx_t_3 = (!initWinsockPointers());
4140
/* "iocpsupport.pyx":241
4141
* import socket # for WSAStartup
4142
* if not initWinsockPointers():
4143
* raise ValueError, 'Failed to initialize Winsock function vectors' # <<<<<<<<<<<<<<
4145
* have_connectex = (lpConnectEx != NULL)
4147
__Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_8), 0);
4148
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4153
/* "iocpsupport.pyx":243
4154
* raise ValueError, 'Failed to initialize Winsock function vectors'
4156
* have_connectex = (lpConnectEx != NULL) # <<<<<<<<<<<<<<
4158
* include 'acceptex.pxi'
4160
__pyx_t_1 = __Pyx_PyBool_FromLong((lpConnectEx != NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4161
__Pyx_GOTREF(__pyx_t_1);
4162
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__have_connectex, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4163
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4165
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":5
4168
* def accept(long listening, long accepting, object buff, object obj): # <<<<<<<<<<<<<<
4170
* CAUTION: unlike system AcceptEx(), this function returns 0 on success
4172
__pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11iocpsupport_3accept, NULL, __pyx_n_s__iocpsupport); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4173
__Pyx_GOTREF(__pyx_t_1);
4174
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__accept, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4175
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4177
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":31
4180
* def get_accept_addrs(long s, object buff): # <<<<<<<<<<<<<<
4181
* cdef WSAPROTOCOL_INFO wsa_pi
4182
* cdef int size, locallen, remotelen
4184
__pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11iocpsupport_4get_accept_addrs, NULL, __pyx_n_s__iocpsupport); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4185
__Pyx_GOTREF(__pyx_t_1);
4186
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__get_accept_addrs, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4187
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4189
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":5
4192
* def connect(long s, object addr, object obj): # <<<<<<<<<<<<<<
4194
* CAUTION: unlike system ConnectEx(), this function returns 0 on success
4196
__pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11iocpsupport_5connect, NULL, __pyx_n_s__iocpsupport); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4197
__Pyx_GOTREF(__pyx_t_1);
4198
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__connect, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4199
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4200
__pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11iocpsupport_6recv, NULL, __pyx_n_s__iocpsupport); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4201
__Pyx_GOTREF(__pyx_t_1);
4202
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__recv, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4203
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4205
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":38
4206
* PyMem_Free(ws_buf)
4208
* def recvfrom(long s, object buff, object addr_buff, object addr_len_buff, object obj, unsigned long flags = 0): # <<<<<<<<<<<<<<
4209
* cdef int rc, c_addr_buff_len, c_addr_len_buff_len
4210
* cdef myOVERLAPPED *ov
4212
__pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11iocpsupport_7recvfrom, NULL, __pyx_n_s__iocpsupport); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4213
__Pyx_GOTREF(__pyx_t_1);
4214
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__recvfrom, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4215
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4217
/* "E:\Twisted.3233\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":5
4220
* def send(long s, object buff, object obj, unsigned long flags = 0): # <<<<<<<<<<<<<<
4222
* cdef myOVERLAPPED *ov
4224
__pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11iocpsupport_8send, NULL, __pyx_n_s__iocpsupport); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4225
__Pyx_GOTREF(__pyx_t_1);
4226
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__send, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4227
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4229
/* "iocpsupport.pyx":1
4230
* # Copyright (c) Twisted Matrix Laboratories. # <<<<<<<<<<<<<<
4231
* # See LICENSE for details.
4234
__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;}
4235
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
4236
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;}
4237
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
4240
__Pyx_XDECREF(__pyx_t_1);
4241
__Pyx_XDECREF(__pyx_t_2);
4243
__Pyx_AddTraceback("init iocpsupport");
4244
Py_DECREF(__pyx_m); __pyx_m = 0;
4245
} else if (!PyErr_Occurred()) {
4246
PyErr_SetString(PyExc_ImportError, "init iocpsupport");
4249
__Pyx_RefNannyFinishContext();
4250
#if PY_MAJOR_VERSION < 3
4257
/* Runtime support code */
4259
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
4261
result = PyObject_GetAttr(dict, name);
4263
PyErr_SetObject(PyExc_NameError, name);
4267
static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
4268
PyObject *tmp_type, *tmp_value, *tmp_tb;
4269
PyThreadState *tstate = PyThreadState_GET();
4271
tmp_type = tstate->curexc_type;
4272
tmp_value = tstate->curexc_value;
4273
tmp_tb = tstate->curexc_traceback;
4274
tstate->curexc_type = type;
4275
tstate->curexc_value = value;
4276
tstate->curexc_traceback = tb;
4277
Py_XDECREF(tmp_type);
4278
Py_XDECREF(tmp_value);
4282
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
4283
PyThreadState *tstate = PyThreadState_GET();
4284
*type = tstate->curexc_type;
4285
*value = tstate->curexc_value;
4286
*tb = tstate->curexc_traceback;
4288
tstate->curexc_type = 0;
4289
tstate->curexc_value = 0;
4290
tstate->curexc_traceback = 0;
4294
#if PY_MAJOR_VERSION < 3
4295
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
4299
/* First, check the traceback argument, replacing None with NULL. */
4300
if (tb == Py_None) {
4304
else if (tb != NULL && !PyTraceBack_Check(tb)) {
4305
PyErr_SetString(PyExc_TypeError,
4306
"raise: arg 3 must be a traceback or None");
4309
/* Next, replace a missing value with None */
4310
if (value == NULL) {
4314
#if PY_VERSION_HEX < 0x02050000
4315
if (!PyClass_Check(type))
4317
if (!PyType_Check(type))
4320
/* Raising an instance. The value should be a dummy. */
4321
if (value != Py_None) {
4322
PyErr_SetString(PyExc_TypeError,
4323
"instance exception may not have a separate value");
4326
/* Normalize to raise <class>, <instance> */
4329
#if PY_VERSION_HEX < 0x02050000
4330
if (PyInstance_Check(type)) {
4331
type = (PyObject*) ((PyInstanceObject*)type)->in_class;
4336
PyErr_SetString(PyExc_TypeError,
4337
"raise: exception must be an old-style class or instance");
4341
type = (PyObject*) Py_TYPE(type);
4343
if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
4344
PyErr_SetString(PyExc_TypeError,
4345
"raise: exception class must be a subclass of BaseException");
4351
__Pyx_ErrRestore(type, value, tb);
4360
#else /* Python 3+ */
4362
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
4363
if (tb == Py_None) {
4365
} else if (tb && !PyTraceBack_Check(tb)) {
4366
PyErr_SetString(PyExc_TypeError,
4367
"raise: arg 3 must be a traceback or None");
4370
if (value == Py_None)
4373
if (PyExceptionInstance_Check(type)) {
4375
PyErr_SetString(PyExc_TypeError,
4376
"instance exception may not have a separate value");
4380
type = (PyObject*) Py_TYPE(value);
4381
} else if (!PyExceptionClass_Check(type)) {
4382
PyErr_SetString(PyExc_TypeError,
4383
"raise: exception class must be a subclass of BaseException");
4387
PyErr_SetObject(type, value);
4390
PyThreadState *tstate = PyThreadState_GET();
4391
PyObject* tmp_tb = tstate->curexc_traceback;
4394
tstate->curexc_traceback = tb;
4404
static void __Pyx_RaiseArgtupleInvalid(
4405
const char* func_name,
4409
Py_ssize_t num_found)
4411
Py_ssize_t num_expected;
4412
const char *number, *more_or_less;
4414
if (num_found < num_min) {
4415
num_expected = num_min;
4416
more_or_less = "at least";
4418
num_expected = num_max;
4419
more_or_less = "at most";
4422
more_or_less = "exactly";
4424
number = (num_expected == 1) ? "" : "s";
4425
PyErr_Format(PyExc_TypeError,
4426
#if PY_VERSION_HEX < 0x02050000
4427
"%s() takes %s %d positional argument%s (%d given)",
4429
"%s() takes %s %zd positional argument%s (%zd given)",
4431
func_name, more_or_less, num_expected, number, num_found);
4434
static void __Pyx_RaiseDoubleKeywordsError(
4435
const char* func_name,
4438
PyErr_Format(PyExc_TypeError,
4439
#if PY_MAJOR_VERSION >= 3
4440
"%s() got multiple values for keyword argument '%U'", func_name, kw_name);
4442
"%s() got multiple values for keyword argument '%s'", func_name,
4443
PyString_AS_STRING(kw_name));
4447
static int __Pyx_ParseOptionalKeywords(
4449
PyObject **argnames[],
4452
Py_ssize_t num_pos_args,
4453
const char* function_name)
4455
PyObject *key = 0, *value = 0;
4458
PyObject*** first_kw_arg = argnames + num_pos_args;
4460
while (PyDict_Next(kwds, &pos, &key, &value)) {
4461
name = first_kw_arg;
4462
while (*name && (**name != key)) name++;
4464
values[name-argnames] = value;
4466
#if PY_MAJOR_VERSION < 3
4467
if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
4469
if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
4471
goto invalid_keyword_type;
4473
for (name = first_kw_arg; *name; name++) {
4474
#if PY_MAJOR_VERSION >= 3
4475
if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
4476
PyUnicode_Compare(**name, key) == 0) break;
4478
if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
4479
_PyString_Eq(**name, key)) break;
4483
values[name-argnames] = value;
4485
/* unexpected keyword found */
4486
for (name=argnames; name != first_kw_arg; name++) {
4487
if (**name == key) goto arg_passed_twice;
4488
#if PY_MAJOR_VERSION >= 3
4489
if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
4490
PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
4492
if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
4493
_PyString_Eq(**name, key)) goto arg_passed_twice;
4497
if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
4499
goto invalid_keyword;
4507
__Pyx_RaiseDoubleKeywordsError(function_name, **name);
4509
invalid_keyword_type:
4510
PyErr_Format(PyExc_TypeError,
4511
"%s() keywords must be strings", function_name);
4514
PyErr_Format(PyExc_TypeError,
4515
#if PY_MAJOR_VERSION < 3
4516
"%s() got an unexpected keyword argument '%s'",
4517
function_name, PyString_AsString(key));
4519
"%s() got an unexpected keyword argument '%U'",
4520
function_name, key);
4526
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
4527
PyErr_Format(PyExc_ValueError,
4528
#if PY_VERSION_HEX < 0x02050000
4529
"need more than %d value%s to unpack", (int)index,
4531
"need more than %zd value%s to unpack", index,
4533
(index == 1) ? "" : "s");
4536
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
4537
PyErr_Format(PyExc_ValueError,
4538
#if PY_VERSION_HEX < 0x02050000
4539
"too many values to unpack (expected %d)", (int)expected);
4541
"too many values to unpack (expected %zd)", expected);
4545
static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) {
4547
if (!(item = PyIter_Next(iter))) {
4548
if (!PyErr_Occurred()) {
4549
__Pyx_RaiseNeedMoreValuesError(index);
4555
static int __Pyx_EndUnpack(PyObject *iter, Py_ssize_t expected) {
4557
if ((item = PyIter_Next(iter))) {
4559
__Pyx_RaiseTooManyValuesError(expected);
4562
else if (!PyErr_Occurred())
4568
static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
4570
const char* function_name,
4575
while (PyDict_Next(kwdict, &pos, &key, 0)) {
4576
#if PY_MAJOR_VERSION < 3
4577
if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
4579
if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key)))
4581
goto invalid_keyword_type;
4583
if ((!kw_allowed) && unlikely(key))
4584
goto invalid_keyword;
4586
invalid_keyword_type:
4587
PyErr_Format(PyExc_TypeError,
4588
"%s() keywords must be strings", function_name);
4591
PyErr_Format(PyExc_TypeError,
4592
#if PY_MAJOR_VERSION < 3
4593
"%s() got an unexpected keyword argument '%s'",
4594
function_name, PyString_AsString(key));
4596
"%s() got an unexpected keyword argument '%U'",
4597
function_name, key);
4602
static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
4605
q -= ((r != 0) & ((r ^ b) < 0));
4609
static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
4610
PyObject *metaclass;
4611
/* Default metaclass */
4612
#if PY_MAJOR_VERSION < 3
4613
if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
4614
PyObject *base = PyTuple_GET_ITEM(bases, 0);
4615
metaclass = PyObject_GetAttrString(base, "__class__");
4618
metaclass = (PyObject*) Py_TYPE(base);
4621
metaclass = (PyObject *) &PyClass_Type;
4624
if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
4625
PyObject *base = PyTuple_GET_ITEM(bases, 0);
4626
metaclass = (PyObject*) Py_TYPE(base);
4628
metaclass = (PyObject *) &PyType_Type;
4631
Py_INCREF(metaclass);
4635
static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
4636
PyObject *modname) {
4638
PyObject *metaclass;
4640
if (PyDict_SetItemString(dict, "__module__", modname) < 0)
4643
/* Python2 __metaclass__ */
4644
metaclass = PyDict_GetItemString(dict, "__metaclass__");
4646
Py_INCREF(metaclass);
4648
metaclass = __Pyx_FindPy2Metaclass(bases);
4650
result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL);
4651
Py_DECREF(metaclass);
4656
static PyObject *__pyx_binding_PyCFunctionType_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module) {
4657
__pyx_binding_PyCFunctionType_object *op = PyObject_GC_New(__pyx_binding_PyCFunctionType_object, __pyx_binding_PyCFunctionType);
4662
op->func.m_self = self;
4664
op->func.m_module = module;
4665
PyObject_GC_Track(op);
4666
return (PyObject *)op;
4669
static void __pyx_binding_PyCFunctionType_dealloc(__pyx_binding_PyCFunctionType_object *m) {
4670
PyObject_GC_UnTrack(m);
4671
Py_XDECREF(m->func.m_self);
4672
Py_XDECREF(m->func.m_module);
4676
static PyObject *__pyx_binding_PyCFunctionType_descr_get(PyObject *func, PyObject *obj, PyObject *type) {
4679
return PyMethod_New(func, obj, type);
4682
static int __pyx_binding_PyCFunctionType_init(void) {
4683
__pyx_binding_PyCFunctionType_type = PyCFunction_Type;
4684
__pyx_binding_PyCFunctionType_type.tp_name = __Pyx_NAMESTR("cython_binding_builtin_function_or_method");
4685
__pyx_binding_PyCFunctionType_type.tp_dealloc = (destructor)__pyx_binding_PyCFunctionType_dealloc;
4686
__pyx_binding_PyCFunctionType_type.tp_descr_get = __pyx_binding_PyCFunctionType_descr_get;
4687
if (PyType_Ready(&__pyx_binding_PyCFunctionType_type) < 0) {
4690
__pyx_binding_PyCFunctionType = &__pyx_binding_PyCFunctionType_type;
4695
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
4696
PyObject *py_import = 0;
4697
PyObject *empty_list = 0;
4698
PyObject *module = 0;
4699
PyObject *global_dict = 0;
4700
PyObject *empty_dict = 0;
4702
py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
4708
empty_list = PyList_New(0);
4713
global_dict = PyModule_GetDict(__pyx_m);
4716
empty_dict = PyDict_New();
4719
module = PyObject_CallFunctionObjArgs(py_import,
4720
name, global_dict, empty_dict, list, NULL);
4722
Py_XDECREF(empty_list);
4723
Py_XDECREF(py_import);
4724
Py_XDECREF(empty_dict);
4728
static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
4729
const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
4730
const int is_unsigned = neg_one > const_zero;
4731
if (sizeof(unsigned char) < sizeof(long)) {
4732
long val = __Pyx_PyInt_AsLong(x);
4733
if (unlikely(val != (long)(unsigned char)val)) {
4734
if (!unlikely(val == -1 && PyErr_Occurred())) {
4735
PyErr_SetString(PyExc_OverflowError,
4736
(is_unsigned && unlikely(val < 0)) ?
4737
"can't convert negative value to unsigned char" :
4738
"value too large to convert to unsigned char");
4740
return (unsigned char)-1;
4742
return (unsigned char)val;
4744
return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
4747
static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
4748
const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
4749
const int is_unsigned = neg_one > const_zero;
4750
if (sizeof(unsigned short) < sizeof(long)) {
4751
long val = __Pyx_PyInt_AsLong(x);
4752
if (unlikely(val != (long)(unsigned short)val)) {
4753
if (!unlikely(val == -1 && PyErr_Occurred())) {
4754
PyErr_SetString(PyExc_OverflowError,
4755
(is_unsigned && unlikely(val < 0)) ?
4756
"can't convert negative value to unsigned short" :
4757
"value too large to convert to unsigned short");
4759
return (unsigned short)-1;
4761
return (unsigned short)val;
4763
return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
4766
static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
4767
const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
4768
const int is_unsigned = neg_one > const_zero;
4769
if (sizeof(unsigned int) < sizeof(long)) {
4770
long val = __Pyx_PyInt_AsLong(x);
4771
if (unlikely(val != (long)(unsigned int)val)) {
4772
if (!unlikely(val == -1 && PyErr_Occurred())) {
4773
PyErr_SetString(PyExc_OverflowError,
4774
(is_unsigned && unlikely(val < 0)) ?
4775
"can't convert negative value to unsigned int" :
4776
"value too large to convert to unsigned int");
4778
return (unsigned int)-1;
4780
return (unsigned int)val;
4782
return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
4785
static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
4786
const char neg_one = (char)-1, const_zero = 0;
4787
const int is_unsigned = neg_one > const_zero;
4788
if (sizeof(char) < sizeof(long)) {
4789
long val = __Pyx_PyInt_AsLong(x);
4790
if (unlikely(val != (long)(char)val)) {
4791
if (!unlikely(val == -1 && PyErr_Occurred())) {
4792
PyErr_SetString(PyExc_OverflowError,
4793
(is_unsigned && unlikely(val < 0)) ?
4794
"can't convert negative value to char" :
4795
"value too large to convert to char");
4801
return (char)__Pyx_PyInt_AsLong(x);
4804
static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
4805
const short neg_one = (short)-1, const_zero = 0;
4806
const int is_unsigned = neg_one > const_zero;
4807
if (sizeof(short) < sizeof(long)) {
4808
long val = __Pyx_PyInt_AsLong(x);
4809
if (unlikely(val != (long)(short)val)) {
4810
if (!unlikely(val == -1 && PyErr_Occurred())) {
4811
PyErr_SetString(PyExc_OverflowError,
4812
(is_unsigned && unlikely(val < 0)) ?
4813
"can't convert negative value to short" :
4814
"value too large to convert to short");
4820
return (short)__Pyx_PyInt_AsLong(x);
4823
static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
4824
const int neg_one = (int)-1, const_zero = 0;
4825
const int is_unsigned = neg_one > const_zero;
4826
if (sizeof(int) < sizeof(long)) {
4827
long val = __Pyx_PyInt_AsLong(x);
4828
if (unlikely(val != (long)(int)val)) {
4829
if (!unlikely(val == -1 && PyErr_Occurred())) {
4830
PyErr_SetString(PyExc_OverflowError,
4831
(is_unsigned && unlikely(val < 0)) ?
4832
"can't convert negative value to int" :
4833
"value too large to convert to int");
4839
return (int)__Pyx_PyInt_AsLong(x);
4842
static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
4843
const signed char neg_one = (signed char)-1, const_zero = 0;
4844
const int is_unsigned = neg_one > const_zero;
4845
if (sizeof(signed char) < sizeof(long)) {
4846
long val = __Pyx_PyInt_AsLong(x);
4847
if (unlikely(val != (long)(signed char)val)) {
4848
if (!unlikely(val == -1 && PyErr_Occurred())) {
4849
PyErr_SetString(PyExc_OverflowError,
4850
(is_unsigned && unlikely(val < 0)) ?
4851
"can't convert negative value to signed char" :
4852
"value too large to convert to signed char");
4854
return (signed char)-1;
4856
return (signed char)val;
4858
return (signed char)__Pyx_PyInt_AsSignedLong(x);
4861
static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
4862
const signed short neg_one = (signed short)-1, const_zero = 0;
4863
const int is_unsigned = neg_one > const_zero;
4864
if (sizeof(signed short) < sizeof(long)) {
4865
long val = __Pyx_PyInt_AsLong(x);
4866
if (unlikely(val != (long)(signed short)val)) {
4867
if (!unlikely(val == -1 && PyErr_Occurred())) {
4868
PyErr_SetString(PyExc_OverflowError,
4869
(is_unsigned && unlikely(val < 0)) ?
4870
"can't convert negative value to signed short" :
4871
"value too large to convert to signed short");
4873
return (signed short)-1;
4875
return (signed short)val;
4877
return (signed short)__Pyx_PyInt_AsSignedLong(x);
4880
static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
4881
const signed int neg_one = (signed int)-1, const_zero = 0;
4882
const int is_unsigned = neg_one > const_zero;
4883
if (sizeof(signed int) < sizeof(long)) {
4884
long val = __Pyx_PyInt_AsLong(x);
4885
if (unlikely(val != (long)(signed int)val)) {
4886
if (!unlikely(val == -1 && PyErr_Occurred())) {
4887
PyErr_SetString(PyExc_OverflowError,
4888
(is_unsigned && unlikely(val < 0)) ?
4889
"can't convert negative value to signed int" :
4890
"value too large to convert to signed int");
4892
return (signed int)-1;
4894
return (signed int)val;
4896
return (signed int)__Pyx_PyInt_AsSignedLong(x);
4899
static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
4900
const int neg_one = (int)-1, const_zero = 0;
4901
const int is_unsigned = neg_one > const_zero;
4902
if (sizeof(int) < sizeof(long)) {
4903
long val = __Pyx_PyInt_AsLong(x);
4904
if (unlikely(val != (long)(int)val)) {
4905
if (!unlikely(val == -1 && PyErr_Occurred())) {
4906
PyErr_SetString(PyExc_OverflowError,
4907
(is_unsigned && unlikely(val < 0)) ?
4908
"can't convert negative value to int" :
4909
"value too large to convert to int");
4915
return (int)__Pyx_PyInt_AsLong(x);
4918
static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
4919
const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
4920
const int is_unsigned = neg_one > const_zero;
4921
#if PY_VERSION_HEX < 0x03000000
4922
if (likely(PyInt_Check(x))) {
4923
long val = PyInt_AS_LONG(x);
4924
if (is_unsigned && unlikely(val < 0)) {
4925
PyErr_SetString(PyExc_OverflowError,
4926
"can't convert negative value to unsigned long");
4927
return (unsigned long)-1;
4929
return (unsigned long)val;
4932
if (likely(PyLong_Check(x))) {
4934
if (unlikely(Py_SIZE(x) < 0)) {
4935
PyErr_SetString(PyExc_OverflowError,
4936
"can't convert negative value to unsigned long");
4937
return (unsigned long)-1;
4939
return PyLong_AsUnsignedLong(x);
4941
return PyLong_AsLong(x);
4945
PyObject *tmp = __Pyx_PyNumber_Int(x);
4946
if (!tmp) return (unsigned long)-1;
4947
val = __Pyx_PyInt_AsUnsignedLong(tmp);
4953
static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
4954
const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
4955
const int is_unsigned = neg_one > const_zero;
4956
#if PY_VERSION_HEX < 0x03000000
4957
if (likely(PyInt_Check(x))) {
4958
long val = PyInt_AS_LONG(x);
4959
if (is_unsigned && unlikely(val < 0)) {
4960
PyErr_SetString(PyExc_OverflowError,
4961
"can't convert negative value to unsigned PY_LONG_LONG");
4962
return (unsigned PY_LONG_LONG)-1;
4964
return (unsigned PY_LONG_LONG)val;
4967
if (likely(PyLong_Check(x))) {
4969
if (unlikely(Py_SIZE(x) < 0)) {
4970
PyErr_SetString(PyExc_OverflowError,
4971
"can't convert negative value to unsigned PY_LONG_LONG");
4972
return (unsigned PY_LONG_LONG)-1;
4974
return PyLong_AsUnsignedLongLong(x);
4976
return PyLong_AsLongLong(x);
4979
unsigned PY_LONG_LONG val;
4980
PyObject *tmp = __Pyx_PyNumber_Int(x);
4981
if (!tmp) return (unsigned PY_LONG_LONG)-1;
4982
val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
4988
static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
4989
const long neg_one = (long)-1, const_zero = 0;
4990
const int is_unsigned = neg_one > const_zero;
4991
#if PY_VERSION_HEX < 0x03000000
4992
if (likely(PyInt_Check(x))) {
4993
long val = PyInt_AS_LONG(x);
4994
if (is_unsigned && unlikely(val < 0)) {
4995
PyErr_SetString(PyExc_OverflowError,
4996
"can't convert negative value to long");
5002
if (likely(PyLong_Check(x))) {
5004
if (unlikely(Py_SIZE(x) < 0)) {
5005
PyErr_SetString(PyExc_OverflowError,
5006
"can't convert negative value to long");
5009
return PyLong_AsUnsignedLong(x);
5011
return PyLong_AsLong(x);
5015
PyObject *tmp = __Pyx_PyNumber_Int(x);
5016
if (!tmp) return (long)-1;
5017
val = __Pyx_PyInt_AsLong(tmp);
5023
static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
5024
const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
5025
const int is_unsigned = neg_one > const_zero;
5026
#if PY_VERSION_HEX < 0x03000000
5027
if (likely(PyInt_Check(x))) {
5028
long val = PyInt_AS_LONG(x);
5029
if (is_unsigned && unlikely(val < 0)) {
5030
PyErr_SetString(PyExc_OverflowError,
5031
"can't convert negative value to PY_LONG_LONG");
5032
return (PY_LONG_LONG)-1;
5034
return (PY_LONG_LONG)val;
5037
if (likely(PyLong_Check(x))) {
5039
if (unlikely(Py_SIZE(x) < 0)) {
5040
PyErr_SetString(PyExc_OverflowError,
5041
"can't convert negative value to PY_LONG_LONG");
5042
return (PY_LONG_LONG)-1;
5044
return PyLong_AsUnsignedLongLong(x);
5046
return PyLong_AsLongLong(x);
5050
PyObject *tmp = __Pyx_PyNumber_Int(x);
5051
if (!tmp) return (PY_LONG_LONG)-1;
5052
val = __Pyx_PyInt_AsLongLong(tmp);
5058
static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
5059
const signed long neg_one = (signed long)-1, const_zero = 0;
5060
const int is_unsigned = neg_one > const_zero;
5061
#if PY_VERSION_HEX < 0x03000000
5062
if (likely(PyInt_Check(x))) {
5063
long val = PyInt_AS_LONG(x);
5064
if (is_unsigned && unlikely(val < 0)) {
5065
PyErr_SetString(PyExc_OverflowError,
5066
"can't convert negative value to signed long");
5067
return (signed long)-1;
5069
return (signed long)val;
5072
if (likely(PyLong_Check(x))) {
5074
if (unlikely(Py_SIZE(x) < 0)) {
5075
PyErr_SetString(PyExc_OverflowError,
5076
"can't convert negative value to signed long");
5077
return (signed long)-1;
5079
return PyLong_AsUnsignedLong(x);
5081
return PyLong_AsLong(x);
5085
PyObject *tmp = __Pyx_PyNumber_Int(x);
5086
if (!tmp) return (signed long)-1;
5087
val = __Pyx_PyInt_AsSignedLong(tmp);
5093
static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
5094
const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
5095
const int is_unsigned = neg_one > const_zero;
5096
#if PY_VERSION_HEX < 0x03000000
5097
if (likely(PyInt_Check(x))) {
5098
long val = PyInt_AS_LONG(x);
5099
if (is_unsigned && unlikely(val < 0)) {
5100
PyErr_SetString(PyExc_OverflowError,
5101
"can't convert negative value to signed PY_LONG_LONG");
5102
return (signed PY_LONG_LONG)-1;
5104
return (signed PY_LONG_LONG)val;
5107
if (likely(PyLong_Check(x))) {
5109
if (unlikely(Py_SIZE(x) < 0)) {
5110
PyErr_SetString(PyExc_OverflowError,
5111
"can't convert negative value to signed PY_LONG_LONG");
5112
return (signed PY_LONG_LONG)-1;
5114
return PyLong_AsUnsignedLongLong(x);
5116
return PyLong_AsLongLong(x);
5119
signed PY_LONG_LONG val;
5120
PyObject *tmp = __Pyx_PyNumber_Int(x);
5121
if (!tmp) return (signed PY_LONG_LONG)-1;
5122
val = __Pyx_PyInt_AsSignedLongLong(tmp);
5128
#include "compile.h"
5129
#include "frameobject.h"
5130
#include "traceback.h"
5132
static void __Pyx_AddTraceback(const char *funcname) {
5133
PyObject *py_srcfile = 0;
5134
PyObject *py_funcname = 0;
5135
PyObject *py_globals = 0;
5136
PyCodeObject *py_code = 0;
5137
PyFrameObject *py_frame = 0;
5139
#if PY_MAJOR_VERSION < 3
5140
py_srcfile = PyString_FromString(__pyx_filename);
5142
py_srcfile = PyUnicode_FromString(__pyx_filename);
5144
if (!py_srcfile) goto bad;
5145
if (__pyx_clineno) {
5146
#if PY_MAJOR_VERSION < 3
5147
py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
5149
py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
5153
#if PY_MAJOR_VERSION < 3
5154
py_funcname = PyString_FromString(funcname);
5156
py_funcname = PyUnicode_FromString(funcname);
5159
if (!py_funcname) goto bad;
5160
py_globals = PyModule_GetDict(__pyx_m);
5161
if (!py_globals) goto bad;
5162
py_code = PyCode_New(
5163
0, /*int argcount,*/
5164
#if PY_MAJOR_VERSION >= 3
5165
0, /*int kwonlyargcount,*/
5168
0, /*int stacksize,*/
5170
__pyx_empty_bytes, /*PyObject *code,*/
5171
__pyx_empty_tuple, /*PyObject *consts,*/
5172
__pyx_empty_tuple, /*PyObject *names,*/
5173
__pyx_empty_tuple, /*PyObject *varnames,*/
5174
__pyx_empty_tuple, /*PyObject *freevars,*/
5175
__pyx_empty_tuple, /*PyObject *cellvars,*/
5176
py_srcfile, /*PyObject *filename,*/
5177
py_funcname, /*PyObject *name,*/
5178
__pyx_lineno, /*int firstlineno,*/
5179
__pyx_empty_bytes /*PyObject *lnotab*/
5181
if (!py_code) goto bad;
5182
py_frame = PyFrame_New(
5183
PyThreadState_GET(), /*PyThreadState *tstate,*/
5184
py_code, /*PyCodeObject *code,*/
5185
py_globals, /*PyObject *globals,*/
5186
0 /*PyObject *locals*/
5188
if (!py_frame) goto bad;
5189
py_frame->f_lineno = __pyx_lineno;
5190
PyTraceBack_Here(py_frame);
5192
Py_XDECREF(py_srcfile);
5193
Py_XDECREF(py_funcname);
5194
Py_XDECREF(py_code);
5195
Py_XDECREF(py_frame);
5198
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
5200
#if PY_MAJOR_VERSION < 3
5201
if (t->is_unicode) {
5202
*t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
5203
} else if (t->intern) {
5204
*t->p = PyString_InternFromString(t->s);
5206
*t->p = PyString_FromStringAndSize(t->s, t->n - 1);
5208
#else /* Python 3+ has unicode identifiers */
5209
if (t->is_unicode | t->is_str) {
5211
*t->p = PyUnicode_InternFromString(t->s);
5212
} else if (t->encoding) {
5213
*t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
5215
*t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
5218
*t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
5228
/* Type Conversion Functions */
5230
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
5231
int is_true = x == Py_True;
5232
if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
5233
else return PyObject_IsTrue(x);
5236
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
5238
const char *name = NULL;
5239
PyObject *res = NULL;
5240
#if PY_VERSION_HEX < 0x03000000
5241
if (PyInt_Check(x) || PyLong_Check(x))
5243
if (PyLong_Check(x))
5245
return Py_INCREF(x), x;
5246
m = Py_TYPE(x)->tp_as_number;
5247
#if PY_VERSION_HEX < 0x03000000
5248
if (m && m->nb_int) {
5250
res = PyNumber_Int(x);
5252
else if (m && m->nb_long) {
5254
res = PyNumber_Long(x);
5257
if (m && m->nb_int) {
5259
res = PyNumber_Long(x);
5263
#if PY_VERSION_HEX < 0x03000000
5264
if (!PyInt_Check(res) && !PyLong_Check(res)) {
5266
if (!PyLong_Check(res)) {
5268
PyErr_Format(PyExc_TypeError,
5269
"__%s__ returned non-%s (type %.200s)",
5270
name, name, Py_TYPE(res)->tp_name);
5275
else if (!PyErr_Occurred()) {
5276
PyErr_SetString(PyExc_TypeError,
5277
"an integer is required");
5282
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
5284
PyObject* x = PyNumber_Index(b);
5286
ival = PyInt_AsSsize_t(x);
5291
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
5292
#if PY_VERSION_HEX < 0x02050000
5293
if (ival <= LONG_MAX)
5294
return PyInt_FromLong((long)ival);
5296
unsigned char *bytes = (unsigned char *) &ival;
5297
int one = 1; int little = (int)*(unsigned char*)&one;
5298
return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
5301
return PyInt_FromSize_t(ival);
5305
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
5306
unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
5307
if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
5309
} else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
5310
PyErr_SetString(PyExc_OverflowError,
5311
"value too large to convert to size_t");
5318
#endif /* Py_PYTHON_H */