Current Path : /usr/lib/python2.7/dist-packages/twisted/internet/iocpreactor/iocpsupport/ |
Current File : //usr/lib/python2.7/dist-packages/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c |
/* Generated by Cython 0.14.1 on Sat May 14 18:30:23 2011 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #else #include <stddef.h> /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif #ifndef __cdecl #define __cdecl #endif #ifndef __fastcall #define __fastcall #endif #endif #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #if PY_VERSION_HEX < 0x02040000 #define METH_COEXIST 0 #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) #define PyDict_Contains(d,o) PySequence_Contains(d,o) #endif #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) PyInt_AsLong(o) #define PyNumber_Index(o) PyNumber_Int(o) #define PyIndex_Check(o) PyNumber_Check(o) #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #endif #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) typedef struct { void *buf; PyObject *obj; Py_ssize_t len; Py_ssize_t itemsize; int readonly; int ndim; char *format; Py_ssize_t *shape; Py_ssize_t *strides; Py_ssize_t *suboffsets; void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 #define PyBUF_ND 0x0008 #define PyBUF_STRIDES (0x0010 | PyBUF_ND) #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #endif #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #endif #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type #define PyBytes_Check PyString_Check #define PyBytes_CheckExact PyString_CheckExact #define PyBytes_FromString PyString_FromString #define PyBytes_FromStringAndSize PyString_FromStringAndSize #define PyBytes_FromFormat PyString_FromFormat #define PyBytes_DecodeEscape PyString_DecodeEscape #define PyBytes_AsString PyString_AsString #define PyBytes_AsStringAndSize PyString_AsStringAndSize #define PyBytes_Size PyString_Size #define PyBytes_AS_STRING PyString_AS_STRING #define PyBytes_GET_SIZE PyString_GET_SIZE #define PyBytes_Repr PyString_Repr #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) #endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong #define PyInt_FromSize_t PyLong_FromSize_t #define PyInt_FromSsize_t PyLong_FromSsize_t #define PyInt_AsLong PyLong_AsLong #define PyInt_AS_LONG PyLong_AS_LONG #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) #else #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) #else #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) #else #define __Pyx_NAMESTR(n) (n) #define __Pyx_DOCSTR(n) (n) #endif #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES #endif #include <math.h> #define __PYX_HAVE_API__iocpsupport #include "io.h" #include "errno.h" #include "winsock2.h" #include "ws2tcpip.h" #include "windows.h" #include "python.h" #include "string.h" #include "winsock_pointers.h" #ifdef PYREX_WITHOUT_ASSERTIONS #define CYTHON_WITHOUT_ASSERTIONS #endif /* inline attribute */ #ifndef CYTHON_INLINE #if defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_INLINE inline #else #define CYTHON_INLINE #endif #endif /* unused attribute */ #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif # elif defined(__ICC) || defined(__INTEL_COMPILER) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif #endif 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*/ /* Type Conversion Predeclarations */ #define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #ifdef __GNUC__ /* Test for GCC > 2.95 */ #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else /* __GNUC__ > 2 ... */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; static const char *__pyx_f[] = { "iocpsupport.pyx", "acceptex.pxi", "connectex.pxi", "wsarecv.pxi", "wsasend.pxi", }; typedef int __pyx_t_11iocpsupport_size_t; typedef unsigned long __pyx_t_11iocpsupport_HANDLE; typedef unsigned long __pyx_t_11iocpsupport_SOCKET; typedef unsigned long __pyx_t_11iocpsupport_DWORD; typedef unsigned long __pyx_t_11iocpsupport_ULONG_PTR; typedef int __pyx_t_11iocpsupport_BOOL; /* Type declarations */ /* "iocpsupport.pyx":114 * # BOOL (*lpTransmitFile)(SOCKET s, HANDLE hFile, DWORD size, DWORD buffer_size, OVERLAPPED *ov, TRANSMIT_FILE_BUFFERS *buff, DWORD flags) * * cdef struct myOVERLAPPED: # <<<<<<<<<<<<<< * OVERLAPPED ov * PyObject *obj */ struct __pyx_t_11iocpsupport_myOVERLAPPED { OVERLAPPED ov; struct PyObject *obj; }; /* "iocpsupport.pyx":138 * setattr(self, k, v) * * cdef class CompletionPort: # <<<<<<<<<<<<<< * cdef HANDLE port * def __init__(self): */ struct __pyx_obj_11iocpsupport_CompletionPort { PyObject_HEAD __pyx_t_11iocpsupport_HANDLE port; }; #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); void (*DECREF)(void*, PyObject*, int); void (*GOTREF)(void*, PyObject*, int); void (*GIVEREF)(void*, PyObject*, int); void* (*SetupContext)(const char*, int, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; m = PyImport_ImportModule((char *)modname); if (!m) goto end; p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: Py_XDECREF(p); Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) #else #define __Pyx_RefNannySetupContext(name) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) #endif /* CYTHON_REFNANNY */ #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name); /*proto*/ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ static int __Pyx_EndUnpack(PyObject *, Py_ssize_t expected); /*proto*/ static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); /*proto*/ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; r = PyObject_GetItem(o, j); Py_DECREF(j); return r; } #define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_List_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { if (likely(o != Py_None)) { if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { PyObject *r = PyList_GET_ITEM(o, i); Py_INCREF(r); return r; } else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); Py_INCREF(r); return r; } } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Tuple_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { if (likely(o != Py_None)) { if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, i); Py_INCREF(r); return r; } else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); Py_INCREF(r); return r; } } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } #define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { PyObject *r; if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { r = PyList_GET_ITEM(o, i); Py_INCREF(r); } else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { r = PyTuple_GET_ITEM(o, i); Py_INCREF(r); } else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { r = PySequence_GetItem(o, i); } else { r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } return r; } static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */ static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/ static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, PyObject *modname); /*proto*/ #define __pyx_binding_PyCFunctionType_USED 1 typedef struct { PyCFunctionObject func; } __pyx_binding_PyCFunctionType_object; static PyTypeObject __pyx_binding_PyCFunctionType_type; static PyTypeObject *__pyx_binding_PyCFunctionType = NULL; static PyObject *__pyx_binding_PyCFunctionType_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module); /* proto */ #define __pyx_binding_PyCFunctionType_New(ml, self) __pyx_binding_PyCFunctionType_NewEx(ml, self, NULL) static int __pyx_binding_PyCFunctionType_init(void); /* proto */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); static void __Pyx_AddTraceback(const char *funcname); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from iocpsupport */ static PyTypeObject *__pyx_ptype_11iocpsupport_CompletionPort = 0; static struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_f_11iocpsupport_makeOV(void); /*proto*/ static void __pyx_f_11iocpsupport_raise_error(int, PyObject *); /*proto*/ static PyObject *__pyx_f_11iocpsupport__makesockaddr(struct sockaddr *, int); /*proto*/ static PyObject *__pyx_f_11iocpsupport_fillinetaddr(struct sockaddr_in *, PyObject *); /*proto*/ static int __pyx_f_11iocpsupport_getAddrFamily(__pyx_t_11iocpsupport_SOCKET); /*proto*/ #define __Pyx_MODULE_NAME "iocpsupport" static int __pyx_module_is_main_iocpsupport = 0; /* Implementation of iocpsupport */ static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_MemoryError; static PyObject *__pyx_builtin_WindowsError; static char __pyx_k_1[] = "CreateIoCompletionPort"; static char __pyx_k_2[] = "PostQueuedCompletionStatus"; static char __pyx_k_3[] = ":"; static char __pyx_k_5[] = "["; static char __pyx_k_6[] = "]"; static char __pyx_k_7[] = "invalid IP address"; static char __pyx_k_8[] = "ConnectEx is not available on this system"; static char __pyx_k_9[] = "unsupported address family"; static char __pyx_k_10[] = "second argument needs to be a list"; static char __pyx_k_11[] = "length of address length buffer needs to be sizeof(int)"; static char __pyx_k_12[] = "Failed to initialize Winsock function vectors"; static char __pyx_k__s[] = "s"; static char __pyx_k__buf[] = "buf"; static char __pyx_k__key[] = "key"; static char __pyx_k__len[] = "len"; static char __pyx_k__obj[] = "obj"; static char __pyx_k__addr[] = "addr"; static char __pyx_k__buff[] = "buff"; static char __pyx_k__port[] = "port"; static char __pyx_k__recv[] = "recv"; static char __pyx_k__self[] = "self"; static char __pyx_k__send[] = "send"; static char __pyx_k__Event[] = "Event"; static char __pyx_k__bytes[] = "bytes"; static char __pyx_k__flags[] = "flags"; static char __pyx_k__items[] = "items"; static char __pyx_k__owner[] = "owner"; static char __pyx_k__accept[] = "accept"; static char __pyx_k__handle[] = "handle"; static char __pyx_k__rsplit[] = "rsplit"; static char __pyx_k__s_addr[] = "s_addr"; static char __pyx_k__socket[] = "socket"; static char __pyx_k__connect[] = "connect"; static char __pyx_k__sa_data[] = "sa_data"; static char __pyx_k____init__[] = "__init__"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; static char __pyx_k__bufflist[] = "bufflist"; static char __pyx_k__callback[] = "callback"; static char __pyx_k__recvfrom[] = "recvfrom"; static char __pyx_k__sin_addr[] = "sin_addr"; static char __pyx_k__sin_port[] = "sin_port"; static char __pyx_k__accepting[] = "accepting"; static char __pyx_k__addr_buff[] = "addr_buff"; static char __pyx_k__listening[] = "listening"; static char __pyx_k__sa_family[] = "sa_family"; static char __pyx_k__sin6_port[] = "sin6_port"; static char __pyx_k__ValueError[] = "ValueError"; static char __pyx_k__getsockopt[] = "getsockopt"; static char __pyx_k__maxAddrLen[] = "maxAddrLen"; static char __pyx_k__MemoryError[] = "MemoryError"; static char __pyx_k__iocpsupport[] = "iocpsupport"; static char __pyx_k__WindowsError[] = "WindowsError"; static char __pyx_k__iMaxSockAddr[] = "iMaxSockAddr"; static char __pyx_k__makesockaddr[] = "makesockaddr"; static char __pyx_k__addr_len_buff[] = "addr_len_buff"; static char __pyx_k__have_connectex[] = "have_connectex"; static char __pyx_k__iAddressFamily[] = "iAddressFamily"; static char __pyx_k__get_accept_addrs[] = "get_accept_addrs"; static char __pyx_k__AllocateReadBuffer[] = "AllocateReadBuffer"; static char __pyx_k__WSAAddressToString[] = "WSAAddressToString"; static PyObject *__pyx_n_s_1; static PyObject *__pyx_kp_s_11; static PyObject *__pyx_kp_s_12; static PyObject *__pyx_n_s_2; static PyObject *__pyx_kp_s_3; static PyObject *__pyx_kp_s_5; static PyObject *__pyx_kp_s_6; static PyObject *__pyx_kp_s_7; static PyObject *__pyx_kp_s_8; static PyObject *__pyx_kp_s_9; static PyObject *__pyx_n_s__AllocateReadBuffer; static PyObject *__pyx_n_s__Event; static PyObject *__pyx_n_s__MemoryError; static PyObject *__pyx_n_s__ValueError; static PyObject *__pyx_n_s__WSAAddressToString; static PyObject *__pyx_n_s__WindowsError; static PyObject *__pyx_n_s____init__; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s__accept; static PyObject *__pyx_n_s__accepting; static PyObject *__pyx_n_s__addr; static PyObject *__pyx_n_s__addr_buff; static PyObject *__pyx_n_s__addr_len_buff; static PyObject *__pyx_n_s__buf; static PyObject *__pyx_n_s__buff; static PyObject *__pyx_n_s__bufflist; static PyObject *__pyx_n_s__bytes; static PyObject *__pyx_n_s__callback; static PyObject *__pyx_n_s__connect; static PyObject *__pyx_n_s__flags; static PyObject *__pyx_n_s__get_accept_addrs; static PyObject *__pyx_n_s__getsockopt; static PyObject *__pyx_n_s__handle; static PyObject *__pyx_n_s__have_connectex; static PyObject *__pyx_n_s__iAddressFamily; static PyObject *__pyx_n_s__iMaxSockAddr; static PyObject *__pyx_n_s__iocpsupport; static PyObject *__pyx_n_s__items; static PyObject *__pyx_n_s__key; static PyObject *__pyx_n_s__len; static PyObject *__pyx_n_s__listening; static PyObject *__pyx_n_s__makesockaddr; static PyObject *__pyx_n_s__maxAddrLen; static PyObject *__pyx_n_s__obj; static PyObject *__pyx_n_s__owner; static PyObject *__pyx_n_s__port; static PyObject *__pyx_n_s__recv; static PyObject *__pyx_n_s__recvfrom; static PyObject *__pyx_n_s__rsplit; static PyObject *__pyx_n_s__s; static PyObject *__pyx_n_s__s_addr; static PyObject *__pyx_n_s__sa_data; static PyObject *__pyx_n_s__sa_family; static PyObject *__pyx_n_s__self; static PyObject *__pyx_n_s__send; static PyObject *__pyx_n_s__sin6_port; static PyObject *__pyx_n_s__sin_addr; static PyObject *__pyx_n_s__sin_port; static PyObject *__pyx_n_s__socket; static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; static PyObject *__pyx_k_tuple_4; /* "iocpsupport.pyx":118 * PyObject *obj * * cdef myOVERLAPPED *makeOV() except NULL: # <<<<<<<<<<<<<< * cdef myOVERLAPPED *res * res = <myOVERLAPPED *>PyMem_Malloc(sizeof(myOVERLAPPED)) */ static struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_f_11iocpsupport_makeOV(void) { struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_res; struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_r; void *__pyx_t_1; int __pyx_t_2; __Pyx_RefNannySetupContext("makeOV"); /* "iocpsupport.pyx":120 * cdef myOVERLAPPED *makeOV() except NULL: * cdef myOVERLAPPED *res * res = <myOVERLAPPED *>PyMem_Malloc(sizeof(myOVERLAPPED)) # <<<<<<<<<<<<<< * if not res: * raise MemoryError */ __pyx_t_1 = PyMem_Malloc((sizeof(struct __pyx_t_11iocpsupport_myOVERLAPPED))); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_res = ((struct __pyx_t_11iocpsupport_myOVERLAPPED *)__pyx_t_1); /* "iocpsupport.pyx":121 * cdef myOVERLAPPED *res * res = <myOVERLAPPED *>PyMem_Malloc(sizeof(myOVERLAPPED)) * if not res: # <<<<<<<<<<<<<< * raise MemoryError * memset(res, 0, sizeof(myOVERLAPPED)) */ __pyx_t_2 = (!(__pyx_v_res != 0)); if (__pyx_t_2) { /* "iocpsupport.pyx":122 * res = <myOVERLAPPED *>PyMem_Malloc(sizeof(myOVERLAPPED)) * if not res: * raise MemoryError # <<<<<<<<<<<<<< * memset(res, 0, sizeof(myOVERLAPPED)) * return res */ PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; /* "iocpsupport.pyx":123 * if not res: * raise MemoryError * memset(res, 0, sizeof(myOVERLAPPED)) # <<<<<<<<<<<<<< * return res * */ memset(__pyx_v_res, 0, (sizeof(struct __pyx_t_11iocpsupport_myOVERLAPPED))); /* "iocpsupport.pyx":124 * raise MemoryError * memset(res, 0, sizeof(myOVERLAPPED)) * return res # <<<<<<<<<<<<<< * * cdef void raise_error(int err, object message) except *: */ __pyx_r = __pyx_v_res; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("iocpsupport.makeOV"); __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "iocpsupport.pyx":126 * return res * * cdef void raise_error(int err, object message) except *: # <<<<<<<<<<<<<< * if not err: * err = GetLastError() */ static void __pyx_f_11iocpsupport_raise_error(int __pyx_v_err, PyObject *__pyx_v_message) { int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("raise_error"); /* "iocpsupport.pyx":127 * * cdef void raise_error(int err, object message) except *: * if not err: # <<<<<<<<<<<<<< * err = GetLastError() * raise WindowsError(message, err) */ __pyx_t_1 = (!__pyx_v_err); if (__pyx_t_1) { /* "iocpsupport.pyx":128 * cdef void raise_error(int err, object message) except *: * if not err: * err = GetLastError() # <<<<<<<<<<<<<< * raise WindowsError(message, err) * */ __pyx_v_err = GetLastError(); goto __pyx_L3; } __pyx_L3:; /* "iocpsupport.pyx":129 * if not err: * err = GetLastError() * raise WindowsError(message, err) # <<<<<<<<<<<<<< * * class Event: */ __pyx_t_2 = PyInt_FromLong(__pyx_v_err); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_INCREF(__pyx_v_message); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_message); __Pyx_GIVEREF(__pyx_v_message); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; __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 = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("iocpsupport.raise_error"); __pyx_L0:; __Pyx_RefNannyFinishContext(); } /* "iocpsupport.pyx":132 * * class Event: * def __init__(self, callback, owner, **kw): # <<<<<<<<<<<<<< * self.callback = callback * self.owner = owner */ static PyObject *__pyx_pf_11iocpsupport_5Event___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_11iocpsupport_5Event___init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pf_11iocpsupport_5Event___init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; static PyObject *__pyx_pf_11iocpsupport_5Event___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; PyObject *__pyx_v_callback = 0; PyObject *__pyx_v_owner = 0; PyObject *__pyx_v_kw = 0; PyObject *__pyx_v_k; PyObject *__pyx_v_v; PyObject *__pyx_r = NULL; Py_ssize_t __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; int __pyx_t_7; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__callback,&__pyx_n_s__owner,0}; __Pyx_RefNannySetupContext("__init__"); __pyx_self = __pyx_self; __pyx_v_kw = PyDict_New(); if (unlikely(!__pyx_v_kw)) return NULL; __Pyx_GOTREF(__pyx_v_kw); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[3] = {0,0,0}; switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__owner); if (likely(values[2])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { 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 = 132; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_self = values[0]; __pyx_v_callback = values[1]; __pyx_v_owner = values[2]; } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; } else { __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); __pyx_v_callback = PyTuple_GET_ITEM(__pyx_args, 1); __pyx_v_owner = PyTuple_GET_ITEM(__pyx_args, 2); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_DECREF(__pyx_v_kw); __Pyx_AddTraceback("iocpsupport.Event.__init__"); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_v_k = Py_None; __Pyx_INCREF(Py_None); __pyx_v_v = Py_None; __Pyx_INCREF(Py_None); /* "iocpsupport.pyx":133 * class Event: * def __init__(self, callback, owner, **kw): * self.callback = callback # <<<<<<<<<<<<<< * self.owner = owner * for k, v in kw.items(): */ if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__callback, __pyx_v_callback) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "iocpsupport.pyx":134 * def __init__(self, callback, owner, **kw): * self.callback = callback * self.owner = owner # <<<<<<<<<<<<<< * for k, v in kw.items(): * setattr(self, k, v) */ if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__owner, __pyx_v_owner) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "iocpsupport.pyx":135 * self.callback = callback * self.owner = owner * for k, v in kw.items(): # <<<<<<<<<<<<<< * setattr(self, k, v) * */ if (unlikely(__pyx_v_kw == Py_None)) { PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'items'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_2 = PyDict_Items(__pyx_v_kw); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) { __pyx_t_1 = 0; __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); } else { __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; for (;;) { if (likely(PyList_CheckExact(__pyx_t_3))) { if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break; __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++; } else if (likely(PyTuple_CheckExact(__pyx_t_3))) { if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break; __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++; } else { __pyx_t_2 = PyIter_Next(__pyx_t_3); if (!__pyx_t_2) { if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } __Pyx_GOTREF(__pyx_t_2); } if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) { PyObject* tuple = __pyx_t_2; __pyx_t_4 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_v_k); __pyx_v_k = __pyx_t_4; __pyx_t_4 = 0; __Pyx_DECREF(__pyx_v_v); __pyx_v_v = __pyx_t_5; __pyx_t_5 = 0; } else { __pyx_t_6 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); if (__Pyx_EndUnpack(__pyx_t_6, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_v_k); __pyx_v_k = __pyx_t_4; __pyx_t_4 = 0; __Pyx_DECREF(__pyx_v_v); __pyx_v_v = __pyx_t_5; __pyx_t_5 = 0; } /* "iocpsupport.pyx":136 * self.owner = owner * for k, v in kw.items(): * setattr(self, k, v) # <<<<<<<<<<<<<< * * cdef class CompletionPort: */ __pyx_t_2 = __pyx_v_self; __Pyx_INCREF(__pyx_t_2); __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 = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("iocpsupport.Event.__init__"); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(__pyx_v_kw); __Pyx_DECREF(__pyx_v_k); __Pyx_DECREF(__pyx_v_v); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "iocpsupport.pyx":140 * cdef class CompletionPort: * cdef HANDLE port * def __init__(self): # <<<<<<<<<<<<<< * cdef HANDLE res * res = CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0) */ static int __pyx_pf_11iocpsupport_14CompletionPort___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pf_11iocpsupport_14CompletionPort___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { __pyx_t_11iocpsupport_HANDLE __pyx_v_res; int __pyx_r; int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("__init__"); if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; /* "iocpsupport.pyx":142 * def __init__(self): * cdef HANDLE res * res = CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0) # <<<<<<<<<<<<<< * if not res: * raise_error(0, 'CreateIoCompletionPort') */ __pyx_v_res = CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0); /* "iocpsupport.pyx":143 * cdef HANDLE res * res = CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0) * if not res: # <<<<<<<<<<<<<< * raise_error(0, 'CreateIoCompletionPort') * self.port = res */ __pyx_t_1 = (!__pyx_v_res); if (__pyx_t_1) { /* "iocpsupport.pyx":144 * res = CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0) * if not res: * raise_error(0, 'CreateIoCompletionPort') # <<<<<<<<<<<<<< * self.port = res * */ __pyx_t_2 = 0; __pyx_t_3 = ((PyObject *)__pyx_n_s_1); __Pyx_INCREF(__pyx_t_3); __pyx_f_11iocpsupport_raise_error(__pyx_t_2, __pyx_t_3); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L5; } __pyx_L5:; /* "iocpsupport.pyx":145 * if not res: * raise_error(0, 'CreateIoCompletionPort') * self.port = res # <<<<<<<<<<<<<< * * def addHandle(self, long handle, long key=0): */ ((struct __pyx_obj_11iocpsupport_CompletionPort *)__pyx_v_self)->port = __pyx_v_res; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("iocpsupport.CompletionPort.__init__"); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "iocpsupport.pyx":147 * self.port = res * * def addHandle(self, long handle, long key=0): # <<<<<<<<<<<<<< * cdef HANDLE res * res = CreateIoCompletionPort(handle, self.port, key, 0) */ static PyObject *__pyx_pf_11iocpsupport_14CompletionPort_1addHandle(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pf_11iocpsupport_14CompletionPort_1addHandle(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { long __pyx_v_handle; long __pyx_v_key; __pyx_t_11iocpsupport_HANDLE __pyx_v_res; PyObject *__pyx_r = NULL; int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__handle,&__pyx_n_s__key,0}; __Pyx_RefNannySetupContext("addHandle"); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[2] = {0,0}; switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__handle); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key); if (value) { values[1] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "addHandle") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_handle = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_handle == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L3_error;} if (values[1]) { __pyx_v_key = __Pyx_PyInt_AsLong(values[1]); if (unlikely((__pyx_v_key == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_key = ((long)0); } } else { __pyx_v_key = ((long)0); switch (PyTuple_GET_SIZE(__pyx_args)) { 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 = 147; __pyx_clineno = __LINE__; goto __pyx_L3_error;} 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 = 147; __pyx_clineno = __LINE__; goto __pyx_L3_error;} break; default: goto __pyx_L5_argtuple_error; } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("addHandle", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("iocpsupport.CompletionPort.addHandle"); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; /* "iocpsupport.pyx":149 * def addHandle(self, long handle, long key=0): * cdef HANDLE res * res = CreateIoCompletionPort(handle, self.port, key, 0) # <<<<<<<<<<<<<< * if not res: * raise_error(0, 'CreateIoCompletionPort') */ __pyx_v_res = CreateIoCompletionPort(__pyx_v_handle, ((struct __pyx_obj_11iocpsupport_CompletionPort *)__pyx_v_self)->port, __pyx_v_key, 0); /* "iocpsupport.pyx":150 * cdef HANDLE res * res = CreateIoCompletionPort(handle, self.port, key, 0) * if not res: # <<<<<<<<<<<<<< * raise_error(0, 'CreateIoCompletionPort') * */ __pyx_t_1 = (!__pyx_v_res); if (__pyx_t_1) { /* "iocpsupport.pyx":151 * res = CreateIoCompletionPort(handle, self.port, key, 0) * if not res: * raise_error(0, 'CreateIoCompletionPort') # <<<<<<<<<<<<<< * * def getEvent(self, long timeout): */ __pyx_t_2 = 0; __pyx_t_3 = ((PyObject *)__pyx_n_s_1); __Pyx_INCREF(__pyx_t_3); __pyx_f_11iocpsupport_raise_error(__pyx_t_2, __pyx_t_3); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L6; } __pyx_L6:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("iocpsupport.CompletionPort.addHandle"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "iocpsupport.pyx":153 * raise_error(0, 'CreateIoCompletionPort') * * def getEvent(self, long timeout): # <<<<<<<<<<<<<< * cdef PyThreadState *_save * cdef unsigned long bytes, key, rc */ static PyObject *__pyx_pf_11iocpsupport_14CompletionPort_2getEvent(PyObject *__pyx_v_self, PyObject *__pyx_arg_timeout); /*proto*/ static PyObject *__pyx_pf_11iocpsupport_14CompletionPort_2getEvent(PyObject *__pyx_v_self, PyObject *__pyx_arg_timeout) { long __pyx_v_timeout; struct PyThreadState *__pyx_v__save; unsigned long __pyx_v_bytes; unsigned long __pyx_v_key; unsigned long __pyx_v_rc; struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov; PyObject *__pyx_v_obj; PyObject *__pyx_r = NULL; int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("getEvent"); assert(__pyx_arg_timeout); { __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 = 153; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("iocpsupport.CompletionPort.getEvent"); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_v_obj = Py_None; __Pyx_INCREF(Py_None); /* "iocpsupport.pyx":158 * cdef myOVERLAPPED *ov * * _save = PyEval_SaveThread() # <<<<<<<<<<<<<< * rc = GetQueuedCompletionStatus(self.port, &bytes, &key, <OVERLAPPED **>&ov, timeout) * PyEval_RestoreThread(_save) */ __pyx_v__save = PyEval_SaveThread(); /* "iocpsupport.pyx":159 * * _save = PyEval_SaveThread() * rc = GetQueuedCompletionStatus(self.port, &bytes, &key, <OVERLAPPED **>&ov, timeout) # <<<<<<<<<<<<<< * PyEval_RestoreThread(_save) * */ __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); /* "iocpsupport.pyx":160 * _save = PyEval_SaveThread() * rc = GetQueuedCompletionStatus(self.port, &bytes, &key, <OVERLAPPED **>&ov, timeout) * PyEval_RestoreThread(_save) # <<<<<<<<<<<<<< * * if not rc: */ PyEval_RestoreThread(__pyx_v__save); /* "iocpsupport.pyx":162 * PyEval_RestoreThread(_save) * * if not rc: # <<<<<<<<<<<<<< * rc = GetLastError() * else: */ __pyx_t_1 = (!__pyx_v_rc); if (__pyx_t_1) { /* "iocpsupport.pyx":163 * * if not rc: * rc = GetLastError() # <<<<<<<<<<<<<< * else: * rc = 0 */ __pyx_v_rc = GetLastError(); goto __pyx_L5; } /*else*/ { /* "iocpsupport.pyx":165 * rc = GetLastError() * else: * rc = 0 # <<<<<<<<<<<<<< * * obj = None */ __pyx_v_rc = 0; } __pyx_L5:; /* "iocpsupport.pyx":167 * rc = 0 * * obj = None # <<<<<<<<<<<<<< * if ov: * if ov.obj: */ __Pyx_INCREF(Py_None); __Pyx_DECREF(__pyx_v_obj); __pyx_v_obj = Py_None; /* "iocpsupport.pyx":168 * * obj = None * if ov: # <<<<<<<<<<<<<< * if ov.obj: * obj = <object>ov.obj */ __pyx_t_1 = (__pyx_v_ov != 0); if (__pyx_t_1) { /* "iocpsupport.pyx":169 * obj = None * if ov: * if ov.obj: # <<<<<<<<<<<<<< * obj = <object>ov.obj * Py_DECREF(obj) # we are stealing a reference here */ __pyx_t_1 = (__pyx_v_ov->obj != 0); if (__pyx_t_1) { /* "iocpsupport.pyx":170 * if ov: * if ov.obj: * obj = <object>ov.obj # <<<<<<<<<<<<<< * Py_DECREF(obj) # we are stealing a reference here * PyMem_Free(ov) */ __Pyx_INCREF(((PyObject *)__pyx_v_ov->obj)); __Pyx_DECREF(__pyx_v_obj); __pyx_v_obj = ((PyObject *)__pyx_v_ov->obj); /* "iocpsupport.pyx":171 * if ov.obj: * obj = <object>ov.obj * Py_DECREF(obj) # we are stealing a reference here # <<<<<<<<<<<<<< * PyMem_Free(ov) * */ Py_DECREF(__pyx_v_obj); goto __pyx_L7; } __pyx_L7:; /* "iocpsupport.pyx":172 * obj = <object>ov.obj * Py_DECREF(obj) # we are stealing a reference here * PyMem_Free(ov) # <<<<<<<<<<<<<< * * return (rc, bytes, key, obj) */ PyMem_Free(__pyx_v_ov); goto __pyx_L6; } __pyx_L6:; /* "iocpsupport.pyx":174 * PyMem_Free(ov) * * return (rc, bytes, key, obj) # <<<<<<<<<<<<<< * * def postEvent(self, unsigned long bytes, unsigned long key, obj): */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_rc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_bytes); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_key); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_obj); PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_obj); __Pyx_GIVEREF(__pyx_v_obj); __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_r = ((PyObject *)__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("iocpsupport.CompletionPort.getEvent"); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(__pyx_v_obj); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "iocpsupport.pyx":176 * return (rc, bytes, key, obj) * * def postEvent(self, unsigned long bytes, unsigned long key, obj): # <<<<<<<<<<<<<< * cdef myOVERLAPPED *ov * cdef unsigned long rc */ static PyObject *__pyx_pf_11iocpsupport_14CompletionPort_3postEvent(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pf_11iocpsupport_14CompletionPort_3postEvent(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { unsigned long __pyx_v_bytes; unsigned long __pyx_v_key; PyObject *__pyx_v_obj = 0; struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov; unsigned long __pyx_v_rc; PyObject *__pyx_r = NULL; int __pyx_t_1; struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_t_2; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__bytes,&__pyx_n_s__key,&__pyx_n_s__obj,0}; __Pyx_RefNannySetupContext("postEvent"); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[3] = {0,0,0}; switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bytes); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("postEvent", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__obj); if (likely(values[2])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("postEvent", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "postEvent") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __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 = 176; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __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 = 176; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_obj = values[2]; } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; } else { __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 = 176; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __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 = 176; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_obj = PyTuple_GET_ITEM(__pyx_args, 2); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("postEvent", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("iocpsupport.CompletionPort.postEvent"); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; /* "iocpsupport.pyx":180 * cdef unsigned long rc * * if obj is not None: # <<<<<<<<<<<<<< * ov = makeOV() * Py_INCREF(obj) # give ov its own reference to obj */ __pyx_t_1 = (__pyx_v_obj != Py_None); if (__pyx_t_1) { /* "iocpsupport.pyx":181 * * if obj is not None: * ov = makeOV() # <<<<<<<<<<<<<< * Py_INCREF(obj) # give ov its own reference to obj * ov.obj = <PyObject *>obj */ __pyx_t_2 = __pyx_f_11iocpsupport_makeOV(); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_ov = __pyx_t_2; /* "iocpsupport.pyx":182 * if obj is not None: * ov = makeOV() * Py_INCREF(obj) # give ov its own reference to obj # <<<<<<<<<<<<<< * ov.obj = <PyObject *>obj * else: */ __pyx_t_3 = __pyx_v_obj; __Pyx_INCREF(__pyx_t_3); Py_INCREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "iocpsupport.pyx":183 * ov = makeOV() * Py_INCREF(obj) # give ov its own reference to obj * ov.obj = <PyObject *>obj # <<<<<<<<<<<<<< * else: * ov = NULL */ __pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj); goto __pyx_L6; } /*else*/ { /* "iocpsupport.pyx":185 * ov.obj = <PyObject *>obj * else: * ov = NULL # <<<<<<<<<<<<<< * * rc = PostQueuedCompletionStatus(self.port, bytes, key, <OVERLAPPED *>ov) */ __pyx_v_ov = NULL; } __pyx_L6:; /* "iocpsupport.pyx":187 * ov = NULL * * rc = PostQueuedCompletionStatus(self.port, bytes, key, <OVERLAPPED *>ov) # <<<<<<<<<<<<<< * if not rc: * raise_error(0, 'PostQueuedCompletionStatus') */ __pyx_v_rc = PostQueuedCompletionStatus(((struct __pyx_obj_11iocpsupport_CompletionPort *)__pyx_v_self)->port, __pyx_v_bytes, __pyx_v_key, ((OVERLAPPED *)__pyx_v_ov)); /* "iocpsupport.pyx":188 * * rc = PostQueuedCompletionStatus(self.port, bytes, key, <OVERLAPPED *>ov) * if not rc: # <<<<<<<<<<<<<< * raise_error(0, 'PostQueuedCompletionStatus') * */ __pyx_t_1 = (!__pyx_v_rc); if (__pyx_t_1) { /* "iocpsupport.pyx":189 * rc = PostQueuedCompletionStatus(self.port, bytes, key, <OVERLAPPED *>ov) * if not rc: * raise_error(0, 'PostQueuedCompletionStatus') # <<<<<<<<<<<<<< * * def __del__(self): */ __pyx_t_4 = 0; __pyx_t_3 = ((PyObject *)__pyx_n_s_2); __Pyx_INCREF(__pyx_t_3); __pyx_f_11iocpsupport_raise_error(__pyx_t_4, __pyx_t_3); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L7; } __pyx_L7:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("iocpsupport.CompletionPort.postEvent"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "iocpsupport.pyx":191 * raise_error(0, 'PostQueuedCompletionStatus') * * def __del__(self): # <<<<<<<<<<<<<< * CloseHandle(self.port) * */ static PyObject *__pyx_pf_11iocpsupport_14CompletionPort_4__del__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pf_11iocpsupport_14CompletionPort_4__del__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = NULL; __Pyx_RefNannySetupContext("__del__"); /* "iocpsupport.pyx":192 * * def __del__(self): * CloseHandle(self.port) # <<<<<<<<<<<<<< * * def makesockaddr(object buff): */ CloseHandle(((struct __pyx_obj_11iocpsupport_CompletionPort *)__pyx_v_self)->port); __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "iocpsupport.pyx":194 * CloseHandle(self.port) * * def makesockaddr(object buff): # <<<<<<<<<<<<<< * cdef void *mem_buffer * cdef int size */ static PyObject *__pyx_pf_11iocpsupport_makesockaddr(PyObject *__pyx_self, PyObject *__pyx_v_buff); /*proto*/ static PyMethodDef __pyx_mdef_11iocpsupport_makesockaddr = {__Pyx_NAMESTR("makesockaddr"), (PyCFunction)__pyx_pf_11iocpsupport_makesockaddr, METH_O, __Pyx_DOCSTR(0)}; static PyObject *__pyx_pf_11iocpsupport_makesockaddr(PyObject *__pyx_self, PyObject *__pyx_v_buff) { void *__pyx_v_mem_buffer; int __pyx_v_size; PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; int __pyx_t_2; __Pyx_RefNannySetupContext("makesockaddr"); __pyx_self = __pyx_self; /* "iocpsupport.pyx":198 * cdef int size * * PyObject_AsReadBuffer(buff, &mem_buffer, &size) # <<<<<<<<<<<<<< * # XXX: this should really return the address family as well * return _makesockaddr(<sockaddr *>mem_buffer, size) */ __pyx_t_1 = __pyx_v_buff; __Pyx_INCREF(__pyx_t_1); __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 = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "iocpsupport.pyx":200 * PyObject_AsReadBuffer(buff, &mem_buffer, &size) * # XXX: this should really return the address family as well * return _makesockaddr(<sockaddr *>mem_buffer, size) # <<<<<<<<<<<<<< * * cdef object _makesockaddr(sockaddr *addr, int len): */ __Pyx_XDECREF(__pyx_r); __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 = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("iocpsupport.makesockaddr"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "iocpsupport.pyx":202 * return _makesockaddr(<sockaddr *>mem_buffer, size) * * cdef object _makesockaddr(sockaddr *addr, int len): # <<<<<<<<<<<<<< * cdef sockaddr_in *sin * cdef sockaddr_in6 *sin6 */ static PyObject *__pyx_f_11iocpsupport__makesockaddr(struct sockaddr *__pyx_v_addr, int __pyx_v_len) { struct sockaddr_in *__pyx_v_sin; struct sockaddr_in6 *__pyx_v_sin6; char __pyx_v_buff[256]; int __pyx_v_rc; __pyx_t_11iocpsupport_DWORD __pyx_v_buff_size; PyObject *__pyx_v_host; unsigned short __pyx_v_sa_port; PyObject *__pyx_v_port; PyObject *__pyx_r = NULL; int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; unsigned short __pyx_t_6; PyObject *__pyx_t_7 = NULL; __Pyx_RefNannySetupContext("_makesockaddr"); __pyx_v_host = Py_None; __Pyx_INCREF(Py_None); __pyx_v_port = Py_None; __Pyx_INCREF(Py_None); /* "iocpsupport.pyx":207 * cdef char buff[256] * cdef int rc * cdef DWORD buff_size = sizeof(buff) # <<<<<<<<<<<<<< * if not len: * return None */ __pyx_v_buff_size = (sizeof(__pyx_v_buff)); /* "iocpsupport.pyx":208 * cdef int rc * cdef DWORD buff_size = sizeof(buff) * if not len: # <<<<<<<<<<<<<< * return None * if addr.sa_family == AF_INET: */ __pyx_t_1 = (!__pyx_v_len); if (__pyx_t_1) { /* "iocpsupport.pyx":209 * cdef DWORD buff_size = sizeof(buff) * if not len: * return None # <<<<<<<<<<<<<< * if addr.sa_family == AF_INET: * sin = <sockaddr_in *>addr */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_None); __pyx_r = Py_None; goto __pyx_L0; goto __pyx_L3; } __pyx_L3:; /* "iocpsupport.pyx":213 * sin = <sockaddr_in *>addr * return PyString_FromString(inet_ntoa(sin.sin_addr)), ntohs(sin.sin_port) * elif addr.sa_family == AF_INET6: # <<<<<<<<<<<<<< * sin6 = <sockaddr_in6 *>addr * rc = WSAAddressToStringA(addr, sizeof(sockaddr_in6), NULL, buff, &buff_size) */ switch (__pyx_v_addr->sa_family) { /* "iocpsupport.pyx":210 * if not len: * return None * if addr.sa_family == AF_INET: # <<<<<<<<<<<<<< * sin = <sockaddr_in *>addr * return PyString_FromString(inet_ntoa(sin.sin_addr)), ntohs(sin.sin_port) */ case AF_INET: /* "iocpsupport.pyx":211 * return None * if addr.sa_family == AF_INET: * sin = <sockaddr_in *>addr # <<<<<<<<<<<<<< * return PyString_FromString(inet_ntoa(sin.sin_addr)), ntohs(sin.sin_port) * elif addr.sa_family == AF_INET6: */ __pyx_v_sin = ((struct sockaddr_in *)__pyx_v_addr); /* "iocpsupport.pyx":212 * if addr.sa_family == AF_INET: * sin = <sockaddr_in *>addr * return PyString_FromString(inet_ntoa(sin.sin_addr)), ntohs(sin.sin_port) # <<<<<<<<<<<<<< * elif addr.sa_family == AF_INET6: * sin6 = <sockaddr_in6 *>addr */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyString_FromString(inet_ntoa(__pyx_v_sin->sin_addr)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyInt_FromLong(ntohs(__pyx_v_sin->sin_port)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_r = ((PyObject *)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L0; break; /* "iocpsupport.pyx":213 * sin = <sockaddr_in *>addr * return PyString_FromString(inet_ntoa(sin.sin_addr)), ntohs(sin.sin_port) * elif addr.sa_family == AF_INET6: # <<<<<<<<<<<<<< * sin6 = <sockaddr_in6 *>addr * rc = WSAAddressToStringA(addr, sizeof(sockaddr_in6), NULL, buff, &buff_size) */ case AF_INET6: /* "iocpsupport.pyx":214 * return PyString_FromString(inet_ntoa(sin.sin_addr)), ntohs(sin.sin_port) * elif addr.sa_family == AF_INET6: * sin6 = <sockaddr_in6 *>addr # <<<<<<<<<<<<<< * rc = WSAAddressToStringA(addr, sizeof(sockaddr_in6), NULL, buff, &buff_size) * if rc == SOCKET_ERROR: */ __pyx_v_sin6 = ((struct sockaddr_in6 *)__pyx_v_addr); /* "iocpsupport.pyx":215 * elif addr.sa_family == AF_INET6: * sin6 = <sockaddr_in6 *>addr * rc = WSAAddressToStringA(addr, sizeof(sockaddr_in6), NULL, buff, &buff_size) # <<<<<<<<<<<<<< * if rc == SOCKET_ERROR: * raise_error(0, 'WSAAddressToString') */ __pyx_v_rc = WSAAddressToStringA(__pyx_v_addr, (sizeof(struct sockaddr_in6)), NULL, __pyx_v_buff, (&__pyx_v_buff_size)); /* "iocpsupport.pyx":216 * sin6 = <sockaddr_in6 *>addr * rc = WSAAddressToStringA(addr, sizeof(sockaddr_in6), NULL, buff, &buff_size) * if rc == SOCKET_ERROR: # <<<<<<<<<<<<<< * raise_error(0, 'WSAAddressToString') * host, sa_port = PyString_FromString(buff), ntohs(sin6.sin6_port) */ __pyx_t_1 = (__pyx_v_rc == SOCKET_ERROR); if (__pyx_t_1) { /* "iocpsupport.pyx":217 * rc = WSAAddressToStringA(addr, sizeof(sockaddr_in6), NULL, buff, &buff_size) * if rc == SOCKET_ERROR: * raise_error(0, 'WSAAddressToString') # <<<<<<<<<<<<<< * host, sa_port = PyString_FromString(buff), ntohs(sin6.sin6_port) * host, port = host.rsplit(':', 1) */ __pyx_t_5 = 0; __pyx_t_4 = ((PyObject *)__pyx_n_s__WSAAddressToString); __Pyx_INCREF(__pyx_t_4); __pyx_f_11iocpsupport_raise_error(__pyx_t_5, __pyx_t_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L4; } __pyx_L4:; /* "iocpsupport.pyx":218 * if rc == SOCKET_ERROR: * raise_error(0, 'WSAAddressToString') * host, sa_port = PyString_FromString(buff), ntohs(sin6.sin6_port) # <<<<<<<<<<<<<< * host, port = host.rsplit(':', 1) * port = int(port) */ __pyx_t_4 = PyString_FromString(__pyx_v_buff); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = ntohs(__pyx_v_sin6->sin6_port); __Pyx_DECREF(__pyx_v_host); __pyx_v_host = __pyx_t_4; __pyx_t_4 = 0; __pyx_v_sa_port = __pyx_t_6; /* "iocpsupport.pyx":219 * raise_error(0, 'WSAAddressToString') * host, sa_port = PyString_FromString(buff), ntohs(sin6.sin6_port) * host, port = host.rsplit(':', 1) # <<<<<<<<<<<<<< * port = int(port) * assert host[0] == '[' */ __pyx_t_4 = PyObject_GetAttr(__pyx_v_host, __pyx_n_s__rsplit); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 2)) { PyObject* tuple = __pyx_t_3; __pyx_t_4 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_host); __pyx_v_host = __pyx_t_4; __pyx_t_4 = 0; __Pyx_DECREF(__pyx_v_port); __pyx_v_port = __pyx_t_2; __pyx_t_2 = 0; } else { __pyx_t_7 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_7, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_7, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (__Pyx_EndUnpack(__pyx_t_7, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_v_host); __pyx_v_host = __pyx_t_4; __pyx_t_4 = 0; __Pyx_DECREF(__pyx_v_port); __pyx_v_port = __pyx_t_2; __pyx_t_2 = 0; } /* "iocpsupport.pyx":220 * host, sa_port = PyString_FromString(buff), ntohs(sin6.sin6_port) * host, port = host.rsplit(':', 1) * port = int(port) # <<<<<<<<<<<<<< * assert host[0] == '[' * assert host[-1] == ']' */ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_INCREF(__pyx_v_port); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_port); __Pyx_GIVEREF(__pyx_v_port); __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_port); __pyx_v_port = __pyx_t_2; __pyx_t_2 = 0; /* "iocpsupport.pyx":221 * host, port = host.rsplit(':', 1) * port = int(port) * assert host[0] == '[' # <<<<<<<<<<<<<< * assert host[-1] == ']' * assert port == sa_port */ #ifndef CYTHON_WITHOUT_ASSERTIONS __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_host, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_kp_s_5), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "iocpsupport.pyx":222 * port = int(port) * assert host[0] == '[' * assert host[-1] == ']' # <<<<<<<<<<<<<< * assert port == sa_port * return host[1:-1], port */ #ifndef CYTHON_WITHOUT_ASSERTIONS __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_host, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_kp_s_6), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "iocpsupport.pyx":223 * assert host[0] == '[' * assert host[-1] == ']' * assert port == sa_port # <<<<<<<<<<<<<< * return host[1:-1], port * else: */ #ifndef CYTHON_WITHOUT_ASSERTIONS __pyx_t_2 = PyInt_FromLong(__pyx_v_sa_port); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_RichCompare(__pyx_v_port, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "iocpsupport.pyx":224 * assert host[-1] == ']' * assert port == sa_port * return host[1:-1], port # <<<<<<<<<<<<<< * else: * return PyString_FromStringAndSize(addr.sa_data, sizeof(addr.sa_data)) */ __Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PySequence_GetSlice(__pyx_v_host, 1, -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_port); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_port); __Pyx_GIVEREF(__pyx_v_port); __pyx_t_3 = 0; __pyx_r = ((PyObject *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; break; default: /* "iocpsupport.pyx":226 * return host[1:-1], port * else: * return PyString_FromStringAndSize(addr.sa_data, sizeof(addr.sa_data)) # <<<<<<<<<<<<<< * * cdef object fillinetaddr(sockaddr_in *dest, object addr): */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyString_FromStringAndSize(__pyx_v_addr->sa_data, (sizeof(__pyx_v_addr->sa_data))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; break; } __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("iocpsupport._makesockaddr"); __pyx_r = 0; __pyx_L0:; __Pyx_DECREF(__pyx_v_host); __Pyx_DECREF(__pyx_v_port); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "iocpsupport.pyx":228 * return PyString_FromStringAndSize(addr.sa_data, sizeof(addr.sa_data)) * * cdef object fillinetaddr(sockaddr_in *dest, object addr): # <<<<<<<<<<<<<< * cdef unsigned short port * cdef unsigned long res */ static PyObject *__pyx_f_11iocpsupport_fillinetaddr(struct sockaddr_in *__pyx_v_dest, PyObject *__pyx_v_addr) { unsigned short __pyx_v_port; unsigned long __pyx_v_res; char *__pyx_v_hoststr; PyObject *__pyx_v_host; PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; unsigned short __pyx_t_3; PyObject *__pyx_t_4 = NULL; char *__pyx_t_5; int __pyx_t_6; __Pyx_RefNannySetupContext("fillinetaddr"); __pyx_v_host = Py_None; __Pyx_INCREF(Py_None); /* "iocpsupport.pyx":232 * cdef unsigned long res * cdef char *hoststr * host, port = addr # <<<<<<<<<<<<<< * * hoststr = PyString_AsString(host) */ if (PyTuple_CheckExact(__pyx_v_addr) && likely(PyTuple_GET_SIZE(__pyx_v_addr) == 2)) { PyObject* tuple = __pyx_v_addr; __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_2); __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 = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_v_host); __pyx_v_host = __pyx_t_1; __pyx_t_1 = 0; __pyx_v_port = __pyx_t_3; } else { __pyx_t_4 = PyObject_GetIter(__pyx_v_addr); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_4, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_4, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __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 = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_EndUnpack(__pyx_t_4, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_v_host); __pyx_v_host = __pyx_t_1; __pyx_t_1 = 0; __pyx_v_port = __pyx_t_3; } /* "iocpsupport.pyx":234 * host, port = addr * * hoststr = PyString_AsString(host) # <<<<<<<<<<<<<< * res = inet_addr(hoststr) * if res == INADDR_ANY: */ __pyx_t_5 = PyString_AsString(__pyx_v_host); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_hoststr = __pyx_t_5; /* "iocpsupport.pyx":235 * * hoststr = PyString_AsString(host) * res = inet_addr(hoststr) # <<<<<<<<<<<<<< * if res == INADDR_ANY: * raise ValueError, 'invalid IP address' */ __pyx_v_res = inet_addr(__pyx_v_hoststr); /* "iocpsupport.pyx":236 * hoststr = PyString_AsString(host) * res = inet_addr(hoststr) * if res == INADDR_ANY: # <<<<<<<<<<<<<< * raise ValueError, 'invalid IP address' * dest.sin_addr.s_addr = res */ __pyx_t_6 = (__pyx_v_res == INADDR_ANY); if (__pyx_t_6) { /* "iocpsupport.pyx":237 * res = inet_addr(hoststr) * if res == INADDR_ANY: * raise ValueError, 'invalid IP address' # <<<<<<<<<<<<<< * dest.sin_addr.s_addr = res * */ __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_7), 0); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; /* "iocpsupport.pyx":238 * if res == INADDR_ANY: * raise ValueError, 'invalid IP address' * dest.sin_addr.s_addr = res # <<<<<<<<<<<<<< * * dest.sin_port = htons(port) */ __pyx_v_dest->sin_addr.s_addr = __pyx_v_res; /* "iocpsupport.pyx":240 * dest.sin_addr.s_addr = res * * dest.sin_port = htons(port) # <<<<<<<<<<<<<< * * def AllocateReadBuffer(int size): */ __pyx_v_dest->sin_port = htons(__pyx_v_port); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("iocpsupport.fillinetaddr"); __pyx_r = 0; __pyx_L0:; __Pyx_DECREF(__pyx_v_host); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "iocpsupport.pyx":242 * dest.sin_port = htons(port) * * def AllocateReadBuffer(int size): # <<<<<<<<<<<<<< * return PyBuffer_New(size) * */ static PyObject *__pyx_pf_11iocpsupport_1AllocateReadBuffer(PyObject *__pyx_self, PyObject *__pyx_arg_size); /*proto*/ static PyMethodDef __pyx_mdef_11iocpsupport_1AllocateReadBuffer = {__Pyx_NAMESTR("AllocateReadBuffer"), (PyCFunction)__pyx_pf_11iocpsupport_1AllocateReadBuffer, METH_O, __Pyx_DOCSTR(0)}; static PyObject *__pyx_pf_11iocpsupport_1AllocateReadBuffer(PyObject *__pyx_self, PyObject *__pyx_arg_size) { int __pyx_v_size; PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("AllocateReadBuffer"); __pyx_self = __pyx_self; assert(__pyx_arg_size); { __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 = 242; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("iocpsupport.AllocateReadBuffer"); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; /* "iocpsupport.pyx":243 * * def AllocateReadBuffer(int size): * return PyBuffer_New(size) # <<<<<<<<<<<<<< * * def maxAddrLen(long s): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyBuffer_New(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("iocpsupport.AllocateReadBuffer"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "iocpsupport.pyx":245 * return PyBuffer_New(size) * * def maxAddrLen(long s): # <<<<<<<<<<<<<< * cdef WSAPROTOCOL_INFO wsa_pi * cdef int size, rc */ static PyObject *__pyx_pf_11iocpsupport_2maxAddrLen(PyObject *__pyx_self, PyObject *__pyx_arg_s); /*proto*/ static PyMethodDef __pyx_mdef_11iocpsupport_2maxAddrLen = {__Pyx_NAMESTR("maxAddrLen"), (PyCFunction)__pyx_pf_11iocpsupport_2maxAddrLen, METH_O, __Pyx_DOCSTR(0)}; static PyObject *__pyx_pf_11iocpsupport_2maxAddrLen(PyObject *__pyx_self, PyObject *__pyx_arg_s) { long __pyx_v_s; WSAPROTOCOL_INFO __pyx_v_wsa_pi; int __pyx_v_size; int __pyx_v_rc; PyObject *__pyx_r = NULL; int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("maxAddrLen"); __pyx_self = __pyx_self; assert(__pyx_arg_s); { __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 = 245; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("iocpsupport.maxAddrLen"); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; /* "iocpsupport.pyx":249 * cdef int size, rc * * size = sizeof(wsa_pi) # <<<<<<<<<<<<<< * rc = getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, <char *>&wsa_pi, &size) * if rc == SOCKET_ERROR: */ __pyx_v_size = (sizeof(__pyx_v_wsa_pi)); /* "iocpsupport.pyx":250 * * size = sizeof(wsa_pi) * rc = getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, <char *>&wsa_pi, &size) # <<<<<<<<<<<<<< * if rc == SOCKET_ERROR: * raise_error(WSAGetLastError(), 'getsockopt') */ __pyx_v_rc = getsockopt(__pyx_v_s, SOL_SOCKET, SO_PROTOCOL_INFO, ((char *)(&__pyx_v_wsa_pi)), (&__pyx_v_size)); /* "iocpsupport.pyx":251 * size = sizeof(wsa_pi) * rc = getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, <char *>&wsa_pi, &size) * if rc == SOCKET_ERROR: # <<<<<<<<<<<<<< * raise_error(WSAGetLastError(), 'getsockopt') * return wsa_pi.iMaxSockAddr */ __pyx_t_1 = (__pyx_v_rc == SOCKET_ERROR); if (__pyx_t_1) { /* "iocpsupport.pyx":252 * rc = getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, <char *>&wsa_pi, &size) * if rc == SOCKET_ERROR: * raise_error(WSAGetLastError(), 'getsockopt') # <<<<<<<<<<<<<< * return wsa_pi.iMaxSockAddr * */ __pyx_t_2 = WSAGetLastError(); __pyx_t_3 = ((PyObject *)__pyx_n_s__getsockopt); __Pyx_INCREF(__pyx_t_3); __pyx_f_11iocpsupport_raise_error(__pyx_t_2, __pyx_t_3); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L5; } __pyx_L5:; /* "iocpsupport.pyx":253 * if rc == SOCKET_ERROR: * raise_error(WSAGetLastError(), 'getsockopt') * return wsa_pi.iMaxSockAddr # <<<<<<<<<<<<<< * * cdef int getAddrFamily(SOCKET s) except *: */ __Pyx_XDECREF(__pyx_r); __pyx_t_3 = PyInt_FromLong(__pyx_v_wsa_pi.iMaxSockAddr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("iocpsupport.maxAddrLen"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "iocpsupport.pyx":255 * return wsa_pi.iMaxSockAddr * * cdef int getAddrFamily(SOCKET s) except *: # <<<<<<<<<<<<<< * cdef WSAPROTOCOL_INFO wsa_pi * cdef int size, rc */ static int __pyx_f_11iocpsupport_getAddrFamily(__pyx_t_11iocpsupport_SOCKET __pyx_v_s) { WSAPROTOCOL_INFO __pyx_v_wsa_pi; int __pyx_v_size; int __pyx_v_rc; int __pyx_r; int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("getAddrFamily"); /* "iocpsupport.pyx":259 * cdef int size, rc * * size = sizeof(wsa_pi) # <<<<<<<<<<<<<< * rc = getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, <char *>&wsa_pi, &size) * if rc == SOCKET_ERROR: */ __pyx_v_size = (sizeof(__pyx_v_wsa_pi)); /* "iocpsupport.pyx":260 * * size = sizeof(wsa_pi) * rc = getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, <char *>&wsa_pi, &size) # <<<<<<<<<<<<<< * if rc == SOCKET_ERROR: * raise_error(WSAGetLastError(), 'getsockopt') */ __pyx_v_rc = getsockopt(__pyx_v_s, SOL_SOCKET, SO_PROTOCOL_INFO, ((char *)(&__pyx_v_wsa_pi)), (&__pyx_v_size)); /* "iocpsupport.pyx":261 * size = sizeof(wsa_pi) * rc = getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, <char *>&wsa_pi, &size) * if rc == SOCKET_ERROR: # <<<<<<<<<<<<<< * raise_error(WSAGetLastError(), 'getsockopt') * return wsa_pi.iAddressFamily */ __pyx_t_1 = (__pyx_v_rc == SOCKET_ERROR); if (__pyx_t_1) { /* "iocpsupport.pyx":262 * rc = getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, <char *>&wsa_pi, &size) * if rc == SOCKET_ERROR: * raise_error(WSAGetLastError(), 'getsockopt') # <<<<<<<<<<<<<< * return wsa_pi.iAddressFamily * */ __pyx_t_2 = WSAGetLastError(); __pyx_t_3 = ((PyObject *)__pyx_n_s__getsockopt); __Pyx_INCREF(__pyx_t_3); __pyx_f_11iocpsupport_raise_error(__pyx_t_2, __pyx_t_3); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L3; } __pyx_L3:; /* "iocpsupport.pyx":263 * if rc == SOCKET_ERROR: * raise_error(WSAGetLastError(), 'getsockopt') * return wsa_pi.iAddressFamily # <<<<<<<<<<<<<< * * import socket # for WSAStartup */ __pyx_r = __pyx_v_wsa_pi.iAddressFamily; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("iocpsupport.getAddrFamily"); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":5 * * * def accept(long listening, long accepting, object buff, object obj): # <<<<<<<<<<<<<< * """ * CAUTION: unlike system AcceptEx(), this function returns 0 on success */ static PyObject *__pyx_pf_11iocpsupport_3accept(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_11iocpsupport_3accept[] = "\n CAUTION: unlike system AcceptEx(), this function returns 0 on success\n "; static PyMethodDef __pyx_mdef_11iocpsupport_3accept = {__Pyx_NAMESTR("accept"), (PyCFunction)__pyx_pf_11iocpsupport_3accept, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_11iocpsupport_3accept)}; static PyObject *__pyx_pf_11iocpsupport_3accept(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { long __pyx_v_listening; long __pyx_v_accepting; PyObject *__pyx_v_buff = 0; PyObject *__pyx_v_obj = 0; unsigned long __pyx_v_bytes; int __pyx_v_size; int __pyx_v_rc; void *__pyx_v_mem_buffer; struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov; PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; int __pyx_t_2; struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_t_3; int __pyx_t_4; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__listening,&__pyx_n_s__accepting,&__pyx_n_s__buff,&__pyx_n_s__obj,0}; __Pyx_RefNannySetupContext("accept"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[4] = {0,0,0,0}; switch (PyTuple_GET_SIZE(__pyx_args)) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__listening); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__accepting); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("accept", 1, 4, 4, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buff); if (likely(values[2])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("accept", 1, 4, 4, 2); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__obj); if (likely(values[3])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("accept", 1, 4, 4, 3); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { 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;} } __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;} __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;} __pyx_v_buff = values[2]; __pyx_v_obj = values[3]; } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; } else { __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;} __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;} __pyx_v_buff = PyTuple_GET_ITEM(__pyx_args, 2); __pyx_v_obj = PyTuple_GET_ITEM(__pyx_args, 3); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __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;} __pyx_L3_error:; __Pyx_AddTraceback("iocpsupport.accept"); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":14 * cdef myOVERLAPPED *ov * * PyObject_AsWriteBuffer(buff, &mem_buffer, &size) # <<<<<<<<<<<<<< * * ov = makeOV() */ __pyx_t_1 = __pyx_v_buff; __Pyx_INCREF(__pyx_t_1); __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;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":16 * PyObject_AsWriteBuffer(buff, &mem_buffer, &size) * * ov = makeOV() # <<<<<<<<<<<<<< * if obj is not None: * ov.obj = <PyObject *>obj */ __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;} __pyx_v_ov = __pyx_t_3; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":17 * * ov = makeOV() * if obj is not None: # <<<<<<<<<<<<<< * ov.obj = <PyObject *>obj * */ __pyx_t_4 = (__pyx_v_obj != Py_None); if (__pyx_t_4) { /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":18 * ov = makeOV() * if obj is not None: * ov.obj = <PyObject *>obj # <<<<<<<<<<<<<< * * rc = lpAcceptEx(listening, accepting, mem_buffer, 0, size / 2, size / 2, */ __pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj); goto __pyx_L6; } __pyx_L6:; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":21 * * rc = lpAcceptEx(listening, accepting, mem_buffer, 0, size / 2, size / 2, * &bytes, <OVERLAPPED *>ov) # <<<<<<<<<<<<<< * if not rc: * rc = WSAGetLastError() */ __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)); /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":22 * rc = lpAcceptEx(listening, accepting, mem_buffer, 0, size / 2, size / 2, * &bytes, <OVERLAPPED *>ov) * if not rc: # <<<<<<<<<<<<<< * rc = WSAGetLastError() * if rc != ERROR_IO_PENDING: */ __pyx_t_4 = (!__pyx_v_rc); if (__pyx_t_4) { /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":23 * &bytes, <OVERLAPPED *>ov) * if not rc: * rc = WSAGetLastError() # <<<<<<<<<<<<<< * if rc != ERROR_IO_PENDING: * return rc */ __pyx_v_rc = WSAGetLastError(); /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":24 * if not rc: * rc = WSAGetLastError() * if rc != ERROR_IO_PENDING: # <<<<<<<<<<<<<< * return rc * */ __pyx_t_4 = (__pyx_v_rc != ERROR_IO_PENDING); if (__pyx_t_4) { /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":25 * rc = WSAGetLastError() * if rc != ERROR_IO_PENDING: * return rc # <<<<<<<<<<<<<< * * # operation is in progress */ __Pyx_XDECREF(__pyx_r); __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;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; goto __pyx_L8; } __pyx_L8:; goto __pyx_L7; } __pyx_L7:; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":28 * * # operation is in progress * Py_XINCREF(obj) # <<<<<<<<<<<<<< * return 0 * */ __pyx_t_1 = __pyx_v_obj; __Pyx_INCREF(__pyx_t_1); Py_XINCREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":29 * # operation is in progress * Py_XINCREF(obj) * return 0 # <<<<<<<<<<<<<< * * def get_accept_addrs(long s, object buff): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_int_0); __pyx_r = __pyx_int_0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("iocpsupport.accept"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":31 * return 0 * * def get_accept_addrs(long s, object buff): # <<<<<<<<<<<<<< * cdef WSAPROTOCOL_INFO wsa_pi * cdef int size, locallen, remotelen */ static PyObject *__pyx_pf_11iocpsupport_4get_accept_addrs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ 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)}; static PyObject *__pyx_pf_11iocpsupport_4get_accept_addrs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { long __pyx_v_s; PyObject *__pyx_v_buff = 0; int __pyx_v_size; int __pyx_v_locallen; int __pyx_v_remotelen; void *__pyx_v_mem_buffer; struct sockaddr *__pyx_v_localaddr; struct sockaddr *__pyx_v_remoteaddr; PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__s,&__pyx_n_s__buff,0}; __Pyx_RefNannySetupContext("get_accept_addrs"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[2] = {0,0}; switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__s); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buff); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("get_accept_addrs", 1, 2, 2, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { 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;} } __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;} __pyx_v_buff = values[1]; } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { __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;} __pyx_v_buff = PyTuple_GET_ITEM(__pyx_args, 1); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __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;} __pyx_L3_error:; __Pyx_AddTraceback("iocpsupport.get_accept_addrs"); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":37 * cdef sockaddr *localaddr, *remoteaddr * * PyObject_AsReadBuffer(buff, &mem_buffer, &size) # <<<<<<<<<<<<<< * * lpGetAcceptExSockaddrs(mem_buffer, 0, size / 2, size / 2, &localaddr, &locallen, &remoteaddr, &remotelen) */ __pyx_t_1 = __pyx_v_buff; __Pyx_INCREF(__pyx_t_1); __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;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":39 * PyObject_AsReadBuffer(buff, &mem_buffer, &size) * * lpGetAcceptExSockaddrs(mem_buffer, 0, size / 2, size / 2, &localaddr, &locallen, &remoteaddr, &remotelen) # <<<<<<<<<<<<<< * return remoteaddr.sa_family, _makesockaddr(localaddr, locallen), _makesockaddr(remoteaddr, remotelen) * */ 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)); /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":40 * * lpGetAcceptExSockaddrs(mem_buffer, 0, size / 2, size / 2, &localaddr, &locallen, &remoteaddr, &remotelen) * return remoteaddr.sa_family, _makesockaddr(localaddr, locallen), _makesockaddr(remoteaddr, remotelen) # <<<<<<<<<<<<<< * */ __Pyx_XDECREF(__pyx_r); __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;} __Pyx_GOTREF(__pyx_t_1); __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;} __Pyx_GOTREF(__pyx_t_3); __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;} __Pyx_GOTREF(__pyx_t_4); __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;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_r = ((PyObject *)__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("iocpsupport.get_accept_addrs"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":5 * * * def connect(long s, object addr, object obj): # <<<<<<<<<<<<<< * """ * CAUTION: unlike system ConnectEx(), this function returns 0 on success */ static PyObject *__pyx_pf_11iocpsupport_5connect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_11iocpsupport_5connect[] = "\n CAUTION: unlike system ConnectEx(), this function returns 0 on success\n "; static PyMethodDef __pyx_mdef_11iocpsupport_5connect = {__Pyx_NAMESTR("connect"), (PyCFunction)__pyx_pf_11iocpsupport_5connect, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_11iocpsupport_5connect)}; static PyObject *__pyx_pf_11iocpsupport_5connect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { long __pyx_v_s; PyObject *__pyx_v_addr = 0; PyObject *__pyx_v_obj = 0; int __pyx_v_family; int __pyx_v_rc; struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov; struct sockaddr __pyx_v_name; PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; struct sockaddr_in *__pyx_t_5; PyObject *__pyx_t_6 = NULL; struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_t_7; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__s,&__pyx_n_s__addr,&__pyx_n_s__obj,0}; __Pyx_RefNannySetupContext("connect"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[3] = {0,0,0}; switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__s); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__addr); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("connect", 1, 3, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__obj); if (likely(values[2])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("connect", 1, 3, 3, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { 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;} } __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;} __pyx_v_addr = values[1]; __pyx_v_obj = values[2]; } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; } else { __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;} __pyx_v_addr = PyTuple_GET_ITEM(__pyx_args, 1); __pyx_v_obj = PyTuple_GET_ITEM(__pyx_args, 2); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __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;} __pyx_L3_error:; __Pyx_AddTraceback("iocpsupport.connect"); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":13 * cdef sockaddr name * * if not have_connectex: # <<<<<<<<<<<<<< * raise ValueError, 'ConnectEx is not available on this system' * */ __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;} __Pyx_GOTREF(__pyx_t_1); __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;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = (!__pyx_t_2); if (__pyx_t_3) { /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":14 * * if not have_connectex: * raise ValueError, 'ConnectEx is not available on this system' # <<<<<<<<<<<<<< * * family = getAddrFamily(s) */ __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_8), 0); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":16 * raise ValueError, 'ConnectEx is not available on this system' * * family = getAddrFamily(s) # <<<<<<<<<<<<<< * if family == AF_INET: * fillinetaddr(<sockaddr_in *>&name, addr) */ __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;} __pyx_v_family = __pyx_t_4; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":17 * * family = getAddrFamily(s) * if family == AF_INET: # <<<<<<<<<<<<<< * fillinetaddr(<sockaddr_in *>&name, addr) * else: */ __pyx_t_3 = (__pyx_v_family == AF_INET); if (__pyx_t_3) { /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":18 * family = getAddrFamily(s) * if family == AF_INET: * fillinetaddr(<sockaddr_in *>&name, addr) # <<<<<<<<<<<<<< * else: * raise ValueError, 'unsupported address family' */ __pyx_t_5 = ((struct sockaddr_in *)(&__pyx_v_name)); __pyx_t_1 = __pyx_v_addr; __Pyx_INCREF(__pyx_t_1); __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;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L7; } /*else*/ { /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":20 * fillinetaddr(<sockaddr_in *>&name, addr) * else: * raise ValueError, 'unsupported address family' # <<<<<<<<<<<<<< * name.sa_family = family * */ __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_9), 0); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L7:; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":21 * else: * raise ValueError, 'unsupported address family' * name.sa_family = family # <<<<<<<<<<<<<< * * ov = makeOV() */ __pyx_v_name.sa_family = __pyx_v_family; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":23 * name.sa_family = family * * ov = makeOV() # <<<<<<<<<<<<<< * if obj is not None: * ov.obj = <PyObject *>obj */ __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;} __pyx_v_ov = __pyx_t_7; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":24 * * ov = makeOV() * if obj is not None: # <<<<<<<<<<<<<< * ov.obj = <PyObject *>obj * */ __pyx_t_3 = (__pyx_v_obj != Py_None); if (__pyx_t_3) { /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":25 * ov = makeOV() * if obj is not None: * ov.obj = <PyObject *>obj # <<<<<<<<<<<<<< * * rc = lpConnectEx(s, &name, sizeof(name), NULL, 0, NULL, <OVERLAPPED *>ov) */ __pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj); goto __pyx_L8; } __pyx_L8:; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":27 * ov.obj = <PyObject *>obj * * rc = lpConnectEx(s, &name, sizeof(name), NULL, 0, NULL, <OVERLAPPED *>ov) # <<<<<<<<<<<<<< * * if not rc: */ __pyx_v_rc = lpConnectEx(__pyx_v_s, (&__pyx_v_name), (sizeof(__pyx_v_name)), NULL, 0, NULL, ((OVERLAPPED *)__pyx_v_ov)); /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":29 * rc = lpConnectEx(s, &name, sizeof(name), NULL, 0, NULL, <OVERLAPPED *>ov) * * if not rc: # <<<<<<<<<<<<<< * rc = WSAGetLastError() * if rc != ERROR_IO_PENDING: */ __pyx_t_3 = (!__pyx_v_rc); if (__pyx_t_3) { /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":30 * * if not rc: * rc = WSAGetLastError() # <<<<<<<<<<<<<< * if rc != ERROR_IO_PENDING: * return rc */ __pyx_v_rc = WSAGetLastError(); /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":31 * if not rc: * rc = WSAGetLastError() * if rc != ERROR_IO_PENDING: # <<<<<<<<<<<<<< * return rc * */ __pyx_t_3 = (__pyx_v_rc != ERROR_IO_PENDING); if (__pyx_t_3) { /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":32 * rc = WSAGetLastError() * if rc != ERROR_IO_PENDING: * return rc # <<<<<<<<<<<<<< * * # operation is in progress */ __Pyx_XDECREF(__pyx_r); __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;} __Pyx_GOTREF(__pyx_t_6); __pyx_r = __pyx_t_6; __pyx_t_6 = 0; goto __pyx_L0; goto __pyx_L10; } __pyx_L10:; goto __pyx_L9; } __pyx_L9:; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":35 * * # operation is in progress * Py_XINCREF(obj) # <<<<<<<<<<<<<< * return 0 * */ __pyx_t_6 = __pyx_v_obj; __Pyx_INCREF(__pyx_t_6); Py_XINCREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":36 * # operation is in progress * Py_XINCREF(obj) * return 0 # <<<<<<<<<<<<<< * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_int_0); __pyx_r = __pyx_int_0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("iocpsupport.connect"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":5 * * * def recv(long s, object bufflist, object obj, unsigned long flags = 0): # <<<<<<<<<<<<<< * cdef int rc, buffcount, i, res * cdef myOVERLAPPED *ov */ static PyObject *__pyx_pf_11iocpsupport_6recv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_11iocpsupport_6recv = {__Pyx_NAMESTR("recv"), (PyCFunction)__pyx_pf_11iocpsupport_6recv, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; static PyObject *__pyx_pf_11iocpsupport_6recv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { long __pyx_v_s; PyObject *__pyx_v_bufflist = 0; PyObject *__pyx_v_obj = 0; unsigned long __pyx_v_flags; int __pyx_v_rc; int __pyx_v_buffcount; int __pyx_v_i; struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov; WSABUF *__pyx_v_ws_buf; unsigned long __pyx_v_bytes; struct PyObject **__pyx_v_buffers; PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; void *__pyx_t_3; int __pyx_t_4; int __pyx_t_5; struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_t_6; int __pyx_t_7; PyObject *__pyx_t_8 = NULL; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__s,&__pyx_n_s__bufflist,&__pyx_n_s__obj,&__pyx_n_s__flags,0}; __Pyx_RefNannySetupContext("recv"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[4] = {0,0,0,0}; switch (PyTuple_GET_SIZE(__pyx_args)) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__s); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bufflist); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("recv", 0, 3, 4, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__obj); if (likely(values[2])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("recv", 0, 3, 4, 2); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags); if (value) { values[3] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { 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;} } __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;} __pyx_v_bufflist = values[1]; __pyx_v_obj = values[2]; if (values[3]) { __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;} } else { __pyx_v_flags = ((unsigned long)0); } } else { __pyx_v_flags = ((unsigned long)0); switch (PyTuple_GET_SIZE(__pyx_args)) { case 4: __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;} case 3: __pyx_v_obj = PyTuple_GET_ITEM(__pyx_args, 2); __pyx_v_bufflist = PyTuple_GET_ITEM(__pyx_args, 1); __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;} break; default: goto __pyx_L5_argtuple_error; } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __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;} __pyx_L3_error:; __Pyx_AddTraceback("iocpsupport.recv"); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __Pyx_INCREF(__pyx_v_bufflist); /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":12 * cdef PyObject **buffers * * bufflist = PySequence_Fast(bufflist, 'second argument needs to be a list') # <<<<<<<<<<<<<< * buffcount = PySequence_Fast_GET_SIZE(bufflist) * buffers = PySequence_Fast_ITEMS(bufflist) */ __pyx_t_1 = __pyx_v_bufflist; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = PySequence_Fast(__pyx_t_1, __pyx_k_10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_v_bufflist); __pyx_v_bufflist = __pyx_t_2; __pyx_t_2 = 0; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":13 * * bufflist = PySequence_Fast(bufflist, 'second argument needs to be a list') * buffcount = PySequence_Fast_GET_SIZE(bufflist) # <<<<<<<<<<<<<< * buffers = PySequence_Fast_ITEMS(bufflist) * */ __pyx_t_2 = __pyx_v_bufflist; __Pyx_INCREF(__pyx_t_2); __pyx_v_buffcount = PySequence_Fast_GET_SIZE(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":14 * bufflist = PySequence_Fast(bufflist, 'second argument needs to be a list') * buffcount = PySequence_Fast_GET_SIZE(bufflist) * buffers = PySequence_Fast_ITEMS(bufflist) # <<<<<<<<<<<<<< * * ws_buf = <WSABUF *>PyMem_Malloc(buffcount*sizeof(WSABUF)) */ __pyx_t_2 = __pyx_v_bufflist; __Pyx_INCREF(__pyx_t_2); __pyx_v_buffers = PySequence_Fast_ITEMS(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":16 * buffers = PySequence_Fast_ITEMS(bufflist) * * ws_buf = <WSABUF *>PyMem_Malloc(buffcount*sizeof(WSABUF)) # <<<<<<<<<<<<<< * * try: */ __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;} __pyx_v_ws_buf = ((WSABUF *)__pyx_t_3); /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":18 * ws_buf = <WSABUF *>PyMem_Malloc(buffcount*sizeof(WSABUF)) * * try: # <<<<<<<<<<<<<< * for i from 0 <= i < buffcount: * PyObject_AsWriteBuffer(<object>buffers[i], <void **>&ws_buf[i].buf, <int *>&ws_buf[i].len) */ /*try:*/ { /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":19 * * try: * for i from 0 <= i < buffcount: # <<<<<<<<<<<<<< * PyObject_AsWriteBuffer(<object>buffers[i], <void **>&ws_buf[i].buf, <int *>&ws_buf[i].len) * */ __pyx_t_4 = __pyx_v_buffcount; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_4; __pyx_v_i++) { /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":20 * try: * for i from 0 <= i < buffcount: * PyObject_AsWriteBuffer(<object>buffers[i], <void **>&ws_buf[i].buf, <int *>&ws_buf[i].len) # <<<<<<<<<<<<<< * * ov = makeOV() */ __pyx_t_2 = ((PyObject *)(__pyx_v_buffers[__pyx_v_i])); __Pyx_INCREF(__pyx_t_2); __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;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":22 * PyObject_AsWriteBuffer(<object>buffers[i], <void **>&ws_buf[i].buf, <int *>&ws_buf[i].len) * * ov = makeOV() # <<<<<<<<<<<<<< * if obj is not None: * ov.obj = <PyObject *>obj */ __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;} __pyx_v_ov = __pyx_t_6; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":23 * * ov = makeOV() * if obj is not None: # <<<<<<<<<<<<<< * ov.obj = <PyObject *>obj * */ __pyx_t_7 = (__pyx_v_obj != Py_None); if (__pyx_t_7) { /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":24 * ov = makeOV() * if obj is not None: * ov.obj = <PyObject *>obj # <<<<<<<<<<<<<< * * rc = WSARecv(s, ws_buf, buffcount, &bytes, &flags, <OVERLAPPED *>ov, NULL) */ __pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj); goto __pyx_L11; } __pyx_L11:; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":26 * ov.obj = <PyObject *>obj * * rc = WSARecv(s, ws_buf, buffcount, &bytes, &flags, <OVERLAPPED *>ov, NULL) # <<<<<<<<<<<<<< * * if rc == SOCKET_ERROR: */ __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); /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":28 * rc = WSARecv(s, ws_buf, buffcount, &bytes, &flags, <OVERLAPPED *>ov, NULL) * * if rc == SOCKET_ERROR: # <<<<<<<<<<<<<< * rc = WSAGetLastError() * if rc != ERROR_IO_PENDING: */ __pyx_t_7 = (__pyx_v_rc == SOCKET_ERROR); if (__pyx_t_7) { /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":29 * * if rc == SOCKET_ERROR: * rc = WSAGetLastError() # <<<<<<<<<<<<<< * if rc != ERROR_IO_PENDING: * return rc, 0 */ __pyx_v_rc = WSAGetLastError(); /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":30 * if rc == SOCKET_ERROR: * rc = WSAGetLastError() * if rc != ERROR_IO_PENDING: # <<<<<<<<<<<<<< * return rc, 0 * */ __pyx_t_7 = (__pyx_v_rc != ERROR_IO_PENDING); if (__pyx_t_7) { /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":31 * rc = WSAGetLastError() * if rc != ERROR_IO_PENDING: * return rc, 0 # <<<<<<<<<<<<<< * * Py_XINCREF(obj) */ __Pyx_XDECREF(__pyx_r); __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;} __Pyx_GOTREF(__pyx_t_2); __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;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __pyx_t_2 = 0; __pyx_r = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L6; goto __pyx_L13; } __pyx_L13:; goto __pyx_L12; } __pyx_L12:; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":33 * return rc, 0 * * Py_XINCREF(obj) # <<<<<<<<<<<<<< * return rc, bytes * finally: */ __pyx_t_1 = __pyx_v_obj; __Pyx_INCREF(__pyx_t_1); Py_XINCREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":34 * * Py_XINCREF(obj) * return rc, bytes # <<<<<<<<<<<<<< * finally: * PyMem_Free(ws_buf) */ __Pyx_XDECREF(__pyx_r); __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;} __Pyx_GOTREF(__pyx_t_1); __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;} __Pyx_GOTREF(__pyx_t_2); __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;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_r = ((PyObject *)__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L6; } /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":36 * return rc, bytes * finally: * PyMem_Free(ws_buf) # <<<<<<<<<<<<<< * * def recvfrom(long s, object buff, object addr_buff, object addr_len_buff, object obj, unsigned long flags = 0): */ /*finally:*/ { int __pyx_why; PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb; int __pyx_exc_lineno; __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0; __pyx_why = 0; goto __pyx_L8; __pyx_L6: __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0; __pyx_why = 3; goto __pyx_L8; __pyx_L7: { __pyx_why = 4; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb); __pyx_exc_lineno = __pyx_lineno; goto __pyx_L8; } __pyx_L8:; PyMem_Free(__pyx_v_ws_buf); switch (__pyx_why) { case 3: goto __pyx_L0; case 4: { __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb); __pyx_lineno = __pyx_exc_lineno; __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; goto __pyx_L1_error; } } } __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("iocpsupport.recv"); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(__pyx_v_bufflist); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":38 * PyMem_Free(ws_buf) * * def recvfrom(long s, object buff, object addr_buff, object addr_len_buff, object obj, unsigned long flags = 0): # <<<<<<<<<<<<<< * cdef int rc, c_addr_buff_len, c_addr_len_buff_len * cdef myOVERLAPPED *ov */ static PyObject *__pyx_pf_11iocpsupport_7recvfrom(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_11iocpsupport_7recvfrom = {__Pyx_NAMESTR("recvfrom"), (PyCFunction)__pyx_pf_11iocpsupport_7recvfrom, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; static PyObject *__pyx_pf_11iocpsupport_7recvfrom(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { long __pyx_v_s; PyObject *__pyx_v_buff = 0; PyObject *__pyx_v_addr_buff = 0; PyObject *__pyx_v_addr_len_buff = 0; PyObject *__pyx_v_obj = 0; unsigned long __pyx_v_flags; int __pyx_v_rc; int __pyx_v_c_addr_buff_len; int __pyx_v_c_addr_len_buff_len; struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov; WSABUF __pyx_v_ws_buf; unsigned long __pyx_v_bytes; struct sockaddr *__pyx_v_c_addr_buff; int *__pyx_v_c_addr_len_buff; PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; int __pyx_t_2; int __pyx_t_3; struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_t_4; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; 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}; __Pyx_RefNannySetupContext("recvfrom"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[6] = {0,0,0,0,0,0}; switch (PyTuple_GET_SIZE(__pyx_args)) { case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__s); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buff); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("recvfrom", 0, 5, 6, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__addr_buff); if (likely(values[2])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("recvfrom", 0, 5, 6, 2); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__addr_len_buff); if (likely(values[3])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("recvfrom", 0, 5, 6, 3); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__obj); if (likely(values[4])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("recvfrom", 0, 5, 6, 4); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags); if (value) { values[5] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { 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;} } __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;} __pyx_v_buff = values[1]; __pyx_v_addr_buff = values[2]; __pyx_v_addr_len_buff = values[3]; __pyx_v_obj = values[4]; if (values[5]) { __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;} } else { __pyx_v_flags = ((unsigned long)0); } } else { __pyx_v_flags = ((unsigned long)0); switch (PyTuple_GET_SIZE(__pyx_args)) { case 6: __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;} case 5: __pyx_v_obj = PyTuple_GET_ITEM(__pyx_args, 4); __pyx_v_addr_len_buff = PyTuple_GET_ITEM(__pyx_args, 3); __pyx_v_addr_buff = PyTuple_GET_ITEM(__pyx_args, 2); __pyx_v_buff = PyTuple_GET_ITEM(__pyx_args, 1); __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;} break; default: goto __pyx_L5_argtuple_error; } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __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;} __pyx_L3_error:; __Pyx_AddTraceback("iocpsupport.recvfrom"); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":46 * cdef int *c_addr_len_buff * * PyObject_AsWriteBuffer(buff, <void **>&ws_buf.buf, <int *>&ws_buf.len) # <<<<<<<<<<<<<< * PyObject_AsWriteBuffer(addr_buff, <void **>&c_addr_buff, &c_addr_buff_len) * PyObject_AsWriteBuffer(addr_len_buff, <void **>&c_addr_len_buff, &c_addr_len_buff_len) */ __pyx_t_1 = __pyx_v_buff; __Pyx_INCREF(__pyx_t_1); __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;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":47 * * PyObject_AsWriteBuffer(buff, <void **>&ws_buf.buf, <int *>&ws_buf.len) * PyObject_AsWriteBuffer(addr_buff, <void **>&c_addr_buff, &c_addr_buff_len) # <<<<<<<<<<<<<< * PyObject_AsWriteBuffer(addr_len_buff, <void **>&c_addr_len_buff, &c_addr_len_buff_len) * */ __pyx_t_1 = __pyx_v_addr_buff; __Pyx_INCREF(__pyx_t_1); __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;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":48 * PyObject_AsWriteBuffer(buff, <void **>&ws_buf.buf, <int *>&ws_buf.len) * PyObject_AsWriteBuffer(addr_buff, <void **>&c_addr_buff, &c_addr_buff_len) * PyObject_AsWriteBuffer(addr_len_buff, <void **>&c_addr_len_buff, &c_addr_len_buff_len) # <<<<<<<<<<<<<< * * if c_addr_len_buff_len != sizeof(int): */ __pyx_t_1 = __pyx_v_addr_len_buff; __Pyx_INCREF(__pyx_t_1); __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;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":50 * PyObject_AsWriteBuffer(addr_len_buff, <void **>&c_addr_len_buff, &c_addr_len_buff_len) * * if c_addr_len_buff_len != sizeof(int): # <<<<<<<<<<<<<< * raise ValueError, 'length of address length buffer needs to be sizeof(int)' * */ __pyx_t_3 = (__pyx_v_c_addr_len_buff_len != (sizeof(int))); if (__pyx_t_3) { /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":51 * * if c_addr_len_buff_len != sizeof(int): * raise ValueError, 'length of address length buffer needs to be sizeof(int)' # <<<<<<<<<<<<<< * * c_addr_len_buff[0] = c_addr_buff_len */ __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_11), 0); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":53 * raise ValueError, 'length of address length buffer needs to be sizeof(int)' * * c_addr_len_buff[0] = c_addr_buff_len # <<<<<<<<<<<<<< * * ov = makeOV() */ (__pyx_v_c_addr_len_buff[0]) = __pyx_v_c_addr_buff_len; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":55 * c_addr_len_buff[0] = c_addr_buff_len * * ov = makeOV() # <<<<<<<<<<<<<< * if obj is not None: * ov.obj = <PyObject *>obj */ __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;} __pyx_v_ov = __pyx_t_4; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":56 * * ov = makeOV() * if obj is not None: # <<<<<<<<<<<<<< * ov.obj = <PyObject *>obj * */ __pyx_t_3 = (__pyx_v_obj != Py_None); if (__pyx_t_3) { /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":57 * ov = makeOV() * if obj is not None: * ov.obj = <PyObject *>obj # <<<<<<<<<<<<<< * * rc = WSARecvFrom(s, &ws_buf, 1, &bytes, &flags, c_addr_buff, c_addr_len_buff, <OVERLAPPED *>ov, NULL) */ __pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj); goto __pyx_L7; } __pyx_L7:; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":59 * ov.obj = <PyObject *>obj * * rc = WSARecvFrom(s, &ws_buf, 1, &bytes, &flags, c_addr_buff, c_addr_len_buff, <OVERLAPPED *>ov, NULL) # <<<<<<<<<<<<<< * * if rc == SOCKET_ERROR: */ __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); /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":61 * rc = WSARecvFrom(s, &ws_buf, 1, &bytes, &flags, c_addr_buff, c_addr_len_buff, <OVERLAPPED *>ov, NULL) * * if rc == SOCKET_ERROR: # <<<<<<<<<<<<<< * rc = WSAGetLastError() * if rc != ERROR_IO_PENDING: */ __pyx_t_3 = (__pyx_v_rc == SOCKET_ERROR); if (__pyx_t_3) { /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":62 * * if rc == SOCKET_ERROR: * rc = WSAGetLastError() # <<<<<<<<<<<<<< * if rc != ERROR_IO_PENDING: * return rc, 0 */ __pyx_v_rc = WSAGetLastError(); /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":63 * if rc == SOCKET_ERROR: * rc = WSAGetLastError() * if rc != ERROR_IO_PENDING: # <<<<<<<<<<<<<< * return rc, 0 * */ __pyx_t_3 = (__pyx_v_rc != ERROR_IO_PENDING); if (__pyx_t_3) { /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":64 * rc = WSAGetLastError() * if rc != ERROR_IO_PENDING: * return rc, 0 # <<<<<<<<<<<<<< * * Py_XINCREF(obj) */ __Pyx_XDECREF(__pyx_r); __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;} __Pyx_GOTREF(__pyx_t_1); __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;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __pyx_t_1 = 0; __pyx_r = ((PyObject *)__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L0; goto __pyx_L9; } __pyx_L9:; goto __pyx_L8; } __pyx_L8:; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":66 * return rc, 0 * * Py_XINCREF(obj) # <<<<<<<<<<<<<< * return rc, bytes * */ __pyx_t_5 = __pyx_v_obj; __Pyx_INCREF(__pyx_t_5); Py_XINCREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":67 * * Py_XINCREF(obj) * return rc, bytes # <<<<<<<<<<<<<< * */ __Pyx_XDECREF(__pyx_r); __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;} __Pyx_GOTREF(__pyx_t_5); __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;} __Pyx_GOTREF(__pyx_t_1); __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;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_5 = 0; __pyx_t_1 = 0; __pyx_r = ((PyObject *)__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("iocpsupport.recvfrom"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":5 * * * def send(long s, object buff, object obj, unsigned long flags = 0): # <<<<<<<<<<<<<< * cdef int rc * cdef myOVERLAPPED *ov */ static PyObject *__pyx_pf_11iocpsupport_8send(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_11iocpsupport_8send = {__Pyx_NAMESTR("send"), (PyCFunction)__pyx_pf_11iocpsupport_8send, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; static PyObject *__pyx_pf_11iocpsupport_8send(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { long __pyx_v_s; PyObject *__pyx_v_buff = 0; PyObject *__pyx_v_obj = 0; unsigned long __pyx_v_flags; int __pyx_v_rc; struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov; WSABUF __pyx_v_ws_buf; unsigned long __pyx_v_bytes; PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; int __pyx_t_2; struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_t_3; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__s,&__pyx_n_s__buff,&__pyx_n_s__obj,&__pyx_n_s__flags,0}; __Pyx_RefNannySetupContext("send"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[4] = {0,0,0,0}; switch (PyTuple_GET_SIZE(__pyx_args)) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__s); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buff); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("send", 0, 3, 4, 1); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__obj); if (likely(values[2])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("send", 0, 3, 4, 2); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags); if (value) { values[3] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { 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;} } __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;} __pyx_v_buff = values[1]; __pyx_v_obj = values[2]; if (values[3]) { __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;} } else { __pyx_v_flags = ((unsigned long)0); } } else { __pyx_v_flags = ((unsigned long)0); switch (PyTuple_GET_SIZE(__pyx_args)) { case 4: __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;} case 3: __pyx_v_obj = PyTuple_GET_ITEM(__pyx_args, 2); __pyx_v_buff = PyTuple_GET_ITEM(__pyx_args, 1); __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;} break; default: goto __pyx_L5_argtuple_error; } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __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;} __pyx_L3_error:; __Pyx_AddTraceback("iocpsupport.send"); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":11 * cdef unsigned long bytes * * PyObject_AsReadBuffer(buff, <void **>&ws_buf.buf, <int *>&ws_buf.len) # <<<<<<<<<<<<<< * * ov = makeOV() */ __pyx_t_1 = __pyx_v_buff; __Pyx_INCREF(__pyx_t_1); __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;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":13 * PyObject_AsReadBuffer(buff, <void **>&ws_buf.buf, <int *>&ws_buf.len) * * ov = makeOV() # <<<<<<<<<<<<<< * if obj is not None: * ov.obj = <PyObject *>obj */ __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;} __pyx_v_ov = __pyx_t_3; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":14 * * ov = makeOV() * if obj is not None: # <<<<<<<<<<<<<< * ov.obj = <PyObject *>obj * */ __pyx_t_4 = (__pyx_v_obj != Py_None); if (__pyx_t_4) { /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":15 * ov = makeOV() * if obj is not None: * ov.obj = <PyObject *>obj # <<<<<<<<<<<<<< * * rc = WSASend(s, &ws_buf, 1, &bytes, flags, <OVERLAPPED *>ov, NULL) */ __pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj); goto __pyx_L6; } __pyx_L6:; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":17 * ov.obj = <PyObject *>obj * * rc = WSASend(s, &ws_buf, 1, &bytes, flags, <OVERLAPPED *>ov, NULL) # <<<<<<<<<<<<<< * * if rc == SOCKET_ERROR: */ __pyx_v_rc = WSASend(__pyx_v_s, (&__pyx_v_ws_buf), 1, (&__pyx_v_bytes), __pyx_v_flags, ((OVERLAPPED *)__pyx_v_ov), NULL); /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":19 * rc = WSASend(s, &ws_buf, 1, &bytes, flags, <OVERLAPPED *>ov, NULL) * * if rc == SOCKET_ERROR: # <<<<<<<<<<<<<< * rc = WSAGetLastError() * if rc != ERROR_IO_PENDING: */ __pyx_t_4 = (__pyx_v_rc == SOCKET_ERROR); if (__pyx_t_4) { /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":20 * * if rc == SOCKET_ERROR: * rc = WSAGetLastError() # <<<<<<<<<<<<<< * if rc != ERROR_IO_PENDING: * return rc, bytes */ __pyx_v_rc = WSAGetLastError(); /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":21 * if rc == SOCKET_ERROR: * rc = WSAGetLastError() * if rc != ERROR_IO_PENDING: # <<<<<<<<<<<<<< * return rc, bytes * */ __pyx_t_4 = (__pyx_v_rc != ERROR_IO_PENDING); if (__pyx_t_4) { /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":22 * rc = WSAGetLastError() * if rc != ERROR_IO_PENDING: * return rc, bytes # <<<<<<<<<<<<<< * * Py_XINCREF(obj) */ __Pyx_XDECREF(__pyx_r); __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;} __Pyx_GOTREF(__pyx_t_1); __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;} __Pyx_GOTREF(__pyx_t_5); __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;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_r = ((PyObject *)__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L0; goto __pyx_L8; } __pyx_L8:; goto __pyx_L7; } __pyx_L7:; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":24 * return rc, bytes * * Py_XINCREF(obj) # <<<<<<<<<<<<<< * return rc, bytes * */ __pyx_t_6 = __pyx_v_obj; __Pyx_INCREF(__pyx_t_6); Py_XINCREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":25 * * Py_XINCREF(obj) * return rc, bytes # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __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;} __Pyx_GOTREF(__pyx_t_6); __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;} __Pyx_GOTREF(__pyx_t_5); __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;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_r = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("iocpsupport.send"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_tp_new_11iocpsupport_CompletionPort(PyTypeObject *t, PyObject *a, PyObject *k) { PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; return o; } static void __pyx_tp_dealloc_11iocpsupport_CompletionPort(PyObject *o) { (*Py_TYPE(o)->tp_free)(o); } static PyMethodDef __pyx_methods_11iocpsupport_CompletionPort[] = { {__Pyx_NAMESTR("addHandle"), (PyCFunction)__pyx_pf_11iocpsupport_14CompletionPort_1addHandle, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, {__Pyx_NAMESTR("getEvent"), (PyCFunction)__pyx_pf_11iocpsupport_14CompletionPort_2getEvent, METH_O, __Pyx_DOCSTR(0)}, {__Pyx_NAMESTR("postEvent"), (PyCFunction)__pyx_pf_11iocpsupport_14CompletionPort_3postEvent, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, {__Pyx_NAMESTR("__del__"), (PyCFunction)__pyx_pf_11iocpsupport_14CompletionPort_4__del__, METH_NOARGS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; static PyNumberMethods __pyx_tp_as_number_CompletionPort = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_divide*/ #endif 0, /*nb_remainder*/ 0, /*nb_divmod*/ 0, /*nb_power*/ 0, /*nb_negative*/ 0, /*nb_positive*/ 0, /*nb_absolute*/ 0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_MAJOR_VERSION < 3 0, /*nb_coerce*/ #endif 0, /*nb_int*/ #if PY_MAJOR_VERSION < 3 0, /*nb_long*/ #else 0, /*reserved*/ #endif 0, /*nb_float*/ #if PY_MAJOR_VERSION < 3 0, /*nb_oct*/ #endif #if PY_MAJOR_VERSION < 3 0, /*nb_hex*/ #endif 0, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_inplace_divide*/ #endif 0, /*nb_inplace_remainder*/ 0, /*nb_inplace_power*/ 0, /*nb_inplace_lshift*/ 0, /*nb_inplace_rshift*/ 0, /*nb_inplace_and*/ 0, /*nb_inplace_xor*/ 0, /*nb_inplace_or*/ 0, /*nb_floor_divide*/ 0, /*nb_true_divide*/ 0, /*nb_inplace_floor_divide*/ 0, /*nb_inplace_true_divide*/ #if PY_VERSION_HEX >= 0x02050000 0, /*nb_index*/ #endif }; static PySequenceMethods __pyx_tp_as_sequence_CompletionPort = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ 0, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ 0, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_CompletionPort = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; static PyBufferProcs __pyx_tp_as_buffer_CompletionPort = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getwritebuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getsegcount*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getcharbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_getbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_releasebuffer*/ #endif }; static PyTypeObject __pyx_type_11iocpsupport_CompletionPort = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("iocpsupport.CompletionPort"), /*tp_name*/ sizeof(struct __pyx_obj_11iocpsupport_CompletionPort), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_11iocpsupport_CompletionPort, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #else 0, /*reserved*/ #endif 0, /*tp_repr*/ &__pyx_tp_as_number_CompletionPort, /*tp_as_number*/ &__pyx_tp_as_sequence_CompletionPort, /*tp_as_sequence*/ &__pyx_tp_as_mapping_CompletionPort, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_CompletionPort, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_11iocpsupport_CompletionPort, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ __pyx_pf_11iocpsupport_14CompletionPort___init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_11iocpsupport_CompletionPort, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif }; static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, __Pyx_NAMESTR("iocpsupport"), 0, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ }; #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 1}, {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0}, {&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0}, {&__pyx_n_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 1}, {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0}, {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0}, {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0}, {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0}, {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0}, {&__pyx_n_s__AllocateReadBuffer, __pyx_k__AllocateReadBuffer, sizeof(__pyx_k__AllocateReadBuffer), 0, 0, 1, 1}, {&__pyx_n_s__Event, __pyx_k__Event, sizeof(__pyx_k__Event), 0, 0, 1, 1}, {&__pyx_n_s__MemoryError, __pyx_k__MemoryError, sizeof(__pyx_k__MemoryError), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, {&__pyx_n_s__WSAAddressToString, __pyx_k__WSAAddressToString, sizeof(__pyx_k__WSAAddressToString), 0, 0, 1, 1}, {&__pyx_n_s__WindowsError, __pyx_k__WindowsError, sizeof(__pyx_k__WindowsError), 0, 0, 1, 1}, {&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s__accept, __pyx_k__accept, sizeof(__pyx_k__accept), 0, 0, 1, 1}, {&__pyx_n_s__accepting, __pyx_k__accepting, sizeof(__pyx_k__accepting), 0, 0, 1, 1}, {&__pyx_n_s__addr, __pyx_k__addr, sizeof(__pyx_k__addr), 0, 0, 1, 1}, {&__pyx_n_s__addr_buff, __pyx_k__addr_buff, sizeof(__pyx_k__addr_buff), 0, 0, 1, 1}, {&__pyx_n_s__addr_len_buff, __pyx_k__addr_len_buff, sizeof(__pyx_k__addr_len_buff), 0, 0, 1, 1}, {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1}, {&__pyx_n_s__buff, __pyx_k__buff, sizeof(__pyx_k__buff), 0, 0, 1, 1}, {&__pyx_n_s__bufflist, __pyx_k__bufflist, sizeof(__pyx_k__bufflist), 0, 0, 1, 1}, {&__pyx_n_s__bytes, __pyx_k__bytes, sizeof(__pyx_k__bytes), 0, 0, 1, 1}, {&__pyx_n_s__callback, __pyx_k__callback, sizeof(__pyx_k__callback), 0, 0, 1, 1}, {&__pyx_n_s__connect, __pyx_k__connect, sizeof(__pyx_k__connect), 0, 0, 1, 1}, {&__pyx_n_s__flags, __pyx_k__flags, sizeof(__pyx_k__flags), 0, 0, 1, 1}, {&__pyx_n_s__get_accept_addrs, __pyx_k__get_accept_addrs, sizeof(__pyx_k__get_accept_addrs), 0, 0, 1, 1}, {&__pyx_n_s__getsockopt, __pyx_k__getsockopt, sizeof(__pyx_k__getsockopt), 0, 0, 1, 1}, {&__pyx_n_s__handle, __pyx_k__handle, sizeof(__pyx_k__handle), 0, 0, 1, 1}, {&__pyx_n_s__have_connectex, __pyx_k__have_connectex, sizeof(__pyx_k__have_connectex), 0, 0, 1, 1}, {&__pyx_n_s__iAddressFamily, __pyx_k__iAddressFamily, sizeof(__pyx_k__iAddressFamily), 0, 0, 1, 1}, {&__pyx_n_s__iMaxSockAddr, __pyx_k__iMaxSockAddr, sizeof(__pyx_k__iMaxSockAddr), 0, 0, 1, 1}, {&__pyx_n_s__iocpsupport, __pyx_k__iocpsupport, sizeof(__pyx_k__iocpsupport), 0, 0, 1, 1}, {&__pyx_n_s__items, __pyx_k__items, sizeof(__pyx_k__items), 0, 0, 1, 1}, {&__pyx_n_s__key, __pyx_k__key, sizeof(__pyx_k__key), 0, 0, 1, 1}, {&__pyx_n_s__len, __pyx_k__len, sizeof(__pyx_k__len), 0, 0, 1, 1}, {&__pyx_n_s__listening, __pyx_k__listening, sizeof(__pyx_k__listening), 0, 0, 1, 1}, {&__pyx_n_s__makesockaddr, __pyx_k__makesockaddr, sizeof(__pyx_k__makesockaddr), 0, 0, 1, 1}, {&__pyx_n_s__maxAddrLen, __pyx_k__maxAddrLen, sizeof(__pyx_k__maxAddrLen), 0, 0, 1, 1}, {&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1}, {&__pyx_n_s__owner, __pyx_k__owner, sizeof(__pyx_k__owner), 0, 0, 1, 1}, {&__pyx_n_s__port, __pyx_k__port, sizeof(__pyx_k__port), 0, 0, 1, 1}, {&__pyx_n_s__recv, __pyx_k__recv, sizeof(__pyx_k__recv), 0, 0, 1, 1}, {&__pyx_n_s__recvfrom, __pyx_k__recvfrom, sizeof(__pyx_k__recvfrom), 0, 0, 1, 1}, {&__pyx_n_s__rsplit, __pyx_k__rsplit, sizeof(__pyx_k__rsplit), 0, 0, 1, 1}, {&__pyx_n_s__s, __pyx_k__s, sizeof(__pyx_k__s), 0, 0, 1, 1}, {&__pyx_n_s__s_addr, __pyx_k__s_addr, sizeof(__pyx_k__s_addr), 0, 0, 1, 1}, {&__pyx_n_s__sa_data, __pyx_k__sa_data, sizeof(__pyx_k__sa_data), 0, 0, 1, 1}, {&__pyx_n_s__sa_family, __pyx_k__sa_family, sizeof(__pyx_k__sa_family), 0, 0, 1, 1}, {&__pyx_n_s__self, __pyx_k__self, sizeof(__pyx_k__self), 0, 0, 1, 1}, {&__pyx_n_s__send, __pyx_k__send, sizeof(__pyx_k__send), 0, 0, 1, 1}, {&__pyx_n_s__sin6_port, __pyx_k__sin6_port, sizeof(__pyx_k__sin6_port), 0, 0, 1, 1}, {&__pyx_n_s__sin_addr, __pyx_k__sin_addr, sizeof(__pyx_k__sin_addr), 0, 0, 1, 1}, {&__pyx_n_s__sin_port, __pyx_k__sin_port, sizeof(__pyx_k__sin_port), 0, 0, 1, 1}, {&__pyx_n_s__socket, __pyx_k__socket, sizeof(__pyx_k__socket), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_MemoryError = __Pyx_GetName(__pyx_b, __pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_WindowsError = __Pyx_GetName(__pyx_b, __pyx_n_s__WindowsError); if (!__pyx_builtin_WindowsError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); /* "iocpsupport.pyx":219 * raise_error(0, 'WSAAddressToString') * host, sa_port = PyString_FromString(buff), ntohs(sin6.sin6_port) * host, port = host.rsplit(':', 1) # <<<<<<<<<<<<<< * port = int(port) * assert host[0] == '[' */ __pyx_k_tuple_4 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4)); __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_s_3)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3)); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_k_tuple_4, 1, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __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;}; __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; return -1; } #if PY_MAJOR_VERSION < 3 PyMODINIT_FUNC initiocpsupport(void); /*proto*/ PyMODINIT_FUNC initiocpsupport(void) #else PyMODINIT_FUNC PyInit_iocpsupport(void); /*proto*/ PyMODINIT_FUNC PyInit_iocpsupport(void) #endif { PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; int __pyx_t_3; #if CYTHON_REFNANNY void* __pyx_refnanny = NULL; __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_iocpsupport(void)", __LINE__, __FILE__); #endif __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;} __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;} #ifdef __pyx_binding_PyCFunctionType_USED if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS #ifdef WITH_THREAD /* Python build with threading support? */ PyEval_InitThreads(); #endif #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4(__Pyx_NAMESTR("iocpsupport"), __pyx_methods, 0, 0, PYTHON_API_VERSION); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; #if PY_MAJOR_VERSION < 3 Py_INCREF(__pyx_m); #endif __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_module_is_main_iocpsupport) { 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;}; } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Constants init code ---*/ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ if (PyType_Ready(&__pyx_type_11iocpsupport_CompletionPort) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetAttrString(__pyx_m, "CompletionPort", (PyObject *)&__pyx_type_11iocpsupport_CompletionPort) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_11iocpsupport_CompletionPort = &__pyx_type_11iocpsupport_CompletionPort; /*--- Type import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ /* "iocpsupport.pyx":131 * raise WindowsError(message, err) * * class Event: # <<<<<<<<<<<<<< * def __init__(self, callback, owner, **kw): * self.callback = callback */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); /* "iocpsupport.pyx":132 * * class Event: * def __init__(self, callback, owner, **kw): # <<<<<<<<<<<<<< * self.callback = callback * self.owner = owner */ __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 = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____init__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "iocpsupport.pyx":131 * raise WindowsError(message, err) * * class Event: # <<<<<<<<<<<<<< * def __init__(self, callback, owner, **kw): * self.callback = callback */ __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 = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Event, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; /* "iocpsupport.pyx":194 * CloseHandle(self.port) * * def makesockaddr(object buff): # <<<<<<<<<<<<<< * cdef void *mem_buffer * cdef int size */ __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 = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__makesockaddr, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "iocpsupport.pyx":242 * dest.sin_port = htons(port) * * def AllocateReadBuffer(int size): # <<<<<<<<<<<<<< * return PyBuffer_New(size) * */ __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 = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__AllocateReadBuffer, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "iocpsupport.pyx":245 * return PyBuffer_New(size) * * def maxAddrLen(long s): # <<<<<<<<<<<<<< * cdef WSAPROTOCOL_INFO wsa_pi * cdef int size, rc */ __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 = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__maxAddrLen, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "iocpsupport.pyx":265 * return wsa_pi.iAddressFamily * * import socket # for WSAStartup # <<<<<<<<<<<<<< * if not initWinsockPointers(): * raise ValueError, 'Failed to initialize Winsock function vectors' */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__socket), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__socket, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "iocpsupport.pyx":266 * * import socket # for WSAStartup * if not initWinsockPointers(): # <<<<<<<<<<<<<< * raise ValueError, 'Failed to initialize Winsock function vectors' * */ __pyx_t_3 = (!initWinsockPointers()); if (__pyx_t_3) { /* "iocpsupport.pyx":267 * import socket # for WSAStartup * if not initWinsockPointers(): * raise ValueError, 'Failed to initialize Winsock function vectors' # <<<<<<<<<<<<<< * * have_connectex = (lpConnectEx != NULL) */ __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_12), 0); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L2; } __pyx_L2:; /* "iocpsupport.pyx":269 * raise ValueError, 'Failed to initialize Winsock function vectors' * * have_connectex = (lpConnectEx != NULL) # <<<<<<<<<<<<<< * * include 'acceptex.pxi' */ __pyx_t_1 = __Pyx_PyBool_FromLong((lpConnectEx != NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__have_connectex, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":5 * * * def accept(long listening, long accepting, object buff, object obj): # <<<<<<<<<<<<<< * """ * CAUTION: unlike system AcceptEx(), this function returns 0 on success */ __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;} __Pyx_GOTREF(__pyx_t_1); 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;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":31 * return 0 * * def get_accept_addrs(long s, object buff): # <<<<<<<<<<<<<< * cdef WSAPROTOCOL_INFO wsa_pi * cdef int size, locallen, remotelen */ __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;} __Pyx_GOTREF(__pyx_t_1); 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;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":5 * * * def connect(long s, object addr, object obj): # <<<<<<<<<<<<<< * """ * CAUTION: unlike system ConnectEx(), this function returns 0 on success */ __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;} __Pyx_GOTREF(__pyx_t_1); 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;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __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;} __Pyx_GOTREF(__pyx_t_1); 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;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":38 * PyMem_Free(ws_buf) * * def recvfrom(long s, object buff, object addr_buff, object addr_len_buff, object obj, unsigned long flags = 0): # <<<<<<<<<<<<<< * cdef int rc, c_addr_buff_len, c_addr_len_buff_len * cdef myOVERLAPPED *ov */ __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;} __Pyx_GOTREF(__pyx_t_1); 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;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "E:\Twisted.5084\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":5 * * * def send(long s, object buff, object obj, unsigned long flags = 0): # <<<<<<<<<<<<<< * cdef int rc * cdef myOVERLAPPED *ov */ __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;} __Pyx_GOTREF(__pyx_t_1); 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;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "iocpsupport.pyx":1 * # Copyright (c) Twisted Matrix Laboratories. # <<<<<<<<<<<<<< * # See LICENSE for details. * */ __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;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); 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;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); if (__pyx_m) { __Pyx_AddTraceback("init iocpsupport"); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init iocpsupport"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif } /* Runtime support code */ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { PyObject *result; result = PyObject_GetAttr(dict, name); if (!result) PyErr_SetObject(PyExc_NameError, name); return result; } static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; tstate->curexc_type = type; tstate->curexc_value = value; tstate->curexc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); } static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; } #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { Py_XINCREF(type); Py_XINCREF(value); Py_XINCREF(tb); /* First, check the traceback argument, replacing None with NULL. */ if (tb == Py_None) { Py_DECREF(tb); tb = 0; } else if (tb != NULL && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto raise_error; } /* Next, replace a missing value with None */ if (value == NULL) { value = Py_None; Py_INCREF(value); } #if PY_VERSION_HEX < 0x02050000 if (!PyClass_Check(type)) #else if (!PyType_Check(type)) #endif { /* Raising an instance. The value should be a dummy. */ if (value != Py_None) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } /* Normalize to raise <class>, <instance> */ Py_DECREF(value); value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { type = (PyObject*) ((PyInstanceObject*)type)->in_class; Py_INCREF(type); } else { type = 0; PyErr_SetString(PyExc_TypeError, "raise: exception must be an old-style class or instance"); goto raise_error; } #else type = (PyObject*) Py_TYPE(type); Py_INCREF(type); if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto raise_error; } #endif } __Pyx_ErrRestore(type, value, tb); return; raise_error: Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); return; } #else /* Python 3+ */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto bad; } if (value == Py_None) value = 0; if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto bad; } value = type; type = (PyObject*) Py_TYPE(value); } else if (!PyExceptionClass_Check(type)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } PyErr_SetObject(type, value); if (tb) { PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } } bad: return; } #endif static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found) { Py_ssize_t num_expected; const char *number, *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; } else { num_expected = num_max; more_or_less = "at most"; } if (exact) { more_or_less = "exactly"; } number = (num_expected == 1) ? "" : "s"; PyErr_Format(PyExc_TypeError, #if PY_VERSION_HEX < 0x02050000 "%s() takes %s %d positional argument%s (%d given)", #else "%s() takes %s %zd positional argument%s (%zd given)", #endif func_name, more_or_less, num_expected, number, num_found); } static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION >= 3 "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, PyString_AS_STRING(kw_name)); #endif } static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name) { PyObject *key = 0, *value = 0; Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; } else { #if PY_MAJOR_VERSION < 3 if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { #else if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { #endif goto invalid_keyword_type; } else { for (name = first_kw_arg; *name; name++) { #if PY_MAJOR_VERSION >= 3 if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && PyUnicode_Compare(**name, key) == 0) break; #else if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && _PyString_Eq(**name, key)) break; #endif } if (*name) { values[name-argnames] = value; } else { /* unexpected keyword found */ for (name=argnames; name != first_kw_arg; name++) { if (**name == key) goto arg_passed_twice; #if PY_MAJOR_VERSION >= 3 if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; #else if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && _PyString_Eq(**name, key)) goto arg_passed_twice; #endif } if (kwds2) { if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else { goto invalid_keyword; } } } } } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, **name); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%s() keywords must be strings", function_name); goto bad; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%s() got an unexpected keyword argument '%s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif bad: return -1; } static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, #if PY_VERSION_HEX < 0x02050000 "need more than %d value%s to unpack", (int)index, #else "need more than %zd value%s to unpack", index, #endif (index == 1) ? "" : "s"); } static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, #if PY_VERSION_HEX < 0x02050000 "too many values to unpack (expected %d)", (int)expected); #else "too many values to unpack (expected %zd)", expected); #endif } static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { PyObject *item; if (!(item = PyIter_Next(iter))) { if (!PyErr_Occurred()) { __Pyx_RaiseNeedMoreValuesError(index); } } return item; } static int __Pyx_EndUnpack(PyObject *iter, Py_ssize_t expected) { PyObject *item; if ((item = PyIter_Next(iter))) { Py_DECREF(item); __Pyx_RaiseTooManyValuesError(expected); return -1; } else if (!PyErr_Occurred()) return 0; else return -1; } static CYTHON_INLINE int __Pyx_CheckKeywordStrings( PyObject *kwdict, const char* function_name, int kw_allowed) { PyObject* key = 0; Py_ssize_t pos = 0; while (PyDict_Next(kwdict, &pos, &key, 0)) { #if PY_MAJOR_VERSION < 3 if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) #else if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) #endif goto invalid_keyword_type; } if ((!kw_allowed) && unlikely(key)) goto invalid_keyword; return 1; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%s() keywords must be strings", function_name); return 0; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%s() got an unexpected keyword argument '%s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif return 0; } static CYTHON_INLINE long __Pyx_div_long(long a, long b) { long q = a / b; long r = a - q*b; q -= ((r != 0) & ((r ^ b) < 0)); return q; } static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) { PyObject *metaclass; /* Default metaclass */ #if PY_MAJOR_VERSION < 3 if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) { PyObject *base = PyTuple_GET_ITEM(bases, 0); metaclass = PyObject_GetAttrString(base, "__class__"); if (!metaclass) { PyErr_Clear(); metaclass = (PyObject*) Py_TYPE(base); } } else { metaclass = (PyObject *) &PyClass_Type; } #else if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) { PyObject *base = PyTuple_GET_ITEM(bases, 0); metaclass = (PyObject*) Py_TYPE(base); } else { metaclass = (PyObject *) &PyType_Type; } #endif Py_INCREF(metaclass); return metaclass; } static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, PyObject *modname) { PyObject *result; PyObject *metaclass; if (PyDict_SetItemString(dict, "__module__", modname) < 0) return NULL; /* Python2 __metaclass__ */ metaclass = PyDict_GetItemString(dict, "__metaclass__"); if (metaclass) { Py_INCREF(metaclass); } else { metaclass = __Pyx_FindPy2Metaclass(bases); } result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL); Py_DECREF(metaclass); return result; } static PyObject *__pyx_binding_PyCFunctionType_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module) { __pyx_binding_PyCFunctionType_object *op = PyObject_GC_New(__pyx_binding_PyCFunctionType_object, __pyx_binding_PyCFunctionType); if (op == NULL) return NULL; op->func.m_ml = ml; Py_XINCREF(self); op->func.m_self = self; Py_XINCREF(module); op->func.m_module = module; PyObject_GC_Track(op); return (PyObject *)op; } static void __pyx_binding_PyCFunctionType_dealloc(__pyx_binding_PyCFunctionType_object *m) { PyObject_GC_UnTrack(m); Py_XDECREF(m->func.m_self); Py_XDECREF(m->func.m_module); PyObject_GC_Del(m); } static PyObject *__pyx_binding_PyCFunctionType_descr_get(PyObject *func, PyObject *obj, PyObject *type) { if (obj == Py_None) obj = NULL; return PyMethod_New(func, obj, type); } static int __pyx_binding_PyCFunctionType_init(void) { __pyx_binding_PyCFunctionType_type = PyCFunction_Type; __pyx_binding_PyCFunctionType_type.tp_name = __Pyx_NAMESTR("cython_binding_builtin_function_or_method"); __pyx_binding_PyCFunctionType_type.tp_dealloc = (destructor)__pyx_binding_PyCFunctionType_dealloc; __pyx_binding_PyCFunctionType_type.tp_descr_get = __pyx_binding_PyCFunctionType_descr_get; if (PyType_Ready(&__pyx_binding_PyCFunctionType_type) < 0) { return -1; } __pyx_binding_PyCFunctionType = &__pyx_binding_PyCFunctionType_type; return 0; } static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { PyObject *py_import = 0; PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); if (!py_import) goto bad; if (from_list) list = from_list; else { empty_list = PyList_New(0); if (!empty_list) goto bad; list = empty_list; } global_dict = PyModule_GetDict(__pyx_m); if (!global_dict) goto bad; empty_dict = PyDict_New(); if (!empty_dict) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, NULL); bad: Py_XDECREF(empty_list); Py_XDECREF(py_import); Py_XDECREF(empty_dict); return module; } static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { const unsigned char neg_one = (unsigned char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned char" : "value too large to convert to unsigned char"); } return (unsigned char)-1; } return (unsigned char)val; } return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { const unsigned short neg_one = (unsigned short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned short" : "value too large to convert to unsigned short"); } return (unsigned short)-1; } return (unsigned short)val; } return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { const unsigned int neg_one = (unsigned int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned int" : "value too large to convert to unsigned int"); } return (unsigned int)-1; } return (unsigned int)val; } return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { const char neg_one = (char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to char" : "value too large to convert to char"); } return (char)-1; } return (char)val; } return (char)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { const short neg_one = (short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to short" : "value too large to convert to short"); } return (short)-1; } return (short)val; } return (short)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { const signed char neg_one = (signed char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed char" : "value too large to convert to signed char"); } return (signed char)-1; } return (signed char)val; } return (signed char)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { const signed short neg_one = (signed short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed short" : "value too large to convert to signed short"); } return (signed short)-1; } return (signed short)val; } return (signed short)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { const signed int neg_one = (signed int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed int" : "value too large to convert to signed int"); } return (signed int)-1; } return (signed int)val; } return (signed int)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return PyLong_AsUnsignedLong(x); } else { return PyLong_AsLong(x); } } else { unsigned long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned long)-1; val = __Pyx_PyInt_AsUnsignedLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return PyLong_AsUnsignedLongLong(x); } else { return PyLong_AsLongLong(x); } } else { unsigned PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned PY_LONG_LONG)-1; val = __Pyx_PyInt_AsUnsignedLongLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { const long neg_one = (long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return PyLong_AsUnsignedLong(x); } else { return PyLong_AsLong(x); } } else { long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (long)-1; val = __Pyx_PyInt_AsLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return PyLong_AsUnsignedLongLong(x); } else { return PyLong_AsLongLong(x); } } else { PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; val = __Pyx_PyInt_AsLongLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { const signed long neg_one = (signed long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return PyLong_AsUnsignedLong(x); } else { return PyLong_AsLong(x); } } else { signed long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed long)-1; val = __Pyx_PyInt_AsSignedLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return PyLong_AsUnsignedLongLong(x); } else { return PyLong_AsLongLong(x); } } else { signed PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed PY_LONG_LONG)-1; val = __Pyx_PyInt_AsSignedLongLong(tmp); Py_DECREF(tmp); return val; } } #include "compile.h" #include "frameobject.h" #include "traceback.h" static void __Pyx_AddTraceback(const char *funcname) { PyObject *py_srcfile = 0; PyObject *py_funcname = 0; PyObject *py_globals = 0; PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; #if PY_MAJOR_VERSION < 3 py_srcfile = PyString_FromString(__pyx_filename); #else py_srcfile = PyUnicode_FromString(__pyx_filename); #endif if (!py_srcfile) goto bad; if (__pyx_clineno) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); #else py_funcname = PyUnicode_FromString(funcname); #endif } if (!py_funcname) goto bad; py_globals = PyModule_GetDict(__pyx_m); if (!py_globals) goto bad; py_code = PyCode_New( 0, /*int argcount,*/ #if PY_MAJOR_VERSION >= 3 0, /*int kwonlyargcount,*/ #endif 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ __pyx_empty_tuple, /*PyObject *freevars,*/ __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ __pyx_lineno, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); if (!py_code) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ py_globals, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; py_frame->f_lineno = __pyx_lineno; PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); Py_XDECREF(py_code); Py_XDECREF(py_frame); } static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else /* Python 3+ has unicode identifiers */ if (t->is_unicode | t->is_str) { if (t->intern) { *t->p = PyUnicode_InternFromString(t->s); } else if (t->encoding) { *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); } else { *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } #endif if (!*t->p) return -1; ++t; } return 0; } /* Type Conversion Functions */ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; #if PY_VERSION_HEX < 0x03000000 if (PyInt_Check(x) || PyLong_Check(x)) #else if (PyLong_Check(x)) #endif return Py_INCREF(x), x; m = Py_TYPE(x)->tp_as_number; #if PY_VERSION_HEX < 0x03000000 if (m && m->nb_int) { name = "int"; res = PyNumber_Int(x); } else if (m && m->nb_long) { name = "long"; res = PyNumber_Long(x); } #else if (m && m->nb_int) { name = "int"; res = PyNumber_Long(x); } #endif if (res) { #if PY_VERSION_HEX < 0x03000000 if (!PyInt_Check(res) && !PyLong_Check(res)) { #else if (!PyLong_Check(res)) { #endif PyErr_Format(PyExc_TypeError, "__%s__ returned non-%s (type %.200s)", name, name, Py_TYPE(res)->tp_name); Py_DECREF(res); return NULL; } } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "an integer is required"); } return res; } static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); return ival; } static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { #if PY_VERSION_HEX < 0x02050000 if (ival <= LONG_MAX) return PyInt_FromLong((long)ival); else { unsigned char *bytes = (unsigned char *) &ival; int one = 1; int little = (int)*(unsigned char*)&one; return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); } #else return PyInt_FromSize_t(ival); #endif } static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { return (size_t)-1; } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to size_t"); return (size_t)-1; } return (size_t)val; } #endif /* Py_PYTHON_H */