aboutsummaryrefslogtreecommitdiffstats
path: root/lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c')
-rw-r--r--lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c6376
1 files changed, 0 insertions, 6376 deletions
diff --git a/lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c b/lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c
deleted file mode 100644
index deb4b22b..00000000
--- a/lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c
+++ /dev/null
@@ -1,6376 +0,0 @@
-/* Generated by Cython 0.15.1 on Tue Mar 27 07:16:06 2012 */
-
-#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) __Pyx_PyInt_AsInt(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_VERSION_HEX < 0x03020000
- typedef long Py_hash_t;
- #define __Pyx_PyInt_FromHash_t PyInt_FromLong
- #define __Pyx_PyInt_AsHash_t PyInt_AsLong
-#else
- #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
- #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
-#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
-
-#ifndef __PYX_EXTERN_C
- #ifdef __cplusplus
- #define __PYX_EXTERN_C extern "C"
- #else
- #define __PYX_EXTERN_C extern
- #endif
-#endif
-
-#if defined(WIN32) || defined(MS_WINDOWS)
-#define _USE_MATH_DEFINES
-#endif
-#include <math.h>
-#define __PYX_HAVE__iocpsupport
-#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 _OPENMP
-#include <omp.h>
-#endif /* _OPENMP */
-
-#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_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
-#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",
-};
-
-/* "iocpsupport.pyx":6
- *
- * # HANDLE and SOCKET are pointer-sized (they are 64 bit wide in 64-bit builds)
- * ctypedef size_t HANDLE # <<<<<<<<<<<<<<
- * ctypedef size_t SOCKET
- * ctypedef unsigned long DWORD
- */
-typedef size_t __pyx_t_11iocpsupport_HANDLE;
-
-/* "iocpsupport.pyx":7
- * # HANDLE and SOCKET are pointer-sized (they are 64 bit wide in 64-bit builds)
- * ctypedef size_t HANDLE
- * ctypedef size_t SOCKET # <<<<<<<<<<<<<<
- * ctypedef unsigned long DWORD
- * # it's really a pointer, but we use it as an integer
- */
-typedef size_t __pyx_t_11iocpsupport_SOCKET;
-
-/* "iocpsupport.pyx":8
- * ctypedef size_t HANDLE
- * ctypedef size_t SOCKET
- * ctypedef unsigned long DWORD # <<<<<<<<<<<<<<
- * # it's really a pointer, but we use it as an integer
- * ctypedef size_t ULONG_PTR
- */
-typedef unsigned long __pyx_t_11iocpsupport_DWORD;
-
-/* "iocpsupport.pyx":10
- * ctypedef unsigned long DWORD
- * # it's really a pointer, but we use it as an integer
- * ctypedef size_t ULONG_PTR # <<<<<<<<<<<<<<
- * ctypedef int BOOL
- *
- */
-typedef size_t __pyx_t_11iocpsupport_ULONG_PTR;
-
-/* "iocpsupport.pyx":11
- * # it's really a pointer, but we use it as an integer
- * ctypedef size_t ULONG_PTR
- * ctypedef int BOOL # <<<<<<<<<<<<<<
- *
- * cdef extern from 'io.h':
- */
-typedef int __pyx_t_11iocpsupport_BOOL;
-
-/*--- Type declarations ---*/
-struct __pyx_obj_11iocpsupport_CompletionPort;
-struct __pyx_t_11iocpsupport_myOVERLAPPED;
-
-/* "iocpsupport.pyx":124
- * # 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":148
- * 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); /*proto*/
- #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
- #define __Pyx_RefNannySetupContext(name) __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_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
- #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
- #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
- #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
-#else
- #define __Pyx_RefNannyDeclarations
- #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_XINCREF(r) Py_XINCREF(r)
- #define __Pyx_XDECREF(r) Py_XDECREF(r)
- #define __Pyx_XGOTREF(r)
- #define __Pyx_XGIVEREF(r)
-#endif /* CYTHON_REFNANNY */
-
-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, PyObject *cause); /*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 int __Pyx_IternextUnpackEndCheck(PyObject *retval, 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 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, long level); /*proto*/
-
-#include <string.h>
-
-static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
-
-static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
-
-#if PY_MAJOR_VERSION >= 3
-#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
-#else
-#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
-#endif
-
-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 int __Pyx_check_binary_version(void);
-
-static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
- int __pyx_lineno, const char *__pyx_filename); /*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 *, Py_ssize_t); /*proto*/
-static PyObject *__pyx_f_11iocpsupport_fillinetaddr(struct sockaddr_in *, PyObject *); /*proto*/
-static PyObject *__pyx_f_11iocpsupport_fillinet6addr(struct sockaddr_in6 *, PyObject *); /*proto*/
-static int __pyx_f_11iocpsupport_getAddrFamily(__pyx_t_11iocpsupport_SOCKET); /*proto*/
-#define __Pyx_MODULE_NAME "iocpsupport"
-int __pyx_module_is_main_iocpsupport = 0;
-
-/* Implementation of 'iocpsupport' */
-static PyObject *__pyx_builtin_ValueError;
-static PyObject *__pyx_builtin_MemoryError;
-static PyObject *__pyx_builtin_RuntimeError;
-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[] = "%";
-static char __pyx_k_10[] = "invalid IPv6 address %r";
-static char __pyx_k_11[] = "undefined error occurred during address parsing";
-static char __pyx_k_12[] = "ConnectEx is not available on this system";
-static char __pyx_k_13[] = "unsupported address family";
-static char __pyx_k_14[] = "second argument needs to be a list";
-static char __pyx_k_15[] = "length of address length buffer needs to be sizeof(int)";
-static char __pyx_k_16[] = "Failed to initialize Winsock function vectors";
-static char __pyx_k__s[] = "s";
-static char __pyx_k__key[] = "key";
-static char __pyx_k__obj[] = "obj";
-static char __pyx_k__addr[] = "addr";
-static char __pyx_k__buff[] = "buff";
-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__owner[] = "owner";
-static char __pyx_k__split[] = "split";
-static char __pyx_k__accept[] = "accept";
-static char __pyx_k__handle[] = "handle";
-static char __pyx_k__rsplit[] = "rsplit";
-static char __pyx_k__socket[] = "socket";
-static char __pyx_k__connect[] = "connect";
-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__accepting[] = "accepting";
-static char __pyx_k__addr_buff[] = "addr_buff";
-static char __pyx_k__listening[] = "listening";
-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__RuntimeError[] = "RuntimeError";
-static char __pyx_k__WindowsError[] = "WindowsError";
-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__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_10;
-static PyObject *__pyx_kp_s_11;
-static PyObject *__pyx_kp_s_12;
-static PyObject *__pyx_kp_s_13;
-static PyObject *__pyx_kp_s_15;
-static PyObject *__pyx_kp_s_16;
-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_n_s__AllocateReadBuffer;
-static PyObject *__pyx_n_s__Event;
-static PyObject *__pyx_n_s__MemoryError;
-static PyObject *__pyx_n_s__RuntimeError;
-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__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__iocpsupport;
-static PyObject *__pyx_n_s__key;
-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__recv;
-static PyObject *__pyx_n_s__recvfrom;
-static PyObject *__pyx_n_s__rsplit;
-static PyObject *__pyx_n_s__s;
-static PyObject *__pyx_n_s__self;
-static PyObject *__pyx_n_s__send;
-static PyObject *__pyx_n_s__socket;
-static PyObject *__pyx_n_s__split;
-static PyObject *__pyx_int_0;
-static PyObject *__pyx_int_1;
-static PyObject *__pyx_k_tuple_4;
-static PyObject *__pyx_k_tuple_9;
-
-/* "iocpsupport.pyx":128
- * 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;
- __Pyx_RefNannyDeclarations
- void *__pyx_t_1;
- int __pyx_t_2;
- int __pyx_lineno = 0;
- const char *__pyx_filename = NULL;
- int __pyx_clineno = 0;
- __Pyx_RefNannySetupContext("makeOV");
-
- /* "iocpsupport.pyx":130
- * 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 = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_res = ((struct __pyx_t_11iocpsupport_myOVERLAPPED *)__pyx_t_1);
-
- /* "iocpsupport.pyx":131
- * 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":132
- * 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 = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L3;
- }
- __pyx_L3:;
-
- /* "iocpsupport.pyx":133
- * 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":134
- * 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_clineno, __pyx_lineno, __pyx_filename);
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
-}
-
-/* "iocpsupport.pyx":136
- * 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) {
- __Pyx_RefNannyDeclarations
- int __pyx_t_1;
- PyObject *__pyx_t_2 = NULL;
- PyObject *__pyx_t_3 = NULL;
- PyObject *__pyx_t_4 = NULL;
- int __pyx_lineno = 0;
- const char *__pyx_filename = NULL;
- int __pyx_clineno = 0;
- __Pyx_RefNannySetupContext("raise_error");
-
- /* "iocpsupport.pyx":137
- *
- * 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":138
- * 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":139
- * if not err:
- * err = GetLastError()
- * raise WindowsError(message, err) # <<<<<<<<<<<<<<
- *
- * class Event:
- */
- __pyx_t_2 = __Pyx_GetName(__pyx_b, __pyx_n_s__WindowsError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyInt_FromLong(__pyx_v_err); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __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 = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_4));
- __Pyx_INCREF(__pyx_v_message);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_message);
- __Pyx_GIVEREF(__pyx_v_message);
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
- goto __pyx_L0;
- __pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_2);
- __Pyx_XDECREF(__pyx_t_3);
- __Pyx_XDECREF(__pyx_t_4);
- __Pyx_AddTraceback("iocpsupport.raise_error", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __pyx_L0:;
- __Pyx_RefNannyFinishContext();
-}
-
-/* "iocpsupport.pyx":142
- *
- * 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 = NULL;
- PyObject *__pyx_v_v = NULL;
- PyObject *__pyx_r = NULL;
- __Pyx_RefNannyDeclarations
- PyObject *__pyx_t_1 = NULL;
- PyObject *__pyx_t_2 = NULL;
- Py_ssize_t __pyx_t_3;
- PyObject *(*__pyx_t_4)(PyObject *);
- PyObject *__pyx_t_5 = NULL;
- PyObject *__pyx_t_6 = NULL;
- PyObject *__pyx_t_7 = NULL;
- PyObject *(*__pyx_t_8)(PyObject *);
- int __pyx_t_9;
- int __pyx_lineno = 0;
- const char *__pyx_filename = NULL;
- int __pyx_clineno = 0;
- 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);
- {
- PyObject* values[3] = {0,0,0};
- if (unlikely(__pyx_kwds)) {
- Py_ssize_t kw_args;
- 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;
- }
- kw_args = PyDict_Size(__pyx_kwds);
- 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 = 142; __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 = 142; __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 = 142; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- }
- } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
- goto __pyx_L5_argtuple_error;
- } else {
- values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
- values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
- values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
- }
- __pyx_v_self = values[0];
- __pyx_v_callback = values[1];
- __pyx_v_owner = values[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 = 142; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __pyx_L3_error:;
- __Pyx_DECREF(__pyx_v_kw); __pyx_v_kw = 0;
- __Pyx_AddTraceback("iocpsupport.Event.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __Pyx_RefNannyFinishContext();
- return NULL;
- __pyx_L4_argument_unpacking_done:;
-
- /* "iocpsupport.pyx":143
- * 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 = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
- /* "iocpsupport.pyx":144
- * 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 = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
- /* "iocpsupport.pyx":145
- * self.callback = callback
- * self.owner = owner
- * for k, v in kw.items(): # <<<<<<<<<<<<<<
- * setattr(self, k, v)
- *
- */
- if (unlikely(((PyObject *)__pyx_v_kw) == Py_None)) {
- PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "items"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- __pyx_t_1 = PyDict_Items(__pyx_v_kw); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
- __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
- __pyx_t_4 = NULL;
- } else {
- __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
- }
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- for (;;) {
- if (PyList_CheckExact(__pyx_t_2)) {
- if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
- __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
- } else if (PyTuple_CheckExact(__pyx_t_2)) {
- if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
- __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
- } else {
- __pyx_t_1 = __pyx_t_4(__pyx_t_2);
- if (unlikely(!__pyx_t_1)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- break;
- }
- __Pyx_GOTREF(__pyx_t_1);
- }
- if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
- PyObject* sequence = __pyx_t_1;
- if (likely(PyTuple_CheckExact(sequence))) {
- if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
- if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
- else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
- __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
- } else {
- if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
- if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
- else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- __pyx_t_5 = PyList_GET_ITEM(sequence, 0);
- __pyx_t_6 = PyList_GET_ITEM(sequence, 1);
- }
- __Pyx_INCREF(__pyx_t_5);
- __Pyx_INCREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- } else {
- Py_ssize_t index = -1;
- __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
- index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L8_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_5);
- index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_6);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- goto __pyx_L9_unpacking_done;
- __pyx_L8_unpacking_failed:;
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
- if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_L9_unpacking_done:;
- }
- __Pyx_XDECREF(__pyx_v_k);
- __pyx_v_k = __pyx_t_5;
- __pyx_t_5 = 0;
- __Pyx_XDECREF(__pyx_v_v);
- __pyx_v_v = __pyx_t_6;
- __pyx_t_6 = 0;
-
- /* "iocpsupport.pyx":146
- * self.owner = owner
- * for k, v in kw.items():
- * setattr(self, k, v) # <<<<<<<<<<<<<<
- *
- * cdef class CompletionPort:
- */
- __pyx_t_9 = PyObject_SetAttr(__pyx_v_self, __pyx_v_k, __pyx_v_v); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-
- __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_5);
- __Pyx_XDECREF(__pyx_t_6);
- __Pyx_XDECREF(__pyx_t_7);
- __Pyx_AddTraceback("iocpsupport.Event.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_XDECREF(__pyx_v_kw);
- __Pyx_XDECREF(__pyx_v_k);
- __Pyx_XDECREF(__pyx_v_v);
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
-}
-
-/* "iocpsupport.pyx":150
- * 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;
- __Pyx_RefNannyDeclarations
- int __pyx_t_1;
- PyObject *__pyx_t_2 = NULL;
- int __pyx_lineno = 0;
- const char *__pyx_filename = NULL;
- int __pyx_clineno = 0;
- __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":152
- * 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":153
- * 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":154
- * res = CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0)
- * if not res:
- * raise_error(0, 'CreateIoCompletionPort') # <<<<<<<<<<<<<<
- * self.port = res
- *
- */
- __pyx_t_2 = ((PyObject *)__pyx_n_s_1);
- __Pyx_INCREF(__pyx_t_2);
- __pyx_f_11iocpsupport_raise_error(0, __pyx_t_2); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- goto __pyx_L5;
- }
- __pyx_L5:;
-
- /* "iocpsupport.pyx":155
- * if not res:
- * raise_error(0, 'CreateIoCompletionPort')
- * self.port = res # <<<<<<<<<<<<<<
- *
- * def addHandle(self, HANDLE handle, size_t 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_2);
- __Pyx_AddTraceback("iocpsupport.CompletionPort.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __pyx_r = -1;
- __pyx_L0:;
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
-}
-
-/* "iocpsupport.pyx":157
- * self.port = res
- *
- * def addHandle(self, HANDLE handle, size_t 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) {
- __pyx_t_11iocpsupport_HANDLE __pyx_v_handle;
- size_t __pyx_v_key;
- __pyx_t_11iocpsupport_HANDLE __pyx_v_res;
- PyObject *__pyx_r = NULL;
- __Pyx_RefNannyDeclarations
- int __pyx_t_1;
- PyObject *__pyx_t_2 = NULL;
- int __pyx_lineno = 0;
- const char *__pyx_filename = NULL;
- int __pyx_clineno = 0;
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__handle,&__pyx_n_s__key,0};
- __Pyx_RefNannySetupContext("addHandle");
- {
- PyObject* values[2] = {0,0};
- if (unlikely(__pyx_kwds)) {
- Py_ssize_t kw_args;
- 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;
- }
- kw_args = PyDict_Size(__pyx_kwds);
- 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 = 157; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- }
- } else {
- 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);
- break;
- default: goto __pyx_L5_argtuple_error;
- }
- }
- __pyx_v_handle = __Pyx_PyInt_AsSize_t(values[0]); if (unlikely((__pyx_v_handle == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- if (values[1]) {
- __pyx_v_key = __Pyx_PyInt_AsSize_t(values[1]); if (unlikely((__pyx_v_key == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- } else {
- __pyx_v_key = ((size_t)0);
- }
- }
- 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 = 157; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __pyx_L3_error:;
- __Pyx_AddTraceback("iocpsupport.CompletionPort.addHandle", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __Pyx_RefNannyFinishContext();
- return NULL;
- __pyx_L4_argument_unpacking_done:;
-
- /* "iocpsupport.pyx":159
- * def addHandle(self, HANDLE handle, size_t 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":160
- * 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":161
- * res = CreateIoCompletionPort(handle, self.port, key, 0)
- * if not res:
- * raise_error(0, 'CreateIoCompletionPort') # <<<<<<<<<<<<<<
- *
- * def getEvent(self, long timeout):
- */
- __pyx_t_2 = ((PyObject *)__pyx_n_s_1);
- __Pyx_INCREF(__pyx_t_2);
- __pyx_f_11iocpsupport_raise_error(0, __pyx_t_2); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- goto __pyx_L6;
- }
- __pyx_L6:;
-
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
- __pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_2);
- __Pyx_AddTraceback("iocpsupport.CompletionPort.addHandle", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
-}
-
-/* "iocpsupport.pyx":163
- * raise_error(0, 'CreateIoCompletionPort')
- *
- * def getEvent(self, long timeout): # <<<<<<<<<<<<<<
- * cdef PyThreadState *_save
- * cdef unsigned long bytes, 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_rc;
- size_t __pyx_v_key;
- struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov;
- PyObject *__pyx_v_obj = NULL;
- PyObject *__pyx_r = NULL;
- __Pyx_RefNannyDeclarations
- int __pyx_t_1;
- PyObject *__pyx_t_2 = NULL;
- PyObject *__pyx_t_3 = NULL;
- PyObject *__pyx_t_4 = NULL;
- PyObject *__pyx_t_5 = NULL;
- int __pyx_lineno = 0;
- const char *__pyx_filename = NULL;
- int __pyx_clineno = 0;
- __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 = 163; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- }
- goto __pyx_L4_argument_unpacking_done;
- __pyx_L3_error:;
- __Pyx_AddTraceback("iocpsupport.CompletionPort.getEvent", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __Pyx_RefNannyFinishContext();
- return NULL;
- __pyx_L4_argument_unpacking_done:;
-
- /* "iocpsupport.pyx":169
- * 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":170
- *
- * _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":171
- * _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":173
- * PyEval_RestoreThread(_save)
- *
- * if not rc: # <<<<<<<<<<<<<<
- * rc = GetLastError()
- * else:
- */
- __pyx_t_1 = (!__pyx_v_rc);
- if (__pyx_t_1) {
-
- /* "iocpsupport.pyx":174
- *
- * if not rc:
- * rc = GetLastError() # <<<<<<<<<<<<<<
- * else:
- * rc = 0
- */
- __pyx_v_rc = GetLastError();
- goto __pyx_L5;
- }
- /*else*/ {
-
- /* "iocpsupport.pyx":176
- * rc = GetLastError()
- * else:
- * rc = 0 # <<<<<<<<<<<<<<
- *
- * obj = None
- */
- __pyx_v_rc = 0;
- }
- __pyx_L5:;
-
- /* "iocpsupport.pyx":178
- * rc = 0
- *
- * obj = None # <<<<<<<<<<<<<<
- * if ov:
- * if ov.obj:
- */
- __Pyx_INCREF(Py_None);
- __pyx_v_obj = Py_None;
-
- /* "iocpsupport.pyx":179
- *
- * obj = None
- * if ov: # <<<<<<<<<<<<<<
- * if ov.obj:
- * obj = <object>ov.obj
- */
- __pyx_t_1 = (__pyx_v_ov != 0);
- if (__pyx_t_1) {
-
- /* "iocpsupport.pyx":180
- * 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":181
- * 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":182
- * 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":183
- * 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":185
- * PyMem_Free(ov)
- *
- * return (rc, bytes, key, obj) # <<<<<<<<<<<<<<
- *
- * def postEvent(self, unsigned long bytes, size_t 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 = 185; __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 = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_key); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __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 = 185; __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_clineno, __pyx_lineno, __pyx_filename);
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_XDECREF(__pyx_v_obj);
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
-}
-
-/* "iocpsupport.pyx":187
- * return (rc, bytes, key, obj)
- *
- * def postEvent(self, unsigned long bytes, size_t 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;
- size_t __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;
- __Pyx_RefNannyDeclarations
- int __pyx_t_1;
- struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_t_2;
- PyObject *__pyx_t_3 = NULL;
- int __pyx_lineno = 0;
- const char *__pyx_filename = NULL;
- int __pyx_clineno = 0;
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__bytes,&__pyx_n_s__key,&__pyx_n_s__obj,0};
- __Pyx_RefNannySetupContext("postEvent");
- {
- PyObject* values[3] = {0,0,0};
- if (unlikely(__pyx_kwds)) {
- Py_ssize_t kw_args;
- 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;
- }
- kw_args = PyDict_Size(__pyx_kwds);
- 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 = 187; __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 = 187; __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 = 187; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- }
- } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
- goto __pyx_L5_argtuple_error;
- } else {
- values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
- values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
- values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
- }
- __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 = 187; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __pyx_v_key = __Pyx_PyInt_AsSize_t(values[1]); if (unlikely((__pyx_v_key == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __pyx_v_obj = values[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 = 187; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __pyx_L3_error:;
- __Pyx_AddTraceback("iocpsupport.CompletionPort.postEvent", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __Pyx_RefNannyFinishContext();
- return NULL;
- __pyx_L4_argument_unpacking_done:;
-
- /* "iocpsupport.pyx":191
- * 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":192
- *
- * 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 = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_ov = __pyx_t_2;
-
- /* "iocpsupport.pyx":193
- * if obj is not None:
- * ov = makeOV()
- * Py_INCREF(obj) # give ov its own reference to obj # <<<<<<<<<<<<<<
- * ov.obj = <PyObject *>obj
- * else:
- */
- Py_INCREF(__pyx_v_obj);
-
- /* "iocpsupport.pyx":194
- * 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":196
- * ov.obj = <PyObject *>obj
- * else:
- * ov = NULL # <<<<<<<<<<<<<<
- *
- * rc = PostQueuedCompletionStatus(self.port, bytes, key, <OVERLAPPED *>ov)
- */
- __pyx_v_ov = NULL;
- }
- __pyx_L6:;
-
- /* "iocpsupport.pyx":198
- * ov = NULL
- *
- * rc = PostQueuedCompletionStatus(self.port, bytes, key, <OVERLAPPED *>ov) # <<<<<<<<<<<<<<
- * if not rc:
- * if ov:
- */
- __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":199
- *
- * rc = PostQueuedCompletionStatus(self.port, bytes, key, <OVERLAPPED *>ov)
- * if not rc: # <<<<<<<<<<<<<<
- * if ov:
- * Py_DECREF(obj)
- */
- __pyx_t_1 = (!__pyx_v_rc);
- if (__pyx_t_1) {
-
- /* "iocpsupport.pyx":200
- * rc = PostQueuedCompletionStatus(self.port, bytes, key, <OVERLAPPED *>ov)
- * if not rc:
- * if ov: # <<<<<<<<<<<<<<
- * Py_DECREF(obj)
- * PyMem_Free(ov)
- */
- __pyx_t_1 = (__pyx_v_ov != 0);
- if (__pyx_t_1) {
-
- /* "iocpsupport.pyx":201
- * if not rc:
- * if ov:
- * Py_DECREF(obj) # <<<<<<<<<<<<<<
- * PyMem_Free(ov)
- * raise_error(0, 'PostQueuedCompletionStatus')
- */
- Py_DECREF(__pyx_v_obj);
-
- /* "iocpsupport.pyx":202
- * if ov:
- * Py_DECREF(obj)
- * PyMem_Free(ov) # <<<<<<<<<<<<<<
- * raise_error(0, 'PostQueuedCompletionStatus')
- *
- */
- PyMem_Free(__pyx_v_ov);
- goto __pyx_L8;
- }
- __pyx_L8:;
-
- /* "iocpsupport.pyx":203
- * Py_DECREF(obj)
- * PyMem_Free(ov)
- * raise_error(0, 'PostQueuedCompletionStatus') # <<<<<<<<<<<<<<
- *
- * def __del__(self):
- */
- __pyx_t_3 = ((PyObject *)__pyx_n_s_2);
- __Pyx_INCREF(__pyx_t_3);
- __pyx_f_11iocpsupport_raise_error(0, __pyx_t_3); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __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_clineno, __pyx_lineno, __pyx_filename);
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
-}
-
-/* "iocpsupport.pyx":205
- * 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_RefNannyDeclarations
- __Pyx_RefNannySetupContext("__del__");
-
- /* "iocpsupport.pyx":206
- *
- * 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":208
- * CloseHandle(self.port)
- *
- * def makesockaddr(object buff): # <<<<<<<<<<<<<<
- * cdef void *mem_buffer
- * cdef Py_ssize_t 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;
- Py_ssize_t __pyx_v_size;
- PyObject *__pyx_r = NULL;
- __Pyx_RefNannyDeclarations
- int __pyx_t_1;
- PyObject *__pyx_t_2 = NULL;
- int __pyx_lineno = 0;
- const char *__pyx_filename = NULL;
- int __pyx_clineno = 0;
- __Pyx_RefNannySetupContext("makesockaddr");
- __pyx_self = __pyx_self;
-
- /* "iocpsupport.pyx":212
- * cdef Py_ssize_t 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 = PyObject_AsReadBuffer(__pyx_v_buff, (&__pyx_v_mem_buffer), (&__pyx_v_size)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
- /* "iocpsupport.pyx":214
- * 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, Py_ssize_t len):
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = __pyx_f_11iocpsupport__makesockaddr(((struct sockaddr *)__pyx_v_mem_buffer), __pyx_v_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_r = __pyx_t_2;
- __pyx_t_2 = 0;
- goto __pyx_L0;
-
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
- __pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_2);
- __Pyx_AddTraceback("iocpsupport.makesockaddr", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
-}
-
-/* "iocpsupport.pyx":216
- * return _makesockaddr(<sockaddr *>mem_buffer, size)
- *
- * cdef object _makesockaddr(sockaddr *addr, Py_ssize_t len): # <<<<<<<<<<<<<<
- * cdef sockaddr_in *sin
- * cdef sockaddr_in6 *sin6
- */
-
-static PyObject *__pyx_f_11iocpsupport__makesockaddr(struct sockaddr *__pyx_v_addr, Py_ssize_t __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 = NULL;
- unsigned short __pyx_v_sa_port;
- PyObject *__pyx_v_port = NULL;
- PyObject *__pyx_r = NULL;
- __Pyx_RefNannyDeclarations
- int __pyx_t_1;
- PyObject *__pyx_t_2 = NULL;
- PyObject *__pyx_t_3 = NULL;
- PyObject *__pyx_t_4 = NULL;
- unsigned short __pyx_t_5;
- PyObject *__pyx_t_6 = NULL;
- PyObject *(*__pyx_t_7)(PyObject *);
- int __pyx_lineno = 0;
- const char *__pyx_filename = NULL;
- int __pyx_clineno = 0;
- __Pyx_RefNannySetupContext("_makesockaddr");
-
- /* "iocpsupport.pyx":221
- * 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":222
- * 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":223
- * 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":227
- * 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":224
- * 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":225
- * 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":226
- * 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 = 226; __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 = 226; __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 = 226; __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":227
- * 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":228
- * 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":229
- * 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":230
- * 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":231
- * 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_4 = ((PyObject *)__pyx_n_s__WSAAddressToString);
- __Pyx_INCREF(__pyx_t_4);
- __pyx_f_11iocpsupport_raise_error(0, __pyx_t_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- goto __pyx_L4;
- }
- __pyx_L4:;
-
- /* "iocpsupport.pyx":232
- * 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 = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_5 = ntohs(__pyx_v_sin6->sin6_port);
- __pyx_v_host = __pyx_t_4;
- __pyx_t_4 = 0;
- __pyx_v_sa_port = __pyx_t_5;
-
- /* "iocpsupport.pyx":233
- * 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 = 233; __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 = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
- PyObject* sequence = __pyx_t_3;
- if (likely(PyTuple_CheckExact(sequence))) {
- if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
- if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
- else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
- __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
- } else {
- if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
- if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
- else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- __pyx_t_4 = PyList_GET_ITEM(sequence, 0);
- __pyx_t_2 = PyList_GET_ITEM(sequence, 1);
- }
- __Pyx_INCREF(__pyx_t_4);
- __Pyx_INCREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- } else {
- Py_ssize_t index = -1;
- __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
- index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_4);
- index = 1; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_2);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- goto __pyx_L6_unpacking_done;
- __pyx_L5_unpacking_failed:;
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
- if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_L6_unpacking_done:;
- }
- __Pyx_DECREF(__pyx_v_host);
- __pyx_v_host = __pyx_t_4;
- __pyx_t_4 = 0;
- __pyx_v_port = __pyx_t_2;
- __pyx_t_2 = 0;
-
- /* "iocpsupport.pyx":234
- * 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 = 234; __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 = 234; __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":235
- * 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 = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_PyString_Equals(__pyx_t_2, ((PyObject *)__pyx_kp_s_5), Py_EQ); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __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 = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- #endif
-
- /* "iocpsupport.pyx":236
- * port = int(port)
- * assert host[0] == '['
- * assert host[-1] == ']' # <<<<<<<<<<<<<<
- * assert port == sa_port
- * return host[1:-1], port
- */
- #ifndef CYTHON_WITHOUT_ASSERTIONS
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_host, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_PyString_Equals(__pyx_t_2, ((PyObject *)__pyx_kp_s_6), Py_EQ); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __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 = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- #endif
-
- /* "iocpsupport.pyx":237
- * 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 = 237; __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 = 237; __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 = 237; __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 = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- #endif
-
- /* "iocpsupport.pyx":238
- * 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 = 238; __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 = 238; __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":240
- * return host[1:-1], port
- * else:
- * return PyString_FromStringAndSize(addr.sa_data, sizeof(addr.sa_data)) # <<<<<<<<<<<<<<
- *
- *
- */
- __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 = 240; __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_6);
- __Pyx_AddTraceback("iocpsupport._makesockaddr", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __pyx_r = 0;
- __pyx_L0:;
- __Pyx_XDECREF(__pyx_v_host);
- __Pyx_XDECREF(__pyx_v_port);
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
-}
-
-/* "iocpsupport.pyx":243
- *
- *
- * 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 = NULL;
- PyObject *__pyx_r = NULL;
- __Pyx_RefNannyDeclarations
- PyObject *__pyx_t_1 = NULL;
- PyObject *__pyx_t_2 = NULL;
- PyObject *__pyx_t_3 = NULL;
- PyObject *(*__pyx_t_4)(PyObject *);
- unsigned short __pyx_t_5;
- char *__pyx_t_6;
- int __pyx_t_7;
- int __pyx_lineno = 0;
- const char *__pyx_filename = NULL;
- int __pyx_clineno = 0;
- __Pyx_RefNannySetupContext("fillinetaddr");
-
- /* "iocpsupport.pyx":247
- * cdef unsigned long res
- * cdef char *hoststr
- * host, port = addr # <<<<<<<<<<<<<<
- *
- * hoststr = PyString_AsString(host)
- */
- if ((likely(PyTuple_CheckExact(__pyx_v_addr))) || (PyList_CheckExact(__pyx_v_addr))) {
- PyObject* sequence = __pyx_v_addr;
- if (likely(PyTuple_CheckExact(sequence))) {
- if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
- if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
- else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
- __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
- } else {
- if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
- if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
- else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
- __pyx_t_2 = PyList_GET_ITEM(sequence, 1);
- }
- __Pyx_INCREF(__pyx_t_1);
- __Pyx_INCREF(__pyx_t_2);
- } else {
- Py_ssize_t index = -1;
- __pyx_t_3 = PyObject_GetIter(__pyx_v_addr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext;
- index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_1);
- index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_2);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- goto __pyx_L4_unpacking_done;
- __pyx_L3_unpacking_failed:;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
- if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_L4_unpacking_done:;
- }
- __pyx_t_5 = __Pyx_PyInt_AsUnsignedShort(__pyx_t_2); if (unlikely((__pyx_t_5 == (unsigned short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_v_host = __pyx_t_1;
- __pyx_t_1 = 0;
- __pyx_v_port = __pyx_t_5;
-
- /* "iocpsupport.pyx":249
- * host, port = addr
- *
- * hoststr = PyString_AsString(host) # <<<<<<<<<<<<<<
- * res = inet_addr(hoststr)
- * if res == INADDR_ANY:
- */
- __pyx_t_6 = PyString_AsString(__pyx_v_host); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_hoststr = __pyx_t_6;
-
- /* "iocpsupport.pyx":250
- *
- * 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":251
- * 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_7 = (__pyx_v_res == INADDR_ANY);
- if (__pyx_t_7) {
-
- /* "iocpsupport.pyx":252
- * 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, 0);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L5;
- }
- __pyx_L5:;
-
- /* "iocpsupport.pyx":253
- * 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":255
- * dest.sin_addr.s_addr = res
- *
- * dest.sin_port = htons(port) # <<<<<<<<<<<<<<
- *
- *
- */
- __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_3);
- __Pyx_AddTraceback("iocpsupport.fillinetaddr", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __pyx_r = 0;
- __pyx_L0:;
- __Pyx_XDECREF(__pyx_v_host);
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
-}
-
-/* "iocpsupport.pyx":258
- *
- *
- * cdef object fillinet6addr(sockaddr_in6 *dest, object addr): # <<<<<<<<<<<<<<
- * cdef unsigned short port
- * cdef unsigned long res
- */
-
-static PyObject *__pyx_f_11iocpsupport_fillinet6addr(struct sockaddr_in6 *__pyx_v_dest, PyObject *__pyx_v_addr) {
- unsigned short __pyx_v_port;
- char *__pyx_v_hoststr;
- int __pyx_v_addrlen;
- PyObject *__pyx_v_host = NULL;
- PyObject *__pyx_v_flow = NULL;
- PyObject *__pyx_v_scope = NULL;
- int __pyx_v_parseresult;
- PyObject *__pyx_r = NULL;
- __Pyx_RefNannyDeclarations
- PyObject *__pyx_t_1 = NULL;
- PyObject *__pyx_t_2 = NULL;
- PyObject *__pyx_t_3 = NULL;
- PyObject *__pyx_t_4 = NULL;
- PyObject *__pyx_t_5 = NULL;
- PyObject *(*__pyx_t_6)(PyObject *);
- unsigned short __pyx_t_7;
- char *__pyx_t_8;
- int __pyx_t_9;
- unsigned long __pyx_t_10;
- int __pyx_lineno = 0;
- const char *__pyx_filename = NULL;
- int __pyx_clineno = 0;
- __Pyx_RefNannySetupContext("fillinet6addr");
-
- /* "iocpsupport.pyx":262
- * cdef unsigned long res
- * cdef char *hoststr
- * cdef int addrlen = sizeof(sockaddr_in6) # <<<<<<<<<<<<<<
- * host, port, flow, scope = addr
- * host = host.split("%")[0] # remove scope ID, if any
- */
- __pyx_v_addrlen = (sizeof(struct sockaddr_in6));
-
- /* "iocpsupport.pyx":263
- * cdef char *hoststr
- * cdef int addrlen = sizeof(sockaddr_in6)
- * host, port, flow, scope = addr # <<<<<<<<<<<<<<
- * host = host.split("%")[0] # remove scope ID, if any
- *
- */
- if ((likely(PyTuple_CheckExact(__pyx_v_addr))) || (PyList_CheckExact(__pyx_v_addr))) {
- PyObject* sequence = __pyx_v_addr;
- if (likely(PyTuple_CheckExact(sequence))) {
- if (unlikely(PyTuple_GET_SIZE(sequence) != 4)) {
- if (PyTuple_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4);
- else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
- __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
- __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2);
- __pyx_t_4 = PyTuple_GET_ITEM(sequence, 3);
- } else {
- if (unlikely(PyList_GET_SIZE(sequence) != 4)) {
- if (PyList_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4);
- else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
- __pyx_t_2 = PyList_GET_ITEM(sequence, 1);
- __pyx_t_3 = PyList_GET_ITEM(sequence, 2);
- __pyx_t_4 = PyList_GET_ITEM(sequence, 3);
- }
- __Pyx_INCREF(__pyx_t_1);
- __Pyx_INCREF(__pyx_t_2);
- __Pyx_INCREF(__pyx_t_3);
- __Pyx_INCREF(__pyx_t_4);
- } else {
- Py_ssize_t index = -1;
- __pyx_t_5 = PyObject_GetIter(__pyx_v_addr); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
- index = 0; __pyx_t_1 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_1);
- index = 1; __pyx_t_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_2);
- index = 2; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_3);
- index = 3; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_4);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- goto __pyx_L4_unpacking_done;
- __pyx_L3_unpacking_failed:;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
- if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_L4_unpacking_done:;
- }
- __pyx_t_7 = __Pyx_PyInt_AsUnsignedShort(__pyx_t_2); if (unlikely((__pyx_t_7 == (unsigned short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_v_host = __pyx_t_1;
- __pyx_t_1 = 0;
- __pyx_v_port = __pyx_t_7;
- __pyx_v_flow = __pyx_t_3;
- __pyx_t_3 = 0;
- __pyx_v_scope = __pyx_t_4;
- __pyx_t_4 = 0;
-
- /* "iocpsupport.pyx":264
- * cdef int addrlen = sizeof(sockaddr_in6)
- * host, port, flow, scope = addr
- * host = host.split("%")[0] # remove scope ID, if any # <<<<<<<<<<<<<<
- *
- * hoststr = PyString_AsString(host)
- */
- __pyx_t_4 = PyObject_GetAttr(__pyx_v_host, __pyx_n_s__split); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_v_host);
- __pyx_v_host = __pyx_t_4;
- __pyx_t_4 = 0;
-
- /* "iocpsupport.pyx":266
- * host = host.split("%")[0] # remove scope ID, if any
- *
- * hoststr = PyString_AsString(host) # <<<<<<<<<<<<<<
- * cdef int parseresult = WSAStringToAddressA(hoststr, AF_INET6, NULL,
- * <sockaddr *>dest, &addrlen)
- */
- __pyx_t_8 = PyString_AsString(__pyx_v_host); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_hoststr = __pyx_t_8;
-
- /* "iocpsupport.pyx":268
- * hoststr = PyString_AsString(host)
- * cdef int parseresult = WSAStringToAddressA(hoststr, AF_INET6, NULL,
- * <sockaddr *>dest, &addrlen) # <<<<<<<<<<<<<<
- * if parseresult == SOCKET_ERROR:
- * raise ValueError, 'invalid IPv6 address %r' % (host,)
- */
- __pyx_v_parseresult = WSAStringToAddressA(__pyx_v_hoststr, AF_INET6, NULL, ((struct sockaddr *)__pyx_v_dest), (&__pyx_v_addrlen));
-
- /* "iocpsupport.pyx":269
- * cdef int parseresult = WSAStringToAddressA(hoststr, AF_INET6, NULL,
- * <sockaddr *>dest, &addrlen)
- * if parseresult == SOCKET_ERROR: # <<<<<<<<<<<<<<
- * raise ValueError, 'invalid IPv6 address %r' % (host,)
- * if parseresult != 0:
- */
- __pyx_t_9 = (__pyx_v_parseresult == SOCKET_ERROR);
- if (__pyx_t_9) {
-
- /* "iocpsupport.pyx":270
- * <sockaddr *>dest, &addrlen)
- * if parseresult == SOCKET_ERROR:
- * raise ValueError, 'invalid IPv6 address %r' % (host,) # <<<<<<<<<<<<<<
- * if parseresult != 0:
- * raise RuntimeError, 'undefined error occurred during address parsing'
- */
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_4));
- __Pyx_INCREF(__pyx_v_host);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_host);
- __Pyx_GIVEREF(__pyx_v_host);
- __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_3));
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
- __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), 0, 0);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L5;
- }
- __pyx_L5:;
-
- /* "iocpsupport.pyx":271
- * if parseresult == SOCKET_ERROR:
- * raise ValueError, 'invalid IPv6 address %r' % (host,)
- * if parseresult != 0: # <<<<<<<<<<<<<<
- * raise RuntimeError, 'undefined error occurred during address parsing'
- * # sin6_host field was handled by WSAStringToAddress
- */
- __pyx_t_9 = (__pyx_v_parseresult != 0);
- if (__pyx_t_9) {
-
- /* "iocpsupport.pyx":272
- * raise ValueError, 'invalid IPv6 address %r' % (host,)
- * if parseresult != 0:
- * raise RuntimeError, 'undefined error occurred during address parsing' # <<<<<<<<<<<<<<
- * # sin6_host field was handled by WSAStringToAddress
- * dest.sin6_port = htons(port)
- */
- __Pyx_Raise(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_kp_s_11), 0, 0);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L6;
- }
- __pyx_L6:;
-
- /* "iocpsupport.pyx":274
- * raise RuntimeError, 'undefined error occurred during address parsing'
- * # sin6_host field was handled by WSAStringToAddress
- * dest.sin6_port = htons(port) # <<<<<<<<<<<<<<
- * dest.sin6_flowinfo = flow
- * dest.sin6_scope_id = scope
- */
- __pyx_v_dest->sin6_port = htons(__pyx_v_port);
-
- /* "iocpsupport.pyx":275
- * # sin6_host field was handled by WSAStringToAddress
- * dest.sin6_port = htons(port)
- * dest.sin6_flowinfo = flow # <<<<<<<<<<<<<<
- * dest.sin6_scope_id = scope
- *
- */
- __pyx_t_10 = __Pyx_PyInt_AsUnsignedLong(__pyx_v_flow); if (unlikely((__pyx_t_10 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_dest->sin6_flowinfo = __pyx_t_10;
-
- /* "iocpsupport.pyx":276
- * dest.sin6_port = htons(port)
- * dest.sin6_flowinfo = flow
- * dest.sin6_scope_id = scope # <<<<<<<<<<<<<<
- *
- *
- */
- __pyx_t_10 = __Pyx_PyInt_AsUnsignedLong(__pyx_v_scope); if (unlikely((__pyx_t_10 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_dest->sin6_scope_id = __pyx_t_10;
-
- __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_3);
- __Pyx_XDECREF(__pyx_t_4);
- __Pyx_XDECREF(__pyx_t_5);
- __Pyx_AddTraceback("iocpsupport.fillinet6addr", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __pyx_r = 0;
- __pyx_L0:;
- __Pyx_XDECREF(__pyx_v_host);
- __Pyx_XDECREF(__pyx_v_flow);
- __Pyx_XDECREF(__pyx_v_scope);
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
-}
-
-/* "iocpsupport.pyx":279
- *
- *
- * 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;
- __Pyx_RefNannyDeclarations
- PyObject *__pyx_t_1 = NULL;
- int __pyx_lineno = 0;
- const char *__pyx_filename = NULL;
- int __pyx_clineno = 0;
- __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 = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- }
- goto __pyx_L4_argument_unpacking_done;
- __pyx_L3_error:;
- __Pyx_AddTraceback("iocpsupport.AllocateReadBuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __Pyx_RefNannyFinishContext();
- return NULL;
- __pyx_L4_argument_unpacking_done:;
-
- /* "iocpsupport.pyx":280
- *
- * 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 = 280; __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_clineno, __pyx_lineno, __pyx_filename);
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
-}
-
-/* "iocpsupport.pyx":282
- * 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;
- __Pyx_RefNannyDeclarations
- int __pyx_t_1;
- PyObject *__pyx_t_2 = NULL;
- int __pyx_lineno = 0;
- const char *__pyx_filename = NULL;
- int __pyx_clineno = 0;
- __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 = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- }
- goto __pyx_L4_argument_unpacking_done;
- __pyx_L3_error:;
- __Pyx_AddTraceback("iocpsupport.maxAddrLen", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __Pyx_RefNannyFinishContext();
- return NULL;
- __pyx_L4_argument_unpacking_done:;
-
- /* "iocpsupport.pyx":286
- * 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":287
- *
- * 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":288
- * 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":289
- * 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 = ((PyObject *)__pyx_n_s__getsockopt);
- __Pyx_INCREF(__pyx_t_2);
- __pyx_f_11iocpsupport_raise_error(WSAGetLastError(), __pyx_t_2); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- goto __pyx_L5;
- }
- __pyx_L5:;
-
- /* "iocpsupport.pyx":290
- * if rc == SOCKET_ERROR:
- * raise_error(WSAGetLastError(), 'getsockopt')
- * return wsa_pi.iMaxSockAddr # <<<<<<<<<<<<<<
- *
- * cdef int getAddrFamily(SOCKET s) except *:
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = PyInt_FromLong(__pyx_v_wsa_pi.iMaxSockAddr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_r = __pyx_t_2;
- __pyx_t_2 = 0;
- goto __pyx_L0;
-
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
- __pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_2);
- __Pyx_AddTraceback("iocpsupport.maxAddrLen", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
-}
-
-/* "iocpsupport.pyx":292
- * 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;
- __Pyx_RefNannyDeclarations
- int __pyx_t_1;
- PyObject *__pyx_t_2 = NULL;
- int __pyx_lineno = 0;
- const char *__pyx_filename = NULL;
- int __pyx_clineno = 0;
- __Pyx_RefNannySetupContext("getAddrFamily");
-
- /* "iocpsupport.pyx":296
- * 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":297
- *
- * 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":298
- * 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":299
- * 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 = ((PyObject *)__pyx_n_s__getsockopt);
- __Pyx_INCREF(__pyx_t_2);
- __pyx_f_11iocpsupport_raise_error(WSAGetLastError(), __pyx_t_2); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- goto __pyx_L3;
- }
- __pyx_L3:;
-
- /* "iocpsupport.pyx":300
- * 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_2);
- __Pyx_AddTraceback("iocpsupport.getAddrFamily", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __pyx_r = 0;
- __pyx_L0:;
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
-}
-
-/* "C:\t\twisted\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_rc;
- Py_ssize_t __pyx_v_size;
- void *__pyx_v_mem_buffer;
- struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov;
- PyObject *__pyx_r = NULL;
- __Pyx_RefNannyDeclarations
- int __pyx_t_1;
- struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_t_2;
- int __pyx_t_3;
- PyObject *__pyx_t_4 = NULL;
- int __pyx_lineno = 0;
- const char *__pyx_filename = NULL;
- int __pyx_clineno = 0;
- 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;
- {
- PyObject* values[4] = {0,0,0,0};
- if (unlikely(__pyx_kwds)) {
- Py_ssize_t kw_args;
- 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;
- }
- kw_args = PyDict_Size(__pyx_kwds);
- 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;}
- }
- } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
- goto __pyx_L5_argtuple_error;
- } else {
- values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
- values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
- values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
- values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
- }
- __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];
- }
- 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_clineno, __pyx_lineno, __pyx_filename);
- __Pyx_RefNannyFinishContext();
- return NULL;
- __pyx_L4_argument_unpacking_done:;
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":15
- * cdef myOVERLAPPED *ov
- *
- * PyObject_AsWriteBuffer(buff, &mem_buffer, &size) # <<<<<<<<<<<<<<
- *
- * ov = makeOV()
- */
- __pyx_t_1 = PyObject_AsWriteBuffer(__pyx_v_buff, (&__pyx_v_mem_buffer), (&__pyx_v_size)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":17
- * PyObject_AsWriteBuffer(buff, &mem_buffer, &size)
- *
- * ov = makeOV() # <<<<<<<<<<<<<<
- * if obj is not None:
- * ov.obj = <PyObject *>obj
- */
- __pyx_t_2 = __pyx_f_11iocpsupport_makeOV(); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_ov = __pyx_t_2;
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":18
- *
- * ov = makeOV()
- * if obj is not None: # <<<<<<<<<<<<<<
- * ov.obj = <PyObject *>obj
- *
- */
- __pyx_t_3 = (__pyx_v_obj != Py_None);
- if (__pyx_t_3) {
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":19
- * ov = makeOV()
- * if obj is not None:
- * ov.obj = <PyObject *>obj # <<<<<<<<<<<<<<
- *
- * rc = lpAcceptEx(listening, accepting, mem_buffer, 0,
- */
- __pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj);
- goto __pyx_L6;
- }
- __pyx_L6:;
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":23
- * rc = lpAcceptEx(listening, accepting, mem_buffer, 0,
- * <DWORD>size / 2, <DWORD>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_t_11iocpsupport_DWORD)__pyx_v_size) / 2), (((__pyx_t_11iocpsupport_DWORD)__pyx_v_size) / 2), (&__pyx_v_bytes), ((OVERLAPPED *)__pyx_v_ov));
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":24
- * <DWORD>size / 2, <DWORD>size / 2,
- * &bytes, <OVERLAPPED *>ov)
- * if not rc: # <<<<<<<<<<<<<<
- * rc = WSAGetLastError()
- * if rc != ERROR_IO_PENDING:
- */
- __pyx_t_3 = (!__pyx_v_rc);
- if (__pyx_t_3) {
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":25
- * &bytes, <OVERLAPPED *>ov)
- * if not rc:
- * rc = WSAGetLastError() # <<<<<<<<<<<<<<
- * if rc != ERROR_IO_PENDING:
- * PyMem_Free(ov)
- */
- __pyx_v_rc = WSAGetLastError();
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":26
- * if not rc:
- * rc = WSAGetLastError()
- * if rc != ERROR_IO_PENDING: # <<<<<<<<<<<<<<
- * PyMem_Free(ov)
- * return rc
- */
- __pyx_t_3 = (__pyx_v_rc != ERROR_IO_PENDING);
- if (__pyx_t_3) {
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":27
- * rc = WSAGetLastError()
- * if rc != ERROR_IO_PENDING:
- * PyMem_Free(ov) # <<<<<<<<<<<<<<
- * return rc
- *
- */
- PyMem_Free(__pyx_v_ov);
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":28
- * if rc != ERROR_IO_PENDING:
- * PyMem_Free(ov)
- * return rc # <<<<<<<<<<<<<<
- *
- * # operation is in progress
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_4 = PyInt_FromLong(__pyx_v_rc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_r = __pyx_t_4;
- __pyx_t_4 = 0;
- goto __pyx_L0;
- goto __pyx_L8;
- }
- __pyx_L8:;
- goto __pyx_L7;
- }
- __pyx_L7:;
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":31
- *
- * # operation is in progress
- * Py_XINCREF(obj) # <<<<<<<<<<<<<<
- * return 0
- *
- */
- Py_XINCREF(__pyx_v_obj);
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":32
- * # 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_4);
- __Pyx_AddTraceback("iocpsupport.accept", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
-}
-
-/* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":34
- * return 0
- *
- * def get_accept_addrs(long s, object buff): # <<<<<<<<<<<<<<
- * cdef WSAPROTOCOL_INFO wsa_pi
- * cdef int 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_locallen;
- int __pyx_v_remotelen;
- Py_ssize_t __pyx_v_size;
- void *__pyx_v_mem_buffer;
- struct sockaddr *__pyx_v_localaddr;
- struct sockaddr *__pyx_v_remoteaddr;
- PyObject *__pyx_r = NULL;
- __Pyx_RefNannyDeclarations
- int __pyx_t_1;
- PyObject *__pyx_t_2 = NULL;
- PyObject *__pyx_t_3 = NULL;
- PyObject *__pyx_t_4 = NULL;
- PyObject *__pyx_t_5 = NULL;
- int __pyx_lineno = 0;
- const char *__pyx_filename = NULL;
- int __pyx_clineno = 0;
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__s,&__pyx_n_s__buff,0};
- __Pyx_RefNannySetupContext("get_accept_addrs");
- __pyx_self = __pyx_self;
- {
- PyObject* values[2] = {0,0};
- if (unlikely(__pyx_kwds)) {
- Py_ssize_t kw_args;
- 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;
- }
- kw_args = PyDict_Size(__pyx_kwds);
- 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 = 34; __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 = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- }
- } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
- goto __pyx_L5_argtuple_error;
- } else {
- values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
- values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
- }
- __pyx_v_s = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __pyx_v_buff = values[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 = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __pyx_L3_error:;
- __Pyx_AddTraceback("iocpsupport.get_accept_addrs", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __Pyx_RefNannyFinishContext();
- return NULL;
- __pyx_L4_argument_unpacking_done:;
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":41
- * cdef sockaddr *localaddr, *remoteaddr
- *
- * PyObject_AsReadBuffer(buff, &mem_buffer, &size) # <<<<<<<<<<<<<<
- *
- * lpGetAcceptExSockaddrs(mem_buffer, 0, <DWORD>size / 2, <DWORD>size / 2,
- */
- __pyx_t_1 = PyObject_AsReadBuffer(__pyx_v_buff, (&__pyx_v_mem_buffer), (&__pyx_v_size)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":44
- *
- * lpGetAcceptExSockaddrs(mem_buffer, 0, <DWORD>size / 2, <DWORD>size / 2,
- * &localaddr, &locallen, &remoteaddr, &remotelen) # <<<<<<<<<<<<<<
- * return remoteaddr.sa_family, _makesockaddr(localaddr, locallen), _makesockaddr(remoteaddr, remotelen)
- *
- */
- lpGetAcceptExSockaddrs(__pyx_v_mem_buffer, 0, (((__pyx_t_11iocpsupport_DWORD)__pyx_v_size) / 2), (((__pyx_t_11iocpsupport_DWORD)__pyx_v_size) / 2), (&__pyx_v_localaddr), (&__pyx_v_locallen), (&__pyx_v_remoteaddr), (&__pyx_v_remotelen));
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":45
- * lpGetAcceptExSockaddrs(mem_buffer, 0, <DWORD>size / 2, <DWORD>size / 2,
- * &localaddr, &locallen, &remoteaddr, &remotelen)
- * return remoteaddr.sa_family, _makesockaddr(localaddr, locallen), _makesockaddr(remoteaddr, remotelen) # <<<<<<<<<<<<<<
- *
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = PyInt_FromLong(__pyx_v_remoteaddr->sa_family); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __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 = 45; __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 = 45; __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 = 45; __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_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.get_accept_addrs", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
-}
-
-/* "C:\t\twisted\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_in __pyx_v_ipv4_name;
- struct sockaddr_in6 __pyx_v_ipv6_name;
- struct sockaddr *__pyx_v_name;
- int __pyx_v_namelen;
- PyObject *__pyx_r = NULL;
- __Pyx_RefNannyDeclarations
- PyObject *__pyx_t_1 = NULL;
- int __pyx_t_2;
- int __pyx_t_3;
- int __pyx_t_4;
- struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_t_5;
- int __pyx_lineno = 0;
- const char *__pyx_filename = NULL;
- int __pyx_clineno = 0;
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__s,&__pyx_n_s__addr,&__pyx_n_s__obj,0};
- __Pyx_RefNannySetupContext("connect");
- __pyx_self = __pyx_self;
- {
- PyObject* values[3] = {0,0,0};
- if (unlikely(__pyx_kwds)) {
- Py_ssize_t kw_args;
- 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;
- }
- kw_args = PyDict_Size(__pyx_kwds);
- 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;}
- }
- } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
- goto __pyx_L5_argtuple_error;
- } else {
- values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
- values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
- values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
- }
- __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];
- }
- 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_clineno, __pyx_lineno, __pyx_filename);
- __Pyx_RefNannyFinishContext();
- return NULL;
- __pyx_L4_argument_unpacking_done:;
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":16
- * cdef int namelen
- *
- * 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 = 16; __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 = 16; __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) {
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":17
- *
- * 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_12), 0, 0);
- {__pyx_filename = __pyx_f[2]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L6;
- }
- __pyx_L6:;
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":19
- * raise ValueError, 'ConnectEx is not available on this system'
- *
- * family = getAddrFamily(s) # <<<<<<<<<<<<<<
- * if family == AF_INET:
- * name = <sockaddr *>&ipv4_name
- */
- __pyx_t_4 = __pyx_f_11iocpsupport_getAddrFamily(__pyx_v_s); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_family = __pyx_t_4;
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":24
- * namelen = sizeof(ipv4_name)
- * fillinetaddr(&ipv4_name, addr)
- * elif family == AF_INET6: # <<<<<<<<<<<<<<
- * name = <sockaddr *>&ipv6_name
- * namelen = sizeof(ipv6_name)
- */
- switch (__pyx_v_family) {
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":20
- *
- * family = getAddrFamily(s)
- * if family == AF_INET: # <<<<<<<<<<<<<<
- * name = <sockaddr *>&ipv4_name
- * namelen = sizeof(ipv4_name)
- */
- case AF_INET:
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":21
- * family = getAddrFamily(s)
- * if family == AF_INET:
- * name = <sockaddr *>&ipv4_name # <<<<<<<<<<<<<<
- * namelen = sizeof(ipv4_name)
- * fillinetaddr(&ipv4_name, addr)
- */
- __pyx_v_name = ((struct sockaddr *)(&__pyx_v_ipv4_name));
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":22
- * if family == AF_INET:
- * name = <sockaddr *>&ipv4_name
- * namelen = sizeof(ipv4_name) # <<<<<<<<<<<<<<
- * fillinetaddr(&ipv4_name, addr)
- * elif family == AF_INET6:
- */
- __pyx_v_namelen = (sizeof(__pyx_v_ipv4_name));
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":23
- * name = <sockaddr *>&ipv4_name
- * namelen = sizeof(ipv4_name)
- * fillinetaddr(&ipv4_name, addr) # <<<<<<<<<<<<<<
- * elif family == AF_INET6:
- * name = <sockaddr *>&ipv6_name
- */
- __pyx_t_1 = __pyx_f_11iocpsupport_fillinetaddr((&__pyx_v_ipv4_name), __pyx_v_addr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- break;
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":24
- * namelen = sizeof(ipv4_name)
- * fillinetaddr(&ipv4_name, addr)
- * elif family == AF_INET6: # <<<<<<<<<<<<<<
- * name = <sockaddr *>&ipv6_name
- * namelen = sizeof(ipv6_name)
- */
- case AF_INET6:
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":25
- * fillinetaddr(&ipv4_name, addr)
- * elif family == AF_INET6:
- * name = <sockaddr *>&ipv6_name # <<<<<<<<<<<<<<
- * namelen = sizeof(ipv6_name)
- * fillinet6addr(&ipv6_name, addr)
- */
- __pyx_v_name = ((struct sockaddr *)(&__pyx_v_ipv6_name));
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":26
- * elif family == AF_INET6:
- * name = <sockaddr *>&ipv6_name
- * namelen = sizeof(ipv6_name) # <<<<<<<<<<<<<<
- * fillinet6addr(&ipv6_name, addr)
- * else:
- */
- __pyx_v_namelen = (sizeof(__pyx_v_ipv6_name));
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":27
- * name = <sockaddr *>&ipv6_name
- * namelen = sizeof(ipv6_name)
- * fillinet6addr(&ipv6_name, addr) # <<<<<<<<<<<<<<
- * else:
- * raise ValueError, 'unsupported address family'
- */
- __pyx_t_1 = __pyx_f_11iocpsupport_fillinet6addr((&__pyx_v_ipv6_name), __pyx_v_addr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- break;
- default:
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":29
- * fillinet6addr(&ipv6_name, addr)
- * else:
- * raise ValueError, 'unsupported address family' # <<<<<<<<<<<<<<
- * name.sa_family = family
- *
- */
- __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_13), 0, 0);
- {__pyx_filename = __pyx_f[2]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- break;
- }
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":30
- * else:
- * raise ValueError, 'unsupported address family'
- * name.sa_family = family # <<<<<<<<<<<<<<
- *
- * ov = makeOV()
- */
- __pyx_v_name->sa_family = __pyx_v_family;
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":32
- * name.sa_family = family
- *
- * ov = makeOV() # <<<<<<<<<<<<<<
- * if obj is not None:
- * ov.obj = <PyObject *>obj
- */
- __pyx_t_5 = __pyx_f_11iocpsupport_makeOV(); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_ov = __pyx_t_5;
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":33
- *
- * ov = makeOV()
- * if obj is not None: # <<<<<<<<<<<<<<
- * ov.obj = <PyObject *>obj
- *
- */
- __pyx_t_3 = (__pyx_v_obj != Py_None);
- if (__pyx_t_3) {
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":34
- * ov = makeOV()
- * if obj is not None:
- * ov.obj = <PyObject *>obj # <<<<<<<<<<<<<<
- *
- * rc = lpConnectEx(s, name, namelen, NULL, 0, NULL, <OVERLAPPED *>ov)
- */
- __pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj);
- goto __pyx_L7;
- }
- __pyx_L7:;
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":36
- * ov.obj = <PyObject *>obj
- *
- * rc = lpConnectEx(s, name, namelen, NULL, 0, NULL, <OVERLAPPED *>ov) # <<<<<<<<<<<<<<
- *
- * if not rc:
- */
- __pyx_v_rc = lpConnectEx(__pyx_v_s, __pyx_v_name, __pyx_v_namelen, NULL, 0, NULL, ((OVERLAPPED *)__pyx_v_ov));
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":38
- * rc = lpConnectEx(s, name, namelen, 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) {
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":39
- *
- * if not rc:
- * rc = WSAGetLastError() # <<<<<<<<<<<<<<
- * if rc != ERROR_IO_PENDING:
- * PyMem_Free(ov)
- */
- __pyx_v_rc = WSAGetLastError();
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":40
- * if not rc:
- * rc = WSAGetLastError()
- * if rc != ERROR_IO_PENDING: # <<<<<<<<<<<<<<
- * PyMem_Free(ov)
- * return rc
- */
- __pyx_t_3 = (__pyx_v_rc != ERROR_IO_PENDING);
- if (__pyx_t_3) {
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":41
- * rc = WSAGetLastError()
- * if rc != ERROR_IO_PENDING:
- * PyMem_Free(ov) # <<<<<<<<<<<<<<
- * return rc
- *
- */
- PyMem_Free(__pyx_v_ov);
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":42
- * if rc != ERROR_IO_PENDING:
- * PyMem_Free(ov)
- * 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[2]; __pyx_lineno = 42; __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_L9;
- }
- __pyx_L9:;
- goto __pyx_L8;
- }
- __pyx_L8:;
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":45
- *
- * # operation is in progress
- * Py_XINCREF(obj) # <<<<<<<<<<<<<<
- * return 0
- *
- */
- Py_XINCREF(__pyx_v_obj);
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":46
- * # 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_AddTraceback("iocpsupport.connect", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
-}
-
-/* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":5
- *
- *
- * def recv(long s, object bufflist, object obj, unsigned long flags = 0): # <<<<<<<<<<<<<<
- * cdef int rc, 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;
- struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov;
- WSABUF *__pyx_v_ws_buf;
- unsigned long __pyx_v_bytes;
- struct PyObject **__pyx_v_buffers;
- Py_ssize_t __pyx_v_i;
- Py_ssize_t __pyx_v_size;
- Py_ssize_t __pyx_v_buffcount;
- PyObject *__pyx_r = NULL;
- __Pyx_RefNannyDeclarations
- PyObject *__pyx_t_1 = NULL;
- void *__pyx_t_2;
- Py_ssize_t __pyx_t_3;
- int __pyx_t_4;
- struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_t_5;
- int __pyx_t_6;
- PyObject *__pyx_t_7 = NULL;
- PyObject *__pyx_t_8 = NULL;
- int __pyx_lineno = 0;
- const char *__pyx_filename = NULL;
- int __pyx_clineno = 0;
- 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;
- {
- PyObject* values[4] = {0,0,0,0};
- if (unlikely(__pyx_kwds)) {
- Py_ssize_t kw_args;
- 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;
- }
- kw_args = PyDict_Size(__pyx_kwds);
- 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;}
- }
- } else {
- 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);
- values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
- values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
- break;
- default: goto __pyx_L5_argtuple_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);
- }
- }
- 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_clineno, __pyx_lineno, __pyx_filename);
- __Pyx_RefNannyFinishContext();
- return NULL;
- __pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF(__pyx_v_bufflist);
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":13
- * cdef Py_ssize_t i, size, buffcount
- *
- * 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 = PySequence_Fast(__pyx_v_bufflist, __pyx_k_14); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_v_bufflist);
- __pyx_v_bufflist = __pyx_t_1;
- __pyx_t_1 = 0;
-
- /* "C:\t\twisted\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)
- *
- */
- __pyx_v_buffcount = PySequence_Fast_GET_SIZE(__pyx_v_bufflist);
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":15
- * 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_v_buffers = PySequence_Fast_ITEMS(__pyx_v_bufflist);
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":17
- * buffers = PySequence_Fast_ITEMS(bufflist)
- *
- * ws_buf = <WSABUF *>PyMem_Malloc(buffcount*sizeof(WSABUF)) # <<<<<<<<<<<<<<
- *
- * try:
- */
- __pyx_t_2 = PyMem_Malloc((__pyx_v_buffcount * (sizeof(WSABUF)))); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_ws_buf = ((WSABUF *)__pyx_t_2);
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":19
- * 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, &size)
- */
- /*try:*/ {
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":20
- *
- * try:
- * for i from 0 <= i < buffcount: # <<<<<<<<<<<<<<
- * PyObject_AsWriteBuffer(<object>buffers[i], <void **>&ws_buf[i].buf, &size)
- * ws_buf[i].len = <DWORD>size
- */
- __pyx_t_3 = __pyx_v_buffcount;
- for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":21
- * try:
- * for i from 0 <= i < buffcount:
- * PyObject_AsWriteBuffer(<object>buffers[i], <void **>&ws_buf[i].buf, &size) # <<<<<<<<<<<<<<
- * ws_buf[i].len = <DWORD>size
- *
- */
- __pyx_t_1 = ((PyObject *)(__pyx_v_buffers[__pyx_v_i]));
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_4 = PyObject_AsWriteBuffer(__pyx_t_1, ((void **)(&(__pyx_v_ws_buf[__pyx_v_i]).buf)), (&__pyx_v_size)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L7;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":22
- * for i from 0 <= i < buffcount:
- * PyObject_AsWriteBuffer(<object>buffers[i], <void **>&ws_buf[i].buf, &size)
- * ws_buf[i].len = <DWORD>size # <<<<<<<<<<<<<<
- *
- * ov = makeOV()
- */
- (__pyx_v_ws_buf[__pyx_v_i]).len = ((__pyx_t_11iocpsupport_DWORD)__pyx_v_size);
- }
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":24
- * ws_buf[i].len = <DWORD>size
- *
- * ov = makeOV() # <<<<<<<<<<<<<<
- * if obj is not None:
- * ov.obj = <PyObject *>obj
- */
- __pyx_t_5 = __pyx_f_11iocpsupport_makeOV(); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L7;}
- __pyx_v_ov = __pyx_t_5;
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":25
- *
- * ov = makeOV()
- * if obj is not None: # <<<<<<<<<<<<<<
- * ov.obj = <PyObject *>obj
- *
- */
- __pyx_t_6 = (__pyx_v_obj != Py_None);
- if (__pyx_t_6) {
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":26
- * ov = makeOV()
- * if obj is not None:
- * ov.obj = <PyObject *>obj # <<<<<<<<<<<<<<
- *
- * rc = WSARecv(s, ws_buf, <DWORD>buffcount, &bytes, &flags, <OVERLAPPED *>ov, NULL)
- */
- __pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj);
- goto __pyx_L11;
- }
- __pyx_L11:;
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":28
- * ov.obj = <PyObject *>obj
- *
- * rc = WSARecv(s, ws_buf, <DWORD>buffcount, &bytes, &flags, <OVERLAPPED *>ov, NULL) # <<<<<<<<<<<<<<
- *
- * if rc == SOCKET_ERROR:
- */
- __pyx_v_rc = WSARecv(__pyx_v_s, __pyx_v_ws_buf, ((__pyx_t_11iocpsupport_DWORD)__pyx_v_buffcount), (&__pyx_v_bytes), (&__pyx_v_flags), ((OVERLAPPED *)__pyx_v_ov), NULL);
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":30
- * rc = WSARecv(s, ws_buf, <DWORD>buffcount, &bytes, &flags, <OVERLAPPED *>ov, NULL)
- *
- * if rc == SOCKET_ERROR: # <<<<<<<<<<<<<<
- * rc = WSAGetLastError()
- * if rc != ERROR_IO_PENDING:
- */
- __pyx_t_6 = (__pyx_v_rc == SOCKET_ERROR);
- if (__pyx_t_6) {
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":31
- *
- * if rc == SOCKET_ERROR:
- * rc = WSAGetLastError() # <<<<<<<<<<<<<<
- * if rc != ERROR_IO_PENDING:
- * PyMem_Free(ov)
- */
- __pyx_v_rc = WSAGetLastError();
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":32
- * if rc == SOCKET_ERROR:
- * rc = WSAGetLastError()
- * if rc != ERROR_IO_PENDING: # <<<<<<<<<<<<<<
- * PyMem_Free(ov)
- * return rc, 0
- */
- __pyx_t_6 = (__pyx_v_rc != ERROR_IO_PENDING);
- if (__pyx_t_6) {
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":33
- * rc = WSAGetLastError()
- * if rc != ERROR_IO_PENDING:
- * PyMem_Free(ov) # <<<<<<<<<<<<<<
- * return rc, 0
- *
- */
- PyMem_Free(__pyx_v_ov);
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":34
- * if rc != ERROR_IO_PENDING:
- * PyMem_Free(ov)
- * 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 = 34; __pyx_clineno = __LINE__; goto __pyx_L7;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L7;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_7));
- PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
- __Pyx_INCREF(__pyx_int_0);
- PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_int_0);
- __Pyx_GIVEREF(__pyx_int_0);
- __pyx_t_1 = 0;
- __pyx_r = ((PyObject *)__pyx_t_7);
- __pyx_t_7 = 0;
- goto __pyx_L6;
- goto __pyx_L13;
- }
- __pyx_L13:;
- goto __pyx_L12;
- }
- __pyx_L12:;
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":36
- * return rc, 0
- *
- * Py_XINCREF(obj) # <<<<<<<<<<<<<<
- * return rc, bytes
- * finally:
- */
- Py_XINCREF(__pyx_v_obj);
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":37
- *
- * Py_XINCREF(obj)
- * return rc, bytes # <<<<<<<<<<<<<<
- * finally:
- * PyMem_Free(ws_buf)
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_7 = PyInt_FromLong(__pyx_v_rc); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L7;}
- __Pyx_GOTREF(__pyx_t_7);
- __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_bytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L7;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L7;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_8));
- PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7);
- __Pyx_GIVEREF(__pyx_t_7);
- PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_7 = 0;
- __pyx_t_1 = 0;
- __pyx_r = ((PyObject *)__pyx_t_8);
- __pyx_t_8 = 0;
- goto __pyx_L6;
- }
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":39
- * 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_7); __pyx_t_7 = 0;
- __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 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_7);
- __Pyx_XDECREF(__pyx_t_8);
- __Pyx_AddTraceback("iocpsupport.recv", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_XDECREF(__pyx_v_bufflist);
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
-}
-
-/* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":41
- * 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;
- Py_ssize_t __pyx_v_size;
- PyObject *__pyx_r = NULL;
- __Pyx_RefNannyDeclarations
- int __pyx_t_1;
- int __pyx_t_2;
- struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_t_3;
- PyObject *__pyx_t_4 = NULL;
- PyObject *__pyx_t_5 = NULL;
- PyObject *__pyx_t_6 = NULL;
- int __pyx_lineno = 0;
- const char *__pyx_filename = NULL;
- int __pyx_clineno = 0;
- 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;
- {
- PyObject* values[6] = {0,0,0,0,0,0};
- if (unlikely(__pyx_kwds)) {
- Py_ssize_t kw_args;
- 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;
- }
- kw_args = PyDict_Size(__pyx_kwds);
- 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 = 41; __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 = 41; __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 = 41; __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 = 41; __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 = 41; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- }
- } else {
- 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);
- values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
- values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
- values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
- values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
- break;
- default: goto __pyx_L5_argtuple_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 = 41; __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 = 41; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- } else {
- __pyx_v_flags = ((unsigned long)0);
- }
- }
- 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 = 41; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __pyx_L3_error:;
- __Pyx_AddTraceback("iocpsupport.recvfrom", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __Pyx_RefNannyFinishContext();
- return NULL;
- __pyx_L4_argument_unpacking_done:;
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":50
- * cdef Py_ssize_t size
- *
- * PyObject_AsWriteBuffer(buff, <void **>&ws_buf.buf, &size) # <<<<<<<<<<<<<<
- * ws_buf.len = <DWORD>size
- * PyObject_AsWriteBuffer(addr_buff, <void **>&c_addr_buff, &size)
- */
- __pyx_t_1 = PyObject_AsWriteBuffer(__pyx_v_buff, ((void **)(&__pyx_v_ws_buf.buf)), (&__pyx_v_size)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":51
- *
- * PyObject_AsWriteBuffer(buff, <void **>&ws_buf.buf, &size)
- * ws_buf.len = <DWORD>size # <<<<<<<<<<<<<<
- * PyObject_AsWriteBuffer(addr_buff, <void **>&c_addr_buff, &size)
- * c_addr_buff_len = <int>size
- */
- __pyx_v_ws_buf.len = ((__pyx_t_11iocpsupport_DWORD)__pyx_v_size);
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":52
- * PyObject_AsWriteBuffer(buff, <void **>&ws_buf.buf, &size)
- * ws_buf.len = <DWORD>size
- * PyObject_AsWriteBuffer(addr_buff, <void **>&c_addr_buff, &size) # <<<<<<<<<<<<<<
- * c_addr_buff_len = <int>size
- * PyObject_AsWriteBuffer(addr_len_buff, <void **>&c_addr_len_buff, &size)
- */
- __pyx_t_1 = PyObject_AsWriteBuffer(__pyx_v_addr_buff, ((void **)(&__pyx_v_c_addr_buff)), (&__pyx_v_size)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":53
- * ws_buf.len = <DWORD>size
- * PyObject_AsWriteBuffer(addr_buff, <void **>&c_addr_buff, &size)
- * c_addr_buff_len = <int>size # <<<<<<<<<<<<<<
- * PyObject_AsWriteBuffer(addr_len_buff, <void **>&c_addr_len_buff, &size)
- * c_addr_len_buff_len = <int>size
- */
- __pyx_v_c_addr_buff_len = ((int)__pyx_v_size);
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":54
- * PyObject_AsWriteBuffer(addr_buff, <void **>&c_addr_buff, &size)
- * c_addr_buff_len = <int>size
- * PyObject_AsWriteBuffer(addr_len_buff, <void **>&c_addr_len_buff, &size) # <<<<<<<<<<<<<<
- * c_addr_len_buff_len = <int>size
- *
- */
- __pyx_t_1 = PyObject_AsWriteBuffer(__pyx_v_addr_len_buff, ((void **)(&__pyx_v_c_addr_len_buff)), (&__pyx_v_size)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":55
- * c_addr_buff_len = <int>size
- * PyObject_AsWriteBuffer(addr_len_buff, <void **>&c_addr_len_buff, &size)
- * c_addr_len_buff_len = <int>size # <<<<<<<<<<<<<<
- *
- * if c_addr_len_buff_len != sizeof(int):
- */
- __pyx_v_c_addr_len_buff_len = ((int)__pyx_v_size);
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":57
- * c_addr_len_buff_len = <int>size
- *
- * if c_addr_len_buff_len != sizeof(int): # <<<<<<<<<<<<<<
- * raise ValueError, 'length of address length buffer needs to be sizeof(int)'
- *
- */
- __pyx_t_2 = (__pyx_v_c_addr_len_buff_len != (sizeof(int)));
- if (__pyx_t_2) {
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":58
- *
- * 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_15), 0, 0);
- {__pyx_filename = __pyx_f[3]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L6;
- }
- __pyx_L6:;
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":60
- * 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;
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":62
- * c_addr_len_buff[0] = c_addr_buff_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[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_ov = __pyx_t_3;
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":63
- *
- * ov = makeOV()
- * if obj is not None: # <<<<<<<<<<<<<<
- * ov.obj = <PyObject *>obj
- *
- */
- __pyx_t_2 = (__pyx_v_obj != Py_None);
- if (__pyx_t_2) {
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":64
- * 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:;
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":66
- * 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);
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":68
- * 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_2 = (__pyx_v_rc == SOCKET_ERROR);
- if (__pyx_t_2) {
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":69
- *
- * if rc == SOCKET_ERROR:
- * rc = WSAGetLastError() # <<<<<<<<<<<<<<
- * if rc != ERROR_IO_PENDING:
- * PyMem_Free(ov)
- */
- __pyx_v_rc = WSAGetLastError();
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":70
- * if rc == SOCKET_ERROR:
- * rc = WSAGetLastError()
- * if rc != ERROR_IO_PENDING: # <<<<<<<<<<<<<<
- * PyMem_Free(ov)
- * return rc, 0
- */
- __pyx_t_2 = (__pyx_v_rc != ERROR_IO_PENDING);
- if (__pyx_t_2) {
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":71
- * rc = WSAGetLastError()
- * if rc != ERROR_IO_PENDING:
- * PyMem_Free(ov) # <<<<<<<<<<<<<<
- * return rc, 0
- *
- */
- PyMem_Free(__pyx_v_ov);
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":72
- * if rc != ERROR_IO_PENDING:
- * PyMem_Free(ov)
- * return rc, 0 # <<<<<<<<<<<<<<
- *
- * Py_XINCREF(obj)
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_4 = PyInt_FromLong(__pyx_v_rc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_5));
- PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
- __Pyx_INCREF(__pyx_int_0);
- PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_0);
- __Pyx_GIVEREF(__pyx_int_0);
- __pyx_t_4 = 0;
- __pyx_r = ((PyObject *)__pyx_t_5);
- __pyx_t_5 = 0;
- goto __pyx_L0;
- goto __pyx_L9;
- }
- __pyx_L9:;
- goto __pyx_L8;
- }
- __pyx_L8:;
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":74
- * return rc, 0
- *
- * Py_XINCREF(obj) # <<<<<<<<<<<<<<
- * return rc, bytes
- *
- */
- Py_XINCREF(__pyx_v_obj);
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":75
- *
- * 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 = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_bytes); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __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_4);
- __Pyx_GIVEREF(__pyx_t_4);
- __pyx_t_5 = 0;
- __pyx_t_4 = 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_4);
- __Pyx_XDECREF(__pyx_t_5);
- __Pyx_XDECREF(__pyx_t_6);
- __Pyx_AddTraceback("iocpsupport.recvfrom", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
-}
-
-/* "C:\t\twisted\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;
- Py_ssize_t __pyx_v_size;
- PyObject *__pyx_r = NULL;
- __Pyx_RefNannyDeclarations
- int __pyx_t_1;
- struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_t_2;
- int __pyx_t_3;
- PyObject *__pyx_t_4 = NULL;
- PyObject *__pyx_t_5 = NULL;
- PyObject *__pyx_t_6 = NULL;
- int __pyx_lineno = 0;
- const char *__pyx_filename = NULL;
- int __pyx_clineno = 0;
- 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;
- {
- PyObject* values[4] = {0,0,0,0};
- if (unlikely(__pyx_kwds)) {
- Py_ssize_t kw_args;
- 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;
- }
- kw_args = PyDict_Size(__pyx_kwds);
- 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;}
- }
- } else {
- 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);
- values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
- values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
- break;
- default: goto __pyx_L5_argtuple_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);
- }
- }
- 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_clineno, __pyx_lineno, __pyx_filename);
- __Pyx_RefNannyFinishContext();
- return NULL;
- __pyx_L4_argument_unpacking_done:;
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":12
- * cdef Py_ssize_t size
- *
- * PyObject_AsReadBuffer(buff, <void **>&ws_buf.buf, &size) # <<<<<<<<<<<<<<
- * ws_buf.len = <DWORD>size
- *
- */
- __pyx_t_1 = PyObject_AsReadBuffer(__pyx_v_buff, ((void **)(&__pyx_v_ws_buf.buf)), (&__pyx_v_size)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":13
- *
- * PyObject_AsReadBuffer(buff, <void **>&ws_buf.buf, &size)
- * ws_buf.len = <DWORD>size # <<<<<<<<<<<<<<
- *
- * ov = makeOV()
- */
- __pyx_v_ws_buf.len = ((__pyx_t_11iocpsupport_DWORD)__pyx_v_size);
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":15
- * ws_buf.len = <DWORD>size
- *
- * ov = makeOV() # <<<<<<<<<<<<<<
- * if obj is not None:
- * ov.obj = <PyObject *>obj
- */
- __pyx_t_2 = __pyx_f_11iocpsupport_makeOV(); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_ov = __pyx_t_2;
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":16
- *
- * ov = makeOV()
- * if obj is not None: # <<<<<<<<<<<<<<
- * ov.obj = <PyObject *>obj
- *
- */
- __pyx_t_3 = (__pyx_v_obj != Py_None);
- if (__pyx_t_3) {
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":17
- * 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:;
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":19
- * 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);
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":21
- * rc = WSASend(s, &ws_buf, 1, &bytes, flags, <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) {
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":22
- *
- * if rc == SOCKET_ERROR:
- * rc = WSAGetLastError() # <<<<<<<<<<<<<<
- * if rc != ERROR_IO_PENDING:
- * PyMem_Free(ov)
- */
- __pyx_v_rc = WSAGetLastError();
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":23
- * if rc == SOCKET_ERROR:
- * rc = WSAGetLastError()
- * if rc != ERROR_IO_PENDING: # <<<<<<<<<<<<<<
- * PyMem_Free(ov)
- * return rc, bytes
- */
- __pyx_t_3 = (__pyx_v_rc != ERROR_IO_PENDING);
- if (__pyx_t_3) {
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":24
- * rc = WSAGetLastError()
- * if rc != ERROR_IO_PENDING:
- * PyMem_Free(ov) # <<<<<<<<<<<<<<
- * return rc, bytes
- *
- */
- PyMem_Free(__pyx_v_ov);
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":25
- * if rc != ERROR_IO_PENDING:
- * PyMem_Free(ov)
- * return rc, bytes # <<<<<<<<<<<<<<
- *
- * Py_XINCREF(obj)
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_4 = PyInt_FromLong(__pyx_v_rc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __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_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_6));
- PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
- __Pyx_GIVEREF(__pyx_t_5);
- __pyx_t_4 = 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:;
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":27
- * return rc, bytes
- *
- * Py_XINCREF(obj) # <<<<<<<<<<<<<<
- * return rc, bytes
- *
- */
- Py_XINCREF(__pyx_v_obj);
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":28
- *
- * 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 = 28; __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 = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_4));
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
- __Pyx_GIVEREF(__pyx_t_6);
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
- __Pyx_GIVEREF(__pyx_t_5);
- __pyx_t_6 = 0;
- __pyx_t_5 = 0;
- __pyx_r = ((PyObject *)__pyx_t_4);
- __pyx_t_4 = 0;
- goto __pyx_L0;
-
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
- __pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_4);
- __Pyx_XDECREF(__pyx_t_5);
- __Pyx_XDECREF(__pyx_t_6);
- __Pyx_AddTraceback("iocpsupport.send", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __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_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0},
- {&__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_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0},
- {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
- {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 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_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__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 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__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__iocpsupport, __pyx_k__iocpsupport, sizeof(__pyx_k__iocpsupport), 0, 0, 1, 1},
- {&__pyx_n_s__key, __pyx_k__key, sizeof(__pyx_k__key), 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__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__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__socket, __pyx_k__socket, sizeof(__pyx_k__socket), 0, 0, 1, 1},
- {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 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 = 304; __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 = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- return 0;
- __pyx_L1_error:;
- return -1;
-}
-
-static int __Pyx_InitCachedConstants(void) {
- __Pyx_RefNannyDeclarations
- __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants");
-
- /* "iocpsupport.pyx":233
- * 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 = 233; __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));
-
- /* "iocpsupport.pyx":264
- * cdef int addrlen = sizeof(sockaddr_in6)
- * host, port, flow, scope = addr
- * host = host.split("%")[0] # remove scope ID, if any # <<<<<<<<<<<<<<
- *
- * hoststr = PyString_AsString(host)
- */
- __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_9));
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_8));
- PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_s_8));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_8));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9));
- __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;
- __Pyx_RefNannyDeclarations
- #if CYTHON_REFNANNY
- __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");
- }
- #endif
- __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_iocpsupport(void)");
- if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __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 ---*/
- /*--- Variable export code ---*/
- /*--- Function export code ---*/
- /*--- Type init code ---*/
- if (PyType_Ready(&__pyx_type_11iocpsupport_CompletionPort) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __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 = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_11iocpsupport_CompletionPort = &__pyx_type_11iocpsupport_CompletionPort;
- /*--- Type import code ---*/
- /*--- Variable import code ---*/
- /*--- Function import code ---*/
- /*--- Execution code ---*/
-
- /* "iocpsupport.pyx":141
- * 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 = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-
- /* "iocpsupport.pyx":142
- *
- * 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 = 142; __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 = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-
- /* "iocpsupport.pyx":141
- * 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 = 141; __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 = 141; __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":208
- * CloseHandle(self.port)
- *
- * def makesockaddr(object buff): # <<<<<<<<<<<<<<
- * cdef void *mem_buffer
- * cdef Py_ssize_t 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 = 208; __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 = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
- /* "iocpsupport.pyx":279
- *
- *
- * 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 = 279; __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 = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
- /* "iocpsupport.pyx":282
- * 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 = 282; __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 = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
- /* "iocpsupport.pyx":302
- * 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, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __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 = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
- /* "iocpsupport.pyx":303
- *
- * 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":304
- * 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_16), 0, 0);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L2;
- }
- __pyx_L2:;
-
- /* "iocpsupport.pyx":306
- * 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 = 306; __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 = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
- /* "C:\t\twisted\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;
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":34
- * return 0
- *
- * def get_accept_addrs(long s, object buff): # <<<<<<<<<<<<<<
- * cdef WSAPROTOCOL_INFO wsa_pi
- * cdef int 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 = 34; __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 = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
- /* "C:\t\twisted\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;
-
- /* "C:\t\twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":41
- * 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 = 41; __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 = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
- /* "C:\t\twisted\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", __pyx_clineno, __pyx_lineno, __pyx_filename);
- 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 */
-
-#if CYTHON_REFNANNY
-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;
-}
-#endif /* CYTHON_REFNANNY */
-
-static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
- PyObject *result;
- result = PyObject_GetAttr(dict, name);
- if (!result) {
- if (dict != __pyx_b) {
- PyErr_Clear();
- result = PyObject_GetAttr(__pyx_b, 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, PyObject *cause) {
- /* cause is unused */
- 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, PyObject *cause) {
- 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;
- }
-
- if (cause) {
- PyObject *fixed_cause;
- if (PyExceptionClass_Check(cause)) {
- fixed_cause = PyObject_CallObject(cause, NULL);
- if (fixed_cause == NULL)
- goto bad;
- }
- else if (PyExceptionInstance_Check(cause)) {
- fixed_cause = cause;
- Py_INCREF(fixed_cause);
- }
- else {
- PyErr_SetString(PyExc_TypeError,
- "exception causes must derive from "
- "BaseException");
- goto bad;
- }
- if (!value) {
- value = PyObject_CallObject(type, NULL);
- }
- PyException_SetCause(value, fixed_cause);
- }
-
- 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 *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";
- }
- PyErr_Format(PyExc_TypeError,
- "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)",
- func_name, more_or_less, num_expected,
- (num_expected == 1) ? "" : "s", 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,
- "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack",
- index, (index == 1) ? "" : "s");
-}
-
-static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
- PyErr_Format(PyExc_ValueError,
- "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected);
-}
-
-static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
- if (unlikely(retval)) {
- Py_DECREF(retval);
- __Pyx_RaiseTooManyValuesError(expected);
- return -1;
- } else if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
- PyErr_Clear();
- return 0;
- } else {
- return -1;
- }
- }
- return 0;
-}
-
-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 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, (char *)"__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, long level) {
- 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;
- #if PY_VERSION_HEX >= 0x02050000
- {
- PyObject *py_level = PyInt_FromLong(level);
- if (!py_level)
- goto bad;
- module = PyObject_CallFunctionObjArgs(py_import,
- name, global_dict, empty_dict, list, py_level, NULL);
- Py_DECREF(py_level);
- }
- #else
- if (level>0) {
- PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
- goto bad;
- }
- module = PyObject_CallFunctionObjArgs(py_import,
- name, global_dict, empty_dict, list, NULL);
- #endif
-bad:
- Py_XDECREF(empty_list);
- Py_XDECREF(py_import);
- Py_XDECREF(empty_dict);
- return module;
-}
-
-static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
- if (s1 == s2) { /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */
- return (equals == Py_EQ);
- } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
- if (PyBytes_GET_SIZE(s1) != PyBytes_GET_SIZE(s2)) {
- return (equals == Py_NE);
- } else if (PyBytes_GET_SIZE(s1) == 1) {
- if (equals == Py_EQ)
- return (PyBytes_AS_STRING(s1)[0] == PyBytes_AS_STRING(s2)[0]);
- else
- return (PyBytes_AS_STRING(s1)[0] != PyBytes_AS_STRING(s2)[0]);
- } else {
- int result = memcmp(PyBytes_AS_STRING(s1), PyBytes_AS_STRING(s2), (size_t)PyBytes_GET_SIZE(s1));
- return (equals == Py_EQ) ? (result == 0) : (result != 0);
- }
- } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
- return (equals == Py_NE);
- } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
- return (equals == Py_NE);
- } else {
- int result;
- PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
- if (!py_result)
- return -1;
- result = __Pyx_PyObject_IsTrue(py_result);
- Py_DECREF(py_result);
- return result;
- }
-}
-
-static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
- if (s1 == s2) { /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */
- return (equals == Py_EQ);
- } else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) {
- if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) {
- return (equals == Py_NE);
- } else if (PyUnicode_GET_SIZE(s1) == 1) {
- if (equals == Py_EQ)
- return (PyUnicode_AS_UNICODE(s1)[0] == PyUnicode_AS_UNICODE(s2)[0]);
- else
- return (PyUnicode_AS_UNICODE(s1)[0] != PyUnicode_AS_UNICODE(s2)[0]);
- } else {
- int result = PyUnicode_Compare(s1, s2);
- if ((result == -1) && unlikely(PyErr_Occurred()))
- return -1;
- return (equals == Py_EQ) ? (result == 0) : (result != 0);
- }
- } else if ((s1 == Py_None) & PyUnicode_CheckExact(s2)) {
- return (equals == Py_NE);
- } else if ((s2 == Py_None) & PyUnicode_CheckExact(s1)) {
- return (equals == Py_NE);
- } else {
- int result;
- PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
- if (!py_result)
- return -1;
- result = __Pyx_PyObject_IsTrue(py_result);
- Py_DECREF(py_result);
- return result;
- }
-}
-
-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 (unsigned long)PyLong_AsUnsignedLong(x);
- } else {
- return (unsigned long)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 (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
- } else {
- return (unsigned PY_LONG_LONG)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 (long)PyLong_AsUnsignedLong(x);
- } else {
- return (long)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 (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
- } else {
- return (PY_LONG_LONG)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 (signed long)PyLong_AsUnsignedLong(x);
- } else {
- return (signed long)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 (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
- } else {
- return (signed PY_LONG_LONG)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;
- }
-}
-
-static int __Pyx_check_binary_version(void) {
- char ctversion[4], rtversion[4];
- PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
- PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
- if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
- char message[200];
- PyOS_snprintf(message, sizeof(message),
- "compiletime version %s of module '%.100s' "
- "does not match runtime version %s",
- ctversion, __Pyx_MODULE_NAME, rtversion);
- #if PY_VERSION_HEX < 0x02050000
- return PyErr_Warn(NULL, message);
- #else
- return PyErr_WarnEx(NULL, message, 1);
- #endif
- }
- return 0;
-}
-
-#include "compile.h"
-#include "frameobject.h"
-#include "traceback.h"
-
-static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
- int __pyx_lineno, const char *__pyx_filename) {
- 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 */