diff --git a/arrex/dtypes.c b/arrex/dtypes.c index 38e0809..c5f4255 100644 --- a/arrex/dtypes.c +++ b/arrex/dtypes.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.29.27 */ +/* Generated by Cython 3.0.0 */ /* BEGIN: Cython Metadata { @@ -16,20 +16,49 @@ END: Cython Metadata */ #ifndef PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN #endif /* PY_SSIZE_T_CLEAN */ +#if defined(CYTHON_LIMITED_API) && 0 + #ifndef Py_LIMITED_API + #if CYTHON_LIMITED_API+0 > 0x03030000 + #define Py_LIMITED_API CYTHON_LIMITED_API + #else + #define Py_LIMITED_API 0x03030000 + #endif + #endif +#endif + #include "Python.h" + + #if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyFloat_FromString(obj) PyFloat_FromString(obj) + #else + #define __Pyx_PyFloat_FromString(obj) PyFloat_FromString(obj, NULL) + #endif + + + #if PY_MAJOR_VERSION <= 2 + #define PyDict_GetItemWithError _PyDict_GetItemWithError + #endif + + + #if (PY_VERSION_HEX < 0x030700b1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030600)) && !defined(PyContextVar_Get) + #define PyContextVar_Get(var, d, v) ((d) ? ((void)(var), Py_INCREF(d), (v)[0] = (d), 0) : ((v)[0] = NULL, 0) ) + #endif + #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) - #error Cython requires Python 2.6+ or Python 3.3+. +#elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) + #error Cython requires Python 2.7+ or Python 3.3+. #else -#define CYTHON_ABI "0_29_27" -#define CYTHON_HEX_VERSION 0x001D1BF0 +#define CYTHON_ABI "3_0_0" +#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI +#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." +#define CYTHON_HEX_VERSION 0x030000F0 #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif -#if !defined(WIN32) && !defined(MS_WINDOWS) +#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif @@ -48,9 +77,7 @@ END: Cython Metadata */ #endif #define __PYX_COMMA , #ifndef HAVE_LONG_LONG - #if PY_VERSION_HEX >= 0x02070000 - #define HAVE_LONG_LONG - #endif + #define HAVE_LONG_LONG #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG @@ -58,12 +85,18 @@ END: Cython Metadata */ #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif -#ifdef PYPY_VERSION - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_PYSTON 0 +#if defined(GRAALVM_PYTHON) + /* For very preliminary testing purposes. Most variables are set the same as PyPy. + The existence of this section does not imply that anything works or is even tested */ + #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 1 + #define CYTHON_COMPILING_IN_NOGIL 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #if PY_VERSION_HEX < 0x03050000 @@ -88,27 +121,159 @@ END: Cython Metadata */ #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) + #endif #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 -#elif defined(PYSTON_VERSION) + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif +#elif defined(PYPY_VERSION) + #define CYTHON_COMPILING_IN_PYPY 1 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) + #endif + #if PY_VERSION_HEX < 0x03090000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00) + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif +#elif defined(CYTHON_LIMITED_API) + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 1 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 0 + #undef CYTHON_CLINE_IN_TRACEBACK + #define CYTHON_CLINE_IN_TRACEBACK 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 1 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #endif + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 1 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif +#elif defined(PY_NOGIL) #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 1 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 1 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 + #ifndef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 #ifndef CYTHON_USE_UNICODE_INTERNALS @@ -131,25 +296,29 @@ END: Cython Metadata */ #define CYTHON_FAST_THREAD_STATE 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 - #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 1 + #endif #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #else #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 1 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 0 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #ifndef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 1 #endif #if PY_MAJOR_VERSION < 3 @@ -158,10 +327,7 @@ END: Cython Metadata */ #elif !defined(CYTHON_USE_ASYNC_SLOTS) #define CYTHON_USE_ASYNC_SLOTS 1 #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #elif !defined(CYTHON_USE_PYLONG_INTERNALS) + #ifndef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 1 #endif #ifndef CYTHON_USE_PYLIST_INTERNALS @@ -188,25 +354,56 @@ END: Cython Metadata */ #ifndef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 1 #endif + #ifndef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6) + #endif + #ifndef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1) + #endif #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030B00A1) + #define CYTHON_FAST_PYCALL 1 #endif - #ifndef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 #endif - #ifndef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 #endif - #ifndef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1) + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 #endif - #ifndef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3) + #if PY_VERSION_HEX < 0x030400a1 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #elif !defined(CYTHON_USE_TP_FINALIZE) + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #if PY_VERSION_HEX < 0x030600B1 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #elif !defined(CYTHON_USE_DICT_VERSIONS) + #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5) + #endif + #if PY_VERSION_HEX < 0x030700A3 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #elif !defined(CYTHON_USE_EXC_INFO_STACK) + #define CYTHON_USE_EXC_INFO_STACK 1 + #endif + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 #endif #endif #if !defined(CYTHON_FAST_PYCCALL) #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif +#if !defined(CYTHON_VECTORCALL) +#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1) +#endif +#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1) #if CYTHON_USE_PYLONG_INTERNALS #if PY_MAJOR_VERSION < 3 #include "longintrepr.h" @@ -235,6 +432,17 @@ END: Cython Metadata */ #define CYTHON_RESTRICT #endif #endif +#ifndef CYTHON_UNUSED + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(maybe_unused) + #define CYTHON_UNUSED [[maybe_unused]] + #endif + #endif + #endif +#endif #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) @@ -248,13 +456,16 @@ END: Cython Metadata */ # define CYTHON_UNUSED # endif #endif -#ifndef CYTHON_MAYBE_UNUSED_VAR +#ifndef CYTHON_UNUSED_VAR # if defined(__cplusplus) - template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } + template void CYTHON_UNUSED_VAR( const T& ) { } # else -# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) +# define CYTHON_UNUSED_VAR(x) (void)(x) # endif #endif +#ifndef CYTHON_MAYBE_UNUSED_VAR + #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) +#endif #ifndef CYTHON_NCP_UNUSED # if CYTHON_COMPILING_IN_CPYTHON # define CYTHON_NCP_UNUSED @@ -266,24 +477,47 @@ END: Cython Metadata */ #ifdef _MSC_VER #ifndef _MSC_STDINT_H_ #if _MSC_VER < 1300 - typedef unsigned char uint8_t; - typedef unsigned int uint32_t; + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; + #else + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; + #endif + #endif + #if _MSC_VER < 1300 + #ifdef _WIN64 + typedef unsigned long long __pyx_uintptr_t; + #else + typedef unsigned int __pyx_uintptr_t; + #endif + #else + #ifdef _WIN64 + typedef unsigned __int64 __pyx_uintptr_t; #else - typedef unsigned __int8 uint8_t; - typedef unsigned __int32 uint32_t; + typedef unsigned __int32 __pyx_uintptr_t; #endif #endif #else - #include + #include + typedef uintptr_t __pyx_uintptr_t; #endif #ifndef CYTHON_FALLTHROUGH - #if defined(__cplusplus) && __cplusplus >= 201103L - #if __has_cpp_attribute(fallthrough) - #define CYTHON_FALLTHROUGH [[fallthrough]] - #elif __has_cpp_attribute(clang::fallthrough) - #define CYTHON_FALLTHROUGH [[clang::fallthrough]] - #elif __has_cpp_attribute(gnu::fallthrough) - #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #endif #endif #endif #ifndef CYTHON_FALLTHROUGH @@ -293,13 +527,26 @@ END: Cython Metadata */ #define CYTHON_FALLTHROUGH #endif #endif - #if defined(__clang__ ) && defined(__apple_build_version__) + #if defined(__clang__) && defined(__apple_build_version__) #if __apple_build_version__ < 7000000 #undef CYTHON_FALLTHROUGH #define CYTHON_FALLTHROUGH #endif #endif #endif +#ifdef __cplusplus + template + struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; + #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value) +#else + #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) +#endif +#if CYTHON_COMPILING_IN_PYPY == 1 + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000) +#else + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000) +#endif +#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) #ifndef CYTHON_INLINE #if defined(__clang__) @@ -315,35 +562,32 @@ END: Cython Metadata */ #endif #endif -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyClass_Type + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_DefaultClassType PyType_Type #if PY_VERSION_HEX >= 0x030B00A1 - static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f, + static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, PyObject *code, PyObject *c, PyObject* n, PyObject *v, PyObject *fv, PyObject *cell, PyObject* fn, PyObject *name, int fline, PyObject *lnos) { PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; - PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL; + PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *empty=NULL; const char *fn_cstr=NULL; const char *name_cstr=NULL; - PyCodeObject* co=NULL; + PyCodeObject *co=NULL, *result=NULL; PyObject *type, *value, *traceback; PyErr_Fetch(&type, &value, &traceback); if (!(kwds=PyDict_New())) goto end; if (!(argcount=PyLong_FromLong(a))) goto end; if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end; - if (!(posonlyargcount=PyLong_FromLong(0))) goto end; + if (!(posonlyargcount=PyLong_FromLong(p))) goto end; if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end; if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end; @@ -363,18 +607,11 @@ END: Cython Metadata */ if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; - if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too; - if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here - if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too; - Py_XDECREF((PyObject*)co); - co = (PyCodeObject*)call_result; - call_result = NULL; - if (0) { - cleanup_code_too: - Py_XDECREF((PyObject*)co); - co = NULL; - } - end: + if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto end; + if (!(empty = PyTuple_New(0))) goto end; + result = (PyCodeObject*) PyObject_Call(replace, empty, kwds); + end: + Py_XDECREF((PyObject*) co); Py_XDECREF(kwds); Py_XDECREF(argcount); Py_XDECREF(posonlyargcount); @@ -382,18 +619,56 @@ END: Cython Metadata */ Py_XDECREF(nlocals); Py_XDECREF(stacksize); Py_XDECREF(replace); - Py_XDECREF(call_result); Py_XDECREF(empty); if (type) { PyErr_Restore(type, value, traceback); } - return co; + return result; } +#elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif - #define __Pyx_DefaultClassType PyType_Type +#endif +#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) + #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) +#else + #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) + #define __Pyx_Py_Is(x, y) Py_Is(x, y) +#else + #define __Pyx_Py_Is(x, y) ((x) == (y)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) + #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) +#else + #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) + #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) +#else + #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) + #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) +#else + #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) +#endif +#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) +#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) +#else + #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) +#endif +#ifndef CO_COROUTINE + #define CO_COROUTINE 0x80 +#endif +#ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x200 #endif #ifndef Py_TPFLAGS_CHECKTYPES #define Py_TPFLAGS_CHECKTYPES 0 @@ -407,6 +682,12 @@ END: Cython Metadata */ #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif +#ifndef Py_TPFLAGS_SEQUENCE + #define Py_TPFLAGS_SEQUENCE 0 +#endif +#ifndef Py_TPFLAGS_MAPPING + #define Py_TPFLAGS_MAPPING 0 +#endif #ifndef METH_STACKLESS #define METH_STACKLESS 0 #endif @@ -421,30 +702,53 @@ END: Cython Metadata */ #define __Pyx_PyCFunctionFast _PyCFunctionFast #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords #endif -#if CYTHON_FAST_PYCCALL -#define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))))) +#if CYTHON_METH_FASTCALL + #define __Pyx_METH_FASTCALL METH_FASTCALL + #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast + #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords #else -#define __Pyx_PyFastCFunction_Check(func) 0 + #define __Pyx_METH_FASTCALL METH_VARARGS + #define __Pyx_PyCFunction_FastCall PyCFunction + #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords +#endif +#if CYTHON_VECTORCALL + #define __pyx_vectorcallfunc vectorcallfunc + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET + #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) +#elif CYTHON_BACKPORT_VECTORCALL + typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args, + size_t nargsf, PyObject *kwnames); + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1)) + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)) +#else + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) +#endif +#if PY_VERSION_HEX < 0x030900B1 + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) + typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); +#else + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) + #define __Pyx_PyCMethod PyCMethod +#endif +#ifndef METH_METHOD + #define METH_METHOD 0x200 #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) #define PyObject_Malloc(s) PyMem_Malloc(s) #define PyObject_Free(p) PyMem_Free(p) #define PyObject_Realloc(p) PyMem_Realloc(p) #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1 - #define PyMem_RawMalloc(n) PyMem_Malloc(n) - #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) - #define PyMem_RawFree(p) PyMem_Free(p) -#endif -#if CYTHON_COMPILING_IN_PYSTON - #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) #else #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) #endif -#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyThreadState_Current PyThreadState_Get() +#elif !CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_Current PyThreadState_GET() #elif PY_VERSION_HEX >= 0x03060000 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() @@ -453,6 +757,22 @@ END: Cython Metadata */ #else #define __Pyx_PyThreadState_Current _PyThreadState_Current #endif +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op) +{ + void *result; + result = PyModule_GetState(op); + if (!result) + Py_FatalError("Couldn't find the module state"); + return result; +} +#endif +#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) +#else + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) +#endif #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) #include "pythread.h" #define Py_tss_NEEDS_INIT 0 @@ -483,6 +803,28 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { return PyThread_get_key_value(*key); } #endif +#if PY_MAJOR_VERSION < 3 + #if CYTHON_COMPILING_IN_PYPY + #if PYPY_VERSION_NUM < 0x07030600 + #if defined(__cplusplus) && __cplusplus >= 201402L + [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]] + #elif defined(__GNUC__) || defined(__clang__) + __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))) + #elif defined(_MSC_VER) + __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")) + #endif + static CYTHON_INLINE int PyGILState_Check(void) { + return 0; + } + #else // PYPY_VERSION_NUM < 0x07030600 + #endif // PYPY_VERSION_NUM < 0x07030600 + #else + static CYTHON_INLINE int PyGILState_Check(void) { + PyThreadState * tstate = _PyThreadState_Current; + return tstate && (tstate == PyGILState_GetThisThreadState()); + } + #endif +#endif #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) #else @@ -495,34 +837,86 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS -#define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && CYTHON_USE_UNICODE_INTERNALS +#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { + PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); + if (res == NULL) PyErr_Clear(); + return res; +} +#elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000) +#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#else +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { +#if CYTHON_COMPILING_IN_PYPY + return PyDict_GetItem(dict, name); +#else + PyDictEntry *ep; + PyDictObject *mp = (PyDictObject*) dict; + long hash = ((PyStringObject *) name)->ob_shash; + assert(hash != -1); + ep = (mp->ma_lookup)(mp, name, hash); + if (ep == NULL) { + return NULL; + } + return ep->me_value; +#endif +} +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#endif +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) + #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) + #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext) +#else + #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) + #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) + #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next +#endif +#if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000 +#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ + PyTypeObject *type = Py_TYPE(obj);\ + assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ + PyObject_GC_Del(obj);\ + Py_DECREF(type);\ +} #else -#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) +#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) #endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) +#if CYTHON_COMPILING_IN_LIMITED_API #define CYTHON_PEP393_ENABLED 1 - #if defined(PyUnicode_IS_READY) - #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ - 0 : _PyUnicode_Ready((PyObject *)(op))) - #else #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) + #define __Pyx_PyUnicode_DATA(u) ((void*)u) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) +#elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_READY(op) (0) + #else + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ + 0 : _PyUnicode_Ready((PyObject *)(op))) #endif #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) + #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) - #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE) - #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) - #else - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) - #endif + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch) + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) #else - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) + #else + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) + #endif #endif #else #define CYTHON_PEP393_ENABLED 0 @@ -532,11 +926,11 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) - #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE)) #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) #endif #if CYTHON_COMPILING_IN_PYPY @@ -547,14 +941,20 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) #endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) +#if CYTHON_COMPILING_IN_PYPY + #if !defined(PyUnicode_DecodeUnicodeEscape) + #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) + #endif + #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500) + #undef PyUnicode_Contains + #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) + #endif + #if !defined(PyByteArray_Check) + #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) + #endif + #if !defined(PyObject_Format) + #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) + #endif #endif #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) @@ -583,8 +983,14 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) #endif +#if CYTHON_COMPILING_IN_CPYTHON + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#else + #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) +#endif #ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) + #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) #endif #if PY_VERSION_HEX >= 0x030900A4 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) @@ -603,6 +1009,8 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define __Pyx_Py3Int_Check(op) PyLong_Check(op) + #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong @@ -614,6 +1022,9 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define PyNumber_Int PyNumber_Long +#else + #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op)) + #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op)) #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject @@ -631,11 +1042,6 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t #endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) -#endif #if CYTHON_USE_ASYNC_SLOTS #if PY_VERSION_HEX >= 0x030500B1 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods @@ -654,8 +1060,10 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { } __Pyx_PyAsyncMethodsStruct; #endif -#if defined(WIN32) || defined(MS_WINDOWS) - #define _USE_MATH_DEFINES +#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) + #if !defined(_USE_MATH_DEFINES) + #define _USE_MATH_DEFINES + #endif #endif #include #ifdef NAN @@ -678,7 +1086,16 @@ static CYTHON_INLINE float __PYX_NAN() { #define __PYX_ERR(f_index, lineno, Ln_error) \ { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } -#ifndef __PYX_EXTERN_C +#ifdef CYTHON_EXTERN_C + #undef __PYX_EXTERN_C + #define __PYX_EXTERN_C CYTHON_EXTERN_C +#elif defined(__PYX_EXTERN_C) + #ifdef _MSC_VER + #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") + #else + #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. + #endif +#else #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else @@ -760,9 +1177,9 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) @@ -770,11 +1187,22 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const wchar_t *u) +{ + const wchar_t *u_end = u; + while (*u_end++) ; + return (size_t)(u_end - u - 1); +} +#else +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) +{ const Py_UNICODE *u_end = u; while (*u_end++) ; return (size_t)(u_end - u - 1); } +#endif +#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode @@ -800,7 +1228,52 @@ static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #else #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) #endif -#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) +#if CYTHON_USE_PYLONG_INTERNALS + #if PY_VERSION_HEX >= 0x030C00A7 + #ifndef _PyLong_SIGN_MASK + #define _PyLong_SIGN_MASK 3 + #endif + #ifndef _PyLong_NON_SIZE_BITS + #define _PyLong_NON_SIZE_BITS 3 + #endif + #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) + #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) + #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) + #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) + #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_SignedDigitCount(x)\ + ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) + #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) + #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) + #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) + #else + #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) + #endif + typedef Py_ssize_t __Pyx_compact_pylong; + typedef size_t __Pyx_compact_upylong; + #else // Py < 3.12 + #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) + #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) + #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) + #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) + #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) + #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) + #define __Pyx_PyLong_CompactValue(x)\ + ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) + typedef sdigit __Pyx_compact_pylong; + typedef digit __Pyx_compact_upylong; + #endif + #if PY_VERSION_HEX >= 0x030C00A5 + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) + #else + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) + #endif +#endif #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII static int __Pyx_sys_getdefaultencoding_not_ascii; static int __Pyx_init_sys_getdefaultencoding_params(void) { @@ -822,7 +1295,7 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { char ascii_chars[128]; int c; for (c = 0; c < 128; c++) { - ascii_chars[c] = c; + ascii_chars[c] = (char) c; } __Pyx_sys_getdefaultencoding_not_ascii = 1; ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); @@ -887,27 +1360,29 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { #endif /* __GNUC__ */ static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } +#if !CYTHON_USE_MODULE_STATE static PyObject *__pyx_m = NULL; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_cython_runtime = NULL; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static PyObject *__pyx_empty_unicode; +#endif static int __pyx_lineno; static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; +static const char * __pyx_cfilenm = __FILE__; static const char *__pyx_filename; +/* #### Code section: filename_table ### */ static const char *__pyx_f[] = { "arrex/dtypes.pyx", + "contextvars.pxd", "arrex/dtypes.pxd", - "stringsource", + "", "type.pxd", "bool.pxd", "complex.pxd", }; +/* #### Code section: utility_code_proto_before_types ### */ +/* #### Code section: numeric_typedefs ### */ +/* #### Code section: complex_type_declarations ### */ +/* #### Code section: type_declarations ### */ /*--- Type declarations ---*/ struct __pyx_obj_5arrex_6dtypes_DDType; @@ -916,6 +1391,32 @@ struct __pyx_obj_5arrex_6dtypes_DDTypeCType; struct __pyx_obj_5arrex_6dtypes_DDTypeExtension; struct __pyx_obj_5arrex_6dtypes__head; struct __pyx_obj_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct; +struct __pyx_opt_args_7cpython_11contextvars_get_value; +struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default; + +/* "cpython/contextvars.pxd":112 + * + * + * cdef inline object get_value(var, default_value=None): # <<<<<<<<<<<<<< + * """Return a new reference to the value of the context variable, + * or the default value of the context variable, + */ +struct __pyx_opt_args_7cpython_11contextvars_get_value { + int __pyx_n; + PyObject *default_value; +}; + +/* "cpython/contextvars.pxd":129 + * + * + * cdef inline object get_value_no_default(var, default_value=None): # <<<<<<<<<<<<<< + * """Return a new reference to the value of the context variable, + * or the provided default value if no such value was found. + */ +struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default { + int __pyx_n; + PyObject *default_value; +}; struct __pyx_opt_args_5arrex_6dtypes_declare; /* "arrex/dtypes.pxd":11 @@ -1078,6 +1579,7 @@ struct __pyx_vtabstruct_5arrex_6dtypes_DDTypeExtension { PyObject *(*_ext_unpack)(struct __pyx_obj_5arrex_6dtypes_DDTypeExtension *, void *); }; static struct __pyx_vtabstruct_5arrex_6dtypes_DDTypeExtension *__pyx_vtabptr_5arrex_6dtypes_DDTypeExtension; +/* #### Code section: utility_code_proto ### */ /* --- Runtime support code (head) --- */ /* Refnanny.proto */ @@ -1086,11 +1588,11 @@ static struct __pyx_vtabstruct_5arrex_6dtypes_DDTypeExtension *__pyx_vtabptr_5ar #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 (*INCREF)(void*, PyObject*, Py_ssize_t); + void (*DECREF)(void*, PyObject*, Py_ssize_t); + void (*GOTREF)(void*, PyObject*, Py_ssize_t); + void (*GIVEREF)(void*, PyObject*, Py_ssize_t); + void* (*SetupContext)(const char*, Py_ssize_t, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; @@ -1100,28 +1602,40 @@ static struct __pyx_vtabstruct_5arrex_6dtypes_DDTypeExtension *__pyx_vtabptr_5ar #define __Pyx_RefNannySetupContext(name, acquire_gil)\ if (acquire_gil) {\ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ PyGILState_Release(__pyx_gilstate_save);\ } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__)) + #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext() #endif + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } #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) + #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); else {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContextNogil() #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) @@ -1132,7 +1646,11 @@ static struct __pyx_vtabstruct_5arrex_6dtypes_DDTypeExtension *__pyx_vtabptr_5ar #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif -#define __Pyx_XDECREF_SET(r, v) do {\ +#define __Pyx_Py_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; Py_XDECREF(tmp);\ + } while (0) +#define __Pyx_XDECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_XDECREF(tmp);\ } while (0) @@ -1143,6 +1661,57 @@ static struct __pyx_vtabstruct_5arrex_6dtypes_DDTypeExtension *__pyx_vtabptr_5ar #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) +/* PyErrExceptionMatches.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); +#else +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) +#endif + +/* PyThreadStateGet.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; +#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; +#if PY_VERSION_HEX >= 0x030C00A6 +#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) +#else +#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) +#endif +#else +#define __Pyx_PyThreadState_declare +#define __Pyx_PyThreadState_assign +#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) +#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() +#endif + +/* PyErrFetchRestore.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) +#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 +#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) +#else +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#endif +#else +#define __Pyx_PyErr_Clear() PyErr_Clear() +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) +#endif + /* PyObjectGetAttrStr.proto */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); @@ -1150,31 +1719,78 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) #endif +/* PyObjectGetAttrStrNoError.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + /* GetBuiltinName.proto */ static PyObject *__Pyx_GetBuiltinName(PyObject *name); -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); +/* TupleAndListFromArray.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); +static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); +#endif + +/* IncludeStringH.proto */ +#include + +/* BytesEquals.proto */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); + +/* UnicodeEquals.proto */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); + +/* fastcall.proto */ +#define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i) +#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) +#define __Pyx_KwValues_VARARGS(args, nargs) NULL +#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) +#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) +#if CYTHON_METH_FASTCALL + #define __Pyx_Arg_FASTCALL(args, i) args[i] + #define __Pyx_NumKwargs_FASTCALL(kwds) PyTuple_GET_SIZE(kwds) + #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) + static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); + #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) +#else + #define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS + #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS + #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS + #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS + #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS +#endif +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start) #else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) #endif /* PyFunctionFastCall.proto */ #if CYTHON_FAST_PYCALL +#if !CYTHON_VECTORCALL #define __Pyx_PyFunction_FastCall(func, args, nargs)\ __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); -#else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) #endif #define __Pyx_BUILD_ASSERT_EXPR(cond)\ (sizeof(char [1 - 2*!(cond)]) - 1) #ifndef Py_MEMBER_SIZE #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) #endif -#if CYTHON_FAST_PYCALL +#if !CYTHON_VECTORCALL +#if PY_VERSION_HEX >= 0x03080000 + #include "frameobject.h" +#if PY_VERSION_HEX >= 0x030b00a6 + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif + #define __Pxy_PyFrame_Initialize_Offsets() + #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus) +#else static size_t __pyx_pyframe_localsplus_offset = 0; #include "frameobject.h" #define __Pxy_PyFrame_Initialize_Offsets()\ @@ -1182,7 +1798,8 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) #define __Pyx_PyFrame_GetLocalsplus(frame)\ (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) -#endif // CYTHON_FAST_PYCALL +#endif +#endif #endif /* PyObjectCall.proto */ @@ -1192,90 +1809,42 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) #endif -/* PyObjectCall2Args.proto */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); - /* PyObjectCallMethO.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); #endif +/* PyObjectFastCall.proto */ +#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs); + /* PyObjectCallOneArg.proto */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); -/* PyThreadStateGet.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; -#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type -#else -#define __Pyx_PyThreadState_declare -#define __Pyx_PyThreadState_assign -#define __Pyx_PyErr_Occurred() PyErr_Occurred() -#endif - -/* PyErrFetchRestore.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) -#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) -#else -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#endif -#else -#define __Pyx_PyErr_Clear() PyErr_Clear() -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) -#endif +/* RaiseDoubleKeywords.proto */ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); -/* RaiseException.proto */ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); +/* ParseKeywords.proto */ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues, + PyObject **argnames[], + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, + const char* function_name); /* RaiseArgTupleInvalid.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); -/* RaiseDoubleKeywords.proto */ -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); - -/* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ - const char* function_name); +/* RaiseException.proto */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /* ArgTypeTest.proto */ #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ - ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ + ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\ __Pyx__ArgTypeTest(obj, type, name, exact)) static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); -/* IncludeStringH.proto */ -#include - -/* BytesEquals.proto */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); - -/* PyErrExceptionMatches.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) -static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); -#else -#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) -#endif - -/* GetAttr.proto */ -static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); +/* RaiseUnexpectedTypeError.proto */ +static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj); /* GetAttr3.proto */ static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); @@ -1308,18 +1877,18 @@ static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UIN /* GetModuleGlobalName.proto */ #if CYTHON_USE_DICT_VERSIONS -#define __Pyx_GetModuleGlobalName(var, name) {\ +#define __Pyx_GetModuleGlobalName(var, name) do {\ static PY_UINT64_T __pyx_dict_version = 0;\ static PyObject *__pyx_dict_cached_value = NULL;\ (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} -#define __Pyx_GetModuleGlobalNameUncached(var, name) {\ +} while(0) +#define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ PY_UINT64_T __pyx_dict_version;\ PyObject *__pyx_dict_cached_value;\ (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} +} while(0) static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); #else #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) @@ -1327,27 +1896,74 @@ static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_ve static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); #endif -/* None.proto */ +/* RaiseClosureNameError.proto */ static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname); +/* IncludeStructmemberH.proto */ +#include + +/* FixUpExtensionType.proto */ +#if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); +#endif + +/* FetchSharedCythonModule.proto */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void); + /* FetchCommonType.proto */ +#if !CYTHON_USE_TYPE_SPECS static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); +#else +static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases); +#endif + +/* PyMethodNew.proto */ +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + return PyMethod_New(func, self); +} +#else + #define __Pyx_PyMethod_New PyMethod_New +#endif + +/* PyVectorcallFastCallDict.proto */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); +#endif /* CythonFunctionShared.proto */ -#define __Pyx_CyFunction_USED 1 +#define __Pyx_CyFunction_USED #define __Pyx_CYFUNCTION_STATICMETHOD 0x01 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 #define __Pyx_CYFUNCTION_CCLASS 0x04 +#define __Pyx_CYFUNCTION_COROUTINE 0x08 #define __Pyx_CyFunction_GetClosure(f)\ (((__pyx_CyFunctionObject *) (f))->func_closure) -#define __Pyx_CyFunction_GetClassObj(f)\ - (((__pyx_CyFunctionObject *) (f))->func_classobj) +#if PY_VERSION_HEX < 0x030900B1 + #define __Pyx_CyFunction_GetClassObj(f)\ + (((__pyx_CyFunctionObject *) (f))->func_classobj) +#else + #define __Pyx_CyFunction_GetClassObj(f)\ + ((PyObject*) ((PyCMethodObject *) (f))->mm_class) +#endif +#define __Pyx_CyFunction_SetClassObj(f, classobj)\ + __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) #define __Pyx_CyFunction_Defaults(type, f)\ ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) typedef struct { +#if PY_VERSION_HEX < 0x030900B1 PyCFunctionObject func; +#else + PyCMethodObject func; +#endif +#if CYTHON_BACKPORT_VECTORCALL + __pyx_vectorcallfunc func_vectorcall; +#endif #if PY_VERSION_HEX < 0x030500A0 PyObject *func_weakreflist; #endif @@ -1358,7 +1974,9 @@ typedef struct { PyObject *func_globals; PyObject *func_code; PyObject *func_closure; +#if PY_VERSION_HEX < 0x030900B1 PyObject *func_classobj; +#endif void *defaults; int defaults_pyobjects; size_t defaults_size; // used by FusedFunction for copying defaults @@ -1367,14 +1985,17 @@ typedef struct { PyObject *defaults_kwdict; PyObject *(*defaults_getter)(PyObject *); PyObject *func_annotations; + PyObject *func_is_coroutine; } __pyx_CyFunctionObject; -static PyTypeObject *__pyx_CyFunctionType = 0; -#define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType)) +#define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_CyFunctionType) +#define __Pyx_IsCyOrPyCFunction(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type) +#define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType) static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, int flags, PyObject* qualname, - PyObject *self, + PyObject *closure, PyObject *module, PyObject *globals, PyObject* code); +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, size_t size, int pyobjects); @@ -1384,7 +2005,18 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, PyObject *dict); static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, PyObject *dict); -static int __pyx_CyFunction_init(void); +static int __pyx_CyFunction_init(PyObject *module); +#if CYTHON_METH_FASTCALL +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +#if CYTHON_BACKPORT_VECTORCALL +#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) +#else +#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) +#endif +#endif /* CythonFunction.proto */ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, @@ -1400,13 +2032,6 @@ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, #define __Pyx_PyCallable_Check(obj) PyCallable_Check(obj) #endif -/* PyObjectCallNoArg.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); -#else -#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) -#endif - /* dict_getitem_default.proto */ static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value); @@ -1439,7 +2064,7 @@ static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction * static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /* GetTopmostException.proto */ -#if CYTHON_USE_EXC_INFO_STACK +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); #endif @@ -1462,12 +2087,24 @@ static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); #endif +/* KeywordStringCheck.proto */ +static int __Pyx_CheckKeywordStrings(PyObject *kw, const char* function_name, int kw_allowed); + +/* PySequenceContains.proto */ +static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) { + int result = PySequence_Contains(seq, item); + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + /* Import.proto */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /* ImportFrom.proto */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); +/* GetAttr.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); + /* HasAttr.proto */ static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); @@ -1493,6 +2130,23 @@ static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, int wraparound, int boundscheck); +/* PyObjectCallNoArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); + +/* PyObjectGetMethod.proto */ +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); + +/* PyObjectCallMethod0.proto */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); + +/* ValidateBasesTuple.proto */ +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases); +#endif + +/* PyType_Ready.proto */ +CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t); + /* PyObject_GenericGetAttrNoDict.proto */ #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name); @@ -1508,28 +2162,49 @@ static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_nam #endif /* SetVTable.proto */ -static int __Pyx_SetVtable(PyObject *dict, void *vtable); +static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable); -/* PyObjectGetAttrStrNoError.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); +/* GetVTable.proto */ +static void* __Pyx_GetVtable(PyTypeObject *type); + +/* MergeVTables.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_MergeVtables(PyTypeObject *type); +#endif /* SetupReduce.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API static int __Pyx_setup_reduce(PyObject* type_obj); +#endif /* TypeImport.proto */ -#ifndef __PYX_HAVE_RT_ImportType_proto -#define __PYX_HAVE_RT_ImportType_proto -enum __Pyx_ImportType_CheckSize { - __Pyx_ImportType_CheckSize_Error = 0, - __Pyx_ImportType_CheckSize_Warn = 1, - __Pyx_ImportType_CheckSize_Ignore = 2 +#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_0 +#define __PYX_HAVE_RT_ImportType_proto_3_0_0 +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +#include +#endif +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_0(s) alignof(s) +#else +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_0(s) sizeof(void*) +#endif +enum __Pyx_ImportType_CheckSize_3_0_0 { + __Pyx_ImportType_CheckSize_Error_3_0_0 = 0, + __Pyx_ImportType_CheckSize_Warn_3_0_0 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_0_0 = 2 }; -static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size); +static PyTypeObject *__Pyx_ImportType_3_0_0(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_0 check_size); +#endif + +/* ImportDottedModule.proto */ +static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple); +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple); #endif /* ClassMethod.proto */ #include "descrobject.h" -static CYTHON_UNUSED PyObject* __Pyx_Method_ClassMethod(PyObject *method); +CYTHON_UNUSED static PyObject* __Pyx_Method_ClassMethod(PyObject *method); /* GetNameInClass.proto */ #define __Pyx_GetNameInClass(var, nmspace, name) (var) = __Pyx__GetNameInClass(nmspace, name) @@ -1543,6 +2218,7 @@ static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); #endif /* CodeObjectCache.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API typedef struct { PyCodeObject* code_object; int code_line; @@ -1556,13 +2232,14 @@ static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); +#endif /* AddTraceback.proto */ static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); /* GCCDiagnostics.proto */ -#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) #define __Pyx_HAS_GCC_DIAGNOSTIC #endif @@ -1575,20 +2252,37 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); +/* FormatTypeName.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%U" +static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp); +#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) +#else +typedef const char *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%.200s" +#define __Pyx_PyType_GetName(tp) ((tp)->tp_name) +#define __Pyx_DECREF_TypeName(obj) +#endif + /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); /* FastTypeChecks.proto */ #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); #else #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) #endif +#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) /* CheckBinaryVersion.proto */ @@ -1600,6 +2294,9 @@ static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *s /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); +/* #### Code section: module_declarations ### */ +static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4real_real(PyComplexObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4imag_imag(PyComplexObject *__pyx_v_self); /* proto*/ static int __pyx_f_5arrex_6dtypes_15DDTypeFunctions__func_pack(struct __pyx_obj_5arrex_6dtypes_DDTypeFunctions *__pyx_v_self, void *__pyx_v_place, PyObject *__pyx_v_obj); /* proto*/ static PyObject *__pyx_f_5arrex_6dtypes_15DDTypeFunctions__func_unpack(struct __pyx_obj_5arrex_6dtypes_DDTypeFunctions *__pyx_v_self, void *__pyx_v_place); /* proto*/ static int __pyx_f_5arrex_6dtypes_11DDTypeCType__ctype_pack(struct __pyx_obj_5arrex_6dtypes_DDTypeCType *__pyx_v_self, void *__pyx_v_place, PyObject *__pyx_v_obj); /* proto*/ @@ -1608,114 +2305,119 @@ static void *__pyx_f_5arrex_6dtypes_15DDTypeExtension__raw(struct __pyx_obj_5arr static int __pyx_f_5arrex_6dtypes_15DDTypeExtension__ext_pack(struct __pyx_obj_5arrex_6dtypes_DDTypeExtension *__pyx_v_self, void *__pyx_v_place, PyObject *__pyx_v_obj); /* proto*/ static PyObject *__pyx_f_5arrex_6dtypes_15DDTypeExtension__ext_unpack(struct __pyx_obj_5arrex_6dtypes_DDTypeExtension *__pyx_v_self, void *__pyx_v_place); /* proto*/ -/* Module declarations from 'cython' */ +/* Module declarations from "cython" */ + +/* Module declarations from "cpython.version" */ -/* Module declarations from 'cpython.version' */ +/* Module declarations from "__builtin__" */ -/* Module declarations from '__builtin__' */ +/* Module declarations from "cpython.type" */ -/* Module declarations from 'cpython.type' */ -static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; +/* Module declarations from "libc.string" */ -/* Module declarations from 'libc.string' */ +/* Module declarations from "libc.stdio" */ -/* Module declarations from 'libc.stdio' */ +/* Module declarations from "cpython.object" */ -/* Module declarations from 'cpython.object' */ +/* Module declarations from "cpython.ref" */ -/* Module declarations from 'cpython.ref' */ +/* Module declarations from "cpython.exc" */ -/* Module declarations from 'cpython.exc' */ +/* Module declarations from "cpython.module" */ -/* Module declarations from 'cpython.module' */ +/* Module declarations from "cpython.mem" */ -/* Module declarations from 'cpython.mem' */ +/* Module declarations from "cpython.tuple" */ -/* Module declarations from 'cpython.tuple' */ +/* Module declarations from "cpython.list" */ -/* Module declarations from 'cpython.list' */ +/* Module declarations from "cpython.sequence" */ -/* Module declarations from 'cpython.sequence' */ +/* Module declarations from "cpython.mapping" */ -/* Module declarations from 'cpython.mapping' */ +/* Module declarations from "cpython.iterator" */ -/* Module declarations from 'cpython.iterator' */ +/* Module declarations from "cpython.number" */ -/* Module declarations from 'cpython.number' */ +/* Module declarations from "cpython.int" */ -/* Module declarations from 'cpython.int' */ +/* Module declarations from "__builtin__" */ -/* Module declarations from '__builtin__' */ +/* Module declarations from "cpython.bool" */ -/* Module declarations from 'cpython.bool' */ -static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0; +/* Module declarations from "cpython.long" */ -/* Module declarations from 'cpython.long' */ +/* Module declarations from "cpython.float" */ -/* Module declarations from 'cpython.float' */ +/* Module declarations from "__builtin__" */ -/* Module declarations from '__builtin__' */ +/* Module declarations from "cpython.complex" */ -/* Module declarations from 'cpython.complex' */ -static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0; +/* Module declarations from "cpython.string" */ -/* Module declarations from 'cpython.string' */ +/* Module declarations from "cpython.unicode" */ -/* Module declarations from 'cpython.unicode' */ +/* Module declarations from "cpython.pyport" */ -/* Module declarations from 'cpython.dict' */ +/* Module declarations from "cpython.dict" */ -/* Module declarations from 'cpython.instance' */ +/* Module declarations from "cpython.instance" */ -/* Module declarations from 'cpython.function' */ +/* Module declarations from "cpython.function" */ -/* Module declarations from 'cpython.method' */ +/* Module declarations from "cpython.method" */ -/* Module declarations from 'cpython.weakref' */ +/* Module declarations from "cpython.weakref" */ -/* Module declarations from 'cpython.getargs' */ +/* Module declarations from "cpython.getargs" */ -/* Module declarations from 'cpython.pythread' */ +/* Module declarations from "cpython.pythread" */ -/* Module declarations from 'cpython.pystate' */ +/* Module declarations from "cpython.pystate" */ -/* Module declarations from 'cpython.cobject' */ +/* Module declarations from "cpython.cobject" */ -/* Module declarations from 'cpython.oldbuffer' */ +/* Module declarations from "cpython.oldbuffer" */ -/* Module declarations from 'cpython.set' */ +/* Module declarations from "cpython.set" */ -/* Module declarations from 'cpython.buffer' */ +/* Module declarations from "cpython.buffer" */ -/* Module declarations from 'cpython.bytes' */ +/* Module declarations from "cpython.bytes" */ -/* Module declarations from 'cpython.pycapsule' */ +/* Module declarations from "cpython.pycapsule" */ -/* Module declarations from 'cpython' */ +/* Module declarations from "cpython.contextvars" */ -/* Module declarations from 'arrex.dtypes' */ -static PyTypeObject *__pyx_ptype_5arrex_6dtypes_DDType = 0; -static PyTypeObject *__pyx_ptype_5arrex_6dtypes_DDTypeFunctions = 0; -static PyTypeObject *__pyx_ptype_5arrex_6dtypes_DDTypeCType = 0; -static PyTypeObject *__pyx_ptype_5arrex_6dtypes_DDTypeExtension = 0; -static PyTypeObject *__pyx_ptype_5arrex_6dtypes__head = 0; -static PyTypeObject *__pyx_ptype_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct = 0; +/* Module declarations from "cpython" */ + +/* Module declarations from "arrex.dtypes" */ static PyObject *__pyx_v_5arrex_6dtypes__declared = 0; static PyObject *__pyx_v_5arrex_6dtypes__empty = 0; static struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_f_5arrex_6dtypes_declare(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_5arrex_6dtypes_declare *__pyx_optional_args); /*proto*/ static struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_f_5arrex_6dtypes_declared(PyObject *, int __pyx_skip_dispatch); /*proto*/ static PyObject *__pyx_f_5arrex_6dtypes_isctype(PyObject *); /*proto*/ static PyObject *__pyx_f_5arrex_6dtypes___pyx_unpickle__head__set_state(struct __pyx_obj_5arrex_6dtypes__head *, PyObject *); /*proto*/ +/* #### Code section: typeinfo ### */ +/* #### Code section: before_global_var ### */ #define __Pyx_MODULE_NAME "arrex.dtypes" extern int __pyx_module_is_main_arrex__dtypes; int __pyx_module_is_main_arrex__dtypes = 0; -/* Implementation of 'arrex.dtypes' */ +/* Implementation of "arrex.dtypes" */ +/* #### Code section: global_var ### */ static PyObject *__pyx_builtin_id; static PyObject *__pyx_builtin_TypeError; static PyObject *__pyx_builtin_ValueError; +/* #### Code section: string_decls ### */ +static const char __pyx_k_o[] = "o"; static const char __pyx_k__2[] = ""; +static const char __pyx_k_gc[] = "gc"; static const char __pyx_k_id[] = "id"; +static const char __pyx_k__17[] = "."; +static const char __pyx_k__18[] = "*"; +static const char __pyx_k__42[] = "?"; +static const char __pyx_k_cls[] = "cls"; static const char __pyx_k_ext[] = "ext"; static const char __pyx_k_get[] = "get"; static const char __pyx_k_key[] = "key"; @@ -1725,15 +2427,20 @@ static const char __pyx_k_head[] = "_head"; static const char __pyx_k_main[] = "__main__"; static const char __pyx_k_name[] = "__name__"; static const char __pyx_k_pack[] = "pack"; +static const char __pyx_k_self[] = "self"; static const char __pyx_k_size[] = "size"; +static const char __pyx_k_spec[] = "__spec__"; static const char __pyx_k_test[] = "__test__"; static const char __pyx_k_type[] = "type"; static const char __pyx_k_bytes[] = "__bytes__"; static const char __pyx_k_dsize[] = "dsize"; static const char __pyx_k_dtype[] = ""; +static const char __pyx_k_state[] = "state"; static const char __pyx_k_DDType[] = "DDType"; static const char __pyx_k_Struct[] = "Struct"; static const char __pyx_k_ctypes[] = "ctypes"; +static const char __pyx_k_dict_2[] = "_dict"; +static const char __pyx_k_enable[] = "enable"; static const char __pyx_k_encode[] = "encode"; static const char __pyx_k_format[] = "format"; static const char __pyx_k_import[] = "__import__"; @@ -1744,19 +2451,25 @@ static const char __pyx_k_sizeof[] = "sizeof"; static const char __pyx_k_struct[] = "struct"; static const char __pyx_k_unpack[] = "unpack"; static const char __pyx_k_update[] = "update"; +static const char __pyx_k_declare[] = "declare"; +static const char __pyx_k_disable[] = "disable"; static const char __pyx_k_dtype_2[] = "dtype"; static const char __pyx_k_rebuild[] = "_rebuild"; static const char __pyx_k_tobytes[] = "tobytes"; static const char __pyx_k_calcsize[] = "calcsize"; +static const char __pyx_k_declared[] = "declared"; static const char __pyx_k_dtype_at[] = ""; static const char __pyx_k_getstate[] = "__getstate__"; static const char __pyx_k_packsize[] = "__packsize__"; +static const char __pyx_k_protocol[] = "protocol"; static const char __pyx_k_pyx_type[] = "__pyx_type"; static const char __pyx_k_setstate[] = "__setstate__"; static const char __pyx_k_to_bytes[] = "to_bytes"; static const char __pyx_k_TypeError[] = "TypeError"; static const char __pyx_k_addressof[] = "addressof"; +static const char __pyx_k_candidate[] = "candidate"; static const char __pyx_k_frombytes[] = "frombytes"; +static const char __pyx_k_isenabled[] = "isenabled"; static const char __pyx_k_pyx_state[] = "__pyx_state"; static const char __pyx_k_reduce_ex[] = "__reduce_ex__"; static const char __pyx_k_ValueError[] = "ValueError"; @@ -1772,29 +2485,40 @@ static const char __pyx_k_constructor[] = "constructor"; static const char __pyx_k_from_buffer[] = "from_buffer"; static const char __pyx_k_DDTypeStruct[] = "DDTypeStruct"; static const char __pyx_k_arrex_dtypes[] = "arrex.dtypes"; +static const char __pyx_k_initializing[] = "_initializing"; +static const char __pyx_k_is_coroutine[] = "_is_coroutine"; static const char __pyx_k_pyx_checksum[] = "__pyx_checksum"; -static const char __pyx_k_stringsource[] = "stringsource"; +static const char __pyx_k_stringsource[] = ""; +static const char __pyx_k_use_setstate[] = "use_setstate"; static const char __pyx_k_reduce_cython[] = "__reduce_cython__"; static const char __pyx_k_DDTypeExtension[] = "DDTypeExtension"; static const char __pyx_k_DDTypeFunctions[] = "DDTypeFunctions"; +static const char __pyx_k_DDType__rebuild[] = "DDType._rebuild"; static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError"; static const char __pyx_k_setstate_cython[] = "__setstate_cython__"; static const char __pyx_k_arrex_dtypes_pyx[] = "arrex/dtypes.pyx"; static const char __pyx_k_dsize_cannot_be_0[] = "dsize cannot be 0"; +static const char __pyx_k_DDType___reduce_ex[] = "DDType.__reduce_ex__"; +static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines"; static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; static const char __pyx_k_pyx_unpickle__head[] = "__pyx_unpickle__head"; static const char __pyx_k_DDTypeClass_line_66[] = "DDTypeClass (line 66)"; static const char __pyx_k_dtype_must_be_a_type[] = "dtype must be a type"; +static const char __pyx_k_head___reduce_cython[] = "_head.__reduce_cython__"; static const char __pyx_k_type_must_be_a_ctype[] = "type must be a ctype"; static const char __pyx_k_DDTypeStruct_line_122[] = "DDTypeStruct (line 122)"; +static const char __pyx_k_head___setstate_cython[] = "_head.__setstate_cython__"; +static const char __pyx_k_DDTypeExtension__rebuild[] = "DDTypeExtension._rebuild"; static const char __pyx_k_DDTypeStruct_locals_lambda[] = "DDTypeStruct.."; +static const char __pyx_k_DDTypeExtension___reduce_ex[] = "DDTypeExtension.__reduce_ex__"; +static const char __pyx_k_DDTypeFunctions___reduce_ex[] = "DDTypeFunctions.__reduce_ex__"; static const char __pyx_k_dsize_must_match_layout_size[] = "dsize must match layout size"; static const char __pyx_k_DDTypeClass_type_Create_a_dtype[] = " DDTypeClass(type)\n\t\n\t\tCreate a dtype from a python class (can be a pure python class) \n\t\t\n\t\tthe given type must have the following attributes:\n\t\t\n\t\t\t- `frombytes` or `from_bytes` or `from_buffer`\n\t\t\t\n\t\t\t\tstatic method that initialize the type from bytes\n\t\t\t\t\n\t\t\t- `__bytes__` or `tobytes` or `to_bytes`\n\t\t\t\t\n\t\t\t\tmethod that converts to bytes, the returned byte must always be of the same size\n\t\t\t\n\t\t\t- `__packlayout__` (optional) string or bytes giving binary format returned by `__bytes__`, it must follow the specifications of module `struct`\n\t\t\t- `__packsize__` (optional) defines the byte size returned by `__bytes__`, optional if `__packlayout__` is provided\n\t\t\t\n\t\tExample:\n\t\t\n\t\t\t>>> class test_class:\n\t\t\t... \t__packlayout__ = 'ff'\n\t\t\t... \t_struct = struct.Struct(__packlayout__)\n\t\t\t... \t\n\t\t\t... \tdef __init__(self, x, y):\n\t\t\t... \t\tself.x = x\n\t\t\t... \t\tself.y = y\n\t\t\t... \t\n\t\t\t... \tdef __bytes__(self):\n\t\t\t... \t\treturn self._struct.pack(self.x, self.y)\n\t\t\t... \t@classmethod\n\t\t\t... \tdef frombytes(cls, b):\n\t\t\t... \t\treturn cls(*cls._struct.unpack(b))\n\t\t\t... \t\t\n\t\t\t... \tdef __repr__(self):\n\t\t\t... \t\treturn '(x={}, y={})'.format(self.x, self.y)\n\t\t\t... \n\t\t\t>>> a = typedlist(dtype=test_class) # no declaration needed\n\t"; static const char __pyx_k_DDTypeStruct_struct_create_a_dt[] = " DDTypeStruct(struct)\n\t\n\t\tcreate a dtype from a Struct object from module `struct` \n\t\n\t\tExample:\n\t\t\t\n\t\t\t>>> a = typedlist(dtype='fxBh') # no declaration needed\n\t"; static const char __pyx_k_The_dtype_is_the_type_of_the_el[] = "\n\tThe *dtype* is the type of the elements in a buffer. Thanks to the ddtype system, it is very easy to create new dtypes on top of pretty much everything.\n\t\n\tDefinitions:\n\t\n\t\t:type: a python type object (typically a class or a builtin type)\n\t\t:dtype: data dtype, meaning the type of the elements in an array, it can be a type, but more generally anything that define a data format.\n\t\t:ddtype: declaration of data type, meaning a packet of things decribing how to pack/unpack that dtype from/to an array\n\t\t\n\ta ddtype always inherits from base class `DDType` which content is implemented at C level.\n"; static const char __pyx_k_cannot_implicitely_convert_into[] = "cannot implicitely convert {} into {}"; static const char __pyx_k_structure_must_be_struct_Struct[] = "structure must be struct.Struct"; -static const char __pyx_k_Incompatible_checksums_s_vs_0xd4[] = "Incompatible checksums (%s vs 0xd41d8cd = ())"; +static const char __pyx_k_Incompatible_checksums_0x_x_vs_0[] = "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())"; static const char __pyx_k_a_dtype_must_be_declared_in_orde[] = "a dtype must be declared in order to be pickleable"; static const char __pyx_k_cannot_store_an_object_of_a_diff[] = "cannot store an object of a different type"; static const char __pyx_k_dsize_must_be_provided_or_deduce[] = "dsize must be provided or deduced from a given layout"; @@ -1808,100 +2532,7 @@ static const char __pyx_k_the_given_type_must_have_a_metho[] = "the given type m static const char __pyx_k_the_pickled_dtype_has_a_differen[] = "the pickled dtype {} has a different size here than in dump, unpickled {} expected {}"; static const char __pyx_k_the_given_type_must_have_a_metho_2[] = "the given type must have a method 'frombytes', 'from_bytes', or 'from_buffer'"; static const char __pyx_k_the_pickled_dtype_has_a_differen_2[] = "the pickled dtype {} has a different memory layout here than in dump, unpickled {} expected {}"; -static PyObject *__pyx_n_s_DDType; -static PyObject *__pyx_n_s_DDTypeCType; -static PyObject *__pyx_n_s_DDTypeClass; -static PyObject *__pyx_kp_u_DDTypeClass_line_66; -static PyObject *__pyx_kp_u_DDTypeClass_type_Create_a_dtype; -static PyObject *__pyx_n_s_DDTypeExtension; -static PyObject *__pyx_n_s_DDTypeFunctions; -static PyObject *__pyx_n_s_DDTypeStruct; -static PyObject *__pyx_kp_u_DDTypeStruct_line_122; -static PyObject *__pyx_n_s_DDTypeStruct_locals_lambda; -static PyObject *__pyx_kp_u_DDTypeStruct_struct_create_a_dt; -static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xd4; -static PyObject *__pyx_n_s_PickleError; -static PyObject *__pyx_n_s_Struct; -static PyObject *__pyx_n_s_TypeError; -static PyObject *__pyx_n_s_ValueError; -static PyObject *__pyx_kp_b__2; -static PyObject *__pyx_kp_u_a_dtype_must_be_declared_in_orde; -static PyObject *__pyx_n_s_addressof; -static PyObject *__pyx_n_s_arrex_dtypes; -static PyObject *__pyx_kp_s_arrex_dtypes_pyx; -static PyObject *__pyx_n_u_bytes; -static PyObject *__pyx_n_s_calcsize; -static PyObject *__pyx_kp_u_cannot_implicitely_convert_into; -static PyObject *__pyx_kp_u_cannot_store_an_object_of_a_diff; -static PyObject *__pyx_n_s_cline_in_traceback; -static PyObject *__pyx_n_s_constructor; -static PyObject *__pyx_n_s_ctypes; -static PyObject *__pyx_n_s_definition; -static PyObject *__pyx_n_s_dict; -static PyObject *__pyx_n_s_dsize; -static PyObject *__pyx_kp_u_dsize_cannot_be_0; -static PyObject *__pyx_kp_u_dsize_must_be_provided_or_deduce; -static PyObject *__pyx_kp_u_dsize_must_match_layout_size; -static PyObject *__pyx_kp_u_dsize_must_not_be_null___packlay; -static PyObject *__pyx_kp_u_dtype; -static PyObject *__pyx_n_s_dtype_2; -static PyObject *__pyx_kp_u_dtype_at; -static PyObject *__pyx_kp_u_dtype_is_not_declared_and_cannot; -static PyObject *__pyx_kp_u_dtype_must_be_a_type; -static PyObject *__pyx_n_s_encode; -static PyObject *__pyx_n_s_ext; -static PyObject *__pyx_n_s_format; -static PyObject *__pyx_kp_u_format_describes_a_too_big_struc; -static PyObject *__pyx_n_s_from_buffer; -static PyObject *__pyx_n_u_from_buffer; -static PyObject *__pyx_n_u_from_bytes; -static PyObject *__pyx_n_u_frombytes; -static PyObject *__pyx_n_s_get; -static PyObject *__pyx_n_s_getstate; -static PyObject *__pyx_n_s_head; -static PyObject *__pyx_n_s_id; -static PyObject *__pyx_n_s_import; -static PyObject *__pyx_n_s_key; -static PyObject *__pyx_n_s_layout; -static PyObject *__pyx_n_s_main; -static PyObject *__pyx_n_s_name; -static PyObject *__pyx_n_s_new; -static PyObject *__pyx_n_s_pack; -static PyObject *__pyx_kp_u_pack_and_unpack_must_be_callable; -static PyObject *__pyx_kp_u_pack_must_provide_a_bytes_object; -static PyObject *__pyx_n_u_packlayout; -static PyObject *__pyx_n_u_packsize; -static PyObject *__pyx_n_s_pickle; -static PyObject *__pyx_n_s_pyx_PickleError; -static PyObject *__pyx_n_s_pyx_checksum; -static PyObject *__pyx_n_s_pyx_result; -static PyObject *__pyx_n_s_pyx_state; -static PyObject *__pyx_n_s_pyx_type; -static PyObject *__pyx_n_s_pyx_unpickle__head; -static PyObject *__pyx_n_s_pyx_vtable; -static PyObject *__pyx_n_s_rebuild; -static PyObject *__pyx_n_s_reduce; -static PyObject *__pyx_n_s_reduce_cython; -static PyObject *__pyx_n_s_reduce_ex; -static PyObject *__pyx_n_s_setstate; -static PyObject *__pyx_n_s_setstate_cython; -static PyObject *__pyx_n_s_size; -static PyObject *__pyx_n_s_sizeof; -static PyObject *__pyx_kp_s_stringsource; -static PyObject *__pyx_n_s_struct; -static PyObject *__pyx_kp_u_structure_must_be_struct_Struct; -static PyObject *__pyx_n_s_test; -static PyObject *__pyx_kp_u_the_dumped_bytes_length_does_not; -static PyObject *__pyx_kp_u_the_given_type_must_have_a_metho; -static PyObject *__pyx_kp_u_the_given_type_must_have_a_metho_2; -static PyObject *__pyx_kp_u_the_pickled_dtype_has_a_differen; -static PyObject *__pyx_kp_u_the_pickled_dtype_has_a_differen_2; -static PyObject *__pyx_n_u_to_bytes; -static PyObject *__pyx_n_u_tobytes; -static PyObject *__pyx_n_s_type; -static PyObject *__pyx_kp_u_type_must_be_a_ctype; -static PyObject *__pyx_n_s_unpack; -static PyObject *__pyx_n_s_update; +/* #### Code section: decls ### */ static PyObject *__pyx_pf_5arrex_6dtypes_6DDType___repr__(struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_5arrex_6dtypes_6DDType_2__reduce_ex__(struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_protocol); /* proto */ static PyObject *__pyx_pf_5arrex_6dtypes_6DDType_4_rebuild(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_key, size_t __pyx_v_dsize, PyObject *__pyx_v_layout); /* proto */ @@ -1948,29 +2579,1312 @@ static PyObject *__pyx_tp_new_5arrex_6dtypes_DDTypeCType(PyTypeObject *t, PyObje static PyObject *__pyx_tp_new_5arrex_6dtypes_DDTypeExtension(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_5arrex_6dtypes__head(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get = {0, &__pyx_n_s_get, 0, 0, 0}; -static PyObject *__pyx_int_222419149; -static PyObject *__pyx_tuple_; -static PyObject *__pyx_tuple__3; -static PyObject *__pyx_tuple__4; -static PyObject *__pyx_tuple__5; -static PyObject *__pyx_tuple__6; -static PyObject *__pyx_tuple__7; -static PyObject *__pyx_tuple__8; -static PyObject *__pyx_tuple__9; -static PyObject *__pyx_tuple__10; -static PyObject *__pyx_tuple__11; -static PyObject *__pyx_tuple__12; -static PyObject *__pyx_tuple__13; -static PyObject *__pyx_tuple__14; -static PyObject *__pyx_tuple__15; -static PyObject *__pyx_tuple__16; -static PyObject *__pyx_tuple__18; -static PyObject *__pyx_tuple__20; -static PyObject *__pyx_codeobj__17; -static PyObject *__pyx_codeobj__19; -static PyObject *__pyx_codeobj__21; -/* Late includes */ +static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get = {0, 0, 0, 0, 0}; +/* #### Code section: late_includes ### */ +/* #### Code section: module_state ### */ +typedef struct { + PyObject *__pyx_d; + PyObject *__pyx_b; + PyObject *__pyx_cython_runtime; + PyObject *__pyx_empty_tuple; + PyObject *__pyx_empty_bytes; + PyObject *__pyx_empty_unicode; + #ifdef __Pyx_CyFunction_USED + PyTypeObject *__pyx_CyFunctionType; + #endif + #ifdef __Pyx_FusedFunction_USED + PyTypeObject *__pyx_FusedFunctionType; + #endif + #ifdef __Pyx_Generator_USED + PyTypeObject *__pyx_GeneratorType; + #endif + #ifdef __Pyx_IterableCoroutine_USED + PyTypeObject *__pyx_IterableCoroutineType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineAwaitType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineType; + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyTypeObject *__pyx_ptype_7cpython_4type_type; + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyTypeObject *__pyx_ptype_7cpython_4bool_bool; + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyTypeObject *__pyx_ptype_7cpython_7complex_complex; + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + PyObject *__pyx_type_5arrex_6dtypes_DDType; + PyObject *__pyx_type_5arrex_6dtypes_DDTypeFunctions; + PyObject *__pyx_type_5arrex_6dtypes_DDTypeCType; + PyObject *__pyx_type_5arrex_6dtypes_DDTypeExtension; + PyObject *__pyx_type_5arrex_6dtypes__head; + PyObject *__pyx_type_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct; + #endif + PyTypeObject *__pyx_ptype_5arrex_6dtypes_DDType; + PyTypeObject *__pyx_ptype_5arrex_6dtypes_DDTypeFunctions; + PyTypeObject *__pyx_ptype_5arrex_6dtypes_DDTypeCType; + PyTypeObject *__pyx_ptype_5arrex_6dtypes_DDTypeExtension; + PyTypeObject *__pyx_ptype_5arrex_6dtypes__head; + PyTypeObject *__pyx_ptype_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct; + PyObject *__pyx_n_s_DDType; + PyObject *__pyx_n_s_DDTypeCType; + PyObject *__pyx_n_s_DDTypeClass; + PyObject *__pyx_kp_u_DDTypeClass_line_66; + PyObject *__pyx_kp_u_DDTypeClass_type_Create_a_dtype; + PyObject *__pyx_n_s_DDTypeExtension; + PyObject *__pyx_n_s_DDTypeExtension___reduce_ex; + PyObject *__pyx_n_s_DDTypeExtension__rebuild; + PyObject *__pyx_n_s_DDTypeFunctions; + PyObject *__pyx_n_s_DDTypeFunctions___reduce_ex; + PyObject *__pyx_n_s_DDTypeStruct; + PyObject *__pyx_kp_u_DDTypeStruct_line_122; + PyObject *__pyx_n_s_DDTypeStruct_locals_lambda; + PyObject *__pyx_kp_u_DDTypeStruct_struct_create_a_dt; + PyObject *__pyx_n_s_DDType___reduce_ex; + PyObject *__pyx_n_s_DDType__rebuild; + PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0; + PyObject *__pyx_n_s_PickleError; + PyObject *__pyx_n_s_Struct; + PyObject *__pyx_n_s_TypeError; + PyObject *__pyx_n_s_ValueError; + PyObject *__pyx_kp_u__17; + PyObject *__pyx_n_s__18; + PyObject *__pyx_kp_b__2; + PyObject *__pyx_n_s__42; + PyObject *__pyx_kp_u_a_dtype_must_be_declared_in_orde; + PyObject *__pyx_n_s_addressof; + PyObject *__pyx_n_s_arrex_dtypes; + PyObject *__pyx_kp_s_arrex_dtypes_pyx; + PyObject *__pyx_n_s_asyncio_coroutines; + PyObject *__pyx_n_u_bytes; + PyObject *__pyx_n_s_calcsize; + PyObject *__pyx_n_s_candidate; + PyObject *__pyx_kp_u_cannot_implicitely_convert_into; + PyObject *__pyx_kp_u_cannot_store_an_object_of_a_diff; + PyObject *__pyx_n_s_cline_in_traceback; + PyObject *__pyx_n_s_cls; + PyObject *__pyx_n_s_constructor; + PyObject *__pyx_n_s_ctypes; + PyObject *__pyx_n_s_declare; + PyObject *__pyx_n_s_declared; + PyObject *__pyx_n_s_definition; + PyObject *__pyx_n_s_dict; + PyObject *__pyx_n_s_dict_2; + PyObject *__pyx_kp_u_disable; + PyObject *__pyx_n_s_dsize; + PyObject *__pyx_kp_u_dsize_cannot_be_0; + PyObject *__pyx_kp_u_dsize_must_be_provided_or_deduce; + PyObject *__pyx_kp_u_dsize_must_match_layout_size; + PyObject *__pyx_kp_u_dsize_must_not_be_null___packlay; + PyObject *__pyx_kp_u_dtype; + PyObject *__pyx_n_s_dtype_2; + PyObject *__pyx_kp_u_dtype_at; + PyObject *__pyx_kp_u_dtype_is_not_declared_and_cannot; + PyObject *__pyx_kp_u_dtype_must_be_a_type; + PyObject *__pyx_kp_u_enable; + PyObject *__pyx_n_s_encode; + PyObject *__pyx_n_s_ext; + PyObject *__pyx_n_s_format; + PyObject *__pyx_kp_u_format_describes_a_too_big_struc; + PyObject *__pyx_n_s_from_buffer; + PyObject *__pyx_n_u_from_buffer; + PyObject *__pyx_n_u_from_bytes; + PyObject *__pyx_n_u_frombytes; + PyObject *__pyx_kp_u_gc; + PyObject *__pyx_n_s_get; + PyObject *__pyx_n_s_getstate; + PyObject *__pyx_n_s_head; + PyObject *__pyx_n_s_head___reduce_cython; + PyObject *__pyx_n_s_head___setstate_cython; + PyObject *__pyx_n_s_id; + PyObject *__pyx_n_s_import; + PyObject *__pyx_n_s_initializing; + PyObject *__pyx_n_s_is_coroutine; + PyObject *__pyx_kp_u_isenabled; + PyObject *__pyx_n_s_key; + PyObject *__pyx_n_s_layout; + PyObject *__pyx_n_s_main; + PyObject *__pyx_n_s_name; + PyObject *__pyx_n_s_new; + PyObject *__pyx_n_s_o; + PyObject *__pyx_n_s_pack; + PyObject *__pyx_kp_u_pack_and_unpack_must_be_callable; + PyObject *__pyx_kp_u_pack_must_provide_a_bytes_object; + PyObject *__pyx_n_u_packlayout; + PyObject *__pyx_n_u_packsize; + PyObject *__pyx_n_s_pickle; + PyObject *__pyx_n_s_protocol; + PyObject *__pyx_n_s_pyx_PickleError; + PyObject *__pyx_n_s_pyx_checksum; + PyObject *__pyx_n_s_pyx_result; + PyObject *__pyx_n_s_pyx_state; + PyObject *__pyx_n_s_pyx_type; + PyObject *__pyx_n_s_pyx_unpickle__head; + PyObject *__pyx_n_s_pyx_vtable; + PyObject *__pyx_n_s_rebuild; + PyObject *__pyx_n_s_reduce; + PyObject *__pyx_n_s_reduce_cython; + PyObject *__pyx_n_s_reduce_ex; + PyObject *__pyx_n_s_self; + PyObject *__pyx_n_s_setstate; + PyObject *__pyx_n_s_setstate_cython; + PyObject *__pyx_n_s_size; + PyObject *__pyx_n_s_sizeof; + PyObject *__pyx_n_s_spec; + PyObject *__pyx_n_s_state; + PyObject *__pyx_kp_s_stringsource; + PyObject *__pyx_n_s_struct; + PyObject *__pyx_kp_u_structure_must_be_struct_Struct; + PyObject *__pyx_n_s_test; + PyObject *__pyx_kp_u_the_dumped_bytes_length_does_not; + PyObject *__pyx_kp_u_the_given_type_must_have_a_metho; + PyObject *__pyx_kp_u_the_given_type_must_have_a_metho_2; + PyObject *__pyx_kp_u_the_pickled_dtype_has_a_differen; + PyObject *__pyx_kp_u_the_pickled_dtype_has_a_differen_2; + PyObject *__pyx_n_u_to_bytes; + PyObject *__pyx_n_u_tobytes; + PyObject *__pyx_n_s_type; + PyObject *__pyx_kp_u_type_must_be_a_ctype; + PyObject *__pyx_n_s_unpack; + PyObject *__pyx_n_s_update; + PyObject *__pyx_n_s_use_setstate; + PyObject *__pyx_int_222419149; + PyObject *__pyx_int_228825662; + PyObject *__pyx_int_238750788; + PyObject *__pyx_tuple_; + PyObject *__pyx_tuple__3; + PyObject *__pyx_tuple__4; + PyObject *__pyx_tuple__5; + PyObject *__pyx_tuple__6; + PyObject *__pyx_tuple__7; + PyObject *__pyx_tuple__8; + PyObject *__pyx_tuple__9; + PyObject *__pyx_tuple__10; + PyObject *__pyx_tuple__11; + PyObject *__pyx_tuple__12; + PyObject *__pyx_tuple__13; + PyObject *__pyx_tuple__14; + PyObject *__pyx_tuple__15; + PyObject *__pyx_tuple__16; + PyObject *__pyx_tuple__19; + PyObject *__pyx_tuple__21; + PyObject *__pyx_tuple__23; + PyObject *__pyx_tuple__25; + PyObject *__pyx_tuple__29; + PyObject *__pyx_tuple__31; + PyObject *__pyx_tuple__33; + PyObject *__pyx_tuple__34; + PyObject *__pyx_tuple__36; + PyObject *__pyx_tuple__38; + PyObject *__pyx_tuple__40; + PyObject *__pyx_codeobj__20; + PyObject *__pyx_codeobj__22; + PyObject *__pyx_codeobj__24; + PyObject *__pyx_codeobj__26; + PyObject *__pyx_codeobj__27; + PyObject *__pyx_codeobj__28; + PyObject *__pyx_codeobj__30; + PyObject *__pyx_codeobj__32; + PyObject *__pyx_codeobj__35; + PyObject *__pyx_codeobj__37; + PyObject *__pyx_codeobj__39; + PyObject *__pyx_codeobj__41; +} __pyx_mstate; + +#if CYTHON_USE_MODULE_STATE +#ifdef __cplusplus +namespace { + extern struct PyModuleDef __pyx_moduledef; +} /* anonymous namespace */ +#else +static struct PyModuleDef __pyx_moduledef; +#endif + +#define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o)) + +#define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef))) + +#define __pyx_m (PyState_FindModule(&__pyx_moduledef)) +#else +static __pyx_mstate __pyx_mstate_global_static = +#ifdef __cplusplus + {}; +#else + {0}; +#endif +static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static; +#endif +/* #### Code section: module_state_clear ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_clear(PyObject *m) { + __pyx_mstate *clear_module_state = __pyx_mstate(m); + if (!clear_module_state) return 0; + Py_CLEAR(clear_module_state->__pyx_d); + Py_CLEAR(clear_module_state->__pyx_b); + Py_CLEAR(clear_module_state->__pyx_cython_runtime); + Py_CLEAR(clear_module_state->__pyx_empty_tuple); + Py_CLEAR(clear_module_state->__pyx_empty_bytes); + Py_CLEAR(clear_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_CLEAR(clear_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_CLEAR(clear_module_state->__pyx_FusedFunctionType); + #endif + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type); + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4bool_bool); + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_7complex_complex); + Py_CLEAR(clear_module_state->__pyx_ptype_5arrex_6dtypes_DDType); + Py_CLEAR(clear_module_state->__pyx_type_5arrex_6dtypes_DDType); + Py_CLEAR(clear_module_state->__pyx_ptype_5arrex_6dtypes_DDTypeFunctions); + Py_CLEAR(clear_module_state->__pyx_type_5arrex_6dtypes_DDTypeFunctions); + Py_CLEAR(clear_module_state->__pyx_ptype_5arrex_6dtypes_DDTypeCType); + Py_CLEAR(clear_module_state->__pyx_type_5arrex_6dtypes_DDTypeCType); + Py_CLEAR(clear_module_state->__pyx_ptype_5arrex_6dtypes_DDTypeExtension); + Py_CLEAR(clear_module_state->__pyx_type_5arrex_6dtypes_DDTypeExtension); + Py_CLEAR(clear_module_state->__pyx_ptype_5arrex_6dtypes__head); + Py_CLEAR(clear_module_state->__pyx_type_5arrex_6dtypes__head); + Py_CLEAR(clear_module_state->__pyx_ptype_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct); + Py_CLEAR(clear_module_state->__pyx_type_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct); + Py_CLEAR(clear_module_state->__pyx_n_s_DDType); + Py_CLEAR(clear_module_state->__pyx_n_s_DDTypeCType); + Py_CLEAR(clear_module_state->__pyx_n_s_DDTypeClass); + Py_CLEAR(clear_module_state->__pyx_kp_u_DDTypeClass_line_66); + Py_CLEAR(clear_module_state->__pyx_kp_u_DDTypeClass_type_Create_a_dtype); + Py_CLEAR(clear_module_state->__pyx_n_s_DDTypeExtension); + Py_CLEAR(clear_module_state->__pyx_n_s_DDTypeExtension___reduce_ex); + Py_CLEAR(clear_module_state->__pyx_n_s_DDTypeExtension__rebuild); + Py_CLEAR(clear_module_state->__pyx_n_s_DDTypeFunctions); + Py_CLEAR(clear_module_state->__pyx_n_s_DDTypeFunctions___reduce_ex); + Py_CLEAR(clear_module_state->__pyx_n_s_DDTypeStruct); + Py_CLEAR(clear_module_state->__pyx_kp_u_DDTypeStruct_line_122); + Py_CLEAR(clear_module_state->__pyx_n_s_DDTypeStruct_locals_lambda); + Py_CLEAR(clear_module_state->__pyx_kp_u_DDTypeStruct_struct_create_a_dt); + Py_CLEAR(clear_module_state->__pyx_n_s_DDType___reduce_ex); + Py_CLEAR(clear_module_state->__pyx_n_s_DDType__rebuild); + Py_CLEAR(clear_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0); + Py_CLEAR(clear_module_state->__pyx_n_s_PickleError); + Py_CLEAR(clear_module_state->__pyx_n_s_Struct); + Py_CLEAR(clear_module_state->__pyx_n_s_TypeError); + Py_CLEAR(clear_module_state->__pyx_n_s_ValueError); + Py_CLEAR(clear_module_state->__pyx_kp_u__17); + Py_CLEAR(clear_module_state->__pyx_n_s__18); + Py_CLEAR(clear_module_state->__pyx_kp_b__2); + Py_CLEAR(clear_module_state->__pyx_n_s__42); + Py_CLEAR(clear_module_state->__pyx_kp_u_a_dtype_must_be_declared_in_orde); + Py_CLEAR(clear_module_state->__pyx_n_s_addressof); + Py_CLEAR(clear_module_state->__pyx_n_s_arrex_dtypes); + Py_CLEAR(clear_module_state->__pyx_kp_s_arrex_dtypes_pyx); + Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines); + Py_CLEAR(clear_module_state->__pyx_n_u_bytes); + Py_CLEAR(clear_module_state->__pyx_n_s_calcsize); + Py_CLEAR(clear_module_state->__pyx_n_s_candidate); + Py_CLEAR(clear_module_state->__pyx_kp_u_cannot_implicitely_convert_into); + Py_CLEAR(clear_module_state->__pyx_kp_u_cannot_store_an_object_of_a_diff); + Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); + Py_CLEAR(clear_module_state->__pyx_n_s_cls); + Py_CLEAR(clear_module_state->__pyx_n_s_constructor); + Py_CLEAR(clear_module_state->__pyx_n_s_ctypes); + Py_CLEAR(clear_module_state->__pyx_n_s_declare); + Py_CLEAR(clear_module_state->__pyx_n_s_declared); + Py_CLEAR(clear_module_state->__pyx_n_s_definition); + Py_CLEAR(clear_module_state->__pyx_n_s_dict); + Py_CLEAR(clear_module_state->__pyx_n_s_dict_2); + Py_CLEAR(clear_module_state->__pyx_kp_u_disable); + Py_CLEAR(clear_module_state->__pyx_n_s_dsize); + Py_CLEAR(clear_module_state->__pyx_kp_u_dsize_cannot_be_0); + Py_CLEAR(clear_module_state->__pyx_kp_u_dsize_must_be_provided_or_deduce); + Py_CLEAR(clear_module_state->__pyx_kp_u_dsize_must_match_layout_size); + Py_CLEAR(clear_module_state->__pyx_kp_u_dsize_must_not_be_null___packlay); + Py_CLEAR(clear_module_state->__pyx_kp_u_dtype); + Py_CLEAR(clear_module_state->__pyx_n_s_dtype_2); + Py_CLEAR(clear_module_state->__pyx_kp_u_dtype_at); + Py_CLEAR(clear_module_state->__pyx_kp_u_dtype_is_not_declared_and_cannot); + Py_CLEAR(clear_module_state->__pyx_kp_u_dtype_must_be_a_type); + Py_CLEAR(clear_module_state->__pyx_kp_u_enable); + Py_CLEAR(clear_module_state->__pyx_n_s_encode); + Py_CLEAR(clear_module_state->__pyx_n_s_ext); + Py_CLEAR(clear_module_state->__pyx_n_s_format); + Py_CLEAR(clear_module_state->__pyx_kp_u_format_describes_a_too_big_struc); + Py_CLEAR(clear_module_state->__pyx_n_s_from_buffer); + Py_CLEAR(clear_module_state->__pyx_n_u_from_buffer); + Py_CLEAR(clear_module_state->__pyx_n_u_from_bytes); + Py_CLEAR(clear_module_state->__pyx_n_u_frombytes); + Py_CLEAR(clear_module_state->__pyx_kp_u_gc); + Py_CLEAR(clear_module_state->__pyx_n_s_get); + Py_CLEAR(clear_module_state->__pyx_n_s_getstate); + Py_CLEAR(clear_module_state->__pyx_n_s_head); + Py_CLEAR(clear_module_state->__pyx_n_s_head___reduce_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_head___setstate_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_id); + Py_CLEAR(clear_module_state->__pyx_n_s_import); + Py_CLEAR(clear_module_state->__pyx_n_s_initializing); + Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine); + Py_CLEAR(clear_module_state->__pyx_kp_u_isenabled); + Py_CLEAR(clear_module_state->__pyx_n_s_key); + Py_CLEAR(clear_module_state->__pyx_n_s_layout); + Py_CLEAR(clear_module_state->__pyx_n_s_main); + Py_CLEAR(clear_module_state->__pyx_n_s_name); + Py_CLEAR(clear_module_state->__pyx_n_s_new); + Py_CLEAR(clear_module_state->__pyx_n_s_o); + Py_CLEAR(clear_module_state->__pyx_n_s_pack); + Py_CLEAR(clear_module_state->__pyx_kp_u_pack_and_unpack_must_be_callable); + Py_CLEAR(clear_module_state->__pyx_kp_u_pack_must_provide_a_bytes_object); + Py_CLEAR(clear_module_state->__pyx_n_u_packlayout); + Py_CLEAR(clear_module_state->__pyx_n_u_packsize); + Py_CLEAR(clear_module_state->__pyx_n_s_pickle); + Py_CLEAR(clear_module_state->__pyx_n_s_protocol); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_PickleError); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_checksum); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_result); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_state); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_type); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_unpickle__head); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_vtable); + Py_CLEAR(clear_module_state->__pyx_n_s_rebuild); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce_ex); + Py_CLEAR(clear_module_state->__pyx_n_s_self); + Py_CLEAR(clear_module_state->__pyx_n_s_setstate); + Py_CLEAR(clear_module_state->__pyx_n_s_setstate_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_size); + Py_CLEAR(clear_module_state->__pyx_n_s_sizeof); + Py_CLEAR(clear_module_state->__pyx_n_s_spec); + Py_CLEAR(clear_module_state->__pyx_n_s_state); + Py_CLEAR(clear_module_state->__pyx_kp_s_stringsource); + Py_CLEAR(clear_module_state->__pyx_n_s_struct); + Py_CLEAR(clear_module_state->__pyx_kp_u_structure_must_be_struct_Struct); + Py_CLEAR(clear_module_state->__pyx_n_s_test); + Py_CLEAR(clear_module_state->__pyx_kp_u_the_dumped_bytes_length_does_not); + Py_CLEAR(clear_module_state->__pyx_kp_u_the_given_type_must_have_a_metho); + Py_CLEAR(clear_module_state->__pyx_kp_u_the_given_type_must_have_a_metho_2); + Py_CLEAR(clear_module_state->__pyx_kp_u_the_pickled_dtype_has_a_differen); + Py_CLEAR(clear_module_state->__pyx_kp_u_the_pickled_dtype_has_a_differen_2); + Py_CLEAR(clear_module_state->__pyx_n_u_to_bytes); + Py_CLEAR(clear_module_state->__pyx_n_u_tobytes); + Py_CLEAR(clear_module_state->__pyx_n_s_type); + Py_CLEAR(clear_module_state->__pyx_kp_u_type_must_be_a_ctype); + Py_CLEAR(clear_module_state->__pyx_n_s_unpack); + Py_CLEAR(clear_module_state->__pyx_n_s_update); + Py_CLEAR(clear_module_state->__pyx_n_s_use_setstate); + Py_CLEAR(clear_module_state->__pyx_int_222419149); + Py_CLEAR(clear_module_state->__pyx_int_228825662); + Py_CLEAR(clear_module_state->__pyx_int_238750788); + Py_CLEAR(clear_module_state->__pyx_tuple_); + Py_CLEAR(clear_module_state->__pyx_tuple__3); + Py_CLEAR(clear_module_state->__pyx_tuple__4); + Py_CLEAR(clear_module_state->__pyx_tuple__5); + Py_CLEAR(clear_module_state->__pyx_tuple__6); + Py_CLEAR(clear_module_state->__pyx_tuple__7); + Py_CLEAR(clear_module_state->__pyx_tuple__8); + Py_CLEAR(clear_module_state->__pyx_tuple__9); + Py_CLEAR(clear_module_state->__pyx_tuple__10); + Py_CLEAR(clear_module_state->__pyx_tuple__11); + Py_CLEAR(clear_module_state->__pyx_tuple__12); + Py_CLEAR(clear_module_state->__pyx_tuple__13); + Py_CLEAR(clear_module_state->__pyx_tuple__14); + Py_CLEAR(clear_module_state->__pyx_tuple__15); + Py_CLEAR(clear_module_state->__pyx_tuple__16); + Py_CLEAR(clear_module_state->__pyx_tuple__19); + Py_CLEAR(clear_module_state->__pyx_tuple__21); + Py_CLEAR(clear_module_state->__pyx_tuple__23); + Py_CLEAR(clear_module_state->__pyx_tuple__25); + Py_CLEAR(clear_module_state->__pyx_tuple__29); + Py_CLEAR(clear_module_state->__pyx_tuple__31); + Py_CLEAR(clear_module_state->__pyx_tuple__33); + Py_CLEAR(clear_module_state->__pyx_tuple__34); + Py_CLEAR(clear_module_state->__pyx_tuple__36); + Py_CLEAR(clear_module_state->__pyx_tuple__38); + Py_CLEAR(clear_module_state->__pyx_tuple__40); + Py_CLEAR(clear_module_state->__pyx_codeobj__20); + Py_CLEAR(clear_module_state->__pyx_codeobj__22); + Py_CLEAR(clear_module_state->__pyx_codeobj__24); + Py_CLEAR(clear_module_state->__pyx_codeobj__26); + Py_CLEAR(clear_module_state->__pyx_codeobj__27); + Py_CLEAR(clear_module_state->__pyx_codeobj__28); + Py_CLEAR(clear_module_state->__pyx_codeobj__30); + Py_CLEAR(clear_module_state->__pyx_codeobj__32); + Py_CLEAR(clear_module_state->__pyx_codeobj__35); + Py_CLEAR(clear_module_state->__pyx_codeobj__37); + Py_CLEAR(clear_module_state->__pyx_codeobj__39); + Py_CLEAR(clear_module_state->__pyx_codeobj__41); + return 0; +} +#endif +/* #### Code section: module_state_traverse ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { + __pyx_mstate *traverse_module_state = __pyx_mstate(m); + if (!traverse_module_state) return 0; + Py_VISIT(traverse_module_state->__pyx_d); + Py_VISIT(traverse_module_state->__pyx_b); + Py_VISIT(traverse_module_state->__pyx_cython_runtime); + Py_VISIT(traverse_module_state->__pyx_empty_tuple); + Py_VISIT(traverse_module_state->__pyx_empty_bytes); + Py_VISIT(traverse_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_VISIT(traverse_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_VISIT(traverse_module_state->__pyx_FusedFunctionType); + #endif + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type); + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4bool_bool); + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_7complex_complex); + Py_VISIT(traverse_module_state->__pyx_ptype_5arrex_6dtypes_DDType); + Py_VISIT(traverse_module_state->__pyx_type_5arrex_6dtypes_DDType); + Py_VISIT(traverse_module_state->__pyx_ptype_5arrex_6dtypes_DDTypeFunctions); + Py_VISIT(traverse_module_state->__pyx_type_5arrex_6dtypes_DDTypeFunctions); + Py_VISIT(traverse_module_state->__pyx_ptype_5arrex_6dtypes_DDTypeCType); + Py_VISIT(traverse_module_state->__pyx_type_5arrex_6dtypes_DDTypeCType); + Py_VISIT(traverse_module_state->__pyx_ptype_5arrex_6dtypes_DDTypeExtension); + Py_VISIT(traverse_module_state->__pyx_type_5arrex_6dtypes_DDTypeExtension); + Py_VISIT(traverse_module_state->__pyx_ptype_5arrex_6dtypes__head); + Py_VISIT(traverse_module_state->__pyx_type_5arrex_6dtypes__head); + Py_VISIT(traverse_module_state->__pyx_ptype_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct); + Py_VISIT(traverse_module_state->__pyx_type_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct); + Py_VISIT(traverse_module_state->__pyx_n_s_DDType); + Py_VISIT(traverse_module_state->__pyx_n_s_DDTypeCType); + Py_VISIT(traverse_module_state->__pyx_n_s_DDTypeClass); + Py_VISIT(traverse_module_state->__pyx_kp_u_DDTypeClass_line_66); + Py_VISIT(traverse_module_state->__pyx_kp_u_DDTypeClass_type_Create_a_dtype); + Py_VISIT(traverse_module_state->__pyx_n_s_DDTypeExtension); + Py_VISIT(traverse_module_state->__pyx_n_s_DDTypeExtension___reduce_ex); + Py_VISIT(traverse_module_state->__pyx_n_s_DDTypeExtension__rebuild); + Py_VISIT(traverse_module_state->__pyx_n_s_DDTypeFunctions); + Py_VISIT(traverse_module_state->__pyx_n_s_DDTypeFunctions___reduce_ex); + Py_VISIT(traverse_module_state->__pyx_n_s_DDTypeStruct); + Py_VISIT(traverse_module_state->__pyx_kp_u_DDTypeStruct_line_122); + Py_VISIT(traverse_module_state->__pyx_n_s_DDTypeStruct_locals_lambda); + Py_VISIT(traverse_module_state->__pyx_kp_u_DDTypeStruct_struct_create_a_dt); + Py_VISIT(traverse_module_state->__pyx_n_s_DDType___reduce_ex); + Py_VISIT(traverse_module_state->__pyx_n_s_DDType__rebuild); + Py_VISIT(traverse_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0); + Py_VISIT(traverse_module_state->__pyx_n_s_PickleError); + Py_VISIT(traverse_module_state->__pyx_n_s_Struct); + Py_VISIT(traverse_module_state->__pyx_n_s_TypeError); + Py_VISIT(traverse_module_state->__pyx_n_s_ValueError); + Py_VISIT(traverse_module_state->__pyx_kp_u__17); + Py_VISIT(traverse_module_state->__pyx_n_s__18); + Py_VISIT(traverse_module_state->__pyx_kp_b__2); + Py_VISIT(traverse_module_state->__pyx_n_s__42); + Py_VISIT(traverse_module_state->__pyx_kp_u_a_dtype_must_be_declared_in_orde); + Py_VISIT(traverse_module_state->__pyx_n_s_addressof); + Py_VISIT(traverse_module_state->__pyx_n_s_arrex_dtypes); + Py_VISIT(traverse_module_state->__pyx_kp_s_arrex_dtypes_pyx); + Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines); + Py_VISIT(traverse_module_state->__pyx_n_u_bytes); + Py_VISIT(traverse_module_state->__pyx_n_s_calcsize); + Py_VISIT(traverse_module_state->__pyx_n_s_candidate); + Py_VISIT(traverse_module_state->__pyx_kp_u_cannot_implicitely_convert_into); + Py_VISIT(traverse_module_state->__pyx_kp_u_cannot_store_an_object_of_a_diff); + Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); + Py_VISIT(traverse_module_state->__pyx_n_s_cls); + Py_VISIT(traverse_module_state->__pyx_n_s_constructor); + Py_VISIT(traverse_module_state->__pyx_n_s_ctypes); + Py_VISIT(traverse_module_state->__pyx_n_s_declare); + Py_VISIT(traverse_module_state->__pyx_n_s_declared); + Py_VISIT(traverse_module_state->__pyx_n_s_definition); + Py_VISIT(traverse_module_state->__pyx_n_s_dict); + Py_VISIT(traverse_module_state->__pyx_n_s_dict_2); + Py_VISIT(traverse_module_state->__pyx_kp_u_disable); + Py_VISIT(traverse_module_state->__pyx_n_s_dsize); + Py_VISIT(traverse_module_state->__pyx_kp_u_dsize_cannot_be_0); + Py_VISIT(traverse_module_state->__pyx_kp_u_dsize_must_be_provided_or_deduce); + Py_VISIT(traverse_module_state->__pyx_kp_u_dsize_must_match_layout_size); + Py_VISIT(traverse_module_state->__pyx_kp_u_dsize_must_not_be_null___packlay); + Py_VISIT(traverse_module_state->__pyx_kp_u_dtype); + Py_VISIT(traverse_module_state->__pyx_n_s_dtype_2); + Py_VISIT(traverse_module_state->__pyx_kp_u_dtype_at); + Py_VISIT(traverse_module_state->__pyx_kp_u_dtype_is_not_declared_and_cannot); + Py_VISIT(traverse_module_state->__pyx_kp_u_dtype_must_be_a_type); + Py_VISIT(traverse_module_state->__pyx_kp_u_enable); + Py_VISIT(traverse_module_state->__pyx_n_s_encode); + Py_VISIT(traverse_module_state->__pyx_n_s_ext); + Py_VISIT(traverse_module_state->__pyx_n_s_format); + Py_VISIT(traverse_module_state->__pyx_kp_u_format_describes_a_too_big_struc); + Py_VISIT(traverse_module_state->__pyx_n_s_from_buffer); + Py_VISIT(traverse_module_state->__pyx_n_u_from_buffer); + Py_VISIT(traverse_module_state->__pyx_n_u_from_bytes); + Py_VISIT(traverse_module_state->__pyx_n_u_frombytes); + Py_VISIT(traverse_module_state->__pyx_kp_u_gc); + Py_VISIT(traverse_module_state->__pyx_n_s_get); + Py_VISIT(traverse_module_state->__pyx_n_s_getstate); + Py_VISIT(traverse_module_state->__pyx_n_s_head); + Py_VISIT(traverse_module_state->__pyx_n_s_head___reduce_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_head___setstate_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_id); + Py_VISIT(traverse_module_state->__pyx_n_s_import); + Py_VISIT(traverse_module_state->__pyx_n_s_initializing); + Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine); + Py_VISIT(traverse_module_state->__pyx_kp_u_isenabled); + Py_VISIT(traverse_module_state->__pyx_n_s_key); + Py_VISIT(traverse_module_state->__pyx_n_s_layout); + Py_VISIT(traverse_module_state->__pyx_n_s_main); + Py_VISIT(traverse_module_state->__pyx_n_s_name); + Py_VISIT(traverse_module_state->__pyx_n_s_new); + Py_VISIT(traverse_module_state->__pyx_n_s_o); + Py_VISIT(traverse_module_state->__pyx_n_s_pack); + Py_VISIT(traverse_module_state->__pyx_kp_u_pack_and_unpack_must_be_callable); + Py_VISIT(traverse_module_state->__pyx_kp_u_pack_must_provide_a_bytes_object); + Py_VISIT(traverse_module_state->__pyx_n_u_packlayout); + Py_VISIT(traverse_module_state->__pyx_n_u_packsize); + Py_VISIT(traverse_module_state->__pyx_n_s_pickle); + Py_VISIT(traverse_module_state->__pyx_n_s_protocol); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_PickleError); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_checksum); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_result); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_state); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_type); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_unpickle__head); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_vtable); + Py_VISIT(traverse_module_state->__pyx_n_s_rebuild); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce_ex); + Py_VISIT(traverse_module_state->__pyx_n_s_self); + Py_VISIT(traverse_module_state->__pyx_n_s_setstate); + Py_VISIT(traverse_module_state->__pyx_n_s_setstate_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_size); + Py_VISIT(traverse_module_state->__pyx_n_s_sizeof); + Py_VISIT(traverse_module_state->__pyx_n_s_spec); + Py_VISIT(traverse_module_state->__pyx_n_s_state); + Py_VISIT(traverse_module_state->__pyx_kp_s_stringsource); + Py_VISIT(traverse_module_state->__pyx_n_s_struct); + Py_VISIT(traverse_module_state->__pyx_kp_u_structure_must_be_struct_Struct); + Py_VISIT(traverse_module_state->__pyx_n_s_test); + Py_VISIT(traverse_module_state->__pyx_kp_u_the_dumped_bytes_length_does_not); + Py_VISIT(traverse_module_state->__pyx_kp_u_the_given_type_must_have_a_metho); + Py_VISIT(traverse_module_state->__pyx_kp_u_the_given_type_must_have_a_metho_2); + Py_VISIT(traverse_module_state->__pyx_kp_u_the_pickled_dtype_has_a_differen); + Py_VISIT(traverse_module_state->__pyx_kp_u_the_pickled_dtype_has_a_differen_2); + Py_VISIT(traverse_module_state->__pyx_n_u_to_bytes); + Py_VISIT(traverse_module_state->__pyx_n_u_tobytes); + Py_VISIT(traverse_module_state->__pyx_n_s_type); + Py_VISIT(traverse_module_state->__pyx_kp_u_type_must_be_a_ctype); + Py_VISIT(traverse_module_state->__pyx_n_s_unpack); + Py_VISIT(traverse_module_state->__pyx_n_s_update); + Py_VISIT(traverse_module_state->__pyx_n_s_use_setstate); + Py_VISIT(traverse_module_state->__pyx_int_222419149); + Py_VISIT(traverse_module_state->__pyx_int_228825662); + Py_VISIT(traverse_module_state->__pyx_int_238750788); + Py_VISIT(traverse_module_state->__pyx_tuple_); + Py_VISIT(traverse_module_state->__pyx_tuple__3); + Py_VISIT(traverse_module_state->__pyx_tuple__4); + Py_VISIT(traverse_module_state->__pyx_tuple__5); + Py_VISIT(traverse_module_state->__pyx_tuple__6); + Py_VISIT(traverse_module_state->__pyx_tuple__7); + Py_VISIT(traverse_module_state->__pyx_tuple__8); + Py_VISIT(traverse_module_state->__pyx_tuple__9); + Py_VISIT(traverse_module_state->__pyx_tuple__10); + Py_VISIT(traverse_module_state->__pyx_tuple__11); + Py_VISIT(traverse_module_state->__pyx_tuple__12); + Py_VISIT(traverse_module_state->__pyx_tuple__13); + Py_VISIT(traverse_module_state->__pyx_tuple__14); + Py_VISIT(traverse_module_state->__pyx_tuple__15); + Py_VISIT(traverse_module_state->__pyx_tuple__16); + Py_VISIT(traverse_module_state->__pyx_tuple__19); + Py_VISIT(traverse_module_state->__pyx_tuple__21); + Py_VISIT(traverse_module_state->__pyx_tuple__23); + Py_VISIT(traverse_module_state->__pyx_tuple__25); + Py_VISIT(traverse_module_state->__pyx_tuple__29); + Py_VISIT(traverse_module_state->__pyx_tuple__31); + Py_VISIT(traverse_module_state->__pyx_tuple__33); + Py_VISIT(traverse_module_state->__pyx_tuple__34); + Py_VISIT(traverse_module_state->__pyx_tuple__36); + Py_VISIT(traverse_module_state->__pyx_tuple__38); + Py_VISIT(traverse_module_state->__pyx_tuple__40); + Py_VISIT(traverse_module_state->__pyx_codeobj__20); + Py_VISIT(traverse_module_state->__pyx_codeobj__22); + Py_VISIT(traverse_module_state->__pyx_codeobj__24); + Py_VISIT(traverse_module_state->__pyx_codeobj__26); + Py_VISIT(traverse_module_state->__pyx_codeobj__27); + Py_VISIT(traverse_module_state->__pyx_codeobj__28); + Py_VISIT(traverse_module_state->__pyx_codeobj__30); + Py_VISIT(traverse_module_state->__pyx_codeobj__32); + Py_VISIT(traverse_module_state->__pyx_codeobj__35); + Py_VISIT(traverse_module_state->__pyx_codeobj__37); + Py_VISIT(traverse_module_state->__pyx_codeobj__39); + Py_VISIT(traverse_module_state->__pyx_codeobj__41); + return 0; +} +#endif +/* #### Code section: module_state_defines ### */ +#define __pyx_d __pyx_mstate_global->__pyx_d +#define __pyx_b __pyx_mstate_global->__pyx_b +#define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime +#define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple +#define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes +#define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode +#ifdef __Pyx_CyFunction_USED +#define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType +#endif +#ifdef __Pyx_FusedFunction_USED +#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType +#endif +#ifdef __Pyx_Generator_USED +#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType +#endif +#ifdef __Pyx_IterableCoroutine_USED +#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_7cpython_4type_type __pyx_mstate_global->__pyx_ptype_7cpython_4type_type +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_7cpython_4bool_bool __pyx_mstate_global->__pyx_ptype_7cpython_4bool_bool +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_7cpython_7complex_complex __pyx_mstate_global->__pyx_ptype_7cpython_7complex_complex +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#define __pyx_type_5arrex_6dtypes_DDType __pyx_mstate_global->__pyx_type_5arrex_6dtypes_DDType +#define __pyx_type_5arrex_6dtypes_DDTypeFunctions __pyx_mstate_global->__pyx_type_5arrex_6dtypes_DDTypeFunctions +#define __pyx_type_5arrex_6dtypes_DDTypeCType __pyx_mstate_global->__pyx_type_5arrex_6dtypes_DDTypeCType +#define __pyx_type_5arrex_6dtypes_DDTypeExtension __pyx_mstate_global->__pyx_type_5arrex_6dtypes_DDTypeExtension +#define __pyx_type_5arrex_6dtypes__head __pyx_mstate_global->__pyx_type_5arrex_6dtypes__head +#define __pyx_type_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct __pyx_mstate_global->__pyx_type_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct +#endif +#define __pyx_ptype_5arrex_6dtypes_DDType __pyx_mstate_global->__pyx_ptype_5arrex_6dtypes_DDType +#define __pyx_ptype_5arrex_6dtypes_DDTypeFunctions __pyx_mstate_global->__pyx_ptype_5arrex_6dtypes_DDTypeFunctions +#define __pyx_ptype_5arrex_6dtypes_DDTypeCType __pyx_mstate_global->__pyx_ptype_5arrex_6dtypes_DDTypeCType +#define __pyx_ptype_5arrex_6dtypes_DDTypeExtension __pyx_mstate_global->__pyx_ptype_5arrex_6dtypes_DDTypeExtension +#define __pyx_ptype_5arrex_6dtypes__head __pyx_mstate_global->__pyx_ptype_5arrex_6dtypes__head +#define __pyx_ptype_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct __pyx_mstate_global->__pyx_ptype_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct +#define __pyx_n_s_DDType __pyx_mstate_global->__pyx_n_s_DDType +#define __pyx_n_s_DDTypeCType __pyx_mstate_global->__pyx_n_s_DDTypeCType +#define __pyx_n_s_DDTypeClass __pyx_mstate_global->__pyx_n_s_DDTypeClass +#define __pyx_kp_u_DDTypeClass_line_66 __pyx_mstate_global->__pyx_kp_u_DDTypeClass_line_66 +#define __pyx_kp_u_DDTypeClass_type_Create_a_dtype __pyx_mstate_global->__pyx_kp_u_DDTypeClass_type_Create_a_dtype +#define __pyx_n_s_DDTypeExtension __pyx_mstate_global->__pyx_n_s_DDTypeExtension +#define __pyx_n_s_DDTypeExtension___reduce_ex __pyx_mstate_global->__pyx_n_s_DDTypeExtension___reduce_ex +#define __pyx_n_s_DDTypeExtension__rebuild __pyx_mstate_global->__pyx_n_s_DDTypeExtension__rebuild +#define __pyx_n_s_DDTypeFunctions __pyx_mstate_global->__pyx_n_s_DDTypeFunctions +#define __pyx_n_s_DDTypeFunctions___reduce_ex __pyx_mstate_global->__pyx_n_s_DDTypeFunctions___reduce_ex +#define __pyx_n_s_DDTypeStruct __pyx_mstate_global->__pyx_n_s_DDTypeStruct +#define __pyx_kp_u_DDTypeStruct_line_122 __pyx_mstate_global->__pyx_kp_u_DDTypeStruct_line_122 +#define __pyx_n_s_DDTypeStruct_locals_lambda __pyx_mstate_global->__pyx_n_s_DDTypeStruct_locals_lambda +#define __pyx_kp_u_DDTypeStruct_struct_create_a_dt __pyx_mstate_global->__pyx_kp_u_DDTypeStruct_struct_create_a_dt +#define __pyx_n_s_DDType___reduce_ex __pyx_mstate_global->__pyx_n_s_DDType___reduce_ex +#define __pyx_n_s_DDType__rebuild __pyx_mstate_global->__pyx_n_s_DDType__rebuild +#define __pyx_kp_s_Incompatible_checksums_0x_x_vs_0 __pyx_mstate_global->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0 +#define __pyx_n_s_PickleError __pyx_mstate_global->__pyx_n_s_PickleError +#define __pyx_n_s_Struct __pyx_mstate_global->__pyx_n_s_Struct +#define __pyx_n_s_TypeError __pyx_mstate_global->__pyx_n_s_TypeError +#define __pyx_n_s_ValueError __pyx_mstate_global->__pyx_n_s_ValueError +#define __pyx_kp_u__17 __pyx_mstate_global->__pyx_kp_u__17 +#define __pyx_n_s__18 __pyx_mstate_global->__pyx_n_s__18 +#define __pyx_kp_b__2 __pyx_mstate_global->__pyx_kp_b__2 +#define __pyx_n_s__42 __pyx_mstate_global->__pyx_n_s__42 +#define __pyx_kp_u_a_dtype_must_be_declared_in_orde __pyx_mstate_global->__pyx_kp_u_a_dtype_must_be_declared_in_orde +#define __pyx_n_s_addressof __pyx_mstate_global->__pyx_n_s_addressof +#define __pyx_n_s_arrex_dtypes __pyx_mstate_global->__pyx_n_s_arrex_dtypes +#define __pyx_kp_s_arrex_dtypes_pyx __pyx_mstate_global->__pyx_kp_s_arrex_dtypes_pyx +#define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines +#define __pyx_n_u_bytes __pyx_mstate_global->__pyx_n_u_bytes +#define __pyx_n_s_calcsize __pyx_mstate_global->__pyx_n_s_calcsize +#define __pyx_n_s_candidate __pyx_mstate_global->__pyx_n_s_candidate +#define __pyx_kp_u_cannot_implicitely_convert_into __pyx_mstate_global->__pyx_kp_u_cannot_implicitely_convert_into +#define __pyx_kp_u_cannot_store_an_object_of_a_diff __pyx_mstate_global->__pyx_kp_u_cannot_store_an_object_of_a_diff +#define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback +#define __pyx_n_s_cls __pyx_mstate_global->__pyx_n_s_cls +#define __pyx_n_s_constructor __pyx_mstate_global->__pyx_n_s_constructor +#define __pyx_n_s_ctypes __pyx_mstate_global->__pyx_n_s_ctypes +#define __pyx_n_s_declare __pyx_mstate_global->__pyx_n_s_declare +#define __pyx_n_s_declared __pyx_mstate_global->__pyx_n_s_declared +#define __pyx_n_s_definition __pyx_mstate_global->__pyx_n_s_definition +#define __pyx_n_s_dict __pyx_mstate_global->__pyx_n_s_dict +#define __pyx_n_s_dict_2 __pyx_mstate_global->__pyx_n_s_dict_2 +#define __pyx_kp_u_disable __pyx_mstate_global->__pyx_kp_u_disable +#define __pyx_n_s_dsize __pyx_mstate_global->__pyx_n_s_dsize +#define __pyx_kp_u_dsize_cannot_be_0 __pyx_mstate_global->__pyx_kp_u_dsize_cannot_be_0 +#define __pyx_kp_u_dsize_must_be_provided_or_deduce __pyx_mstate_global->__pyx_kp_u_dsize_must_be_provided_or_deduce +#define __pyx_kp_u_dsize_must_match_layout_size __pyx_mstate_global->__pyx_kp_u_dsize_must_match_layout_size +#define __pyx_kp_u_dsize_must_not_be_null___packlay __pyx_mstate_global->__pyx_kp_u_dsize_must_not_be_null___packlay +#define __pyx_kp_u_dtype __pyx_mstate_global->__pyx_kp_u_dtype +#define __pyx_n_s_dtype_2 __pyx_mstate_global->__pyx_n_s_dtype_2 +#define __pyx_kp_u_dtype_at __pyx_mstate_global->__pyx_kp_u_dtype_at +#define __pyx_kp_u_dtype_is_not_declared_and_cannot __pyx_mstate_global->__pyx_kp_u_dtype_is_not_declared_and_cannot +#define __pyx_kp_u_dtype_must_be_a_type __pyx_mstate_global->__pyx_kp_u_dtype_must_be_a_type +#define __pyx_kp_u_enable __pyx_mstate_global->__pyx_kp_u_enable +#define __pyx_n_s_encode __pyx_mstate_global->__pyx_n_s_encode +#define __pyx_n_s_ext __pyx_mstate_global->__pyx_n_s_ext +#define __pyx_n_s_format __pyx_mstate_global->__pyx_n_s_format +#define __pyx_kp_u_format_describes_a_too_big_struc __pyx_mstate_global->__pyx_kp_u_format_describes_a_too_big_struc +#define __pyx_n_s_from_buffer __pyx_mstate_global->__pyx_n_s_from_buffer +#define __pyx_n_u_from_buffer __pyx_mstate_global->__pyx_n_u_from_buffer +#define __pyx_n_u_from_bytes __pyx_mstate_global->__pyx_n_u_from_bytes +#define __pyx_n_u_frombytes __pyx_mstate_global->__pyx_n_u_frombytes +#define __pyx_kp_u_gc __pyx_mstate_global->__pyx_kp_u_gc +#define __pyx_n_s_get __pyx_mstate_global->__pyx_n_s_get +#define __pyx_n_s_getstate __pyx_mstate_global->__pyx_n_s_getstate +#define __pyx_n_s_head __pyx_mstate_global->__pyx_n_s_head +#define __pyx_n_s_head___reduce_cython __pyx_mstate_global->__pyx_n_s_head___reduce_cython +#define __pyx_n_s_head___setstate_cython __pyx_mstate_global->__pyx_n_s_head___setstate_cython +#define __pyx_n_s_id __pyx_mstate_global->__pyx_n_s_id +#define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import +#define __pyx_n_s_initializing __pyx_mstate_global->__pyx_n_s_initializing +#define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine +#define __pyx_kp_u_isenabled __pyx_mstate_global->__pyx_kp_u_isenabled +#define __pyx_n_s_key __pyx_mstate_global->__pyx_n_s_key +#define __pyx_n_s_layout __pyx_mstate_global->__pyx_n_s_layout +#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main +#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name +#define __pyx_n_s_new __pyx_mstate_global->__pyx_n_s_new +#define __pyx_n_s_o __pyx_mstate_global->__pyx_n_s_o +#define __pyx_n_s_pack __pyx_mstate_global->__pyx_n_s_pack +#define __pyx_kp_u_pack_and_unpack_must_be_callable __pyx_mstate_global->__pyx_kp_u_pack_and_unpack_must_be_callable +#define __pyx_kp_u_pack_must_provide_a_bytes_object __pyx_mstate_global->__pyx_kp_u_pack_must_provide_a_bytes_object +#define __pyx_n_u_packlayout __pyx_mstate_global->__pyx_n_u_packlayout +#define __pyx_n_u_packsize __pyx_mstate_global->__pyx_n_u_packsize +#define __pyx_n_s_pickle __pyx_mstate_global->__pyx_n_s_pickle +#define __pyx_n_s_protocol __pyx_mstate_global->__pyx_n_s_protocol +#define __pyx_n_s_pyx_PickleError __pyx_mstate_global->__pyx_n_s_pyx_PickleError +#define __pyx_n_s_pyx_checksum __pyx_mstate_global->__pyx_n_s_pyx_checksum +#define __pyx_n_s_pyx_result __pyx_mstate_global->__pyx_n_s_pyx_result +#define __pyx_n_s_pyx_state __pyx_mstate_global->__pyx_n_s_pyx_state +#define __pyx_n_s_pyx_type __pyx_mstate_global->__pyx_n_s_pyx_type +#define __pyx_n_s_pyx_unpickle__head __pyx_mstate_global->__pyx_n_s_pyx_unpickle__head +#define __pyx_n_s_pyx_vtable __pyx_mstate_global->__pyx_n_s_pyx_vtable +#define __pyx_n_s_rebuild __pyx_mstate_global->__pyx_n_s_rebuild +#define __pyx_n_s_reduce __pyx_mstate_global->__pyx_n_s_reduce +#define __pyx_n_s_reduce_cython __pyx_mstate_global->__pyx_n_s_reduce_cython +#define __pyx_n_s_reduce_ex __pyx_mstate_global->__pyx_n_s_reduce_ex +#define __pyx_n_s_self __pyx_mstate_global->__pyx_n_s_self +#define __pyx_n_s_setstate __pyx_mstate_global->__pyx_n_s_setstate +#define __pyx_n_s_setstate_cython __pyx_mstate_global->__pyx_n_s_setstate_cython +#define __pyx_n_s_size __pyx_mstate_global->__pyx_n_s_size +#define __pyx_n_s_sizeof __pyx_mstate_global->__pyx_n_s_sizeof +#define __pyx_n_s_spec __pyx_mstate_global->__pyx_n_s_spec +#define __pyx_n_s_state __pyx_mstate_global->__pyx_n_s_state +#define __pyx_kp_s_stringsource __pyx_mstate_global->__pyx_kp_s_stringsource +#define __pyx_n_s_struct __pyx_mstate_global->__pyx_n_s_struct +#define __pyx_kp_u_structure_must_be_struct_Struct __pyx_mstate_global->__pyx_kp_u_structure_must_be_struct_Struct +#define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test +#define __pyx_kp_u_the_dumped_bytes_length_does_not __pyx_mstate_global->__pyx_kp_u_the_dumped_bytes_length_does_not +#define __pyx_kp_u_the_given_type_must_have_a_metho __pyx_mstate_global->__pyx_kp_u_the_given_type_must_have_a_metho +#define __pyx_kp_u_the_given_type_must_have_a_metho_2 __pyx_mstate_global->__pyx_kp_u_the_given_type_must_have_a_metho_2 +#define __pyx_kp_u_the_pickled_dtype_has_a_differen __pyx_mstate_global->__pyx_kp_u_the_pickled_dtype_has_a_differen +#define __pyx_kp_u_the_pickled_dtype_has_a_differen_2 __pyx_mstate_global->__pyx_kp_u_the_pickled_dtype_has_a_differen_2 +#define __pyx_n_u_to_bytes __pyx_mstate_global->__pyx_n_u_to_bytes +#define __pyx_n_u_tobytes __pyx_mstate_global->__pyx_n_u_tobytes +#define __pyx_n_s_type __pyx_mstate_global->__pyx_n_s_type +#define __pyx_kp_u_type_must_be_a_ctype __pyx_mstate_global->__pyx_kp_u_type_must_be_a_ctype +#define __pyx_n_s_unpack __pyx_mstate_global->__pyx_n_s_unpack +#define __pyx_n_s_update __pyx_mstate_global->__pyx_n_s_update +#define __pyx_n_s_use_setstate __pyx_mstate_global->__pyx_n_s_use_setstate +#define __pyx_int_222419149 __pyx_mstate_global->__pyx_int_222419149 +#define __pyx_int_228825662 __pyx_mstate_global->__pyx_int_228825662 +#define __pyx_int_238750788 __pyx_mstate_global->__pyx_int_238750788 +#define __pyx_tuple_ __pyx_mstate_global->__pyx_tuple_ +#define __pyx_tuple__3 __pyx_mstate_global->__pyx_tuple__3 +#define __pyx_tuple__4 __pyx_mstate_global->__pyx_tuple__4 +#define __pyx_tuple__5 __pyx_mstate_global->__pyx_tuple__5 +#define __pyx_tuple__6 __pyx_mstate_global->__pyx_tuple__6 +#define __pyx_tuple__7 __pyx_mstate_global->__pyx_tuple__7 +#define __pyx_tuple__8 __pyx_mstate_global->__pyx_tuple__8 +#define __pyx_tuple__9 __pyx_mstate_global->__pyx_tuple__9 +#define __pyx_tuple__10 __pyx_mstate_global->__pyx_tuple__10 +#define __pyx_tuple__11 __pyx_mstate_global->__pyx_tuple__11 +#define __pyx_tuple__12 __pyx_mstate_global->__pyx_tuple__12 +#define __pyx_tuple__13 __pyx_mstate_global->__pyx_tuple__13 +#define __pyx_tuple__14 __pyx_mstate_global->__pyx_tuple__14 +#define __pyx_tuple__15 __pyx_mstate_global->__pyx_tuple__15 +#define __pyx_tuple__16 __pyx_mstate_global->__pyx_tuple__16 +#define __pyx_tuple__19 __pyx_mstate_global->__pyx_tuple__19 +#define __pyx_tuple__21 __pyx_mstate_global->__pyx_tuple__21 +#define __pyx_tuple__23 __pyx_mstate_global->__pyx_tuple__23 +#define __pyx_tuple__25 __pyx_mstate_global->__pyx_tuple__25 +#define __pyx_tuple__29 __pyx_mstate_global->__pyx_tuple__29 +#define __pyx_tuple__31 __pyx_mstate_global->__pyx_tuple__31 +#define __pyx_tuple__33 __pyx_mstate_global->__pyx_tuple__33 +#define __pyx_tuple__34 __pyx_mstate_global->__pyx_tuple__34 +#define __pyx_tuple__36 __pyx_mstate_global->__pyx_tuple__36 +#define __pyx_tuple__38 __pyx_mstate_global->__pyx_tuple__38 +#define __pyx_tuple__40 __pyx_mstate_global->__pyx_tuple__40 +#define __pyx_codeobj__20 __pyx_mstate_global->__pyx_codeobj__20 +#define __pyx_codeobj__22 __pyx_mstate_global->__pyx_codeobj__22 +#define __pyx_codeobj__24 __pyx_mstate_global->__pyx_codeobj__24 +#define __pyx_codeobj__26 __pyx_mstate_global->__pyx_codeobj__26 +#define __pyx_codeobj__27 __pyx_mstate_global->__pyx_codeobj__27 +#define __pyx_codeobj__28 __pyx_mstate_global->__pyx_codeobj__28 +#define __pyx_codeobj__30 __pyx_mstate_global->__pyx_codeobj__30 +#define __pyx_codeobj__32 __pyx_mstate_global->__pyx_codeobj__32 +#define __pyx_codeobj__35 __pyx_mstate_global->__pyx_codeobj__35 +#define __pyx_codeobj__37 __pyx_mstate_global->__pyx_codeobj__37 +#define __pyx_codeobj__39 __pyx_mstate_global->__pyx_codeobj__39 +#define __pyx_codeobj__41 __pyx_mstate_global->__pyx_codeobj__41 +/* #### Code section: module_code ### */ + +/* "cpython/complex.pxd":19 + * + * @property + * cdef inline double real(self): # <<<<<<<<<<<<<< + * return self.cval.real + * + */ + +static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4real_real(PyComplexObject *__pyx_v_self) { + double __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("real", 0); + + /* "cpython/complex.pxd":20 + * @property + * cdef inline double real(self): + * return self.cval.real # <<<<<<<<<<<<<< + * + * @property + */ + __pyx_r = __pyx_v_self->cval.real; + goto __pyx_L0; + + /* "cpython/complex.pxd":19 + * + * @property + * cdef inline double real(self): # <<<<<<<<<<<<<< + * return self.cval.real + * + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cpython/complex.pxd":23 + * + * @property + * cdef inline double imag(self): # <<<<<<<<<<<<<< + * return self.cval.imag + * + */ + +static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4imag_imag(PyComplexObject *__pyx_v_self) { + double __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("imag", 0); + + /* "cpython/complex.pxd":24 + * @property + * cdef inline double imag(self): + * return self.cval.imag # <<<<<<<<<<<<<< + * + * # PyTypeObject PyComplex_Type + */ + __pyx_r = __pyx_v_self->cval.imag; + goto __pyx_L0; + + /* "cpython/complex.pxd":23 + * + * @property + * cdef inline double imag(self): # <<<<<<<<<<<<<< + * return self.cval.imag + * + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cpython/contextvars.pxd":112 + * + * + * cdef inline object get_value(var, default_value=None): # <<<<<<<<<<<<<< + * """Return a new reference to the value of the context variable, + * or the default value of the context variable, + */ + +static CYTHON_INLINE PyObject *__pyx_f_7cpython_11contextvars_get_value(PyObject *__pyx_v_var, struct __pyx_opt_args_7cpython_11contextvars_get_value *__pyx_optional_args) { + PyObject *__pyx_v_default_value = ((PyObject *)Py_None); + PyObject *__pyx_v_value; + PyObject *__pyx_v_pyvalue = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_value", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_default_value = __pyx_optional_args->default_value; + } + } + + /* "cpython/contextvars.pxd":117 + * or None if no such value or default was found. + * """ + * cdef PyObject *value = NULL # <<<<<<<<<<<<<< + * PyContextVar_Get(var, NULL, &value) + * if value is NULL: + */ + __pyx_v_value = NULL; + + /* "cpython/contextvars.pxd":118 + * """ + * cdef PyObject *value = NULL + * PyContextVar_Get(var, NULL, &value) # <<<<<<<<<<<<<< + * if value is NULL: + * # context variable does not have a default + */ + __pyx_t_1 = PyContextVar_Get(__pyx_v_var, NULL, (&__pyx_v_value)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 118, __pyx_L1_error) + + /* "cpython/contextvars.pxd":119 + * cdef PyObject *value = NULL + * PyContextVar_Get(var, NULL, &value) + * if value is NULL: # <<<<<<<<<<<<<< + * # context variable does not have a default + * pyvalue = default_value + */ + __pyx_t_2 = (__pyx_v_value == NULL); + if (__pyx_t_2) { + + /* "cpython/contextvars.pxd":121 + * if value is NULL: + * # context variable does not have a default + * pyvalue = default_value # <<<<<<<<<<<<<< + * else: + * # value or default value of context variable + */ + __Pyx_INCREF(__pyx_v_default_value); + __pyx_v_pyvalue = __pyx_v_default_value; + + /* "cpython/contextvars.pxd":119 + * cdef PyObject *value = NULL + * PyContextVar_Get(var, NULL, &value) + * if value is NULL: # <<<<<<<<<<<<<< + * # context variable does not have a default + * pyvalue = default_value + */ + goto __pyx_L3; + } + + /* "cpython/contextvars.pxd":124 + * else: + * # value or default value of context variable + * pyvalue = value # <<<<<<<<<<<<<< + * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*' + * return pyvalue + */ + /*else*/ { + __pyx_t_3 = ((PyObject *)__pyx_v_value); + __Pyx_INCREF(__pyx_t_3); + __pyx_v_pyvalue = __pyx_t_3; + __pyx_t_3 = 0; + + /* "cpython/contextvars.pxd":125 + * # value or default value of context variable + * pyvalue = value + * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*' # <<<<<<<<<<<<<< + * return pyvalue + * + */ + Py_XDECREF(__pyx_v_value); + } + __pyx_L3:; + + /* "cpython/contextvars.pxd":126 + * pyvalue = value + * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*' + * return pyvalue # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_pyvalue); + __pyx_r = __pyx_v_pyvalue; + goto __pyx_L0; + + /* "cpython/contextvars.pxd":112 + * + * + * cdef inline object get_value(var, default_value=None): # <<<<<<<<<<<<<< + * """Return a new reference to the value of the context variable, + * or the default value of the context variable, + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cpython.contextvars.get_value", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_pyvalue); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cpython/contextvars.pxd":129 + * + * + * cdef inline object get_value_no_default(var, default_value=None): # <<<<<<<<<<<<<< + * """Return a new reference to the value of the context variable, + * or the provided default value if no such value was found. + */ + +static CYTHON_INLINE PyObject *__pyx_f_7cpython_11contextvars_get_value_no_default(PyObject *__pyx_v_var, struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default *__pyx_optional_args) { + PyObject *__pyx_v_default_value = ((PyObject *)Py_None); + PyObject *__pyx_v_value; + PyObject *__pyx_v_pyvalue = NULL; + 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("get_value_no_default", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_default_value = __pyx_optional_args->default_value; + } + } + + /* "cpython/contextvars.pxd":135 + * Ignores the default value of the context variable, if any. + * """ + * cdef PyObject *value = NULL # <<<<<<<<<<<<<< + * PyContextVar_Get(var, default_value, &value) + * # value of context variable or 'default_value' + */ + __pyx_v_value = NULL; + + /* "cpython/contextvars.pxd":136 + * """ + * cdef PyObject *value = NULL + * PyContextVar_Get(var, default_value, &value) # <<<<<<<<<<<<<< + * # value of context variable or 'default_value' + * pyvalue = value + */ + __pyx_t_1 = PyContextVar_Get(__pyx_v_var, ((PyObject *)__pyx_v_default_value), (&__pyx_v_value)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 136, __pyx_L1_error) + + /* "cpython/contextvars.pxd":138 + * PyContextVar_Get(var, default_value, &value) + * # value of context variable or 'default_value' + * pyvalue = value # <<<<<<<<<<<<<< + * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*' + * return pyvalue + */ + __pyx_t_2 = ((PyObject *)__pyx_v_value); + __Pyx_INCREF(__pyx_t_2); + __pyx_v_pyvalue = __pyx_t_2; + __pyx_t_2 = 0; + + /* "cpython/contextvars.pxd":139 + * # value of context variable or 'default_value' + * pyvalue = value + * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*' # <<<<<<<<<<<<<< + * return pyvalue + */ + Py_XDECREF(__pyx_v_value); + + /* "cpython/contextvars.pxd":140 + * pyvalue = value + * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*' + * return pyvalue # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_pyvalue); + __pyx_r = __pyx_v_pyvalue; + goto __pyx_L0; + + /* "cpython/contextvars.pxd":129 + * + * + * cdef inline object get_value_no_default(var, default_value=None): # <<<<<<<<<<<<<< + * """Return a new reference to the value of the context variable, + * or the provided default value if no such value was found. + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cpython.contextvars.get_value_no_default", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_pyvalue); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} /* "arrex/dtypes.pyx":40 * ''' @@ -1983,6 +3897,7 @@ static PyObject *__pyx_codeobj__21; /* Python wrapper */ static PyObject *__pyx_pw_5arrex_6dtypes_6DDType_1__repr__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_5arrex_6dtypes_6DDType_1__repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); @@ -1998,10 +3913,10 @@ static PyObject *__pyx_pf_5arrex_6dtypes_6DDType___repr__(struct __pyx_obj_5arre __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; - int __pyx_t_3; + PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; + int __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -2018,8 +3933,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_6DDType___repr__(struct __pyx_obj_5arre __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = PyType_Check(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { + if (__pyx_t_2) { /* "arrex/dtypes.pyx":42 * def __repr__(self): @@ -2029,26 +3943,31 @@ static PyObject *__pyx_pf_5arrex_6dtypes_6DDType___repr__(struct __pyx_obj_5arre * return ''.format(repr(self.key)) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_dtype, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_dtype, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->key, __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->key, __pyx_n_s_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_6); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_6 = 1; } } - __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; @@ -2071,9 +3990,8 @@ static PyObject *__pyx_pf_5arrex_6dtypes_6DDType___repr__(struct __pyx_obj_5arre */ __pyx_t_1 = __pyx_v_self->key; __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = PyUnicode_Check(__pyx_t_1); + __pyx_t_2 = PyUnicode_Check(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_2 = (__pyx_t_3 != 0); if (__pyx_t_2) { /* "arrex/dtypes.pyx":44 @@ -2084,29 +4002,34 @@ static PyObject *__pyx_pf_5arrex_6dtypes_6DDType___repr__(struct __pyx_obj_5arre * return ''.format(id(self)) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_dtype, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __pyx_v_self->key; - __Pyx_INCREF(__pyx_t_5); - __pyx_t_6 = PyObject_Repr(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_dtype, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __pyx_v_self->key; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = PyObject_Repr(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_6 = 1; } } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; @@ -2129,26 +4052,31 @@ static PyObject *__pyx_pf_5arrex_6dtypes_6DDType___repr__(struct __pyx_obj_5arre */ /*else*/ { __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_dtype_at, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_dtype_at, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = NULL; + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_6 = 1; } } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; @@ -2165,9 +4093,9 @@ static PyObject *__pyx_pf_5arrex_6dtypes_6DDType___repr__(struct __pyx_obj_5arre /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("arrex.dtypes.DDType.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -2185,13 +4113,71 @@ static PyObject *__pyx_pf_5arrex_6dtypes_6DDType___repr__(struct __pyx_obj_5arre */ /* Python wrapper */ -static PyObject *__pyx_pw_5arrex_6dtypes_6DDType_3__reduce_ex__(PyObject *__pyx_v_self, PyObject *__pyx_v_protocol); /*proto*/ -static char __pyx_doc_5arrex_6dtypes_6DDType_2__reduce_ex__[] = " allow serialization of the dtype with the array (particularly useful for anonymous dtypes) "; -static PyObject *__pyx_pw_5arrex_6dtypes_6DDType_3__reduce_ex__(PyObject *__pyx_v_self, PyObject *__pyx_v_protocol) { +static PyObject *__pyx_pw_5arrex_6dtypes_6DDType_3__reduce_ex__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5arrex_6dtypes_6DDType_2__reduce_ex__, " allow serialization of the dtype with the array (particularly useful for anonymous dtypes) "); +static PyMethodDef __pyx_mdef_5arrex_6dtypes_6DDType_3__reduce_ex__ = {"__reduce_ex__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_6dtypes_6DDType_3__reduce_ex__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_6dtypes_6DDType_2__reduce_ex__}; +static PyObject *__pyx_pw_5arrex_6dtypes_6DDType_3__reduce_ex__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v_protocol = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_ex__ (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_6dtypes_6DDType_2__reduce_ex__(((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_v_self), ((PyObject *)__pyx_v_protocol)); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_protocol,0}; + PyObject* values[1] = {0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_protocol)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 48, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__reduce_ex__") < 0)) __PYX_ERR(0, 48, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_protocol = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__reduce_ex__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 48, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("arrex.dtypes.DDType.__reduce_ex__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5arrex_6dtypes_6DDType_2__reduce_ex__(((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_v_self), __pyx_v_protocol); /* function exit code */ __Pyx_RefNannyFinishContext(); @@ -2202,10 +4188,9 @@ static PyObject *__pyx_pf_5arrex_6dtypes_6DDType_2__reduce_ex__(struct __pyx_obj PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - int __pyx_t_2; + 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; @@ -2219,8 +4204,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_6DDType_2__reduce_ex__(struct __pyx_obj * return self._rebuild, (self.key, self.dsize, self.layout) */ __pyx_t_1 = (__pyx_v_self->key == Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (unlikely(__pyx_t_2)) { + if (unlikely(__pyx_t_1)) { /* "arrex/dtypes.pyx":51 * ''' allow serialization of the dtype with the array (particularly useful for anonymous dtypes) ''' @@ -2229,10 +4213,10 @@ static PyObject *__pyx_pf_5arrex_6dtypes_6DDType_2__reduce_ex__(struct __pyx_obj * return self._rebuild, (self.key, self.dsize, self.layout) * */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 51, __pyx_L1_error) /* "arrex/dtypes.pyx":50 @@ -2252,31 +4236,31 @@ static PyObject *__pyx_pf_5arrex_6dtypes_6DDType_2__reduce_ex__(struct __pyx_obj * @classmethod */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_rebuild); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_rebuild); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_self->dsize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_self->dsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 52, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 52, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_self->key); __Pyx_GIVEREF(__pyx_v_self->key); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_self->key); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_self->key); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_INCREF(__pyx_v_self->layout); __Pyx_GIVEREF(__pyx_v_self->layout); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_self->layout); - __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 52, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_self->layout); __pyx_t_3 = 0; - __pyx_t_5 = 0; - __pyx_r = __pyx_t_4; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4); + __pyx_t_2 = 0; __pyx_t_4 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; goto __pyx_L0; /* "arrex/dtypes.pyx":48 @@ -2289,9 +4273,9 @@ static PyObject *__pyx_pf_5arrex_6dtypes_6DDType_2__reduce_ex__(struct __pyx_obj /* function exit code */ __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("arrex.dtypes.DDType.__reduce_ex__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -2300,20 +4284,37 @@ static PyObject *__pyx_pf_5arrex_6dtypes_6DDType_2__reduce_ex__(struct __pyx_obj return __pyx_r; } -/* "arrex/dtypes.pyx":55 +/* "arrex/dtypes.pyx":54 + * return self._rebuild, (self.key, self.dsize, self.layout) * - * @classmethod - * def _rebuild(cls, key, size_t dsize, bytes layout): # <<<<<<<<<<<<<< + * @classmethod # <<<<<<<<<<<<<< + * def _rebuild(cls, key, size_t dsize, bytes layout): * candidate = declared(key) - * if dsize != candidate.dsize: */ /* Python wrapper */ -static PyObject *__pyx_pw_5arrex_6dtypes_6DDType_5_rebuild(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_5arrex_6dtypes_6DDType_5_rebuild(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_5arrex_6dtypes_6DDType_5_rebuild(PyObject *__pyx_v_cls, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5arrex_6dtypes_6DDType_5_rebuild = {"_rebuild", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_6dtypes_6DDType_5_rebuild, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5arrex_6dtypes_6DDType_5_rebuild(PyObject *__pyx_v_cls, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { PyObject *__pyx_v_key = 0; size_t __pyx_v_dsize; PyObject *__pyx_v_layout = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -2321,48 +4322,51 @@ static PyObject *__pyx_pw_5arrex_6dtypes_6DDType_5_rebuild(PyObject *__pyx_v_cls __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_rebuild (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_dsize,&__pyx_n_s_layout,0}; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_dsize,&__pyx_n_s_layout,0}; PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 54, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dsize)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dsize)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 54, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("_rebuild", 1, 3, 3, 1); __PYX_ERR(0, 55, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("_rebuild", 1, 3, 3, 1); __PYX_ERR(0, 54, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_layout)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_layout)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 54, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("_rebuild", 1, 3, 3, 2); __PYX_ERR(0, 55, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("_rebuild", 1, 3, 3, 2); __PYX_ERR(0, 54, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_rebuild") < 0)) __PYX_ERR(0, 55, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_rebuild") < 0)) __PYX_ERR(0, 54, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + } else if (unlikely(__pyx_nargs != 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); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); } __pyx_v_key = values[0]; __pyx_v_dsize = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_dsize == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 55, __pyx_L3_error) @@ -2370,7 +4374,7 @@ static PyObject *__pyx_pw_5arrex_6dtypes_6DDType_5_rebuild(PyObject *__pyx_v_cls } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_rebuild", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 55, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("_rebuild", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 54, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("arrex.dtypes.DDType._rebuild", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -2400,9 +4404,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_6DDType_4_rebuild(CYTHON_UNUSED PyTypeO PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - int __pyx_t_10; - int __pyx_t_11; + int __pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -2427,7 +4429,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_6DDType_4_rebuild(CYTHON_UNUSED PyTypeO * raise ValueError('the pickled dtype {} has a different size here than in dump, unpickled {} expected {}' * .format(repr(key), dsize, candidate.dsize)) */ - __pyx_t_2 = ((__pyx_v_dsize != __pyx_v_candidate->dsize) != 0); + __pyx_t_2 = (__pyx_v_dsize != __pyx_v_candidate->dsize); if (unlikely(__pyx_t_2)) { /* "arrex/dtypes.pyx":59 @@ -2457,48 +4459,17 @@ static PyObject *__pyx_pf_5arrex_6dtypes_6DDType_4_rebuild(CYTHON_UNUSED PyTypeO __pyx_t_8 = 1; } } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_4, __pyx_t_5, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_4, __pyx_t_5, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) + { + PyObject *__pyx_callargs[4] = {__pyx_t_7, __pyx_t_4, __pyx_t_5, __pyx_t_6}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_8, 3+__pyx_t_8); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (__pyx_t_7) { - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; - } - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_6); - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_6 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "arrex/dtypes.pyx":58 * candidate = declared(key) @@ -2530,15 +4501,14 @@ static PyObject *__pyx_pf_5arrex_6dtypes_6DDType_4_rebuild(CYTHON_UNUSED PyTypeO * raise ValueError('the pickled dtype {} has a different memory layout here than in dump, unpickled {} expected {}' * .format(repr(key), layout, candidate.layout)) */ - __pyx_t_10 = (__pyx_v_candidate->layout != Py_None)&&(PyBytes_GET_SIZE(__pyx_v_candidate->layout) != 0); - if (__pyx_t_10) { + __pyx_t_9 = (__pyx_v_candidate->layout != Py_None)&&(PyBytes_GET_SIZE(__pyx_v_candidate->layout) != 0); + if (__pyx_t_9) { } else { - __pyx_t_2 = __pyx_t_10; + __pyx_t_2 = __pyx_t_9; goto __pyx_L5_bool_binop_done; } - __pyx_t_10 = (__Pyx_PyBytes_Equals(__pyx_v_layout, __pyx_v_candidate->layout, Py_NE)); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 60, __pyx_L1_error) - __pyx_t_11 = (__pyx_t_10 != 0); - __pyx_t_2 = __pyx_t_11; + __pyx_t_9 = (__Pyx_PyBytes_Equals(__pyx_v_layout, __pyx_v_candidate->layout, Py_NE)); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 60, __pyx_L1_error) + __pyx_t_2 = __pyx_t_9; __pyx_L5_bool_binop_done:; if (unlikely(__pyx_t_2)) { @@ -2551,58 +4521,29 @@ static PyObject *__pyx_pf_5arrex_6dtypes_6DDType_4_rebuild(CYTHON_UNUSED PyTypeO */ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_the_pickled_dtype_has_a_differen_2, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = PyObject_Repr(__pyx_v_key); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_6 = NULL; + __pyx_t_6 = PyObject_Repr(__pyx_v_key); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = NULL; __pyx_t_8 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_6)) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); __pyx_t_8 = 1; } } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_9, __pyx_v_layout, __pyx_v_candidate->layout}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_9, __pyx_v_layout, __pyx_v_candidate->layout}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif { - __pyx_t_5 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__pyx_t_6) { - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL; - } - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_8, __pyx_t_9); - __Pyx_INCREF(__pyx_v_layout); - __Pyx_GIVEREF(__pyx_v_layout); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_8, __pyx_v_layout); - __Pyx_INCREF(__pyx_v_candidate->layout); - __Pyx_GIVEREF(__pyx_v_candidate->layout); - PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_8, __pyx_v_candidate->layout); - __pyx_t_9 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 62, __pyx_L1_error) + PyObject *__pyx_callargs[4] = {__pyx_t_5, __pyx_t_6, __pyx_v_layout, __pyx_v_candidate->layout}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_8, 3+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "arrex/dtypes.pyx":61 * .format(repr(key), dsize, candidate.dsize)) @@ -2635,16 +4576,16 @@ static PyObject *__pyx_pf_5arrex_6dtypes_6DDType_4_rebuild(CYTHON_UNUSED PyTypeO * */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_candidate)); + __Pyx_INCREF((PyObject *)__pyx_v_candidate); __pyx_r = ((PyObject *)__pyx_v_candidate); goto __pyx_L0; - /* "arrex/dtypes.pyx":55 + /* "arrex/dtypes.pyx":54 + * return self._rebuild, (self.key, self.dsize, self.layout) * - * @classmethod - * def _rebuild(cls, key, size_t dsize, bytes layout): # <<<<<<<<<<<<<< + * @classmethod # <<<<<<<<<<<<<< + * def _rebuild(cls, key, size_t dsize, bytes layout): * candidate = declared(key) - * if dsize != candidate.dsize: */ /* function exit code */ @@ -2655,7 +4596,6 @@ static PyObject *__pyx_pf_5arrex_6dtypes_6DDType_4_rebuild(CYTHON_UNUSED PyTypeO __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("arrex.dtypes.DDType._rebuild", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -2676,6 +4616,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_6DDType_4_rebuild(CYTHON_UNUSED PyTypeO /* Python wrapper */ static PyObject *__pyx_pw_5arrex_6dtypes_6DDType_5dsize_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_5arrex_6dtypes_6DDType_5dsize_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); @@ -2695,7 +4636,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_6DDType_5dsize___get__(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->dsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 16, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->dsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2715,6 +4656,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_6DDType_5dsize___get__(struct __pyx_obj /* Python wrapper */ static int __pyx_pw_5arrex_6dtypes_6DDType_5dsize_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ static int __pyx_pw_5arrex_6dtypes_6DDType_5dsize_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); @@ -2733,7 +4675,7 @@ static int __pyx_pf_5arrex_6dtypes_6DDType_5dsize_2__set__(struct __pyx_obj_5arr const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - __pyx_t_1 = __Pyx_PyInt_As_size_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 16, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_As_size_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 16, __pyx_L1_error) __pyx_v_self->dsize = __pyx_t_1; /* function exit code */ @@ -2758,6 +4700,7 @@ static int __pyx_pf_5arrex_6dtypes_6DDType_5dsize_2__set__(struct __pyx_obj_5arr /* Python wrapper */ static PyObject *__pyx_pw_5arrex_6dtypes_6DDType_6layout_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_5arrex_6dtypes_6DDType_6layout_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); @@ -2787,6 +4730,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_6DDType_6layout___get__(struct __pyx_ob /* Python wrapper */ static int __pyx_pw_5arrex_6dtypes_6DDType_6layout_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ static int __pyx_pw_5arrex_6dtypes_6DDType_6layout_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); @@ -2805,7 +4749,7 @@ static int __pyx_pf_5arrex_6dtypes_6DDType_6layout_2__set__(struct __pyx_obj_5ar const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - if (!(likely(PyBytes_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(1, 19, __pyx_L1_error) + if (!(likely(PyBytes_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_v_value))) __PYX_ERR(2, 19, __pyx_L1_error) __pyx_t_1 = __pyx_v_value; __Pyx_INCREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); @@ -2829,6 +4773,7 @@ static int __pyx_pf_5arrex_6dtypes_6DDType_6layout_2__set__(struct __pyx_obj_5ar /* Python wrapper */ static int __pyx_pw_5arrex_6dtypes_6DDType_6layout_5__del__(PyObject *__pyx_v_self); /*proto*/ static int __pyx_pw_5arrex_6dtypes_6DDType_6layout_5__del__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); @@ -2866,6 +4811,7 @@ static int __pyx_pf_5arrex_6dtypes_6DDType_6layout_4__del__(struct __pyx_obj_5ar /* Python wrapper */ static PyObject *__pyx_pw_5arrex_6dtypes_6DDType_3key_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_5arrex_6dtypes_6DDType_3key_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); @@ -2895,6 +4841,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_6DDType_3key___get__(struct __pyx_obj_5 /* Python wrapper */ static int __pyx_pw_5arrex_6dtypes_6DDType_3key_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ static int __pyx_pw_5arrex_6dtypes_6DDType_3key_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); @@ -2924,6 +4871,7 @@ static int __pyx_pf_5arrex_6dtypes_6DDType_3key_2__set__(struct __pyx_obj_5arrex /* Python wrapper */ static int __pyx_pw_5arrex_6dtypes_6DDType_3key_5__del__(PyObject *__pyx_v_self); /*proto*/ static int __pyx_pw_5arrex_6dtypes_6DDType_3key_5__del__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); @@ -2959,14 +4907,71 @@ static int __pyx_pf_5arrex_6dtypes_6DDType_3key_4__del__(struct __pyx_obj_5arrex */ /* Python wrapper */ -static PyObject *__pyx_pw_5arrex_6dtypes_1DDTypeClass(PyObject *__pyx_self, PyObject *__pyx_v_type); /*proto*/ -static char __pyx_doc_5arrex_6dtypes_DDTypeClass[] = " DDTypeClass(type)\n\t\n\t\tCreate a dtype from a python class (can be a pure python class) \n\t\t\n\t\tthe given type must have the following attributes:\n\t\t\n\t\t\t- `frombytes` or `from_bytes` or `from_buffer`\n\t\t\t\n\t\t\t\tstatic method that initialize the type from bytes\n\t\t\t\t\n\t\t\t- `__bytes__` or `tobytes` or `to_bytes`\n\t\t\t\t\n\t\t\t\tmethod that converts to bytes, the returned byte must always be of the same size\n\t\t\t\n\t\t\t- `__packlayout__` (optional) string or bytes giving binary format returned by `__bytes__`, it must follow the specifications of module `struct`\n\t\t\t- `__packsize__` (optional) defines the byte size returned by `__bytes__`, optional if `__packlayout__` is provided\n\t\t\t\n\t\tExample:\n\t\t\n\t\t\t>>> class test_class:\n\t\t\t... \t__packlayout__ = 'ff'\n\t\t\t... \t_struct = struct.Struct(__packlayout__)\n\t\t\t... \t\n\t\t\t... \tdef __init__(self, x, y):\n\t\t\t... \t\tself.x = x\n\t\t\t... \t\tself.y = y\n\t\t\t... \t\n\t\t\t... \tdef __bytes__(self):\n\t\t\t... \t\treturn self._struct.pack(self.x, self.y)\n\t\t\t... \t@classmethod\n\t\t\t... \tdef frombytes(cls, b):\n\t\t\t... \t\treturn cls(*cls._struct.unpack(b))\n\t\t\t... \t\t\n\t\t\t... \tdef __repr__(self):\n\t\t\t... \t\treturn '(x={}, y={})'.format(self.x, self.y)\n\t\t\t... \n\t\t\t>>> a = typedlist(dtype=test_class) # no declaration needed\n\t"; -static PyMethodDef __pyx_mdef_5arrex_6dtypes_1DDTypeClass = {"DDTypeClass", (PyCFunction)__pyx_pw_5arrex_6dtypes_1DDTypeClass, METH_O, __pyx_doc_5arrex_6dtypes_DDTypeClass}; -static PyObject *__pyx_pw_5arrex_6dtypes_1DDTypeClass(PyObject *__pyx_self, PyObject *__pyx_v_type) { +static PyObject *__pyx_pw_5arrex_6dtypes_1DDTypeClass(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5arrex_6dtypes_DDTypeClass, " DDTypeClass(type)\n\t\n\t\tCreate a dtype from a python class (can be a pure python class) \n\t\t\n\t\tthe given type must have the following attributes:\n\t\t\n\t\t\t- `frombytes` or `from_bytes` or `from_buffer`\n\t\t\t\n\t\t\t\tstatic method that initialize the type from bytes\n\t\t\t\t\n\t\t\t- `__bytes__` or `tobytes` or `to_bytes`\n\t\t\t\t\n\t\t\t\tmethod that converts to bytes, the returned byte must always be of the same size\n\t\t\t\n\t\t\t- `__packlayout__` (optional) string or bytes giving binary format returned by `__bytes__`, it must follow the specifications of module `struct`\n\t\t\t- `__packsize__` (optional) defines the byte size returned by `__bytes__`, optional if `__packlayout__` is provided\n\t\t\t\n\t\tExample:\n\t\t\n\t\t\t>>> class test_class:\n\t\t\t... \t__packlayout__ = 'ff'\n\t\t\t... \t_struct = struct.Struct(__packlayout__)\n\t\t\t... \t\n\t\t\t... \tdef __init__(self, x, y):\n\t\t\t... \t\tself.x = x\n\t\t\t... \t\tself.y = y\n\t\t\t... \t\n\t\t\t... \tdef __bytes__(self):\n\t\t\t... \t\treturn self._struct.pack(self.x, self.y)\n\t\t\t... \t@classmethod\n\t\t\t... \tdef frombytes(cls, b):\n\t\t\t... \t\treturn cls(*cls._struct.unpack(b))\n\t\t\t... \t\t\n\t\t\t... \tdef __repr__(self):\n\t\t\t... \t\treturn '(x={}, y={})'.format(self.x, self.y)\n\t\t\t... \n\t\t\t>>> a = typedlist(dtype=test_class) # no declaration needed\n\t"); +static PyMethodDef __pyx_mdef_5arrex_6dtypes_1DDTypeClass = {"DDTypeClass", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_6dtypes_1DDTypeClass, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_6dtypes_DDTypeClass}; +static PyObject *__pyx_pw_5arrex_6dtypes_1DDTypeClass(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_type = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("DDTypeClass (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_6dtypes_DDTypeClass(__pyx_self, ((PyObject *)__pyx_v_type)); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_type,0}; + PyObject* values[1] = {0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_type)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 66, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "DDTypeClass") < 0)) __PYX_ERR(0, 66, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_type = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("DDTypeClass", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 66, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("arrex.dtypes.DDTypeClass", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5arrex_6dtypes_DDTypeClass(__pyx_self, __pyx_v_type); /* function exit code */ __Pyx_RefNannyFinishContext(); @@ -2986,6 +4991,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_DDTypeClass(CYTHON_UNUSED PyObject *__p PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -3022,8 +5028,8 @@ static PyObject *__pyx_pf_5arrex_6dtypes_DDTypeClass(CYTHON_UNUSED PyObject *__p * dsize = struct.calcsize(layout or b'') * if not dsize: */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_dsize); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 107, __pyx_L1_error) - __pyx_t_3 = ((!__pyx_t_2) != 0); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_dsize); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 107, __pyx_L1_error) + __pyx_t_3 = (!__pyx_t_2); if (__pyx_t_3) { /* "arrex/dtypes.pyx":108 @@ -3038,7 +5044,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_DDTypeClass(CYTHON_UNUSED PyObject *__p __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_calcsize); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_layout); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 108, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_layout); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 108, __pyx_L1_error) if (!__pyx_t_3) { } else { __Pyx_INCREF(__pyx_v_layout); @@ -3049,6 +5055,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_DDTypeClass(CYTHON_UNUSED PyObject *__p __pyx_t_4 = __pyx_kp_b__2; __pyx_L4_bool_binop_done:; __pyx_t_6 = NULL; + __pyx_t_7 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_6)) { @@ -3056,14 +5063,18 @@ static PyObject *__pyx_pf_5arrex_6dtypes_DDTypeClass(CYTHON_UNUSED PyObject *__p __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; } } - __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } __Pyx_DECREF_SET(__pyx_v_dsize, __pyx_t_1); __pyx_t_1 = 0; @@ -3083,8 +5094,8 @@ static PyObject *__pyx_pf_5arrex_6dtypes_DDTypeClass(CYTHON_UNUSED PyObject *__p * raise ValueError('dsize must not be null, __packlayout__ or __packsize__ must be correctly defined in the given type') * */ - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_dsize); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 109, __pyx_L1_error) - __pyx_t_2 = ((!__pyx_t_3) != 0); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_dsize); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 109, __pyx_L1_error) + __pyx_t_2 = (!__pyx_t_3); if (unlikely(__pyx_t_2)) { /* "arrex/dtypes.pyx":110 @@ -3118,7 +5129,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_DDTypeClass(CYTHON_UNUSED PyObject *__p */ __pyx_t_5 = __Pyx_GetAttr3(__pyx_v_type, __pyx_n_u_bytes, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 112, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 112, __pyx_L1_error) if (!__pyx_t_2) { __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else { @@ -3129,7 +5140,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_DDTypeClass(CYTHON_UNUSED PyObject *__p } __pyx_t_5 = __Pyx_GetAttr3(__pyx_v_type, __pyx_n_u_tobytes, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 112, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 112, __pyx_L1_error) if (!__pyx_t_2) { __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else { @@ -3154,8 +5165,8 @@ static PyObject *__pyx_pf_5arrex_6dtypes_DDTypeClass(CYTHON_UNUSED PyObject *__p * raise TypeError("the given type must have a method '__bytes__', 'tobytes', or 'to_bytes'") * */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_pack); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 113, __pyx_L1_error) - __pyx_t_3 = ((!__pyx_t_2) != 0); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_pack); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 113, __pyx_L1_error) + __pyx_t_3 = (!__pyx_t_2); if (unlikely(__pyx_t_3)) { /* "arrex/dtypes.pyx":114 @@ -3189,7 +5200,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_DDTypeClass(CYTHON_UNUSED PyObject *__p */ __pyx_t_5 = __Pyx_GetAttr3(__pyx_v_type, __pyx_n_u_frombytes, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 116, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 116, __pyx_L1_error) if (!__pyx_t_3) { __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else { @@ -3200,7 +5211,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_DDTypeClass(CYTHON_UNUSED PyObject *__p } __pyx_t_5 = __Pyx_GetAttr3(__pyx_v_type, __pyx_n_u_from_bytes, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 116, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 116, __pyx_L1_error) if (!__pyx_t_3) { __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else { @@ -3225,8 +5236,8 @@ static PyObject *__pyx_pf_5arrex_6dtypes_DDTypeClass(CYTHON_UNUSED PyObject *__p * raise TypeError("the given type must have a method 'frombytes', 'from_bytes', or 'from_buffer'") * */ - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_unpack); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 117, __pyx_L1_error) - __pyx_t_2 = ((!__pyx_t_3) != 0); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_unpack); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 117, __pyx_L1_error) + __pyx_t_2 = (!__pyx_t_3); if (unlikely(__pyx_t_2)) { /* "arrex/dtypes.pyx":118 @@ -3315,14 +5326,71 @@ static PyObject *__pyx_pf_5arrex_6dtypes_DDTypeClass(CYTHON_UNUSED PyObject *__p */ /* Python wrapper */ -static PyObject *__pyx_pw_5arrex_6dtypes_3DDTypeStruct(PyObject *__pyx_self, PyObject *__pyx_v_definition); /*proto*/ -static char __pyx_doc_5arrex_6dtypes_2DDTypeStruct[] = " DDTypeStruct(struct)\n\t\n\t\tcreate a dtype from a Struct object from module `struct` \n\t\n\t\tExample:\n\t\t\t\n\t\t\t>>> a = typedlist(dtype='fxBh') # no declaration needed\n\t"; -static PyMethodDef __pyx_mdef_5arrex_6dtypes_3DDTypeStruct = {"DDTypeStruct", (PyCFunction)__pyx_pw_5arrex_6dtypes_3DDTypeStruct, METH_O, __pyx_doc_5arrex_6dtypes_2DDTypeStruct}; -static PyObject *__pyx_pw_5arrex_6dtypes_3DDTypeStruct(PyObject *__pyx_self, PyObject *__pyx_v_definition) { +static PyObject *__pyx_pw_5arrex_6dtypes_3DDTypeStruct(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5arrex_6dtypes_2DDTypeStruct, " DDTypeStruct(struct)\n\t\n\t\tcreate a dtype from a Struct object from module `struct` \n\t\n\t\tExample:\n\t\t\t\n\t\t\t>>> a = typedlist(dtype='fxBh') # no declaration needed\n\t"); +static PyMethodDef __pyx_mdef_5arrex_6dtypes_3DDTypeStruct = {"DDTypeStruct", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_6dtypes_3DDTypeStruct, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_6dtypes_2DDTypeStruct}; +static PyObject *__pyx_pw_5arrex_6dtypes_3DDTypeStruct(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_definition = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("DDTypeStruct (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_6dtypes_2DDTypeStruct(__pyx_self, ((PyObject *)__pyx_v_definition)); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_definition,0}; + PyObject* values[1] = {0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_definition)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 122, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "DDTypeStruct") < 0)) __PYX_ERR(0, 122, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_definition = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("DDTypeStruct", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 122, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("arrex.dtypes.DDTypeStruct", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5arrex_6dtypes_2DDTypeStruct(__pyx_self, __pyx_v_definition); /* function exit code */ __Pyx_RefNannyFinishContext(); @@ -3338,13 +5406,70 @@ static PyObject *__pyx_pw_5arrex_6dtypes_3DDTypeStruct(PyObject *__pyx_self, PyO */ /* Python wrapper */ -static PyObject *__pyx_pw_5arrex_6dtypes_12DDTypeStruct_lambda(PyObject *__pyx_self, PyObject *__pyx_v_o); /*proto*/ -static PyMethodDef __pyx_mdef_5arrex_6dtypes_12DDTypeStruct_lambda = {"lambda", (PyCFunction)__pyx_pw_5arrex_6dtypes_12DDTypeStruct_lambda, METH_O, 0}; -static PyObject *__pyx_pw_5arrex_6dtypes_12DDTypeStruct_lambda(PyObject *__pyx_self, PyObject *__pyx_v_o) { +static PyObject *__pyx_pw_5arrex_6dtypes_12DDTypeStruct_lambda(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5arrex_6dtypes_12DDTypeStruct_lambda = {"lambda", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_6dtypes_12DDTypeStruct_lambda, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5arrex_6dtypes_12DDTypeStruct_lambda(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_o = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("lambda (wrapper)", 0); - __pyx_r = __pyx_lambda_funcdef_lambda(__pyx_self, ((PyObject *)__pyx_v_o)); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_o,0}; + PyObject* values[1] = {0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_o)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 133, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "lambda") < 0)) __PYX_ERR(0, 133, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_o = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("lambda", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 133, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("arrex.dtypes.DDTypeStruct.lambda", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_lambda_funcdef_lambda(__pyx_self, __pyx_v_o); /* function exit code */ __Pyx_RefNannyFinishContext(); @@ -3421,7 +5546,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_2DDTypeStruct(CYTHON_UNUSED PyObject *_ __Pyx_INCREF(Py_None); __PYX_ERR(0, 122, __pyx_L1_error) } else { - __Pyx_GOTREF(__pyx_cur_scope); + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } __pyx_cur_scope->__pyx_v_definition = __pyx_v_definition; __Pyx_INCREF(__pyx_cur_scope->__pyx_v_definition); @@ -3444,7 +5569,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_2DDTypeStruct(CYTHON_UNUSED PyObject *_ __pyx_t_4 = PyObject_IsInstance(__pyx_t_1, __pyx_t_3); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = ((!(__pyx_t_4 != 0)) != 0); + __pyx_t_5 = (!__pyx_t_4); if (unlikely(__pyx_t_5)) { /* "arrex/dtypes.pyx":132 @@ -3524,7 +5649,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_2DDTypeStruct(CYTHON_UNUSED PyObject *_ __Pyx_AddTraceback("arrex.dtypes.DDTypeStruct", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_DECREF((PyObject *)__pyx_cur_scope); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; @@ -3545,6 +5670,8 @@ static int __pyx_pw_5arrex_6dtypes_15DDTypeFunctions_1__init__(PyObject *__pyx_v PyObject *__pyx_v_pack = 0; PyObject *__pyx_v_unpack = 0; PyObject *__pyx_v_layout = 0; + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -3552,58 +5679,62 @@ static int __pyx_pw_5arrex_6dtypes_15DDTypeFunctions_1__init__(PyObject *__pyx_v __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dsize,&__pyx_n_s_pack,&__pyx_n_s_unpack,&__pyx_n_s_layout,0}; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dsize,&__pyx_n_s_pack,&__pyx_n_s_unpack,&__pyx_n_s_layout,0}; PyObject* values[4] = {0,0,0,0}; values[3] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dsize)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dsize)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 155, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pack)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pack)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 155, __pyx_L3_error) else { __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, 1); __PYX_ERR(0, 155, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_unpack)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_unpack)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 155, __pyx_L3_error) else { __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, 2); __PYX_ERR(0, 155, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_layout); + PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_layout); if (value) { values[3] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 155, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 155, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 155, __pyx_L3_error) } } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3); CYTHON_FALLTHROUGH; - 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); + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); + values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); + values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } @@ -3615,7 +5746,7 @@ static int __pyx_pw_5arrex_6dtypes_15DDTypeFunctions_1__init__(PyObject *__pyx_v } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 155, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, __pyx_nargs); __PYX_ERR(0, 155, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("arrex.dtypes.DDTypeFunctions.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3638,7 +5769,8 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeFunctions___init__(struct __pyx_obj_5 PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; - size_t __pyx_t_7; + int __pyx_t_7; + size_t __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -3653,14 +5785,14 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeFunctions___init__(struct __pyx_obj_5 * */ __pyx_t_2 = __Pyx_PyCallable_Check(__pyx_v_pack); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 156, __pyx_L1_error) - __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0); + __pyx_t_3 = (!__pyx_t_2); if (!__pyx_t_3) { } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L4_bool_binop_done; } __pyx_t_3 = __Pyx_PyCallable_Check(__pyx_v_unpack); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 156, __pyx_L1_error) - __pyx_t_2 = ((!(__pyx_t_3 != 0)) != 0); + __pyx_t_2 = (!__pyx_t_3); __pyx_t_1 = __pyx_t_2; __pyx_L4_bool_binop_done:; if (unlikely(__pyx_t_1)) { @@ -3695,8 +5827,7 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeFunctions___init__(struct __pyx_obj_5 * layout = layout.encode() */ __pyx_t_1 = (__pyx_v_layout != Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + if (__pyx_t_1) { /* "arrex/dtypes.pyx":160 * @@ -3705,8 +5836,7 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeFunctions___init__(struct __pyx_obj_5 * layout = layout.encode() * elif not isinstance(layout, bytes): */ - __pyx_t_2 = PyUnicode_Check(__pyx_v_layout); - __pyx_t_1 = (__pyx_t_2 != 0); + __pyx_t_1 = PyUnicode_Check(__pyx_v_layout); if (__pyx_t_1) { /* "arrex/dtypes.pyx":161 @@ -3719,6 +5849,7 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeFunctions___init__(struct __pyx_obj_5 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_layout, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = NULL; + __pyx_t_7 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_6)) { @@ -3726,13 +5857,17 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeFunctions___init__(struct __pyx_obj_5 __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; } } - __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 161, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[1] = {__pyx_t_6, }; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } __Pyx_DECREF_SET(__pyx_v_layout, __pyx_t_4); __pyx_t_4 = 0; @@ -3754,7 +5889,7 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeFunctions___init__(struct __pyx_obj_5 * */ __pyx_t_1 = PyBytes_Check(__pyx_v_layout); - __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); + __pyx_t_2 = (!__pyx_t_1); if (__pyx_t_2) { /* "arrex/dtypes.pyx":163 @@ -3792,6 +5927,7 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeFunctions___init__(struct __pyx_obj_5 __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = NULL; + __pyx_t_7 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_5)) { @@ -3799,13 +5935,17 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeFunctions___init__(struct __pyx_obj_5 __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_7 = 1; } } - __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, __pyx_v_layout) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_layout); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 165, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_layout}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 165, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } __pyx_v_fmtsize = __pyx_t_4; __pyx_t_4 = 0; @@ -3817,16 +5957,15 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeFunctions___init__(struct __pyx_obj_5 * elif not dsize: */ __pyx_t_1 = (__pyx_v_dsize != Py_None); - __pyx_t_3 = (__pyx_t_1 != 0); - if (__pyx_t_3) { + if (__pyx_t_1) { } else { - __pyx_t_2 = __pyx_t_3; + __pyx_t_2 = __pyx_t_1; goto __pyx_L9_bool_binop_done; } __pyx_t_4 = PyObject_RichCompare(__pyx_v_dsize, __pyx_v_fmtsize, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 166, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 166, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_2 = __pyx_t_3; + __pyx_t_2 = __pyx_t_1; __pyx_L9_bool_binop_done:; if (unlikely(__pyx_t_2)) { @@ -3869,9 +6008,9 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeFunctions___init__(struct __pyx_obj_5 * raise ValueError('dsize must be provided or deduced from a given layout') * */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_dsize); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 168, __pyx_L1_error) - __pyx_t_3 = ((!__pyx_t_2) != 0); - if (unlikely(__pyx_t_3)) { + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_dsize); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 168, __pyx_L1_error) + __pyx_t_1 = (!__pyx_t_2); + if (unlikely(__pyx_t_1)) { /* "arrex/dtypes.pyx":169 * raise ValueError('dsize must match layout size') @@ -3903,8 +6042,8 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeFunctions___init__(struct __pyx_obj_5 * self.c_pack = self._func_pack * self.c_unpack = self._func_unpack */ - __pyx_t_7 = __Pyx_PyInt_As_size_t(__pyx_v_dsize); if (unlikely((__pyx_t_7 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 171, __pyx_L1_error) - __pyx_v_self->__pyx_base.dsize = __pyx_t_7; + __pyx_t_8 = __Pyx_PyInt_As_size_t(__pyx_v_dsize); if (unlikely((__pyx_t_8 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 171, __pyx_L1_error) + __pyx_v_self->__pyx_base.dsize = __pyx_t_8; /* "arrex/dtypes.pyx":172 * @@ -3931,7 +6070,7 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeFunctions___init__(struct __pyx_obj_5 * self.pack = pack * self.unpack = unpack */ - if (!(likely(PyBytes_CheckExact(__pyx_v_layout))||((__pyx_v_layout) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_layout)->tp_name), 0))) __PYX_ERR(0, 174, __pyx_L1_error) + if (!(likely(PyBytes_CheckExact(__pyx_v_layout))||((__pyx_v_layout) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_v_layout))) __PYX_ERR(0, 174, __pyx_L1_error) __pyx_t_4 = __pyx_v_layout; __Pyx_INCREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); @@ -4007,11 +6146,10 @@ static int __pyx_f_5arrex_6dtypes_15DDTypeFunctions__func_pack(struct __pyx_obj_ PyObject *__pyx_t_3 = NULL; int __pyx_t_4; int __pyx_t_5; - Py_ssize_t __pyx_t_6; - PyObject *__pyx_t_7 = NULL; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; - PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_9 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -4026,6 +6164,7 @@ static int __pyx_f_5arrex_6dtypes_15DDTypeFunctions__func_pack(struct __pyx_obj_ */ __Pyx_INCREF(__pyx_v_self->pack); __pyx_t_2 = __pyx_v_self->pack; __pyx_t_3 = NULL; + __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { @@ -4033,13 +6172,17 @@ static int __pyx_f_5arrex_6dtypes_15DDTypeFunctions__func_pack(struct __pyx_obj_ __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_4 = 1; } } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_obj) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_obj); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_obj}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } __pyx_v_packed = __pyx_t_1; __pyx_t_1 = 0; @@ -4050,9 +6193,9 @@ static int __pyx_f_5arrex_6dtypes_15DDTypeFunctions__func_pack(struct __pyx_obj_ * raise TypeError('pack must provide a bytes object') * if len(packed) < self.dsize: */ - __pyx_t_4 = PyBytes_Check(__pyx_v_packed); - __pyx_t_5 = ((!(__pyx_t_4 != 0)) != 0); - if (unlikely(__pyx_t_5)) { + __pyx_t_5 = PyBytes_Check(__pyx_v_packed); + __pyx_t_6 = (!__pyx_t_5); + if (unlikely(__pyx_t_6)) { /* "arrex/dtypes.pyx":181 * packed = self.pack(obj) @@ -4083,9 +6226,9 @@ static int __pyx_f_5arrex_6dtypes_15DDTypeFunctions__func_pack(struct __pyx_obj_ * raise ValueError('the dumped bytes length {} does not match dsize {}'.format(len(packed), self.dtype.dsize)) * */ - __pyx_t_6 = PyObject_Length(__pyx_v_packed); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 182, __pyx_L1_error) - __pyx_t_5 = ((__pyx_t_6 < ((Py_ssize_t)__pyx_v_self->__pyx_base.dsize)) != 0); - if (unlikely(__pyx_t_5)) { + __pyx_t_7 = PyObject_Length(__pyx_v_packed); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 182, __pyx_L1_error) + __pyx_t_6 = (__pyx_t_7 < ((Py_ssize_t)__pyx_v_self->__pyx_base.dsize)); + if (unlikely(__pyx_t_6)) { /* "arrex/dtypes.pyx":183 * raise TypeError('pack must provide a bytes object') @@ -4096,63 +6239,36 @@ static int __pyx_f_5arrex_6dtypes_15DDTypeFunctions__func_pack(struct __pyx_obj_ */ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_the_dumped_bytes_length_does_not, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = PyObject_Length(__pyx_v_packed); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 183, __pyx_L1_error) - __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 183, __pyx_L1_error) + __pyx_t_7 = PyObject_Length(__pyx_v_packed); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 183, __pyx_L1_error) + __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_dtype_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 183, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_dsize); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 183, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_dtype_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = NULL; - __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_dsize); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = NULL; + __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_7)) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_9 = 1; + __pyx_t_4 = 1; } } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_3, __pyx_t_8}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 183, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_3, __pyx_t_8}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 183, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif { - __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 183, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (__pyx_t_7) { - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7); __pyx_t_7 = NULL; - } - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_8); - __pyx_t_3 = 0; - __pyx_t_8 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 183, __pyx_L1_error) + PyObject *__pyx_callargs[3] = {__pyx_t_8, __pyx_t_3, __pyx_t_9}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -4193,9 +6309,8 @@ static int __pyx_f_5arrex_6dtypes_15DDTypeFunctions__func_pack(struct __pyx_obj_ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("arrex.dtypes.DDTypeFunctions._func_pack", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; @@ -4219,6 +6334,7 @@ static PyObject *__pyx_f_5arrex_6dtypes_15DDTypeFunctions__func_unpack(struct __ PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -4236,6 +6352,7 @@ static PyObject *__pyx_f_5arrex_6dtypes_15DDTypeFunctions__func_unpack(struct __ __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_self->unpack); __pyx_t_3 = __pyx_v_self->unpack; __pyx_t_4 = NULL; + __pyx_t_5 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { @@ -4243,14 +6360,18 @@ static PyObject *__pyx_f_5arrex_6dtypes_15DDTypeFunctions__func_unpack(struct __ __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; } } - __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 188, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 188, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; @@ -4286,13 +6407,71 @@ static PyObject *__pyx_f_5arrex_6dtypes_15DDTypeFunctions__func_unpack(struct __ */ /* Python wrapper */ -static PyObject *__pyx_pw_5arrex_6dtypes_15DDTypeFunctions_3__reduce_ex__(PyObject *__pyx_v_self, PyObject *__pyx_v_protocol); /*proto*/ -static char __pyx_doc_5arrex_6dtypes_15DDTypeFunctions_2__reduce_ex__[] = " allow serialization of the dtype with the array (particularly useful for anonymous dtypes) "; -static PyObject *__pyx_pw_5arrex_6dtypes_15DDTypeFunctions_3__reduce_ex__(PyObject *__pyx_v_self, PyObject *__pyx_v_protocol) { +static PyObject *__pyx_pw_5arrex_6dtypes_15DDTypeFunctions_3__reduce_ex__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5arrex_6dtypes_15DDTypeFunctions_2__reduce_ex__, " allow serialization of the dtype with the array (particularly useful for anonymous dtypes) "); +static PyMethodDef __pyx_mdef_5arrex_6dtypes_15DDTypeFunctions_3__reduce_ex__ = {"__reduce_ex__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_6dtypes_15DDTypeFunctions_3__reduce_ex__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_6dtypes_15DDTypeFunctions_2__reduce_ex__}; +static PyObject *__pyx_pw_5arrex_6dtypes_15DDTypeFunctions_3__reduce_ex__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v_protocol = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_ex__ (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_6dtypes_15DDTypeFunctions_2__reduce_ex__(((struct __pyx_obj_5arrex_6dtypes_DDTypeFunctions *)__pyx_v_self), ((PyObject *)__pyx_v_protocol)); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_protocol,0}; + PyObject* values[1] = {0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_protocol)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 191, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__reduce_ex__") < 0)) __PYX_ERR(0, 191, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_protocol = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__reduce_ex__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 191, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("arrex.dtypes.DDTypeFunctions.__reduce_ex__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5arrex_6dtypes_15DDTypeFunctions_2__reduce_ex__(((struct __pyx_obj_5arrex_6dtypes_DDTypeFunctions *)__pyx_v_self), __pyx_v_protocol); /* function exit code */ __Pyx_RefNannyFinishContext(); @@ -4383,6 +6562,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_15DDTypeFunctions_2__reduce_ex__(struct /* Python wrapper */ static PyObject *__pyx_pw_5arrex_6dtypes_15DDTypeFunctions_4pack_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_5arrex_6dtypes_15DDTypeFunctions_4pack_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); @@ -4412,6 +6592,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_15DDTypeFunctions_4pack___get__(struct /* Python wrapper */ static int __pyx_pw_5arrex_6dtypes_15DDTypeFunctions_4pack_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ static int __pyx_pw_5arrex_6dtypes_15DDTypeFunctions_4pack_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); @@ -4441,6 +6622,7 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeFunctions_4pack_2__set__(struct __pyx /* Python wrapper */ static int __pyx_pw_5arrex_6dtypes_15DDTypeFunctions_4pack_5__del__(PyObject *__pyx_v_self); /*proto*/ static int __pyx_pw_5arrex_6dtypes_15DDTypeFunctions_4pack_5__del__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); @@ -4478,6 +6660,7 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeFunctions_4pack_4__del__(struct __pyx /* Python wrapper */ static PyObject *__pyx_pw_5arrex_6dtypes_15DDTypeFunctions_6unpack_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_5arrex_6dtypes_15DDTypeFunctions_6unpack_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); @@ -4507,6 +6690,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_15DDTypeFunctions_6unpack___get__(struc /* Python wrapper */ static int __pyx_pw_5arrex_6dtypes_15DDTypeFunctions_6unpack_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ static int __pyx_pw_5arrex_6dtypes_15DDTypeFunctions_6unpack_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); @@ -4536,6 +6720,7 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeFunctions_6unpack_2__set__(struct __p /* Python wrapper */ static int __pyx_pw_5arrex_6dtypes_15DDTypeFunctions_6unpack_5__del__(PyObject *__pyx_v_self); /*proto*/ static int __pyx_pw_5arrex_6dtypes_15DDTypeFunctions_6unpack_5__del__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); @@ -4574,6 +6759,8 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeFunctions_6unpack_4__del__(struct __p static int __pyx_pw_5arrex_6dtypes_11DDTypeCType_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_5arrex_6dtypes_11DDTypeCType_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_type = 0; + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -4581,36 +6768,37 @@ static int __pyx_pw_5arrex_6dtypes_11DDTypeCType_1__init__(PyObject *__pyx_v_sel __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_type,0}; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_type,0}; PyObject* values[1] = {0}; - if (unlikely(__pyx_kwds)) { + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_type)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_type)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 214, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 214, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 214, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); } __pyx_v_type = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 214, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 214, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("arrex.dtypes.DDTypeCType.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -4631,7 +6819,8 @@ static int __pyx_pf_5arrex_6dtypes_11DDTypeCType___init__(struct __pyx_obj_5arre int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - size_t __pyx_t_6; + int __pyx_t_6; + size_t __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -4646,9 +6835,9 @@ static int __pyx_pf_5arrex_6dtypes_11DDTypeCType___init__(struct __pyx_obj_5arre */ __pyx_t_1 = __pyx_f_5arrex_6dtypes_isctype(__pyx_v_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 215, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 215, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 215, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = ((!__pyx_t_2) != 0); + __pyx_t_3 = (!__pyx_t_2); if (unlikely(__pyx_t_3)) { /* "arrex/dtypes.pyx":216 @@ -4699,6 +6888,7 @@ static int __pyx_pf_5arrex_6dtypes_11DDTypeCType___init__(struct __pyx_obj_5arre __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; + __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_4)) { @@ -4706,16 +6896,20 @@ static int __pyx_pf_5arrex_6dtypes_11DDTypeCType___init__(struct __pyx_obj_5arre __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_6 = 1; } } - __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_v_type) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_type); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 218, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyInt_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_6 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 218, __pyx_L1_error) + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_type}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 218, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_t_7 = __Pyx_PyInt_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_7 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 218, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_self->__pyx_base.dsize = __pyx_t_6; + __pyx_v_self->__pyx_base.dsize = __pyx_t_7; /* "arrex/dtypes.pyx":219 * self.type = type @@ -4786,7 +6980,8 @@ static int __pyx_f_5arrex_6dtypes_11DDTypeCType__ctype_pack(struct __pyx_obj_5ar int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - size_t __pyx_t_6; + int __pyx_t_6; + size_t __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -4803,7 +6998,7 @@ static int __pyx_f_5arrex_6dtypes_11DDTypeCType__ctype_pack(struct __pyx_obj_5ar __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = PyObject_IsInstance(__pyx_v_obj, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0); + __pyx_t_3 = (!__pyx_t_2); if (unlikely(__pyx_t_3)) { /* "arrex/dtypes.pyx":225 @@ -4841,6 +7036,7 @@ static int __pyx_f_5arrex_6dtypes_11DDTypeCType__ctype_pack(struct __pyx_obj_5ar __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; + __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_4)) { @@ -4848,16 +7044,20 @@ static int __pyx_f_5arrex_6dtypes_11DDTypeCType__ctype_pack(struct __pyx_obj_5ar __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_6 = 1; } } - __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_v_obj) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_obj); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyInt_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_6 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 226, __pyx_L1_error) + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_obj}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_t_7 = __Pyx_PyInt_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_7 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 226, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - (void)(memcpy(__pyx_v_place, ((void *)((size_t)__pyx_t_6)), __pyx_v_self->__pyx_base.dsize)); + (void)(memcpy(__pyx_v_place, ((void *)((size_t)__pyx_t_7)), __pyx_v_self->__pyx_base.dsize)); /* "arrex/dtypes.pyx":223 * self.layout = None @@ -4896,6 +7096,7 @@ static PyObject *__pyx_f_5arrex_6dtypes_11DDTypeCType__ctype_unpack(struct __pyx PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -4914,6 +7115,7 @@ static PyObject *__pyx_f_5arrex_6dtypes_11DDTypeCType__ctype_unpack(struct __pyx __pyx_t_3 = PyByteArray_FromStringAndSize(((char *)__pyx_v_place), __pyx_v_self->__pyx_base.dsize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; + __pyx_t_5 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { @@ -4921,14 +7123,18 @@ static PyObject *__pyx_f_5arrex_6dtypes_11DDTypeCType__ctype_unpack(struct __pyx __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_5 = 1; } } - __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; @@ -4966,6 +7172,7 @@ static PyObject *__pyx_f_5arrex_6dtypes_11DDTypeCType__ctype_unpack(struct __pyx /* Python wrapper */ static PyObject *__pyx_pw_5arrex_6dtypes_11DDTypeCType_4type_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_5arrex_6dtypes_11DDTypeCType_4type_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); @@ -4995,6 +7202,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_11DDTypeCType_4type___get__(struct __py /* Python wrapper */ static int __pyx_pw_5arrex_6dtypes_11DDTypeCType_4type_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ static int __pyx_pw_5arrex_6dtypes_11DDTypeCType_4type_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); @@ -5024,6 +7232,7 @@ static int __pyx_pf_5arrex_6dtypes_11DDTypeCType_4type_2__set__(struct __pyx_obj /* Python wrapper */ static int __pyx_pw_5arrex_6dtypes_11DDTypeCType_4type_5__del__(PyObject *__pyx_v_self); /*proto*/ static int __pyx_pw_5arrex_6dtypes_11DDTypeCType_4type_5__del__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); @@ -5064,6 +7273,8 @@ static int __pyx_pw_5arrex_6dtypes_15DDTypeExtension_1__init__(PyObject *__pyx_v PyTypeObject *__pyx_v_ext = 0; PyObject *__pyx_v_layout = 0; PyObject *__pyx_v_constructor = 0; + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -5071,51 +7282,54 @@ static int __pyx_pw_5arrex_6dtypes_15DDTypeExtension_1__init__(PyObject *__pyx_v __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ext,&__pyx_n_s_layout,&__pyx_n_s_constructor,0}; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ext,&__pyx_n_s_layout,&__pyx_n_s_constructor,0}; PyObject* values[3] = {0,0,0}; values[1] = ((PyObject *)Py_None); values[2] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ext)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ext)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 256, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_layout); + PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_layout); if (value) { values[1] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 256, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constructor); + PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_constructor); if (value) { values[2] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 256, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 256, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 256, __pyx_L3_error) } } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } @@ -5126,7 +7340,7 @@ static int __pyx_pw_5arrex_6dtypes_15DDTypeExtension_1__init__(PyObject *__pyx_v } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 256, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 256, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("arrex.dtypes.DDTypeExtension.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -5154,8 +7368,9 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeExtension___init__(struct __pyx_obj_5 PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; - size_t __pyx_t_7; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + size_t __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -5170,7 +7385,7 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeExtension___init__(struct __pyx_obj_5 * */ __pyx_t_1 = PyType_Check(((PyObject *)__pyx_v_ext)); - __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); + __pyx_t_2 = (!__pyx_t_1); if (unlikely(__pyx_t_2)) { /* "arrex/dtypes.pyx":260 @@ -5212,8 +7427,7 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeExtension___init__(struct __pyx_obj_5 * layout = layout.encode() */ __pyx_t_2 = (__pyx_v_layout != Py_None); - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { + if (__pyx_t_2) { /* "arrex/dtypes.pyx":264 * packsize = ( ext).tp_basicsize - sizeof(_head) @@ -5222,8 +7436,7 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeExtension___init__(struct __pyx_obj_5 * layout = layout.encode() * elif not isinstance(layout, bytes): */ - __pyx_t_1 = PyUnicode_Check(__pyx_v_layout); - __pyx_t_2 = (__pyx_t_1 != 0); + __pyx_t_2 = PyUnicode_Check(__pyx_v_layout); if (__pyx_t_2) { /* "arrex/dtypes.pyx":265 @@ -5236,6 +7449,7 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeExtension___init__(struct __pyx_obj_5 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_layout, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 265, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; + __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { @@ -5243,13 +7457,17 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeExtension___init__(struct __pyx_obj_5 __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_6 = 1; } } - __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 265, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[1] = {__pyx_t_5, }; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 265, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } __Pyx_DECREF_SET(__pyx_v_layout, __pyx_t_3); __pyx_t_3 = 0; @@ -5271,7 +7489,7 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeExtension___init__(struct __pyx_obj_5 * */ __pyx_t_2 = PyBytes_Check(__pyx_v_layout); - __pyx_t_1 = ((!(__pyx_t_2 != 0)) != 0); + __pyx_t_1 = (!__pyx_t_2); if (__pyx_t_1) { /* "arrex/dtypes.pyx":267 @@ -5309,6 +7527,7 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeExtension___init__(struct __pyx_obj_5 __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; + __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_4)) { @@ -5316,16 +7535,20 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeExtension___init__(struct __pyx_obj_5 __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_6 = 1; } } - __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_v_layout) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_layout); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 269, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = PyInt_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 269, __pyx_L1_error) + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_layout}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 269, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_t_7 = PyInt_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 269, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_fmtsize = __pyx_t_6; + __pyx_v_fmtsize = __pyx_t_7; /* "arrex/dtypes.pyx":270 * @@ -5334,7 +7557,7 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeExtension___init__(struct __pyx_obj_5 * raise ValueError('format describes a too big structure for the given dtype') * else: */ - __pyx_t_1 = ((__pyx_v_packsize < __pyx_v_fmtsize) != 0); + __pyx_t_1 = (__pyx_v_packsize < __pyx_v_fmtsize); if (unlikely(__pyx_t_1)) { /* "arrex/dtypes.pyx":271 @@ -5390,12 +7613,12 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeExtension___init__(struct __pyx_obj_5 */ if (!__pyx_v_fmtsize) { } else { - __pyx_t_7 = __pyx_v_fmtsize; + __pyx_t_8 = __pyx_v_fmtsize; goto __pyx_L7_bool_binop_done; } - __pyx_t_7 = __pyx_v_packsize; + __pyx_t_8 = __pyx_v_packsize; __pyx_L7_bool_binop_done:; - __pyx_v_self->__pyx_base.dsize = __pyx_t_7; + __pyx_v_self->__pyx_base.dsize = __pyx_t_8; /* "arrex/dtypes.pyx":276 * @@ -5404,7 +7627,7 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeExtension___init__(struct __pyx_obj_5 * raise TypeError('dsize cannot be 0') * */ - __pyx_t_1 = ((!(__pyx_v_self->__pyx_base.dsize != 0)) != 0); + __pyx_t_1 = (!(__pyx_v_self->__pyx_base.dsize != 0)); if (unlikely(__pyx_t_1)) { /* "arrex/dtypes.pyx":277 @@ -5454,7 +7677,7 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeExtension___init__(struct __pyx_obj_5 * self.type = ext * self.constructor = constructor */ - if (!(likely(PyBytes_CheckExact(__pyx_v_layout))||((__pyx_v_layout) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_layout)->tp_name), 0))) __PYX_ERR(0, 281, __pyx_L1_error) + if (!(likely(PyBytes_CheckExact(__pyx_v_layout))||((__pyx_v_layout) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_v_layout))) __PYX_ERR(0, 281, __pyx_L1_error) __pyx_t_3 = __pyx_v_layout; __Pyx_INCREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); @@ -5470,10 +7693,10 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeExtension___init__(struct __pyx_obj_5 * self.constructor = constructor * */ - __Pyx_INCREF(((PyObject *)__pyx_v_ext)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_ext)); - __Pyx_GOTREF(__pyx_v_self->type); - __Pyx_DECREF(((PyObject *)__pyx_v_self->type)); + __Pyx_INCREF((PyObject *)__pyx_v_ext); + __Pyx_GIVEREF((PyObject *)__pyx_v_ext); + __Pyx_GOTREF((PyObject *)__pyx_v_self->type); + __Pyx_DECREF((PyObject *)__pyx_v_self->type); __pyx_v_self->type = __pyx_v_ext; /* "arrex/dtypes.pyx":283 @@ -5565,10 +7788,10 @@ static int __pyx_f_5arrex_6dtypes_15DDTypeExtension__ext_pack(struct __pyx_obj_5 int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; + int __pyx_t_6; PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_8 = NULL; + void *__pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -5586,7 +7809,7 @@ static int __pyx_f_5arrex_6dtypes_15DDTypeExtension__ext_pack(struct __pyx_obj_5 __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0); + __pyx_t_3 = (!__pyx_t_2); if (__pyx_t_3) { /* "arrex/dtypes.pyx":290 @@ -5597,8 +7820,7 @@ static int __pyx_f_5arrex_6dtypes_15DDTypeExtension__ext_pack(struct __pyx_obj_5 * else: */ __pyx_t_3 = (__pyx_v_self->constructor != Py_None); - __pyx_t_2 = (__pyx_t_3 != 0); - if (likely(__pyx_t_2)) { + if (likely(__pyx_t_3)) { /* "arrex/dtypes.pyx":291 * if not isinstance(obj, self.type): @@ -5609,6 +7831,7 @@ static int __pyx_f_5arrex_6dtypes_15DDTypeExtension__ext_pack(struct __pyx_obj_5 */ __Pyx_INCREF(__pyx_v_self->constructor); __pyx_t_4 = __pyx_v_self->constructor; __pyx_t_5 = NULL; + __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { @@ -5616,13 +7839,17 @@ static int __pyx_f_5arrex_6dtypes_15DDTypeExtension__ext_pack(struct __pyx_obj_5 __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_6 = 1; } } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_obj) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_obj); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 291, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_obj}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 291, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_1); __pyx_t_1 = 0; @@ -5664,57 +7891,30 @@ static int __pyx_f_5arrex_6dtypes_15DDTypeExtension__ext_pack(struct __pyx_obj_5 * )) * memcpy(place, self._raw(obj), self.dsize) */ - __pyx_t_6 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - __pyx_t_8 = 0; + __pyx_t_7 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 295, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = NULL; + __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_7)) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_8 = 1; + __pyx_t_6 = 1; } } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_5, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_5, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif { - __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 293, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (__pyx_t_7) { - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; - } - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_6); - __pyx_t_5 = 0; - __pyx_t_6 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error) + PyObject *__pyx_callargs[3] = {__pyx_t_8, __pyx_t_5, __pyx_t_7}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "arrex/dtypes.pyx":293 * obj = self.constructor(obj) @@ -5748,7 +7948,8 @@ static int __pyx_f_5arrex_6dtypes_15DDTypeExtension__ext_pack(struct __pyx_obj_5 * * cdef object _ext_unpack(self, void* place): */ - (void)(memcpy(__pyx_v_place, ((struct __pyx_vtabstruct_5arrex_6dtypes_DDTypeExtension *)__pyx_v_self->__pyx_vtab)->_raw(__pyx_v_self, __pyx_v_obj), __pyx_v_self->__pyx_base.dsize)); + __pyx_t_9 = ((struct __pyx_vtabstruct_5arrex_6dtypes_DDTypeExtension *)__pyx_v_self->__pyx_vtab)->_raw(__pyx_v_self, __pyx_v_obj); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 297, __pyx_L1_error) + (void)(memcpy(__pyx_v_place, __pyx_t_9, __pyx_v_self->__pyx_base.dsize)); /* "arrex/dtypes.pyx":288 * return ( obj) + (self.type).tp_basicsize - self.dsize @@ -5765,9 +7966,8 @@ static int __pyx_f_5arrex_6dtypes_15DDTypeExtension__ext_pack(struct __pyx_obj_5 __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("arrex.dtypes.DDTypeExtension._ext_pack", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; @@ -5780,7 +7980,7 @@ static int __pyx_f_5arrex_6dtypes_15DDTypeExtension__ext_pack(struct __pyx_obj_5 * memcpy(place, self._raw(obj), self.dsize) * * cdef object _ext_unpack(self, void* place): # <<<<<<<<<<<<<< - * new = (self.type).tp_new(self.type, _empty, None) + * new = (self.type).tp_new(self.type, _empty, None) * memcpy(self._raw(new), place, self.dsize) */ @@ -5790,7 +7990,7 @@ static PyObject *__pyx_f_5arrex_6dtypes_15DDTypeExtension__ext_unpack(struct __p __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; + void *__pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -5799,32 +7999,30 @@ static PyObject *__pyx_f_5arrex_6dtypes_15DDTypeExtension__ext_unpack(struct __p /* "arrex/dtypes.pyx":300 * * cdef object _ext_unpack(self, void* place): - * new = (self.type).tp_new(self.type, _empty, None) # <<<<<<<<<<<<<< + * new = (self.type).tp_new(self.type, _empty, None) # <<<<<<<<<<<<<< * memcpy(self._raw(new), place, self.dsize) * return new */ __pyx_t_1 = ((PyObject *)__pyx_v_self->type); __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __pyx_v_5arrex_6dtypes__empty; - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = ((PyTypeObject *)__pyx_v_self->type)->tp_new(((PyTypeObject *)__pyx_t_1), __pyx_t_2, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = ((PyTypeObject *)__pyx_v_self->type)->tp_new(((PyTypeObject *)__pyx_t_1), ((PyObject *)__pyx_v_5arrex_6dtypes__empty), ((PyObject *)Py_None)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 300, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_new = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_new = __pyx_t_2; + __pyx_t_2 = 0; /* "arrex/dtypes.pyx":301 * cdef object _ext_unpack(self, void* place): - * new = (self.type).tp_new(self.type, _empty, None) + * new = (self.type).tp_new(self.type, _empty, None) * memcpy(self._raw(new), place, self.dsize) # <<<<<<<<<<<<<< * return new * */ - (void)(memcpy(((struct __pyx_vtabstruct_5arrex_6dtypes_DDTypeExtension *)__pyx_v_self->__pyx_vtab)->_raw(__pyx_v_self, __pyx_v_new), __pyx_v_place, __pyx_v_self->__pyx_base.dsize)); + __pyx_t_3 = ((struct __pyx_vtabstruct_5arrex_6dtypes_DDTypeExtension *)__pyx_v_self->__pyx_vtab)->_raw(__pyx_v_self, __pyx_v_new); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 301, __pyx_L1_error) + (void)(memcpy(__pyx_t_3, __pyx_v_place, __pyx_v_self->__pyx_base.dsize)); /* "arrex/dtypes.pyx":302 - * new = (self.type).tp_new(self.type, _empty, None) + * new = (self.type).tp_new(self.type, _empty, None) * memcpy(self._raw(new), place, self.dsize) * return new # <<<<<<<<<<<<<< * @@ -5839,7 +8037,7 @@ static PyObject *__pyx_f_5arrex_6dtypes_15DDTypeExtension__ext_unpack(struct __p * memcpy(place, self._raw(obj), self.dsize) * * cdef object _ext_unpack(self, void* place): # <<<<<<<<<<<<<< - * new = (self.type).tp_new(self.type, _empty, None) + * new = (self.type).tp_new(self.type, _empty, None) * memcpy(self._raw(new), place, self.dsize) */ @@ -5847,7 +8045,6 @@ static PyObject *__pyx_f_5arrex_6dtypes_15DDTypeExtension__ext_unpack(struct __p __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("arrex.dtypes.DDTypeExtension._ext_unpack", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; @@ -5866,13 +8063,71 @@ static PyObject *__pyx_f_5arrex_6dtypes_15DDTypeExtension__ext_unpack(struct __p */ /* Python wrapper */ -static PyObject *__pyx_pw_5arrex_6dtypes_15DDTypeExtension_3__reduce_ex__(PyObject *__pyx_v_self, PyObject *__pyx_v_protocol); /*proto*/ -static char __pyx_doc_5arrex_6dtypes_15DDTypeExtension_2__reduce_ex__[] = " that overload allows for automatic declaration of the dtype fron the pickled informations, as long as they are consistent with the given type size "; -static PyObject *__pyx_pw_5arrex_6dtypes_15DDTypeExtension_3__reduce_ex__(PyObject *__pyx_v_self, PyObject *__pyx_v_protocol) { +static PyObject *__pyx_pw_5arrex_6dtypes_15DDTypeExtension_3__reduce_ex__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5arrex_6dtypes_15DDTypeExtension_2__reduce_ex__, " that overload allows for automatic declaration of the dtype fron the pickled informations, as long as they are consistent with the given type size "); +static PyMethodDef __pyx_mdef_5arrex_6dtypes_15DDTypeExtension_3__reduce_ex__ = {"__reduce_ex__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_6dtypes_15DDTypeExtension_3__reduce_ex__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_6dtypes_15DDTypeExtension_2__reduce_ex__}; +static PyObject *__pyx_pw_5arrex_6dtypes_15DDTypeExtension_3__reduce_ex__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v_protocol = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_ex__ (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_6dtypes_15DDTypeExtension_2__reduce_ex__(((struct __pyx_obj_5arrex_6dtypes_DDTypeExtension *)__pyx_v_self), ((PyObject *)__pyx_v_protocol)); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_protocol,0}; + PyObject* values[1] = {0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_protocol)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 304, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__reduce_ex__") < 0)) __PYX_ERR(0, 304, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_protocol = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__reduce_ex__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 304, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("arrex.dtypes.DDTypeExtension.__reduce_ex__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5arrex_6dtypes_15DDTypeExtension_2__reduce_ex__(((struct __pyx_obj_5arrex_6dtypes_DDTypeExtension *)__pyx_v_self), __pyx_v_protocol); /* function exit code */ __Pyx_RefNannyFinishContext(); @@ -5904,8 +8159,8 @@ static PyObject *__pyx_pf_5arrex_6dtypes_15DDTypeExtension_2__reduce_ex__(struct __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 306, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_v_self->type)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self->type)); + __Pyx_INCREF((PyObject *)__pyx_v_self->type); + __Pyx_GIVEREF((PyObject *)__pyx_v_self->type); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->type)); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); @@ -5949,21 +8204,38 @@ static PyObject *__pyx_pf_5arrex_6dtypes_15DDTypeExtension_2__reduce_ex__(struct return __pyx_r; } -/* "arrex/dtypes.pyx":309 +/* "arrex/dtypes.pyx":308 + * return self._rebuild, (self.type, self.dsize, self.layout, self.constructor) * - * @classmethod - * def _rebuild(cls, type, size_t dsize, bytes layout, constructor): # <<<<<<<<<<<<<< + * @classmethod # <<<<<<<<<<<<<< + * def _rebuild(cls, type, size_t dsize, bytes layout, constructor): * candidate = _declared.get(type) or declare(type, DDTypeExtension(type, layout, constructor)) - * if dsize != candidate.dsize: */ /* Python wrapper */ -static PyObject *__pyx_pw_5arrex_6dtypes_15DDTypeExtension_5_rebuild(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_5arrex_6dtypes_15DDTypeExtension_5_rebuild(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_5arrex_6dtypes_15DDTypeExtension_5_rebuild(PyObject *__pyx_v_cls, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5arrex_6dtypes_15DDTypeExtension_5_rebuild = {"_rebuild", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_6dtypes_15DDTypeExtension_5_rebuild, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5arrex_6dtypes_15DDTypeExtension_5_rebuild(PyObject *__pyx_v_cls, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { PyObject *__pyx_v_type = 0; size_t __pyx_v_dsize; PyObject *__pyx_v_layout = 0; PyObject *__pyx_v_constructor = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -5971,57 +8243,61 @@ static PyObject *__pyx_pw_5arrex_6dtypes_15DDTypeExtension_5_rebuild(PyObject *_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_rebuild (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_type,&__pyx_n_s_dsize,&__pyx_n_s_layout,&__pyx_n_s_constructor,0}; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_type,&__pyx_n_s_dsize,&__pyx_n_s_layout,&__pyx_n_s_constructor,0}; PyObject* values[4] = {0,0,0,0}; - if (unlikely(__pyx_kwds)) { + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_type)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_type)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 308, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dsize)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dsize)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 308, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("_rebuild", 1, 4, 4, 1); __PYX_ERR(0, 309, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("_rebuild", 1, 4, 4, 1); __PYX_ERR(0, 308, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_layout)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_layout)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 308, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("_rebuild", 1, 4, 4, 2); __PYX_ERR(0, 309, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("_rebuild", 1, 4, 4, 2); __PYX_ERR(0, 308, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constructor)) != 0)) kw_args--; + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_constructor)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 308, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("_rebuild", 1, 4, 4, 3); __PYX_ERR(0, 309, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("_rebuild", 1, 4, 4, 3); __PYX_ERR(0, 308, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_rebuild") < 0)) __PYX_ERR(0, 309, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_rebuild") < 0)) __PYX_ERR(0, 308, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + } else if (unlikely(__pyx_nargs != 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); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); } __pyx_v_type = values[0]; __pyx_v_dsize = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_dsize == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 309, __pyx_L3_error) @@ -6030,7 +8306,7 @@ static PyObject *__pyx_pw_5arrex_6dtypes_15DDTypeExtension_5_rebuild(PyObject *_ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_rebuild", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 309, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("_rebuild", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 308, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("arrex.dtypes.DDTypeExtension._rebuild", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -6061,8 +8337,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_15DDTypeExtension_4_rebuild(CYTHON_UNUS PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; int __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - int __pyx_t_11; + int __pyx_t_10; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -6081,7 +8356,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_15DDTypeExtension_4_rebuild(CYTHON_UNUS } __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_5arrex_6dtypes__declared, __pyx_v_type, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 310, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 310, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 310, __pyx_L1_error) if (!__pyx_t_3) { __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { @@ -6130,7 +8405,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_15DDTypeExtension_4_rebuild(CYTHON_UNUS __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 311, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 311, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 311, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(__pyx_t_3)) { @@ -6161,48 +8436,17 @@ static PyObject *__pyx_pf_5arrex_6dtypes_15DDTypeExtension_4_rebuild(CYTHON_UNUS __pyx_t_9 = 1; } } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_1, __pyx_t_6, __pyx_t_7}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 313, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_1, __pyx_t_6, __pyx_t_7}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 313, __pyx_L1_error) + { + PyObject *__pyx_callargs[4] = {__pyx_t_8, __pyx_t_1, __pyx_t_6, __pyx_t_7}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_9, 3+__pyx_t_9); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - { - __pyx_t_10 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 313, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (__pyx_t_8) { - __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL; - } - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_t_7); - __pyx_t_1 = 0; - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 313, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 313, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "arrex/dtypes.pyx":312 * candidate = _declared.get(type) or declare(type, DDTypeExtension(type, layout, constructor)) @@ -6236,18 +8480,18 @@ static PyObject *__pyx_pf_5arrex_6dtypes_15DDTypeExtension_4_rebuild(CYTHON_UNUS */ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_candidate, __pyx_n_s_layout); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 314, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 314, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 314, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_11) { + if (__pyx_t_10) { } else { - __pyx_t_3 = __pyx_t_11; + __pyx_t_3 = __pyx_t_10; goto __pyx_L7_bool_binop_done; } __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_candidate, __pyx_n_s_layout); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 314, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_11 = (__Pyx_PyBytes_Equals(__pyx_v_layout, __pyx_t_2, Py_NE)); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 314, __pyx_L1_error) + __pyx_t_10 = (__Pyx_PyBytes_Equals(__pyx_v_layout, __pyx_t_2, Py_NE)); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 314, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __pyx_t_11; + __pyx_t_3 = __pyx_t_10; __pyx_L7_bool_binop_done:; if (unlikely(__pyx_t_3)) { @@ -6260,62 +8504,32 @@ static PyObject *__pyx_pf_5arrex_6dtypes_15DDTypeExtension_4_rebuild(CYTHON_UNUS */ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_the_pickled_dtype_has_a_differen_2, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 316, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = PyObject_Repr(__pyx_v_type); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 316, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_candidate, __pyx_n_s_layout); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 316, __pyx_L1_error) + __pyx_t_7 = PyObject_Repr(__pyx_v_type); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 316, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = NULL; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_candidate, __pyx_n_s_layout); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 316, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = NULL; __pyx_t_9 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_6)) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_9 = 1; } } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_10, __pyx_v_layout, __pyx_t_7}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 316, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_10, __pyx_v_layout, __pyx_t_7}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 316, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif { - __pyx_t_1 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 316, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__pyx_t_6) { - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6); __pyx_t_6 = NULL; - } - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_9, __pyx_t_10); - __Pyx_INCREF(__pyx_v_layout); - __Pyx_GIVEREF(__pyx_v_layout); - PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_9, __pyx_v_layout); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_1, 2+__pyx_t_9, __pyx_t_7); - __pyx_t_10 = 0; - __pyx_t_7 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 316, __pyx_L1_error) + PyObject *__pyx_callargs[4] = {__pyx_t_1, __pyx_t_7, __pyx_v_layout, __pyx_t_6}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_9, 3+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 316, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "arrex/dtypes.pyx":315 * .format(repr(type), dsize, candidate.dsize)) @@ -6352,12 +8566,12 @@ static PyObject *__pyx_pf_5arrex_6dtypes_15DDTypeExtension_4_rebuild(CYTHON_UNUS __pyx_r = __pyx_v_candidate; goto __pyx_L0; - /* "arrex/dtypes.pyx":309 + /* "arrex/dtypes.pyx":308 + * return self._rebuild, (self.type, self.dsize, self.layout, self.constructor) * - * @classmethod - * def _rebuild(cls, type, size_t dsize, bytes layout, constructor): # <<<<<<<<<<<<<< + * @classmethod # <<<<<<<<<<<<<< + * def _rebuild(cls, type, size_t dsize, bytes layout, constructor): * candidate = _declared.get(type) or declare(type, DDTypeExtension(type, layout, constructor)) - * if dsize != candidate.dsize: */ /* function exit code */ @@ -6368,7 +8582,6 @@ static PyObject *__pyx_pf_5arrex_6dtypes_15DDTypeExtension_4_rebuild(CYTHON_UNUS __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_10); __Pyx_AddTraceback("arrex.dtypes.DDTypeExtension._rebuild", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -6389,6 +8602,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_15DDTypeExtension_4_rebuild(CYTHON_UNUS /* Python wrapper */ static PyObject *__pyx_pw_5arrex_6dtypes_15DDTypeExtension_4type_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_5arrex_6dtypes_15DDTypeExtension_4type_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); @@ -6404,7 +8618,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_15DDTypeExtension_4type___get__(struct __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self->type)); + __Pyx_INCREF((PyObject *)__pyx_v_self->type); __pyx_r = ((PyObject *)__pyx_v_self->type); goto __pyx_L0; @@ -6418,6 +8632,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_15DDTypeExtension_4type___get__(struct /* Python wrapper */ static int __pyx_pw_5arrex_6dtypes_15DDTypeExtension_4type_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ static int __pyx_pw_5arrex_6dtypes_15DDTypeExtension_4type_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); @@ -6436,12 +8651,12 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeExtension_4type_2__set__(struct __pyx const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - if (!(likely(PyType_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "type", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(0, 253, __pyx_L1_error) + if (!(likely(PyType_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None) || __Pyx_RaiseUnexpectedTypeError("type", __pyx_v_value))) __PYX_ERR(0, 253, __pyx_L1_error) __pyx_t_1 = __pyx_v_value; __Pyx_INCREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->type); - __Pyx_DECREF(((PyObject *)__pyx_v_self->type)); + __Pyx_GOTREF((PyObject *)__pyx_v_self->type); + __Pyx_DECREF((PyObject *)__pyx_v_self->type); __pyx_v_self->type = ((PyTypeObject*)__pyx_t_1); __pyx_t_1 = 0; @@ -6460,6 +8675,7 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeExtension_4type_2__set__(struct __pyx /* Python wrapper */ static int __pyx_pw_5arrex_6dtypes_15DDTypeExtension_4type_5__del__(PyObject *__pyx_v_self); /*proto*/ static int __pyx_pw_5arrex_6dtypes_15DDTypeExtension_4type_5__del__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); @@ -6476,8 +8692,8 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeExtension_4type_4__del__(struct __pyx __Pyx_RefNannySetupContext("__del__", 0); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->type); - __Pyx_DECREF(((PyObject *)__pyx_v_self->type)); + __Pyx_GOTREF((PyObject *)__pyx_v_self->type); + __Pyx_DECREF((PyObject *)__pyx_v_self->type); __pyx_v_self->type = ((PyTypeObject*)Py_None); /* function exit code */ @@ -6497,6 +8713,7 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeExtension_4type_4__del__(struct __pyx /* Python wrapper */ static PyObject *__pyx_pw_5arrex_6dtypes_15DDTypeExtension_11constructor_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_5arrex_6dtypes_15DDTypeExtension_11constructor_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); @@ -6526,6 +8743,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_15DDTypeExtension_11constructor___get__ /* Python wrapper */ static int __pyx_pw_5arrex_6dtypes_15DDTypeExtension_11constructor_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ static int __pyx_pw_5arrex_6dtypes_15DDTypeExtension_11constructor_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); @@ -6555,6 +8773,7 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeExtension_11constructor_2__set__(stru /* Python wrapper */ static int __pyx_pw_5arrex_6dtypes_15DDTypeExtension_11constructor_5__del__(PyObject *__pyx_v_self); /*proto*/ static int __pyx_pw_5arrex_6dtypes_15DDTypeExtension_11constructor_5__del__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); @@ -6589,7 +8808,13 @@ static int __pyx_pf_5arrex_6dtypes_15DDTypeExtension_11constructor_4__del__(stru * */ -static PyObject *__pyx_pw_5arrex_6dtypes_5declare(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_5arrex_6dtypes_5declare(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ static struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_f_5arrex_6dtypes_declare(PyObject *__pyx_v_key, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_5arrex_6dtypes_declare *__pyx_optional_args) { struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_v_dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)Py_None); struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_r = NULL; @@ -6601,10 +8826,10 @@ static struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_f_5arrex_6dtypes_declare(Py PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; + int __pyx_t_8; PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; - int __pyx_t_11; + PyObject *__pyx_t_11 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -6623,8 +8848,8 @@ static struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_f_5arrex_6dtypes_declare(Py * if isinstance(key, str): * # create a struct dtype */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_dtype)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 330, __pyx_L1_error) - __pyx_t_2 = ((!__pyx_t_1) != 0); + __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_dtype)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 330, __pyx_L1_error) + __pyx_t_2 = (!__pyx_t_1); if (__pyx_t_2) { /* "arrex/dtypes.pyx":331 @@ -6635,8 +8860,7 @@ static struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_f_5arrex_6dtypes_declare(Py * dtype = DDTypeStruct(struct.Struct(key)) */ __pyx_t_2 = PyUnicode_Check(__pyx_v_key); - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { + if (__pyx_t_2) { /* "arrex/dtypes.pyx":333 * if isinstance(key, str): @@ -6653,6 +8877,7 @@ static struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_f_5arrex_6dtypes_declare(Py __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; + __pyx_t_8 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_6)) { @@ -6660,14 +8885,19 @@ static struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_f_5arrex_6dtypes_declare(Py __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_7, function); + __pyx_t_8 = 1; } } - __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_6, __pyx_v_key) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_key); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 333, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_key}; + __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 333, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } __pyx_t_7 = NULL; + __pyx_t_8 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_7)) { @@ -6675,14 +8905,18 @@ static struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_f_5arrex_6dtypes_declare(Py __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_8 = 1; } } - __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5arrex_6dtypes_DDType))))) __PYX_ERR(0, 333, __pyx_L1_error) __Pyx_DECREF_SET(__pyx_v_dtype, ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_3)); __pyx_t_3 = 0; @@ -6706,9 +8940,9 @@ static struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_f_5arrex_6dtypes_declare(Py */ __pyx_t_3 = __pyx_f_5arrex_6dtypes_isctype(__pyx_v_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 334, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 334, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 334, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_1) { + if (__pyx_t_2) { /* "arrex/dtypes.pyx":336 * elif isctype(key): @@ -6739,8 +8973,7 @@ static struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_f_5arrex_6dtypes_declare(Py * # create a dtype from a pure python class * try: dtype = DDTypeClass(key) */ - __pyx_t_1 = PyType_Check(__pyx_v_key); - __pyx_t_2 = (__pyx_t_1 != 0); + __pyx_t_2 = PyType_Check(__pyx_v_key); if (__pyx_t_2) { /* "arrex/dtypes.pyx":339 @@ -6753,14 +8986,15 @@ static struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_f_5arrex_6dtypes_declare(Py { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_8); + __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); __Pyx_XGOTREF(__pyx_t_9); __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); /*try:*/ { __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_DDTypeClass); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 339, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; + __pyx_t_8 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { @@ -6768,20 +9002,24 @@ static struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_f_5arrex_6dtypes_declare(Py __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_8 = 1; } } - __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_key) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_key); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 339, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_key}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 339, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5arrex_6dtypes_DDType))))) __PYX_ERR(0, 339, __pyx_L5_error) __Pyx_DECREF_SET(__pyx_v_dtype, ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_3)); __pyx_t_3 = 0; } - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; goto __pyx_L10_try_end; __pyx_L5_error:; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -6797,13 +9035,12 @@ static struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_f_5arrex_6dtypes_declare(Py * if not dtype: * raise TypeError('dtype {} is not declared, and cannot be guessed'.format(key)) */ - __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError); - if (__pyx_t_11) { + __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError); + if (__pyx_t_8) { __Pyx_ErrRestore(0,0,0); goto __pyx_L6_exception_handled; } goto __pyx_L7_except_error; - __pyx_L7_except_error:; /* "arrex/dtypes.pyx":339 * elif isinstance(key, type): @@ -6812,16 +9049,17 @@ static struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_f_5arrex_6dtypes_declare(Py * except TypeError: pass * if not dtype: */ - __Pyx_XGIVEREF(__pyx_t_8); + __pyx_L7_except_error:; __Pyx_XGIVEREF(__pyx_t_9); __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11); goto __pyx_L1_error; __pyx_L6_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_9); __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11); __pyx_L10_try_end:; } @@ -6842,8 +9080,8 @@ static struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_f_5arrex_6dtypes_declare(Py * raise TypeError('dtype {} is not declared, and cannot be guessed'.format(key)) * if not dtype.key: */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_dtype)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 341, __pyx_L1_error) - __pyx_t_1 = ((!__pyx_t_2) != 0); + __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_dtype)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 341, __pyx_L1_error) + __pyx_t_1 = (!__pyx_t_2); if (unlikely(__pyx_t_1)) { /* "arrex/dtypes.pyx":342 @@ -6856,6 +9094,7 @@ static struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_f_5arrex_6dtypes_declare(Py __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_dtype_is_not_declared_and_cannot, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 342, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; + __pyx_t_8 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { @@ -6863,13 +9102,17 @@ static struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_f_5arrex_6dtypes_declare(Py __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_8 = 1; } } - __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_key) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_key); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_key}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 342, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 342, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -6902,8 +9145,8 @@ static struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_f_5arrex_6dtypes_declare(Py * dtype.key = key * _declared[key] = dtype */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_dtype->key); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 343, __pyx_L1_error) - __pyx_t_2 = ((!__pyx_t_1) != 0); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_dtype->key); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 343, __pyx_L1_error) + __pyx_t_2 = (!__pyx_t_1); if (__pyx_t_2) { /* "arrex/dtypes.pyx":344 @@ -6939,7 +9182,7 @@ static struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_f_5arrex_6dtypes_declare(Py PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 345, __pyx_L1_error) } - if (unlikely(PyDict_SetItem(__pyx_v_5arrex_6dtypes__declared, __pyx_v_key, ((PyObject *)__pyx_v_dtype)) < 0)) __PYX_ERR(0, 345, __pyx_L1_error) + if (unlikely((PyDict_SetItem(__pyx_v_5arrex_6dtypes__declared, __pyx_v_key, ((PyObject *)__pyx_v_dtype)) < 0))) __PYX_ERR(0, 345, __pyx_L1_error) /* "arrex/dtypes.pyx":346 * dtype.key = key @@ -6948,8 +9191,8 @@ static struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_f_5arrex_6dtypes_declare(Py * * cpdef DDType declared(key): */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __Pyx_INCREF(((PyObject *)__pyx_v_dtype)); + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_dtype); __pyx_r = __pyx_v_dtype; goto __pyx_L0; @@ -6978,11 +9221,28 @@ static struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_f_5arrex_6dtypes_declare(Py } /* Python wrapper */ -static PyObject *__pyx_pw_5arrex_6dtypes_5declare(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5arrex_6dtypes_4declare[] = " declare(dtype, ddtype)\n\t\n\t\tdeclare a new dtype \n\t"; -static PyObject *__pyx_pw_5arrex_6dtypes_5declare(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_5arrex_6dtypes_5declare(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5arrex_6dtypes_4declare, " declare(dtype, ddtype)\n\t\n\t\tdeclare a new dtype \n\t"); +static PyMethodDef __pyx_mdef_5arrex_6dtypes_5declare = {"declare", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_6dtypes_5declare, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_6dtypes_4declare}; +static PyObject *__pyx_pw_5arrex_6dtypes_5declare(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { PyObject *__pyx_v_key = 0; struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_v_dtype = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -6990,40 +9250,42 @@ static PyObject *__pyx_pw_5arrex_6dtypes_5declare(PyObject *__pyx_self, PyObject __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("declare (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_dtype_2,0}; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_dtype_2,0}; PyObject* values[2] = {0,0}; values[1] = (PyObject *)((struct __pyx_obj_5arrex_6dtypes_DDType *)Py_None); - if (unlikely(__pyx_kwds)) { + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 325, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_2); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dtype_2); if (value) { values[1] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 325, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "declare") < 0)) __PYX_ERR(0, 325, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "declare") < 0)) __PYX_ERR(0, 325, __pyx_L3_error) } } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } @@ -7033,7 +9295,7 @@ static PyObject *__pyx_pw_5arrex_6dtypes_5declare(PyObject *__pyx_self, PyObject } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("declare", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 325, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("declare", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 325, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("arrex.dtypes.declare", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -7088,15 +9350,20 @@ static PyObject *__pyx_pf_5arrex_6dtypes_4declare(CYTHON_UNUSED PyObject *__pyx_ * */ -static PyObject *__pyx_pw_5arrex_6dtypes_7declared(PyObject *__pyx_self, PyObject *__pyx_v_key); /*proto*/ +static PyObject *__pyx_pw_5arrex_6dtypes_7declared(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ static struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_f_5arrex_6dtypes_declared(PyObject *__pyx_v_key, CYTHON_UNUSED int __pyx_skip_dispatch) { PyObject *__pyx_v_dtype = NULL; struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - int __pyx_t_2; + 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; @@ -7110,8 +9377,7 @@ static struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_f_5arrex_6dtypes_declared(P * else: */ __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_key, __pyx_ptype_5arrex_6dtypes_DDType); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + if (__pyx_t_1) { /* "arrex/dtypes.pyx":354 * ''' @@ -7120,7 +9386,7 @@ static struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_f_5arrex_6dtypes_declared(P * else: * # try an automated declaration */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_XDECREF((PyObject *)__pyx_r); if (!(likely(((__pyx_v_key) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_key, __pyx_ptype_5arrex_6dtypes_DDType))))) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_INCREF(__pyx_v_key); __pyx_r = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_v_key); @@ -7147,25 +9413,25 @@ static struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_f_5arrex_6dtypes_declared(P PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); __PYX_ERR(0, 357, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyDict_GetItemDefault(__pyx_v_5arrex_6dtypes__declared, __pyx_v_key, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 357, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 357, __pyx_L1_error) - if (!__pyx_t_2) { - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = __Pyx_PyDict_GetItemDefault(__pyx_v_5arrex_6dtypes__declared, __pyx_v_key, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 357, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 357, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { - __Pyx_INCREF(__pyx_t_4); - __pyx_t_3 = __pyx_t_4; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_2 = __pyx_t_3; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L4_bool_binop_done; } - __pyx_t_4 = ((PyObject *)__pyx_f_5arrex_6dtypes_declare(__pyx_v_key, 0, NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 357, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_3 = __pyx_t_4; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = ((PyObject *)__pyx_f_5arrex_6dtypes_declare(__pyx_v_key, 0, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 357, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_2 = __pyx_t_3; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_L4_bool_binop_done:; - __pyx_v_dtype = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_dtype = __pyx_t_2; + __pyx_t_2 = 0; /* "arrex/dtypes.pyx":360 * # raise an error when not declared @@ -7174,8 +9440,8 @@ static struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_f_5arrex_6dtypes_declared(P * * cdef isctype(obj): */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_v_dtype))); + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_v_dtype)); __pyx_r = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_v_dtype); goto __pyx_L0; } @@ -7190,8 +9456,8 @@ static struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_f_5arrex_6dtypes_declared(P /* function exit code */ __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("arrex.dtypes.declared", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; @@ -7202,13 +9468,71 @@ static struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_f_5arrex_6dtypes_declared(P } /* Python wrapper */ -static PyObject *__pyx_pw_5arrex_6dtypes_7declared(PyObject *__pyx_self, PyObject *__pyx_v_key); /*proto*/ -static char __pyx_doc_5arrex_6dtypes_6declared[] = " declared(key)\n\t\t\n\t\treturn the content of the declaration for the givne dtype \n\t"; -static PyObject *__pyx_pw_5arrex_6dtypes_7declared(PyObject *__pyx_self, PyObject *__pyx_v_key) { +static PyObject *__pyx_pw_5arrex_6dtypes_7declared(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5arrex_6dtypes_6declared, " declared(key)\n\t\t\n\t\treturn the content of the declaration for the givne dtype \n\t"); +static PyMethodDef __pyx_mdef_5arrex_6dtypes_7declared = {"declared", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_6dtypes_7declared, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_6dtypes_6declared}; +static PyObject *__pyx_pw_5arrex_6dtypes_7declared(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_key = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("declared (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_6dtypes_6declared(__pyx_self, ((PyObject *)__pyx_v_key)); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,0}; + PyObject* values[1] = {0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 348, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "declared") < 0)) __PYX_ERR(0, 348, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_key = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("declared", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 348, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("arrex.dtypes.declared", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5arrex_6dtypes_6declared(__pyx_self, __pyx_v_key); /* function exit code */ __Pyx_RefNannyFinishContext(); @@ -7274,7 +9598,7 @@ static PyObject *__pyx_f_5arrex_6dtypes_isctype(PyObject *__pyx_v_obj) { * except TypeError: return False */ __pyx_t_1 = PyType_Check(__pyx_v_obj); - __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); + __pyx_t_2 = (!__pyx_t_1); if (__pyx_t_2) { __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_False); @@ -7303,6 +9627,7 @@ static PyObject *__pyx_f_5arrex_6dtypes_isctype(PyObject *__pyx_v_obj) { __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = NULL; + __pyx_t_9 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_7)) { @@ -7310,13 +9635,17 @@ static PyObject *__pyx_f_5arrex_6dtypes_isctype(PyObject *__pyx_v_obj) { __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_9 = 1; } } - __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_v_obj) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_obj); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 370, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_obj}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 370, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -7339,9 +9668,9 @@ static PyObject *__pyx_f_5arrex_6dtypes_isctype(PyObject *__pyx_v_obj) { if (__pyx_t_9) { __Pyx_AddTraceback("arrex.dtypes.isctype", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_8, &__pyx_t_7) < 0) __PYX_ERR(0, 371, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_7); __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_False); __pyx_r = Py_False; @@ -7351,7 +9680,6 @@ static PyObject *__pyx_f_5arrex_6dtypes_isctype(PyObject *__pyx_v_obj) { goto __pyx_L7_except_return; } goto __pyx_L6_except_error; - __pyx_L6_except_error:; /* "arrex/dtypes.pyx":370 * # this is an ungly way but better would require changes in ctypes ... @@ -7360,6 +9688,7 @@ static PyObject *__pyx_f_5arrex_6dtypes_isctype(PyObject *__pyx_v_obj) { * except TypeError: return False * return True */ + __pyx_L6_except_error:; __Pyx_XGIVEREF(__pyx_t_3); __Pyx_XGIVEREF(__pyx_t_4); __Pyx_XGIVEREF(__pyx_t_5); @@ -7414,11 +9743,31 @@ static PyObject *__pyx_f_5arrex_6dtypes_isctype(PyObject *__pyx_v_obj) { */ /* Python wrapper */ -static PyObject *__pyx_pw_5arrex_6dtypes_5_head_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5arrex_6dtypes_5_head_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_5arrex_6dtypes_5_head_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5arrex_6dtypes_5_head_1__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_6dtypes_5_head_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5arrex_6dtypes_5_head_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; __pyx_r = __pyx_pf_5arrex_6dtypes_5_head___reduce_cython__(((struct __pyx_obj_5arrex_6dtypes__head *)__pyx_v_self)); /* function exit code */ @@ -7434,9 +9783,8 @@ static PyObject *__pyx_pf_5arrex_6dtypes_5_head___reduce_cython__(struct __pyx_o __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; - int __pyx_t_3; + 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; @@ -7459,7 +9807,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_5_head___reduce_cython__(struct __pyx_o * if _dict is not None: * state += (_dict,) */ - __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v__dict = __pyx_t_1; __pyx_t_1 = 0; @@ -7472,8 +9820,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_5_head___reduce_cython__(struct __pyx_o * use_setstate = True */ __pyx_t_2 = (__pyx_v__dict != Py_None); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { + if (__pyx_t_2) { /* "(tree fragment)":8 * _dict = getattr(self, '__dict__', None) @@ -7482,16 +9829,16 @@ static PyObject *__pyx_pf_5arrex_6dtypes_5_head___reduce_cython__(struct __pyx_o * use_setstate = True * else: */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 8, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 8, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v__dict); __Pyx_GIVEREF(__pyx_v__dict); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict); - __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); - __pyx_t_4 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_3)); + __pyx_t_3 = 0; /* "(tree fragment)":9 * if _dict is not None: @@ -7517,7 +9864,7 @@ static PyObject *__pyx_pf_5arrex_6dtypes_5_head___reduce_cython__(struct __pyx_o * else: * use_setstate = False # <<<<<<<<<<<<<< * if use_setstate: - * return __pyx_unpickle__head, (type(self), 0xd41d8cd, None), state + * return __pyx_unpickle__head, (type(self), 0xe3b0c44, None), state */ /*else*/ { __pyx_v_use_setstate = 0; @@ -7528,89 +9875,88 @@ static PyObject *__pyx_pf_5arrex_6dtypes_5_head___reduce_cython__(struct __pyx_o * else: * use_setstate = False * if use_setstate: # <<<<<<<<<<<<<< - * return __pyx_unpickle__head, (type(self), 0xd41d8cd, None), state + * return __pyx_unpickle__head, (type(self), 0xe3b0c44, None), state * else: */ - __pyx_t_3 = (__pyx_v_use_setstate != 0); - if (__pyx_t_3) { + if (__pyx_v_use_setstate) { /* "(tree fragment)":13 * use_setstate = False * if use_setstate: - * return __pyx_unpickle__head, (type(self), 0xd41d8cd, None), state # <<<<<<<<<<<<<< + * return __pyx_unpickle__head, (type(self), 0xe3b0c44, None), state # <<<<<<<<<<<<<< * else: - * return __pyx_unpickle__head, (type(self), 0xd41d8cd, state) + * return __pyx_unpickle__head, (type(self), 0xe3b0c44, state) */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle__head); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyx_unpickle__head); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_INCREF(__pyx_int_222419149); - __Pyx_GIVEREF(__pyx_int_222419149); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149); + __Pyx_INCREF(__pyx_int_238750788); + __Pyx_GIVEREF(__pyx_int_238750788); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_238750788); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); __Pyx_INCREF(__pyx_v_state); __Pyx_GIVEREF(__pyx_v_state); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state); - __pyx_t_4 = 0; + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state); + __pyx_t_3 = 0; __pyx_t_1 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; goto __pyx_L0; /* "(tree fragment)":12 * else: * use_setstate = False * if use_setstate: # <<<<<<<<<<<<<< - * return __pyx_unpickle__head, (type(self), 0xd41d8cd, None), state + * return __pyx_unpickle__head, (type(self), 0xe3b0c44, None), state * else: */ } /* "(tree fragment)":15 - * return __pyx_unpickle__head, (type(self), 0xd41d8cd, None), state + * return __pyx_unpickle__head, (type(self), 0xe3b0c44, None), state * else: - * return __pyx_unpickle__head, (type(self), 0xd41d8cd, state) # <<<<<<<<<<<<<< + * return __pyx_unpickle__head, (type(self), 0xe3b0c44, state) # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * __pyx_unpickle__head__set_state(self, __pyx_state) */ /*else*/ { __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle__head); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle__head); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_INCREF(__pyx_int_222419149); - __Pyx_GIVEREF(__pyx_int_222419149); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149); + __Pyx_INCREF(__pyx_int_238750788); + __Pyx_GIVEREF(__pyx_int_238750788); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_238750788); __Pyx_INCREF(__pyx_v_state); __Pyx_GIVEREF(__pyx_v_state); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); - __pyx_t_5 = 0; - __pyx_t_1 = 0; - __pyx_r = __pyx_t_4; + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; goto __pyx_L0; } @@ -7623,8 +9969,8 @@ static PyObject *__pyx_pf_5arrex_6dtypes_5_head___reduce_cython__(struct __pyx_o /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("arrex.dtypes._head.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -7637,18 +9983,76 @@ static PyObject *__pyx_pf_5arrex_6dtypes_5_head___reduce_cython__(struct __pyx_o /* "(tree fragment)":16 * else: - * return __pyx_unpickle__head, (type(self), 0xd41d8cd, state) + * return __pyx_unpickle__head, (type(self), 0xe3b0c44, state) * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * __pyx_unpickle__head__set_state(self, __pyx_state) */ /* Python wrapper */ -static PyObject *__pyx_pw_5arrex_6dtypes_5_head_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw_5arrex_6dtypes_5_head_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pw_5arrex_6dtypes_5_head_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5arrex_6dtypes_5_head_3__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_6dtypes_5_head_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5arrex_6dtypes_5_head_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_6dtypes_5_head_2__setstate_cython__(((struct __pyx_obj_5arrex_6dtypes__head *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + PyObject* values[1] = {0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(3, 16, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(3, 16, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v___pyx_state = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(3, 16, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("arrex.dtypes._head.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5arrex_6dtypes_5_head_2__setstate_cython__(((struct __pyx_obj_5arrex_6dtypes__head *)__pyx_v_self), __pyx_v___pyx_state); /* function exit code */ __Pyx_RefNannyFinishContext(); @@ -7665,18 +10069,18 @@ static PyObject *__pyx_pf_5arrex_6dtypes_5_head_2__setstate_cython__(struct __py __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":17 - * return __pyx_unpickle__head, (type(self), 0xd41d8cd, state) + * return __pyx_unpickle__head, (type(self), 0xe3b0c44, state) * def __setstate_cython__(self, __pyx_state): * __pyx_unpickle__head__set_state(self, __pyx_state) # <<<<<<<<<<<<<< */ - if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 17, __pyx_L1_error) - __pyx_t_1 = __pyx_f_5arrex_6dtypes___pyx_unpickle__head__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 17, __pyx_L1_error) + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(3, 17, __pyx_L1_error) + __pyx_t_1 = __pyx_f_5arrex_6dtypes___pyx_unpickle__head__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "(tree fragment)":16 * else: - * return __pyx_unpickle__head, (type(self), 0xd41d8cd, state) + * return __pyx_unpickle__head, (type(self), 0xe3b0c44, state) * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * __pyx_unpickle__head__set_state(self, __pyx_state) */ @@ -7701,12 +10105,28 @@ static PyObject *__pyx_pf_5arrex_6dtypes_5_head_2__setstate_cython__(struct __py */ /* Python wrapper */ -static PyObject *__pyx_pw_5arrex_6dtypes_9__pyx_unpickle__head(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_5arrex_6dtypes_9__pyx_unpickle__head = {"__pyx_unpickle__head", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5arrex_6dtypes_9__pyx_unpickle__head, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_5arrex_6dtypes_9__pyx_unpickle__head(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_5arrex_6dtypes_9__pyx_unpickle__head(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5arrex_6dtypes_9__pyx_unpickle__head = {"__pyx_unpickle__head", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_6dtypes_9__pyx_unpickle__head, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5arrex_6dtypes_9__pyx_unpickle__head(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { PyObject *__pyx_v___pyx_type = 0; long __pyx_v___pyx_checksum; PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -7714,56 +10134,59 @@ static PyObject *__pyx_pw_5arrex_6dtypes_9__pyx_unpickle__head(PyObject *__pyx_s __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__pyx_unpickle__head (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(3, 1, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(3, 1, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle__head", 1, 3, 3, 1); __PYX_ERR(2, 1, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle__head", 1, 3, 3, 1); __PYX_ERR(3, 1, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(3, 1, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle__head", 1, 3, 3, 2); __PYX_ERR(2, 1, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle__head", 1, 3, 3, 2); __PYX_ERR(3, 1, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle__head") < 0)) __PYX_ERR(2, 1, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle__head") < 0)) __PYX_ERR(3, 1, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + } else if (unlikely(__pyx_nargs != 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); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); } __pyx_v___pyx_type = values[0]; - __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(2, 1, __pyx_L3_error) + __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(3, 1, __pyx_L3_error) __pyx_v___pyx_state = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle__head", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 1, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle__head", 1, 3, 3, __pyx_nargs); __PYX_ERR(3, 1, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("arrex.dtypes.__pyx_unpickle__head", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -7781,12 +10204,11 @@ static PyObject *__pyx_pf_5arrex_6dtypes_8__pyx_unpickle__head(CYTHON_UNUSED PyO PyObject *__pyx_v___pyx_result = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; + int __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -7795,114 +10217,104 @@ static PyObject *__pyx_pf_5arrex_6dtypes_8__pyx_unpickle__head(CYTHON_UNUSED PyO /* "(tree fragment)":4 * cdef object __pyx_PickleError * cdef object __pyx_result - * if __pyx_checksum != 0xd41d8cd: # <<<<<<<<<<<<<< + * if __pyx_checksum not in (0xe3b0c44, 0xda39a3e, 0xd41d8cd): # <<<<<<<<<<<<<< * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum) + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())" % __pyx_checksum */ - __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xd41d8cd) != 0); - if (__pyx_t_1) { + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__16, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(3, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { /* "(tree fragment)":5 * cdef object __pyx_result - * if __pyx_checksum != 0xd41d8cd: + * if __pyx_checksum not in (0xe3b0c44, 0xda39a3e, 0xd41d8cd): * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< - * raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum) + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())" % __pyx_checksum * __pyx_result = _head.__new__(__pyx_type) */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_PickleError); __Pyx_GIVEREF(__pyx_n_s_PickleError); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError); - __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error) + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError); + __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_2); - __pyx_v___pyx_PickleError = __pyx_t_2; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_1); + __pyx_v___pyx_PickleError = __pyx_t_1; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "(tree fragment)":6 - * if __pyx_checksum != 0xd41d8cd: + * if __pyx_checksum not in (0xe3b0c44, 0xda39a3e, 0xd41d8cd): * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum) # <<<<<<<<<<<<<< + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())" % __pyx_checksum # <<<<<<<<<<<<<< * __pyx_result = _head.__new__(__pyx_type) * if __pyx_state is not None: */ - __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xd4, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_INCREF(__pyx_v___pyx_PickleError); - __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 6, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 6, __pyx_L1_error) + __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(3, 6, __pyx_L1_error) /* "(tree fragment)":4 * cdef object __pyx_PickleError * cdef object __pyx_result - * if __pyx_checksum != 0xd41d8cd: # <<<<<<<<<<<<<< + * if __pyx_checksum not in (0xe3b0c44, 0xda39a3e, 0xd41d8cd): # <<<<<<<<<<<<<< * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum) + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())" % __pyx_checksum */ } /* "(tree fragment)":7 * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum) + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())" % __pyx_checksum * __pyx_result = _head.__new__(__pyx_type) # <<<<<<<<<<<<<< * if __pyx_state is not None: * __pyx_unpickle__head__set_state(<_head> __pyx_result, __pyx_state) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5arrex_6dtypes__head), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5arrex_6dtypes__head), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; } } - __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v___pyx_result = __pyx_t_3; - __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_v___pyx_result = __pyx_t_1; + __pyx_t_1 = 0; /* "(tree fragment)":8 - * raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum) + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())" % __pyx_checksum * __pyx_result = _head.__new__(__pyx_type) * if __pyx_state is not None: # <<<<<<<<<<<<<< * __pyx_unpickle__head__set_state(<_head> __pyx_result, __pyx_state) * return __pyx_result */ - __pyx_t_1 = (__pyx_v___pyx_state != Py_None); - __pyx_t_6 = (__pyx_t_1 != 0); - if (__pyx_t_6) { + __pyx_t_2 = (__pyx_v___pyx_state != Py_None); + if (__pyx_t_2) { /* "(tree fragment)":9 * __pyx_result = _head.__new__(__pyx_type) @@ -7911,13 +10323,13 @@ static PyObject *__pyx_pf_5arrex_6dtypes_8__pyx_unpickle__head(CYTHON_UNUSED PyO * return __pyx_result * cdef __pyx_unpickle__head__set_state(_head __pyx_result, tuple __pyx_state): */ - if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 9, __pyx_L1_error) - __pyx_t_3 = __pyx_f_5arrex_6dtypes___pyx_unpickle__head__set_state(((struct __pyx_obj_5arrex_6dtypes__head *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(3, 9, __pyx_L1_error) + __pyx_t_1 = __pyx_f_5arrex_6dtypes___pyx_unpickle__head__set_state(((struct __pyx_obj_5arrex_6dtypes__head *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "(tree fragment)":8 - * raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum) + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())" % __pyx_checksum * __pyx_result = _head.__new__(__pyx_type) * if __pyx_state is not None: # <<<<<<<<<<<<<< * __pyx_unpickle__head__set_state(<_head> __pyx_result, __pyx_state) @@ -7945,10 +10357,9 @@ static PyObject *__pyx_pf_5arrex_6dtypes_8__pyx_unpickle__head(CYTHON_UNUSED PyO /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("arrex.dtypes.__pyx_unpickle__head", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -7973,11 +10384,11 @@ static PyObject *__pyx_f_5arrex_6dtypes___pyx_unpickle__head__set_state(struct _ int __pyx_t_1; Py_ssize_t __pyx_t_2; int __pyx_t_3; - int __pyx_t_4; + PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; + int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -7991,18 +10402,17 @@ static PyObject *__pyx_f_5arrex_6dtypes___pyx_unpickle__head__set_state(struct _ */ if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(2, 12, __pyx_L1_error) + __PYX_ERR(3, 12, __pyx_L1_error) } - __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(2, 12, __pyx_L1_error) - __pyx_t_3 = ((__pyx_t_2 > 0) != 0); + __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(3, 12, __pyx_L1_error) + __pyx_t_3 = (__pyx_t_2 > 0); if (__pyx_t_3) { } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L4_bool_binop_done; } - __pyx_t_3 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 12, __pyx_L1_error) - __pyx_t_4 = (__pyx_t_3 != 0); - __pyx_t_1 = __pyx_t_4; + __pyx_t_3 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(3, 12, __pyx_L1_error) + __pyx_t_1 = __pyx_t_3; __pyx_L4_bool_binop_done:; if (__pyx_t_1) { @@ -8011,34 +10421,39 @@ static PyObject *__pyx_f_5arrex_6dtypes___pyx_unpickle__head__set_state(struct _ * if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'): * __pyx_result.__dict__.update(__pyx_state[0]) # <<<<<<<<<<<<<< */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 13, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(2, 13, __pyx_L1_error) + __PYX_ERR(3, 13, __pyx_L1_error) } - __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_8); + __pyx_t_5 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_8 = 1; } } - __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "(tree fragment)":12 * return __pyx_result @@ -8060,10 +10475,10 @@ static PyObject *__pyx_f_5arrex_6dtypes___pyx_unpickle__head__set_state(struct _ __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_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("arrex.dtypes.__pyx_unpickle__head__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; @@ -8075,12 +10490,17 @@ static PyObject *__pyx_f_5arrex_6dtypes___pyx_unpickle__head__set_state(struct _ static PyObject *__pyx_tp_new_5arrex_6dtypes_DDType(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_5arrex_6dtypes_DDType *p; PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { o = (*t->tp_alloc)(t, 0); } else { o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; + #endif p = ((struct __pyx_obj_5arrex_6dtypes_DDType *)o); p->layout = ((PyObject*)Py_None); Py_INCREF(Py_None); p->key = Py_None; Py_INCREF(Py_None); @@ -8090,8 +10510,10 @@ static PyObject *__pyx_tp_new_5arrex_6dtypes_DDType(PyTypeObject *t, CYTHON_UNUS static void __pyx_tp_dealloc_5arrex_6dtypes_DDType(PyObject *o) { struct __pyx_obj_5arrex_6dtypes_DDType *p = (struct __pyx_obj_5arrex_6dtypes_DDType *)o; #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5arrex_6dtypes_DDType) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } } #endif PyObject_GC_UnTrack(o); @@ -8158,9 +10580,14 @@ static int __pyx_setprop_5arrex_6dtypes_6DDType_key(PyObject *o, PyObject *v, CY } } +static PyObject *__pyx_specialmethod___pyx_pw_5arrex_6dtypes_6DDType_1__repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) { + return __pyx_pw_5arrex_6dtypes_6DDType_1__repr__(self); +} + static PyMethodDef __pyx_methods_5arrex_6dtypes_DDType[] = { - {"__reduce_ex__", (PyCFunction)__pyx_pw_5arrex_6dtypes_6DDType_3__reduce_ex__, METH_O, __pyx_doc_5arrex_6dtypes_6DDType_2__reduce_ex__}, - {"_rebuild", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5arrex_6dtypes_6DDType_5_rebuild, METH_VARARGS|METH_KEYWORDS, 0}, + {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_pw_5arrex_6dtypes_6DDType_1__repr__, METH_NOARGS|METH_COEXIST, 0}, + {"__reduce_ex__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_6dtypes_6DDType_3__reduce_ex__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_6dtypes_6DDType_2__reduce_ex__}, + {"_rebuild", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_6dtypes_6DDType_5_rebuild, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, {0, 0, 0, 0} }; @@ -8170,10 +10597,30 @@ static struct PyGetSetDef __pyx_getsets_5arrex_6dtypes_DDType[] = { {(char *)"key", __pyx_getprop_5arrex_6dtypes_6DDType_key, __pyx_setprop_5arrex_6dtypes_6DDType_key, (char *)0, 0}, {0, 0, 0, 0, 0} }; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5arrex_6dtypes_DDType_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5arrex_6dtypes_DDType}, + {Py_tp_repr, (void *)__pyx_pw_5arrex_6dtypes_6DDType_1__repr__}, + {Py_tp_doc, (void *)PyDoc_STR(" base class for a declaration of data type (ddtype)\n\t\tDO NOT INSTANTIATE THIS CLASS FROM PYTHON, use on of its specialization instead \n\t\t\n\t\tAttributes:\n\t\t\n\t\t\tdsize (int): byte size of the dtype when packed\n\t\t\tlayout (bytes): layout of the packed data such as defined in module `struct`, or `None` if not defined\n\t\t\tkey: the python dtype itself if this DDType is declared, `None` if not declared\n\t")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5arrex_6dtypes_DDType}, + {Py_tp_clear, (void *)__pyx_tp_clear_5arrex_6dtypes_DDType}, + {Py_tp_methods, (void *)__pyx_methods_5arrex_6dtypes_DDType}, + {Py_tp_getset, (void *)__pyx_getsets_5arrex_6dtypes_DDType}, + {Py_tp_new, (void *)__pyx_tp_new_5arrex_6dtypes_DDType}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5arrex_6dtypes_DDType_spec = { + "arrex.dtypes.DDType", + sizeof(struct __pyx_obj_5arrex_6dtypes_DDType), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type_5arrex_6dtypes_DDType_slots, +}; +#else static PyTypeObject __pyx_type_5arrex_6dtypes_DDType = { PyVarObject_HEAD_INIT(0, 0) - "arrex.dtypes.DDType", /*tp_name*/ + "arrex.dtypes.""DDType", /*tp_name*/ sizeof(struct __pyx_obj_5arrex_6dtypes_DDType), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_5arrex_6dtypes_DDType, /*tp_dealloc*/ @@ -8202,7 +10649,7 @@ static PyTypeObject __pyx_type_5arrex_6dtypes_DDType = { 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - " base class for a declaration of data type (ddtype)\n\t\tDO NOT INSTANTIATE THIS CLASS FROM PYTHON, use on of its specialization instead \n\t\t\n\t\tAttributes:\n\t\t\n\t\t\tdsize (int): byte size of the dtype when packed\n\t\t\tlayout (bytes): layout of the packed data such as defined in module `struct`, or `None` if not defined\n\t\t\tkey: the python dtype itself if this DDType is declared, `None` if not declared\n\t", /*tp_doc*/ + PyDoc_STR(" base class for a declaration of data type (ddtype)\n\t\tDO NOT INSTANTIATE THIS CLASS FROM PYTHON, use on of its specialization instead \n\t\t\n\t\tAttributes:\n\t\t\n\t\t\tdsize (int): byte size of the dtype when packed\n\t\t\tlayout (bytes): layout of the packed data such as defined in module `struct`, or `None` if not defined\n\t\t\tkey: the python dtype itself if this DDType is declared, `None` if not declared\n\t"), /*tp_doc*/ __pyx_tp_traverse_5arrex_6dtypes_DDType, /*tp_traverse*/ __pyx_tp_clear_5arrex_6dtypes_DDType, /*tp_clear*/ 0, /*tp_richcompare*/ @@ -8216,7 +10663,9 @@ static PyTypeObject __pyx_type_5arrex_6dtypes_DDType = { 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS 0, /*tp_dictoffset*/ + #endif 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_5arrex_6dtypes_DDType, /*tp_new*/ @@ -8230,18 +10679,26 @@ static PyTypeObject __pyx_type_5arrex_6dtypes_DDType = { 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif #endif #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + #if __PYX_NEED_TP_PRINT_SLOT == 1 0, /*tp_print*/ #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, /*tp_pypy_flags*/ #endif }; +#endif static struct __pyx_vtabstruct_5arrex_6dtypes_DDTypeFunctions __pyx_vtable_5arrex_6dtypes_DDTypeFunctions; static PyObject *__pyx_tp_new_5arrex_6dtypes_DDTypeFunctions(PyTypeObject *t, PyObject *a, PyObject *k) { @@ -8258,8 +10715,10 @@ static PyObject *__pyx_tp_new_5arrex_6dtypes_DDTypeFunctions(PyTypeObject *t, Py static void __pyx_tp_dealloc_5arrex_6dtypes_DDTypeFunctions(PyObject *o) { struct __pyx_obj_5arrex_6dtypes_DDTypeFunctions *p = (struct __pyx_obj_5arrex_6dtypes_DDTypeFunctions *)o; #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5arrex_6dtypes_DDTypeFunctions) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } } #endif PyObject_GC_UnTrack(o); @@ -8322,7 +10781,7 @@ static int __pyx_setprop_5arrex_6dtypes_15DDTypeFunctions_unpack(PyObject *o, Py } static PyMethodDef __pyx_methods_5arrex_6dtypes_DDTypeFunctions[] = { - {"__reduce_ex__", (PyCFunction)__pyx_pw_5arrex_6dtypes_15DDTypeFunctions_3__reduce_ex__, METH_O, __pyx_doc_5arrex_6dtypes_15DDTypeFunctions_2__reduce_ex__}, + {"__reduce_ex__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_6dtypes_15DDTypeFunctions_3__reduce_ex__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_6dtypes_15DDTypeFunctions_2__reduce_ex__}, {0, 0, 0, 0} }; @@ -8331,10 +10790,30 @@ static struct PyGetSetDef __pyx_getsets_5arrex_6dtypes_DDTypeFunctions[] = { {(char *)"unpack", __pyx_getprop_5arrex_6dtypes_15DDTypeFunctions_unpack, __pyx_setprop_5arrex_6dtypes_15DDTypeFunctions_unpack, (char *)0, 0}, {0, 0, 0, 0, 0} }; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5arrex_6dtypes_DDTypeFunctions_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5arrex_6dtypes_DDTypeFunctions}, + {Py_tp_doc, (void *)PyDoc_STR(" DDTypeFunctions(dsize, pack, unpack, layout=None)\n\t\n\t\tcreate a dtype from pure python pack and unpack functions \n\t\n\t\tExample:\n\t\t\n\t\t\t>>> enum_pack = {'apple':b'a', 'orange':b'o', 'cake':b'c'}\n\t\t\t>>> enum_unpack = {v:k for k,v in enum_direct.items()}\n\t\t\t>>> enum_dtype = DDTypeFunctions(\n\t\t\t... \t\t\tdsize=1, # 1 byte storage\n\t\t\t... \t\t\tpack=enum_pack.__getitem__, # this takes the python object and gives a bytes to dump\n\t\t\t... \t\t\tunpack=enum_unpack.__getitem__, # this takes the bytes and return a python object\n\t\t\t... \t\t\t)\n\t\t\t... \n\t\t\t>>> a = typedlist(dtype=enum_dtype)\t\t# declaration is not necessary\n\t")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5arrex_6dtypes_DDTypeFunctions}, + {Py_tp_clear, (void *)__pyx_tp_clear_5arrex_6dtypes_DDTypeFunctions}, + {Py_tp_methods, (void *)__pyx_methods_5arrex_6dtypes_DDTypeFunctions}, + {Py_tp_getset, (void *)__pyx_getsets_5arrex_6dtypes_DDTypeFunctions}, + {Py_tp_init, (void *)__pyx_pw_5arrex_6dtypes_15DDTypeFunctions_1__init__}, + {Py_tp_new, (void *)__pyx_tp_new_5arrex_6dtypes_DDTypeFunctions}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5arrex_6dtypes_DDTypeFunctions_spec = { + "arrex.dtypes.DDTypeFunctions", + sizeof(struct __pyx_obj_5arrex_6dtypes_DDTypeFunctions), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type_5arrex_6dtypes_DDTypeFunctions_slots, +}; +#else static PyTypeObject __pyx_type_5arrex_6dtypes_DDTypeFunctions = { PyVarObject_HEAD_INIT(0, 0) - "arrex.dtypes.DDTypeFunctions", /*tp_name*/ + "arrex.dtypes.""DDTypeFunctions", /*tp_name*/ sizeof(struct __pyx_obj_5arrex_6dtypes_DDTypeFunctions), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_5arrex_6dtypes_DDTypeFunctions, /*tp_dealloc*/ @@ -8352,7 +10831,7 @@ static PyTypeObject __pyx_type_5arrex_6dtypes_DDTypeFunctions = { #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif - #if CYTHON_COMPILING_IN_PYPY + #if CYTHON_COMPILING_IN_PYPY || 0 __pyx_pw_5arrex_6dtypes_6DDType_1__repr__, /*tp_repr*/ #else 0, /*tp_repr*/ @@ -8367,7 +10846,7 @@ static PyTypeObject __pyx_type_5arrex_6dtypes_DDTypeFunctions = { 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - " DDTypeFunctions(dsize, pack, unpack, layout=None)\n\t\n\t\tcreate a dtype from pure python pack and unpack functions \n\t\n\t\tExample:\n\t\t\n\t\t\t>>> enum_pack = {'apple':b'a', 'orange':b'o', 'cake':b'c'}\n\t\t\t>>> enum_unpack = {v:k for k,v in enum_direct.items()}\n\t\t\t>>> enum_dtype = DDTypeFunctions(\n\t\t\t... \t\t\tdsize=1, # 1 byte storage\n\t\t\t... \t\t\tpack=enum_pack.__getitem__, # this takes the python object and gives a bytes to dump\n\t\t\t... \t\t\tunpack=enum_unpack.__getitem__, # this takes the bytes and return a python object\n\t\t\t... \t\t\t)\n\t\t\t... \n\t\t\t>>> a = typedlist(dtype=enum_dtype)\t\t# declaration is not necessary\n\t", /*tp_doc*/ + PyDoc_STR(" DDTypeFunctions(dsize, pack, unpack, layout=None)\n\t\n\t\tcreate a dtype from pure python pack and unpack functions \n\t\n\t\tExample:\n\t\t\n\t\t\t>>> enum_pack = {'apple':b'a', 'orange':b'o', 'cake':b'c'}\n\t\t\t>>> enum_unpack = {v:k for k,v in enum_direct.items()}\n\t\t\t>>> enum_dtype = DDTypeFunctions(\n\t\t\t... \t\t\tdsize=1, # 1 byte storage\n\t\t\t... \t\t\tpack=enum_pack.__getitem__, # this takes the python object and gives a bytes to dump\n\t\t\t... \t\t\tunpack=enum_unpack.__getitem__, # this takes the bytes and return a python object\n\t\t\t... \t\t\t)\n\t\t\t... \n\t\t\t>>> a = typedlist(dtype=enum_dtype)\t\t# declaration is not necessary\n\t"), /*tp_doc*/ __pyx_tp_traverse_5arrex_6dtypes_DDTypeFunctions, /*tp_traverse*/ __pyx_tp_clear_5arrex_6dtypes_DDTypeFunctions, /*tp_clear*/ 0, /*tp_richcompare*/ @@ -8381,7 +10860,9 @@ static PyTypeObject __pyx_type_5arrex_6dtypes_DDTypeFunctions = { 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS 0, /*tp_dictoffset*/ + #endif __pyx_pw_5arrex_6dtypes_15DDTypeFunctions_1__init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_5arrex_6dtypes_DDTypeFunctions, /*tp_new*/ @@ -8395,18 +10876,26 @@ static PyTypeObject __pyx_type_5arrex_6dtypes_DDTypeFunctions = { 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif #endif #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + #if __PYX_NEED_TP_PRINT_SLOT == 1 0, /*tp_print*/ #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, /*tp_pypy_flags*/ #endif }; +#endif static struct __pyx_vtabstruct_5arrex_6dtypes_DDTypeCType __pyx_vtable_5arrex_6dtypes_DDTypeCType; static PyObject *__pyx_tp_new_5arrex_6dtypes_DDTypeCType(PyTypeObject *t, PyObject *a, PyObject *k) { @@ -8422,8 +10911,10 @@ static PyObject *__pyx_tp_new_5arrex_6dtypes_DDTypeCType(PyTypeObject *t, PyObje static void __pyx_tp_dealloc_5arrex_6dtypes_DDTypeCType(PyObject *o) { struct __pyx_obj_5arrex_6dtypes_DDTypeCType *p = (struct __pyx_obj_5arrex_6dtypes_DDTypeCType *)o; #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5arrex_6dtypes_DDTypeCType) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } } #endif PyObject_GC_UnTrack(o); @@ -8473,10 +10964,30 @@ static struct PyGetSetDef __pyx_getsets_5arrex_6dtypes_DDTypeCType[] = { {(char *)"type", __pyx_getprop_5arrex_6dtypes_11DDTypeCType_type, __pyx_setprop_5arrex_6dtypes_11DDTypeCType_type, (char *)0, 0}, {0, 0, 0, 0, 0} }; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5arrex_6dtypes_DDTypeCType_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5arrex_6dtypes_DDTypeCType}, + {Py_tp_doc, (void *)PyDoc_STR(" DDTypeCType(type)\n\t\n\t\tCreate a dtype from a ctype \n\t\n\t\tExample:\n\t\t\n\t\t\t>>> class test_structure(ctypes.Structure):\n\t\t\t... \t_fields_ = [\n\t\t\t... \t\t('x', ctypes.c_int),\n\t\t\t... \t\t('y', ctypes.c_float),\n\t\t\t... \t\t]\n\t\t\t... \tdef __repr__(self):\n\t\t\t... \t\treturn '(x={}, y={})'.format(self.x, self.y)\n\t\t\t... \n\t\t\t>>> a = typedlist(dtype=test_structure)\n\t")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5arrex_6dtypes_DDTypeCType}, + {Py_tp_clear, (void *)__pyx_tp_clear_5arrex_6dtypes_DDTypeCType}, + {Py_tp_methods, (void *)__pyx_methods_5arrex_6dtypes_DDTypeCType}, + {Py_tp_getset, (void *)__pyx_getsets_5arrex_6dtypes_DDTypeCType}, + {Py_tp_init, (void *)__pyx_pw_5arrex_6dtypes_11DDTypeCType_1__init__}, + {Py_tp_new, (void *)__pyx_tp_new_5arrex_6dtypes_DDTypeCType}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5arrex_6dtypes_DDTypeCType_spec = { + "arrex.dtypes.DDTypeCType", + sizeof(struct __pyx_obj_5arrex_6dtypes_DDTypeCType), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type_5arrex_6dtypes_DDTypeCType_slots, +}; +#else static PyTypeObject __pyx_type_5arrex_6dtypes_DDTypeCType = { PyVarObject_HEAD_INIT(0, 0) - "arrex.dtypes.DDTypeCType", /*tp_name*/ + "arrex.dtypes.""DDTypeCType", /*tp_name*/ sizeof(struct __pyx_obj_5arrex_6dtypes_DDTypeCType), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_5arrex_6dtypes_DDTypeCType, /*tp_dealloc*/ @@ -8494,7 +11005,7 @@ static PyTypeObject __pyx_type_5arrex_6dtypes_DDTypeCType = { #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif - #if CYTHON_COMPILING_IN_PYPY + #if CYTHON_COMPILING_IN_PYPY || 0 __pyx_pw_5arrex_6dtypes_6DDType_1__repr__, /*tp_repr*/ #else 0, /*tp_repr*/ @@ -8509,7 +11020,7 @@ static PyTypeObject __pyx_type_5arrex_6dtypes_DDTypeCType = { 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - " DDTypeCType(type)\n\t\n\t\tCreate a dtype from a ctype \n\t\n\t\tExample:\n\t\t\n\t\t\t>>> class test_structure(ctypes.Structure):\n\t\t\t... \t_fields_ = [\n\t\t\t... \t\t('x', ctypes.c_int),\n\t\t\t... \t\t('y', ctypes.c_float),\n\t\t\t... \t\t]\n\t\t\t... \tdef __repr__(self):\n\t\t\t... \t\treturn '(x={}, y={})'.format(self.x, self.y)\n\t\t\t... \n\t\t\t>>> a = typedlist(dtype=test_structure)\n\t", /*tp_doc*/ + PyDoc_STR(" DDTypeCType(type)\n\t\n\t\tCreate a dtype from a ctype \n\t\n\t\tExample:\n\t\t\n\t\t\t>>> class test_structure(ctypes.Structure):\n\t\t\t... \t_fields_ = [\n\t\t\t... \t\t('x', ctypes.c_int),\n\t\t\t... \t\t('y', ctypes.c_float),\n\t\t\t... \t\t]\n\t\t\t... \tdef __repr__(self):\n\t\t\t... \t\treturn '(x={}, y={})'.format(self.x, self.y)\n\t\t\t... \n\t\t\t>>> a = typedlist(dtype=test_structure)\n\t"), /*tp_doc*/ __pyx_tp_traverse_5arrex_6dtypes_DDTypeCType, /*tp_traverse*/ __pyx_tp_clear_5arrex_6dtypes_DDTypeCType, /*tp_clear*/ 0, /*tp_richcompare*/ @@ -8523,7 +11034,9 @@ static PyTypeObject __pyx_type_5arrex_6dtypes_DDTypeCType = { 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS 0, /*tp_dictoffset*/ + #endif __pyx_pw_5arrex_6dtypes_11DDTypeCType_1__init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_5arrex_6dtypes_DDTypeCType, /*tp_new*/ @@ -8537,18 +11050,26 @@ static PyTypeObject __pyx_type_5arrex_6dtypes_DDTypeCType = { 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif #endif #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + #if __PYX_NEED_TP_PRINT_SLOT == 1 0, /*tp_print*/ #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, /*tp_pypy_flags*/ #endif }; +#endif static struct __pyx_vtabstruct_5arrex_6dtypes_DDTypeExtension __pyx_vtable_5arrex_6dtypes_DDTypeExtension; static PyObject *__pyx_tp_new_5arrex_6dtypes_DDTypeExtension(PyTypeObject *t, PyObject *a, PyObject *k) { @@ -8565,8 +11086,10 @@ static PyObject *__pyx_tp_new_5arrex_6dtypes_DDTypeExtension(PyTypeObject *t, Py static void __pyx_tp_dealloc_5arrex_6dtypes_DDTypeExtension(PyObject *o) { struct __pyx_obj_5arrex_6dtypes_DDTypeExtension *p = (struct __pyx_obj_5arrex_6dtypes_DDTypeExtension *)o; #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5arrex_6dtypes_DDTypeExtension) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } } #endif PyObject_GC_UnTrack(o); @@ -8629,8 +11152,8 @@ static int __pyx_setprop_5arrex_6dtypes_15DDTypeExtension_constructor(PyObject * } static PyMethodDef __pyx_methods_5arrex_6dtypes_DDTypeExtension[] = { - {"__reduce_ex__", (PyCFunction)__pyx_pw_5arrex_6dtypes_15DDTypeExtension_3__reduce_ex__, METH_O, __pyx_doc_5arrex_6dtypes_15DDTypeExtension_2__reduce_ex__}, - {"_rebuild", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5arrex_6dtypes_15DDTypeExtension_5_rebuild, METH_VARARGS|METH_KEYWORDS, 0}, + {"__reduce_ex__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_6dtypes_15DDTypeExtension_3__reduce_ex__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_6dtypes_15DDTypeExtension_2__reduce_ex__}, + {"_rebuild", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_6dtypes_15DDTypeExtension_5_rebuild, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, {0, 0, 0, 0} }; @@ -8639,10 +11162,30 @@ static struct PyGetSetDef __pyx_getsets_5arrex_6dtypes_DDTypeExtension[] = { {(char *)"constructor", __pyx_getprop_5arrex_6dtypes_15DDTypeExtension_constructor, __pyx_setprop_5arrex_6dtypes_15DDTypeExtension_constructor, (char *)0, 0}, {0, 0, 0, 0, 0} }; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5arrex_6dtypes_DDTypeExtension_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5arrex_6dtypes_DDTypeExtension}, + {Py_tp_doc, (void *)PyDoc_STR(" DDTypeTypeExtension(type, layout=None, constructor=None)\n\t\n\t\tCreate a dtype for a C extension type.\n\t\n\t\tThis is the most efficient kind of dtype in term of access/assignation time.\n\t\t\n\t\tIn order to put an extension object into an array, it satisfy the following conditions:\n\t\t\n\t\t- have fixed size known at the time of dtype creation (so any array element has the same)\n\t\t- contain only byte copiable data (so nothing particular is done when copying/destroying the objects)\n\t\t\n\t\tWARNING: \n\t\t\n\t\t\tThese conditions MUST be ensured by the user when declaring an extension type as a dtype, or it will result in memory corruption and crash of the program\n\t\t\n\t\t\n\t\tExample:\n\t\t\n\t\t\t>>> arrex.declare(vec3, DDTypeExtension(vec3, 'fff', vec3))\n\t")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5arrex_6dtypes_DDTypeExtension}, + {Py_tp_clear, (void *)__pyx_tp_clear_5arrex_6dtypes_DDTypeExtension}, + {Py_tp_methods, (void *)__pyx_methods_5arrex_6dtypes_DDTypeExtension}, + {Py_tp_getset, (void *)__pyx_getsets_5arrex_6dtypes_DDTypeExtension}, + {Py_tp_init, (void *)__pyx_pw_5arrex_6dtypes_15DDTypeExtension_1__init__}, + {Py_tp_new, (void *)__pyx_tp_new_5arrex_6dtypes_DDTypeExtension}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5arrex_6dtypes_DDTypeExtension_spec = { + "arrex.dtypes.DDTypeExtension", + sizeof(struct __pyx_obj_5arrex_6dtypes_DDTypeExtension), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type_5arrex_6dtypes_DDTypeExtension_slots, +}; +#else static PyTypeObject __pyx_type_5arrex_6dtypes_DDTypeExtension = { PyVarObject_HEAD_INIT(0, 0) - "arrex.dtypes.DDTypeExtension", /*tp_name*/ + "arrex.dtypes.""DDTypeExtension", /*tp_name*/ sizeof(struct __pyx_obj_5arrex_6dtypes_DDTypeExtension), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_5arrex_6dtypes_DDTypeExtension, /*tp_dealloc*/ @@ -8660,7 +11203,7 @@ static PyTypeObject __pyx_type_5arrex_6dtypes_DDTypeExtension = { #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif - #if CYTHON_COMPILING_IN_PYPY + #if CYTHON_COMPILING_IN_PYPY || 0 __pyx_pw_5arrex_6dtypes_6DDType_1__repr__, /*tp_repr*/ #else 0, /*tp_repr*/ @@ -8675,7 +11218,7 @@ static PyTypeObject __pyx_type_5arrex_6dtypes_DDTypeExtension = { 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - " DDTypeTypeExtension(type, layout=None, constructor=None)\n\t\n\t\tCreate a dtype for a C extension type.\n\t\n\t\tThis is the most efficient kind of dtype in term of access/assignation time.\n\t\t\n\t\tIn order to put an extension object into an array, it satisfy the following conditions:\n\t\t\n\t\t- have fixed size known at the time of dtype creation (so any array element has the same)\n\t\t- contain only byte copiable data (so nothing particular is done when copying/destroying the objects)\n\t\t\n\t\tWARNING: \n\t\t\n\t\t\tThese conditions MUST be ensured by the user when declaring an extension type as a dtype, or it will result in memory corruption and crash of the program\n\t\t\n\t\t\n\t\tExample:\n\t\t\n\t\t\t>>> arrex.declare(vec3, DDTypeExtension(vec3, 'fff', vec3))\n\t", /*tp_doc*/ + PyDoc_STR(" DDTypeTypeExtension(type, layout=None, constructor=None)\n\t\n\t\tCreate a dtype for a C extension type.\n\t\n\t\tThis is the most efficient kind of dtype in term of access/assignation time.\n\t\t\n\t\tIn order to put an extension object into an array, it satisfy the following conditions:\n\t\t\n\t\t- have fixed size known at the time of dtype creation (so any array element has the same)\n\t\t- contain only byte copiable data (so nothing particular is done when copying/destroying the objects)\n\t\t\n\t\tWARNING: \n\t\t\n\t\t\tThese conditions MUST be ensured by the user when declaring an extension type as a dtype, or it will result in memory corruption and crash of the program\n\t\t\n\t\t\n\t\tExample:\n\t\t\n\t\t\t>>> arrex.declare(vec3, DDTypeExtension(vec3, 'fff', vec3))\n\t"), /*tp_doc*/ __pyx_tp_traverse_5arrex_6dtypes_DDTypeExtension, /*tp_traverse*/ __pyx_tp_clear_5arrex_6dtypes_DDTypeExtension, /*tp_clear*/ 0, /*tp_richcompare*/ @@ -8689,7 +11232,9 @@ static PyTypeObject __pyx_type_5arrex_6dtypes_DDTypeExtension = { 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS 0, /*tp_dictoffset*/ + #endif __pyx_pw_5arrex_6dtypes_15DDTypeExtension_1__init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_5arrex_6dtypes_DDTypeExtension, /*tp_new*/ @@ -8703,48 +11248,79 @@ static PyTypeObject __pyx_type_5arrex_6dtypes_DDTypeExtension = { 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif #endif #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + #if __PYX_NEED_TP_PRINT_SLOT == 1 0, /*tp_print*/ #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, /*tp_pypy_flags*/ #endif }; +#endif static PyObject *__pyx_tp_new_5arrex_6dtypes__head(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { o = (*t->tp_alloc)(t, 0); } else { o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; + #endif return o; } static void __pyx_tp_dealloc_5arrex_6dtypes__head(PyObject *o) { #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { - if (PyObject_CallFinalizerFromDealloc(o)) return; + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5arrex_6dtypes__head) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } } #endif (*Py_TYPE(o)->tp_free)(o); } static PyMethodDef __pyx_methods_5arrex_6dtypes__head[] = { - {"__reduce_cython__", (PyCFunction)__pyx_pw_5arrex_6dtypes_5_head_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw_5arrex_6dtypes_5_head_3__setstate_cython__, METH_O, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_6dtypes_5_head_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_6dtypes_5_head_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, {0, 0, 0, 0} }; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5arrex_6dtypes__head_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5arrex_6dtypes__head}, + {Py_tp_doc, (void *)PyDoc_STR(" implementation purpose only ")}, + {Py_tp_methods, (void *)__pyx_methods_5arrex_6dtypes__head}, + {Py_tp_new, (void *)__pyx_tp_new_5arrex_6dtypes__head}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5arrex_6dtypes__head_spec = { + "arrex.dtypes._head", + sizeof(struct __pyx_obj_5arrex_6dtypes__head), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, + __pyx_type_5arrex_6dtypes__head_slots, +}; +#else static PyTypeObject __pyx_type_5arrex_6dtypes__head = { PyVarObject_HEAD_INIT(0, 0) - "arrex.dtypes._head", /*tp_name*/ + "arrex.dtypes.""_head", /*tp_name*/ sizeof(struct __pyx_obj_5arrex_6dtypes__head), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_5arrex_6dtypes__head, /*tp_dealloc*/ @@ -8773,7 +11349,7 @@ static PyTypeObject __pyx_type_5arrex_6dtypes__head = { 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ - " implementation purpose only ", /*tp_doc*/ + PyDoc_STR(" implementation purpose only "), /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ @@ -8787,7 +11363,9 @@ static PyTypeObject __pyx_type_5arrex_6dtypes__head = { 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS 0, /*tp_dictoffset*/ + #endif 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_5arrex_6dtypes__head, /*tp_new*/ @@ -8801,25 +11379,37 @@ static PyTypeObject __pyx_type_5arrex_6dtypes__head = { 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif #endif #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + #if __PYX_NEED_TP_PRINT_SLOT == 1 0, /*tp_print*/ #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, /*tp_pypy_flags*/ #endif }; +#endif static struct __pyx_obj_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct *__pyx_freelist_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct[8]; static int __pyx_freecount_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct = 0; static PyObject *__pyx_tp_new_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct)))) { + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (CYTHON_COMPILING_IN_CPYTHON && likely((int)(__pyx_freecount_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct)))) { o = (PyObject*)__pyx_freelist_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct[--__pyx_freecount_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct]; memset(o, 0, sizeof(struct __pyx_obj_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct)); (void) PyObject_INIT(o, t); @@ -8828,14 +11418,22 @@ static PyObject *__pyx_tp_new_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct(Py o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } + #endif return o; } static void __pyx_tp_dealloc_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct(PyObject *o) { struct __pyx_obj_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct *p = (struct __pyx_obj_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_definition); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct)))) { + if (CYTHON_COMPILING_IN_CPYTHON && ((int)(__pyx_freecount_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct)))) { __pyx_freelist_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct[__pyx_freecount_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct++] = ((struct __pyx_obj_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct *)o); } else { (*Py_TYPE(o)->tp_free)(o); @@ -8859,10 +11457,26 @@ static int __pyx_tp_clear_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct(PyObje Py_XDECREF(tmp); return 0; } +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct}, + {Py_tp_clear, (void *)__pyx_tp_clear_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct}, + {Py_tp_new, (void *)__pyx_tp_new_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct_spec = { + "arrex.dtypes.__pyx_scope_struct__DDTypeStruct", + sizeof(struct __pyx_obj_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, + __pyx_type_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct_slots, +}; +#else static PyTypeObject __pyx_type_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct = { PyVarObject_HEAD_INIT(0, 0) - "arrex.dtypes.__pyx_scope_struct__DDTypeStruct", /*tp_name*/ + "arrex.dtypes.""__pyx_scope_struct__DDTypeStruct", /*tp_name*/ sizeof(struct __pyx_obj_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct, /*tp_dealloc*/ @@ -8890,7 +11504,7 @@ static PyTypeObject __pyx_type_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct = 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/ 0, /*tp_doc*/ __pyx_tp_traverse_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct, /*tp_traverse*/ __pyx_tp_clear_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct, /*tp_clear*/ @@ -8905,7 +11519,9 @@ static PyTypeObject __pyx_type_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct = 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS 0, /*tp_dictoffset*/ + #endif 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct, /*tp_new*/ @@ -8918,57 +11534,31 @@ static PyTypeObject __pyx_type_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct = 0, /*tp_weaklist*/ 0, /*tp_del*/ 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif - #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, /*tp_vectorcall*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 - 0, /*tp_print*/ - #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 - 0, /*tp_pypy_flags*/ - #endif -}; - -static PyMethodDef __pyx_methods[] = { - {"declare", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5arrex_6dtypes_5declare, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5arrex_6dtypes_4declare}, - {"declared", (PyCFunction)__pyx_pw_5arrex_6dtypes_7declared, METH_O, __pyx_doc_5arrex_6dtypes_6declared}, - {0, 0, 0, 0} -}; - -#if PY_MAJOR_VERSION >= 3 -#if CYTHON_PEP489_MULTI_PHASE_INIT -static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ -static int __pyx_pymod_exec_dtypes(PyObject* module); /*proto*/ -static PyModuleDef_Slot __pyx_moduledef_slots[] = { - {Py_mod_create, (void*)__pyx_pymod_create}, - {Py_mod_exec, (void*)__pyx_pymod_exec_dtypes}, - {0, NULL} -}; -#endif - -static struct PyModuleDef __pyx_moduledef = { - PyModuleDef_HEAD_INIT, - "dtypes", - __pyx_k_The_dtype_is_the_type_of_the_el, /* m_doc */ - #if CYTHON_PEP489_MULTI_PHASE_INIT - 0, /* m_size */ + #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ #else - -1, /* m_size */ + NULL, /*tp_finalize*/ #endif - __pyx_methods /* m_methods */, - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_moduledef_slots, /* m_slots */ - #else - NULL, /* m_reload */ #endif - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif }; #endif + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; #ifndef CYTHON_SMALL_CODE #if defined(__clang__) #define CYTHON_SMALL_CODE @@ -8978,104 +11568,137 @@ static struct PyModuleDef __pyx_moduledef = { #define CYTHON_SMALL_CODE #endif #endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_n_s_DDType, __pyx_k_DDType, sizeof(__pyx_k_DDType), 0, 0, 1, 1}, - {&__pyx_n_s_DDTypeCType, __pyx_k_DDTypeCType, sizeof(__pyx_k_DDTypeCType), 0, 0, 1, 1}, - {&__pyx_n_s_DDTypeClass, __pyx_k_DDTypeClass, sizeof(__pyx_k_DDTypeClass), 0, 0, 1, 1}, - {&__pyx_kp_u_DDTypeClass_line_66, __pyx_k_DDTypeClass_line_66, sizeof(__pyx_k_DDTypeClass_line_66), 0, 1, 0, 0}, - {&__pyx_kp_u_DDTypeClass_type_Create_a_dtype, __pyx_k_DDTypeClass_type_Create_a_dtype, sizeof(__pyx_k_DDTypeClass_type_Create_a_dtype), 0, 1, 0, 0}, - {&__pyx_n_s_DDTypeExtension, __pyx_k_DDTypeExtension, sizeof(__pyx_k_DDTypeExtension), 0, 0, 1, 1}, - {&__pyx_n_s_DDTypeFunctions, __pyx_k_DDTypeFunctions, sizeof(__pyx_k_DDTypeFunctions), 0, 0, 1, 1}, - {&__pyx_n_s_DDTypeStruct, __pyx_k_DDTypeStruct, sizeof(__pyx_k_DDTypeStruct), 0, 0, 1, 1}, - {&__pyx_kp_u_DDTypeStruct_line_122, __pyx_k_DDTypeStruct_line_122, sizeof(__pyx_k_DDTypeStruct_line_122), 0, 1, 0, 0}, - {&__pyx_n_s_DDTypeStruct_locals_lambda, __pyx_k_DDTypeStruct_locals_lambda, sizeof(__pyx_k_DDTypeStruct_locals_lambda), 0, 0, 1, 1}, - {&__pyx_kp_u_DDTypeStruct_struct_create_a_dt, __pyx_k_DDTypeStruct_struct_create_a_dt, sizeof(__pyx_k_DDTypeStruct_struct_create_a_dt), 0, 1, 0, 0}, - {&__pyx_kp_s_Incompatible_checksums_s_vs_0xd4, __pyx_k_Incompatible_checksums_s_vs_0xd4, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xd4), 0, 0, 1, 0}, - {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1}, - {&__pyx_n_s_Struct, __pyx_k_Struct, sizeof(__pyx_k_Struct), 0, 0, 1, 1}, - {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, - {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, - {&__pyx_kp_b__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 0, 0}, - {&__pyx_kp_u_a_dtype_must_be_declared_in_orde, __pyx_k_a_dtype_must_be_declared_in_orde, sizeof(__pyx_k_a_dtype_must_be_declared_in_orde), 0, 1, 0, 0}, - {&__pyx_n_s_addressof, __pyx_k_addressof, sizeof(__pyx_k_addressof), 0, 0, 1, 1}, - {&__pyx_n_s_arrex_dtypes, __pyx_k_arrex_dtypes, sizeof(__pyx_k_arrex_dtypes), 0, 0, 1, 1}, - {&__pyx_kp_s_arrex_dtypes_pyx, __pyx_k_arrex_dtypes_pyx, sizeof(__pyx_k_arrex_dtypes_pyx), 0, 0, 1, 0}, - {&__pyx_n_u_bytes, __pyx_k_bytes, sizeof(__pyx_k_bytes), 0, 1, 0, 1}, - {&__pyx_n_s_calcsize, __pyx_k_calcsize, sizeof(__pyx_k_calcsize), 0, 0, 1, 1}, - {&__pyx_kp_u_cannot_implicitely_convert_into, __pyx_k_cannot_implicitely_convert_into, sizeof(__pyx_k_cannot_implicitely_convert_into), 0, 1, 0, 0}, - {&__pyx_kp_u_cannot_store_an_object_of_a_diff, __pyx_k_cannot_store_an_object_of_a_diff, sizeof(__pyx_k_cannot_store_an_object_of_a_diff), 0, 1, 0, 0}, - {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, - {&__pyx_n_s_constructor, __pyx_k_constructor, sizeof(__pyx_k_constructor), 0, 0, 1, 1}, - {&__pyx_n_s_ctypes, __pyx_k_ctypes, sizeof(__pyx_k_ctypes), 0, 0, 1, 1}, - {&__pyx_n_s_definition, __pyx_k_definition, sizeof(__pyx_k_definition), 0, 0, 1, 1}, - {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1}, - {&__pyx_n_s_dsize, __pyx_k_dsize, sizeof(__pyx_k_dsize), 0, 0, 1, 1}, - {&__pyx_kp_u_dsize_cannot_be_0, __pyx_k_dsize_cannot_be_0, sizeof(__pyx_k_dsize_cannot_be_0), 0, 1, 0, 0}, - {&__pyx_kp_u_dsize_must_be_provided_or_deduce, __pyx_k_dsize_must_be_provided_or_deduce, sizeof(__pyx_k_dsize_must_be_provided_or_deduce), 0, 1, 0, 0}, - {&__pyx_kp_u_dsize_must_match_layout_size, __pyx_k_dsize_must_match_layout_size, sizeof(__pyx_k_dsize_must_match_layout_size), 0, 1, 0, 0}, - {&__pyx_kp_u_dsize_must_not_be_null___packlay, __pyx_k_dsize_must_not_be_null___packlay, sizeof(__pyx_k_dsize_must_not_be_null___packlay), 0, 1, 0, 0}, - {&__pyx_kp_u_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 1, 0, 0}, - {&__pyx_n_s_dtype_2, __pyx_k_dtype_2, sizeof(__pyx_k_dtype_2), 0, 0, 1, 1}, - {&__pyx_kp_u_dtype_at, __pyx_k_dtype_at, sizeof(__pyx_k_dtype_at), 0, 1, 0, 0}, - {&__pyx_kp_u_dtype_is_not_declared_and_cannot, __pyx_k_dtype_is_not_declared_and_cannot, sizeof(__pyx_k_dtype_is_not_declared_and_cannot), 0, 1, 0, 0}, - {&__pyx_kp_u_dtype_must_be_a_type, __pyx_k_dtype_must_be_a_type, sizeof(__pyx_k_dtype_must_be_a_type), 0, 1, 0, 0}, - {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, - {&__pyx_n_s_ext, __pyx_k_ext, sizeof(__pyx_k_ext), 0, 0, 1, 1}, - {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, - {&__pyx_kp_u_format_describes_a_too_big_struc, __pyx_k_format_describes_a_too_big_struc, sizeof(__pyx_k_format_describes_a_too_big_struc), 0, 1, 0, 0}, - {&__pyx_n_s_from_buffer, __pyx_k_from_buffer, sizeof(__pyx_k_from_buffer), 0, 0, 1, 1}, - {&__pyx_n_u_from_buffer, __pyx_k_from_buffer, sizeof(__pyx_k_from_buffer), 0, 1, 0, 1}, - {&__pyx_n_u_from_bytes, __pyx_k_from_bytes, sizeof(__pyx_k_from_bytes), 0, 1, 0, 1}, - {&__pyx_n_u_frombytes, __pyx_k_frombytes, sizeof(__pyx_k_frombytes), 0, 1, 0, 1}, - {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1}, - {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, - {&__pyx_n_s_head, __pyx_k_head, sizeof(__pyx_k_head), 0, 0, 1, 1}, - {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_n_s_key, __pyx_k_key, sizeof(__pyx_k_key), 0, 0, 1, 1}, - {&__pyx_n_s_layout, __pyx_k_layout, sizeof(__pyx_k_layout), 0, 0, 1, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, - {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1}, - {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1}, - {&__pyx_kp_u_pack_and_unpack_must_be_callable, __pyx_k_pack_and_unpack_must_be_callable, sizeof(__pyx_k_pack_and_unpack_must_be_callable), 0, 1, 0, 0}, - {&__pyx_kp_u_pack_must_provide_a_bytes_object, __pyx_k_pack_must_provide_a_bytes_object, sizeof(__pyx_k_pack_must_provide_a_bytes_object), 0, 1, 0, 0}, - {&__pyx_n_u_packlayout, __pyx_k_packlayout, sizeof(__pyx_k_packlayout), 0, 1, 0, 1}, - {&__pyx_n_u_packsize, __pyx_k_packsize, sizeof(__pyx_k_packsize), 0, 1, 0, 1}, - {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_unpickle__head, __pyx_k_pyx_unpickle__head, sizeof(__pyx_k_pyx_unpickle__head), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, - {&__pyx_n_s_rebuild, __pyx_k_rebuild, sizeof(__pyx_k_rebuild), 0, 0, 1, 1}, - {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, - {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, - {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, - {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, - {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, - {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, - {&__pyx_n_s_sizeof, __pyx_k_sizeof, sizeof(__pyx_k_sizeof), 0, 0, 1, 1}, - {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, - {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1}, - {&__pyx_kp_u_structure_must_be_struct_Struct, __pyx_k_structure_must_be_struct_Struct, sizeof(__pyx_k_structure_must_be_struct_Struct), 0, 1, 0, 0}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_kp_u_the_dumped_bytes_length_does_not, __pyx_k_the_dumped_bytes_length_does_not, sizeof(__pyx_k_the_dumped_bytes_length_does_not), 0, 1, 0, 0}, - {&__pyx_kp_u_the_given_type_must_have_a_metho, __pyx_k_the_given_type_must_have_a_metho, sizeof(__pyx_k_the_given_type_must_have_a_metho), 0, 1, 0, 0}, - {&__pyx_kp_u_the_given_type_must_have_a_metho_2, __pyx_k_the_given_type_must_have_a_metho_2, sizeof(__pyx_k_the_given_type_must_have_a_metho_2), 0, 1, 0, 0}, - {&__pyx_kp_u_the_pickled_dtype_has_a_differen, __pyx_k_the_pickled_dtype_has_a_differen, sizeof(__pyx_k_the_pickled_dtype_has_a_differen), 0, 1, 0, 0}, - {&__pyx_kp_u_the_pickled_dtype_has_a_differen_2, __pyx_k_the_pickled_dtype_has_a_differen_2, sizeof(__pyx_k_the_pickled_dtype_has_a_differen_2), 0, 1, 0, 0}, - {&__pyx_n_u_to_bytes, __pyx_k_to_bytes, sizeof(__pyx_k_to_bytes), 0, 1, 0, 1}, - {&__pyx_n_u_tobytes, __pyx_k_tobytes, sizeof(__pyx_k_tobytes), 0, 1, 0, 1}, - {&__pyx_n_s_type, __pyx_k_type, sizeof(__pyx_k_type), 0, 0, 1, 1}, - {&__pyx_kp_u_type_must_be_a_ctype, __pyx_k_type_must_be_a_ctype, sizeof(__pyx_k_type_must_be_a_ctype), 0, 1, 0, 0}, - {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1}, - {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; +/* #### Code section: pystring_table ### */ + +static int __Pyx_CreateStringTabAndInitStrings(void) { + __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_n_s_DDType, __pyx_k_DDType, sizeof(__pyx_k_DDType), 0, 0, 1, 1}, + {&__pyx_n_s_DDTypeCType, __pyx_k_DDTypeCType, sizeof(__pyx_k_DDTypeCType), 0, 0, 1, 1}, + {&__pyx_n_s_DDTypeClass, __pyx_k_DDTypeClass, sizeof(__pyx_k_DDTypeClass), 0, 0, 1, 1}, + {&__pyx_kp_u_DDTypeClass_line_66, __pyx_k_DDTypeClass_line_66, sizeof(__pyx_k_DDTypeClass_line_66), 0, 1, 0, 0}, + {&__pyx_kp_u_DDTypeClass_type_Create_a_dtype, __pyx_k_DDTypeClass_type_Create_a_dtype, sizeof(__pyx_k_DDTypeClass_type_Create_a_dtype), 0, 1, 0, 0}, + {&__pyx_n_s_DDTypeExtension, __pyx_k_DDTypeExtension, sizeof(__pyx_k_DDTypeExtension), 0, 0, 1, 1}, + {&__pyx_n_s_DDTypeExtension___reduce_ex, __pyx_k_DDTypeExtension___reduce_ex, sizeof(__pyx_k_DDTypeExtension___reduce_ex), 0, 0, 1, 1}, + {&__pyx_n_s_DDTypeExtension__rebuild, __pyx_k_DDTypeExtension__rebuild, sizeof(__pyx_k_DDTypeExtension__rebuild), 0, 0, 1, 1}, + {&__pyx_n_s_DDTypeFunctions, __pyx_k_DDTypeFunctions, sizeof(__pyx_k_DDTypeFunctions), 0, 0, 1, 1}, + {&__pyx_n_s_DDTypeFunctions___reduce_ex, __pyx_k_DDTypeFunctions___reduce_ex, sizeof(__pyx_k_DDTypeFunctions___reduce_ex), 0, 0, 1, 1}, + {&__pyx_n_s_DDTypeStruct, __pyx_k_DDTypeStruct, sizeof(__pyx_k_DDTypeStruct), 0, 0, 1, 1}, + {&__pyx_kp_u_DDTypeStruct_line_122, __pyx_k_DDTypeStruct_line_122, sizeof(__pyx_k_DDTypeStruct_line_122), 0, 1, 0, 0}, + {&__pyx_n_s_DDTypeStruct_locals_lambda, __pyx_k_DDTypeStruct_locals_lambda, sizeof(__pyx_k_DDTypeStruct_locals_lambda), 0, 0, 1, 1}, + {&__pyx_kp_u_DDTypeStruct_struct_create_a_dt, __pyx_k_DDTypeStruct_struct_create_a_dt, sizeof(__pyx_k_DDTypeStruct_struct_create_a_dt), 0, 1, 0, 0}, + {&__pyx_n_s_DDType___reduce_ex, __pyx_k_DDType___reduce_ex, sizeof(__pyx_k_DDType___reduce_ex), 0, 0, 1, 1}, + {&__pyx_n_s_DDType__rebuild, __pyx_k_DDType__rebuild, sizeof(__pyx_k_DDType__rebuild), 0, 0, 1, 1}, + {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_k_Incompatible_checksums_0x_x_vs_0, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0), 0, 0, 1, 0}, + {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1}, + {&__pyx_n_s_Struct, __pyx_k_Struct, sizeof(__pyx_k_Struct), 0, 0, 1, 1}, + {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, + {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, + {&__pyx_kp_u__17, __pyx_k__17, sizeof(__pyx_k__17), 0, 1, 0, 0}, + {&__pyx_n_s__18, __pyx_k__18, sizeof(__pyx_k__18), 0, 0, 1, 1}, + {&__pyx_kp_b__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 0, 0}, + {&__pyx_n_s__42, __pyx_k__42, sizeof(__pyx_k__42), 0, 0, 1, 1}, + {&__pyx_kp_u_a_dtype_must_be_declared_in_orde, __pyx_k_a_dtype_must_be_declared_in_orde, sizeof(__pyx_k_a_dtype_must_be_declared_in_orde), 0, 1, 0, 0}, + {&__pyx_n_s_addressof, __pyx_k_addressof, sizeof(__pyx_k_addressof), 0, 0, 1, 1}, + {&__pyx_n_s_arrex_dtypes, __pyx_k_arrex_dtypes, sizeof(__pyx_k_arrex_dtypes), 0, 0, 1, 1}, + {&__pyx_kp_s_arrex_dtypes_pyx, __pyx_k_arrex_dtypes_pyx, sizeof(__pyx_k_arrex_dtypes_pyx), 0, 0, 1, 0}, + {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1}, + {&__pyx_n_u_bytes, __pyx_k_bytes, sizeof(__pyx_k_bytes), 0, 1, 0, 1}, + {&__pyx_n_s_calcsize, __pyx_k_calcsize, sizeof(__pyx_k_calcsize), 0, 0, 1, 1}, + {&__pyx_n_s_candidate, __pyx_k_candidate, sizeof(__pyx_k_candidate), 0, 0, 1, 1}, + {&__pyx_kp_u_cannot_implicitely_convert_into, __pyx_k_cannot_implicitely_convert_into, sizeof(__pyx_k_cannot_implicitely_convert_into), 0, 1, 0, 0}, + {&__pyx_kp_u_cannot_store_an_object_of_a_diff, __pyx_k_cannot_store_an_object_of_a_diff, sizeof(__pyx_k_cannot_store_an_object_of_a_diff), 0, 1, 0, 0}, + {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, + {&__pyx_n_s_cls, __pyx_k_cls, sizeof(__pyx_k_cls), 0, 0, 1, 1}, + {&__pyx_n_s_constructor, __pyx_k_constructor, sizeof(__pyx_k_constructor), 0, 0, 1, 1}, + {&__pyx_n_s_ctypes, __pyx_k_ctypes, sizeof(__pyx_k_ctypes), 0, 0, 1, 1}, + {&__pyx_n_s_declare, __pyx_k_declare, sizeof(__pyx_k_declare), 0, 0, 1, 1}, + {&__pyx_n_s_declared, __pyx_k_declared, sizeof(__pyx_k_declared), 0, 0, 1, 1}, + {&__pyx_n_s_definition, __pyx_k_definition, sizeof(__pyx_k_definition), 0, 0, 1, 1}, + {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1}, + {&__pyx_n_s_dict_2, __pyx_k_dict_2, sizeof(__pyx_k_dict_2), 0, 0, 1, 1}, + {&__pyx_kp_u_disable, __pyx_k_disable, sizeof(__pyx_k_disable), 0, 1, 0, 0}, + {&__pyx_n_s_dsize, __pyx_k_dsize, sizeof(__pyx_k_dsize), 0, 0, 1, 1}, + {&__pyx_kp_u_dsize_cannot_be_0, __pyx_k_dsize_cannot_be_0, sizeof(__pyx_k_dsize_cannot_be_0), 0, 1, 0, 0}, + {&__pyx_kp_u_dsize_must_be_provided_or_deduce, __pyx_k_dsize_must_be_provided_or_deduce, sizeof(__pyx_k_dsize_must_be_provided_or_deduce), 0, 1, 0, 0}, + {&__pyx_kp_u_dsize_must_match_layout_size, __pyx_k_dsize_must_match_layout_size, sizeof(__pyx_k_dsize_must_match_layout_size), 0, 1, 0, 0}, + {&__pyx_kp_u_dsize_must_not_be_null___packlay, __pyx_k_dsize_must_not_be_null___packlay, sizeof(__pyx_k_dsize_must_not_be_null___packlay), 0, 1, 0, 0}, + {&__pyx_kp_u_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 1, 0, 0}, + {&__pyx_n_s_dtype_2, __pyx_k_dtype_2, sizeof(__pyx_k_dtype_2), 0, 0, 1, 1}, + {&__pyx_kp_u_dtype_at, __pyx_k_dtype_at, sizeof(__pyx_k_dtype_at), 0, 1, 0, 0}, + {&__pyx_kp_u_dtype_is_not_declared_and_cannot, __pyx_k_dtype_is_not_declared_and_cannot, sizeof(__pyx_k_dtype_is_not_declared_and_cannot), 0, 1, 0, 0}, + {&__pyx_kp_u_dtype_must_be_a_type, __pyx_k_dtype_must_be_a_type, sizeof(__pyx_k_dtype_must_be_a_type), 0, 1, 0, 0}, + {&__pyx_kp_u_enable, __pyx_k_enable, sizeof(__pyx_k_enable), 0, 1, 0, 0}, + {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, + {&__pyx_n_s_ext, __pyx_k_ext, sizeof(__pyx_k_ext), 0, 0, 1, 1}, + {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, + {&__pyx_kp_u_format_describes_a_too_big_struc, __pyx_k_format_describes_a_too_big_struc, sizeof(__pyx_k_format_describes_a_too_big_struc), 0, 1, 0, 0}, + {&__pyx_n_s_from_buffer, __pyx_k_from_buffer, sizeof(__pyx_k_from_buffer), 0, 0, 1, 1}, + {&__pyx_n_u_from_buffer, __pyx_k_from_buffer, sizeof(__pyx_k_from_buffer), 0, 1, 0, 1}, + {&__pyx_n_u_from_bytes, __pyx_k_from_bytes, sizeof(__pyx_k_from_bytes), 0, 1, 0, 1}, + {&__pyx_n_u_frombytes, __pyx_k_frombytes, sizeof(__pyx_k_frombytes), 0, 1, 0, 1}, + {&__pyx_kp_u_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0, 0}, + {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1}, + {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, + {&__pyx_n_s_head, __pyx_k_head, sizeof(__pyx_k_head), 0, 0, 1, 1}, + {&__pyx_n_s_head___reduce_cython, __pyx_k_head___reduce_cython, sizeof(__pyx_k_head___reduce_cython), 0, 0, 1, 1}, + {&__pyx_n_s_head___setstate_cython, __pyx_k_head___setstate_cython, sizeof(__pyx_k_head___setstate_cython), 0, 0, 1, 1}, + {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, + {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, + {&__pyx_n_s_initializing, __pyx_k_initializing, sizeof(__pyx_k_initializing), 0, 0, 1, 1}, + {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1}, + {&__pyx_kp_u_isenabled, __pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0, 0}, + {&__pyx_n_s_key, __pyx_k_key, sizeof(__pyx_k_key), 0, 0, 1, 1}, + {&__pyx_n_s_layout, __pyx_k_layout, sizeof(__pyx_k_layout), 0, 0, 1, 1}, + {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, + {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, + {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1}, + {&__pyx_n_s_o, __pyx_k_o, sizeof(__pyx_k_o), 0, 0, 1, 1}, + {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1}, + {&__pyx_kp_u_pack_and_unpack_must_be_callable, __pyx_k_pack_and_unpack_must_be_callable, sizeof(__pyx_k_pack_and_unpack_must_be_callable), 0, 1, 0, 0}, + {&__pyx_kp_u_pack_must_provide_a_bytes_object, __pyx_k_pack_must_provide_a_bytes_object, sizeof(__pyx_k_pack_must_provide_a_bytes_object), 0, 1, 0, 0}, + {&__pyx_n_u_packlayout, __pyx_k_packlayout, sizeof(__pyx_k_packlayout), 0, 1, 0, 1}, + {&__pyx_n_u_packsize, __pyx_k_packsize, sizeof(__pyx_k_packsize), 0, 1, 0, 1}, + {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1}, + {&__pyx_n_s_protocol, __pyx_k_protocol, sizeof(__pyx_k_protocol), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_unpickle__head, __pyx_k_pyx_unpickle__head, sizeof(__pyx_k_pyx_unpickle__head), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, + {&__pyx_n_s_rebuild, __pyx_k_rebuild, sizeof(__pyx_k_rebuild), 0, 0, 1, 1}, + {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, + {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, + {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, + {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1}, + {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, + {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, + {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, + {&__pyx_n_s_sizeof, __pyx_k_sizeof, sizeof(__pyx_k_sizeof), 0, 0, 1, 1}, + {&__pyx_n_s_spec, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1}, + {&__pyx_n_s_state, __pyx_k_state, sizeof(__pyx_k_state), 0, 0, 1, 1}, + {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, + {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1}, + {&__pyx_kp_u_structure_must_be_struct_Struct, __pyx_k_structure_must_be_struct_Struct, sizeof(__pyx_k_structure_must_be_struct_Struct), 0, 1, 0, 0}, + {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_kp_u_the_dumped_bytes_length_does_not, __pyx_k_the_dumped_bytes_length_does_not, sizeof(__pyx_k_the_dumped_bytes_length_does_not), 0, 1, 0, 0}, + {&__pyx_kp_u_the_given_type_must_have_a_metho, __pyx_k_the_given_type_must_have_a_metho, sizeof(__pyx_k_the_given_type_must_have_a_metho), 0, 1, 0, 0}, + {&__pyx_kp_u_the_given_type_must_have_a_metho_2, __pyx_k_the_given_type_must_have_a_metho_2, sizeof(__pyx_k_the_given_type_must_have_a_metho_2), 0, 1, 0, 0}, + {&__pyx_kp_u_the_pickled_dtype_has_a_differen, __pyx_k_the_pickled_dtype_has_a_differen, sizeof(__pyx_k_the_pickled_dtype_has_a_differen), 0, 1, 0, 0}, + {&__pyx_kp_u_the_pickled_dtype_has_a_differen_2, __pyx_k_the_pickled_dtype_has_a_differen_2, sizeof(__pyx_k_the_pickled_dtype_has_a_differen_2), 0, 1, 0, 0}, + {&__pyx_n_u_to_bytes, __pyx_k_to_bytes, sizeof(__pyx_k_to_bytes), 0, 1, 0, 1}, + {&__pyx_n_u_tobytes, __pyx_k_tobytes, sizeof(__pyx_k_tobytes), 0, 1, 0, 1}, + {&__pyx_n_s_type, __pyx_k_type, sizeof(__pyx_k_type), 0, 0, 1, 1}, + {&__pyx_kp_u_type_must_be_a_ctype, __pyx_k_type_must_be_a_ctype, sizeof(__pyx_k_type_must_be_a_ctype), 0, 1, 0, 0}, + {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1}, + {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1}, + {&__pyx_n_s_use_setstate, __pyx_k_use_setstate, sizeof(__pyx_k_use_setstate), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} + }; + return __Pyx_InitStrings(__pyx_string_tab); +} +/* #### Code section: cached_builtins ### */ static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(0, 46, __pyx_L1_error) __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 51, __pyx_L1_error) @@ -9084,6 +11707,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { __pyx_L1_error:; return -1; } +/* #### Code section: cached_constants ### */ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations @@ -9243,6 +11867,41 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_tuple__15); __Pyx_GIVEREF(__pyx_tuple__15); + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0xe3b0c44, 0xda39a3e, 0xd41d8cd): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())" % __pyx_checksum + */ + __pyx_tuple__16 = PyTuple_Pack(3, __pyx_int_238750788, __pyx_int_228825662, __pyx_int_222419149); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(3, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__16); + __Pyx_GIVEREF(__pyx_tuple__16); + + /* "arrex/dtypes.pyx":48 + * return ''.format(id(self)) + * + * def __reduce_ex__(self, protocol): # <<<<<<<<<<<<<< + * ''' allow serialization of the dtype with the array (particularly useful for anonymous dtypes) ''' + * if self.key is None: + */ + __pyx_tuple__19 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_protocol); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__19); + __Pyx_GIVEREF(__pyx_tuple__19); + __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_arrex_dtypes_pyx, __pyx_n_s_reduce_ex, 48, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 48, __pyx_L1_error) + + /* "arrex/dtypes.pyx":54 + * return self._rebuild, (self.key, self.dsize, self.layout) + * + * @classmethod # <<<<<<<<<<<<<< + * def _rebuild(cls, key, size_t dsize, bytes layout): + * candidate = declared(key) + */ + __pyx_tuple__21 = PyTuple_Pack(5, __pyx_n_s_cls, __pyx_n_s_key, __pyx_n_s_dsize, __pyx_n_s_layout, __pyx_n_s_candidate); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__21); + __Pyx_GIVEREF(__pyx_tuple__21); + __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_arrex_dtypes_pyx, __pyx_n_s_rebuild, 54, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 54, __pyx_L1_error) + /* "arrex/dtypes.pyx":66 * * @@ -9250,10 +11909,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * ''' DDTypeClass(type) * */ - __pyx_tuple__16 = PyTuple_Pack(5, __pyx_n_s_type, __pyx_n_s_layout, __pyx_n_s_dsize, __pyx_n_s_pack, __pyx_n_s_unpack); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 66, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__16); - __Pyx_GIVEREF(__pyx_tuple__16); - __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_arrex_dtypes_pyx, __pyx_n_s_DDTypeClass, 66, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 66, __pyx_L1_error) + __pyx_tuple__23 = PyTuple_Pack(5, __pyx_n_s_type, __pyx_n_s_layout, __pyx_n_s_dsize, __pyx_n_s_pack, __pyx_n_s_unpack); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__23); + __Pyx_GIVEREF(__pyx_tuple__23); + __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_arrex_dtypes_pyx, __pyx_n_s_DDTypeClass, 66, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 66, __pyx_L1_error) /* "arrex/dtypes.pyx":122 * return DDTypeFunctions(dsize, pack, unpack, layout) @@ -9262,35 +11921,123 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * ''' DDTypeStruct(struct) * */ - __pyx_tuple__18 = PyTuple_Pack(1, __pyx_n_s_definition); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__18); - __Pyx_GIVEREF(__pyx_tuple__18); - __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_arrex_dtypes_pyx, __pyx_n_s_DDTypeStruct, 122, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 122, __pyx_L1_error) + __pyx_tuple__25 = PyTuple_Pack(1, __pyx_n_s_definition); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__25); + __Pyx_GIVEREF(__pyx_tuple__25); + __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_arrex_dtypes_pyx, __pyx_n_s_DDTypeStruct, 122, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 122, __pyx_L1_error) + + /* "arrex/dtypes.pyx":191 + * + * + * def __reduce_ex__(self, protocol): # <<<<<<<<<<<<<< + * ''' allow serialization of the dtype with the array (particularly useful for anonymous dtypes) ''' + * return type(self), (self.dsize, self.pack, self.unpack, self.layout, self.constructor) + */ + __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_arrex_dtypes_pyx, __pyx_n_s_reduce_ex, 191, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 191, __pyx_L1_error) + + /* "arrex/dtypes.pyx":304 + * return new + * + * def __reduce_ex__(self, protocol): # <<<<<<<<<<<<<< + * ''' that overload allows for automatic declaration of the dtype fron the pickled informations, as long as they are consistent with the given type size ''' + * return self._rebuild, (self.type, self.dsize, self.layout, self.constructor) + */ + __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_arrex_dtypes_pyx, __pyx_n_s_reduce_ex, 304, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 304, __pyx_L1_error) + + /* "arrex/dtypes.pyx":308 + * return self._rebuild, (self.type, self.dsize, self.layout, self.constructor) + * + * @classmethod # <<<<<<<<<<<<<< + * def _rebuild(cls, type, size_t dsize, bytes layout, constructor): + * candidate = _declared.get(type) or declare(type, DDTypeExtension(type, layout, constructor)) + */ + __pyx_tuple__29 = PyTuple_Pack(6, __pyx_n_s_cls, __pyx_n_s_type, __pyx_n_s_dsize, __pyx_n_s_layout, __pyx_n_s_constructor, __pyx_n_s_candidate); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 308, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__29); + __Pyx_GIVEREF(__pyx_tuple__29); + __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_arrex_dtypes_pyx, __pyx_n_s_rebuild, 308, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 308, __pyx_L1_error) + + /* "arrex/dtypes.pyx":325 + * cdef dict _declared = {} # {python type: dtype} + * + * cpdef DDType declare(key, DDType dtype=None): # <<<<<<<<<<<<<< + * ''' declare(dtype, ddtype) + * + */ + __pyx_tuple__31 = PyTuple_Pack(2, __pyx_n_s_key, __pyx_n_s_dtype_2); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 325, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__31); + __Pyx_GIVEREF(__pyx_tuple__31); + __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_arrex_dtypes_pyx, __pyx_n_s_declare, 325, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 325, __pyx_L1_error) + __pyx_tuple__33 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 325, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__33); + __Pyx_GIVEREF(__pyx_tuple__33); + + /* "arrex/dtypes.pyx":348 + * return dtype + * + * cpdef DDType declared(key): # <<<<<<<<<<<<<< + * ''' declared(key) + * + */ + __pyx_tuple__34 = PyTuple_Pack(1, __pyx_n_s_key); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 348, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__34); + __Pyx_GIVEREF(__pyx_tuple__34); + __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_arrex_dtypes_pyx, __pyx_n_s_declared, 348, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 348, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict + */ + __pyx_tuple__36 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_state, __pyx_n_s_dict_2, __pyx_n_s_use_setstate); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(3, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__36); + __Pyx_GIVEREF(__pyx_tuple__36); + __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(3, 1, __pyx_L1_error) + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle__head, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle__head__set_state(self, __pyx_state) + */ + __pyx_tuple__38 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pyx_state); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(3, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__38); + __Pyx_GIVEREF(__pyx_tuple__38); + __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(3, 16, __pyx_L1_error) /* "(tree fragment)":1 * def __pyx_unpickle__head(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< * cdef object __pyx_PickleError * cdef object __pyx_result */ - __pyx_tuple__20 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__20); - __Pyx_GIVEREF(__pyx_tuple__20); - __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle__head, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(2, 1, __pyx_L1_error) + __pyx_tuple__40 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(3, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__40); + __Pyx_GIVEREF(__pyx_tuple__40); + __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle__head, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(3, 1, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } +/* #### Code section: init_constants ### */ -static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { +static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { __pyx_umethod_PyDict_Type_get.type = (PyObject*)&PyDict_Type; - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + __pyx_umethod_PyDict_Type_get.method_name = &__pyx_n_s_get; + if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error); __pyx_int_222419149 = PyInt_FromLong(222419149L); if (unlikely(!__pyx_int_222419149)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_228825662 = PyInt_FromLong(228825662L); if (unlikely(!__pyx_int_228825662)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_238750788 = PyInt_FromLong(238750788L); if (unlikely(!__pyx_int_238750788)) __PYX_ERR(0, 1, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; } +/* #### Code section: init_globals ### */ + +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { + return 0; +} +/* #### Code section: init_module ### */ static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ @@ -9336,84 +12083,175 @@ static int __Pyx_modinit_function_export_code(void) { static int __Pyx_modinit_type_init_code(void) { __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); /*--- Type init code ---*/ - if (PyType_Ready(&__pyx_type_5arrex_6dtypes_DDType) < 0) __PYX_ERR(0, 29, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type_5arrex_6dtypes_DDType.tp_print = 0; + #if CYTHON_USE_TYPE_SPECS + __pyx_ptype_5arrex_6dtypes_DDType = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5arrex_6dtypes_DDType_spec, NULL); if (unlikely(!__pyx_ptype_5arrex_6dtypes_DDType)) __PYX_ERR(0, 29, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5arrex_6dtypes_DDType_spec, __pyx_ptype_5arrex_6dtypes_DDType) < 0) __PYX_ERR(0, 29, __pyx_L1_error) + #else + __pyx_ptype_5arrex_6dtypes_DDType = &__pyx_type_5arrex_6dtypes_DDType; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_ptype_5arrex_6dtypes_DDType) < 0) __PYX_ERR(0, 29, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_ptype_5arrex_6dtypes_DDType->tp_print = 0; #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5arrex_6dtypes_DDType.tp_dictoffset && __pyx_type_5arrex_6dtypes_DDType.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_5arrex_6dtypes_DDType.tp_getattro = __Pyx_PyObject_GenericGetAttr; + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5arrex_6dtypes_DDType->tp_dictoffset && __pyx_ptype_5arrex_6dtypes_DDType->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_ptype_5arrex_6dtypes_DDType->tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_DDType, (PyObject *)&__pyx_type_5arrex_6dtypes_DDType) < 0) __PYX_ERR(0, 29, __pyx_L1_error) - __pyx_ptype_5arrex_6dtypes_DDType = &__pyx_type_5arrex_6dtypes_DDType; + #endif + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_DDType, (PyObject *) __pyx_ptype_5arrex_6dtypes_DDType) < 0) __PYX_ERR(0, 29, __pyx_L1_error) __pyx_vtabptr_5arrex_6dtypes_DDTypeFunctions = &__pyx_vtable_5arrex_6dtypes_DDTypeFunctions; __pyx_vtable_5arrex_6dtypes_DDTypeFunctions._func_pack = (int (*)(struct __pyx_obj_5arrex_6dtypes_DDTypeFunctions *, void *, PyObject *))__pyx_f_5arrex_6dtypes_15DDTypeFunctions__func_pack; __pyx_vtable_5arrex_6dtypes_DDTypeFunctions._func_unpack = (PyObject *(*)(struct __pyx_obj_5arrex_6dtypes_DDTypeFunctions *, void *))__pyx_f_5arrex_6dtypes_15DDTypeFunctions__func_unpack; - __pyx_type_5arrex_6dtypes_DDTypeFunctions.tp_base = __pyx_ptype_5arrex_6dtypes_DDType; - if (PyType_Ready(&__pyx_type_5arrex_6dtypes_DDTypeFunctions) < 0) __PYX_ERR(0, 135, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type_5arrex_6dtypes_DDTypeFunctions.tp_print = 0; + #if CYTHON_USE_TYPE_SPECS + __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_5arrex_6dtypes_DDType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 135, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_ptype_5arrex_6dtypes_DDTypeFunctions = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5arrex_6dtypes_DDTypeFunctions_spec, __pyx_t_1); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_ptype_5arrex_6dtypes_DDTypeFunctions)) __PYX_ERR(0, 135, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5arrex_6dtypes_DDTypeFunctions_spec, __pyx_ptype_5arrex_6dtypes_DDTypeFunctions) < 0) __PYX_ERR(0, 135, __pyx_L1_error) + #else + __pyx_ptype_5arrex_6dtypes_DDTypeFunctions = &__pyx_type_5arrex_6dtypes_DDTypeFunctions; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_ptype_5arrex_6dtypes_DDTypeFunctions->tp_base = __pyx_ptype_5arrex_6dtypes_DDType; + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_ptype_5arrex_6dtypes_DDTypeFunctions) < 0) __PYX_ERR(0, 135, __pyx_L1_error) #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5arrex_6dtypes_DDTypeFunctions.tp_dictoffset && __pyx_type_5arrex_6dtypes_DDTypeFunctions.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_5arrex_6dtypes_DDTypeFunctions.tp_getattro = __Pyx_PyObject_GenericGetAttr; + #if PY_MAJOR_VERSION < 3 + __pyx_ptype_5arrex_6dtypes_DDTypeFunctions->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5arrex_6dtypes_DDTypeFunctions->tp_dictoffset && __pyx_ptype_5arrex_6dtypes_DDTypeFunctions->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_ptype_5arrex_6dtypes_DDTypeFunctions->tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (__Pyx_SetVtable(__pyx_type_5arrex_6dtypes_DDTypeFunctions.tp_dict, __pyx_vtabptr_5arrex_6dtypes_DDTypeFunctions) < 0) __PYX_ERR(0, 135, __pyx_L1_error) - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_DDTypeFunctions, (PyObject *)&__pyx_type_5arrex_6dtypes_DDTypeFunctions) < 0) __PYX_ERR(0, 135, __pyx_L1_error) - __pyx_ptype_5arrex_6dtypes_DDTypeFunctions = &__pyx_type_5arrex_6dtypes_DDTypeFunctions; + #endif + if (__Pyx_SetVtable(__pyx_ptype_5arrex_6dtypes_DDTypeFunctions, __pyx_vtabptr_5arrex_6dtypes_DDTypeFunctions) < 0) __PYX_ERR(0, 135, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_MergeVtables(__pyx_ptype_5arrex_6dtypes_DDTypeFunctions) < 0) __PYX_ERR(0, 135, __pyx_L1_error) + #endif + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_DDTypeFunctions, (PyObject *) __pyx_ptype_5arrex_6dtypes_DDTypeFunctions) < 0) __PYX_ERR(0, 135, __pyx_L1_error) __pyx_vtabptr_5arrex_6dtypes_DDTypeCType = &__pyx_vtable_5arrex_6dtypes_DDTypeCType; __pyx_vtable_5arrex_6dtypes_DDTypeCType._ctype_pack = (int (*)(struct __pyx_obj_5arrex_6dtypes_DDTypeCType *, void *, PyObject *))__pyx_f_5arrex_6dtypes_11DDTypeCType__ctype_pack; __pyx_vtable_5arrex_6dtypes_DDTypeCType._ctype_unpack = (PyObject *(*)(struct __pyx_obj_5arrex_6dtypes_DDTypeCType *, void *))__pyx_f_5arrex_6dtypes_11DDTypeCType__ctype_unpack; - __pyx_type_5arrex_6dtypes_DDTypeCType.tp_base = __pyx_ptype_5arrex_6dtypes_DDType; - if (PyType_Ready(&__pyx_type_5arrex_6dtypes_DDTypeCType) < 0) __PYX_ERR(0, 195, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type_5arrex_6dtypes_DDTypeCType.tp_print = 0; + #if CYTHON_USE_TYPE_SPECS + __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_5arrex_6dtypes_DDType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 195, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_ptype_5arrex_6dtypes_DDTypeCType = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5arrex_6dtypes_DDTypeCType_spec, __pyx_t_1); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_ptype_5arrex_6dtypes_DDTypeCType)) __PYX_ERR(0, 195, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5arrex_6dtypes_DDTypeCType_spec, __pyx_ptype_5arrex_6dtypes_DDTypeCType) < 0) __PYX_ERR(0, 195, __pyx_L1_error) + #else + __pyx_ptype_5arrex_6dtypes_DDTypeCType = &__pyx_type_5arrex_6dtypes_DDTypeCType; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_ptype_5arrex_6dtypes_DDTypeCType->tp_base = __pyx_ptype_5arrex_6dtypes_DDType; + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_ptype_5arrex_6dtypes_DDTypeCType) < 0) __PYX_ERR(0, 195, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_ptype_5arrex_6dtypes_DDTypeCType->tp_print = 0; #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5arrex_6dtypes_DDTypeCType.tp_dictoffset && __pyx_type_5arrex_6dtypes_DDTypeCType.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_5arrex_6dtypes_DDTypeCType.tp_getattro = __Pyx_PyObject_GenericGetAttr; + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5arrex_6dtypes_DDTypeCType->tp_dictoffset && __pyx_ptype_5arrex_6dtypes_DDTypeCType->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_ptype_5arrex_6dtypes_DDTypeCType->tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (__Pyx_SetVtable(__pyx_type_5arrex_6dtypes_DDTypeCType.tp_dict, __pyx_vtabptr_5arrex_6dtypes_DDTypeCType) < 0) __PYX_ERR(0, 195, __pyx_L1_error) - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_DDTypeCType, (PyObject *)&__pyx_type_5arrex_6dtypes_DDTypeCType) < 0) __PYX_ERR(0, 195, __pyx_L1_error) - __pyx_ptype_5arrex_6dtypes_DDTypeCType = &__pyx_type_5arrex_6dtypes_DDTypeCType; + #endif + if (__Pyx_SetVtable(__pyx_ptype_5arrex_6dtypes_DDTypeCType, __pyx_vtabptr_5arrex_6dtypes_DDTypeCType) < 0) __PYX_ERR(0, 195, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_MergeVtables(__pyx_ptype_5arrex_6dtypes_DDTypeCType) < 0) __PYX_ERR(0, 195, __pyx_L1_error) + #endif + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_DDTypeCType, (PyObject *) __pyx_ptype_5arrex_6dtypes_DDTypeCType) < 0) __PYX_ERR(0, 195, __pyx_L1_error) __pyx_vtabptr_5arrex_6dtypes_DDTypeExtension = &__pyx_vtable_5arrex_6dtypes_DDTypeExtension; __pyx_vtable_5arrex_6dtypes_DDTypeExtension._raw = (void *(*)(struct __pyx_obj_5arrex_6dtypes_DDTypeExtension *, PyObject *))__pyx_f_5arrex_6dtypes_15DDTypeExtension__raw; __pyx_vtable_5arrex_6dtypes_DDTypeExtension._ext_pack = (int (*)(struct __pyx_obj_5arrex_6dtypes_DDTypeExtension *, void *, PyObject *))__pyx_f_5arrex_6dtypes_15DDTypeExtension__ext_pack; __pyx_vtable_5arrex_6dtypes_DDTypeExtension._ext_unpack = (PyObject *(*)(struct __pyx_obj_5arrex_6dtypes_DDTypeExtension *, void *))__pyx_f_5arrex_6dtypes_15DDTypeExtension__ext_unpack; - __pyx_type_5arrex_6dtypes_DDTypeExtension.tp_base = __pyx_ptype_5arrex_6dtypes_DDType; - if (PyType_Ready(&__pyx_type_5arrex_6dtypes_DDTypeExtension) < 0) __PYX_ERR(0, 232, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type_5arrex_6dtypes_DDTypeExtension.tp_print = 0; - #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5arrex_6dtypes_DDTypeExtension.tp_dictoffset && __pyx_type_5arrex_6dtypes_DDTypeExtension.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_5arrex_6dtypes_DDTypeExtension.tp_getattro = __Pyx_PyObject_GenericGetAttr; - } - if (__Pyx_SetVtable(__pyx_type_5arrex_6dtypes_DDTypeExtension.tp_dict, __pyx_vtabptr_5arrex_6dtypes_DDTypeExtension) < 0) __PYX_ERR(0, 232, __pyx_L1_error) - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_DDTypeExtension, (PyObject *)&__pyx_type_5arrex_6dtypes_DDTypeExtension) < 0) __PYX_ERR(0, 232, __pyx_L1_error) + #if CYTHON_USE_TYPE_SPECS + __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_5arrex_6dtypes_DDType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 232, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_ptype_5arrex_6dtypes_DDTypeExtension = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5arrex_6dtypes_DDTypeExtension_spec, __pyx_t_1); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_ptype_5arrex_6dtypes_DDTypeExtension)) __PYX_ERR(0, 232, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5arrex_6dtypes_DDTypeExtension_spec, __pyx_ptype_5arrex_6dtypes_DDTypeExtension) < 0) __PYX_ERR(0, 232, __pyx_L1_error) + #else __pyx_ptype_5arrex_6dtypes_DDTypeExtension = &__pyx_type_5arrex_6dtypes_DDTypeExtension; - if (PyType_Ready(&__pyx_type_5arrex_6dtypes__head) < 0) __PYX_ERR(0, 376, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type_5arrex_6dtypes__head.tp_print = 0; #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5arrex_6dtypes__head.tp_dictoffset && __pyx_type_5arrex_6dtypes__head.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_5arrex_6dtypes__head.tp_getattro = __Pyx_PyObject_GenericGetAttr; + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_ptype_5arrex_6dtypes_DDTypeExtension->tp_base = __pyx_ptype_5arrex_6dtypes_DDType; + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_ptype_5arrex_6dtypes_DDTypeExtension) < 0) __PYX_ERR(0, 232, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_ptype_5arrex_6dtypes_DDTypeExtension->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5arrex_6dtypes_DDTypeExtension->tp_dictoffset && __pyx_ptype_5arrex_6dtypes_DDTypeExtension->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_ptype_5arrex_6dtypes_DDTypeExtension->tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_head, (PyObject *)&__pyx_type_5arrex_6dtypes__head) < 0) __PYX_ERR(0, 376, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5arrex_6dtypes__head) < 0) __PYX_ERR(0, 376, __pyx_L1_error) + #endif + if (__Pyx_SetVtable(__pyx_ptype_5arrex_6dtypes_DDTypeExtension, __pyx_vtabptr_5arrex_6dtypes_DDTypeExtension) < 0) __PYX_ERR(0, 232, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_MergeVtables(__pyx_ptype_5arrex_6dtypes_DDTypeExtension) < 0) __PYX_ERR(0, 232, __pyx_L1_error) + #endif + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_DDTypeExtension, (PyObject *) __pyx_ptype_5arrex_6dtypes_DDTypeExtension) < 0) __PYX_ERR(0, 232, __pyx_L1_error) + #if CYTHON_USE_TYPE_SPECS + __pyx_ptype_5arrex_6dtypes__head = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5arrex_6dtypes__head_spec, NULL); if (unlikely(!__pyx_ptype_5arrex_6dtypes__head)) __PYX_ERR(0, 376, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5arrex_6dtypes__head_spec, __pyx_ptype_5arrex_6dtypes__head) < 0) __PYX_ERR(0, 376, __pyx_L1_error) + #else __pyx_ptype_5arrex_6dtypes__head = &__pyx_type_5arrex_6dtypes__head; - if (PyType_Ready(&__pyx_type_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct) < 0) __PYX_ERR(0, 122, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct.tp_print = 0; #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct.tp_dictoffset && __pyx_type_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_ptype_5arrex_6dtypes__head) < 0) __PYX_ERR(0, 376, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_ptype_5arrex_6dtypes__head->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5arrex_6dtypes__head->tp_dictoffset && __pyx_ptype_5arrex_6dtypes__head->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_ptype_5arrex_6dtypes__head->tp_getattro = __Pyx_PyObject_GenericGetAttr; } + #endif + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_head, (PyObject *) __pyx_ptype_5arrex_6dtypes__head) < 0) __PYX_ERR(0, 376, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_5arrex_6dtypes__head) < 0) __PYX_ERR(0, 376, __pyx_L1_error) + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_ptype_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct_spec, NULL); if (unlikely(!__pyx_ptype_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct)) __PYX_ERR(0, 122, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct_spec, __pyx_ptype_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct) < 0) __PYX_ERR(0, 122, __pyx_L1_error) + #else __pyx_ptype_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct = &__pyx_type_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_ptype_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct) < 0) __PYX_ERR(0, 122, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_ptype_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct->tp_dictoffset && __pyx_ptype_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_ptype_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; + } + #endif __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); __Pyx_RefNannyFinishContext(); return -1; } @@ -9426,26 +12264,25 @@ static int __Pyx_modinit_type_import_code(void) { int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); /*--- Type import code ---*/ - __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error) + __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_0_0(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 - sizeof(PyTypeObject), + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_0(PyTypeObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_0(PyTypeObject), #else - sizeof(PyHeapTypeObject), + sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_0(PyHeapTypeObject), #endif - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error) + __Pyx_ImportType_CheckSize_Warn_3_0_0); if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(4, 9, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8, __pyx_L1_error) + __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 8, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(4, 8, __pyx_L1_error) + __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType_3_0_0(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_0(PyBoolObject),__Pyx_ImportType_CheckSize_Warn_3_0_0); if (!__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(5, 8, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 15, __pyx_L1_error) + __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(5, 15, __pyx_L1_error) + __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType_3_0_0(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_0(PyComplexObject),__Pyx_ImportType_CheckSize_Warn_3_0_0); if (!__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(6, 15, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; @@ -9472,6 +12309,55 @@ static int __Pyx_modinit_function_import_code(void) { } +#if PY_MAJOR_VERSION >= 3 +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec_dtypes(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_dtypes}, + {0, NULL} +}; +#endif + +#ifdef __cplusplus +namespace { + struct PyModuleDef __pyx_moduledef = + #else + static struct PyModuleDef __pyx_moduledef = + #endif + { + PyModuleDef_HEAD_INIT, + "dtypes", + __pyx_k_The_dtype_is_the_type_of_the_el, /* m_doc */ + #if CYTHON_PEP489_MULTI_PHASE_INIT + 0, /* m_size */ + #elif CYTHON_USE_MODULE_STATE + sizeof(__pyx_mstate), /* m_size */ + #else + -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + #if CYTHON_USE_MODULE_STATE + __pyx_m_traverse, /* m_traverse */ + __pyx_m_clear, /* m_clear */ + NULL /* m_free */ + #else + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ + #endif + }; + #ifdef __cplusplus +} /* anonymous namespace */ +#endif +#endif + #ifndef CYTHON_NO_PYINIT_EXPORT #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC #elif PY_MAJOR_VERSION < 3 @@ -9522,12 +12408,21 @@ static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { } return 0; } -static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none) +#else +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) +#endif +{ PyObject *value = PyObject_GetAttrString(spec, from_name); int result = 0; if (likely(value)) { if (allow_none || value != Py_None) { +#if CYTHON_COMPILING_IN_LIMITED_API + result = PyModule_AddObject(module, to_name, value); +#else result = PyDict_SetItemString(moddict, to_name, value); +#endif } Py_DECREF(value); } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { @@ -9537,8 +12432,9 @@ static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject } return result; } -static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { +static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { PyObject *module = NULL, *moddict, *modname; + CYTHON_UNUSED_VAR(def); if (__Pyx_check_single_interpreter()) return NULL; if (__pyx_m) @@ -9548,8 +12444,12 @@ static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNU module = PyModule_NewObject(modname); Py_DECREF(modname); if (unlikely(!module)) goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + moddict = module; +#else moddict = PyModule_GetDict(module); if (unlikely(!moddict)) goto bad; +#endif if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; @@ -9565,8 +12465,13 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec_dtypes(PyObject *__pyx_pyinit_modu #endif #endif { + int stringtab_initialized = 0; + #if CYTHON_USE_MODULE_STATE + int pystate_addmodule_run = 0; + #endif PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -9580,6 +12485,35 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec_dtypes(PyObject *__pyx_pyinit_modu #elif PY_MAJOR_VERSION >= 3 if (__pyx_m) return __Pyx_NewRef(__pyx_m); #endif + /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_m = __pyx_pyinit_module; + Py_INCREF(__pyx_m); + #else + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4("dtypes", __pyx_methods, __pyx_k_The_dtype_is_the_type_of_the_el, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #elif CYTHON_USE_MODULE_STATE + __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + { + int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef); + __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to dtypes pseudovariable */ + if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + pystate_addmodule_run = 1; + } + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #endif + CYTHON_UNUSED_VAR(__pyx_t_1); + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_d); + __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_b); + __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_cython_runtime); + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { @@ -9598,48 +12532,31 @@ if (!__Pyx_RefNanny) { __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_AsyncGen_USED - if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS PyEval_InitThreads(); #endif - /*--- Module creation code ---*/ - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_m = __pyx_pyinit_module; - Py_INCREF(__pyx_m); - #else - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("dtypes", __pyx_methods, __pyx_k_The_dtype_is_the_type_of_the_el, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_b); - __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_cython_runtime); - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + stringtab_initialized = 1; if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) @@ -9651,7 +12568,7 @@ if (!__Pyx_RefNanny) { { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) if (!PyDict_GetItemString(modules, "arrex.dtypes")) { - if (unlikely(PyDict_SetItemString(modules, "arrex.dtypes", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((PyDict_SetItemString(modules, "arrex.dtypes", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) } } #endif @@ -9662,9 +12579,9 @@ if (!__Pyx_RefNanny) { /*--- Global type/function init code ---*/ (void)__Pyx_modinit_global_init_code(); (void)__Pyx_modinit_variable_export_code(); - if (unlikely(__Pyx_modinit_function_export_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_function_export_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_type_init_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_type_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) (void)__Pyx_modinit_variable_import_code(); (void)__Pyx_modinit_function_import_code(); /*--- Execution code ---*/ @@ -9679,24 +12596,27 @@ if (!__Pyx_RefNanny) { * * cdef extern from "Python.h": */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_struct, __pyx_t_1) < 0) __PYX_ERR(0, 19, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_Import(__pyx_n_s_ctypes, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_ctypes, __pyx_t_1) < 0) __PYX_ERR(0, 19, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_struct, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_struct, __pyx_t_2) < 0) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_ctypes, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ctypes, __pyx_t_2) < 0) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "arrex/dtypes.pyx":55 + /* "arrex/dtypes.pyx":48 + * return ''.format(id(self)) * - * @classmethod - * def _rebuild(cls, key, size_t dsize, bytes layout): # <<<<<<<<<<<<<< - * candidate = declared(key) - * if dsize != candidate.dsize: + * def __reduce_ex__(self, protocol): # <<<<<<<<<<<<<< + * ''' allow serialization of the dtype with the array (particularly useful for anonymous dtypes) ''' + * if self.key is None: */ - __Pyx_GetNameInClass(__pyx_t_1, (PyObject *)__pyx_ptype_5arrex_6dtypes_DDType, __pyx_n_s_rebuild); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_6dtypes_6DDType_3__reduce_ex__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_DDType___reduce_ex, NULL, __pyx_n_s_arrex_dtypes, __pyx_d, ((PyObject *)__pyx_codeobj__20)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_6dtypes_DDType->tp_dict, __pyx_n_s_reduce_ex, __pyx_t_2) < 0) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_5arrex_6dtypes_DDType); /* "arrex/dtypes.pyx":54 * return self._rebuild, (self.key, self.dsize, self.layout) @@ -9705,11 +12625,18 @@ if (!__Pyx_RefNanny) { * def _rebuild(cls, key, size_t dsize, bytes layout): * candidate = declared(key) */ - __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_6dtypes_6DDType_5_rebuild, __Pyx_CYFUNCTION_CLASSMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_DDType__rebuild, NULL, __pyx_n_s_arrex_dtypes, __pyx_d, ((PyObject *)__pyx_codeobj__22)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_6dtypes_DDType->tp_dict, __pyx_n_s_rebuild, __pyx_t_2) < 0) __PYX_ERR(0, 55, __pyx_L1_error) + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_6dtypes_DDType->tp_dict, __pyx_n_s_rebuild, __pyx_t_2) < 0) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_5arrex_6dtypes_DDType); + __Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_5arrex_6dtypes_DDType, __pyx_n_s_rebuild); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_Method_ClassMethod(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_6dtypes_DDType->tp_dict, __pyx_n_s_rebuild, __pyx_t_3) < 0) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_5arrex_6dtypes_DDType); /* "arrex/dtypes.pyx":66 @@ -9719,10 +12646,10 @@ if (!__Pyx_RefNanny) { * ''' DDTypeClass(type) * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5arrex_6dtypes_1DDTypeClass, NULL, __pyx_n_s_arrex_dtypes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_DDTypeClass, __pyx_t_2) < 0) __PYX_ERR(0, 66, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_6dtypes_1DDTypeClass, 0, __pyx_n_s_DDTypeClass, NULL, __pyx_n_s_arrex_dtypes, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DDTypeClass, __pyx_t_3) < 0) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "arrex/dtypes.pyx":122 * return DDTypeFunctions(dsize, pack, unpack, layout) @@ -9731,20 +12658,36 @@ if (!__Pyx_RefNanny) { * ''' DDTypeStruct(struct) * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5arrex_6dtypes_3DDTypeStruct, NULL, __pyx_n_s_arrex_dtypes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_DDTypeStruct, __pyx_t_2) < 0) __PYX_ERR(0, 122, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_6dtypes_3DDTypeStruct, 0, __pyx_n_s_DDTypeStruct, NULL, __pyx_n_s_arrex_dtypes, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DDTypeStruct, __pyx_t_3) < 0) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "arrex/dtypes.pyx":309 + /* "arrex/dtypes.pyx":191 * - * @classmethod - * def _rebuild(cls, type, size_t dsize, bytes layout, constructor): # <<<<<<<<<<<<<< - * candidate = _declared.get(type) or declare(type, DDTypeExtension(type, layout, constructor)) - * if dsize != candidate.dsize: + * + * def __reduce_ex__(self, protocol): # <<<<<<<<<<<<<< + * ''' allow serialization of the dtype with the array (particularly useful for anonymous dtypes) ''' + * return type(self), (self.dsize, self.pack, self.unpack, self.layout, self.constructor) */ - __Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_5arrex_6dtypes_DDTypeExtension, __pyx_n_s_rebuild); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 309, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_6dtypes_15DDTypeFunctions_3__reduce_ex__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_DDTypeFunctions___reduce_ex, NULL, __pyx_n_s_arrex_dtypes, __pyx_d, ((PyObject *)__pyx_codeobj__27)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 191, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_6dtypes_DDTypeFunctions->tp_dict, __pyx_n_s_reduce_ex, __pyx_t_3) < 0) __PYX_ERR(0, 191, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + PyType_Modified(__pyx_ptype_5arrex_6dtypes_DDTypeFunctions); + + /* "arrex/dtypes.pyx":304 + * return new + * + * def __reduce_ex__(self, protocol): # <<<<<<<<<<<<<< + * ''' that overload allows for automatic declaration of the dtype fron the pickled informations, as long as they are consistent with the given type size ''' + * return self._rebuild, (self.type, self.dsize, self.layout, self.constructor) + */ + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_6dtypes_15DDTypeExtension_3__reduce_ex__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_DDTypeExtension___reduce_ex, NULL, __pyx_n_s_arrex_dtypes, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 304, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_6dtypes_DDTypeExtension->tp_dict, __pyx_n_s_reduce_ex, __pyx_t_3) < 0) __PYX_ERR(0, 304, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + PyType_Modified(__pyx_ptype_5arrex_6dtypes_DDTypeExtension); /* "arrex/dtypes.pyx":308 * return self._rebuild, (self.type, self.dsize, self.layout, self.constructor) @@ -9753,11 +12696,18 @@ if (!__Pyx_RefNanny) { * def _rebuild(cls, type, size_t dsize, bytes layout, constructor): * candidate = _declared.get(type) or declare(type, DDTypeExtension(type, layout, constructor)) */ - __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_6dtypes_15DDTypeExtension_5_rebuild, __Pyx_CYFUNCTION_CLASSMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_DDTypeExtension__rebuild, NULL, __pyx_n_s_arrex_dtypes, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 308, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_6dtypes_DDTypeExtension->tp_dict, __pyx_n_s_rebuild, __pyx_t_3) < 0) __PYX_ERR(0, 308, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + PyType_Modified(__pyx_ptype_5arrex_6dtypes_DDTypeExtension); + __Pyx_GetNameInClass(__pyx_t_3, (PyObject *)__pyx_ptype_5arrex_6dtypes_DDTypeExtension, __pyx_n_s_rebuild); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 308, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 308, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_6dtypes_DDTypeExtension->tp_dict, __pyx_n_s_rebuild, __pyx_t_2) < 0) __PYX_ERR(0, 308, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_6dtypes_DDTypeExtension->tp_dict, __pyx_n_s_rebuild, __pyx_t_1) < 0) __PYX_ERR(0, 309, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_5arrex_6dtypes_DDTypeExtension); /* "arrex/dtypes.pyx":323 @@ -9767,12 +12717,60 @@ if (!__Pyx_RefNanny) { * * cpdef DDType declare(key, DDType dtype=None): */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 323, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 323, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_v_5arrex_6dtypes__declared); - __Pyx_DECREF_SET(__pyx_v_5arrex_6dtypes__declared, ((PyObject*)__pyx_t_1)); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_5arrex_6dtypes__declared, ((PyObject*)__pyx_t_2)); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + + /* "arrex/dtypes.pyx":325 + * cdef dict _declared = {} # {python type: dtype} + * + * cpdef DDType declare(key, DDType dtype=None): # <<<<<<<<<<<<<< + * ''' declare(dtype, ddtype) + * + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_6dtypes_5declare, 0, __pyx_n_s_declare, NULL, __pyx_n_s_arrex_dtypes, __pyx_d, ((PyObject *)__pyx_codeobj__32)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 325, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__33); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_declare, __pyx_t_2) < 0) __PYX_ERR(0, 325, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "arrex/dtypes.pyx":348 + * return dtype + * + * cpdef DDType declared(key): # <<<<<<<<<<<<<< + * ''' declared(key) + * + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_6dtypes_7declared, 0, __pyx_n_s_declared, NULL, __pyx_n_s_arrex_dtypes, __pyx_d, ((PyObject *)__pyx_codeobj__35)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 348, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_declared, __pyx_t_2) < 0) __PYX_ERR(0, 348, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_6dtypes_5_head_1__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_head___reduce_cython, NULL, __pyx_n_s_arrex_dtypes, __pyx_d, ((PyObject *)__pyx_codeobj__37)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_6dtypes__head->tp_dict, __pyx_n_s_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(3, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_5arrex_6dtypes__head); + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle__head, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle__head__set_state(self, __pyx_state) + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_6dtypes_5_head_3__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_head___setstate_cython, NULL, __pyx_n_s_arrex_dtypes, __pyx_d, ((PyObject *)__pyx_codeobj__39)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_6dtypes__head->tp_dict, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(3, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_5arrex_6dtypes__head); /* "arrex/dtypes.pyx":381 * @@ -9790,34 +12788,44 @@ if (!__Pyx_RefNanny) { * cdef object __pyx_PickleError * cdef object __pyx_result */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5arrex_6dtypes_9__pyx_unpickle__head, NULL, __pyx_n_s_arrex_dtypes); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle__head, __pyx_t_1) < 0) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_6dtypes_9__pyx_unpickle__head, 0, __pyx_n_s_pyx_unpickle__head, NULL, __pyx_n_s_arrex_dtypes, __pyx_d, ((PyObject *)__pyx_codeobj__41)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle__head, __pyx_t_2) < 0) __PYX_ERR(3, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "arrex/dtypes.pyx":1 * # cython: language_level=3, cdivision=True # <<<<<<<<<<<<<< * * ''' */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_DDTypeClass_line_66, __pyx_kp_u_DDTypeClass_type_Create_a_dtype) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_DDTypeStruct_line_122, __pyx_kp_u_DDTypeStruct_struct_create_a_dt) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_DDTypeClass_line_66, __pyx_kp_u_DDTypeClass_type_Create_a_dtype) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_DDTypeStruct_line_122, __pyx_kp_u_DDTypeStruct_struct_create_a_dt) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /*--- Wrapped vars code ---*/ goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); if (__pyx_m) { - if (__pyx_d) { + if (__pyx_d && stringtab_initialized) { __Pyx_AddTraceback("init arrex.dtypes", __pyx_clineno, __pyx_lineno, __pyx_filename); } + #if !CYTHON_USE_MODULE_STATE Py_CLEAR(__pyx_m); + #else + Py_DECREF(__pyx_m); + if (pystate_addmodule_run) { + PyObject *tp, *value, *tb; + PyErr_Fetch(&tp, &value, &tb); + PyState_RemoveModule(&__pyx_moduledef); + PyErr_Restore(tp, value, tb); + } + #endif } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init arrex.dtypes"); } @@ -9831,6 +12839,22 @@ if (!__Pyx_RefNanny) { return; #endif } +/* #### Code section: cleanup_globals ### */ +/* #### Code section: cleanup_module ### */ +/* #### Code section: main_method ### */ +/* #### Code section: utility_code_pragmas ### */ +#ifdef _MSC_VER +#pragma warning( push ) +/* Warning 4127: conditional expression is constant + * Cython uses constant conditional expressions to allow in inline functions to be optimized at + * compile-time, so this warning is not useful + */ +#pragma warning( disable : 4127 ) +#endif + + + +/* #### Code section: utility_code_def ### */ /* --- Runtime support code --- */ /* Refnanny */ @@ -9850,59 +12874,365 @@ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { } #endif -/* PyObjectGetAttrStr */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); +/* PyErrExceptionMatches */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; i= 0x030C00A6 + PyObject *current_exception = tstate->current_exception; + if (unlikely(!current_exception)) return 0; + exc_type = (PyObject*) Py_TYPE(current_exception); + if (exc_type == err) return 1; +#else + exc_type = tstate->curexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; +#endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(exc_type); + #endif + if (unlikely(PyTuple_Check(err))) { + result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + } else { + result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(exc_type); + #endif + return result; +} +#endif + +/* PyErrFetchRestore */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject *tmp_value; + assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); + if (value) { + #if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) + #endif + PyException_SetTraceback(value, tb); + } + tmp_value = tstate->current_exception; + tstate->current_exception = value; + Py_XDECREF(tmp_value); +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + 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); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject* exc_value; + exc_value = tstate->current_exception; + tstate->current_exception = 0; + *value = exc_value; + *type = NULL; + *tb = NULL; + if (exc_value) { + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + #if CYTHON_COMPILING_IN_CPYTHON + *tb = ((PyBaseExceptionObject*) exc_value)->traceback; + Py_XINCREF(*tb); + #else + *tb = PyException_GetTraceback(exc_value); + #endif + } +#else + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#endif +} +#endif + +/* PyObjectGetAttrStr */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#endif + +/* PyObjectGetAttrStrNoError */ +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +} + +/* GetBuiltinName */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name); + if (unlikely(!result) && !PyErr_Occurred()) { + PyErr_Format(PyExc_NameError, +#if PY_MAJOR_VERSION >= 3 + "name '%U' is not defined", name); +#else + "name '%.200s' is not defined", PyString_AS_STRING(name)); +#endif + } + return result; +} + +/* TupleAndListFromArray */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { + PyObject *v; + Py_ssize_t i; + for (i = 0; i < length; i++) { + v = dest[i] = src[i]; + Py_INCREF(v); + } +} +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + Py_INCREF(__pyx_empty_tuple); + return __pyx_empty_tuple; + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); + return res; +} +static CYTHON_INLINE PyObject * +__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return PyList_New(0); + } + res = PyList_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); + return res; +} +#endif + +/* BytesEquals */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); +#else + if (s1 == s2) { + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + const char *ps1, *ps2; + Py_ssize_t length = PyBytes_GET_SIZE(s1); + if (length != PyBytes_GET_SIZE(s2)) + return (equals == Py_NE); + ps1 = PyBytes_AS_STRING(s1); + ps2 = PyBytes_AS_STRING(s2); + if (ps1[0] != ps2[0]) { + return (equals == Py_NE); + } else if (length == 1) { + return (equals == Py_EQ); + } else { + int result; +#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) + Py_hash_t hash1, hash2; + hash1 = ((PyBytesObject*)s1)->ob_shash; + hash2 = ((PyBytesObject*)s2)->ob_shash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + return (equals == Py_NE); + } +#endif + result = memcmp(ps1, ps2, (size_t)length); + 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; + } +#endif +} + +/* UnicodeEquals */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); +#else #if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); + PyObject* owned_ref = NULL; #endif - return PyObject_GetAttr(obj, attr_name); -} + int s1_is_unicode, s2_is_unicode; + if (s1 == s2) { + goto return_eq; + } + s1_is_unicode = PyUnicode_CheckExact(s1); + s2_is_unicode = PyUnicode_CheckExact(s2); +#if PY_MAJOR_VERSION < 3 + if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { + owned_ref = PyUnicode_FromObject(s2); + if (unlikely(!owned_ref)) + return -1; + s2 = owned_ref; + s2_is_unicode = 1; + } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { + owned_ref = PyUnicode_FromObject(s1); + if (unlikely(!owned_ref)) + return -1; + s1 = owned_ref; + s1_is_unicode = 1; + } else if (((!s2_is_unicode) & (!s1_is_unicode))) { + return __Pyx_PyBytes_Equals(s1, s2, equals); + } #endif - -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); - if (unlikely(!result)) { - PyErr_Format(PyExc_NameError, -#if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); -#else - "name '%.200s' is not defined", PyString_AS_STRING(name)); + if (s1_is_unicode & s2_is_unicode) { + Py_ssize_t length; + int kind; + void *data1, *data2; + if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) + return -1; + length = __Pyx_PyUnicode_GET_LENGTH(s1); + if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { + goto return_ne; + } +#if CYTHON_USE_UNICODE_INTERNALS + { + Py_hash_t hash1, hash2; + #if CYTHON_PEP393_ENABLED + hash1 = ((PyASCIIObject*)s1)->hash; + hash2 = ((PyASCIIObject*)s2)->hash; + #else + hash1 = ((PyUnicodeObject*)s1)->hash; + hash2 = ((PyUnicodeObject*)s2)->hash; + #endif + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + goto return_ne; + } + } #endif + kind = __Pyx_PyUnicode_KIND(s1); + if (kind != __Pyx_PyUnicode_KIND(s2)) { + goto return_ne; + } + data1 = __Pyx_PyUnicode_DATA(s1); + data2 = __Pyx_PyUnicode_DATA(s2); + if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { + goto return_ne; + } else if (length == 1) { + goto return_eq; + } else { + int result = memcmp(data1, data2, (size_t)(length * kind)); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & s2_is_unicode) { + goto return_ne; + } else if ((s2 == Py_None) & s1_is_unicode) { + goto return_ne; + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; } - return result; +return_eq: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ); +return_ne: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_NE); +#endif } -/* PyCFunctionFastCall */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - int flags = PyCFunction_GET_FLAGS(func); - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { - return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); - } else { - return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); +/* fastcall */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) +{ + Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames); + for (i = 0; i < n; i++) + { + if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i]; } + for (i = 0; i < n; i++) + { + int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ); + if (unlikely(eq != 0)) { + if (unlikely(eq < 0)) return NULL; // error + return kwvalues[i]; + } + } + return NULL; // not found (no exception set) } #endif /* PyFunctionFastCall */ -#if CYTHON_FAST_PYCALL +#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, PyObject *globals) { PyFrameObject *f; @@ -9931,7 +13261,6 @@ static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args --tstate->recursion_depth; return result; } -#if 1 || PY_VERSION_HEX < 0x030600B1 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); PyObject *globals = PyFunction_GET_GLOBALS(func); @@ -9947,7 +13276,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, PyObject *result; assert(kwargs == NULL || PyDict_Check(kwargs)); nk = kwargs ? PyDict_Size(kwargs) : 0; - if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) { return NULL; } if ( @@ -10018,7 +13347,6 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, return result; } #endif -#endif /* PyObjectCall */ #if CYTHON_COMPILING_IN_CPYTHON @@ -10040,35 +13368,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg } #endif -/* PyObjectCall2Args */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { - PyObject *args, *result = NULL; - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyFunction_FastCall(function, args, 2); - } - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyCFunction_FastCall(function, args, 2); - } - #endif - args = PyTuple_New(2); - if (unlikely(!args)) goto done; - Py_INCREF(arg1); - PyTuple_SET_ITEM(args, 0, arg1); - Py_INCREF(arg2); - PyTuple_SET_ITEM(args, 1, arg2); - Py_INCREF(function); - result = __Pyx_PyObject_Call(function, args, NULL); - Py_DECREF(args); - Py_DECREF(function); -done: - return result; -} - /* PyObjectCallMethO */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { @@ -10089,75 +13388,250 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject } #endif -/* PyObjectCallOneArg */ -#if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { +/* PyObjectFastCall */ +static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) { + PyObject *argstuple; PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); + size_t i; + argstuple = PyTuple_New((Py_ssize_t)nargs); + if (unlikely(!argstuple)) return NULL; + for (i = 0; i < nargs; i++) { + Py_INCREF(args[i]); + PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]); + } + result = __Pyx_PyObject_Call(func, argstuple, kwargs); + Py_DECREF(argstuple); return result; } -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); - } +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) { + Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); +#if CYTHON_COMPILING_IN_CPYTHON + if (nargs == 0 && kwargs == NULL) { +#if defined(__Pyx_CyFunction_USED) && defined(NDEBUG) + if (__Pyx_IsCyOrPyCFunction(func)) +#else + if (PyCFunction_Check(func)) #endif - if (likely(PyCFunction_Check(func))) { - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (__Pyx_PyFastCFunction_Check(func)) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { + return __Pyx_PyObject_CallMethO(func, NULL); + } + } + } + else if (nargs == 1 && kwargs == NULL) { + if (PyCFunction_Check(func)) + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, args[0]); + } + } + } #endif + #if PY_VERSION_HEX < 0x030800B1 + #if CYTHON_FAST_PYCCALL + if (PyCFunction_Check(func)) { + if (kwargs) { + return _PyCFunction_FastCallDict(func, args, nargs, kwargs); + } else { + return _PyCFunction_FastCallKeywords(func, args, nargs, NULL); } } - return __Pyx__PyObject_CallOneArg(func, arg); + #if PY_VERSION_HEX >= 0x030700A1 + if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) { + return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL); + } + #endif + #endif + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs); + } + #endif + #endif + #if CYTHON_VECTORCALL + vectorcallfunc f = _PyVectorcall_Function(func); + if (f) { + return f(func, args, (size_t)nargs, kwargs); + } + #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL + if (__Pyx_CyFunction_CheckExact(func)) { + __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func); + if (f) return f(func, args, (size_t)nargs, kwargs); + } + #endif + if (nargs == 0) { + return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs); + } + return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); } -#else + +/* PyObjectCallOneArg */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; + PyObject *args[2] = {NULL, arg}; + return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); } -#endif -/* PyErrFetchRestore */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - 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); +/* RaiseDoubleKeywords */ +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_AsString(kw_name)); + #endif +} + +/* ParseKeywords */ +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject *const *kwvalues, + 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; + int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)); + while (1) { + if (kwds_is_tuple) { + if (pos >= PyTuple_GET_SIZE(kwds)) break; + key = PyTuple_GET_ITEM(kwds, pos); + value = kwvalues[pos]; + pos++; + } + else + { + if (!PyDict_Next(kwds, &pos, &key, &value)) break; + } + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = ( + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key) + ); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + #if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_TypeError, + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; } -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; + +/* RaiseArgTupleInvalid */ +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, + "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); } -#endif /* RaiseException */ #if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, - CYTHON_UNUSED PyObject *cause) { +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { __Pyx_PyThreadState_declare + CYTHON_UNUSED_VAR(cause); Py_XINCREF(type); if (!value || value == Py_None) value = NULL; @@ -10290,13 +13764,9 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } PyErr_SetObject(type, value); if (tb) { -#if CYTHON_COMPILING_IN_PYPY - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); - Py_INCREF(tb); - PyErr_Restore(tmp_type, tmp_value, tb); - Py_XDECREF(tmp_tb); -#else + #if PY_VERSION_HEX >= 0x030C00A6 + PyException_SetTraceback(value, tb); + #elif CYTHON_FAST_THREAD_STATE PyThreadState *tstate = __Pyx_PyThreadState_Current; PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { @@ -10304,6 +13774,12 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); + Py_INCREF(tb); + PyErr_Restore(tmp_type, tmp_value, tb); + Py_XDECREF(tmp_tb); #endif } bad: @@ -10312,151 +13788,11 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } #endif -/* RaiseArgTupleInvalid */ -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, - "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); -} - -/* RaiseDoubleKeywords */ -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_AsString(kw_name)); - #endif -} - -/* ParseKeywords */ -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; - continue; - } - name = first_kw_arg; - #if PY_MAJOR_VERSION < 3 - if (likely(PyString_Check(key))) { - while (*name) { - if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) - && _PyString_Eq(**name, key)) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - if ((**argname == key) || ( - (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) - && _PyString_Eq(**argname, key))) { - goto arg_passed_twice; - } - argname++; - } - } - } else - #endif - if (likely(PyUnicode_Check(key))) { - while (*name) { - int cmp = (**name == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : - #endif - PyUnicode_Compare(**name, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - int cmp = (**argname == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : - #endif - PyUnicode_Compare(**argname, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) goto arg_passed_twice; - argname++; - } - } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } - } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - return -1; -} - /* ArgTypeTest */ static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) { + __Pyx_TypeName type_name; + __Pyx_TypeName obj_type_name; if (unlikely(!type)) { PyErr_SetString(PyExc_SystemError, "Missing type object"); return 0; @@ -10467,97 +13803,27 @@ static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *nam #endif } else { - if (likely(__Pyx_TypeCheck(obj, type))) return 1; - } - PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); - return 0; -} - -/* BytesEquals */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY - return PyObject_RichCompareBool(s1, s2, equals); -#else - if (s1 == s2) { - return (equals == Py_EQ); - } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { - const char *ps1, *ps2; - Py_ssize_t length = PyBytes_GET_SIZE(s1); - if (length != PyBytes_GET_SIZE(s2)) - return (equals == Py_NE); - ps1 = PyBytes_AS_STRING(s1); - ps2 = PyBytes_AS_STRING(s2); - if (ps1[0] != ps2[0]) { - return (equals == Py_NE); - } else if (length == 1) { - return (equals == Py_EQ); - } else { - int result; -#if CYTHON_USE_UNICODE_INTERNALS - Py_hash_t hash1, hash2; - hash1 = ((PyBytesObject*)s1)->ob_shash; - hash2 = ((PyBytesObject*)s2)->ob_shash; - if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { - return (equals == Py_NE); - } -#endif - result = memcmp(ps1, ps2, (size_t)length); - 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; - } -#endif -} - -/* PyErrExceptionMatches */ -#if CYTHON_FAST_THREAD_STATE -static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; icurexc_type; - if (exc_type == err) return 1; - if (unlikely(!exc_type)) return 0; - if (unlikely(PyTuple_Check(err))) - return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); - return __Pyx_PyErr_GivenExceptionMatches(exc_type, err); -} -#endif -/* GetAttr */ -static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { -#if CYTHON_USE_TYPE_SLOTS -#if PY_MAJOR_VERSION >= 3 - if (likely(PyUnicode_Check(n))) -#else - if (likely(PyString_Check(n))) -#endif - return __Pyx_PyObject_GetAttrStr(o, n); -#endif - return PyObject_GetAttr(o, n); +/* RaiseUnexpectedTypeError */ +static int +__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) +{ + __Pyx_TypeName obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, + expected, obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; } /* GetAttr3 */ @@ -10571,7 +13837,17 @@ static PyObject *__Pyx_GetAttr3Default(PyObject *d) { return d; } static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { - PyObject *r = __Pyx_GetAttr(o, n); + PyObject *r; +#if CYTHON_USE_TYPE_SLOTS + if (likely(PyString_Check(n))) { + r = __Pyx_PyObject_GetAttrStrNoError(o, n); + if (unlikely(!r) && likely(!PyErr_Occurred())) { + r = __Pyx_NewRef(d); + } + return r; + } +#endif + r = PyObject_GetAttr(o, n); return (likely(r)) ? r : __Pyx_GetAttr3Default(d); } @@ -10618,6 +13894,14 @@ static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) } else if (unlikely(PyErr_Occurred())) { return NULL; } +#elif CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!__pyx_m)) { + return NULL; + } + result = PyObject_GetAttr(__pyx_m, name); + if (likely(result)) { + return result; + } #else result = PyDict_GetItem(__pyx_d, name); __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) @@ -10636,61 +13920,271 @@ static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) return __Pyx_GetBuiltinName(name); } -/* None */ +/* RaiseClosureNameError */ static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) { PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname); } +/* FixUpExtensionType */ +#if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { +#if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + CYTHON_UNUSED_VAR(spec); + CYTHON_UNUSED_VAR(type); +#else + const PyType_Slot *slot = spec->slots; + while (slot && slot->slot && slot->slot != Py_tp_members) + slot++; + if (slot && slot->slot == Py_tp_members) { + int changed = 0; +#if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON) + const +#endif + PyMemberDef *memb = (PyMemberDef*) slot->pfunc; + while (memb && memb->name) { + if (memb->name[0] == '_' && memb->name[1] == '_') { +#if PY_VERSION_HEX < 0x030900b1 + if (strcmp(memb->name, "__weaklistoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_weaklistoffset = memb->offset; + changed = 1; + } + else if (strcmp(memb->name, "__dictoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_dictoffset = memb->offset; + changed = 1; + } +#if CYTHON_METH_FASTCALL + else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); +#if PY_VERSION_HEX >= 0x030800b4 + type->tp_vectorcall_offset = memb->offset; +#else + type->tp_print = (printfunc) memb->offset; +#endif + changed = 1; + } +#endif +#else + if ((0)); +#endif +#if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON + else if (strcmp(memb->name, "__module__") == 0) { + PyObject *descr; + assert(memb->type == T_OBJECT); + assert(memb->flags == 0 || memb->flags == READONLY); + descr = PyDescr_NewMember(type, memb); + if (unlikely(!descr)) + return -1; + if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) { + Py_DECREF(descr); + return -1; + } + Py_DECREF(descr); + changed = 1; + } +#endif + } + memb++; + } + if (changed) + PyType_Modified(type); + } +#endif + return 0; +} +#endif + +/* FetchSharedCythonModule */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void) { + PyObject *abi_module = PyImport_AddModule((char*) __PYX_ABI_MODULE_NAME); + if (unlikely(!abi_module)) return NULL; + Py_INCREF(abi_module); + return abi_module; +} + /* FetchCommonType */ +static int __Pyx_VerifyCachedType(PyObject *cached_type, + const char *name, + Py_ssize_t basicsize, + Py_ssize_t expected_basicsize) { + if (!PyType_Check(cached_type)) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s is not a type object", name); + return -1; + } + if (basicsize != expected_basicsize) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s has the wrong size, try recompiling", + name); + return -1; + } + return 0; +} +#if !CYTHON_USE_TYPE_SPECS static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { - PyObject* fake_module; - PyTypeObject* cached_type = NULL; - fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI); - if (!fake_module) return NULL; - Py_INCREF(fake_module); - cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name); + PyObject* abi_module; + const char* object_name; + PyTypeObject *cached_type = NULL; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) return NULL; + object_name = strrchr(type->tp_name, '.'); + object_name = object_name ? object_name+1 : type->tp_name; + cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name); if (cached_type) { - if (!PyType_Check((PyObject*)cached_type)) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s is not a type object", - type->tp_name); + if (__Pyx_VerifyCachedType( + (PyObject *)cached_type, + object_name, + cached_type->tp_basicsize, + type->tp_basicsize) < 0) { goto bad; } - if (cached_type->tp_basicsize != type->tp_basicsize) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s has the wrong size, try recompiling", - type->tp_name); + goto done; + } + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + if (PyType_Ready(type) < 0) goto bad; + if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0) + goto bad; + Py_INCREF(type); + cached_type = type; +done: + Py_DECREF(abi_module); + return cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; +} +#else +static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) { + PyObject *abi_module, *cached_type = NULL; + const char* object_name = strrchr(spec->name, '.'); + object_name = object_name ? object_name+1 : spec->name; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) return NULL; + cached_type = PyObject_GetAttrString(abi_module, object_name); + if (cached_type) { + Py_ssize_t basicsize; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_basicsize; + py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); + if (unlikely(!py_basicsize)) goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; +#else + basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1; +#endif + if (__Pyx_VerifyCachedType( + cached_type, + object_name, + basicsize, + spec->basicsize) < 0) { goto bad; } - } else { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; - PyErr_Clear(); - if (PyType_Ready(type) < 0) goto bad; - if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0) - goto bad; - Py_INCREF(type); - cached_type = type; + goto done; } + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + CYTHON_UNUSED_VAR(module); + cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases); + if (unlikely(!cached_type)) goto bad; + if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; + if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad; done: - Py_DECREF(fake_module); - return cached_type; + Py_DECREF(abi_module); + assert(cached_type == NULL || PyType_Check(cached_type)); + return (PyTypeObject *) cached_type; bad: Py_XDECREF(cached_type); cached_type = NULL; goto done; } +#endif + +/* PyVectorcallFastCallDict */ +#if CYTHON_METH_FASTCALL +static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + PyObject *res = NULL; + PyObject *kwnames; + PyObject **newargs; + PyObject **kwvalues; + Py_ssize_t i, pos; + size_t j; + PyObject *key, *value; + unsigned long keys_are_strings; + Py_ssize_t nkw = PyDict_GET_SIZE(kw); + newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); + if (unlikely(newargs == NULL)) { + PyErr_NoMemory(); + return NULL; + } + for (j = 0; j < nargs; j++) newargs[j] = args[j]; + kwnames = PyTuple_New(nkw); + if (unlikely(kwnames == NULL)) { + PyMem_Free(newargs); + return NULL; + } + kwvalues = newargs + nargs; + pos = i = 0; + keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; + while (PyDict_Next(kw, &pos, &key, &value)) { + keys_are_strings &= Py_TYPE(key)->tp_flags; + Py_INCREF(key); + Py_INCREF(value); + PyTuple_SET_ITEM(kwnames, i, key); + kwvalues[i] = value; + i++; + } + if (unlikely(!keys_are_strings)) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + goto cleanup; + } + res = vc(func, newargs, nargs, kwnames); +cleanup: + Py_DECREF(kwnames); + for (i = 0; i < nkw; i++) + Py_DECREF(kwvalues[i]); + PyMem_Free(newargs); + return res; +} +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) { + return vc(func, args, nargs, NULL); + } + return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); +} +#endif /* CythonFunctionShared */ -#include +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { +#if PY_VERSION_HEX < 0x030900B1 + __Pyx_Py_XDECREF_SET( + __Pyx_CyFunction_GetClassObj(f), + ((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#else + __Pyx_Py_XDECREF_SET( + ((PyCMethodObject *) (f))->mm_class, + (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#endif +} static PyObject * -__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) +__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) { + CYTHON_UNUSED_VAR(closure); if (unlikely(op->func_doc == NULL)) { - if (op->func.m_ml->ml_doc) { + if (((PyCFunctionObject*)op)->m_ml->ml_doc) { #if PY_MAJOR_VERSION >= 3 - op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc); + op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); #else - op->func_doc = PyString_FromString(op->func.m_ml->ml_doc); + op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); #endif if (unlikely(op->func_doc == NULL)) return NULL; @@ -10703,25 +14197,25 @@ __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure return op->func_doc; } static int -__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) { - PyObject *tmp = op->func_doc; + CYTHON_UNUSED_VAR(context); if (value == NULL) { value = Py_None; } Py_INCREF(value); - op->func_doc = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->func_doc, value); return 0; } static PyObject * -__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); if (unlikely(op->func_name == NULL)) { #if PY_MAJOR_VERSION >= 3 - op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name); + op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); #else - op->func_name = PyString_InternFromString(op->func.m_ml->ml_name); + op->func_name = PyString_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); #endif if (unlikely(op->func_name == NULL)) return NULL; @@ -10730,9 +14224,9 @@ __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *contex return op->func_name; } static int -__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) { - PyObject *tmp; + CYTHON_UNUSED_VAR(context); #if PY_MAJOR_VERSION >= 3 if (unlikely(value == NULL || !PyUnicode_Check(value))) #else @@ -10743,22 +14237,21 @@ __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UN "__name__ must be set to a string object"); return -1; } - tmp = op->func_name; Py_INCREF(value); - op->func_name = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->func_name, value); return 0; } static PyObject * -__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); Py_INCREF(op->func_qualname); return op->func_qualname; } static int -__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) { - PyObject *tmp; + CYTHON_UNUSED_VAR(context); #if PY_MAJOR_VERSION >= 3 if (unlikely(value == NULL || !PyUnicode_Check(value))) #else @@ -10769,25 +14262,14 @@ __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHO "__qualname__ must be set to a string object"); return -1; } - tmp = op->func_qualname; Py_INCREF(value); - op->func_qualname = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->func_qualname, value); return 0; } static PyObject * -__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure) -{ - PyObject *self; - self = m->func_closure; - if (self == NULL) - self = Py_None; - Py_INCREF(self); - return self; -} -static PyObject * -__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); if (unlikely(op->func_dict == NULL)) { op->func_dict = PyDict_New(); if (unlikely(op->func_dict == NULL)) @@ -10797,9 +14279,9 @@ __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *contex return op->func_dict; } static int -__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context) { - PyObject *tmp; + CYTHON_UNUSED_VAR(context); if (unlikely(value == NULL)) { PyErr_SetString(PyExc_TypeError, "function's dictionary may not be deleted"); @@ -10810,28 +14292,30 @@ __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UN "setting function's dictionary to a non-dict"); return -1; } - tmp = op->func_dict; Py_INCREF(value); - op->func_dict = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->func_dict, value); return 0; } static PyObject * -__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); Py_INCREF(op->func_globals); return op->func_globals; } static PyObject * -__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(op); + CYTHON_UNUSED_VAR(context); Py_INCREF(Py_None); return Py_None; } static PyObject * -__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) { PyObject* result = (op->func_code) ? op->func_code : Py_None; + CYTHON_UNUSED_VAR(context); Py_INCREF(result); return result; } @@ -10858,27 +14342,28 @@ __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { return result; } static int -__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { - PyObject* tmp; +__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); if (!value) { value = Py_None; - } else if (value != Py_None && !PyTuple_Check(value)) { + } else if (unlikely(value != Py_None && !PyTuple_Check(value))) { PyErr_SetString(PyExc_TypeError, "__defaults__ must be set to a tuple object"); return -1; } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " + "currently affect the values used in function calls", 1); Py_INCREF(value); - tmp = op->defaults_tuple; - op->defaults_tuple = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->defaults_tuple, value); return 0; } static PyObject * -__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { PyObject* result = op->defaults_tuple; + CYTHON_UNUSED_VAR(context); if (unlikely(!result)) { if (op->defaults_getter) { - if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; result = op->defaults_tuple; } else { result = Py_None; @@ -10888,27 +14373,28 @@ __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *co return result; } static int -__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { - PyObject* tmp; +__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); if (!value) { value = Py_None; - } else if (value != Py_None && !PyDict_Check(value)) { + } else if (unlikely(value != Py_None && !PyDict_Check(value))) { PyErr_SetString(PyExc_TypeError, "__kwdefaults__ must be set to a dict object"); return -1; } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " + "currently affect the values used in function calls", 1); Py_INCREF(value); - tmp = op->defaults_kwdict; - op->defaults_kwdict = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); return 0; } static PyObject * -__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { PyObject* result = op->defaults_kwdict; + CYTHON_UNUSED_VAR(context); if (unlikely(!result)) { if (op->defaults_getter) { - if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; result = op->defaults_kwdict; } else { result = Py_None; @@ -10918,24 +14404,23 @@ __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void * return result; } static int -__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { - PyObject* tmp; +__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); if (!value || value == Py_None) { value = NULL; - } else if (!PyDict_Check(value)) { + } else if (unlikely(!PyDict_Check(value))) { PyErr_SetString(PyExc_TypeError, "__annotations__ must be set to a dict object"); return -1; } Py_XINCREF(value); - tmp = op->func_annotations; - op->func_annotations = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->func_annotations, value); return 0; } static PyObject * -__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { PyObject* result = op->func_annotations; + CYTHON_UNUSED_VAR(context); if (unlikely(!result)) { result = PyDict_New(); if (unlikely(!result)) return NULL; @@ -10944,13 +14429,42 @@ __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void Py_INCREF(result); return result; } +static PyObject * +__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { + int is_coroutine; + CYTHON_UNUSED_VAR(context); + if (op->func_is_coroutine) { + return __Pyx_NewRef(op->func_is_coroutine); + } + is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; +#if PY_VERSION_HEX >= 0x03050000 + if (is_coroutine) { + PyObject *module, *fromlist, *marker = __pyx_n_s_is_coroutine; + fromlist = PyList_New(1); + if (unlikely(!fromlist)) return NULL; + Py_INCREF(marker); + PyList_SET_ITEM(fromlist, 0, marker); + module = PyImport_ImportModuleLevelObject(__pyx_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0); + Py_DECREF(fromlist); + if (unlikely(!module)) goto ignore; + op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker); + Py_DECREF(module); + if (likely(op->func_is_coroutine)) { + return __Pyx_NewRef(op->func_is_coroutine); + } +ignore: + PyErr_Clear(); + } +#endif + op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine); + return __Pyx_NewRef(op->func_is_coroutine); +} static PyGetSetDef __pyx_CyFunction_getsets[] = { {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, - {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0}, {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, @@ -10963,20 +14477,37 @@ static PyGetSetDef __pyx_CyFunction_getsets[] = { {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, + {(char *) "_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, {0, 0, 0, 0, 0} }; static PyMemberDef __pyx_CyFunction_members[] = { - {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0}, + {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, +#if CYTHON_USE_TYPE_SPECS + {(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, +#if CYTHON_METH_FASTCALL +#if CYTHON_BACKPORT_VECTORCALL + {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, +#else + {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, +#endif +#endif +#if PY_VERSION_HEX < 0x030500A0 + {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, +#else + {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, +#endif +#endif {0, 0, 0, 0, 0} }; static PyObject * -__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args) +__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) { + CYTHON_UNUSED_VAR(args); #if PY_MAJOR_VERSION >= 3 Py_INCREF(m->func_qualname); return m->func_qualname; #else - return PyString_FromString(m->func.m_ml->ml_name); + return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name); #endif } static PyMethodDef __pyx_CyFunction_methods[] = { @@ -10986,26 +14517,31 @@ static PyMethodDef __pyx_CyFunction_methods[] = { #if PY_VERSION_HEX < 0x030500A0 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) #else -#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist) +#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) #endif static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + PyCFunctionObject *cf = (PyCFunctionObject*) op; if (unlikely(op == NULL)) return NULL; op->flags = flags; __Pyx_CyFunction_weakreflist(op) = NULL; - op->func.m_ml = ml; - op->func.m_self = (PyObject *) op; + cf->m_ml = ml; + cf->m_self = (PyObject *) op; Py_XINCREF(closure); op->func_closure = closure; Py_XINCREF(module); - op->func.m_module = module; + cf->m_module = module; op->func_dict = NULL; op->func_name = NULL; Py_INCREF(qualname); op->func_qualname = qualname; op->func_doc = NULL; +#if PY_VERSION_HEX < 0x030900B1 op->func_classobj = NULL; +#else + ((PyCMethodObject*)op)->mm_class = NULL; +#endif op->func_globals = globals; Py_INCREF(op->func_globals); Py_XINCREF(code); @@ -11017,23 +14553,56 @@ static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef * op->defaults_kwdict = NULL; op->defaults_getter = NULL; op->func_annotations = NULL; + op->func_is_coroutine = NULL; +#if CYTHON_METH_FASTCALL + switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { + case METH_NOARGS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; + break; + case METH_O: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; + break; + case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; + break; + case METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; + break; + case METH_VARARGS | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = NULL; + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + Py_DECREF(op); + return NULL; + } +#endif return (PyObject *) op; } static int __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) { Py_CLEAR(m->func_closure); - Py_CLEAR(m->func.m_module); + Py_CLEAR(((PyCFunctionObject*)m)->m_module); Py_CLEAR(m->func_dict); Py_CLEAR(m->func_name); Py_CLEAR(m->func_qualname); Py_CLEAR(m->func_doc); Py_CLEAR(m->func_globals); Py_CLEAR(m->func_code); - Py_CLEAR(m->func_classobj); +#if PY_VERSION_HEX < 0x030900B1 + Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); +#else + { + PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; + ((PyCMethodObject *) (m))->mm_class = NULL; + Py_XDECREF(cls); + } +#endif Py_CLEAR(m->defaults_tuple); Py_CLEAR(m->defaults_kwdict); Py_CLEAR(m->func_annotations); + Py_CLEAR(m->func_is_coroutine); if (m->defaults) { PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); int i; @@ -11049,7 +14618,7 @@ static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) if (__Pyx_CyFunction_weakreflist(m) != NULL) PyObject_ClearWeakRefs((PyObject *) m); __Pyx_CyFunction_clear(m); - PyObject_GC_Del(m); + __Pyx_PyHeapTypeObject_GC_Del(m); } static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) { @@ -11059,16 +14628,17 @@ static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) { Py_VISIT(m->func_closure); - Py_VISIT(m->func.m_module); + Py_VISIT(((PyCFunctionObject*)m)->m_module); Py_VISIT(m->func_dict); Py_VISIT(m->func_name); Py_VISIT(m->func_qualname); Py_VISIT(m->func_doc); Py_VISIT(m->func_globals); Py_VISIT(m->func_code); - Py_VISIT(m->func_classobj); + Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); Py_VISIT(m->defaults_tuple); Py_VISIT(m->defaults_kwdict); + Py_VISIT(m->func_is_coroutine); if (m->defaults) { PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); int i; @@ -11077,24 +14647,6 @@ static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, } return 0; } -static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) -{ -#if PY_MAJOR_VERSION < 3 - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { - Py_INCREF(func); - return func; - } - if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) { - if (type == NULL) - type = (PyObject *)(Py_TYPE(obj)); - return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type))); - } - if (obj == Py_None) - obj = NULL; -#endif - return __Pyx_PyMethod_New(func, obj, type); -} static PyObject* __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) { @@ -11151,9 +14703,7 @@ static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, Py } break; default: - PyErr_SetString(PyExc_SystemError, "Bad call flags in " - "__Pyx_CyFunction_Call. METH_OLDARGS is no " - "longer supported!"); + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); return NULL; } PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", @@ -11166,6 +14716,17 @@ static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *a static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { PyObject *result; __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; +#if CYTHON_METH_FASTCALL + __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); + if (vc) { +#if CYTHON_ASSUME_SAFE_MACROS + return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); +#else + (void) &__Pyx_PyVectorcall_FastCallDict; + return PyVectorcall_Call(func, args, kw); +#endif + } +#endif if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { Py_ssize_t argc; PyObject *new_args; @@ -11177,6 +14738,14 @@ static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, P self = PyTuple_GetItem(args, 0); if (unlikely(!self)) { Py_DECREF(new_args); +#if PY_MAJOR_VERSION > 2 + PyErr_Format(PyExc_TypeError, + "unbound method %.200S() needs an argument", + cyfunc->func_qualname); +#else + PyErr_SetString(PyExc_TypeError, + "unbound method needs an argument"); +#endif return NULL; } result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); @@ -11186,13 +14755,175 @@ static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, P } return result; } +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) +{ + int ret = 0; + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + if (unlikely(nargs < 1)) { + PyErr_Format(PyExc_TypeError, "%.200s() needs an argument", + ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); + return -1; + } + ret = 1; + } + if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); + return -1; + } + return ret; +} +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + if (unlikely(nargs != 0)) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + def->ml_name, nargs); + return NULL; + } + return def->ml_meth(self, NULL); +} +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + if (unlikely(nargs != 1)) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + def->ml_name, nargs); + return NULL; + } + return def->ml_meth(self, args[0]); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + return ((_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; + PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, (size_t)nargs, kwnames); +} +#endif +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_CyFunctionType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, + {Py_tp_repr, (void *)__Pyx_CyFunction_repr}, + {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, + {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, + {Py_tp_clear, (void *)__Pyx_CyFunction_clear}, + {Py_tp_methods, (void *)__pyx_CyFunction_methods}, + {Py_tp_members, (void *)__pyx_CyFunction_members}, + {Py_tp_getset, (void *)__pyx_CyFunction_getsets}, + {Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, + {0, 0}, +}; +static PyType_Spec __pyx_CyFunctionType_spec = { + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if (defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL) + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, + __pyx_CyFunctionType_slots +}; +#else static PyTypeObject __pyx_CyFunctionType_type = { PyVarObject_HEAD_INIT(0, 0) - "cython_function_or_method", + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", sizeof(__pyx_CyFunctionObject), 0, (destructor) __Pyx_CyFunction_dealloc, +#if !CYTHON_METH_FASTCALL 0, +#elif CYTHON_BACKPORT_VECTORCALL + (printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall), +#else + offsetof(PyCFunctionObject, vectorcall), +#endif 0, 0, #if PY_MAJOR_VERSION < 3 @@ -11210,7 +14941,13 @@ static PyTypeObject __pyx_CyFunctionType_type = { 0, 0, 0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#ifdef _Py_TPFLAGS_HAVE_VECTORCALL + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, 0, (traverseproc) __Pyx_CyFunction_traverse, (inquiry) __Pyx_CyFunction_clear, @@ -11227,7 +14964,7 @@ static PyTypeObject __pyx_CyFunctionType_type = { __pyx_CyFunction_getsets, 0, 0, - __Pyx_CyFunction_descr_get, + __Pyx_PyMethod_New, 0, offsetof(__pyx_CyFunctionObject, func_dict), 0, @@ -11248,15 +14985,24 @@ static PyTypeObject __pyx_CyFunctionType_type = { #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, #endif -#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 +#if __PYX_NEED_TP_PRINT_SLOT + 0, +#endif +#if PY_VERSION_HEX >= 0x030C0000 0, #endif -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, #endif }; -static int __pyx_CyFunction_init(void) { +#endif +static int __pyx_CyFunction_init(PyObject *module) { +#if CYTHON_USE_TYPE_SPECS + __pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL); +#else + CYTHON_UNUSED_VAR(module); __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); +#endif if (unlikely(__pyx_CyFunctionType == NULL)) { return -1; } @@ -11301,29 +15047,20 @@ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qual return op; } -/* PyObjectCallNoArg */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, NULL, 0); - } -#endif -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func))) -#else - if (likely(PyCFunction_Check(func))) -#endif - { - if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { - return __Pyx_PyObject_CallMethO(func, NULL); - } - } - return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); -} -#endif - /* UnpackUnboundCMethod */ +static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) { + PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args)); + if (unlikely(!selfless_args)) return NULL; + PyObject *result = PyObject_Call(method, selfless_args, kwargs); + Py_DECREF(selfless_args); + return result; +} +static PyMethodDef __Pyx_UnboundCMethod_Def = { + "CythonUnboundCMethod", + __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_SelflessCall), + METH_VARARGS | METH_KEYWORDS, + NULL +}; static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { PyObject *method; method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name); @@ -11333,13 +15070,43 @@ static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { #if CYTHON_COMPILING_IN_CPYTHON #if PY_MAJOR_VERSION >= 3 if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type))) + #else + if (likely(!PyCFunction_Check(method))) #endif { PyMethodDescrObject *descr = (PyMethodDescrObject*) method; target->func = descr->d_method->ml_meth; target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS); - } + } else +#endif +#if defined(CYTHON_COMPILING_IN_PYPY) +#elif PY_VERSION_HEX >= 0x03090000 + if (PyCFunction_CheckExact(method)) +#else + if (PyCFunction_Check(method)) +#endif + { + PyObject *self; + int self_found; +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + self = PyObject_GetAttrString(method, "__self__"); + if (!self) { + PyErr_Clear(); + } +#else + self = PyCFunction_GET_SELF(method); #endif + self_found = (self && self != Py_None); +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + Py_XDECREF(self); +#endif + if (self_found) { + PyObject *unbound_method = PyCFunction_New(&__Pyx_UnboundCMethod_Def, method); + if (unlikely(!unbound_method)) return -1; + Py_DECREF(method); + target->method = unbound_method; + } + } return 0; } @@ -11350,13 +15117,13 @@ static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* int flag = cfunc->flag; if (flag == METH_O) { return (*(cfunc->func))(self, arg); - } else if (PY_VERSION_HEX >= 0x030600B1 && flag == METH_FASTCALL) { - if (PY_VERSION_HEX >= 0x030700A0) { + } else if ((PY_VERSION_HEX >= 0x030600B1) && flag == METH_FASTCALL) { + #if PY_VERSION_HEX >= 0x030700A0 return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, &arg, 1); - } else { + #else return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL); - } - } else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) { + #endif + } else if ((PY_VERSION_HEX >= 0x030700A0) && flag == (METH_FASTCALL | METH_KEYWORDS)) { return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL); } } @@ -11454,7 +15221,7 @@ static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObje /* dict_getitem_default */ static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) { PyObject* value; -#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY +#if PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000) value = PyDict_GetItemWithError(d, key); if (unlikely(!value)) { if (unlikely(PyErr_Occurred())) @@ -11483,24 +15250,31 @@ static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObjec /* ExtTypeTest */ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + __Pyx_TypeName obj_type_name; + __Pyx_TypeName type_name; if (unlikely(!type)) { PyErr_SetString(PyExc_SystemError, "Missing type object"); return 0; } if (likely(__Pyx_TypeCheck(obj, type))) return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", - Py_TYPE(obj)->tp_name, type->tp_name); + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + type_name = __Pyx_PyType_GetName(type); + PyErr_Format(PyExc_TypeError, + "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME, + obj_type_name, type_name); + __Pyx_DECREF_TypeName(obj_type_name); + __Pyx_DECREF_TypeName(type_name); return 0; } /* GetTopmostException */ -#if CYTHON_USE_EXC_INFO_STACK +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate) { _PyErr_StackItem *exc_info = tstate->exc_info; - while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) && + while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) && exc_info->previous_item != NULL) { exc_info = exc_info->previous_item; @@ -11512,21 +15286,46 @@ __Pyx_PyErr_GetTopmostException(PyThreadState *tstate) /* SaveResetException */ #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - #if CYTHON_USE_EXC_INFO_STACK + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + PyObject *exc_value = exc_info->exc_value; + if (exc_value == NULL || exc_value == Py_None) { + *value = NULL; + *type = NULL; + *tb = NULL; + } else { + *value = exc_value; + Py_INCREF(*value); + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + *tb = PyException_GetTraceback(exc_value); + } + #elif CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); *type = exc_info->exc_type; *value = exc_info->exc_value; *tb = exc_info->exc_traceback; - #else + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #else *type = tstate->exc_type; *value = tstate->exc_value; *tb = tstate->exc_traceback; - #endif Py_XINCREF(*type); Py_XINCREF(*value); Py_XINCREF(*tb); + #endif } static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + PyObject *tmp_value = exc_info->exc_value; + exc_info->exc_value = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); + #else PyObject *tmp_type, *tmp_value, *tmp_tb; #if CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = tstate->exc_info; @@ -11547,6 +15346,7 @@ static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); + #endif } #endif @@ -11557,20 +15357,32 @@ static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) #endif { - PyObject *local_type, *local_value, *local_tb; + PyObject *local_type = NULL, *local_value, *local_tb = NULL; #if CYTHON_FAST_THREAD_STATE PyObject *tmp_type, *tmp_value, *tmp_tb; + #if PY_VERSION_HEX >= 0x030C00A6 + local_value = tstate->current_exception; + tstate->current_exception = 0; + if (likely(local_value)) { + local_type = (PyObject*) Py_TYPE(local_value); + Py_INCREF(local_type); + local_tb = PyException_GetTraceback(local_value); + } + #else local_type = tstate->curexc_type; local_value = tstate->curexc_value; local_tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; + #endif #else PyErr_Fetch(&local_type, &local_value, &local_tb); #endif PyErr_NormalizeException(&local_type, &local_value, &local_tb); -#if CYTHON_FAST_THREAD_STATE +#if CYTHON_FAST_THREAD_STATE && PY_VERSION_HEX >= 0x030C00A6 + if (unlikely(tstate->current_exception)) +#elif CYTHON_FAST_THREAD_STATE if (unlikely(tstate->curexc_type)) #else if (unlikely(PyErr_Occurred())) @@ -11592,12 +15404,21 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) #if CYTHON_USE_EXC_INFO_STACK { _PyErr_StackItem *exc_info = tstate->exc_info; + #if PY_VERSION_HEX >= 0x030B00a4 + tmp_value = exc_info->exc_value; + exc_info->exc_value = local_value; + tmp_type = NULL; + tmp_tb = NULL; + Py_XDECREF(local_type); + Py_XDECREF(local_tb); + #else tmp_type = exc_info->exc_type; tmp_value = exc_info->exc_value; tmp_tb = exc_info->exc_traceback; exc_info->exc_type = local_type; exc_info->exc_value = local_value; exc_info->exc_traceback = local_tb; + #endif } #else tmp_type = tstate->exc_type; @@ -11624,41 +15445,96 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) return -1; } +/* KeywordStringCheck */ +static int __Pyx_CheckKeywordStrings( + PyObject *kw, + const char* function_name, + int kw_allowed) +{ + PyObject* key = 0; + Py_ssize_t pos = 0; +#if CYTHON_COMPILING_IN_PYPY + if (!kw_allowed && PyDict_Next(kw, &pos, &key, 0)) + goto invalid_keyword; + return 1; +#else + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) { + if (unlikely(PyTuple_GET_SIZE(kw) == 0)) + return 1; + if (!kw_allowed) { + key = PyTuple_GET_ITEM(kw, 0); + goto invalid_keyword; + } +#if PY_VERSION_HEX < 0x03090000 + for (pos = 0; pos < PyTuple_GET_SIZE(kw); pos++) { + key = PyTuple_GET_ITEM(kw, pos); + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; + } +#endif + return 1; + } + while (PyDict_Next(kw, &pos, &key, 0)) { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_Check(key))) + #endif + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; + } + if (!kw_allowed && unlikely(key)) + goto invalid_keyword; + return 1; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + return 0; +#endif +invalid_keyword: + #if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_TypeError, + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif + return 0; +} + /* Import */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *empty_list = 0; PyObject *module = 0; - PyObject *global_dict = 0; PyObject *empty_dict = 0; - PyObject *list; + PyObject *empty_list = 0; #if PY_MAJOR_VERSION < 3 PyObject *py_import; py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (!py_import) + if (unlikely(!py_import)) goto bad; - #endif - if (from_list) - list = from_list; - else { + if (!from_list) { empty_list = PyList_New(0); - if (!empty_list) + if (unlikely(!empty_list)) goto bad; - list = empty_list; + from_list = empty_list; } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) - goto bad; + #endif empty_dict = PyDict_New(); - if (!empty_dict) + if (unlikely(!empty_dict)) goto bad; { #if PY_MAJOR_VERSION >= 3 if (level == -1) { if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { + #if CYTHON_COMPILING_IN_LIMITED_API module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, 1); - if (!module) { - if (!PyErr_ExceptionMatches(PyExc_ImportError)) + name, empty_dict, empty_dict, from_list, 1); + #else + module = PyImport_ImportModuleLevelObject( + name, __pyx_d, empty_dict, from_list, 1); + #endif + if (unlikely(!module)) { + if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError))) goto bad; PyErr_Clear(); } @@ -11669,23 +15545,28 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { if (!module) { #if PY_MAJOR_VERSION < 3 PyObject *py_level = PyInt_FromLong(level); - if (!py_level) + if (unlikely(!py_level)) goto bad; module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, (PyObject *)NULL); + name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL); Py_DECREF(py_level); #else + #if CYTHON_COMPILING_IN_LIMITED_API + module = PyImport_ImportModuleLevelObject( + name, empty_dict, empty_dict, from_list, level); + #else module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, level); + name, __pyx_d, empty_dict, from_list, level); + #endif #endif } } bad: + Py_XDECREF(empty_dict); + Py_XDECREF(empty_list); #if PY_MAJOR_VERSION < 3 Py_XDECREF(py_import); #endif - Py_XDECREF(empty_list); - Py_XDECREF(empty_dict); return module; } @@ -11693,6 +15574,35 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + const char* module_name_str = 0; + PyObject* module_name = 0; + PyObject* module_dot = 0; + PyObject* full_name = 0; + PyErr_Clear(); + module_name_str = PyModule_GetName(module); + if (unlikely(!module_name_str)) { goto modbad; } + module_name = PyUnicode_FromString(module_name_str); + if (unlikely(!module_name)) { goto modbad; } + module_dot = PyUnicode_Concat(module_name, __pyx_kp_u__17); + if (unlikely(!module_dot)) { goto modbad; } + full_name = PyUnicode_Concat(module_dot, name); + if (unlikely(!full_name)) { goto modbad; } + #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) + { + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + goto modbad; + value = PyObject_GetItem(modules, full_name); + } + #else + value = PyImport_GetModule(full_name); + #endif + modbad: + Py_XDECREF(full_name); + Py_XDECREF(module_dot); + Py_XDECREF(module_name); + } + if (unlikely(!value)) { PyErr_Format(PyExc_ImportError, #if PY_MAJOR_VERSION < 3 "cannot import name %.230s", PyString_AS_STRING(name)); @@ -11703,6 +15613,19 @@ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { return value; } +/* GetAttr */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { +#if CYTHON_USE_TYPE_SLOTS +#if PY_MAJOR_VERSION >= 3 + if (likely(PyUnicode_Check(n))) +#else + if (likely(PyString_Check(n))) +#endif + return __Pyx_PyObject_GetAttrStr(o, n); +#endif + return PyObject_GetAttr(o, n); +} + /* HasAttr */ static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { PyObject *r; @@ -11712,7 +15635,7 @@ static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { return -1; } r = __Pyx_GetAttr(o, n); - if (unlikely(!r)) { + if (!r) { PyErr_Clear(); return 0; } else { @@ -11724,7 +15647,7 @@ static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { /* GetItemInt */ static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; - if (!j) return NULL; + if (unlikely(!j)) return NULL; r = PyObject_GetItem(o, j); Py_DECREF(j); return r; @@ -11785,10 +15708,18 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, return r; } } else { - PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; - if (likely(m && m->sq_item)) { - if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { - Py_ssize_t l = m->sq_length(o); + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (mm && mm->mp_subscript) { + PyObject *r, *key = PyInt_FromSsize_t(i); + if (unlikely(!key)) return NULL; + r = mm->mp_subscript(o, key); + Py_DECREF(key); + return r; + } + if (likely(sm && sm->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); if (likely(l >= 0)) { i += l; } else { @@ -11797,7 +15728,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, PyErr_Clear(); } } - return m->sq_item(o, i); + return sm->sq_item(o, i); } } #else @@ -11808,17 +15739,266 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } +/* PyObjectCallNoArg */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { + PyObject *arg = NULL; + return __Pyx_PyObject_FastCall(func, (&arg)+1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* PyObjectGetMethod */ +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { + PyObject *attr; +#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP + __Pyx_TypeName type_name; + PyTypeObject *tp = Py_TYPE(obj); + PyObject *descr; + descrgetfunc f = NULL; + PyObject **dictptr, *dict; + int meth_found = 0; + assert (*method == NULL); + if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) { + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; + } + if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) { + return 0; + } + descr = _PyType_Lookup(tp, name); + if (likely(descr != NULL)) { + Py_INCREF(descr); +#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR + if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR)) +#elif PY_MAJOR_VERSION >= 3 + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) + #else + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type))) + #endif +#else + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr))) + #else + if (likely(PyFunction_Check(descr))) + #endif +#endif + { + meth_found = 1; + } else { + f = Py_TYPE(descr)->tp_descr_get; + if (f != NULL && PyDescr_IsData(descr)) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + } + } + dictptr = _PyObject_GetDictPtr(obj); + if (dictptr != NULL && (dict = *dictptr) != NULL) { + Py_INCREF(dict); + attr = __Pyx_PyDict_GetItemStr(dict, name); + if (attr != NULL) { + Py_INCREF(attr); + Py_DECREF(dict); + Py_XDECREF(descr); + goto try_unpack; + } + Py_DECREF(dict); + } + if (meth_found) { + *method = descr; + return 1; + } + if (f != NULL) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + if (likely(descr != NULL)) { + *method = descr; + return 0; + } + type_name = __Pyx_PyType_GetName(tp); + PyErr_Format(PyExc_AttributeError, +#if PY_MAJOR_VERSION >= 3 + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, name); +#else + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", + type_name, PyString_AS_STRING(name)); +#endif + __Pyx_DECREF_TypeName(type_name); + return 0; +#else + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; +#endif +try_unpack: +#if CYTHON_UNPACK_METHODS + if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) { + PyObject *function = PyMethod_GET_FUNCTION(attr); + Py_INCREF(function); + Py_DECREF(attr); + *method = function; + return 1; + } +#endif + *method = attr; + return 0; +} + +/* PyObjectCallMethod0 */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { + PyObject *method = NULL, *result = NULL; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_CallOneArg(method, obj); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) goto bad; + result = __Pyx_PyObject_CallNoArg(method); + Py_DECREF(method); +bad: + return result; +} + +/* ValidateBasesTuple */ +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) { + Py_ssize_t i, n = PyTuple_GET_SIZE(bases); + for (i = 1; i < n; i++) + { + PyObject *b0 = PyTuple_GET_ITEM(bases, i); + PyTypeObject *b; +#if PY_MAJOR_VERSION < 3 + if (PyClass_Check(b0)) + { + PyErr_Format(PyExc_TypeError, "base class '%.200s' is an old-style class", + PyString_AS_STRING(((PyClassObject*)b0)->cl_name)); + return -1; + } +#endif + b = (PyTypeObject*) b0; + if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE)) + { + __Pyx_TypeName b_name = __Pyx_PyType_GetName(b); + PyErr_Format(PyExc_TypeError, + "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name); + __Pyx_DECREF_TypeName(b_name); + return -1; + } + if (dictoffset == 0 && b->tp_dictoffset) + { + __Pyx_TypeName b_name = __Pyx_PyType_GetName(b); + PyErr_Format(PyExc_TypeError, + "extension type '%.200s' has no __dict__ slot, " + "but base type '" __Pyx_FMT_TYPENAME "' has: " + "either add 'cdef dict __dict__' to the extension type " + "or add '__slots__ = [...]' to the base type", + type_name, b_name); + __Pyx_DECREF_TypeName(b_name); + return -1; + } + } + return 0; +} +#endif + +/* PyType_Ready */ +static int __Pyx_PyType_Ready(PyTypeObject *t) { +#if CYTHON_USE_TYPE_SPECS || !(CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API) || defined(PYSTON_MAJOR_VERSION) + (void)__Pyx_PyObject_CallMethod0; +#if CYTHON_USE_TYPE_SPECS + (void)__Pyx_validate_bases_tuple; +#endif + return PyType_Ready(t); +#else + int r; + PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); + if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1)) + return -1; +#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION) + { + int gc_was_enabled; + #if PY_VERSION_HEX >= 0x030A00b1 + gc_was_enabled = PyGC_Disable(); + (void)__Pyx_PyObject_CallMethod0; + #else + PyObject *ret, *py_status; + PyObject *gc = NULL; + #if PY_VERSION_HEX >= 0x030700a1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) + gc = PyImport_GetModule(__pyx_kp_u_gc); + #endif + if (unlikely(!gc)) gc = PyImport_Import(__pyx_kp_u_gc); + if (unlikely(!gc)) return -1; + py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_isenabled); + if (unlikely(!py_status)) { + Py_DECREF(gc); + return -1; + } + gc_was_enabled = __Pyx_PyObject_IsTrue(py_status); + Py_DECREF(py_status); + if (gc_was_enabled > 0) { + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_disable); + if (unlikely(!ret)) { + Py_DECREF(gc); + return -1; + } + Py_DECREF(ret); + } else if (unlikely(gc_was_enabled == -1)) { + Py_DECREF(gc); + return -1; + } + #endif + t->tp_flags |= Py_TPFLAGS_HEAPTYPE; +#if PY_VERSION_HEX >= 0x030A0000 + t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE; +#endif +#else + (void)__Pyx_PyObject_CallMethod0; +#endif + r = PyType_Ready(t); +#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION) + t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE; + #if PY_VERSION_HEX >= 0x030A00b1 + if (gc_was_enabled) + PyGC_Enable(); + #else + if (gc_was_enabled) { + PyObject *tp, *v, *tb; + PyErr_Fetch(&tp, &v, &tb); + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_enable); + if (likely(ret || r == -1)) { + Py_XDECREF(ret); + PyErr_Restore(tp, v, tb); + } else { + Py_XDECREF(tp); + Py_XDECREF(v); + Py_XDECREF(tb); + r = -1; + } + } + Py_DECREF(gc); + #endif + } +#endif + return r; +#endif +} + /* PyObject_GenericGetAttrNoDict */ #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { + __Pyx_TypeName type_name = __Pyx_PyType_GetName(tp); PyErr_Format(PyExc_AttributeError, #if PY_MAJOR_VERSION >= 3 - "'%.50s' object has no attribute '%U'", - tp->tp_name, attr_name); + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, attr_name); #else - "'%.50s' object has no attribute '%.400s'", - tp->tp_name, PyString_AS_STRING(attr_name)); + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", + type_name, PyString_AS_STRING(attr_name)); #endif + __Pyx_DECREF_TypeName(type_name); return NULL; } static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { @@ -11859,15 +16039,15 @@ static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_nam #endif /* SetVTable */ -static int __Pyx_SetVtable(PyObject *dict, void *vtable) { -#if PY_VERSION_HEX >= 0x02070000 +static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) { PyObject *ob = PyCapsule_New(vtable, 0, 0); + if (unlikely(!ob)) + goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_n_s_pyx_vtable, ob) < 0)) #else - PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); + if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_n_s_pyx_vtable, ob) < 0)) #endif - if (!ob) - goto bad; - if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0) goto bad; Py_DECREF(ob); return 0; @@ -11876,33 +16056,85 @@ static int __Pyx_SetVtable(PyObject *dict, void *vtable) { return -1; } -/* PyObjectGetAttrStrNoError */ -static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) - __Pyx_PyErr_Clear(); +/* GetVTable */ +static void* __Pyx_GetVtable(PyTypeObject *type) { + void* ptr; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_n_s_pyx_vtable); +#else + PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_n_s_pyx_vtable); +#endif + if (!ob) + goto bad; + ptr = PyCapsule_GetPointer(ob, 0); + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; } -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { - PyObject *result; -#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { - return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + +/* MergeVTables */ +#if !CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_MergeVtables(PyTypeObject *type) { + int i; + void** base_vtables; + __Pyx_TypeName tp_base_name; + __Pyx_TypeName base_name; + void* unknown = (void*)-1; + PyObject* bases = type->tp_bases; + int base_depth = 0; + { + PyTypeObject* base = type->tp_base; + while (base) { + base_depth += 1; + base = base->tp_base; + } } -#endif - result = __Pyx_PyObject_GetAttrStr(obj, attr_name); - if (unlikely(!result)) { - __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + base_vtables = (void**) malloc(sizeof(void*) * (size_t)(base_depth + 1)); + base_vtables[0] = unknown; + for (i = 1; i < PyTuple_GET_SIZE(bases); i++) { + void* base_vtable = __Pyx_GetVtable(((PyTypeObject*)PyTuple_GET_ITEM(bases, i))); + if (base_vtable != NULL) { + int j; + PyTypeObject* base = type->tp_base; + for (j = 0; j < base_depth; j++) { + if (base_vtables[j] == unknown) { + base_vtables[j] = __Pyx_GetVtable(base); + base_vtables[j + 1] = unknown; + } + if (base_vtables[j] == base_vtable) { + break; + } else if (base_vtables[j] == NULL) { + goto bad; + } + base = base->tp_base; + } + } } - return result; + PyErr_Clear(); + free(base_vtables); + return 0; +bad: + tp_base_name = __Pyx_PyType_GetName(type->tp_base); + base_name = __Pyx_PyType_GetName((PyTypeObject*)PyTuple_GET_ITEM(bases, i)); + PyErr_Format(PyExc_TypeError, + "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name); + __Pyx_DECREF_TypeName(tp_base_name); + __Pyx_DECREF_TypeName(base_name); + free(base_vtables); + return -1; } +#endif /* SetupReduce */ +#if !CYTHON_COMPILING_IN_LIMITED_API static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { int ret; PyObject *name_attr; - name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name); + name_attr = __Pyx_PyObject_GetAttrStrNoError(meth, __pyx_n_s_name); if (likely(name_attr)) { ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); } else { @@ -11918,17 +16150,35 @@ static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { static int __Pyx_setup_reduce(PyObject* type_obj) { int ret = 0; PyObject *object_reduce = NULL; + PyObject *object_getstate = NULL; PyObject *object_reduce_ex = NULL; PyObject *reduce = NULL; PyObject *reduce_ex = NULL; PyObject *reduce_cython = NULL; PyObject *setstate = NULL; PyObject *setstate_cython = NULL; + PyObject *getstate = NULL; +#if CYTHON_USE_PYTYPE_LOOKUP + getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate); +#else + getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_getstate); + if (!getstate && PyErr_Occurred()) { + goto __PYX_BAD; + } +#endif + if (getstate) { #if CYTHON_USE_PYTYPE_LOOKUP - if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD; + object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_getstate); #else - if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD; + object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_n_s_getstate); + if (!object_getstate && PyErr_Occurred()) { + goto __PYX_BAD; + } #endif + if (object_getstate != getstate) { + goto __PYX_GOOD; + } + } #if CYTHON_USE_PYTYPE_LOOKUP object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; #else @@ -11950,7 +16200,7 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { } else if (reduce == object_reduce || PyErr_Occurred()) { goto __PYX_BAD; } - setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate); + setstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate); if (!setstate) PyErr_Clear(); if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) { setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython); @@ -11966,13 +16216,20 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { } goto __PYX_GOOD; __PYX_BAD: - if (!PyErr_Occurred()) - PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name); + if (!PyErr_Occurred()) { + __Pyx_TypeName type_obj_name = + __Pyx_PyType_GetName((PyTypeObject*)type_obj); + PyErr_Format(PyExc_RuntimeError, + "Unable to initialize pickling for " __Pyx_FMT_TYPENAME, type_obj_name); + __Pyx_DECREF_TypeName(type_obj_name); + } ret = -1; __PYX_GOOD: #if !CYTHON_USE_PYTYPE_LOOKUP Py_XDECREF(object_reduce); Py_XDECREF(object_reduce_ex); + Py_XDECREF(object_getstate); + Py_XDECREF(getstate); #endif Py_XDECREF(reduce); Py_XDECREF(reduce_ex); @@ -11981,18 +16238,21 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { Py_XDECREF(setstate_cython); return ret; } +#endif /* TypeImport */ -#ifndef __PYX_HAVE_RT_ImportType -#define __PYX_HAVE_RT_ImportType -static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name, - size_t size, enum __Pyx_ImportType_CheckSize check_size) +#ifndef __PYX_HAVE_RT_ImportType_3_0_0 +#define __PYX_HAVE_RT_ImportType_3_0_0 +static PyTypeObject *__Pyx_ImportType_3_0_0(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_0 check_size) { PyObject *result = 0; char warning[200]; Py_ssize_t basicsize; -#ifdef Py_LIMITED_API + Py_ssize_t itemsize; +#if CYTHON_COMPILING_IN_LIMITED_API PyObject *py_basicsize; + PyObject *py_itemsize; #endif result = PyObject_GetAttrString(module, class_name); if (!result) @@ -12003,8 +16263,9 @@ static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, module_name, class_name); goto bad; } -#ifndef Py_LIMITED_API +#if !CYTHON_COMPILING_IN_LIMITED_API basicsize = ((PyTypeObject *)result)->tp_basicsize; + itemsize = ((PyTypeObject *)result)->tp_itemsize; #else py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); if (!py_basicsize) @@ -12014,22 +16275,38 @@ static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, py_basicsize = 0; if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) goto bad; + py_itemsize = PyObject_GetAttrString(result, "__itemsize__"); + if (!py_itemsize) + goto bad; + itemsize = PyLong_AsSsize_t(py_itemsize); + Py_DECREF(py_itemsize); + py_itemsize = 0; + if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; #endif - if ((size_t)basicsize < size) { + if (itemsize) { + if (size % alignment) { + alignment = size % alignment; + } + if (itemsize < (Py_ssize_t)alignment) + itemsize = (Py_ssize_t)alignment; + } + if ((size_t)(basicsize + itemsize) < size) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); + module_name, class_name, size, basicsize+itemsize); goto bad; } - if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) { + if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_0 && + ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); + "Expected %zd from C header, got %zd-%zd from PyObject", + module_name, class_name, size, basicsize, basicsize+itemsize); goto bad; } - else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) { + else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_0 && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", @@ -12043,6 +16320,134 @@ static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, } #endif +/* ImportDottedModule */ +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx__ImportDottedModule_Error(PyObject *name, PyObject *parts_tuple, Py_ssize_t count) { + PyObject *partial_name = NULL, *slice = NULL, *sep = NULL; + if (unlikely(PyErr_Occurred())) { + PyErr_Clear(); + } + if (likely(PyTuple_GET_SIZE(parts_tuple) == count)) { + partial_name = name; + } else { + slice = PySequence_GetSlice(parts_tuple, 0, count); + if (unlikely(!slice)) + goto bad; + sep = PyUnicode_FromStringAndSize(".", 1); + if (unlikely(!sep)) + goto bad; + partial_name = PyUnicode_Join(sep, slice); + } + PyErr_Format( +#if PY_MAJOR_VERSION < 3 + PyExc_ImportError, + "No module named '%s'", PyString_AS_STRING(partial_name)); +#else +#if PY_VERSION_HEX >= 0x030600B1 + PyExc_ModuleNotFoundError, +#else + PyExc_ImportError, +#endif + "No module named '%U'", partial_name); +#endif +bad: + Py_XDECREF(sep); + Py_XDECREF(slice); + Py_XDECREF(partial_name); + return NULL; +} +#endif +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx__ImportDottedModule_Lookup(PyObject *name) { + PyObject *imported_module; +#if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + return NULL; + imported_module = __Pyx_PyDict_GetItemStr(modules, name); + Py_XINCREF(imported_module); +#else + imported_module = PyImport_GetModule(name); +#endif + return imported_module; +} +#endif +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple) { + Py_ssize_t i, nparts; + nparts = PyTuple_GET_SIZE(parts_tuple); + for (i=1; i < nparts && module; i++) { + PyObject *part, *submodule; +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + part = PyTuple_GET_ITEM(parts_tuple, i); +#else + part = PySequence_ITEM(parts_tuple, i); +#endif + submodule = __Pyx_PyObject_GetAttrStrNoError(module, part); +#if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(part); +#endif + Py_DECREF(module); + module = submodule; + } + if (unlikely(!module)) { + return __Pyx__ImportDottedModule_Error(name, parts_tuple, i); + } + return module; +} +#endif +static PyObject *__Pyx__ImportDottedModule(PyObject *name, PyObject *parts_tuple) { +#if PY_MAJOR_VERSION < 3 + PyObject *module, *from_list, *star = __pyx_n_s__18; + CYTHON_UNUSED_VAR(parts_tuple); + from_list = PyList_New(1); + if (unlikely(!from_list)) + return NULL; + Py_INCREF(star); + PyList_SET_ITEM(from_list, 0, star); + module = __Pyx_Import(name, from_list, 0); + Py_DECREF(from_list); + return module; +#else + PyObject *imported_module; + PyObject *module = __Pyx_Import(name, NULL, 0); + if (!parts_tuple || unlikely(!module)) + return module; + imported_module = __Pyx__ImportDottedModule_Lookup(name); + if (likely(imported_module)) { + Py_DECREF(module); + return imported_module; + } + PyErr_Clear(); + return __Pyx_ImportDottedModule_WalkParts(module, name, parts_tuple); +#endif +} +static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030400B1 + PyObject *module = __Pyx__ImportDottedModule_Lookup(name); + if (likely(module)) { + PyObject *spec = __Pyx_PyObject_GetAttrStrNoError(module, __pyx_n_s_spec); + if (likely(spec)) { + PyObject *unsafe = __Pyx_PyObject_GetAttrStrNoError(spec, __pyx_n_s_initializing); + if (likely(!unsafe || !__Pyx_PyObject_IsTrue(unsafe))) { + Py_DECREF(spec); + spec = NULL; + } + Py_XDECREF(unsafe); + } + if (likely(!spec)) { + PyErr_Clear(); + return module; + } + Py_DECREF(spec); + Py_DECREF(module); + } else if (PyErr_Occurred()) { + PyErr_Clear(); + } +#endif + return __Pyx__ImportDottedModule(name, parts_tuple); +} + /* ClassMethod */ static PyObject* __Pyx_Method_ClassMethod(PyObject *method) { #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM <= 0x05080000 @@ -12050,14 +16455,14 @@ static PyObject* __Pyx_Method_ClassMethod(PyObject *method) { return PyClassMethod_New(method); } #else -#if CYTHON_COMPILING_IN_PYSTON || CYTHON_COMPILING_IN_PYPY +#if CYTHON_COMPILING_IN_PYPY if (PyMethodDescr_Check(method)) #else #if PY_MAJOR_VERSION == 2 static PyTypeObject *methoddescr_type = NULL; - if (methoddescr_type == NULL) { + if (unlikely(methoddescr_type == NULL)) { PyObject *meth = PyObject_GetAttrString((PyObject*)&PyList_Type, "append"); - if (!meth) return NULL; + if (unlikely(!meth)) return NULL; methoddescr_type = Py_TYPE(meth); Py_DECREF(meth); } @@ -12085,33 +16490,37 @@ static PyObject* __Pyx_Method_ClassMethod(PyObject *method) { } /* GetNameInClass */ -static PyObject *__Pyx_GetGlobalNameAfterAttributeLookup(PyObject *name) { - PyObject *result; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) - return NULL; - __Pyx_PyErr_Clear(); - __Pyx_GetModuleGlobalNameUncached(result, name); - return result; -} static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name) { PyObject *result; - result = __Pyx_PyObject_GetAttrStr(nmspace, name); - if (!result) { - result = __Pyx_GetGlobalNameAfterAttributeLookup(name); + PyObject *dict; + assert(PyType_Check(nmspace)); +#if CYTHON_USE_TYPE_SLOTS + dict = ((PyTypeObject*)nmspace)->tp_dict; + Py_XINCREF(dict); +#else + dict = PyObject_GetAttr(nmspace, __pyx_n_s_dict); +#endif + if (likely(dict)) { + result = PyObject_GetItem(dict, name); + Py_DECREF(dict); + if (result) { + return result; + } } + PyErr_Clear(); + __Pyx_GetModuleGlobalNameUncached(result, name); return result; } /* CLineInTraceback */ #ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) { +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { PyObject *use_cline; PyObject *ptype, *pvalue, *ptraceback; #if CYTHON_COMPILING_IN_CPYTHON PyObject **cython_runtime_dict; #endif + CYTHON_MAYBE_UNUSED_VAR(tstate); if (unlikely(!__pyx_cython_runtime)) { return c_line; } @@ -12125,7 +16534,7 @@ static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int } else #endif { - PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); + PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); if (use_cline_obj) { use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; Py_DECREF(use_cline_obj); @@ -12147,6 +16556,7 @@ static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int #endif /* CodeObjectCache */ +#if !CYTHON_COMPILING_IN_LIMITED_API static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { @@ -12225,11 +16635,28 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { __pyx_code_cache.count++; Py_INCREF(code_object); } +#endif /* AddTraceback */ #include "compile.h" #include "frameobject.h" #include "traceback.h" +#if PY_VERSION_HEX >= 0x030b00a6 + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif +#if CYTHON_COMPILING_IN_LIMITED_API +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + if (c_line) { + (void) __pyx_cfilenm; + (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); + } + _PyTraceback_Add(funcname, filename, py_line); +} +#else static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { @@ -12264,6 +16691,7 @@ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( 0, 0, 0, + 0, __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ @@ -12293,14 +16721,24 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject *ptype, *pvalue, *ptraceback; if (c_line) { c_line = __Pyx_CLineForTraceback(tstate, c_line); } py_code = __pyx_find_code_object(c_line ? -c_line : py_line); if (!py_code) { + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); - if (!py_code) goto bad; + if (!py_code) { + /* If the code object creation fails, then we should clear the + fetched exception references and propagate the new exception */ + Py_XDECREF(ptype); + Py_XDECREF(pvalue); + Py_XDECREF(ptraceback); + goto bad; + } + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); } py_frame = PyFrame_New( @@ -12316,6 +16754,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, Py_XDECREF(py_code); Py_XDECREF(py_frame); } +#endif /* CIntFromPyVerify */ #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ @@ -12352,7 +16791,7 @@ static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(size_t) < sizeof(long)) { + if ((sizeof(size_t) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -12366,40 +16805,45 @@ static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (size_t) 0; - case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0]) - case 2: - if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) { - return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(size_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 2 * PyLong_SHIFT)) { + return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) { - return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + break; + case 3: + if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 3 * PyLong_SHIFT)) { + return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) { - return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + break; + case 4: + if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 4 * PyLong_SHIFT)) { + return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -12412,109 +16856,181 @@ static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { goto raise_neg_overflow; } #endif - if (sizeof(size_t) <= sizeof(unsigned long)) { + if ((sizeof(size_t) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (size_t) 0; - case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, +digits[0]) - case -2: - if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { - return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(size_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { - return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + break; + case 2: + if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { - return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + break; + case -3: + if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { - return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + break; + case 3: + if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) { - return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + break; + case -4: + if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) { - return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + break; + case 4: + if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) { + return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(size_t) <= sizeof(long)) { + if ((sizeof(size_t) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(size_t) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else size_t val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (size_t) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (size_t) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (size_t) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (size_t) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (size_t) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(size_t) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((size_t) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(size_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((size_t) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((size_t) 1) << (sizeof(size_t) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (size_t) -1; } } else { @@ -12548,7 +17064,7 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { + if ((sizeof(long) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -12562,40 +17078,45 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -12608,109 +17129,181 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { goto raise_neg_overflow; } #endif - if (sizeof(long) <= sizeof(unsigned long)) { + if ((sizeof(long) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) - case -2: - if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case -3: + if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case -4: + if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(long) <= sizeof(long)) { + if ((sizeof(long) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else long val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (long) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (long) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (long) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (long) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (long) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((long) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((long) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (long) -1; } } else { @@ -12769,6 +17362,21 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { } } +/* FormatTypeName */ +#if CYTHON_COMPILING_IN_LIMITED_API +static __Pyx_TypeName +__Pyx_PyType_GetName(PyTypeObject* tp) +{ + PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_n_s_name); + if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { + PyErr_Clear(); + Py_XSETREF(name, __Pyx_NewRef(__pyx_n_s__42)); + } + return name; +} +#endif + /* CIntFromPy */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC @@ -12782,7 +17390,7 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { + if ((sizeof(int) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -12796,40 +17404,45 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -12842,109 +17455,181 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { goto raise_neg_overflow; } #endif - if (sizeof(int) <= sizeof(unsigned long)) { + if ((sizeof(int) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case -3: + if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case -4: + if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(int) <= sizeof(long)) { + if ((sizeof(int) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else int val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (int) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (int) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (int) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (int) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((int) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (int) -1; } } else { @@ -12969,7 +17654,7 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { #if CYTHON_COMPILING_IN_CPYTHON static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { while (a) { - a = a->tp_base; + a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); if (a == b) return 1; } @@ -12990,6 +17675,22 @@ static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { } return __Pyx_InBases(a, b); } +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (cls == a || cls == b) return 1; + mro = cls->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + PyObject *base = PyTuple_GET_ITEM(mro, i); + if (base == (PyObject *)a || base == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); +} #if PY_MAJOR_VERSION == 2 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { PyObject *exception, *value, *tb; @@ -13014,11 +17715,11 @@ static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc } #else static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { - int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0; - if (!res) { - res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); + if (exc_type1) { + return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); + } else { + return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); } - return res; } #endif static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { @@ -13067,13 +17768,35 @@ static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObj /* CheckBinaryVersion */ 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 ctversion[5]; + int same=1, i, found_dot; + const char* rt_from_call = Py_GetVersion(); + PyOS_snprintf(ctversion, 5, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + found_dot = 0; + for (i = 0; i < 4; i++) { + if (!ctversion[i]) { + same = (rt_from_call[i] < '0' || rt_from_call[i] > '9'); + break; + } + if (rt_from_call[i] != ctversion[i]) { + same = 0; + break; + } + } + if (!same) { + char rtversion[5] = {'\0'}; char message[200]; + for (i=0; i<4; ++i) { + if (rt_from_call[i] == '.') { + if (found_dot) break; + found_dot = 1; + } else if (rt_from_call[i] < '0' || rt_from_call[i] > '9') { + break; + } + rtversion[i] = rt_from_call[i]; + } PyOS_snprintf(message, sizeof(message), - "compiletime version %s of module '%.100s' " + "compile time version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); return PyErr_WarnEx(NULL, message, 1); @@ -13100,11 +17823,7 @@ static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *s goto bad; } tmp.fp = f; -#if PY_VERSION_HEX >= 0x02070000 cobj = PyCapsule_New(tmp.p, sig, 0); -#else - cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0); -#endif if (!cobj) goto bad; if (PyDict_SetItemString(d, name, cobj) < 0) @@ -13119,9 +17838,31 @@ static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *s } /* InitStrings */ +#if PY_MAJOR_VERSION >= 3 +static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) { + if (t.is_unicode | t.is_str) { + if (t.intern) { + *str = PyUnicode_InternFromString(t.s); + } else if (t.encoding) { + *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL); + } else { + *str = PyUnicode_FromStringAndSize(t.s, t.n - 1); + } + } else { + *str = PyBytes_FromStringAndSize(t.s, t.n - 1); + } + if (!*str) + return -1; + if (PyObject_Hash(*str) == -1) + return -1; + return 0; +} +#endif static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { - #if PY_MAJOR_VERSION < 3 + #if PY_MAJOR_VERSION >= 3 + __Pyx_InitString(*t, t->p); + #else if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { @@ -13129,23 +17870,11 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } - #else - 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; if (PyObject_Hash(*t->p) == -1) return -1; + #endif ++t; } return 0; @@ -13207,7 +17936,7 @@ static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ return __Pyx_PyUnicode_AsStringAndSize(o, length); } else #endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) +#if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) if (PyByteArray_Check(o)) { *length = PyByteArray_GET_SIZE(o); return PyByteArray_AS_STRING(o); @@ -13236,22 +17965,26 @@ static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { return retval; } static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { + __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result)); #if PY_MAJOR_VERSION >= 3 if (PyLong_Check(result)) { if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, - "__int__ returned non-int (type %.200s). " - "The ability to return an instance of a strict subclass of int " - "is deprecated, and may be removed in a future version of Python.", - Py_TYPE(result)->tp_name)) { + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " + "The ability to return an instance of a strict subclass of int is deprecated, " + "and may be removed in a future version of Python.", + result_type_name)) { + __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } + __Pyx_DECREF_TypeName(result_type_name); return result; } #endif PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type %.200s)", - type_name, type_name, Py_TYPE(result)->tp_name); + "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")", + type_name, type_name, result_type_name); + __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } @@ -13317,13 +18050,11 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { #endif if (likely(PyLong_CheckExact(b))) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)b)->ob_digit; - const Py_ssize_t size = Py_SIZE(b); - if (likely(__Pyx_sst_abs(size) <= 1)) { - ival = likely(size) ? digits[0] : 0; - if (size == -1) ival = -ival; - return ival; + if (likely(__Pyx_PyLong_IsCompact(b))) { + return __Pyx_PyLong_CompactValue(b); } else { + const digit* digits = __Pyx_PyLong_Digits(b); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); switch (size) { case 2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { @@ -13391,4 +18122,12 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { } +/* #### Code section: utility_code_pragmas_end ### */ +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + + + +/* #### Code section: end ### */ #endif /* Py_PYTHON_H */ diff --git a/arrex/list.c b/arrex/list.c index dc81a28..b1a0c94 100644 --- a/arrex/list.c +++ b/arrex/list.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.29.28 */ +/* Generated by Cython 3.0.0 */ /* BEGIN: Cython Metadata { @@ -16,20 +16,49 @@ END: Cython Metadata */ #ifndef PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN #endif /* PY_SSIZE_T_CLEAN */ +#if defined(CYTHON_LIMITED_API) && 0 + #ifndef Py_LIMITED_API + #if CYTHON_LIMITED_API+0 > 0x03030000 + #define Py_LIMITED_API CYTHON_LIMITED_API + #else + #define Py_LIMITED_API 0x03030000 + #endif + #endif +#endif + #include "Python.h" + + #if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyFloat_FromString(obj) PyFloat_FromString(obj) + #else + #define __Pyx_PyFloat_FromString(obj) PyFloat_FromString(obj, NULL) + #endif + + + #if PY_MAJOR_VERSION <= 2 + #define PyDict_GetItemWithError _PyDict_GetItemWithError + #endif + + + #if (PY_VERSION_HEX < 0x030700b1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030600)) && !defined(PyContextVar_Get) + #define PyContextVar_Get(var, d, v) ((d) ? ((void)(var), Py_INCREF(d), (v)[0] = (d), 0) : ((v)[0] = NULL, 0) ) + #endif + #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) - #error Cython requires Python 2.6+ or Python 3.3+. +#elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) + #error Cython requires Python 2.7+ or Python 3.3+. #else -#define CYTHON_ABI "0_29_28" -#define CYTHON_HEX_VERSION 0x001D1CF0 +#define CYTHON_ABI "3_0_0" +#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI +#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." +#define CYTHON_HEX_VERSION 0x030000F0 #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif -#if !defined(WIN32) && !defined(MS_WINDOWS) +#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif @@ -48,9 +77,7 @@ END: Cython Metadata */ #endif #define __PYX_COMMA , #ifndef HAVE_LONG_LONG - #if PY_VERSION_HEX >= 0x02070000 - #define HAVE_LONG_LONG - #endif + #define HAVE_LONG_LONG #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG @@ -58,12 +85,18 @@ END: Cython Metadata */ #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif -#ifdef PYPY_VERSION - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_PYSTON 0 +#if defined(GRAALVM_PYTHON) + /* For very preliminary testing purposes. Most variables are set the same as PyPy. + The existence of this section does not imply that anything works or is even tested */ + #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 1 + #define CYTHON_COMPILING_IN_NOGIL 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #if PY_VERSION_HEX < 0x03050000 @@ -88,27 +121,159 @@ END: Cython Metadata */ #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) + #endif #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 -#elif defined(PYSTON_VERSION) + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif +#elif defined(PYPY_VERSION) + #define CYTHON_COMPILING_IN_PYPY 1 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) + #endif + #if PY_VERSION_HEX < 0x03090000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00) + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif +#elif defined(CYTHON_LIMITED_API) + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 1 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 0 + #undef CYTHON_CLINE_IN_TRACEBACK + #define CYTHON_CLINE_IN_TRACEBACK 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 1 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #endif + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 1 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif +#elif defined(PY_NOGIL) #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 1 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 1 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 + #ifndef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 #ifndef CYTHON_USE_UNICODE_INTERNALS @@ -131,25 +296,29 @@ END: Cython Metadata */ #define CYTHON_FAST_THREAD_STATE 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 - #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 1 + #endif #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #else #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 1 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 0 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #ifndef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 1 #endif #if PY_MAJOR_VERSION < 3 @@ -158,10 +327,7 @@ END: Cython Metadata */ #elif !defined(CYTHON_USE_ASYNC_SLOTS) #define CYTHON_USE_ASYNC_SLOTS 1 #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #elif !defined(CYTHON_USE_PYLONG_INTERNALS) + #ifndef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 1 #endif #ifndef CYTHON_USE_PYLIST_INTERNALS @@ -185,34 +351,59 @@ END: Cython Metadata */ #ifndef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 1 #endif - #if PY_VERSION_HEX >= 0x030B00A4 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #elif !defined(CYTHON_FAST_THREAD_STATE) + #ifndef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 1 #endif + #ifndef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6) + #endif + #ifndef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1) + #endif #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030B00A1) + #define CYTHON_FAST_PYCALL 1 #endif - #ifndef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 #endif - #ifndef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 #endif - #ifndef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1) + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 #endif - #if PY_VERSION_HEX >= 0x030B00A4 + #if PY_VERSION_HEX < 0x030400a1 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #elif !defined(CYTHON_USE_TP_FINALIZE) + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #if PY_VERSION_HEX < 0x030600B1 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #elif !defined(CYTHON_USE_DICT_VERSIONS) + #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5) + #endif + #if PY_VERSION_HEX < 0x030700A3 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #elif !defined(CYTHON_USE_EXC_INFO_STACK) - #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3) + #define CYTHON_USE_EXC_INFO_STACK 1 + #endif + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 #endif #endif #if !defined(CYTHON_FAST_PYCCALL) #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif +#if !defined(CYTHON_VECTORCALL) +#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1) +#endif +#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1) #if CYTHON_USE_PYLONG_INTERNALS #if PY_MAJOR_VERSION < 3 #include "longintrepr.h" @@ -241,6 +432,17 @@ END: Cython Metadata */ #define CYTHON_RESTRICT #endif #endif +#ifndef CYTHON_UNUSED + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(maybe_unused) + #define CYTHON_UNUSED [[maybe_unused]] + #endif + #endif + #endif +#endif #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) @@ -254,13 +456,16 @@ END: Cython Metadata */ # define CYTHON_UNUSED # endif #endif -#ifndef CYTHON_MAYBE_UNUSED_VAR +#ifndef CYTHON_UNUSED_VAR # if defined(__cplusplus) - template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } + template void CYTHON_UNUSED_VAR( const T& ) { } # else -# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) +# define CYTHON_UNUSED_VAR(x) (void)(x) # endif #endif +#ifndef CYTHON_MAYBE_UNUSED_VAR + #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) +#endif #ifndef CYTHON_NCP_UNUSED # if CYTHON_COMPILING_IN_CPYTHON # define CYTHON_NCP_UNUSED @@ -272,24 +477,47 @@ END: Cython Metadata */ #ifdef _MSC_VER #ifndef _MSC_STDINT_H_ #if _MSC_VER < 1300 - typedef unsigned char uint8_t; - typedef unsigned int uint32_t; + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; + #else + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; + #endif + #endif + #if _MSC_VER < 1300 + #ifdef _WIN64 + typedef unsigned long long __pyx_uintptr_t; + #else + typedef unsigned int __pyx_uintptr_t; + #endif + #else + #ifdef _WIN64 + typedef unsigned __int64 __pyx_uintptr_t; #else - typedef unsigned __int8 uint8_t; - typedef unsigned __int32 uint32_t; + typedef unsigned __int32 __pyx_uintptr_t; #endif #endif #else - #include + #include + typedef uintptr_t __pyx_uintptr_t; #endif #ifndef CYTHON_FALLTHROUGH - #if defined(__cplusplus) && __cplusplus >= 201103L - #if __has_cpp_attribute(fallthrough) - #define CYTHON_FALLTHROUGH [[fallthrough]] - #elif __has_cpp_attribute(clang::fallthrough) - #define CYTHON_FALLTHROUGH [[clang::fallthrough]] - #elif __has_cpp_attribute(gnu::fallthrough) - #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #endif #endif #endif #ifndef CYTHON_FALLTHROUGH @@ -299,13 +527,26 @@ END: Cython Metadata */ #define CYTHON_FALLTHROUGH #endif #endif - #if defined(__clang__ ) && defined(__apple_build_version__) + #if defined(__clang__) && defined(__apple_build_version__) #if __apple_build_version__ < 7000000 #undef CYTHON_FALLTHROUGH #define CYTHON_FALLTHROUGH #endif #endif #endif +#ifdef __cplusplus + template + struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; + #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value) +#else + #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) +#endif +#if CYTHON_COMPILING_IN_PYPY == 1 + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000) +#else + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000) +#endif +#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) #ifndef CYTHON_INLINE #if defined(__clang__) @@ -321,35 +562,32 @@ END: Cython Metadata */ #endif #endif -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyClass_Type + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_DefaultClassType PyType_Type #if PY_VERSION_HEX >= 0x030B00A1 - static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f, + static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, PyObject *code, PyObject *c, PyObject* n, PyObject *v, PyObject *fv, PyObject *cell, PyObject* fn, PyObject *name, int fline, PyObject *lnos) { PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; - PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL; + PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *empty=NULL; const char *fn_cstr=NULL; const char *name_cstr=NULL; - PyCodeObject* co=NULL; + PyCodeObject *co=NULL, *result=NULL; PyObject *type, *value, *traceback; PyErr_Fetch(&type, &value, &traceback); if (!(kwds=PyDict_New())) goto end; if (!(argcount=PyLong_FromLong(a))) goto end; if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end; - if (!(posonlyargcount=PyLong_FromLong(0))) goto end; + if (!(posonlyargcount=PyLong_FromLong(p))) goto end; if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end; if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end; @@ -369,18 +607,11 @@ END: Cython Metadata */ if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; - if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too; - if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here - if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too; - Py_XDECREF((PyObject*)co); - co = (PyCodeObject*)call_result; - call_result = NULL; - if (0) { - cleanup_code_too: - Py_XDECREF((PyObject*)co); - co = NULL; - } - end: + if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto end; + if (!(empty = PyTuple_New(0))) goto end; + result = (PyCodeObject*) PyObject_Call(replace, empty, kwds); + end: + Py_XDECREF((PyObject*) co); Py_XDECREF(kwds); Py_XDECREF(argcount); Py_XDECREF(posonlyargcount); @@ -388,18 +619,56 @@ END: Cython Metadata */ Py_XDECREF(nlocals); Py_XDECREF(stacksize); Py_XDECREF(replace); - Py_XDECREF(call_result); Py_XDECREF(empty); if (type) { PyErr_Restore(type, value, traceback); } - return co; + return result; } +#elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif - #define __Pyx_DefaultClassType PyType_Type +#endif +#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) + #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) +#else + #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) + #define __Pyx_Py_Is(x, y) Py_Is(x, y) +#else + #define __Pyx_Py_Is(x, y) ((x) == (y)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) + #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) +#else + #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) + #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) +#else + #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) + #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) +#else + #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) +#endif +#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) +#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) +#else + #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) +#endif +#ifndef CO_COROUTINE + #define CO_COROUTINE 0x80 +#endif +#ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x200 #endif #ifndef Py_TPFLAGS_CHECKTYPES #define Py_TPFLAGS_CHECKTYPES 0 @@ -413,6 +682,12 @@ END: Cython Metadata */ #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif +#ifndef Py_TPFLAGS_SEQUENCE + #define Py_TPFLAGS_SEQUENCE 0 +#endif +#ifndef Py_TPFLAGS_MAPPING + #define Py_TPFLAGS_MAPPING 0 +#endif #ifndef METH_STACKLESS #define METH_STACKLESS 0 #endif @@ -427,30 +702,53 @@ END: Cython Metadata */ #define __Pyx_PyCFunctionFast _PyCFunctionFast #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords #endif -#if CYTHON_FAST_PYCCALL -#define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))))) +#if CYTHON_METH_FASTCALL + #define __Pyx_METH_FASTCALL METH_FASTCALL + #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast + #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords #else -#define __Pyx_PyFastCFunction_Check(func) 0 + #define __Pyx_METH_FASTCALL METH_VARARGS + #define __Pyx_PyCFunction_FastCall PyCFunction + #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords +#endif +#if CYTHON_VECTORCALL + #define __pyx_vectorcallfunc vectorcallfunc + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET + #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) +#elif CYTHON_BACKPORT_VECTORCALL + typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args, + size_t nargsf, PyObject *kwnames); + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1)) + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)) +#else + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) +#endif +#if PY_VERSION_HEX < 0x030900B1 + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) + typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); +#else + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) + #define __Pyx_PyCMethod PyCMethod +#endif +#ifndef METH_METHOD + #define METH_METHOD 0x200 #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) #define PyObject_Malloc(s) PyMem_Malloc(s) #define PyObject_Free(p) PyMem_Free(p) #define PyObject_Realloc(p) PyMem_Realloc(p) #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1 - #define PyMem_RawMalloc(n) PyMem_Malloc(n) - #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) - #define PyMem_RawFree(p) PyMem_Free(p) -#endif -#if CYTHON_COMPILING_IN_PYSTON - #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) #else #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) #endif -#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyThreadState_Current PyThreadState_Get() +#elif !CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_Current PyThreadState_GET() #elif PY_VERSION_HEX >= 0x03060000 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() @@ -459,6 +757,22 @@ END: Cython Metadata */ #else #define __Pyx_PyThreadState_Current _PyThreadState_Current #endif +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op) +{ + void *result; + result = PyModule_GetState(op); + if (!result) + Py_FatalError("Couldn't find the module state"); + return result; +} +#endif +#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) +#else + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) +#endif #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) #include "pythread.h" #define Py_tss_NEEDS_INIT 0 @@ -489,6 +803,28 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { return PyThread_get_key_value(*key); } #endif +#if PY_MAJOR_VERSION < 3 + #if CYTHON_COMPILING_IN_PYPY + #if PYPY_VERSION_NUM < 0x07030600 + #if defined(__cplusplus) && __cplusplus >= 201402L + [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]] + #elif defined(__GNUC__) || defined(__clang__) + __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))) + #elif defined(_MSC_VER) + __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")) + #endif + static CYTHON_INLINE int PyGILState_Check(void) { + return 0; + } + #else // PYPY_VERSION_NUM < 0x07030600 + #endif // PYPY_VERSION_NUM < 0x07030600 + #else + static CYTHON_INLINE int PyGILState_Check(void) { + PyThreadState * tstate = _PyThreadState_Current; + return tstate && (tstate == PyGILState_GetThisThreadState()); + } + #endif +#endif #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) #else @@ -501,34 +837,86 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS -#define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && CYTHON_USE_UNICODE_INTERNALS +#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { + PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); + if (res == NULL) PyErr_Clear(); + return res; +} +#elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000) +#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#else +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { +#if CYTHON_COMPILING_IN_PYPY + return PyDict_GetItem(dict, name); +#else + PyDictEntry *ep; + PyDictObject *mp = (PyDictObject*) dict; + long hash = ((PyStringObject *) name)->ob_shash; + assert(hash != -1); + ep = (mp->ma_lookup)(mp, name, hash); + if (ep == NULL) { + return NULL; + } + return ep->me_value; +#endif +} +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#endif +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) + #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) + #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext) +#else + #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) + #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) + #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next +#endif +#if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000 +#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ + PyTypeObject *type = Py_TYPE(obj);\ + assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ + PyObject_GC_Del(obj);\ + Py_DECREF(type);\ +} #else -#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) +#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) #endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) +#if CYTHON_COMPILING_IN_LIMITED_API #define CYTHON_PEP393_ENABLED 1 - #if defined(PyUnicode_IS_READY) - #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ - 0 : _PyUnicode_Ready((PyObject *)(op))) - #else #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) + #define __Pyx_PyUnicode_DATA(u) ((void*)u) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) +#elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_READY(op) (0) + #else + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ + 0 : _PyUnicode_Ready((PyObject *)(op))) #endif #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) + #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) - #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE) - #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) - #else - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) - #endif + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch) + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) #else - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) + #else + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) + #endif #endif #else #define CYTHON_PEP393_ENABLED 0 @@ -538,11 +926,11 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) - #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE)) #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) #endif #if CYTHON_COMPILING_IN_PYPY @@ -553,14 +941,20 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) #endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) +#if CYTHON_COMPILING_IN_PYPY + #if !defined(PyUnicode_DecodeUnicodeEscape) + #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) + #endif + #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500) + #undef PyUnicode_Contains + #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) + #endif + #if !defined(PyByteArray_Check) + #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) + #endif + #if !defined(PyObject_Format) + #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) + #endif #endif #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) @@ -589,8 +983,14 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) #endif +#if CYTHON_COMPILING_IN_CPYTHON + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#else + #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) +#endif #ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) + #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) #endif #if PY_VERSION_HEX >= 0x030900A4 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) @@ -609,6 +1009,8 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define __Pyx_Py3Int_Check(op) PyLong_Check(op) + #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong @@ -620,6 +1022,9 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define PyNumber_Int PyNumber_Long +#else + #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op)) + #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op)) #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject @@ -637,11 +1042,6 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t #endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) -#endif #if CYTHON_USE_ASYNC_SLOTS #if PY_VERSION_HEX >= 0x030500B1 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods @@ -660,8 +1060,10 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { } __Pyx_PyAsyncMethodsStruct; #endif -#if defined(WIN32) || defined(MS_WINDOWS) - #define _USE_MATH_DEFINES +#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) + #if !defined(_USE_MATH_DEFINES) + #define _USE_MATH_DEFINES + #endif #endif #include #ifdef NAN @@ -684,7 +1086,16 @@ static CYTHON_INLINE float __PYX_NAN() { #define __PYX_ERR(f_index, lineno, Ln_error) \ { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } -#ifndef __PYX_EXTERN_C +#ifdef CYTHON_EXTERN_C + #undef __PYX_EXTERN_C + #define __PYX_EXTERN_C CYTHON_EXTERN_C +#elif defined(__PYX_EXTERN_C) + #ifdef _MSC_VER + #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") + #else + #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. + #endif +#else #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else @@ -779,9 +1190,9 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) @@ -789,11 +1200,22 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const wchar_t *u) +{ + const wchar_t *u_end = u; + while (*u_end++) ; + return (size_t)(u_end - u - 1); +} +#else +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) +{ const Py_UNICODE *u_end = u; while (*u_end++) ; return (size_t)(u_end - u - 1); } +#endif +#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode @@ -819,7 +1241,52 @@ static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #else #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) #endif -#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) +#if CYTHON_USE_PYLONG_INTERNALS + #if PY_VERSION_HEX >= 0x030C00A7 + #ifndef _PyLong_SIGN_MASK + #define _PyLong_SIGN_MASK 3 + #endif + #ifndef _PyLong_NON_SIZE_BITS + #define _PyLong_NON_SIZE_BITS 3 + #endif + #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) + #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) + #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) + #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) + #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_SignedDigitCount(x)\ + ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) + #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) + #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) + #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) + #else + #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) + #endif + typedef Py_ssize_t __Pyx_compact_pylong; + typedef size_t __Pyx_compact_upylong; + #else // Py < 3.12 + #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) + #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) + #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) + #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) + #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) + #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) + #define __Pyx_PyLong_CompactValue(x)\ + ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) + typedef sdigit __Pyx_compact_pylong; + typedef digit __Pyx_compact_upylong; + #endif + #if PY_VERSION_HEX >= 0x030C00A5 + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) + #else + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) + #endif +#endif #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII static int __Pyx_sys_getdefaultencoding_not_ascii; static int __Pyx_init_sys_getdefaultencoding_params(void) { @@ -841,7 +1308,7 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { char ascii_chars[128]; int c; for (c = 0; c < 128; c++) { - ascii_chars[c] = c; + ascii_chars[c] = (char) c; } __Pyx_sys_getdefaultencoding_not_ascii = 1; ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); @@ -906,33 +1373,61 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { #endif /* __GNUC__ */ static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } +#if !CYTHON_USE_MODULE_STATE static PyObject *__pyx_m = NULL; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_cython_runtime = NULL; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static PyObject *__pyx_empty_unicode; +#endif static int __pyx_lineno; static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; +static const char * __pyx_cfilenm = __FILE__; static const char *__pyx_filename; +/* #### Code section: filename_table ### */ static const char *__pyx_f[] = { "arrex/list.pyx", - "stringsource", + "", + "contextvars.pxd", "type.pxd", "bool.pxd", "complex.pxd", "arrex/dtypes.pxd", }; +/* #### Code section: utility_code_proto_before_types ### */ +/* #### Code section: numeric_typedefs ### */ +/* #### Code section: complex_type_declarations ### */ +/* #### Code section: type_declarations ### */ /*--- Type declarations ---*/ struct __pyx_obj_5arrex_6dtypes_DDType; struct __pyx_obj_5arrex_4list_typedlist; struct __pyx_obj_5arrex_4list_arrayexposer; struct __pyx_obj_5arrex_4list_arrayiter; +struct __pyx_opt_args_7cpython_11contextvars_get_value; +struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default; + +/* "cpython/contextvars.pxd":112 + * + * + * cdef inline object get_value(var, default_value=None): # <<<<<<<<<<<<<< + * """Return a new reference to the value of the context variable, + * or the default value of the context variable, + */ +struct __pyx_opt_args_7cpython_11contextvars_get_value { + int __pyx_n; + PyObject *default_value; +}; + +/* "cpython/contextvars.pxd":129 + * + * + * cdef inline object get_value_no_default(var, default_value=None): # <<<<<<<<<<<<<< + * """Return a new reference to the value of the context variable, + * or the provided default value if no such value was found. + */ +struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default { + int __pyx_n; + PyObject *default_value; +}; struct __pyx_opt_args_5arrex_6dtypes_declare; /* "dtypes.pxd":11 @@ -1047,6 +1542,7 @@ struct __pyx_vtabstruct_5arrex_4list_typedlist { int (*extend)(struct __pyx_obj_5arrex_4list_typedlist *, PyObject *, int __pyx_skip_dispatch); }; static struct __pyx_vtabstruct_5arrex_4list_typedlist *__pyx_vtabptr_5arrex_4list_typedlist; +/* #### Code section: utility_code_proto ### */ /* --- Runtime support code (head) --- */ /* Refnanny.proto */ @@ -1055,11 +1551,11 @@ static struct __pyx_vtabstruct_5arrex_4list_typedlist *__pyx_vtabptr_5arrex_4lis #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 (*INCREF)(void*, PyObject*, Py_ssize_t); + void (*DECREF)(void*, PyObject*, Py_ssize_t); + void (*GOTREF)(void*, PyObject*, Py_ssize_t); + void (*GIVEREF)(void*, PyObject*, Py_ssize_t); + void* (*SetupContext)(const char*, Py_ssize_t, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; @@ -1069,28 +1565,40 @@ static struct __pyx_vtabstruct_5arrex_4list_typedlist *__pyx_vtabptr_5arrex_4lis #define __Pyx_RefNannySetupContext(name, acquire_gil)\ if (acquire_gil) {\ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ PyGILState_Release(__pyx_gilstate_save);\ } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__)) + #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext() #endif + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } #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) + #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); else {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContextNogil() #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) @@ -1101,7 +1609,11 @@ static struct __pyx_vtabstruct_5arrex_4list_typedlist *__pyx_vtabptr_5arrex_4lis #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif -#define __Pyx_XDECREF_SET(r, v) do {\ +#define __Pyx_Py_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; Py_XDECREF(tmp);\ + } while (0) +#define __Pyx_XDECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_XDECREF(tmp);\ } while (0) @@ -1112,43 +1624,30 @@ static struct __pyx_vtabstruct_5arrex_4list_typedlist *__pyx_vtabptr_5arrex_4lis #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) -/* PyObjectGetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); +/* PyErrExceptionMatches.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); #else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) #endif -/* GetBuiltinName.proto */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name); - -/* RaiseDoubleKeywords.proto */ -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); - -/* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ - const char* function_name); - -/* RaiseArgTupleInvalid.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); - -/* GetAttr.proto */ -static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); - -/* HasAttr.proto */ -static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); - /* PyThreadStateGet.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; -#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type +#if PY_VERSION_HEX >= 0x030C00A6 +#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) +#else +#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) +#endif #else #define __Pyx_PyThreadState_declare #define __Pyx_PyThreadState_assign -#define __Pyx_PyErr_Occurred() PyErr_Occurred() +#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) +#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() #endif /* PyErrFetchRestore.proto */ @@ -1160,7 +1659,7 @@ static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) #else #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) @@ -1176,22 +1675,21 @@ static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) #endif -/* IterNext.proto */ -#define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL) -static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *); - -/* PyObjectCall.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +/* PyObjectGetAttrStr.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); #else -#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) #endif -/* RaiseException.proto */ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); +/* PyObjectGetAttrStrNoError.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + +/* GetBuiltinName.proto */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name); /* GetTopmostException.proto */ -#if CYTHON_USE_EXC_INFO_STACK +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); #endif @@ -1206,14 +1704,98 @@ static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) #endif -/* PyErrExceptionMatches.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) -static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); +/* FastTypeChecks.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); #else -#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) +#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) +#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) +#endif +#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) +#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) + +/* TupleAndListFromArray.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); +static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); +#endif + +/* IncludeStringH.proto */ +#include + +/* BytesEquals.proto */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); + +/* UnicodeEquals.proto */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); + +/* fastcall.proto */ +#define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i) +#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) +#define __Pyx_KwValues_VARARGS(args, nargs) NULL +#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) +#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) +#if CYTHON_METH_FASTCALL + #define __Pyx_Arg_FASTCALL(args, i) args[i] + #define __Pyx_NumKwargs_FASTCALL(kwds) PyTuple_GET_SIZE(kwds) + #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) + static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); + #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) +#else + #define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS + #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS + #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS + #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS + #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS +#endif +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start) +#else +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) +#endif + +/* RaiseDoubleKeywords.proto */ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); + +/* ParseKeywords.proto */ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues, + PyObject **argnames[], + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, + const char* function_name); + +/* RaiseArgTupleInvalid.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); + +/* GetAttr.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); + +/* HasAttr.proto */ +static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); + +/* IterNext.proto */ +#define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL) +static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *); + +/* PyObjectCall.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +#else +#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) #endif +/* RaiseException.proto */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); + /* GetException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) @@ -1248,28 +1830,30 @@ static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UIN #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); #endif -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); -#else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) -#endif - /* PyFunctionFastCall.proto */ #if CYTHON_FAST_PYCALL +#if !CYTHON_VECTORCALL #define __Pyx_PyFunction_FastCall(func, args, nargs)\ __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); -#else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) #endif #define __Pyx_BUILD_ASSERT_EXPR(cond)\ (sizeof(char [1 - 2*!(cond)]) - 1) #ifndef Py_MEMBER_SIZE #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) #endif -#if CYTHON_FAST_PYCALL +#if !CYTHON_VECTORCALL +#if PY_VERSION_HEX >= 0x03080000 + #include "frameobject.h" +#if PY_VERSION_HEX >= 0x030b00a6 + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif + #define __Pxy_PyFrame_Initialize_Offsets() + #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus) +#else static size_t __pyx_pyframe_localsplus_offset = 0; #include "frameobject.h" #define __Pxy_PyFrame_Initialize_Offsets()\ @@ -1277,26 +1861,25 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) #define __Pyx_PyFrame_GetLocalsplus(frame)\ (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) -#endif // CYTHON_FAST_PYCALL #endif - -/* PyObjectCall2Args.proto */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); +#endif +#endif /* PyObjectCallMethO.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); #endif +/* PyObjectFastCall.proto */ +#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs); + +/* KeywordStringCheck.proto */ +static int __Pyx_CheckKeywordStrings(PyObject *kw, const char* function_name, int kw_allowed); + /* PyObjectCallOneArg.proto */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); -/* ArgTypeTest.proto */ -#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ - ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ - __Pyx__ArgTypeTest(obj, type, name, exact)) -static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); - /* PyIntBinop.proto */ #if !CYTHON_COMPILING_IN_PYPY static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); @@ -1316,18 +1899,18 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( /* GetModuleGlobalName.proto */ #if CYTHON_USE_DICT_VERSIONS -#define __Pyx_GetModuleGlobalName(var, name) {\ +#define __Pyx_GetModuleGlobalName(var, name) do {\ static PY_UINT64_T __pyx_dict_version = 0;\ static PyObject *__pyx_dict_cached_value = NULL;\ (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} -#define __Pyx_GetModuleGlobalNameUncached(var, name) {\ +} while(0) +#define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ PY_UINT64_T __pyx_dict_version;\ PyObject *__pyx_dict_cached_value;\ (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} +} while(0) static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); #else #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) @@ -1335,6 +1918,23 @@ static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_ve static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); #endif +/* AssertionsEnabled.proto */ +#define __Pyx_init_assertions_enabled() +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) + #define __pyx_assertions_enabled() (1) +#elif PY_VERSION_HEX < 0x03080000 || CYTHON_COMPILING_IN_PYPY || defined(Py_LIMITED_API) + #define __pyx_assertions_enabled() (!Py_OptimizeFlag) +#elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030900A6 + static int __pyx_assertions_enabled_flag; + #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag) + #undef __Pyx_init_assertions_enabled + static void __Pyx_init_assertions_enabled(void) { + __pyx_assertions_enabled_flag = ! _PyInterpreterState_GetConfig(__Pyx_PyThreadState_Current->interp)->optimization_level; + } +#else + #define __pyx_assertions_enabled() (!Py_OptimizeFlag) +#endif + /* WriteUnraisableException.proto */ static void __Pyx_WriteUnraisable(const char *name, int clineno, int lineno, const char *filename, @@ -1343,8 +1943,14 @@ static void __Pyx_WriteUnraisable(const char *name, int clineno, /* GetAttr3.proto */ static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); -/* KeywordStringCheck.proto */ -static int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); +/* RaiseUnexpectedTypeError.proto */ +static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj); + +/* PySequenceContains.proto */ +static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) { + int result = PySequence_Contains(seq, item); + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} /* Import.proto */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); @@ -1374,8 +1980,30 @@ static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, int wraparound, int boundscheck); -/* IncludeStringH.proto */ -#include +/* IncludeStructmemberH.proto */ +#include + +/* FixUpExtensionType.proto */ +#if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); +#endif + +/* PyObjectCallNoArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); + +/* PyObjectGetMethod.proto */ +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); + +/* PyObjectCallMethod0.proto */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); + +/* ValidateBasesTuple.proto */ +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases); +#endif + +/* PyType_Ready.proto */ +CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t); /* PyObject_GenericGetAttrNoDict.proto */ #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 @@ -1392,24 +2020,163 @@ static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_nam #endif /* SetVTable.proto */ -static int __Pyx_SetVtable(PyObject *dict, void *vtable); +static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable); -/* PyObjectGetAttrStrNoError.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); +/* GetVTable.proto */ +static void* __Pyx_GetVtable(PyTypeObject *type); + +/* MergeVTables.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_MergeVtables(PyTypeObject *type); +#endif /* SetupReduce.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API static int __Pyx_setup_reduce(PyObject* type_obj); +#endif /* TypeImport.proto */ -#ifndef __PYX_HAVE_RT_ImportType_proto -#define __PYX_HAVE_RT_ImportType_proto -enum __Pyx_ImportType_CheckSize { - __Pyx_ImportType_CheckSize_Error = 0, - __Pyx_ImportType_CheckSize_Warn = 1, - __Pyx_ImportType_CheckSize_Ignore = 2 +#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_0 +#define __PYX_HAVE_RT_ImportType_proto_3_0_0 +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +#include +#endif +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_0(s) alignof(s) +#else +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_0(s) sizeof(void*) +#endif +enum __Pyx_ImportType_CheckSize_3_0_0 { + __Pyx_ImportType_CheckSize_Error_3_0_0 = 0, + __Pyx_ImportType_CheckSize_Warn_3_0_0 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_0_0 = 2 }; -static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size); +static PyTypeObject *__Pyx_ImportType_3_0_0(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_0 check_size); +#endif + +/* ImportDottedModule.proto */ +static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple); +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple); +#endif + +/* FetchSharedCythonModule.proto */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void); + +/* FetchCommonType.proto */ +#if !CYTHON_USE_TYPE_SPECS +static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); +#else +static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases); +#endif + +/* PyMethodNew.proto */ +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + return PyMethod_New(func, self); +} +#else + #define __Pyx_PyMethod_New PyMethod_New +#endif + +/* PyVectorcallFastCallDict.proto */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); +#endif + +/* CythonFunctionShared.proto */ +#define __Pyx_CyFunction_USED +#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 +#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 +#define __Pyx_CYFUNCTION_CCLASS 0x04 +#define __Pyx_CYFUNCTION_COROUTINE 0x08 +#define __Pyx_CyFunction_GetClosure(f)\ + (((__pyx_CyFunctionObject *) (f))->func_closure) +#if PY_VERSION_HEX < 0x030900B1 + #define __Pyx_CyFunction_GetClassObj(f)\ + (((__pyx_CyFunctionObject *) (f))->func_classobj) +#else + #define __Pyx_CyFunction_GetClassObj(f)\ + ((PyObject*) ((PyCMethodObject *) (f))->mm_class) +#endif +#define __Pyx_CyFunction_SetClassObj(f, classobj)\ + __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) +#define __Pyx_CyFunction_Defaults(type, f)\ + ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) +#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ + ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) +typedef struct { +#if PY_VERSION_HEX < 0x030900B1 + PyCFunctionObject func; +#else + PyCMethodObject func; +#endif +#if CYTHON_BACKPORT_VECTORCALL + __pyx_vectorcallfunc func_vectorcall; #endif +#if PY_VERSION_HEX < 0x030500A0 + PyObject *func_weakreflist; +#endif + PyObject *func_dict; + PyObject *func_name; + PyObject *func_qualname; + PyObject *func_doc; + PyObject *func_globals; + PyObject *func_code; + PyObject *func_closure; +#if PY_VERSION_HEX < 0x030900B1 + PyObject *func_classobj; +#endif + void *defaults; + int defaults_pyobjects; + size_t defaults_size; // used by FusedFunction for copying defaults + int flags; + PyObject *defaults_tuple; + PyObject *defaults_kwdict; + PyObject *(*defaults_getter)(PyObject *); + PyObject *func_annotations; + PyObject *func_is_coroutine; +} __pyx_CyFunctionObject; +#define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_CyFunctionType) +#define __Pyx_IsCyOrPyCFunction(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type) +#define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType) +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, + size_t size, + int pyobjects); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, + PyObject *tuple); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, + PyObject *dict); +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, + PyObject *dict); +static int __pyx_CyFunction_init(PyObject *module); +#if CYTHON_METH_FASTCALL +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +#if CYTHON_BACKPORT_VECTORCALL +#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) +#else +#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) +#endif +#endif + +/* CythonFunction.proto */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); /* GetNameInClass.proto */ #define __Pyx_GetNameInClass(var, nmspace, name) (var) = __Pyx__GetNameInClass(nmspace, name) @@ -1417,7 +2184,7 @@ static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name); /* ClassMethod.proto */ #include "descrobject.h" -static CYTHON_UNUSED PyObject* __Pyx_Method_ClassMethod(PyObject *method); +CYTHON_UNUSED static PyObject* __Pyx_Method_ClassMethod(PyObject *method); /* CLineInTraceback.proto */ #ifdef CYTHON_CLINE_IN_TRACEBACK @@ -1427,6 +2194,7 @@ static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); #endif /* CodeObjectCache.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API typedef struct { PyCodeObject* code_object; int code_line; @@ -1440,13 +2208,14 @@ static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); +#endif /* AddTraceback.proto */ static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); /* GCCDiagnostics.proto */ -#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) #define __Pyx_HAS_GCC_DIAGNOSTIC #endif @@ -1468,28 +2237,31 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_ptrdiff_t(ptrdiff_t value); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); -/* FastTypeChecks.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) -static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); +/* FormatTypeName.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%U" +static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp); +#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) #else -#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) -#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) -#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) +typedef const char *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%.200s" +#define __Pyx_PyType_GetName(tp) ((tp)->tp_name) +#define __Pyx_DECREF_TypeName(obj) #endif -#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); /* FunctionImport.proto */ -static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); +static int __Pyx_ImportFunction_3_0_0(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); +/* #### Code section: module_declarations ### */ +static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4real_real(PyComplexObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4imag_imag(PyComplexObject *__pyx_v_self); /* proto*/ static PyObject *__pyx_f_5arrex_4list_9typedlist__getitem(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, void *__pyx_v_place); /* proto*/ static int __pyx_f_5arrex_4list_9typedlist__setitem(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, void *__pyx_v_place, PyObject *__pyx_v_obj); /* proto*/ static int __pyx_f_5arrex_4list_9typedlist__use(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_buffer); /* proto*/ @@ -1499,113 +2271,113 @@ static Py_ssize_t __pyx_f_5arrex_4list_9typedlist__index(struct __pyx_obj_5arrex static int __pyx_f_5arrex_4list_9typedlist_append(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_value, int __pyx_skip_dispatch); /* proto*/ static int __pyx_f_5arrex_4list_9typedlist_extend(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_skip_dispatch); /* proto*/ -/* Module declarations from 'cython' */ +/* Module declarations from "cython" */ + +/* Module declarations from "cpython.version" */ -/* Module declarations from 'cpython.version' */ +/* Module declarations from "__builtin__" */ -/* Module declarations from '__builtin__' */ +/* Module declarations from "cpython.type" */ -/* Module declarations from 'cpython.type' */ -static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; +/* Module declarations from "libc.string" */ -/* Module declarations from 'libc.string' */ +/* Module declarations from "libc.stdio" */ -/* Module declarations from 'libc.stdio' */ +/* Module declarations from "cpython.object" */ -/* Module declarations from 'cpython.object' */ +/* Module declarations from "cpython.ref" */ -/* Module declarations from 'cpython.ref' */ +/* Module declarations from "cpython.exc" */ -/* Module declarations from 'cpython.exc' */ +/* Module declarations from "cpython.module" */ -/* Module declarations from 'cpython.module' */ +/* Module declarations from "cpython.mem" */ -/* Module declarations from 'cpython.mem' */ +/* Module declarations from "cpython.tuple" */ -/* Module declarations from 'cpython.tuple' */ +/* Module declarations from "cpython.list" */ -/* Module declarations from 'cpython.list' */ +/* Module declarations from "cpython.sequence" */ -/* Module declarations from 'cpython.sequence' */ +/* Module declarations from "cpython.mapping" */ -/* Module declarations from 'cpython.mapping' */ +/* Module declarations from "cpython.iterator" */ -/* Module declarations from 'cpython.iterator' */ +/* Module declarations from "cpython.number" */ -/* Module declarations from 'cpython.number' */ +/* Module declarations from "cpython.int" */ -/* Module declarations from 'cpython.int' */ +/* Module declarations from "__builtin__" */ -/* Module declarations from '__builtin__' */ +/* Module declarations from "cpython.bool" */ -/* Module declarations from 'cpython.bool' */ -static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0; +/* Module declarations from "cpython.long" */ -/* Module declarations from 'cpython.long' */ +/* Module declarations from "cpython.float" */ -/* Module declarations from 'cpython.float' */ +/* Module declarations from "__builtin__" */ -/* Module declarations from '__builtin__' */ +/* Module declarations from "cpython.complex" */ -/* Module declarations from 'cpython.complex' */ -static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0; +/* Module declarations from "cpython.string" */ -/* Module declarations from 'cpython.string' */ +/* Module declarations from "cpython.unicode" */ -/* Module declarations from 'cpython.unicode' */ +/* Module declarations from "cpython.pyport" */ -/* Module declarations from 'cpython.dict' */ +/* Module declarations from "cpython.dict" */ -/* Module declarations from 'cpython.instance' */ +/* Module declarations from "cpython.instance" */ -/* Module declarations from 'cpython.function' */ +/* Module declarations from "cpython.function" */ -/* Module declarations from 'cpython.method' */ +/* Module declarations from "cpython.method" */ -/* Module declarations from 'cpython.weakref' */ +/* Module declarations from "cpython.weakref" */ -/* Module declarations from 'cpython.getargs' */ +/* Module declarations from "cpython.getargs" */ -/* Module declarations from 'cpython.pythread' */ +/* Module declarations from "cpython.pythread" */ -/* Module declarations from 'cpython.pystate' */ +/* Module declarations from "cpython.pystate" */ -/* Module declarations from 'cpython.cobject' */ +/* Module declarations from "cpython.cobject" */ -/* Module declarations from 'cpython.oldbuffer' */ +/* Module declarations from "cpython.oldbuffer" */ -/* Module declarations from 'cpython.set' */ +/* Module declarations from "cpython.set" */ -/* Module declarations from 'cpython.buffer' */ +/* Module declarations from "cpython.buffer" */ -/* Module declarations from 'cpython.bytes' */ +/* Module declarations from "cpython.bytes" */ -/* Module declarations from 'cpython.pycapsule' */ +/* Module declarations from "cpython.pycapsule" */ -/* Module declarations from 'cpython' */ +/* Module declarations from "cpython.contextvars" */ -/* Module declarations from 'cpython.slice' */ +/* Module declarations from "cpython" */ -/* Module declarations from 'libc.stdlib' */ +/* Module declarations from "cpython.slice" */ -/* Module declarations from 'arrex.dtypes' */ -static PyTypeObject *__pyx_ptype_5arrex_6dtypes_DDType = 0; +/* Module declarations from "libc.stdlib" */ + +/* Module declarations from "arrex.dtypes" */ static struct __pyx_obj_5arrex_6dtypes_DDType *(*__pyx_f_5arrex_6dtypes_declared)(PyObject *, int __pyx_skip_dispatch); /*proto*/ -/* Module declarations from 'arrex.list' */ -static PyTypeObject *__pyx_ptype_5arrex_4list_typedlist = 0; -static PyTypeObject *__pyx_ptype_5arrex_4list_arrayexposer = 0; -static PyTypeObject *__pyx_ptype_5arrex_4list_arrayiter = 0; +/* Module declarations from "arrex.list" */ static PyObject *__pyx_f_5arrex_4list___pyx_unpickle_arrayexposer__set_state(struct __pyx_obj_5arrex_4list_arrayexposer *, PyObject *); /*proto*/ static PyObject *__pyx_f_5arrex_4list___pyx_unpickle_arrayiter__set_state(struct __pyx_obj_5arrex_4list_arrayiter *, PyObject *); /*proto*/ static CYTHON_INLINE PyObject *__Pyx_carray_to_py_Py_ssize_t(Py_ssize_t *, Py_ssize_t); /*proto*/ static CYTHON_INLINE PyObject *__Pyx_carray_to_tuple_Py_ssize_t(Py_ssize_t *, Py_ssize_t); /*proto*/ static int __Pyx_carray_from_py_Py_ssize_t(PyObject *, Py_ssize_t *, Py_ssize_t); /*proto*/ +/* #### Code section: typeinfo ### */ +/* #### Code section: before_global_var ### */ #define __Pyx_MODULE_NAME "arrex.list" extern int __pyx_module_is_main_arrex__list; int __pyx_module_is_main_arrex__list = 0; -/* Implementation of 'arrex.list' */ +/* Implementation of "arrex.list" */ +/* #### Code section: global_var ### */ static PyObject *__pyx_builtin_staticmethod; static PyObject *__pyx_builtin_TypeError; static PyObject *__pyx_builtin_StopIteration; @@ -1614,47 +2386,85 @@ static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_IndexError; static PyObject *__pyx_builtin_NotImplemented; static PyObject *__pyx_builtin_RuntimeError; +static PyObject *__pyx_builtin_AssertionError; static PyObject *__pyx_builtin_print; static PyObject *__pyx_builtin_OverflowError; static PyObject *__pyx_builtin_enumerate; +/* #### Code section: string_decls ### */ +static const char __pyx_k_e[] = "e"; static const char __pyx_k_i[] = "i"; +static const char __pyx_k_j[] = "j"; +static const char __pyx_k_l[] = "l"; +static const char __pyx_k_gc[] = "gc"; static const char __pyx_k__12[] = ", "; static const char __pyx_k__13[] = "])"; +static const char __pyx_k__19[] = "."; +static const char __pyx_k__21[] = "*"; +static const char __pyx_k__61[] = "?"; +static const char __pyx_k_cls[] = "cls"; static const char __pyx_k_new[] = "__new__"; +static const char __pyx_k_pop[] = "pop"; static const char __pyx_k_sys[] = "sys"; +static const char __pyx_k_val[] = "val"; +static const char __pyx_k_copy[] = "__copy__"; +static const char __pyx_k_data[] = "data"; static const char __pyx_k_dict[] = "__dict__"; static const char __pyx_k_full[] = "full"; static const char __pyx_k_iter[] = "__iter__"; +static const char __pyx_k_last[] = "last"; static const char __pyx_k_main[] = "__main__"; +static const char __pyx_k_memo[] = "memo"; static const char __pyx_k_name[] = "__name__"; static const char __pyx_k_next[] = "__next__"; +static const char __pyx_k_self[] = "self"; static const char __pyx_k_size[] = "size"; +static const char __pyx_k_spec[] = "__spec__"; +static const char __pyx_k_temp[] = "temp"; static const char __pyx_k_test[] = "__test__"; +static const char __pyx_k_view[] = "view"; static const char __pyx_k_array[] = "array"; +static const char __pyx_k_asked[] = "asked"; +static const char __pyx_k_clear[] = "clear"; static const char __pyx_k_dtype[] = "dtype"; static const char __pyx_k_empty[] = "empty"; +static const char __pyx_k_first[] = "first"; static const char __pyx_k_index[] = "index"; +static const char __pyx_k_new_2[] = "new"; +static const char __pyx_k_other[] = "other"; static const char __pyx_k_owner[] = "owner"; static const char __pyx_k_print[] = "print"; static const char __pyx_k_range[] = "range"; static const char __pyx_k_start[] = "start"; +static const char __pyx_k_state[] = "state"; +static const char __pyx_k_stuff[] = "stuff"; static const char __pyx_k_value[] = "value"; +static const char __pyx_k_amount[] = "amount"; static const char __pyx_k_append[] = "append"; +static const char __pyx_k_dict_2[] = "_dict"; +static const char __pyx_k_enable[] = "enable"; static const char __pyx_k_extend[] = "extend"; static const char __pyx_k_import[] = "__import__"; +static const char __pyx_k_insert[] = "insert"; static const char __pyx_k_pickle[] = "pickle"; static const char __pyx_k_reduce[] = "__reduce__"; +static const char __pyx_k_shrink[] = "shrink"; static const char __pyx_k_struct[] = "struct"; static const char __pyx_k_update[] = "update"; +static const char __pyx_k_disable[] = "disable"; static const char __pyx_k_rebuild[] = "_rebuild"; static const char __pyx_k_reserve[] = "reserve"; +static const char __pyx_k_reverse[] = "reverse"; +static const char __pyx_k_capacity[] = "capacity"; +static const char __pyx_k_deepcopy[] = "__deepcopy__"; static const char __pyx_k_getstate[] = "__getstate__"; static const char __pyx_k_iterable[] = "iterable"; +static const char __pyx_k_protocol[] = "protocol"; static const char __pyx_k_pyx_type[] = "__pyx_type"; static const char __pyx_k_setstate[] = "__setstate__"; static const char __pyx_k_TypeError[] = "TypeError"; static const char __pyx_k_arrayiter[] = "arrayiter"; static const char __pyx_k_enumerate[] = "enumerate"; +static const char __pyx_k_isenabled[] = "isenabled"; static const char __pyx_k_pyx_state[] = "__pyx_state"; static const char __pyx_k_reduce_ex[] = "__reduce_ex__"; static const char __pyx_k_typedlist[] = "typedlist(["; @@ -1669,118 +2479,62 @@ static const char __pyx_k_typedlist_2[] = "typedlist"; static const char __pyx_k_PickleBuffer[] = "PickleBuffer"; static const char __pyx_k_RuntimeError[] = "RuntimeError"; static const char __pyx_k_arrayexposer[] = "arrayexposer"; +static const char __pyx_k_initializing[] = "_initializing"; +static const char __pyx_k_is_coroutine[] = "_is_coroutine"; static const char __pyx_k_pyx_checksum[] = "__pyx_checksum"; static const char __pyx_k_staticmethod[] = "staticmethod"; -static const char __pyx_k_stringsource[] = "stringsource"; +static const char __pyx_k_stringsource[] = ""; +static const char __pyx_k_use_setstate[] = "use_setstate"; static const char __pyx_k_OverflowError[] = "OverflowError"; static const char __pyx_k_StopIteration[] = "StopIteration"; static const char __pyx_k_reduce_cython[] = "__reduce_cython__"; +static const char __pyx_k_typedlist_pop[] = "typedlist.pop"; +static const char __pyx_k_AssertionError[] = "AssertionError"; static const char __pyx_k_NotImplemented[] = "NotImplemented"; static const char __pyx_k_arrex_list_pyx[] = "arrex/list.pyx"; static const char __pyx_k_release_buffer[] = "** release buffer"; +static const char __pyx_k_typedlist_full[] = "typedlist.full"; static const char __pyx_k_incorrect_slice[] = "incorrect slice"; static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError"; static const char __pyx_k_setstate_cython[] = "__setstate_cython__"; +static const char __pyx_k_typedlist_clear[] = "typedlist.clear"; +static const char __pyx_k_typedlist_empty[] = "typedlist.empty"; +static const char __pyx_k_typedlist_index[] = "typedlist.index"; static const char __pyx_k_value_not_found[] = "value not found"; +static const char __pyx_k_typedlist___copy[] = "typedlist.__copy__"; +static const char __pyx_k_typedlist_append[] = "typedlist.append"; +static const char __pyx_k_typedlist_extend[] = "typedlist.extend"; +static const char __pyx_k_typedlist_insert[] = "typedlist.insert"; +static const char __pyx_k_typedlist_shrink[] = "typedlist.shrink"; static const char __pyx_k_iterable_is_empty[] = "iterable is empty"; +static const char __pyx_k_typedlist_reserve[] = "typedlist.reserve"; +static const char __pyx_k_typedlist_reverse[] = "typedlist.reverse"; +static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines"; static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; static const char __pyx_k_index_out_of_range[] = "index out of range"; +static const char __pyx_k_typedlist__rebuild[] = "typedlist._rebuild"; +static const char __pyx_k_typedlist_capacity[] = "typedlist.capacity"; static const char __pyx_k_pop_from_empty_list[] = "pop from empty list"; +static const char __pyx_k_typedlist___deepcopy[] = "typedlist.__deepcopy__"; +static const char __pyx_k_typedlist___reduce_ex[] = "typedlist.__reduce_ex__"; static const char __pyx_k_pyx_unpickle_arrayiter[] = "__pyx_unpickle_arrayiter"; static const char __pyx_k_amount_must_be_positive[] = "amount must be positive"; +static const char __pyx_k_arrayiter___reduce_cython[] = "arrayiter.__reduce_cython__"; static const char __pyx_k_pyx_unpickle_arrayexposer[] = "__pyx_unpickle_arrayexposer"; static const char __pyx_k_index_must_be_int_or_slice[] = "index must be int or slice"; +static const char __pyx_k_arrayiter___setstate_cython[] = "arrayiter.__setstate_cython__"; static const char __pyx_k_slice_step_is_not_supported[] = "slice step is not supported"; -static const char __pyx_k_Incompatible_checksums_s_vs_0x19[] = "Incompatible checksums (%s vs 0x194d213 = (array, position))"; -static const char __pyx_k_Incompatible_checksums_s_vs_0xc9[] = "Incompatible checksums (%s vs 0xc9dda6f = (owner, shape))"; +static const char __pyx_k_arrayexposer___reduce_cython[] = "arrayexposer.__reduce_cython__"; +static const char __pyx_k_arrayexposer___setstate_cython[] = "arrayexposer.__setstate_cython__"; +static const char __pyx_k_Incompatible_checksums_0x_x_vs_0[] = "Incompatible checksums (0x%x vs (0x5a3d340, 0xa9252af, 0xc9dda6f) = (owner, shape))"; static const char __pyx_k_arrayiter_must_not_be_instanciat[] = "arrayiter must not be instanciated explicitely"; static const char __pyx_k_dtype_must_be_a_dtype_declaratio[] = "dtype must be a dtype declaration instance, or a key for a declared dtype"; static const char __pyx_k_dtype_must_be_provided_when_it_c[] = "dtype must be provided when it cannot be deduced from the iterable"; static const char __pyx_k_the_assigned_value_must_be_a_buf[] = "the assigned value must be a buffer or an iterable"; static const char __pyx_k_the_buffer_owner_doens_t_impleme[] = "the buffer owner doens't implement the buffer protocol"; static const char __pyx_k_the_given_buffer_must_have_a_byt[] = "the given buffer must have a byte size multiple of dtype size"; -static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x19; -static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xc9; -static PyObject *__pyx_n_s_IndexError; -static PyObject *__pyx_n_s_NotImplemented; -static PyObject *__pyx_n_s_OverflowError; -static PyObject *__pyx_n_s_PickleBuffer; -static PyObject *__pyx_n_s_PickleError; -static PyObject *__pyx_n_s_RuntimeError; -static PyObject *__pyx_n_s_StopIteration; -static PyObject *__pyx_n_s_TypeError; -static PyObject *__pyx_n_s_ValueError; -static PyObject *__pyx_kp_u__12; -static PyObject *__pyx_kp_u__13; -static PyObject *__pyx_kp_u_amount_must_be_positive; -static PyObject *__pyx_n_s_append; -static PyObject *__pyx_n_s_array; -static PyObject *__pyx_n_s_arrayexposer; -static PyObject *__pyx_n_s_arrayiter; -static PyObject *__pyx_kp_u_arrayiter_must_not_be_instanciat; -static PyObject *__pyx_n_s_arrex_list; -static PyObject *__pyx_kp_s_arrex_list_pyx; -static PyObject *__pyx_n_s_cline_in_traceback; -static PyObject *__pyx_n_s_dict; -static PyObject *__pyx_n_s_dtype; -static PyObject *__pyx_kp_u_dtype_must_be_a_dtype_declaratio; -static PyObject *__pyx_kp_u_dtype_must_be_provided_when_it_c; -static PyObject *__pyx_n_s_empty; -static PyObject *__pyx_n_s_enumerate; -static PyObject *__pyx_n_s_extend; -static PyObject *__pyx_n_s_full; -static PyObject *__pyx_n_s_getrefcount; -static PyObject *__pyx_n_s_getstate; -static PyObject *__pyx_n_s_i; -static PyObject *__pyx_n_s_import; -static PyObject *__pyx_kp_u_incorrect_slice; -static PyObject *__pyx_n_s_index; -static PyObject *__pyx_kp_u_index_must_be_int_or_slice; -static PyObject *__pyx_kp_u_index_out_of_range; -static PyObject *__pyx_n_u_iter; -static PyObject *__pyx_n_s_iterable; -static PyObject *__pyx_kp_u_iterable_is_empty; -static PyObject *__pyx_n_s_main; -static PyObject *__pyx_n_s_name; -static PyObject *__pyx_n_s_new; -static PyObject *__pyx_n_u_next; -static PyObject *__pyx_n_s_owner; -static PyObject *__pyx_n_s_pickle; -static PyObject *__pyx_kp_u_pop_from_empty_list; -static PyObject *__pyx_n_s_print; -static PyObject *__pyx_n_s_pyx_PickleError; -static PyObject *__pyx_n_s_pyx_checksum; -static PyObject *__pyx_n_s_pyx_result; -static PyObject *__pyx_n_s_pyx_state; -static PyObject *__pyx_n_s_pyx_type; -static PyObject *__pyx_n_s_pyx_unpickle_arrayexposer; -static PyObject *__pyx_n_s_pyx_unpickle_arrayiter; -static PyObject *__pyx_n_s_pyx_vtable; -static PyObject *__pyx_n_s_range; -static PyObject *__pyx_n_s_rebuild; -static PyObject *__pyx_n_s_reduce; -static PyObject *__pyx_n_s_reduce_cython; -static PyObject *__pyx_n_s_reduce_ex; -static PyObject *__pyx_kp_u_release_buffer; -static PyObject *__pyx_n_s_reserve; -static PyObject *__pyx_n_s_setstate; -static PyObject *__pyx_n_s_setstate_cython; -static PyObject *__pyx_n_s_size; -static PyObject *__pyx_kp_u_slice_step_is_not_supported; -static PyObject *__pyx_n_s_start; -static PyObject *__pyx_n_s_staticmethod; -static PyObject *__pyx_kp_s_stringsource; -static PyObject *__pyx_n_s_struct; -static PyObject *__pyx_n_s_sys; -static PyObject *__pyx_n_s_test; -static PyObject *__pyx_kp_u_the_assigned_value_must_be_a_buf; -static PyObject *__pyx_kp_u_the_buffer_owner_doens_t_impleme; -static PyObject *__pyx_kp_u_the_given_buffer_must_have_a_byt; -static PyObject *__pyx_kp_u_typedlist; -static PyObject *__pyx_n_s_typedlist_2; -static PyObject *__pyx_n_s_update; -static PyObject *__pyx_n_s_value; -static PyObject *__pyx_kp_u_value_not_found; +static const char __pyx_k_Incompatible_checksums_0x_x_vs_0_2[] = "Incompatible checksums (0x%x vs (0x75ae3e5, 0xbde5f15, 0x194d213) = (array, position))"; +/* #### Code section: decls ### */ static PyObject *__pyx_pf_5arrex_4list_9typedlist_5dtype___get__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_5arrex_4list_9typedlist_6ddtype___get__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self); /* proto */ static int __pyx_pf_5arrex_4list_9typedlist___init__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_iterable, PyObject *__pyx_v_dtype, size_t __pyx_v_reserve); /* proto */ @@ -1794,7 +2548,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_14clear(struct __pyx_obj_5arre static PyObject *__pyx_pf_5arrex_4list_9typedlist_16extend(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_other); /* proto */ static PyObject *__pyx_pf_5arrex_4list_9typedlist_18__iadd__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_other); /* proto */ static PyObject *__pyx_pf_5arrex_4list_9typedlist_20__add__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_other); /* proto */ -static PyObject *__pyx_pf_5arrex_4list_9typedlist_22__mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_n); /* proto */ +static PyObject *__pyx_pf_5arrex_4list_9typedlist_22__mul__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_n); /* proto */ static PyObject *__pyx_pf_5arrex_4list_9typedlist_24capacity(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_5arrex_4list_9typedlist_26shrink(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self); /* proto */ static Py_ssize_t __pyx_pf_5arrex_4list_9typedlist_28__len__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self); /* proto */ @@ -1828,2526 +2582,3879 @@ static PyObject *__pyx_pf_5arrex_4list_2__pyx_unpickle_arrayiter(CYTHON_UNUSED P static PyObject *__pyx_tp_new_5arrex_4list_typedlist(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_5arrex_4list_arrayexposer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_5arrex_4list_arrayiter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_int_0; -static PyObject *__pyx_int_1; -static PyObject *__pyx_int_5; -static PyObject *__pyx_int_26530323; -static PyObject *__pyx_int_211671663; -static PyObject *__pyx_tuple_; -static PyObject *__pyx_tuple__2; -static PyObject *__pyx_tuple__3; -static PyObject *__pyx_tuple__4; -static PyObject *__pyx_tuple__5; -static PyObject *__pyx_tuple__6; -static PyObject *__pyx_tuple__7; -static PyObject *__pyx_tuple__8; -static PyObject *__pyx_tuple__9; -static PyObject *__pyx_slice__14; -static PyObject *__pyx_tuple__10; -static PyObject *__pyx_tuple__11; -static PyObject *__pyx_tuple__15; -static PyObject *__pyx_tuple__16; -static PyObject *__pyx_tuple__17; -static PyObject *__pyx_tuple__18; -static PyObject *__pyx_tuple__20; -static PyObject *__pyx_tuple__22; -static PyObject *__pyx_tuple__24; -static PyObject *__pyx_codeobj__19; -static PyObject *__pyx_codeobj__21; -static PyObject *__pyx_codeobj__23; -static PyObject *__pyx_codeobj__25; -/* Late includes */ - -/* "arrex/list.pyx":123 - * - * @property - * def dtype(self): # <<<<<<<<<<<<<< - * ''' the python dtype object, or the ddtype if there is not dtype ''' - * return self.dtype.key or self.dtype - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_5dtype_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_5dtype_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_9typedlist_5dtype___get__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5arrex_4list_9typedlist_5dtype___get__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "arrex/list.pyx":125 - * def dtype(self): - * ''' the python dtype object, or the ddtype if there is not dtype ''' - * return self.dtype.key or self.dtype # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_self->dtype->key); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 125, __pyx_L1_error) - if (!__pyx_t_2) { - } else { - __Pyx_INCREF(__pyx_v_self->dtype->key); - __pyx_t_1 = __pyx_v_self->dtype->key; - goto __pyx_L3_bool_binop_done; - } - __Pyx_INCREF(((PyObject *)__pyx_v_self->dtype)); - __pyx_t_1 = ((PyObject *)__pyx_v_self->dtype); - __pyx_L3_bool_binop_done:; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "arrex/list.pyx":123 - * - * @property - * def dtype(self): # <<<<<<<<<<<<<< - * ''' the python dtype object, or the ddtype if there is not dtype ''' - * return self.dtype.key or self.dtype - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("arrex.list.typedlist.dtype.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} +/* #### Code section: late_includes ### */ +/* #### Code section: module_state ### */ +typedef struct { + PyObject *__pyx_d; + PyObject *__pyx_b; + PyObject *__pyx_cython_runtime; + PyObject *__pyx_empty_tuple; + PyObject *__pyx_empty_bytes; + PyObject *__pyx_empty_unicode; + #ifdef __Pyx_CyFunction_USED + PyTypeObject *__pyx_CyFunctionType; + #endif + #ifdef __Pyx_FusedFunction_USED + PyTypeObject *__pyx_FusedFunctionType; + #endif + #ifdef __Pyx_Generator_USED + PyTypeObject *__pyx_GeneratorType; + #endif + #ifdef __Pyx_IterableCoroutine_USED + PyTypeObject *__pyx_IterableCoroutineType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineAwaitType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineType; + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyTypeObject *__pyx_ptype_7cpython_4type_type; + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyTypeObject *__pyx_ptype_7cpython_4bool_bool; + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyTypeObject *__pyx_ptype_7cpython_7complex_complex; + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyTypeObject *__pyx_ptype_5arrex_6dtypes_DDType; + #if CYTHON_USE_MODULE_STATE + PyObject *__pyx_type_5arrex_4list_typedlist; + PyObject *__pyx_type_5arrex_4list_arrayexposer; + PyObject *__pyx_type_5arrex_4list_arrayiter; + #endif + PyTypeObject *__pyx_ptype_5arrex_4list_typedlist; + PyTypeObject *__pyx_ptype_5arrex_4list_arrayexposer; + PyTypeObject *__pyx_ptype_5arrex_4list_arrayiter; + PyObject *__pyx_n_s_AssertionError; + PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0; + PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_2; + PyObject *__pyx_n_s_IndexError; + PyObject *__pyx_n_s_NotImplemented; + PyObject *__pyx_n_s_OverflowError; + PyObject *__pyx_n_s_PickleBuffer; + PyObject *__pyx_n_s_PickleError; + PyObject *__pyx_n_s_RuntimeError; + PyObject *__pyx_n_s_StopIteration; + PyObject *__pyx_n_s_TypeError; + PyObject *__pyx_n_s_ValueError; + PyObject *__pyx_kp_u__12; + PyObject *__pyx_kp_u__13; + PyObject *__pyx_kp_u__19; + PyObject *__pyx_n_s__21; + PyObject *__pyx_n_s__61; + PyObject *__pyx_n_s_amount; + PyObject *__pyx_kp_u_amount_must_be_positive; + PyObject *__pyx_n_s_append; + PyObject *__pyx_n_s_array; + PyObject *__pyx_n_s_arrayexposer; + PyObject *__pyx_n_s_arrayexposer___reduce_cython; + PyObject *__pyx_n_s_arrayexposer___setstate_cython; + PyObject *__pyx_n_s_arrayiter; + PyObject *__pyx_n_s_arrayiter___reduce_cython; + PyObject *__pyx_n_s_arrayiter___setstate_cython; + PyObject *__pyx_kp_u_arrayiter_must_not_be_instanciat; + PyObject *__pyx_n_s_arrex_list; + PyObject *__pyx_kp_s_arrex_list_pyx; + PyObject *__pyx_n_s_asked; + PyObject *__pyx_n_s_asyncio_coroutines; + PyObject *__pyx_n_s_capacity; + PyObject *__pyx_n_s_clear; + PyObject *__pyx_n_s_cline_in_traceback; + PyObject *__pyx_n_s_cls; + PyObject *__pyx_n_s_copy; + PyObject *__pyx_n_s_data; + PyObject *__pyx_n_s_deepcopy; + PyObject *__pyx_n_s_dict; + PyObject *__pyx_n_s_dict_2; + PyObject *__pyx_kp_u_disable; + PyObject *__pyx_n_s_dtype; + PyObject *__pyx_kp_u_dtype_must_be_a_dtype_declaratio; + PyObject *__pyx_kp_u_dtype_must_be_provided_when_it_c; + PyObject *__pyx_n_s_e; + PyObject *__pyx_n_s_empty; + PyObject *__pyx_kp_u_enable; + PyObject *__pyx_n_s_enumerate; + PyObject *__pyx_n_s_extend; + PyObject *__pyx_n_s_first; + PyObject *__pyx_n_s_full; + PyObject *__pyx_kp_u_gc; + PyObject *__pyx_n_s_getrefcount; + PyObject *__pyx_n_s_getstate; + PyObject *__pyx_n_s_i; + PyObject *__pyx_n_s_import; + PyObject *__pyx_kp_u_incorrect_slice; + PyObject *__pyx_n_s_index; + PyObject *__pyx_kp_u_index_must_be_int_or_slice; + PyObject *__pyx_kp_u_index_out_of_range; + PyObject *__pyx_n_s_initializing; + PyObject *__pyx_n_s_insert; + PyObject *__pyx_n_s_is_coroutine; + PyObject *__pyx_kp_u_isenabled; + PyObject *__pyx_n_u_iter; + PyObject *__pyx_n_s_iterable; + PyObject *__pyx_kp_u_iterable_is_empty; + PyObject *__pyx_n_s_j; + PyObject *__pyx_n_s_l; + PyObject *__pyx_n_s_last; + PyObject *__pyx_n_s_main; + PyObject *__pyx_n_s_memo; + PyObject *__pyx_n_s_name; + PyObject *__pyx_n_s_new; + PyObject *__pyx_n_s_new_2; + PyObject *__pyx_n_u_next; + PyObject *__pyx_n_s_other; + PyObject *__pyx_n_s_owner; + PyObject *__pyx_n_s_pickle; + PyObject *__pyx_n_s_pop; + PyObject *__pyx_kp_u_pop_from_empty_list; + PyObject *__pyx_n_s_print; + PyObject *__pyx_n_s_protocol; + PyObject *__pyx_n_s_pyx_PickleError; + PyObject *__pyx_n_s_pyx_checksum; + PyObject *__pyx_n_s_pyx_result; + PyObject *__pyx_n_s_pyx_state; + PyObject *__pyx_n_s_pyx_type; + PyObject *__pyx_n_s_pyx_unpickle_arrayexposer; + PyObject *__pyx_n_s_pyx_unpickle_arrayiter; + PyObject *__pyx_n_s_pyx_vtable; + PyObject *__pyx_n_s_range; + PyObject *__pyx_n_s_rebuild; + PyObject *__pyx_n_s_reduce; + PyObject *__pyx_n_s_reduce_cython; + PyObject *__pyx_n_s_reduce_ex; + PyObject *__pyx_kp_u_release_buffer; + PyObject *__pyx_n_s_reserve; + PyObject *__pyx_n_s_reverse; + PyObject *__pyx_n_s_self; + PyObject *__pyx_n_s_setstate; + PyObject *__pyx_n_s_setstate_cython; + PyObject *__pyx_n_s_shrink; + PyObject *__pyx_n_s_size; + PyObject *__pyx_kp_u_slice_step_is_not_supported; + PyObject *__pyx_n_s_spec; + PyObject *__pyx_n_s_start; + PyObject *__pyx_n_s_state; + PyObject *__pyx_n_s_staticmethod; + PyObject *__pyx_kp_s_stringsource; + PyObject *__pyx_n_s_struct; + PyObject *__pyx_n_s_stuff; + PyObject *__pyx_n_s_sys; + PyObject *__pyx_n_s_temp; + PyObject *__pyx_n_s_test; + PyObject *__pyx_kp_u_the_assigned_value_must_be_a_buf; + PyObject *__pyx_kp_u_the_buffer_owner_doens_t_impleme; + PyObject *__pyx_kp_u_the_given_buffer_must_have_a_byt; + PyObject *__pyx_kp_u_typedlist; + PyObject *__pyx_n_s_typedlist_2; + PyObject *__pyx_n_s_typedlist___copy; + PyObject *__pyx_n_s_typedlist___deepcopy; + PyObject *__pyx_n_s_typedlist___reduce_ex; + PyObject *__pyx_n_s_typedlist__rebuild; + PyObject *__pyx_n_s_typedlist_append; + PyObject *__pyx_n_s_typedlist_capacity; + PyObject *__pyx_n_s_typedlist_clear; + PyObject *__pyx_n_s_typedlist_empty; + PyObject *__pyx_n_s_typedlist_extend; + PyObject *__pyx_n_s_typedlist_full; + PyObject *__pyx_n_s_typedlist_index; + PyObject *__pyx_n_s_typedlist_insert; + PyObject *__pyx_n_s_typedlist_pop; + PyObject *__pyx_n_s_typedlist_reserve; + PyObject *__pyx_n_s_typedlist_reverse; + PyObject *__pyx_n_s_typedlist_shrink; + PyObject *__pyx_n_s_update; + PyObject *__pyx_n_s_use_setstate; + PyObject *__pyx_n_s_val; + PyObject *__pyx_n_s_value; + PyObject *__pyx_kp_u_value_not_found; + PyObject *__pyx_n_s_view; + PyObject *__pyx_int_0; + PyObject *__pyx_int_1; + PyObject *__pyx_int_5; + PyObject *__pyx_int_26530323; + PyObject *__pyx_int_94622528; + PyObject *__pyx_int_123397093; + PyObject *__pyx_int_177361583; + PyObject *__pyx_int_199122709; + PyObject *__pyx_int_211671663; + PyObject *__pyx_tuple_; + PyObject *__pyx_tuple__2; + PyObject *__pyx_tuple__3; + PyObject *__pyx_tuple__4; + PyObject *__pyx_tuple__5; + PyObject *__pyx_tuple__6; + PyObject *__pyx_tuple__7; + PyObject *__pyx_tuple__8; + PyObject *__pyx_tuple__9; + PyObject *__pyx_slice__14; + PyObject *__pyx_tuple__10; + PyObject *__pyx_tuple__11; + PyObject *__pyx_tuple__15; + PyObject *__pyx_tuple__16; + PyObject *__pyx_tuple__17; + PyObject *__pyx_tuple__18; + PyObject *__pyx_tuple__20; + PyObject *__pyx_tuple__22; + PyObject *__pyx_tuple__24; + PyObject *__pyx_tuple__25; + PyObject *__pyx_tuple__27; + PyObject *__pyx_tuple__29; + PyObject *__pyx_tuple__31; + PyObject *__pyx_tuple__33; + PyObject *__pyx_tuple__35; + PyObject *__pyx_tuple__37; + PyObject *__pyx_tuple__42; + PyObject *__pyx_tuple__44; + PyObject *__pyx_tuple__46; + PyObject *__pyx_tuple__48; + PyObject *__pyx_tuple__50; + PyObject *__pyx_tuple__52; + PyObject *__pyx_tuple__54; + PyObject *__pyx_tuple__58; + PyObject *__pyx_codeobj__23; + PyObject *__pyx_codeobj__26; + PyObject *__pyx_codeobj__28; + PyObject *__pyx_codeobj__30; + PyObject *__pyx_codeobj__32; + PyObject *__pyx_codeobj__34; + PyObject *__pyx_codeobj__36; + PyObject *__pyx_codeobj__38; + PyObject *__pyx_codeobj__39; + PyObject *__pyx_codeobj__40; + PyObject *__pyx_codeobj__41; + PyObject *__pyx_codeobj__43; + PyObject *__pyx_codeobj__45; + PyObject *__pyx_codeobj__47; + PyObject *__pyx_codeobj__49; + PyObject *__pyx_codeobj__51; + PyObject *__pyx_codeobj__53; + PyObject *__pyx_codeobj__55; + PyObject *__pyx_codeobj__56; + PyObject *__pyx_codeobj__57; + PyObject *__pyx_codeobj__59; + PyObject *__pyx_codeobj__60; +} __pyx_mstate; + +#if CYTHON_USE_MODULE_STATE +#ifdef __cplusplus +namespace { + extern struct PyModuleDef __pyx_moduledef; +} /* anonymous namespace */ +#else +static struct PyModuleDef __pyx_moduledef; +#endif -/* "arrex/list.pyx":128 - * - * @property - * def ddtype(self): # <<<<<<<<<<<<<< - * ''' the declaration of the dtype, a DDType instance ''' - * return self.dtype - */ +#define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o)) -/* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_6ddtype_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_6ddtype_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_9typedlist_6ddtype___get__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self)); +#define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef))) - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; +#define __pyx_m (PyState_FindModule(&__pyx_moduledef)) +#else +static __pyx_mstate __pyx_mstate_global_static = +#ifdef __cplusplus + {}; +#else + {0}; +#endif +static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static; +#endif +/* #### Code section: module_state_clear ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_clear(PyObject *m) { + __pyx_mstate *clear_module_state = __pyx_mstate(m); + if (!clear_module_state) return 0; + Py_CLEAR(clear_module_state->__pyx_d); + Py_CLEAR(clear_module_state->__pyx_b); + Py_CLEAR(clear_module_state->__pyx_cython_runtime); + Py_CLEAR(clear_module_state->__pyx_empty_tuple); + Py_CLEAR(clear_module_state->__pyx_empty_bytes); + Py_CLEAR(clear_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_CLEAR(clear_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_CLEAR(clear_module_state->__pyx_FusedFunctionType); + #endif + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type); + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4bool_bool); + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_7complex_complex); + Py_CLEAR(clear_module_state->__pyx_ptype_5arrex_6dtypes_DDType); + Py_CLEAR(clear_module_state->__pyx_ptype_5arrex_4list_typedlist); + Py_CLEAR(clear_module_state->__pyx_type_5arrex_4list_typedlist); + Py_CLEAR(clear_module_state->__pyx_ptype_5arrex_4list_arrayexposer); + Py_CLEAR(clear_module_state->__pyx_type_5arrex_4list_arrayexposer); + Py_CLEAR(clear_module_state->__pyx_ptype_5arrex_4list_arrayiter); + Py_CLEAR(clear_module_state->__pyx_type_5arrex_4list_arrayiter); + Py_CLEAR(clear_module_state->__pyx_n_s_AssertionError); + Py_CLEAR(clear_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0); + Py_CLEAR(clear_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_2); + Py_CLEAR(clear_module_state->__pyx_n_s_IndexError); + Py_CLEAR(clear_module_state->__pyx_n_s_NotImplemented); + Py_CLEAR(clear_module_state->__pyx_n_s_OverflowError); + Py_CLEAR(clear_module_state->__pyx_n_s_PickleBuffer); + Py_CLEAR(clear_module_state->__pyx_n_s_PickleError); + Py_CLEAR(clear_module_state->__pyx_n_s_RuntimeError); + Py_CLEAR(clear_module_state->__pyx_n_s_StopIteration); + Py_CLEAR(clear_module_state->__pyx_n_s_TypeError); + Py_CLEAR(clear_module_state->__pyx_n_s_ValueError); + Py_CLEAR(clear_module_state->__pyx_kp_u__12); + Py_CLEAR(clear_module_state->__pyx_kp_u__13); + Py_CLEAR(clear_module_state->__pyx_kp_u__19); + Py_CLEAR(clear_module_state->__pyx_n_s__21); + Py_CLEAR(clear_module_state->__pyx_n_s__61); + Py_CLEAR(clear_module_state->__pyx_n_s_amount); + Py_CLEAR(clear_module_state->__pyx_kp_u_amount_must_be_positive); + Py_CLEAR(clear_module_state->__pyx_n_s_append); + Py_CLEAR(clear_module_state->__pyx_n_s_array); + Py_CLEAR(clear_module_state->__pyx_n_s_arrayexposer); + Py_CLEAR(clear_module_state->__pyx_n_s_arrayexposer___reduce_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_arrayexposer___setstate_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_arrayiter); + Py_CLEAR(clear_module_state->__pyx_n_s_arrayiter___reduce_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_arrayiter___setstate_cython); + Py_CLEAR(clear_module_state->__pyx_kp_u_arrayiter_must_not_be_instanciat); + Py_CLEAR(clear_module_state->__pyx_n_s_arrex_list); + Py_CLEAR(clear_module_state->__pyx_kp_s_arrex_list_pyx); + Py_CLEAR(clear_module_state->__pyx_n_s_asked); + Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines); + Py_CLEAR(clear_module_state->__pyx_n_s_capacity); + Py_CLEAR(clear_module_state->__pyx_n_s_clear); + Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); + Py_CLEAR(clear_module_state->__pyx_n_s_cls); + Py_CLEAR(clear_module_state->__pyx_n_s_copy); + Py_CLEAR(clear_module_state->__pyx_n_s_data); + Py_CLEAR(clear_module_state->__pyx_n_s_deepcopy); + Py_CLEAR(clear_module_state->__pyx_n_s_dict); + Py_CLEAR(clear_module_state->__pyx_n_s_dict_2); + Py_CLEAR(clear_module_state->__pyx_kp_u_disable); + Py_CLEAR(clear_module_state->__pyx_n_s_dtype); + Py_CLEAR(clear_module_state->__pyx_kp_u_dtype_must_be_a_dtype_declaratio); + Py_CLEAR(clear_module_state->__pyx_kp_u_dtype_must_be_provided_when_it_c); + Py_CLEAR(clear_module_state->__pyx_n_s_e); + Py_CLEAR(clear_module_state->__pyx_n_s_empty); + Py_CLEAR(clear_module_state->__pyx_kp_u_enable); + Py_CLEAR(clear_module_state->__pyx_n_s_enumerate); + Py_CLEAR(clear_module_state->__pyx_n_s_extend); + Py_CLEAR(clear_module_state->__pyx_n_s_first); + Py_CLEAR(clear_module_state->__pyx_n_s_full); + Py_CLEAR(clear_module_state->__pyx_kp_u_gc); + Py_CLEAR(clear_module_state->__pyx_n_s_getrefcount); + Py_CLEAR(clear_module_state->__pyx_n_s_getstate); + Py_CLEAR(clear_module_state->__pyx_n_s_i); + Py_CLEAR(clear_module_state->__pyx_n_s_import); + Py_CLEAR(clear_module_state->__pyx_kp_u_incorrect_slice); + Py_CLEAR(clear_module_state->__pyx_n_s_index); + Py_CLEAR(clear_module_state->__pyx_kp_u_index_must_be_int_or_slice); + Py_CLEAR(clear_module_state->__pyx_kp_u_index_out_of_range); + Py_CLEAR(clear_module_state->__pyx_n_s_initializing); + Py_CLEAR(clear_module_state->__pyx_n_s_insert); + Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine); + Py_CLEAR(clear_module_state->__pyx_kp_u_isenabled); + Py_CLEAR(clear_module_state->__pyx_n_u_iter); + Py_CLEAR(clear_module_state->__pyx_n_s_iterable); + Py_CLEAR(clear_module_state->__pyx_kp_u_iterable_is_empty); + Py_CLEAR(clear_module_state->__pyx_n_s_j); + Py_CLEAR(clear_module_state->__pyx_n_s_l); + Py_CLEAR(clear_module_state->__pyx_n_s_last); + Py_CLEAR(clear_module_state->__pyx_n_s_main); + Py_CLEAR(clear_module_state->__pyx_n_s_memo); + Py_CLEAR(clear_module_state->__pyx_n_s_name); + Py_CLEAR(clear_module_state->__pyx_n_s_new); + Py_CLEAR(clear_module_state->__pyx_n_s_new_2); + Py_CLEAR(clear_module_state->__pyx_n_u_next); + Py_CLEAR(clear_module_state->__pyx_n_s_other); + Py_CLEAR(clear_module_state->__pyx_n_s_owner); + Py_CLEAR(clear_module_state->__pyx_n_s_pickle); + Py_CLEAR(clear_module_state->__pyx_n_s_pop); + Py_CLEAR(clear_module_state->__pyx_kp_u_pop_from_empty_list); + Py_CLEAR(clear_module_state->__pyx_n_s_print); + Py_CLEAR(clear_module_state->__pyx_n_s_protocol); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_PickleError); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_checksum); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_result); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_state); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_type); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_unpickle_arrayexposer); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_unpickle_arrayiter); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_vtable); + Py_CLEAR(clear_module_state->__pyx_n_s_range); + Py_CLEAR(clear_module_state->__pyx_n_s_rebuild); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce_ex); + Py_CLEAR(clear_module_state->__pyx_kp_u_release_buffer); + Py_CLEAR(clear_module_state->__pyx_n_s_reserve); + Py_CLEAR(clear_module_state->__pyx_n_s_reverse); + Py_CLEAR(clear_module_state->__pyx_n_s_self); + Py_CLEAR(clear_module_state->__pyx_n_s_setstate); + Py_CLEAR(clear_module_state->__pyx_n_s_setstate_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_shrink); + Py_CLEAR(clear_module_state->__pyx_n_s_size); + Py_CLEAR(clear_module_state->__pyx_kp_u_slice_step_is_not_supported); + Py_CLEAR(clear_module_state->__pyx_n_s_spec); + Py_CLEAR(clear_module_state->__pyx_n_s_start); + Py_CLEAR(clear_module_state->__pyx_n_s_state); + Py_CLEAR(clear_module_state->__pyx_n_s_staticmethod); + Py_CLEAR(clear_module_state->__pyx_kp_s_stringsource); + Py_CLEAR(clear_module_state->__pyx_n_s_struct); + Py_CLEAR(clear_module_state->__pyx_n_s_stuff); + Py_CLEAR(clear_module_state->__pyx_n_s_sys); + Py_CLEAR(clear_module_state->__pyx_n_s_temp); + Py_CLEAR(clear_module_state->__pyx_n_s_test); + Py_CLEAR(clear_module_state->__pyx_kp_u_the_assigned_value_must_be_a_buf); + Py_CLEAR(clear_module_state->__pyx_kp_u_the_buffer_owner_doens_t_impleme); + Py_CLEAR(clear_module_state->__pyx_kp_u_the_given_buffer_must_have_a_byt); + Py_CLEAR(clear_module_state->__pyx_kp_u_typedlist); + Py_CLEAR(clear_module_state->__pyx_n_s_typedlist_2); + Py_CLEAR(clear_module_state->__pyx_n_s_typedlist___copy); + Py_CLEAR(clear_module_state->__pyx_n_s_typedlist___deepcopy); + Py_CLEAR(clear_module_state->__pyx_n_s_typedlist___reduce_ex); + Py_CLEAR(clear_module_state->__pyx_n_s_typedlist__rebuild); + Py_CLEAR(clear_module_state->__pyx_n_s_typedlist_append); + Py_CLEAR(clear_module_state->__pyx_n_s_typedlist_capacity); + Py_CLEAR(clear_module_state->__pyx_n_s_typedlist_clear); + Py_CLEAR(clear_module_state->__pyx_n_s_typedlist_empty); + Py_CLEAR(clear_module_state->__pyx_n_s_typedlist_extend); + Py_CLEAR(clear_module_state->__pyx_n_s_typedlist_full); + Py_CLEAR(clear_module_state->__pyx_n_s_typedlist_index); + Py_CLEAR(clear_module_state->__pyx_n_s_typedlist_insert); + Py_CLEAR(clear_module_state->__pyx_n_s_typedlist_pop); + Py_CLEAR(clear_module_state->__pyx_n_s_typedlist_reserve); + Py_CLEAR(clear_module_state->__pyx_n_s_typedlist_reverse); + Py_CLEAR(clear_module_state->__pyx_n_s_typedlist_shrink); + Py_CLEAR(clear_module_state->__pyx_n_s_update); + Py_CLEAR(clear_module_state->__pyx_n_s_use_setstate); + Py_CLEAR(clear_module_state->__pyx_n_s_val); + Py_CLEAR(clear_module_state->__pyx_n_s_value); + Py_CLEAR(clear_module_state->__pyx_kp_u_value_not_found); + Py_CLEAR(clear_module_state->__pyx_n_s_view); + Py_CLEAR(clear_module_state->__pyx_int_0); + Py_CLEAR(clear_module_state->__pyx_int_1); + Py_CLEAR(clear_module_state->__pyx_int_5); + Py_CLEAR(clear_module_state->__pyx_int_26530323); + Py_CLEAR(clear_module_state->__pyx_int_94622528); + Py_CLEAR(clear_module_state->__pyx_int_123397093); + Py_CLEAR(clear_module_state->__pyx_int_177361583); + Py_CLEAR(clear_module_state->__pyx_int_199122709); + Py_CLEAR(clear_module_state->__pyx_int_211671663); + Py_CLEAR(clear_module_state->__pyx_tuple_); + Py_CLEAR(clear_module_state->__pyx_tuple__2); + Py_CLEAR(clear_module_state->__pyx_tuple__3); + Py_CLEAR(clear_module_state->__pyx_tuple__4); + Py_CLEAR(clear_module_state->__pyx_tuple__5); + Py_CLEAR(clear_module_state->__pyx_tuple__6); + Py_CLEAR(clear_module_state->__pyx_tuple__7); + Py_CLEAR(clear_module_state->__pyx_tuple__8); + Py_CLEAR(clear_module_state->__pyx_tuple__9); + Py_CLEAR(clear_module_state->__pyx_slice__14); + Py_CLEAR(clear_module_state->__pyx_tuple__10); + Py_CLEAR(clear_module_state->__pyx_tuple__11); + Py_CLEAR(clear_module_state->__pyx_tuple__15); + Py_CLEAR(clear_module_state->__pyx_tuple__16); + Py_CLEAR(clear_module_state->__pyx_tuple__17); + Py_CLEAR(clear_module_state->__pyx_tuple__18); + Py_CLEAR(clear_module_state->__pyx_tuple__20); + Py_CLEAR(clear_module_state->__pyx_tuple__22); + Py_CLEAR(clear_module_state->__pyx_tuple__24); + Py_CLEAR(clear_module_state->__pyx_tuple__25); + Py_CLEAR(clear_module_state->__pyx_tuple__27); + Py_CLEAR(clear_module_state->__pyx_tuple__29); + Py_CLEAR(clear_module_state->__pyx_tuple__31); + Py_CLEAR(clear_module_state->__pyx_tuple__33); + Py_CLEAR(clear_module_state->__pyx_tuple__35); + Py_CLEAR(clear_module_state->__pyx_tuple__37); + Py_CLEAR(clear_module_state->__pyx_tuple__42); + Py_CLEAR(clear_module_state->__pyx_tuple__44); + Py_CLEAR(clear_module_state->__pyx_tuple__46); + Py_CLEAR(clear_module_state->__pyx_tuple__48); + Py_CLEAR(clear_module_state->__pyx_tuple__50); + Py_CLEAR(clear_module_state->__pyx_tuple__52); + Py_CLEAR(clear_module_state->__pyx_tuple__54); + Py_CLEAR(clear_module_state->__pyx_tuple__58); + Py_CLEAR(clear_module_state->__pyx_codeobj__23); + Py_CLEAR(clear_module_state->__pyx_codeobj__26); + Py_CLEAR(clear_module_state->__pyx_codeobj__28); + Py_CLEAR(clear_module_state->__pyx_codeobj__30); + Py_CLEAR(clear_module_state->__pyx_codeobj__32); + Py_CLEAR(clear_module_state->__pyx_codeobj__34); + Py_CLEAR(clear_module_state->__pyx_codeobj__36); + Py_CLEAR(clear_module_state->__pyx_codeobj__38); + Py_CLEAR(clear_module_state->__pyx_codeobj__39); + Py_CLEAR(clear_module_state->__pyx_codeobj__40); + Py_CLEAR(clear_module_state->__pyx_codeobj__41); + Py_CLEAR(clear_module_state->__pyx_codeobj__43); + Py_CLEAR(clear_module_state->__pyx_codeobj__45); + Py_CLEAR(clear_module_state->__pyx_codeobj__47); + Py_CLEAR(clear_module_state->__pyx_codeobj__49); + Py_CLEAR(clear_module_state->__pyx_codeobj__51); + Py_CLEAR(clear_module_state->__pyx_codeobj__53); + Py_CLEAR(clear_module_state->__pyx_codeobj__55); + Py_CLEAR(clear_module_state->__pyx_codeobj__56); + Py_CLEAR(clear_module_state->__pyx_codeobj__57); + Py_CLEAR(clear_module_state->__pyx_codeobj__59); + Py_CLEAR(clear_module_state->__pyx_codeobj__60); + return 0; +} +#endif +/* #### Code section: module_state_traverse ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { + __pyx_mstate *traverse_module_state = __pyx_mstate(m); + if (!traverse_module_state) return 0; + Py_VISIT(traverse_module_state->__pyx_d); + Py_VISIT(traverse_module_state->__pyx_b); + Py_VISIT(traverse_module_state->__pyx_cython_runtime); + Py_VISIT(traverse_module_state->__pyx_empty_tuple); + Py_VISIT(traverse_module_state->__pyx_empty_bytes); + Py_VISIT(traverse_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_VISIT(traverse_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_VISIT(traverse_module_state->__pyx_FusedFunctionType); + #endif + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type); + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4bool_bool); + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_7complex_complex); + Py_VISIT(traverse_module_state->__pyx_ptype_5arrex_6dtypes_DDType); + Py_VISIT(traverse_module_state->__pyx_ptype_5arrex_4list_typedlist); + Py_VISIT(traverse_module_state->__pyx_type_5arrex_4list_typedlist); + Py_VISIT(traverse_module_state->__pyx_ptype_5arrex_4list_arrayexposer); + Py_VISIT(traverse_module_state->__pyx_type_5arrex_4list_arrayexposer); + Py_VISIT(traverse_module_state->__pyx_ptype_5arrex_4list_arrayiter); + Py_VISIT(traverse_module_state->__pyx_type_5arrex_4list_arrayiter); + Py_VISIT(traverse_module_state->__pyx_n_s_AssertionError); + Py_VISIT(traverse_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0); + Py_VISIT(traverse_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_2); + Py_VISIT(traverse_module_state->__pyx_n_s_IndexError); + Py_VISIT(traverse_module_state->__pyx_n_s_NotImplemented); + Py_VISIT(traverse_module_state->__pyx_n_s_OverflowError); + Py_VISIT(traverse_module_state->__pyx_n_s_PickleBuffer); + Py_VISIT(traverse_module_state->__pyx_n_s_PickleError); + Py_VISIT(traverse_module_state->__pyx_n_s_RuntimeError); + Py_VISIT(traverse_module_state->__pyx_n_s_StopIteration); + Py_VISIT(traverse_module_state->__pyx_n_s_TypeError); + Py_VISIT(traverse_module_state->__pyx_n_s_ValueError); + Py_VISIT(traverse_module_state->__pyx_kp_u__12); + Py_VISIT(traverse_module_state->__pyx_kp_u__13); + Py_VISIT(traverse_module_state->__pyx_kp_u__19); + Py_VISIT(traverse_module_state->__pyx_n_s__21); + Py_VISIT(traverse_module_state->__pyx_n_s__61); + Py_VISIT(traverse_module_state->__pyx_n_s_amount); + Py_VISIT(traverse_module_state->__pyx_kp_u_amount_must_be_positive); + Py_VISIT(traverse_module_state->__pyx_n_s_append); + Py_VISIT(traverse_module_state->__pyx_n_s_array); + Py_VISIT(traverse_module_state->__pyx_n_s_arrayexposer); + Py_VISIT(traverse_module_state->__pyx_n_s_arrayexposer___reduce_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_arrayexposer___setstate_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_arrayiter); + Py_VISIT(traverse_module_state->__pyx_n_s_arrayiter___reduce_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_arrayiter___setstate_cython); + Py_VISIT(traverse_module_state->__pyx_kp_u_arrayiter_must_not_be_instanciat); + Py_VISIT(traverse_module_state->__pyx_n_s_arrex_list); + Py_VISIT(traverse_module_state->__pyx_kp_s_arrex_list_pyx); + Py_VISIT(traverse_module_state->__pyx_n_s_asked); + Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines); + Py_VISIT(traverse_module_state->__pyx_n_s_capacity); + Py_VISIT(traverse_module_state->__pyx_n_s_clear); + Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); + Py_VISIT(traverse_module_state->__pyx_n_s_cls); + Py_VISIT(traverse_module_state->__pyx_n_s_copy); + Py_VISIT(traverse_module_state->__pyx_n_s_data); + Py_VISIT(traverse_module_state->__pyx_n_s_deepcopy); + Py_VISIT(traverse_module_state->__pyx_n_s_dict); + Py_VISIT(traverse_module_state->__pyx_n_s_dict_2); + Py_VISIT(traverse_module_state->__pyx_kp_u_disable); + Py_VISIT(traverse_module_state->__pyx_n_s_dtype); + Py_VISIT(traverse_module_state->__pyx_kp_u_dtype_must_be_a_dtype_declaratio); + Py_VISIT(traverse_module_state->__pyx_kp_u_dtype_must_be_provided_when_it_c); + Py_VISIT(traverse_module_state->__pyx_n_s_e); + Py_VISIT(traverse_module_state->__pyx_n_s_empty); + Py_VISIT(traverse_module_state->__pyx_kp_u_enable); + Py_VISIT(traverse_module_state->__pyx_n_s_enumerate); + Py_VISIT(traverse_module_state->__pyx_n_s_extend); + Py_VISIT(traverse_module_state->__pyx_n_s_first); + Py_VISIT(traverse_module_state->__pyx_n_s_full); + Py_VISIT(traverse_module_state->__pyx_kp_u_gc); + Py_VISIT(traverse_module_state->__pyx_n_s_getrefcount); + Py_VISIT(traverse_module_state->__pyx_n_s_getstate); + Py_VISIT(traverse_module_state->__pyx_n_s_i); + Py_VISIT(traverse_module_state->__pyx_n_s_import); + Py_VISIT(traverse_module_state->__pyx_kp_u_incorrect_slice); + Py_VISIT(traverse_module_state->__pyx_n_s_index); + Py_VISIT(traverse_module_state->__pyx_kp_u_index_must_be_int_or_slice); + Py_VISIT(traverse_module_state->__pyx_kp_u_index_out_of_range); + Py_VISIT(traverse_module_state->__pyx_n_s_initializing); + Py_VISIT(traverse_module_state->__pyx_n_s_insert); + Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine); + Py_VISIT(traverse_module_state->__pyx_kp_u_isenabled); + Py_VISIT(traverse_module_state->__pyx_n_u_iter); + Py_VISIT(traverse_module_state->__pyx_n_s_iterable); + Py_VISIT(traverse_module_state->__pyx_kp_u_iterable_is_empty); + Py_VISIT(traverse_module_state->__pyx_n_s_j); + Py_VISIT(traverse_module_state->__pyx_n_s_l); + Py_VISIT(traverse_module_state->__pyx_n_s_last); + Py_VISIT(traverse_module_state->__pyx_n_s_main); + Py_VISIT(traverse_module_state->__pyx_n_s_memo); + Py_VISIT(traverse_module_state->__pyx_n_s_name); + Py_VISIT(traverse_module_state->__pyx_n_s_new); + Py_VISIT(traverse_module_state->__pyx_n_s_new_2); + Py_VISIT(traverse_module_state->__pyx_n_u_next); + Py_VISIT(traverse_module_state->__pyx_n_s_other); + Py_VISIT(traverse_module_state->__pyx_n_s_owner); + Py_VISIT(traverse_module_state->__pyx_n_s_pickle); + Py_VISIT(traverse_module_state->__pyx_n_s_pop); + Py_VISIT(traverse_module_state->__pyx_kp_u_pop_from_empty_list); + Py_VISIT(traverse_module_state->__pyx_n_s_print); + Py_VISIT(traverse_module_state->__pyx_n_s_protocol); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_PickleError); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_checksum); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_result); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_state); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_type); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_unpickle_arrayexposer); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_unpickle_arrayiter); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_vtable); + Py_VISIT(traverse_module_state->__pyx_n_s_range); + Py_VISIT(traverse_module_state->__pyx_n_s_rebuild); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce_ex); + Py_VISIT(traverse_module_state->__pyx_kp_u_release_buffer); + Py_VISIT(traverse_module_state->__pyx_n_s_reserve); + Py_VISIT(traverse_module_state->__pyx_n_s_reverse); + Py_VISIT(traverse_module_state->__pyx_n_s_self); + Py_VISIT(traverse_module_state->__pyx_n_s_setstate); + Py_VISIT(traverse_module_state->__pyx_n_s_setstate_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_shrink); + Py_VISIT(traverse_module_state->__pyx_n_s_size); + Py_VISIT(traverse_module_state->__pyx_kp_u_slice_step_is_not_supported); + Py_VISIT(traverse_module_state->__pyx_n_s_spec); + Py_VISIT(traverse_module_state->__pyx_n_s_start); + Py_VISIT(traverse_module_state->__pyx_n_s_state); + Py_VISIT(traverse_module_state->__pyx_n_s_staticmethod); + Py_VISIT(traverse_module_state->__pyx_kp_s_stringsource); + Py_VISIT(traverse_module_state->__pyx_n_s_struct); + Py_VISIT(traverse_module_state->__pyx_n_s_stuff); + Py_VISIT(traverse_module_state->__pyx_n_s_sys); + Py_VISIT(traverse_module_state->__pyx_n_s_temp); + Py_VISIT(traverse_module_state->__pyx_n_s_test); + Py_VISIT(traverse_module_state->__pyx_kp_u_the_assigned_value_must_be_a_buf); + Py_VISIT(traverse_module_state->__pyx_kp_u_the_buffer_owner_doens_t_impleme); + Py_VISIT(traverse_module_state->__pyx_kp_u_the_given_buffer_must_have_a_byt); + Py_VISIT(traverse_module_state->__pyx_kp_u_typedlist); + Py_VISIT(traverse_module_state->__pyx_n_s_typedlist_2); + Py_VISIT(traverse_module_state->__pyx_n_s_typedlist___copy); + Py_VISIT(traverse_module_state->__pyx_n_s_typedlist___deepcopy); + Py_VISIT(traverse_module_state->__pyx_n_s_typedlist___reduce_ex); + Py_VISIT(traverse_module_state->__pyx_n_s_typedlist__rebuild); + Py_VISIT(traverse_module_state->__pyx_n_s_typedlist_append); + Py_VISIT(traverse_module_state->__pyx_n_s_typedlist_capacity); + Py_VISIT(traverse_module_state->__pyx_n_s_typedlist_clear); + Py_VISIT(traverse_module_state->__pyx_n_s_typedlist_empty); + Py_VISIT(traverse_module_state->__pyx_n_s_typedlist_extend); + Py_VISIT(traverse_module_state->__pyx_n_s_typedlist_full); + Py_VISIT(traverse_module_state->__pyx_n_s_typedlist_index); + Py_VISIT(traverse_module_state->__pyx_n_s_typedlist_insert); + Py_VISIT(traverse_module_state->__pyx_n_s_typedlist_pop); + Py_VISIT(traverse_module_state->__pyx_n_s_typedlist_reserve); + Py_VISIT(traverse_module_state->__pyx_n_s_typedlist_reverse); + Py_VISIT(traverse_module_state->__pyx_n_s_typedlist_shrink); + Py_VISIT(traverse_module_state->__pyx_n_s_update); + Py_VISIT(traverse_module_state->__pyx_n_s_use_setstate); + Py_VISIT(traverse_module_state->__pyx_n_s_val); + Py_VISIT(traverse_module_state->__pyx_n_s_value); + Py_VISIT(traverse_module_state->__pyx_kp_u_value_not_found); + Py_VISIT(traverse_module_state->__pyx_n_s_view); + Py_VISIT(traverse_module_state->__pyx_int_0); + Py_VISIT(traverse_module_state->__pyx_int_1); + Py_VISIT(traverse_module_state->__pyx_int_5); + Py_VISIT(traverse_module_state->__pyx_int_26530323); + Py_VISIT(traverse_module_state->__pyx_int_94622528); + Py_VISIT(traverse_module_state->__pyx_int_123397093); + Py_VISIT(traverse_module_state->__pyx_int_177361583); + Py_VISIT(traverse_module_state->__pyx_int_199122709); + Py_VISIT(traverse_module_state->__pyx_int_211671663); + Py_VISIT(traverse_module_state->__pyx_tuple_); + Py_VISIT(traverse_module_state->__pyx_tuple__2); + Py_VISIT(traverse_module_state->__pyx_tuple__3); + Py_VISIT(traverse_module_state->__pyx_tuple__4); + Py_VISIT(traverse_module_state->__pyx_tuple__5); + Py_VISIT(traverse_module_state->__pyx_tuple__6); + Py_VISIT(traverse_module_state->__pyx_tuple__7); + Py_VISIT(traverse_module_state->__pyx_tuple__8); + Py_VISIT(traverse_module_state->__pyx_tuple__9); + Py_VISIT(traverse_module_state->__pyx_slice__14); + Py_VISIT(traverse_module_state->__pyx_tuple__10); + Py_VISIT(traverse_module_state->__pyx_tuple__11); + Py_VISIT(traverse_module_state->__pyx_tuple__15); + Py_VISIT(traverse_module_state->__pyx_tuple__16); + Py_VISIT(traverse_module_state->__pyx_tuple__17); + Py_VISIT(traverse_module_state->__pyx_tuple__18); + Py_VISIT(traverse_module_state->__pyx_tuple__20); + Py_VISIT(traverse_module_state->__pyx_tuple__22); + Py_VISIT(traverse_module_state->__pyx_tuple__24); + Py_VISIT(traverse_module_state->__pyx_tuple__25); + Py_VISIT(traverse_module_state->__pyx_tuple__27); + Py_VISIT(traverse_module_state->__pyx_tuple__29); + Py_VISIT(traverse_module_state->__pyx_tuple__31); + Py_VISIT(traverse_module_state->__pyx_tuple__33); + Py_VISIT(traverse_module_state->__pyx_tuple__35); + Py_VISIT(traverse_module_state->__pyx_tuple__37); + Py_VISIT(traverse_module_state->__pyx_tuple__42); + Py_VISIT(traverse_module_state->__pyx_tuple__44); + Py_VISIT(traverse_module_state->__pyx_tuple__46); + Py_VISIT(traverse_module_state->__pyx_tuple__48); + Py_VISIT(traverse_module_state->__pyx_tuple__50); + Py_VISIT(traverse_module_state->__pyx_tuple__52); + Py_VISIT(traverse_module_state->__pyx_tuple__54); + Py_VISIT(traverse_module_state->__pyx_tuple__58); + Py_VISIT(traverse_module_state->__pyx_codeobj__23); + Py_VISIT(traverse_module_state->__pyx_codeobj__26); + Py_VISIT(traverse_module_state->__pyx_codeobj__28); + Py_VISIT(traverse_module_state->__pyx_codeobj__30); + Py_VISIT(traverse_module_state->__pyx_codeobj__32); + Py_VISIT(traverse_module_state->__pyx_codeobj__34); + Py_VISIT(traverse_module_state->__pyx_codeobj__36); + Py_VISIT(traverse_module_state->__pyx_codeobj__38); + Py_VISIT(traverse_module_state->__pyx_codeobj__39); + Py_VISIT(traverse_module_state->__pyx_codeobj__40); + Py_VISIT(traverse_module_state->__pyx_codeobj__41); + Py_VISIT(traverse_module_state->__pyx_codeobj__43); + Py_VISIT(traverse_module_state->__pyx_codeobj__45); + Py_VISIT(traverse_module_state->__pyx_codeobj__47); + Py_VISIT(traverse_module_state->__pyx_codeobj__49); + Py_VISIT(traverse_module_state->__pyx_codeobj__51); + Py_VISIT(traverse_module_state->__pyx_codeobj__53); + Py_VISIT(traverse_module_state->__pyx_codeobj__55); + Py_VISIT(traverse_module_state->__pyx_codeobj__56); + Py_VISIT(traverse_module_state->__pyx_codeobj__57); + Py_VISIT(traverse_module_state->__pyx_codeobj__59); + Py_VISIT(traverse_module_state->__pyx_codeobj__60); + return 0; } +#endif +/* #### Code section: module_state_defines ### */ +#define __pyx_d __pyx_mstate_global->__pyx_d +#define __pyx_b __pyx_mstate_global->__pyx_b +#define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime +#define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple +#define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes +#define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode +#ifdef __Pyx_CyFunction_USED +#define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType +#endif +#ifdef __Pyx_FusedFunction_USED +#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType +#endif +#ifdef __Pyx_Generator_USED +#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType +#endif +#ifdef __Pyx_IterableCoroutine_USED +#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_7cpython_4type_type __pyx_mstate_global->__pyx_ptype_7cpython_4type_type +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_7cpython_4bool_bool __pyx_mstate_global->__pyx_ptype_7cpython_4bool_bool +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_7cpython_7complex_complex __pyx_mstate_global->__pyx_ptype_7cpython_7complex_complex +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_5arrex_6dtypes_DDType __pyx_mstate_global->__pyx_ptype_5arrex_6dtypes_DDType +#if CYTHON_USE_MODULE_STATE +#define __pyx_type_5arrex_4list_typedlist __pyx_mstate_global->__pyx_type_5arrex_4list_typedlist +#define __pyx_type_5arrex_4list_arrayexposer __pyx_mstate_global->__pyx_type_5arrex_4list_arrayexposer +#define __pyx_type_5arrex_4list_arrayiter __pyx_mstate_global->__pyx_type_5arrex_4list_arrayiter +#endif +#define __pyx_ptype_5arrex_4list_typedlist __pyx_mstate_global->__pyx_ptype_5arrex_4list_typedlist +#define __pyx_ptype_5arrex_4list_arrayexposer __pyx_mstate_global->__pyx_ptype_5arrex_4list_arrayexposer +#define __pyx_ptype_5arrex_4list_arrayiter __pyx_mstate_global->__pyx_ptype_5arrex_4list_arrayiter +#define __pyx_n_s_AssertionError __pyx_mstate_global->__pyx_n_s_AssertionError +#define __pyx_kp_s_Incompatible_checksums_0x_x_vs_0 __pyx_mstate_global->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0 +#define __pyx_kp_s_Incompatible_checksums_0x_x_vs_0_2 __pyx_mstate_global->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_2 +#define __pyx_n_s_IndexError __pyx_mstate_global->__pyx_n_s_IndexError +#define __pyx_n_s_NotImplemented __pyx_mstate_global->__pyx_n_s_NotImplemented +#define __pyx_n_s_OverflowError __pyx_mstate_global->__pyx_n_s_OverflowError +#define __pyx_n_s_PickleBuffer __pyx_mstate_global->__pyx_n_s_PickleBuffer +#define __pyx_n_s_PickleError __pyx_mstate_global->__pyx_n_s_PickleError +#define __pyx_n_s_RuntimeError __pyx_mstate_global->__pyx_n_s_RuntimeError +#define __pyx_n_s_StopIteration __pyx_mstate_global->__pyx_n_s_StopIteration +#define __pyx_n_s_TypeError __pyx_mstate_global->__pyx_n_s_TypeError +#define __pyx_n_s_ValueError __pyx_mstate_global->__pyx_n_s_ValueError +#define __pyx_kp_u__12 __pyx_mstate_global->__pyx_kp_u__12 +#define __pyx_kp_u__13 __pyx_mstate_global->__pyx_kp_u__13 +#define __pyx_kp_u__19 __pyx_mstate_global->__pyx_kp_u__19 +#define __pyx_n_s__21 __pyx_mstate_global->__pyx_n_s__21 +#define __pyx_n_s__61 __pyx_mstate_global->__pyx_n_s__61 +#define __pyx_n_s_amount __pyx_mstate_global->__pyx_n_s_amount +#define __pyx_kp_u_amount_must_be_positive __pyx_mstate_global->__pyx_kp_u_amount_must_be_positive +#define __pyx_n_s_append __pyx_mstate_global->__pyx_n_s_append +#define __pyx_n_s_array __pyx_mstate_global->__pyx_n_s_array +#define __pyx_n_s_arrayexposer __pyx_mstate_global->__pyx_n_s_arrayexposer +#define __pyx_n_s_arrayexposer___reduce_cython __pyx_mstate_global->__pyx_n_s_arrayexposer___reduce_cython +#define __pyx_n_s_arrayexposer___setstate_cython __pyx_mstate_global->__pyx_n_s_arrayexposer___setstate_cython +#define __pyx_n_s_arrayiter __pyx_mstate_global->__pyx_n_s_arrayiter +#define __pyx_n_s_arrayiter___reduce_cython __pyx_mstate_global->__pyx_n_s_arrayiter___reduce_cython +#define __pyx_n_s_arrayiter___setstate_cython __pyx_mstate_global->__pyx_n_s_arrayiter___setstate_cython +#define __pyx_kp_u_arrayiter_must_not_be_instanciat __pyx_mstate_global->__pyx_kp_u_arrayiter_must_not_be_instanciat +#define __pyx_n_s_arrex_list __pyx_mstate_global->__pyx_n_s_arrex_list +#define __pyx_kp_s_arrex_list_pyx __pyx_mstate_global->__pyx_kp_s_arrex_list_pyx +#define __pyx_n_s_asked __pyx_mstate_global->__pyx_n_s_asked +#define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines +#define __pyx_n_s_capacity __pyx_mstate_global->__pyx_n_s_capacity +#define __pyx_n_s_clear __pyx_mstate_global->__pyx_n_s_clear +#define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback +#define __pyx_n_s_cls __pyx_mstate_global->__pyx_n_s_cls +#define __pyx_n_s_copy __pyx_mstate_global->__pyx_n_s_copy +#define __pyx_n_s_data __pyx_mstate_global->__pyx_n_s_data +#define __pyx_n_s_deepcopy __pyx_mstate_global->__pyx_n_s_deepcopy +#define __pyx_n_s_dict __pyx_mstate_global->__pyx_n_s_dict +#define __pyx_n_s_dict_2 __pyx_mstate_global->__pyx_n_s_dict_2 +#define __pyx_kp_u_disable __pyx_mstate_global->__pyx_kp_u_disable +#define __pyx_n_s_dtype __pyx_mstate_global->__pyx_n_s_dtype +#define __pyx_kp_u_dtype_must_be_a_dtype_declaratio __pyx_mstate_global->__pyx_kp_u_dtype_must_be_a_dtype_declaratio +#define __pyx_kp_u_dtype_must_be_provided_when_it_c __pyx_mstate_global->__pyx_kp_u_dtype_must_be_provided_when_it_c +#define __pyx_n_s_e __pyx_mstate_global->__pyx_n_s_e +#define __pyx_n_s_empty __pyx_mstate_global->__pyx_n_s_empty +#define __pyx_kp_u_enable __pyx_mstate_global->__pyx_kp_u_enable +#define __pyx_n_s_enumerate __pyx_mstate_global->__pyx_n_s_enumerate +#define __pyx_n_s_extend __pyx_mstate_global->__pyx_n_s_extend +#define __pyx_n_s_first __pyx_mstate_global->__pyx_n_s_first +#define __pyx_n_s_full __pyx_mstate_global->__pyx_n_s_full +#define __pyx_kp_u_gc __pyx_mstate_global->__pyx_kp_u_gc +#define __pyx_n_s_getrefcount __pyx_mstate_global->__pyx_n_s_getrefcount +#define __pyx_n_s_getstate __pyx_mstate_global->__pyx_n_s_getstate +#define __pyx_n_s_i __pyx_mstate_global->__pyx_n_s_i +#define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import +#define __pyx_kp_u_incorrect_slice __pyx_mstate_global->__pyx_kp_u_incorrect_slice +#define __pyx_n_s_index __pyx_mstate_global->__pyx_n_s_index +#define __pyx_kp_u_index_must_be_int_or_slice __pyx_mstate_global->__pyx_kp_u_index_must_be_int_or_slice +#define __pyx_kp_u_index_out_of_range __pyx_mstate_global->__pyx_kp_u_index_out_of_range +#define __pyx_n_s_initializing __pyx_mstate_global->__pyx_n_s_initializing +#define __pyx_n_s_insert __pyx_mstate_global->__pyx_n_s_insert +#define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine +#define __pyx_kp_u_isenabled __pyx_mstate_global->__pyx_kp_u_isenabled +#define __pyx_n_u_iter __pyx_mstate_global->__pyx_n_u_iter +#define __pyx_n_s_iterable __pyx_mstate_global->__pyx_n_s_iterable +#define __pyx_kp_u_iterable_is_empty __pyx_mstate_global->__pyx_kp_u_iterable_is_empty +#define __pyx_n_s_j __pyx_mstate_global->__pyx_n_s_j +#define __pyx_n_s_l __pyx_mstate_global->__pyx_n_s_l +#define __pyx_n_s_last __pyx_mstate_global->__pyx_n_s_last +#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main +#define __pyx_n_s_memo __pyx_mstate_global->__pyx_n_s_memo +#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name +#define __pyx_n_s_new __pyx_mstate_global->__pyx_n_s_new +#define __pyx_n_s_new_2 __pyx_mstate_global->__pyx_n_s_new_2 +#define __pyx_n_u_next __pyx_mstate_global->__pyx_n_u_next +#define __pyx_n_s_other __pyx_mstate_global->__pyx_n_s_other +#define __pyx_n_s_owner __pyx_mstate_global->__pyx_n_s_owner +#define __pyx_n_s_pickle __pyx_mstate_global->__pyx_n_s_pickle +#define __pyx_n_s_pop __pyx_mstate_global->__pyx_n_s_pop +#define __pyx_kp_u_pop_from_empty_list __pyx_mstate_global->__pyx_kp_u_pop_from_empty_list +#define __pyx_n_s_print __pyx_mstate_global->__pyx_n_s_print +#define __pyx_n_s_protocol __pyx_mstate_global->__pyx_n_s_protocol +#define __pyx_n_s_pyx_PickleError __pyx_mstate_global->__pyx_n_s_pyx_PickleError +#define __pyx_n_s_pyx_checksum __pyx_mstate_global->__pyx_n_s_pyx_checksum +#define __pyx_n_s_pyx_result __pyx_mstate_global->__pyx_n_s_pyx_result +#define __pyx_n_s_pyx_state __pyx_mstate_global->__pyx_n_s_pyx_state +#define __pyx_n_s_pyx_type __pyx_mstate_global->__pyx_n_s_pyx_type +#define __pyx_n_s_pyx_unpickle_arrayexposer __pyx_mstate_global->__pyx_n_s_pyx_unpickle_arrayexposer +#define __pyx_n_s_pyx_unpickle_arrayiter __pyx_mstate_global->__pyx_n_s_pyx_unpickle_arrayiter +#define __pyx_n_s_pyx_vtable __pyx_mstate_global->__pyx_n_s_pyx_vtable +#define __pyx_n_s_range __pyx_mstate_global->__pyx_n_s_range +#define __pyx_n_s_rebuild __pyx_mstate_global->__pyx_n_s_rebuild +#define __pyx_n_s_reduce __pyx_mstate_global->__pyx_n_s_reduce +#define __pyx_n_s_reduce_cython __pyx_mstate_global->__pyx_n_s_reduce_cython +#define __pyx_n_s_reduce_ex __pyx_mstate_global->__pyx_n_s_reduce_ex +#define __pyx_kp_u_release_buffer __pyx_mstate_global->__pyx_kp_u_release_buffer +#define __pyx_n_s_reserve __pyx_mstate_global->__pyx_n_s_reserve +#define __pyx_n_s_reverse __pyx_mstate_global->__pyx_n_s_reverse +#define __pyx_n_s_self __pyx_mstate_global->__pyx_n_s_self +#define __pyx_n_s_setstate __pyx_mstate_global->__pyx_n_s_setstate +#define __pyx_n_s_setstate_cython __pyx_mstate_global->__pyx_n_s_setstate_cython +#define __pyx_n_s_shrink __pyx_mstate_global->__pyx_n_s_shrink +#define __pyx_n_s_size __pyx_mstate_global->__pyx_n_s_size +#define __pyx_kp_u_slice_step_is_not_supported __pyx_mstate_global->__pyx_kp_u_slice_step_is_not_supported +#define __pyx_n_s_spec __pyx_mstate_global->__pyx_n_s_spec +#define __pyx_n_s_start __pyx_mstate_global->__pyx_n_s_start +#define __pyx_n_s_state __pyx_mstate_global->__pyx_n_s_state +#define __pyx_n_s_staticmethod __pyx_mstate_global->__pyx_n_s_staticmethod +#define __pyx_kp_s_stringsource __pyx_mstate_global->__pyx_kp_s_stringsource +#define __pyx_n_s_struct __pyx_mstate_global->__pyx_n_s_struct +#define __pyx_n_s_stuff __pyx_mstate_global->__pyx_n_s_stuff +#define __pyx_n_s_sys __pyx_mstate_global->__pyx_n_s_sys +#define __pyx_n_s_temp __pyx_mstate_global->__pyx_n_s_temp +#define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test +#define __pyx_kp_u_the_assigned_value_must_be_a_buf __pyx_mstate_global->__pyx_kp_u_the_assigned_value_must_be_a_buf +#define __pyx_kp_u_the_buffer_owner_doens_t_impleme __pyx_mstate_global->__pyx_kp_u_the_buffer_owner_doens_t_impleme +#define __pyx_kp_u_the_given_buffer_must_have_a_byt __pyx_mstate_global->__pyx_kp_u_the_given_buffer_must_have_a_byt +#define __pyx_kp_u_typedlist __pyx_mstate_global->__pyx_kp_u_typedlist +#define __pyx_n_s_typedlist_2 __pyx_mstate_global->__pyx_n_s_typedlist_2 +#define __pyx_n_s_typedlist___copy __pyx_mstate_global->__pyx_n_s_typedlist___copy +#define __pyx_n_s_typedlist___deepcopy __pyx_mstate_global->__pyx_n_s_typedlist___deepcopy +#define __pyx_n_s_typedlist___reduce_ex __pyx_mstate_global->__pyx_n_s_typedlist___reduce_ex +#define __pyx_n_s_typedlist__rebuild __pyx_mstate_global->__pyx_n_s_typedlist__rebuild +#define __pyx_n_s_typedlist_append __pyx_mstate_global->__pyx_n_s_typedlist_append +#define __pyx_n_s_typedlist_capacity __pyx_mstate_global->__pyx_n_s_typedlist_capacity +#define __pyx_n_s_typedlist_clear __pyx_mstate_global->__pyx_n_s_typedlist_clear +#define __pyx_n_s_typedlist_empty __pyx_mstate_global->__pyx_n_s_typedlist_empty +#define __pyx_n_s_typedlist_extend __pyx_mstate_global->__pyx_n_s_typedlist_extend +#define __pyx_n_s_typedlist_full __pyx_mstate_global->__pyx_n_s_typedlist_full +#define __pyx_n_s_typedlist_index __pyx_mstate_global->__pyx_n_s_typedlist_index +#define __pyx_n_s_typedlist_insert __pyx_mstate_global->__pyx_n_s_typedlist_insert +#define __pyx_n_s_typedlist_pop __pyx_mstate_global->__pyx_n_s_typedlist_pop +#define __pyx_n_s_typedlist_reserve __pyx_mstate_global->__pyx_n_s_typedlist_reserve +#define __pyx_n_s_typedlist_reverse __pyx_mstate_global->__pyx_n_s_typedlist_reverse +#define __pyx_n_s_typedlist_shrink __pyx_mstate_global->__pyx_n_s_typedlist_shrink +#define __pyx_n_s_update __pyx_mstate_global->__pyx_n_s_update +#define __pyx_n_s_use_setstate __pyx_mstate_global->__pyx_n_s_use_setstate +#define __pyx_n_s_val __pyx_mstate_global->__pyx_n_s_val +#define __pyx_n_s_value __pyx_mstate_global->__pyx_n_s_value +#define __pyx_kp_u_value_not_found __pyx_mstate_global->__pyx_kp_u_value_not_found +#define __pyx_n_s_view __pyx_mstate_global->__pyx_n_s_view +#define __pyx_int_0 __pyx_mstate_global->__pyx_int_0 +#define __pyx_int_1 __pyx_mstate_global->__pyx_int_1 +#define __pyx_int_5 __pyx_mstate_global->__pyx_int_5 +#define __pyx_int_26530323 __pyx_mstate_global->__pyx_int_26530323 +#define __pyx_int_94622528 __pyx_mstate_global->__pyx_int_94622528 +#define __pyx_int_123397093 __pyx_mstate_global->__pyx_int_123397093 +#define __pyx_int_177361583 __pyx_mstate_global->__pyx_int_177361583 +#define __pyx_int_199122709 __pyx_mstate_global->__pyx_int_199122709 +#define __pyx_int_211671663 __pyx_mstate_global->__pyx_int_211671663 +#define __pyx_tuple_ __pyx_mstate_global->__pyx_tuple_ +#define __pyx_tuple__2 __pyx_mstate_global->__pyx_tuple__2 +#define __pyx_tuple__3 __pyx_mstate_global->__pyx_tuple__3 +#define __pyx_tuple__4 __pyx_mstate_global->__pyx_tuple__4 +#define __pyx_tuple__5 __pyx_mstate_global->__pyx_tuple__5 +#define __pyx_tuple__6 __pyx_mstate_global->__pyx_tuple__6 +#define __pyx_tuple__7 __pyx_mstate_global->__pyx_tuple__7 +#define __pyx_tuple__8 __pyx_mstate_global->__pyx_tuple__8 +#define __pyx_tuple__9 __pyx_mstate_global->__pyx_tuple__9 +#define __pyx_slice__14 __pyx_mstate_global->__pyx_slice__14 +#define __pyx_tuple__10 __pyx_mstate_global->__pyx_tuple__10 +#define __pyx_tuple__11 __pyx_mstate_global->__pyx_tuple__11 +#define __pyx_tuple__15 __pyx_mstate_global->__pyx_tuple__15 +#define __pyx_tuple__16 __pyx_mstate_global->__pyx_tuple__16 +#define __pyx_tuple__17 __pyx_mstate_global->__pyx_tuple__17 +#define __pyx_tuple__18 __pyx_mstate_global->__pyx_tuple__18 +#define __pyx_tuple__20 __pyx_mstate_global->__pyx_tuple__20 +#define __pyx_tuple__22 __pyx_mstate_global->__pyx_tuple__22 +#define __pyx_tuple__24 __pyx_mstate_global->__pyx_tuple__24 +#define __pyx_tuple__25 __pyx_mstate_global->__pyx_tuple__25 +#define __pyx_tuple__27 __pyx_mstate_global->__pyx_tuple__27 +#define __pyx_tuple__29 __pyx_mstate_global->__pyx_tuple__29 +#define __pyx_tuple__31 __pyx_mstate_global->__pyx_tuple__31 +#define __pyx_tuple__33 __pyx_mstate_global->__pyx_tuple__33 +#define __pyx_tuple__35 __pyx_mstate_global->__pyx_tuple__35 +#define __pyx_tuple__37 __pyx_mstate_global->__pyx_tuple__37 +#define __pyx_tuple__42 __pyx_mstate_global->__pyx_tuple__42 +#define __pyx_tuple__44 __pyx_mstate_global->__pyx_tuple__44 +#define __pyx_tuple__46 __pyx_mstate_global->__pyx_tuple__46 +#define __pyx_tuple__48 __pyx_mstate_global->__pyx_tuple__48 +#define __pyx_tuple__50 __pyx_mstate_global->__pyx_tuple__50 +#define __pyx_tuple__52 __pyx_mstate_global->__pyx_tuple__52 +#define __pyx_tuple__54 __pyx_mstate_global->__pyx_tuple__54 +#define __pyx_tuple__58 __pyx_mstate_global->__pyx_tuple__58 +#define __pyx_codeobj__23 __pyx_mstate_global->__pyx_codeobj__23 +#define __pyx_codeobj__26 __pyx_mstate_global->__pyx_codeobj__26 +#define __pyx_codeobj__28 __pyx_mstate_global->__pyx_codeobj__28 +#define __pyx_codeobj__30 __pyx_mstate_global->__pyx_codeobj__30 +#define __pyx_codeobj__32 __pyx_mstate_global->__pyx_codeobj__32 +#define __pyx_codeobj__34 __pyx_mstate_global->__pyx_codeobj__34 +#define __pyx_codeobj__36 __pyx_mstate_global->__pyx_codeobj__36 +#define __pyx_codeobj__38 __pyx_mstate_global->__pyx_codeobj__38 +#define __pyx_codeobj__39 __pyx_mstate_global->__pyx_codeobj__39 +#define __pyx_codeobj__40 __pyx_mstate_global->__pyx_codeobj__40 +#define __pyx_codeobj__41 __pyx_mstate_global->__pyx_codeobj__41 +#define __pyx_codeobj__43 __pyx_mstate_global->__pyx_codeobj__43 +#define __pyx_codeobj__45 __pyx_mstate_global->__pyx_codeobj__45 +#define __pyx_codeobj__47 __pyx_mstate_global->__pyx_codeobj__47 +#define __pyx_codeobj__49 __pyx_mstate_global->__pyx_codeobj__49 +#define __pyx_codeobj__51 __pyx_mstate_global->__pyx_codeobj__51 +#define __pyx_codeobj__53 __pyx_mstate_global->__pyx_codeobj__53 +#define __pyx_codeobj__55 __pyx_mstate_global->__pyx_codeobj__55 +#define __pyx_codeobj__56 __pyx_mstate_global->__pyx_codeobj__56 +#define __pyx_codeobj__57 __pyx_mstate_global->__pyx_codeobj__57 +#define __pyx_codeobj__59 __pyx_mstate_global->__pyx_codeobj__59 +#define __pyx_codeobj__60 __pyx_mstate_global->__pyx_codeobj__60 +/* #### Code section: module_code ### */ + +/* "carray.to_py":114 + * + * @cname("__Pyx_carray_to_py_Py_ssize_t") + * cdef inline list __Pyx_carray_to_py_Py_ssize_t(base_type *v, Py_ssize_t length): # <<<<<<<<<<<<<< + * cdef size_t i + * cdef object value + */ -static PyObject *__pyx_pf_5arrex_4list_9typedlist_6ddtype___get__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self) { +static CYTHON_INLINE PyObject *__Pyx_carray_to_py_Py_ssize_t(Py_ssize_t *__pyx_v_v, Py_ssize_t __pyx_v_length) { + size_t __pyx_v_i; + PyObject *__pyx_v_value = 0; + PyObject *__pyx_v_l = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); + PyObject *__pyx_t_1 = NULL; + size_t __pyx_t_2; + size_t __pyx_t_3; + size_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_carray_to_py_Py_ssize_t", 0); - /* "arrex/list.pyx":130 - * def ddtype(self): - * ''' the declaration of the dtype, a DDType instance ''' - * return self.dtype # <<<<<<<<<<<<<< + /* "carray.to_py":117 + * cdef size_t i + * cdef object value + * l = PyList_New(length) # <<<<<<<<<<<<<< + * for i in range(length): + * value = v[i] + */ + __pyx_t_1 = PyList_New(__pyx_v_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_l = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "carray.to_py":118 + * cdef object value + * l = PyList_New(length) + * for i in range(length): # <<<<<<<<<<<<<< + * value = v[i] + * Py_INCREF(value) + */ + __pyx_t_2 = ((size_t)__pyx_v_length); + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "carray.to_py":119 + * l = PyList_New(length) + * for i in range(length): + * value = v[i] # <<<<<<<<<<<<<< + * Py_INCREF(value) + * PyList_SET_ITEM(l, i, value) + */ + __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_1); + __pyx_t_1 = 0; + + /* "carray.to_py":120 + * for i in range(length): + * value = v[i] + * Py_INCREF(value) # <<<<<<<<<<<<<< + * PyList_SET_ITEM(l, i, value) + * return l + */ + Py_INCREF(__pyx_v_value); + + /* "carray.to_py":121 + * value = v[i] + * Py_INCREF(value) + * PyList_SET_ITEM(l, i, value) # <<<<<<<<<<<<<< + * return l + * + */ + PyList_SET_ITEM(__pyx_v_l, __pyx_v_i, __pyx_v_value); + } + + /* "carray.to_py":122 + * Py_INCREF(value) + * PyList_SET_ITEM(l, i, value) + * return l # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self->dtype)); - __pyx_r = ((PyObject *)__pyx_v_self->dtype); + __Pyx_INCREF(__pyx_v_l); + __pyx_r = __pyx_v_l; goto __pyx_L0; - /* "arrex/list.pyx":128 + /* "carray.to_py":114 * - * @property - * def ddtype(self): # <<<<<<<<<<<<<< - * ''' the declaration of the dtype, a DDType instance ''' - * return self.dtype + * @cname("__Pyx_carray_to_py_Py_ssize_t") + * cdef inline list __Pyx_carray_to_py_Py_ssize_t(base_type *v, Py_ssize_t length): # <<<<<<<<<<<<<< + * cdef size_t i + * cdef object value */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("carray.to_py.__Pyx_carray_to_py_Py_ssize_t", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_value); + __Pyx_XDECREF(__pyx_v_l); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "arrex/list.pyx":133 - * +/* "carray.to_py":126 * - * def __init__(self, iterable=None, object dtype=None, size_t reserve=0): # <<<<<<<<<<<<<< - * # look at the type of the first element - * first = None + * @cname("__Pyx_carray_to_tuple_Py_ssize_t") + * cdef inline tuple __Pyx_carray_to_tuple_Py_ssize_t(base_type *v, Py_ssize_t length): # <<<<<<<<<<<<<< + * cdef size_t i + * cdef object value */ -/* Python wrapper */ -static int __pyx_pw_5arrex_4list_9typedlist_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_5arrex_4list_9typedlist_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_iterable = 0; - PyObject *__pyx_v_dtype = 0; - size_t __pyx_v_reserve; +static CYTHON_INLINE PyObject *__Pyx_carray_to_tuple_Py_ssize_t(Py_ssize_t *__pyx_v_v, Py_ssize_t __pyx_v_length) { + size_t __pyx_v_i; + PyObject *__pyx_v_value = 0; + PyObject *__pyx_v_t = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + size_t __pyx_t_2; + size_t __pyx_t_3; + size_t __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_iterable,&__pyx_n_s_dtype,&__pyx_n_s_reserve,0}; - PyObject* values[3] = {0,0,0}; - values[0] = ((PyObject *)Py_None); - values[1] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_iterable); - if (value) { values[0] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 1: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype); - if (value) { values[1] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 2: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reserve); - if (value) { values[2] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 133, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_iterable = values[0]; - __pyx_v_dtype = values[1]; - if (values[2]) { - __pyx_v_reserve = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_reserve == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 133, __pyx_L3_error) - } else { - __pyx_v_reserve = ((size_t)0); - } + __Pyx_RefNannySetupContext("__Pyx_carray_to_tuple_Py_ssize_t", 0); + + /* "carray.to_py":129 + * cdef size_t i + * cdef object value + * t = PyTuple_New(length) # <<<<<<<<<<<<<< + * for i in range(length): + * value = v[i] + */ + __pyx_t_1 = PyTuple_New(__pyx_v_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_t = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "carray.to_py":130 + * cdef object value + * t = PyTuple_New(length) + * for i in range(length): # <<<<<<<<<<<<<< + * value = v[i] + * Py_INCREF(value) + */ + __pyx_t_2 = ((size_t)__pyx_v_length); + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "carray.to_py":131 + * t = PyTuple_New(length) + * for i in range(length): + * value = v[i] # <<<<<<<<<<<<<< + * Py_INCREF(value) + * PyTuple_SET_ITEM(t, i, value) + */ + __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_1); + __pyx_t_1 = 0; + + /* "carray.to_py":132 + * for i in range(length): + * value = v[i] + * Py_INCREF(value) # <<<<<<<<<<<<<< + * PyTuple_SET_ITEM(t, i, value) + * return t + */ + Py_INCREF(__pyx_v_value); + + /* "carray.to_py":133 + * value = v[i] + * Py_INCREF(value) + * PyTuple_SET_ITEM(t, i, value) # <<<<<<<<<<<<<< + * return t + */ + PyTuple_SET_ITEM(__pyx_v_t, __pyx_v_i, __pyx_v_value); } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 133, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("arrex.list.typedlist.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5arrex_4list_9typedlist___init__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), __pyx_v_iterable, __pyx_v_dtype, __pyx_v_reserve); + + /* "carray.to_py":134 + * Py_INCREF(value) + * PyTuple_SET_ITEM(t, i, value) + * return t # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_t); + __pyx_r = __pyx_v_t; + goto __pyx_L0; + + /* "carray.to_py":126 + * + * @cname("__Pyx_carray_to_tuple_Py_ssize_t") + * cdef inline tuple __Pyx_carray_to_tuple_Py_ssize_t(base_type *v, Py_ssize_t length): # <<<<<<<<<<<<<< + * cdef size_t i + * cdef object value + */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("carray.to_py.__Pyx_carray_to_tuple_Py_ssize_t", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_value); + __Pyx_XDECREF(__pyx_v_t); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_5arrex_4list_9typedlist___init__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_iterable, PyObject *__pyx_v_dtype, size_t __pyx_v_reserve) { - PyObject *__pyx_v_first = NULL; +/* "carray.from_py":79 + * + * @cname("__Pyx_carray_from_py_Py_ssize_t") + * cdef int __Pyx_carray_from_py_Py_ssize_t(object o, base_type *v, Py_ssize_t length) except -1: # <<<<<<<<<<<<<< + * cdef Py_ssize_t i = length + * try: + */ + +static int __Pyx_carray_from_py_Py_ssize_t(PyObject *__pyx_v_o, Py_ssize_t *__pyx_v_v, Py_ssize_t __pyx_v_length) { + Py_ssize_t __pyx_v_i; + PyObject *__pyx_v_item = NULL; int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; + 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; + Py_ssize_t __pyx_t_4; + int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; + Py_ssize_t __pyx_t_8; + PyObject *(*__pyx_t_9)(PyObject *); PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - size_t __pyx_t_12; + Py_ssize_t __pyx_t_11; + char const *__pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__", 0); - __Pyx_INCREF(__pyx_v_iterable); - __Pyx_INCREF(__pyx_v_dtype); + __Pyx_RefNannySetupContext("__Pyx_carray_from_py_Py_ssize_t", 0); - /* "arrex/list.pyx":135 - * def __init__(self, iterable=None, object dtype=None, size_t reserve=0): - * # look at the type of the first element - * first = None # <<<<<<<<<<<<<< - * if not dtype: - * try: + /* "carray.from_py":80 + * @cname("__Pyx_carray_from_py_Py_ssize_t") + * cdef int __Pyx_carray_from_py_Py_ssize_t(object o, base_type *v, Py_ssize_t length) except -1: + * cdef Py_ssize_t i = length # <<<<<<<<<<<<<< + * try: + * i = len(o) */ - __Pyx_INCREF(Py_None); - __pyx_v_first = Py_None; + __pyx_v_i = __pyx_v_length; - /* "arrex/list.pyx":136 - * # look at the type of the first element - * first = None - * if not dtype: # <<<<<<<<<<<<<< - * try: - * if isinstance(iterable, type) and not dtype: + /* "carray.from_py":81 + * cdef int __Pyx_carray_from_py_Py_ssize_t(object o, base_type *v, Py_ssize_t length) except -1: + * cdef Py_ssize_t i = length + * try: # <<<<<<<<<<<<<< + * i = len(o) + * except (TypeError, OverflowError): */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_dtype); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 136, __pyx_L1_error) - __pyx_t_2 = ((!__pyx_t_1) != 0); - if (__pyx_t_2) { + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { - /* "arrex/list.pyx":137 - * first = None - * if not dtype: - * try: # <<<<<<<<<<<<<< - * if isinstance(iterable, type) and not dtype: - * iterable, dtype = None, iterable + /* "carray.from_py":82 + * cdef Py_ssize_t i = length + * try: + * i = len(o) # <<<<<<<<<<<<<< + * except (TypeError, OverflowError): + * pass */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); - __Pyx_XGOTREF(__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_4); - __Pyx_XGOTREF(__pyx_t_5); - /*try:*/ { + __pyx_t_4 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 82, __pyx_L3_error) + __pyx_v_i = __pyx_t_4; - /* "arrex/list.pyx":138 - * if not dtype: - * try: - * if isinstance(iterable, type) and not dtype: # <<<<<<<<<<<<<< - * iterable, dtype = None, iterable - * elif hasattr(iterable, '__next__'): + /* "carray.from_py":81 + * cdef int __Pyx_carray_from_py_Py_ssize_t(object o, base_type *v, Py_ssize_t length) except -1: + * cdef Py_ssize_t i = length + * try: # <<<<<<<<<<<<<< + * i = len(o) + * except (TypeError, OverflowError): */ - __pyx_t_1 = PyType_Check(__pyx_v_iterable); - __pyx_t_6 = (__pyx_t_1 != 0); - if (__pyx_t_6) { - } else { - __pyx_t_2 = __pyx_t_6; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_dtype); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 138, __pyx_L4_error) - __pyx_t_1 = ((!__pyx_t_6) != 0); - __pyx_t_2 = __pyx_t_1; - __pyx_L11_bool_binop_done:; - if (__pyx_t_2) { + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; - /* "arrex/list.pyx":139 - * try: - * if isinstance(iterable, type) and not dtype: - * iterable, dtype = None, iterable # <<<<<<<<<<<<<< - * elif hasattr(iterable, '__next__'): - * first = next(iterable) - */ - __pyx_t_7 = Py_None; - __Pyx_INCREF(__pyx_t_7); - __pyx_t_8 = __pyx_v_iterable; - __Pyx_INCREF(__pyx_t_8); - __Pyx_DECREF_SET(__pyx_v_iterable, __pyx_t_7); - __pyx_t_7 = 0; - __Pyx_DECREF_SET(__pyx_v_dtype, __pyx_t_8); - __pyx_t_8 = 0; + /* "carray.from_py":83 + * try: + * i = len(o) + * except (TypeError, OverflowError): # <<<<<<<<<<<<<< + * pass + * if i == length: + */ + __pyx_t_5 = __Pyx_PyErr_ExceptionMatches2(__pyx_builtin_TypeError, __pyx_builtin_OverflowError); + if (__pyx_t_5) { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L4_exception_handled; + } + goto __pyx_L5_except_error; - /* "arrex/list.pyx":138 - * if not dtype: - * try: - * if isinstance(iterable, type) and not dtype: # <<<<<<<<<<<<<< - * iterable, dtype = None, iterable - * elif hasattr(iterable, '__next__'): + /* "carray.from_py":81 + * cdef int __Pyx_carray_from_py_Py_ssize_t(object o, base_type *v, Py_ssize_t length) except -1: + * cdef Py_ssize_t i = length + * try: # <<<<<<<<<<<<<< + * i = len(o) + * except (TypeError, OverflowError): */ - goto __pyx_L10; - } + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L4_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L8_try_end:; + } - /* "arrex/list.pyx":140 - * if isinstance(iterable, type) and not dtype: - * iterable, dtype = None, iterable - * elif hasattr(iterable, '__next__'): # <<<<<<<<<<<<<< - * first = next(iterable) - * dtype = type(first) + /* "carray.from_py":85 + * except (TypeError, OverflowError): + * pass + * if i == length: # <<<<<<<<<<<<<< + * for i, item in enumerate(o): + * if i >= length: */ - __pyx_t_2 = __Pyx_HasAttr(__pyx_v_iterable, __pyx_n_u_next); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 140, __pyx_L4_error) - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { + __pyx_t_6 = (__pyx_v_i == __pyx_v_length); + if (__pyx_t_6) { - /* "arrex/list.pyx":141 - * iterable, dtype = None, iterable - * elif hasattr(iterable, '__next__'): - * first = next(iterable) # <<<<<<<<<<<<<< - * dtype = type(first) - * elif hasattr(iterable, '__iter__'): + /* "carray.from_py":86 + * pass + * if i == length: + * for i, item in enumerate(o): # <<<<<<<<<<<<<< + * if i >= length: + * break */ - __pyx_t_8 = __Pyx_PyIter_Next(__pyx_v_iterable); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 141, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF_SET(__pyx_v_first, __pyx_t_8); - __pyx_t_8 = 0; + __pyx_t_4 = 0; + if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) { + __pyx_t_7 = __pyx_v_o; __Pyx_INCREF(__pyx_t_7); __pyx_t_8 = 0; + __pyx_t_9 = NULL; + } else { + __pyx_t_8 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 86, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_9)) { + if (likely(PyList_CheckExact(__pyx_t_7))) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_7)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_10 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(1, 86, __pyx_L1_error) + #else + __pyx_t_10 = PySequence_ITEM(__pyx_t_7, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + #endif + } else { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_7)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(1, 86, __pyx_L1_error) + #else + __pyx_t_10 = PySequence_ITEM(__pyx_t_7, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + #endif + } + } else { + __pyx_t_10 = __pyx_t_9(__pyx_t_7); + if (unlikely(!__pyx_t_10)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 86, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_10); + } + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_10); + __pyx_t_10 = 0; + __pyx_v_i = __pyx_t_4; + __pyx_t_4 = (__pyx_t_4 + 1); - /* "arrex/list.pyx":142 - * elif hasattr(iterable, '__next__'): - * first = next(iterable) - * dtype = type(first) # <<<<<<<<<<<<<< - * elif hasattr(iterable, '__iter__'): - * dtype = type(next(iter(iterable))) + /* "carray.from_py":87 + * if i == length: + * for i, item in enumerate(o): + * if i >= length: # <<<<<<<<<<<<<< + * break + * v[i] = item */ - __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_first))); - __Pyx_DECREF_SET(__pyx_v_dtype, ((PyObject *)Py_TYPE(__pyx_v_first))); + __pyx_t_6 = (__pyx_v_i >= __pyx_v_length); + if (__pyx_t_6) { - /* "arrex/list.pyx":140 - * if isinstance(iterable, type) and not dtype: - * iterable, dtype = None, iterable - * elif hasattr(iterable, '__next__'): # <<<<<<<<<<<<<< - * first = next(iterable) - * dtype = type(first) + /* "carray.from_py":88 + * for i, item in enumerate(o): + * if i >= length: + * break # <<<<<<<<<<<<<< + * v[i] = item + * else: */ - goto __pyx_L10; - } + goto __pyx_L11_break; - /* "arrex/list.pyx":143 - * first = next(iterable) - * dtype = type(first) - * elif hasattr(iterable, '__iter__'): # <<<<<<<<<<<<<< - * dtype = type(next(iter(iterable))) - * else: + /* "carray.from_py":87 + * if i == length: + * for i, item in enumerate(o): + * if i >= length: # <<<<<<<<<<<<<< + * break + * v[i] = item */ - __pyx_t_1 = __Pyx_HasAttr(__pyx_v_iterable, __pyx_n_u_iter); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 143, __pyx_L4_error) - __pyx_t_2 = (__pyx_t_1 != 0); - if (likely(__pyx_t_2)) { + } - /* "arrex/list.pyx":144 - * dtype = type(first) - * elif hasattr(iterable, '__iter__'): - * dtype = type(next(iter(iterable))) # <<<<<<<<<<<<<< - * else: - * raise TypeError('dtype must be provided when it cannot be deduced from the iterable') + /* "carray.from_py":89 + * if i >= length: + * break + * v[i] = item # <<<<<<<<<<<<<< + * else: + * i += 1 # convert index to length */ - __pyx_t_8 = PyObject_GetIter(__pyx_v_iterable); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 144, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = __Pyx_PyIter_Next(__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 144, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_t_7))); - __Pyx_DECREF_SET(__pyx_v_dtype, ((PyObject *)Py_TYPE(__pyx_t_7))); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_item); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 89, __pyx_L1_error) + (__pyx_v_v[__pyx_v_i]) = __pyx_t_11; - /* "arrex/list.pyx":143 - * first = next(iterable) - * dtype = type(first) - * elif hasattr(iterable, '__iter__'): # <<<<<<<<<<<<<< - * dtype = type(next(iter(iterable))) - * else: + /* "carray.from_py":86 + * pass + * if i == length: + * for i, item in enumerate(o): # <<<<<<<<<<<<<< + * if i >= length: + * break */ - goto __pyx_L10; - } + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L13_for_else; + __pyx_L11_break:; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L14_for_end; + /*else*/ { + __pyx_L13_for_else:; - /* "arrex/list.pyx":146 - * dtype = type(next(iter(iterable))) - * else: - * raise TypeError('dtype must be provided when it cannot be deduced from the iterable') # <<<<<<<<<<<<<< - * except StopIteration: - * raise ValueError('iterable is empty') + /* "carray.from_py":91 + * v[i] = item + * else: + * i += 1 # convert index to length # <<<<<<<<<<<<<< + * if i == length: + * return 0 */ - /*else*/ { - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 146, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_Raise(__pyx_t_7, 0, 0, 0); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(0, 146, __pyx_L4_error) - } - __pyx_L10:; + __pyx_v_i = (__pyx_v_i + 1); - /* "arrex/list.pyx":137 - * first = None - * if not dtype: - * try: # <<<<<<<<<<<<<< - * if isinstance(iterable, type) and not dtype: - * iterable, dtype = None, iterable + /* "carray.from_py":92 + * else: + * i += 1 # convert index to length + * if i == length: # <<<<<<<<<<<<<< + * return 0 + * */ - } - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L9_try_end; - __pyx_L4_error:; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_6 = (__pyx_v_i == __pyx_v_length); + if (__pyx_t_6) { - /* "arrex/list.pyx":147 - * else: - * raise TypeError('dtype must be provided when it cannot be deduced from the iterable') - * except StopIteration: # <<<<<<<<<<<<<< - * raise ValueError('iterable is empty') + /* "carray.from_py":93 + * i += 1 # convert index to length + * if i == length: + * return 0 # <<<<<<<<<<<<<< * + * PyErr_Format( */ - __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_StopIteration); - if (__pyx_t_9) { - __Pyx_AddTraceback("arrex.list.typedlist.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_10) < 0) __PYX_ERR(0, 147, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GOTREF(__pyx_t_10); + __pyx_r = 0; + goto __pyx_L0; - /* "arrex/list.pyx":148 - * raise TypeError('dtype must be provided when it cannot be deduced from the iterable') - * except StopIteration: - * raise ValueError('iterable is empty') # <<<<<<<<<<<<<< + /* "carray.from_py":92 + * else: + * i += 1 # convert index to length + * if i == length: # <<<<<<<<<<<<<< + * return 0 * - * # initialize the internal structure */ - __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 148, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_Raise(__pyx_t_11, 0, 0, 0); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __PYX_ERR(0, 148, __pyx_L6_except_error) } - goto __pyx_L6_except_error; - __pyx_L6_except_error:; + } + __pyx_L14_for_end:; - /* "arrex/list.pyx":137 - * first = None - * if not dtype: - * try: # <<<<<<<<<<<<<< - * if isinstance(iterable, type) and not dtype: - * iterable, dtype = None, iterable + /* "carray.from_py":85 + * except (TypeError, OverflowError): + * pass + * if i == length: # <<<<<<<<<<<<<< + * for i, item in enumerate(o): + * if i >= length: */ - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); - goto __pyx_L1_error; - __pyx_L9_try_end:; - } + } - /* "arrex/list.pyx":136 - * # look at the type of the first element - * first = None - * if not dtype: # <<<<<<<<<<<<<< - * try: - * if isinstance(iterable, type) and not dtype: + /* "carray.from_py":98 + * IndexError, + * ("too many values found during array assignment, expected %zd" + * if i >= length else # <<<<<<<<<<<<<< + * "not enough values found during array assignment, expected %zd, got %zd"), + * length, i) */ + if ((__pyx_v_i >= __pyx_v_length)) { + __pyx_t_12 = ((char const *)"too many values found during array assignment, expected %zd"); + } else { + __pyx_t_12 = ((char const *)"not enough values found during array assignment, expected %zd, got %zd"); } - /* "arrex/list.pyx":151 + /* "carray.from_py":95 + * return 0 * - * # initialize the internal structure - * self.owner = None # <<<<<<<<<<<<<< - * self.ptr = NULL - * self.size = 0 + * PyErr_Format( # <<<<<<<<<<<<<< + * IndexError, + * ("too many values found during array assignment, expected %zd" */ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->owner); - __Pyx_DECREF(__pyx_v_self->owner); - __pyx_v_self->owner = Py_None; + __pyx_t_7 = PyErr_Format(__pyx_builtin_IndexError, __pyx_t_12, __pyx_v_length, __pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "arrex/list.pyx":152 - * # initialize the internal structure - * self.owner = None - * self.ptr = NULL # <<<<<<<<<<<<<< - * self.size = 0 - * self.allocated = 0 + /* "carray.from_py":79 + * + * @cname("__Pyx_carray_from_py_Py_ssize_t") + * cdef int __Pyx_carray_from_py_Py_ssize_t(object o, base_type *v, Py_ssize_t length) except -1: # <<<<<<<<<<<<<< + * cdef Py_ssize_t i = length + * try: */ - __pyx_v_self->ptr = NULL; - /* "arrex/list.pyx":153 - * self.owner = None - * self.ptr = NULL - * self.size = 0 # <<<<<<<<<<<<<< - * self.allocated = 0 - * self.dtype = declared(dtype) - */ - __pyx_v_self->size = 0; + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("carray.from_py.__Pyx_carray_from_py_Py_ssize_t", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_item); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "arrex/list.pyx":154 - * self.ptr = NULL - * self.size = 0 - * self.allocated = 0 # <<<<<<<<<<<<<< - * self.dtype = declared(dtype) - * if not self.dtype: +/* "cpython/complex.pxd":19 + * + * @property + * cdef inline double real(self): # <<<<<<<<<<<<<< + * return self.cval.real + * */ - __pyx_v_self->allocated = 0; - /* "arrex/list.pyx":155 - * self.size = 0 - * self.allocated = 0 - * self.dtype = declared(dtype) # <<<<<<<<<<<<<< - * if not self.dtype: - * raise TypeError('dtype must be a dtype declaration instance, or a key for a declared dtype') +static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4real_real(PyComplexObject *__pyx_v_self) { + double __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("real", 0); + + /* "cpython/complex.pxd":20 + * @property + * cdef inline double real(self): + * return self.cval.real # <<<<<<<<<<<<<< + * + * @property */ - __pyx_t_10 = ((PyObject *)__pyx_f_5arrex_6dtypes_declared(__pyx_v_dtype, 0)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 155, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_10); - __Pyx_GOTREF(__pyx_v_self->dtype); - __Pyx_DECREF(((PyObject *)__pyx_v_self->dtype)); - __pyx_v_self->dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_10); - __pyx_t_10 = 0; + __pyx_r = __pyx_v_self->cval.real; + goto __pyx_L0; - /* "arrex/list.pyx":156 - * self.allocated = 0 - * self.dtype = declared(dtype) - * if not self.dtype: # <<<<<<<<<<<<<< - * raise TypeError('dtype must be a dtype declaration instance, or a key for a declared dtype') + /* "cpython/complex.pxd":19 + * + * @property + * cdef inline double real(self): # <<<<<<<<<<<<<< + * return self.cval.real * */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->dtype)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 156, __pyx_L1_error) - __pyx_t_1 = ((!__pyx_t_2) != 0); - if (unlikely(__pyx_t_1)) { - /* "arrex/list.pyx":157 - * self.dtype = declared(dtype) - * if not self.dtype: - * raise TypeError('dtype must be a dtype declaration instance, or a key for a declared dtype') # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cpython/complex.pxd":23 + * + * @property + * cdef inline double imag(self): # <<<<<<<<<<<<<< + * return self.cval.imag * - * # borrow a buffer */ - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 157, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_Raise(__pyx_t_10, 0, 0, 0); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __PYX_ERR(0, 157, __pyx_L1_error) - /* "arrex/list.pyx":156 - * self.allocated = 0 - * self.dtype = declared(dtype) - * if not self.dtype: # <<<<<<<<<<<<<< - * raise TypeError('dtype must be a dtype declaration instance, or a key for a declared dtype') +static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4imag_imag(PyComplexObject *__pyx_v_self) { + double __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("imag", 0); + + /* "cpython/complex.pxd":24 + * @property + * cdef inline double imag(self): + * return self.cval.imag # <<<<<<<<<<<<<< * + * # PyTypeObject PyComplex_Type */ - } + __pyx_r = __pyx_v_self->cval.imag; + goto __pyx_L0; - /* "arrex/list.pyx":160 + /* "cpython/complex.pxd":23 + * + * @property + * cdef inline double imag(self): # <<<<<<<<<<<<<< + * return self.cval.imag * - * # borrow a buffer - * if PyObject_CheckBuffer(iterable): # <<<<<<<<<<<<<< - * self._use(iterable) - * self.size = self.allocated */ - __pyx_t_1 = (PyObject_CheckBuffer(__pyx_v_iterable) != 0); - if (__pyx_t_1) { - /* "arrex/list.pyx":161 - * # borrow a buffer - * if PyObject_CheckBuffer(iterable): - * self._use(iterable) # <<<<<<<<<<<<<< - * self.size = self.allocated - * if reserve: + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cpython/contextvars.pxd":112 + * + * + * cdef inline object get_value(var, default_value=None): # <<<<<<<<<<<<<< + * """Return a new reference to the value of the context variable, + * or the default value of the context variable, */ - __pyx_t_9 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_use(__pyx_v_self, __pyx_v_iterable); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 161, __pyx_L1_error) - /* "arrex/list.pyx":162 - * if PyObject_CheckBuffer(iterable): - * self._use(iterable) - * self.size = self.allocated # <<<<<<<<<<<<<< - * if reserve: - * self._reallocate(reserve * self.dtype.dsize) +static CYTHON_INLINE PyObject *__pyx_f_7cpython_11contextvars_get_value(PyObject *__pyx_v_var, struct __pyx_opt_args_7cpython_11contextvars_get_value *__pyx_optional_args) { + PyObject *__pyx_v_default_value = ((PyObject *)Py_None); + PyObject *__pyx_v_value; + PyObject *__pyx_v_pyvalue = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_value", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_default_value = __pyx_optional_args->default_value; + } + } + + /* "cpython/contextvars.pxd":117 + * or None if no such value or default was found. + * """ + * cdef PyObject *value = NULL # <<<<<<<<<<<<<< + * PyContextVar_Get(var, NULL, &value) + * if value is NULL: */ - __pyx_t_12 = __pyx_v_self->allocated; - __pyx_v_self->size = __pyx_t_12; + __pyx_v_value = NULL; - /* "arrex/list.pyx":163 - * self._use(iterable) - * self.size = self.allocated - * if reserve: # <<<<<<<<<<<<<< - * self._reallocate(reserve * self.dtype.dsize) - * # fill with an iterable + /* "cpython/contextvars.pxd":118 + * """ + * cdef PyObject *value = NULL + * PyContextVar_Get(var, NULL, &value) # <<<<<<<<<<<<<< + * if value is NULL: + * # context variable does not have a default */ - __pyx_t_1 = (__pyx_v_reserve != 0); - if (__pyx_t_1) { + __pyx_t_1 = PyContextVar_Get(__pyx_v_var, NULL, (&__pyx_v_value)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 118, __pyx_L1_error) - /* "arrex/list.pyx":164 - * self.size = self.allocated - * if reserve: - * self._reallocate(reserve * self.dtype.dsize) # <<<<<<<<<<<<<< - * # fill with an iterable - * else: + /* "cpython/contextvars.pxd":119 + * cdef PyObject *value = NULL + * PyContextVar_Get(var, NULL, &value) + * if value is NULL: # <<<<<<<<<<<<<< + * # context variable does not have a default + * pyvalue = default_value */ - __pyx_t_9 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_reallocate(__pyx_v_self, (__pyx_v_reserve * __pyx_v_self->dtype->dsize)); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 164, __pyx_L1_error) + __pyx_t_2 = (__pyx_v_value == NULL); + if (__pyx_t_2) { - /* "arrex/list.pyx":163 - * self._use(iterable) - * self.size = self.allocated - * if reserve: # <<<<<<<<<<<<<< - * self._reallocate(reserve * self.dtype.dsize) - * # fill with an iterable + /* "cpython/contextvars.pxd":121 + * if value is NULL: + * # context variable does not have a default + * pyvalue = default_value # <<<<<<<<<<<<<< + * else: + * # value or default value of context variable */ - } + __Pyx_INCREF(__pyx_v_default_value); + __pyx_v_pyvalue = __pyx_v_default_value; - /* "arrex/list.pyx":160 - * - * # borrow a buffer - * if PyObject_CheckBuffer(iterable): # <<<<<<<<<<<<<< - * self._use(iterable) - * self.size = self.allocated + /* "cpython/contextvars.pxd":119 + * cdef PyObject *value = NULL + * PyContextVar_Get(var, NULL, &value) + * if value is NULL: # <<<<<<<<<<<<<< + * # context variable does not have a default + * pyvalue = default_value */ - goto __pyx_L16; + goto __pyx_L3; } - /* "arrex/list.pyx":167 - * # fill with an iterable - * else: - * if reserve: # <<<<<<<<<<<<<< - * self._reallocate(reserve * self.dtype.dsize) - * if iterable is not None: + /* "cpython/contextvars.pxd":124 + * else: + * # value or default value of context variable + * pyvalue = value # <<<<<<<<<<<<<< + * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*' + * return pyvalue */ /*else*/ { - __pyx_t_1 = (__pyx_v_reserve != 0); - if (__pyx_t_1) { + __pyx_t_3 = ((PyObject *)__pyx_v_value); + __Pyx_INCREF(__pyx_t_3); + __pyx_v_pyvalue = __pyx_t_3; + __pyx_t_3 = 0; - /* "arrex/list.pyx":168 - * else: - * if reserve: - * self._reallocate(reserve * self.dtype.dsize) # <<<<<<<<<<<<<< - * if iterable is not None: - * if first is not None: + /* "cpython/contextvars.pxd":125 + * # value or default value of context variable + * pyvalue = value + * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*' # <<<<<<<<<<<<<< + * return pyvalue + * */ - __pyx_t_9 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_reallocate(__pyx_v_self, (__pyx_v_reserve * __pyx_v_self->dtype->dsize)); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 168, __pyx_L1_error) + Py_XDECREF(__pyx_v_value); + } + __pyx_L3:; - /* "arrex/list.pyx":167 - * # fill with an iterable - * else: - * if reserve: # <<<<<<<<<<<<<< - * self._reallocate(reserve * self.dtype.dsize) - * if iterable is not None: + /* "cpython/contextvars.pxd":126 + * pyvalue = value + * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*' + * return pyvalue # <<<<<<<<<<<<<< + * + * */ - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_pyvalue); + __pyx_r = __pyx_v_pyvalue; + goto __pyx_L0; - /* "arrex/list.pyx":169 - * if reserve: - * self._reallocate(reserve * self.dtype.dsize) - * if iterable is not None: # <<<<<<<<<<<<<< - * if first is not None: - * self.append(first) + /* "cpython/contextvars.pxd":112 + * + * + * cdef inline object get_value(var, default_value=None): # <<<<<<<<<<<<<< + * """Return a new reference to the value of the context variable, + * or the default value of the context variable, */ - __pyx_t_1 = (__pyx_v_iterable != Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - /* "arrex/list.pyx":170 - * self._reallocate(reserve * self.dtype.dsize) - * if iterable is not None: - * if first is not None: # <<<<<<<<<<<<<< - * self.append(first) - * self.extend(iterable) - */ - __pyx_t_2 = (__pyx_v_first != Py_None); - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cpython.contextvars.get_value", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_pyvalue); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "arrex/list.pyx":171 - * if iterable is not None: - * if first is not None: - * self.append(first) # <<<<<<<<<<<<<< - * self.extend(iterable) +/* "cpython/contextvars.pxd":129 * + * + * cdef inline object get_value_no_default(var, default_value=None): # <<<<<<<<<<<<<< + * """Return a new reference to the value of the context variable, + * or the provided default value if no such value was found. */ - __pyx_t_9 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->append(__pyx_v_self, __pyx_v_first, 0); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 171, __pyx_L1_error) - /* "arrex/list.pyx":170 - * self._reallocate(reserve * self.dtype.dsize) - * if iterable is not None: - * if first is not None: # <<<<<<<<<<<<<< - * self.append(first) - * self.extend(iterable) +static CYTHON_INLINE PyObject *__pyx_f_7cpython_11contextvars_get_value_no_default(PyObject *__pyx_v_var, struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default *__pyx_optional_args) { + PyObject *__pyx_v_default_value = ((PyObject *)Py_None); + PyObject *__pyx_v_value; + PyObject *__pyx_v_pyvalue = NULL; + 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("get_value_no_default", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_default_value = __pyx_optional_args->default_value; + } + } + + /* "cpython/contextvars.pxd":135 + * Ignores the default value of the context variable, if any. + * """ + * cdef PyObject *value = NULL # <<<<<<<<<<<<<< + * PyContextVar_Get(var, default_value, &value) + * # value of context variable or 'default_value' + */ + __pyx_v_value = NULL; + + /* "cpython/contextvars.pxd":136 + * """ + * cdef PyObject *value = NULL + * PyContextVar_Get(var, default_value, &value) # <<<<<<<<<<<<<< + * # value of context variable or 'default_value' + * pyvalue = value + */ + __pyx_t_1 = PyContextVar_Get(__pyx_v_var, ((PyObject *)__pyx_v_default_value), (&__pyx_v_value)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 136, __pyx_L1_error) + + /* "cpython/contextvars.pxd":138 + * PyContextVar_Get(var, default_value, &value) + * # value of context variable or 'default_value' + * pyvalue = value # <<<<<<<<<<<<<< + * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*' + * return pyvalue + */ + __pyx_t_2 = ((PyObject *)__pyx_v_value); + __Pyx_INCREF(__pyx_t_2); + __pyx_v_pyvalue = __pyx_t_2; + __pyx_t_2 = 0; + + /* "cpython/contextvars.pxd":139 + * # value of context variable or 'default_value' + * pyvalue = value + * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*' # <<<<<<<<<<<<<< + * return pyvalue */ - } + Py_XDECREF(__pyx_v_value); - /* "arrex/list.pyx":172 - * if first is not None: - * self.append(first) - * self.extend(iterable) # <<<<<<<<<<<<<< + /* "cpython/contextvars.pxd":140 + * pyvalue = value + * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*' + * return pyvalue # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_pyvalue); + __pyx_r = __pyx_v_pyvalue; + goto __pyx_L0; + + /* "cpython/contextvars.pxd":129 * - * @staticmethod + * + * cdef inline object get_value_no_default(var, default_value=None): # <<<<<<<<<<<<<< + * """Return a new reference to the value of the context variable, + * or the provided default value if no such value was found. */ - ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->extend(__pyx_v_self, __pyx_v_iterable, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 172, __pyx_L1_error) - /* "arrex/list.pyx":169 - * if reserve: - * self._reallocate(reserve * self.dtype.dsize) - * if iterable is not None: # <<<<<<<<<<<<<< - * if first is not None: - * self.append(first) + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cpython.contextvars.get_value_no_default", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_pyvalue); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "arrex/list.pyx":122 + * cdef readonly object owner + * + * @property # <<<<<<<<<<<<<< + * def dtype(self): + * ''' the python dtype object, or the ddtype if there is not dtype ''' */ - } + +/* Python wrapper */ +static PyObject *__pyx_pw_5arrex_4list_9typedlist_5dtype_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5arrex_4list_9typedlist_5dtype_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_5arrex_4list_9typedlist_5dtype___get__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5arrex_4list_9typedlist_5dtype___get__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "arrex/list.pyx":125 + * def dtype(self): + * ''' the python dtype object, or the ddtype if there is not dtype ''' + * return self.dtype.key or self.dtype # <<<<<<<<<<<<<< + * + * @property + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_self->dtype->key); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 125, __pyx_L1_error) + if (!__pyx_t_2) { + } else { + __Pyx_INCREF(__pyx_v_self->dtype->key); + __pyx_t_1 = __pyx_v_self->dtype->key; + goto __pyx_L3_bool_binop_done; } - __pyx_L16:; + __Pyx_INCREF((PyObject *)__pyx_v_self->dtype); + __pyx_t_1 = ((PyObject *)__pyx_v_self->dtype); + __pyx_L3_bool_binop_done:; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "arrex/list.pyx":133 + /* "arrex/list.pyx":122 + * cdef readonly object owner * + * @property # <<<<<<<<<<<<<< + * def dtype(self): + * ''' the python dtype object, or the ddtype if there is not dtype ''' + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("arrex.list.typedlist.dtype.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "arrex/list.pyx":127 + * return self.dtype.key or self.dtype * - * def __init__(self, iterable=None, object dtype=None, size_t reserve=0): # <<<<<<<<<<<<<< - * # look at the type of the first element - * first = None + * @property # <<<<<<<<<<<<<< + * def ddtype(self): + * ''' the declaration of the dtype, a DDType instance ''' */ +/* Python wrapper */ +static PyObject *__pyx_pw_5arrex_4list_9typedlist_6ddtype_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5arrex_4list_9typedlist_6ddtype_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_5arrex_4list_9typedlist_6ddtype___get__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self)); + /* function exit code */ - __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5arrex_4list_9typedlist_6ddtype___get__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + + /* "arrex/list.pyx":130 + * def ddtype(self): + * ''' the declaration of the dtype, a DDType instance ''' + * return self.dtype # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self->dtype); + __pyx_r = ((PyObject *)__pyx_v_self->dtype); goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("arrex.list.typedlist.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + + /* "arrex/list.pyx":127 + * return self.dtype.key or self.dtype + * + * @property # <<<<<<<<<<<<<< + * def ddtype(self): + * ''' the declaration of the dtype, a DDType instance ''' + */ + + /* function exit code */ __pyx_L0:; - __Pyx_XDECREF(__pyx_v_first); - __Pyx_XDECREF(__pyx_v_iterable); - __Pyx_XDECREF(__pyx_v_dtype); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "arrex/list.pyx":175 +/* "arrex/list.pyx":133 * - * @staticmethod - * def full(value, size, dtype=None): # <<<<<<<<<<<<<< - * ''' full(value, size) * + * def __init__(self, iterable=None, object dtype=None, size_t reserve=0): # <<<<<<<<<<<<<< + * # look at the type of the first element + * first = None */ /* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_3full(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5arrex_4list_9typedlist_2full[] = " full(value, size)\n\t\t\n\t\t\tcreate a new typedlist with the given `size`, all elements initialized to `value`. \n\t\t"; -static PyMethodDef __pyx_mdef_5arrex_4list_9typedlist_3full = {"full", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5arrex_4list_9typedlist_3full, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_2full}; -static PyObject *__pyx_pw_5arrex_4list_9typedlist_3full(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_value = 0; - PyObject *__pyx_v_size = 0; +static int __pyx_pw_5arrex_4list_9typedlist_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_5arrex_4list_9typedlist_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_iterable = 0; PyObject *__pyx_v_dtype = 0; + size_t __pyx_v_reserve; + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("full (wrapper)", 0); + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_value,&__pyx_n_s_size,&__pyx_n_s_dtype,0}; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_iterable,&__pyx_n_s_dtype,&__pyx_n_s_reserve,0}; PyObject* values[3] = {0,0,0}; - values[2] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { + values[0] = ((PyObject *)Py_None); + values[1] = ((PyObject *)Py_None); + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_iterable); + if (value) { values[0] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 133, __pyx_L3_error) + } CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("full", 0, 2, 3, 1); __PYX_ERR(0, 175, __pyx_L3_error) + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dtype); + if (value) { values[1] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 133, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype); + PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_reserve); if (value) { values[2] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 133, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "full") < 0)) __PYX_ERR(0, 175, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 133, __pyx_L3_error) } } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; + case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; default: goto __pyx_L5_argtuple_error; } } - __pyx_v_value = values[0]; - __pyx_v_size = values[1]; - __pyx_v_dtype = values[2]; + __pyx_v_iterable = values[0]; + __pyx_v_dtype = values[1]; + if (values[2]) { + __pyx_v_reserve = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_reserve == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 133, __pyx_L3_error) + } else { + __pyx_v_reserve = ((size_t)0); + } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("full", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 175, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 3, __pyx_nargs); __PYX_ERR(0, 133, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("arrex.list.typedlist.full", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("arrex.list.typedlist.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return NULL; + return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5arrex_4list_9typedlist_2full(__pyx_v_value, __pyx_v_size, __pyx_v_dtype); + __pyx_r = __pyx_pf_5arrex_4list_9typedlist___init__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), __pyx_v_iterable, __pyx_v_dtype, __pyx_v_reserve); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5arrex_4list_9typedlist_2full(PyObject *__pyx_v_value, PyObject *__pyx_v_size, PyObject *__pyx_v_dtype) { - Py_ssize_t __pyx_v_i; - struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_array = 0; - PyObject *__pyx_r = NULL; +static int __pyx_pf_5arrex_4list_9typedlist___init__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_iterable, PyObject *__pyx_v_dtype, size_t __pyx_v_reserve) { + PyObject *__pyx_v_first = NULL; + int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - long __pyx_t_4; - long __pyx_t_5; - Py_ssize_t __pyx_t_6; - int __pyx_t_7; - size_t __pyx_t_8; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("full", 0); + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + size_t __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + __Pyx_INCREF(__pyx_v_iterable); + __Pyx_INCREF(__pyx_v_dtype); - /* "arrex/list.pyx":181 - * ''' - * cdef ssize_t i - * cdef typedlist array = typedlist(dtype=dtype or type(value), reserve=size) # <<<<<<<<<<<<<< - * for i in range(size): - * array._setitem(array.ptr + i*array.dtype.dsize, value) + /* "arrex/list.pyx":135 + * def __init__(self, iterable=None, object dtype=None, size_t reserve=0): + * # look at the type of the first element + * first = None # <<<<<<<<<<<<<< + * if not dtype: + * try: */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_dtype); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 181, __pyx_L1_error) - if (!__pyx_t_3) { - } else { - __Pyx_INCREF(__pyx_v_dtype); - __pyx_t_2 = __pyx_v_dtype; - goto __pyx_L3_bool_binop_done; - } - __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_value))); - __pyx_t_2 = ((PyObject *)Py_TYPE(__pyx_v_value)); - __pyx_L3_bool_binop_done:; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 181, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reserve, __pyx_v_size) < 0) __PYX_ERR(0, 181, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5arrex_4list_typedlist), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 181, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_array = ((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_t_2); - __pyx_t_2 = 0; + __Pyx_INCREF(Py_None); + __pyx_v_first = Py_None; - /* "arrex/list.pyx":182 - * cdef ssize_t i - * cdef typedlist array = typedlist(dtype=dtype or type(value), reserve=size) - * for i in range(size): # <<<<<<<<<<<<<< - * array._setitem(array.ptr + i*array.dtype.dsize, value) - * array.size = array.allocated + /* "arrex/list.pyx":136 + * # look at the type of the first element + * first = None + * if not dtype: # <<<<<<<<<<<<<< + * try: + * if isinstance(iterable, type) and not dtype: */ - __pyx_t_4 = __Pyx_PyInt_As_long(__pyx_v_size); if (unlikely((__pyx_t_4 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 182, __pyx_L1_error) - __pyx_t_5 = __pyx_t_4; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_dtype); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 136, __pyx_L1_error) + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { - /* "arrex/list.pyx":183 - * cdef typedlist array = typedlist(dtype=dtype or type(value), reserve=size) - * for i in range(size): - * array._setitem(array.ptr + i*array.dtype.dsize, value) # <<<<<<<<<<<<<< - * array.size = array.allocated - * return array + /* "arrex/list.pyx":137 + * first = None + * if not dtype: + * try: # <<<<<<<<<<<<<< + * if isinstance(iterable, type) and not dtype: + * iterable, dtype = None, iterable */ - __pyx_t_7 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_array->__pyx_vtab)->_setitem(__pyx_v_array, (__pyx_v_array->ptr + (__pyx_v_i * __pyx_v_array->dtype->dsize)), __pyx_v_value); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 183, __pyx_L1_error) - } + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_5); + /*try:*/ { - /* "arrex/list.pyx":184 - * for i in range(size): - * array._setitem(array.ptr + i*array.dtype.dsize, value) - * array.size = array.allocated # <<<<<<<<<<<<<< - * return array - * + /* "arrex/list.pyx":138 + * if not dtype: + * try: + * if isinstance(iterable, type) and not dtype: # <<<<<<<<<<<<<< + * iterable, dtype = None, iterable + * elif hasattr(iterable, '__next__'): */ - __pyx_t_8 = __pyx_v_array->allocated; - __pyx_v_array->size = __pyx_t_8; + __pyx_t_1 = PyType_Check(__pyx_v_iterable); + if (__pyx_t_1) { + } else { + __pyx_t_2 = __pyx_t_1; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_dtype); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 138, __pyx_L4_error) + __pyx_t_6 = (!__pyx_t_1); + __pyx_t_2 = __pyx_t_6; + __pyx_L11_bool_binop_done:; + if (__pyx_t_2) { - /* "arrex/list.pyx":185 - * array._setitem(array.ptr + i*array.dtype.dsize, value) - * array.size = array.allocated - * return array # <<<<<<<<<<<<<< - * - * @staticmethod + /* "arrex/list.pyx":139 + * try: + * if isinstance(iterable, type) and not dtype: + * iterable, dtype = None, iterable # <<<<<<<<<<<<<< + * elif hasattr(iterable, '__next__'): + * first = next(iterable) */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_array)); - __pyx_r = ((PyObject *)__pyx_v_array); - goto __pyx_L0; + __pyx_t_7 = Py_None; + __Pyx_INCREF(__pyx_t_7); + __pyx_t_8 = __pyx_v_iterable; + __Pyx_INCREF(__pyx_t_8); + __Pyx_DECREF_SET(__pyx_v_iterable, __pyx_t_7); + __pyx_t_7 = 0; + __Pyx_DECREF_SET(__pyx_v_dtype, __pyx_t_8); + __pyx_t_8 = 0; - /* "arrex/list.pyx":175 - * - * @staticmethod - * def full(value, size, dtype=None): # <<<<<<<<<<<<<< - * ''' full(value, size) - * + /* "arrex/list.pyx":138 + * if not dtype: + * try: + * if isinstance(iterable, type) and not dtype: # <<<<<<<<<<<<<< + * iterable, dtype = None, iterable + * elif hasattr(iterable, '__next__'): */ + goto __pyx_L10; + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("arrex.list.typedlist.full", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_array); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "arrex/list.pyx":140 + * if isinstance(iterable, type) and not dtype: + * iterable, dtype = None, iterable + * elif hasattr(iterable, '__next__'): # <<<<<<<<<<<<<< + * first = next(iterable) + * dtype = type(first) + */ + __pyx_t_2 = __Pyx_HasAttr(__pyx_v_iterable, __pyx_n_u_next); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 140, __pyx_L4_error) + if (__pyx_t_2) { -/* "arrex/list.pyx":188 - * - * @staticmethod - * def empty(dtype, size): # <<<<<<<<<<<<<< - * ''' empty(dtype, size) - * + /* "arrex/list.pyx":141 + * iterable, dtype = None, iterable + * elif hasattr(iterable, '__next__'): + * first = next(iterable) # <<<<<<<<<<<<<< + * dtype = type(first) + * elif hasattr(iterable, '__iter__'): */ + __pyx_t_8 = __Pyx_PyIter_Next(__pyx_v_iterable); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 141, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF_SET(__pyx_v_first, __pyx_t_8); + __pyx_t_8 = 0; -/* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_5empty(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5arrex_4list_9typedlist_4empty[] = " empty(dtype, size)\n\t\t\n\t\t\tcreate a new typedlist with the given `size` and unitialized elements of type `dtype`\n\t\t"; -static PyMethodDef __pyx_mdef_5arrex_4list_9typedlist_5empty = {"empty", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5arrex_4list_9typedlist_5empty, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_4empty}; -static PyObject *__pyx_pw_5arrex_4list_9typedlist_5empty(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_dtype = 0; - PyObject *__pyx_v_size = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("empty (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dtype,&__pyx_n_s_size,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("empty", 1, 2, 2, 1); __PYX_ERR(0, 188, __pyx_L3_error) + /* "arrex/list.pyx":142 + * elif hasattr(iterable, '__next__'): + * first = next(iterable) + * dtype = type(first) # <<<<<<<<<<<<<< + * elif hasattr(iterable, '__iter__'): + * dtype = type(next(iter(iterable))) + */ + __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_first))); + __Pyx_DECREF_SET(__pyx_v_dtype, ((PyObject *)Py_TYPE(__pyx_v_first))); + + /* "arrex/list.pyx":140 + * if isinstance(iterable, type) and not dtype: + * iterable, dtype = None, iterable + * elif hasattr(iterable, '__next__'): # <<<<<<<<<<<<<< + * first = next(iterable) + * dtype = type(first) + */ + goto __pyx_L10; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "empty") < 0)) __PYX_ERR(0, 188, __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_dtype = values[0]; - __pyx_v_size = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("empty", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 188, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("arrex.list.typedlist.empty", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5arrex_4list_9typedlist_4empty(__pyx_v_dtype, __pyx_v_size); - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "arrex/list.pyx":143 + * first = next(iterable) + * dtype = type(first) + * elif hasattr(iterable, '__iter__'): # <<<<<<<<<<<<<< + * dtype = type(next(iter(iterable))) + * else: + */ + __pyx_t_2 = __Pyx_HasAttr(__pyx_v_iterable, __pyx_n_u_iter); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 143, __pyx_L4_error) + if (likely(__pyx_t_2)) { -static PyObject *__pyx_pf_5arrex_4list_9typedlist_4empty(PyObject *__pyx_v_dtype, PyObject *__pyx_v_size) { - struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_array = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - size_t __pyx_t_3; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("empty", 0); - - /* "arrex/list.pyx":193 - * create a new typedlist with the given `size` and unitialized elements of type `dtype` - * ''' - * cdef typedlist array = typedlist(dtype=dtype, reserve=size) # <<<<<<<<<<<<<< - * array.size = array.allocated - * return array + /* "arrex/list.pyx":144 + * dtype = type(first) + * elif hasattr(iterable, '__iter__'): + * dtype = type(next(iter(iterable))) # <<<<<<<<<<<<<< + * else: + * raise TypeError('dtype must be provided when it cannot be deduced from the iterable') */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_dtype) < 0) __PYX_ERR(0, 193, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reserve, __pyx_v_size) < 0) __PYX_ERR(0, 193, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5arrex_4list_typedlist), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_array = ((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_8 = PyObject_GetIter(__pyx_v_iterable); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 144, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = __Pyx_PyIter_Next(__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 144, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_t_7))); + __Pyx_DECREF_SET(__pyx_v_dtype, ((PyObject *)Py_TYPE(__pyx_t_7))); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "arrex/list.pyx":194 - * ''' - * cdef typedlist array = typedlist(dtype=dtype, reserve=size) - * array.size = array.allocated # <<<<<<<<<<<<<< - * return array - * + /* "arrex/list.pyx":143 + * first = next(iterable) + * dtype = type(first) + * elif hasattr(iterable, '__iter__'): # <<<<<<<<<<<<<< + * dtype = type(next(iter(iterable))) + * else: */ - __pyx_t_3 = __pyx_v_array->allocated; - __pyx_v_array->size = __pyx_t_3; + goto __pyx_L10; + } - /* "arrex/list.pyx":195 - * cdef typedlist array = typedlist(dtype=dtype, reserve=size) - * array.size = array.allocated - * return array # <<<<<<<<<<<<<< - * - * + /* "arrex/list.pyx":146 + * dtype = type(next(iter(iterable))) + * else: + * raise TypeError('dtype must be provided when it cannot be deduced from the iterable') # <<<<<<<<<<<<<< + * except StopIteration: + * raise ValueError('iterable is empty') */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_array)); - __pyx_r = ((PyObject *)__pyx_v_array); - goto __pyx_L0; + /*else*/ { + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 146, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_Raise(__pyx_t_7, 0, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __PYX_ERR(0, 146, __pyx_L4_error) + } + __pyx_L10:; - /* "arrex/list.pyx":188 - * - * @staticmethod - * def empty(dtype, size): # <<<<<<<<<<<<<< - * ''' empty(dtype, size) - * + /* "arrex/list.pyx":137 + * first = None + * if not dtype: + * try: # <<<<<<<<<<<<<< + * if isinstance(iterable, type) and not dtype: + * iterable, dtype = None, iterable */ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L9_try_end; + __pyx_L4_error:; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("arrex.list.typedlist.empty", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_array); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "arrex/list.pyx":200 - * # convenient internal functions - * - * cdef object _getitem(self, void* place): # <<<<<<<<<<<<<< - * return self.dtype.c_unpack(self.dtype, place) + /* "arrex/list.pyx":147 + * else: + * raise TypeError('dtype must be provided when it cannot be deduced from the iterable') + * except StopIteration: # <<<<<<<<<<<<<< + * raise ValueError('iterable is empty') * */ + __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_StopIteration); + if (__pyx_t_9) { + __Pyx_AddTraceback("arrex.list.typedlist.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_10) < 0) __PYX_ERR(0, 147, __pyx_L6_except_error) + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_10); -static PyObject *__pyx_f_5arrex_4list_9typedlist__getitem(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, void *__pyx_v_place) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_getitem", 0); - - /* "arrex/list.pyx":201 - * - * cdef object _getitem(self, void* place): - * return self.dtype.c_unpack(self.dtype, place) # <<<<<<<<<<<<<< + /* "arrex/list.pyx":148 + * raise TypeError('dtype must be provided when it cannot be deduced from the iterable') + * except StopIteration: + * raise ValueError('iterable is empty') # <<<<<<<<<<<<<< * - * cdef int _setitem(self, void* place, obj) except -1: + * # initialize the internal structure */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_v_self->dtype); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __pyx_v_self->dtype->c_unpack(__pyx_t_1, __pyx_v_place); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 201, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 148, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_Raise(__pyx_t_11, 0, 0, 0); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __PYX_ERR(0, 148, __pyx_L6_except_error) + } + goto __pyx_L6_except_error; - /* "arrex/list.pyx":200 - * # convenient internal functions - * - * cdef object _getitem(self, void* place): # <<<<<<<<<<<<<< - * return self.dtype.c_unpack(self.dtype, place) - * + /* "arrex/list.pyx":137 + * first = None + * if not dtype: + * try: # <<<<<<<<<<<<<< + * if isinstance(iterable, type) and not dtype: + * iterable, dtype = None, iterable */ + __pyx_L6_except_error:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L1_error; + __pyx_L9_try_end:; + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("arrex.list.typedlist._getitem", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "arrex/list.pyx":136 + * # look at the type of the first element + * first = None + * if not dtype: # <<<<<<<<<<<<<< + * try: + * if isinstance(iterable, type) and not dtype: + */ + } -/* "arrex/list.pyx":203 - * return self.dtype.c_unpack(self.dtype, place) - * - * cdef int _setitem(self, void* place, obj) except -1: # <<<<<<<<<<<<<< - * return self.dtype.c_pack(self.dtype, place, obj) + /* "arrex/list.pyx":151 * + * # initialize the internal structure + * self.owner = None # <<<<<<<<<<<<<< + * self.ptr = NULL + * self.size = 0 */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->owner); + __Pyx_DECREF(__pyx_v_self->owner); + __pyx_v_self->owner = Py_None; -static int __pyx_f_5arrex_4list_9typedlist__setitem(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, void *__pyx_v_place, PyObject *__pyx_v_obj) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_setitem", 0); - - /* "arrex/list.pyx":204 - * - * cdef int _setitem(self, void* place, obj) except -1: - * return self.dtype.c_pack(self.dtype, place, obj) # <<<<<<<<<<<<<< - * - * cdef int _use(self, buffer) except -1: + /* "arrex/list.pyx":152 + * # initialize the internal structure + * self.owner = None + * self.ptr = NULL # <<<<<<<<<<<<<< + * self.size = 0 + * self.allocated = 0 */ - __pyx_t_1 = ((PyObject *)__pyx_v_self->dtype); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __pyx_v_self->dtype->c_pack(__pyx_t_1, __pyx_v_place, __pyx_v_obj); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - goto __pyx_L0; + __pyx_v_self->ptr = NULL; - /* "arrex/list.pyx":203 - * return self.dtype.c_unpack(self.dtype, place) - * - * cdef int _setitem(self, void* place, obj) except -1: # <<<<<<<<<<<<<< - * return self.dtype.c_pack(self.dtype, place, obj) - * + /* "arrex/list.pyx":153 + * self.owner = None + * self.ptr = NULL + * self.size = 0 # <<<<<<<<<<<<<< + * self.allocated = 0 + * self.dtype = declared(dtype) */ + __pyx_v_self->size = 0; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("arrex.list.typedlist._setitem", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "arrex/list.pyx":206 - * return self.dtype.c_pack(self.dtype, place, obj) - * - * cdef int _use(self, buffer) except -1: # <<<<<<<<<<<<<< - * cdef Py_buffer view - * + /* "arrex/list.pyx":154 + * self.ptr = NULL + * self.size = 0 + * self.allocated = 0 # <<<<<<<<<<<<<< + * self.dtype = declared(dtype) + * if not self.dtype: */ + __pyx_v_self->allocated = 0; -static int __pyx_f_5arrex_4list_9typedlist__use(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_buffer) { - Py_buffer __pyx_v_view; - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_use", 0); - - /* "arrex/list.pyx":209 - * cdef Py_buffer view - * - * PyObject_GetBuffer(buffer, &view, PyBUF_SIMPLE) # <<<<<<<<<<<<<< - * self.ptr = view.buf - * self.allocated = view.len + /* "arrex/list.pyx":155 + * self.size = 0 + * self.allocated = 0 + * self.dtype = declared(dtype) # <<<<<<<<<<<<<< + * if not self.dtype: + * raise TypeError('dtype must be a dtype declaration instance, or a key for a declared dtype') */ - __pyx_t_1 = PyObject_GetBuffer(__pyx_v_buffer, (&__pyx_v_view), PyBUF_SIMPLE); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 209, __pyx_L1_error) + __pyx_t_10 = ((PyObject *)__pyx_f_5arrex_6dtypes_declared(__pyx_v_dtype, 0)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 155, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __Pyx_GOTREF((PyObject *)__pyx_v_self->dtype); + __Pyx_DECREF((PyObject *)__pyx_v_self->dtype); + __pyx_v_self->dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_10); + __pyx_t_10 = 0; - /* "arrex/list.pyx":210 + /* "arrex/list.pyx":156 + * self.allocated = 0 + * self.dtype = declared(dtype) + * if not self.dtype: # <<<<<<<<<<<<<< + * raise TypeError('dtype must be a dtype declaration instance, or a key for a declared dtype') * - * PyObject_GetBuffer(buffer, &view, PyBUF_SIMPLE) - * self.ptr = view.buf # <<<<<<<<<<<<<< - * self.allocated = view.len - * self.owner = view.obj - */ - __pyx_v_self->ptr = ((char *)__pyx_v_view.buf); - - /* "arrex/list.pyx":211 - * PyObject_GetBuffer(buffer, &view, PyBUF_SIMPLE) - * self.ptr = view.buf - * self.allocated = view.len # <<<<<<<<<<<<<< - * self.owner = view.obj - * PyBuffer_Release(&view) */ - __pyx_t_2 = __pyx_v_view.len; - __pyx_v_self->allocated = __pyx_t_2; + __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->dtype)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 156, __pyx_L1_error) + __pyx_t_6 = (!__pyx_t_2); + if (unlikely(__pyx_t_6)) { - /* "arrex/list.pyx":212 - * self.ptr = view.buf - * self.allocated = view.len - * self.owner = view.obj # <<<<<<<<<<<<<< - * PyBuffer_Release(&view) + /* "arrex/list.pyx":157 + * self.dtype = declared(dtype) + * if not self.dtype: + * raise TypeError('dtype must be a dtype declaration instance, or a key for a declared dtype') # <<<<<<<<<<<<<< * + * # borrow a buffer */ - __pyx_t_3 = __pyx_v_view.obj; - __Pyx_INCREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_v_self->owner); - __Pyx_DECREF(__pyx_v_self->owner); - __pyx_v_self->owner = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 157, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_Raise(__pyx_t_10, 0, 0, 0); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __PYX_ERR(0, 157, __pyx_L1_error) - /* "arrex/list.pyx":213 - * self.allocated = view.len - * self.owner = view.obj - * PyBuffer_Release(&view) # <<<<<<<<<<<<<< + /* "arrex/list.pyx":156 + * self.allocated = 0 + * self.dtype = declared(dtype) + * if not self.dtype: # <<<<<<<<<<<<<< + * raise TypeError('dtype must be a dtype declaration instance, or a key for a declared dtype') * - * cdef int _reallocate(self, size_t size) except -1: */ - PyBuffer_Release((&__pyx_v_view)); + } - /* "arrex/list.pyx":206 - * return self.dtype.c_pack(self.dtype, place, obj) - * - * cdef int _use(self, buffer) except -1: # <<<<<<<<<<<<<< - * cdef Py_buffer view + /* "arrex/list.pyx":160 * + * # borrow a buffer + * if PyObject_CheckBuffer(iterable): # <<<<<<<<<<<<<< + * self._use(iterable) + * self.size = self.allocated */ + __pyx_t_6 = PyObject_CheckBuffer(__pyx_v_iterable); + if (__pyx_t_6) { - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("arrex.list.typedlist._use", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "arrex/list.pyx":161 + * # borrow a buffer + * if PyObject_CheckBuffer(iterable): + * self._use(iterable) # <<<<<<<<<<<<<< + * self.size = self.allocated + * if reserve: + */ + __pyx_t_9 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_use(__pyx_v_self, __pyx_v_iterable); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 161, __pyx_L1_error) -/* "arrex/list.pyx":215 - * PyBuffer_Release(&view) - * - * cdef int _reallocate(self, size_t size) except -1: # <<<<<<<<<<<<<< - * lastowner = self.owner - * lastptr = self.ptr + /* "arrex/list.pyx":162 + * if PyObject_CheckBuffer(iterable): + * self._use(iterable) + * self.size = self.allocated # <<<<<<<<<<<<<< + * if reserve: + * self._reallocate(reserve * self.dtype.dsize) */ + __pyx_t_12 = __pyx_v_self->allocated; + __pyx_v_self->size = __pyx_t_12; -static int __pyx_f_5arrex_4list_9typedlist__reallocate(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, size_t __pyx_v_size) { - CYTHON_UNUSED PyObject *__pyx_v_lastowner = NULL; - char *__pyx_v_lastptr; - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - char *__pyx_t_2; - size_t __pyx_t_3; - size_t __pyx_t_4; - size_t __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_reallocate", 0); + /* "arrex/list.pyx":163 + * self._use(iterable) + * self.size = self.allocated + * if reserve: # <<<<<<<<<<<<<< + * self._reallocate(reserve * self.dtype.dsize) + * # fill with an iterable + */ + __pyx_t_6 = (__pyx_v_reserve != 0); + if (__pyx_t_6) { - /* "arrex/list.pyx":216 - * - * cdef int _reallocate(self, size_t size) except -1: - * lastowner = self.owner # <<<<<<<<<<<<<< - * lastptr = self.ptr - * + /* "arrex/list.pyx":164 + * self.size = self.allocated + * if reserve: + * self._reallocate(reserve * self.dtype.dsize) # <<<<<<<<<<<<<< + * # fill with an iterable + * else: */ - __pyx_t_1 = __pyx_v_self->owner; - __Pyx_INCREF(__pyx_t_1); - __pyx_v_lastowner = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_9 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_reallocate(__pyx_v_self, (__pyx_v_reserve * __pyx_v_self->dtype->dsize)); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 164, __pyx_L1_error) - /* "arrex/list.pyx":217 - * cdef int _reallocate(self, size_t size) except -1: - * lastowner = self.owner - * lastptr = self.ptr # <<<<<<<<<<<<<< - * - * # buffer protocol is less efficient that PyBytes_AS_STRING so we use it directly here where we know that owner is bytes + /* "arrex/list.pyx":163 + * self._use(iterable) + * self.size = self.allocated + * if reserve: # <<<<<<<<<<<<<< + * self._reallocate(reserve * self.dtype.dsize) + * # fill with an iterable */ - __pyx_t_2 = __pyx_v_self->ptr; - __pyx_v_lastptr = __pyx_t_2; + } - /* "arrex/list.pyx":220 + /* "arrex/list.pyx":160 * - * # buffer protocol is less efficient that PyBytes_AS_STRING so we use it directly here where we know that owner is bytes - * self.owner = PyBytes_FromStringAndSize(NULL, size) # <<<<<<<<<<<<<< - * self.ptr = PyBytes_AS_STRING(self.owner) - * #cdef buffer buff = buffer(size) + * # borrow a buffer + * if PyObject_CheckBuffer(iterable): # <<<<<<<<<<<<<< + * self._use(iterable) + * self.size = self.allocated */ - __pyx_t_1 = PyBytes_FromStringAndSize(NULL, __pyx_v_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->owner); - __Pyx_DECREF(__pyx_v_self->owner); - __pyx_v_self->owner = __pyx_t_1; - __pyx_t_1 = 0; + goto __pyx_L16; + } - /* "arrex/list.pyx":221 - * # buffer protocol is less efficient that PyBytes_AS_STRING so we use it directly here where we know that owner is bytes - * self.owner = PyBytes_FromStringAndSize(NULL, size) - * self.ptr = PyBytes_AS_STRING(self.owner) # <<<<<<<<<<<<<< - * #cdef buffer buff = buffer(size) - * #self.owner = buff + /* "arrex/list.pyx":167 + * # fill with an iterable + * else: + * if reserve: # <<<<<<<<<<<<<< + * self._reallocate(reserve * self.dtype.dsize) + * if iterable is not None: */ - __pyx_t_1 = __pyx_v_self->owner; - __Pyx_INCREF(__pyx_t_1); - __pyx_v_self->ptr = PyBytes_AS_STRING(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /*else*/ { + __pyx_t_6 = (__pyx_v_reserve != 0); + if (__pyx_t_6) { - /* "arrex/list.pyx":228 - * #print('** reallocate', sys.getrefcount(self.owner), sys.getrefcount(lastowner), lastowner is None) - * - * self.allocated = size # <<<<<<<<<<<<<< - * self.size = min(size, self.size) - * memcpy(self.ptr, lastptr, self.size) + /* "arrex/list.pyx":168 + * else: + * if reserve: + * self._reallocate(reserve * self.dtype.dsize) # <<<<<<<<<<<<<< + * if iterable is not None: + * if first is not None: */ - __pyx_v_self->allocated = __pyx_v_size; + __pyx_t_9 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_reallocate(__pyx_v_self, (__pyx_v_reserve * __pyx_v_self->dtype->dsize)); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 168, __pyx_L1_error) - /* "arrex/list.pyx":229 - * - * self.allocated = size - * self.size = min(size, self.size) # <<<<<<<<<<<<<< - * memcpy(self.ptr, lastptr, self.size) + /* "arrex/list.pyx":167 + * # fill with an iterable + * else: + * if reserve: # <<<<<<<<<<<<<< + * self._reallocate(reserve * self.dtype.dsize) + * if iterable is not None: + */ + } + + /* "arrex/list.pyx":169 + * if reserve: + * self._reallocate(reserve * self.dtype.dsize) + * if iterable is not None: # <<<<<<<<<<<<<< + * if first is not None: + * self.append(first) + */ + __pyx_t_6 = (__pyx_v_iterable != Py_None); + if (__pyx_t_6) { + + /* "arrex/list.pyx":170 + * self._reallocate(reserve * self.dtype.dsize) + * if iterable is not None: + * if first is not None: # <<<<<<<<<<<<<< + * self.append(first) + * self.extend(iterable) + */ + __pyx_t_6 = (__pyx_v_first != Py_None); + if (__pyx_t_6) { + + /* "arrex/list.pyx":171 + * if iterable is not None: + * if first is not None: + * self.append(first) # <<<<<<<<<<<<<< + * self.extend(iterable) * */ - __pyx_t_3 = __pyx_v_self->size; - __pyx_t_4 = __pyx_v_size; - if (((__pyx_t_3 < __pyx_t_4) != 0)) { - __pyx_t_5 = __pyx_t_3; - } else { - __pyx_t_5 = __pyx_t_4; - } - __pyx_v_self->size = __pyx_t_5; + __pyx_t_9 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->append(__pyx_v_self, __pyx_v_first, 0); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 171, __pyx_L1_error) - /* "arrex/list.pyx":230 - * self.allocated = size - * self.size = min(size, self.size) - * memcpy(self.ptr, lastptr, self.size) # <<<<<<<<<<<<<< + /* "arrex/list.pyx":170 + * self._reallocate(reserve * self.dtype.dsize) + * if iterable is not None: + * if first is not None: # <<<<<<<<<<<<<< + * self.append(first) + * self.extend(iterable) + */ + } + + /* "arrex/list.pyx":172 + * if first is not None: + * self.append(first) + * self.extend(iterable) # <<<<<<<<<<<<<< * - * cdef size_t _len(self): + * @staticmethod */ - (void)(memcpy(__pyx_v_self->ptr, __pyx_v_lastptr, __pyx_v_self->size)); + ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->extend(__pyx_v_self, __pyx_v_iterable, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 172, __pyx_L1_error) - /* "arrex/list.pyx":215 - * PyBuffer_Release(&view) + /* "arrex/list.pyx":169 + * if reserve: + * self._reallocate(reserve * self.dtype.dsize) + * if iterable is not None: # <<<<<<<<<<<<<< + * if first is not None: + * self.append(first) + */ + } + } + __pyx_L16:; + + /* "arrex/list.pyx":133 * - * cdef int _reallocate(self, size_t size) except -1: # <<<<<<<<<<<<<< - * lastowner = self.owner - * lastptr = self.ptr + * + * def __init__(self, iterable=None, object dtype=None, size_t reserve=0): # <<<<<<<<<<<<<< + * # look at the type of the first element + * first = None */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("arrex.list.typedlist._reallocate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("arrex.list.typedlist.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_lastowner); + __Pyx_XDECREF(__pyx_v_first); + __Pyx_XDECREF(__pyx_v_iterable); + __Pyx_XDECREF(__pyx_v_dtype); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "arrex/list.pyx":232 - * memcpy(self.ptr, lastptr, self.size) - * - * cdef size_t _len(self): # <<<<<<<<<<<<<< - * return self.size // self.dtype.dsize +/* "arrex/list.pyx":174 + * self.extend(iterable) * + * @staticmethod # <<<<<<<<<<<<<< + * def full(value, size, dtype=None): + * ''' full(value, size) */ -static size_t __pyx_f_5arrex_4list_9typedlist__len(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self) { - size_t __pyx_r; +/* Python wrapper */ +static PyObject *__pyx_pw_5arrex_4list_9typedlist_3full(CYTHON_UNUSED PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5arrex_4list_9typedlist_2full, " full(value, size)\n\t\t\n\t\t\tcreate a new typedlist with the given `size`, all elements initialized to `value`. \n\t\t"); +static PyMethodDef __pyx_mdef_5arrex_4list_9typedlist_3full = {"full", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9typedlist_3full, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_2full}; +static PyObject *__pyx_pw_5arrex_4list_9typedlist_3full(CYTHON_UNUSED PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_value = 0; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_v_dtype = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_len", 0); + __Pyx_RefNannySetupContext("full (wrapper)", 0); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_value,&__pyx_n_s_size,&__pyx_n_s_dtype,0}; + PyObject* values[3] = {0,0,0}; - /* "arrex/list.pyx":233 + /* "arrex/list.pyx":175 * - * cdef size_t _len(self): - * return self.size // self.dtype.dsize # <<<<<<<<<<<<<< + * @staticmethod + * def full(value, size, dtype=None): # <<<<<<<<<<<<<< + * ''' full(value, size) * - * cdef Py_ssize_t _index(self, index) except -1: */ - __pyx_r = (__pyx_v_self->size / __pyx_v_self->dtype->dsize); - goto __pyx_L0; + values[2] = ((PyObject *)Py_None); + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_value)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 174, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_size)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 174, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("full", 0, 2, 3, 1); __PYX_ERR(0, 174, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dtype); + if (value) { values[2] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 174, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "full") < 0)) __PYX_ERR(0, 174, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_value = values[0]; + __pyx_v_size = values[1]; + __pyx_v_dtype = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("full", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 174, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("arrex.list.typedlist.full", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5arrex_4list_9typedlist_2full(__pyx_v_value, __pyx_v_size, __pyx_v_dtype); - /* "arrex/list.pyx":232 - * memcpy(self.ptr, lastptr, self.size) - * - * cdef size_t _len(self): # <<<<<<<<<<<<<< - * return self.size // self.dtype.dsize + /* "arrex/list.pyx":174 + * self.extend(iterable) * + * @staticmethod # <<<<<<<<<<<<<< + * def full(value, size, dtype=None): + * ''' full(value, size) */ /* function exit code */ - __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "arrex/list.pyx":235 - * return self.size // self.dtype.dsize - * - * cdef Py_ssize_t _index(self, index) except -1: # <<<<<<<<<<<<<< - * ''' return a C index (0 < i < l) from a python object ''' - * cdef Py_ssize_t i = index - */ - -static Py_ssize_t __pyx_f_5arrex_4list_9typedlist__index(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_index) { +static PyObject *__pyx_pf_5arrex_4list_9typedlist_2full(PyObject *__pyx_v_value, PyObject *__pyx_v_size, PyObject *__pyx_v_dtype) { Py_ssize_t __pyx_v_i; - Py_ssize_t __pyx_v_l; - Py_ssize_t __pyx_r; + struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_array = 0; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - int __pyx_t_2; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; + long __pyx_t_4; + long __pyx_t_5; + Py_ssize_t __pyx_t_6; + int __pyx_t_7; + size_t __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_index", 0); - - /* "arrex/list.pyx":237 - * cdef Py_ssize_t _index(self, index) except -1: - * ''' return a C index (0 < i < l) from a python object ''' - * cdef Py_ssize_t i = index # <<<<<<<<<<<<<< - * cdef Py_ssize_t l = self._len() - * if i < 0: i += l - */ - __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 237, __pyx_L1_error) - __pyx_v_i = __pyx_t_1; - - /* "arrex/list.pyx":238 - * ''' return a C index (0 < i < l) from a python object ''' - * cdef Py_ssize_t i = index - * cdef Py_ssize_t l = self._len() # <<<<<<<<<<<<<< - * if i < 0: i += l - * if i < 0 or i >= l: - */ - __pyx_v_l = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_len(__pyx_v_self); - - /* "arrex/list.pyx":239 - * cdef Py_ssize_t i = index - * cdef Py_ssize_t l = self._len() - * if i < 0: i += l # <<<<<<<<<<<<<< - * if i < 0 or i >= l: - * raise IndexError('index out of range') - */ - __pyx_t_2 = ((__pyx_v_i < 0) != 0); - if (__pyx_t_2) { - __pyx_v_i = (__pyx_v_i + __pyx_v_l); - } + __Pyx_RefNannySetupContext("full", 0); - /* "arrex/list.pyx":240 - * cdef Py_ssize_t l = self._len() - * if i < 0: i += l - * if i < 0 or i >= l: # <<<<<<<<<<<<<< - * raise IndexError('index out of range') - * return i + /* "arrex/list.pyx":181 + * ''' + * cdef ssize_t i + * cdef typedlist array = typedlist(dtype=dtype or type(value), reserve=size) # <<<<<<<<<<<<<< + * for i in range(size): + * array._setitem(array.ptr + i*array.dtype.dsize, value) */ - __pyx_t_3 = ((__pyx_v_i < 0) != 0); + __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_dtype); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 181, __pyx_L1_error) if (!__pyx_t_3) { } else { - __pyx_t_2 = __pyx_t_3; - goto __pyx_L5_bool_binop_done; - } - __pyx_t_3 = ((__pyx_v_i >= __pyx_v_l) != 0); - __pyx_t_2 = __pyx_t_3; - __pyx_L5_bool_binop_done:; - if (unlikely(__pyx_t_2)) { + __Pyx_INCREF(__pyx_v_dtype); + __pyx_t_2 = __pyx_v_dtype; + goto __pyx_L3_bool_binop_done; + } + __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_value))); + __pyx_t_2 = ((PyObject *)Py_TYPE(__pyx_v_value)); + __pyx_L3_bool_binop_done:; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 181, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reserve, __pyx_v_size) < 0) __PYX_ERR(0, 181, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5arrex_4list_typedlist), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 181, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_array = ((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_t_2); + __pyx_t_2 = 0; - /* "arrex/list.pyx":241 - * if i < 0: i += l - * if i < 0 or i >= l: - * raise IndexError('index out of range') # <<<<<<<<<<<<<< - * return i - * + /* "arrex/list.pyx":182 + * cdef ssize_t i + * cdef typedlist array = typedlist(dtype=dtype or type(value), reserve=size) + * for i in range(size): # <<<<<<<<<<<<<< + * array._setitem(array.ptr + i*array.dtype.dsize, value) + * array.size = array.allocated */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 241, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_As_long(__pyx_v_size); if (unlikely((__pyx_t_4 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 182, __pyx_L1_error) + __pyx_t_5 = __pyx_t_4; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; - /* "arrex/list.pyx":240 - * cdef Py_ssize_t l = self._len() - * if i < 0: i += l - * if i < 0 or i >= l: # <<<<<<<<<<<<<< - * raise IndexError('index out of range') - * return i + /* "arrex/list.pyx":183 + * cdef typedlist array = typedlist(dtype=dtype or type(value), reserve=size) + * for i in range(size): + * array._setitem(array.ptr + i*array.dtype.dsize, value) # <<<<<<<<<<<<<< + * array.size = array.allocated + * return array */ + __pyx_t_7 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_array->__pyx_vtab)->_setitem(__pyx_v_array, (__pyx_v_array->ptr + (__pyx_v_i * __pyx_v_array->dtype->dsize)), __pyx_v_value); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 183, __pyx_L1_error) } - /* "arrex/list.pyx":242 - * if i < 0 or i >= l: - * raise IndexError('index out of range') - * return i # <<<<<<<<<<<<<< + /* "arrex/list.pyx":184 + * for i in range(size): + * array._setitem(array.ptr + i*array.dtype.dsize, value) + * array.size = array.allocated # <<<<<<<<<<<<<< + * return array * - * # python interface */ - __pyx_r = __pyx_v_i; + __pyx_t_8 = __pyx_v_array->allocated; + __pyx_v_array->size = __pyx_t_8; + + /* "arrex/list.pyx":185 + * array._setitem(array.ptr + i*array.dtype.dsize, value) + * array.size = array.allocated + * return array # <<<<<<<<<<<<<< + * + * @staticmethod + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_array); + __pyx_r = ((PyObject *)__pyx_v_array); goto __pyx_L0; - /* "arrex/list.pyx":235 - * return self.size // self.dtype.dsize + /* "arrex/list.pyx":174 + * self.extend(iterable) * - * cdef Py_ssize_t _index(self, index) except -1: # <<<<<<<<<<<<<< - * ''' return a C index (0 < i < l) from a python object ''' - * cdef Py_ssize_t i = index + * @staticmethod # <<<<<<<<<<<<<< + * def full(value, size, dtype=None): + * ''' full(value, size) */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("arrex.list.typedlist._index", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1L; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("arrex.list.typedlist.full", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_array); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "arrex/list.pyx":246 - * # python interface - * - * def reserve(self, amount): # <<<<<<<<<<<<<< - * ''' reserve(amount: int) +/* "arrex/list.pyx":187 + * return array * + * @staticmethod # <<<<<<<<<<<<<< + * def empty(dtype, size): + * ''' empty(dtype, size) */ /* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_7reserve(PyObject *__pyx_v_self, PyObject *__pyx_v_amount); /*proto*/ -static char __pyx_doc_5arrex_4list_9typedlist_6reserve[] = " reserve(amount: int)\n\t\t\n\t\t\tMake sure there is enough allocated memory to append the given amount of elements. \n\t\t\n\t\t\tif there is not enough of allocated memory, the memory is reallocated immediately.\n\t\t"; -static PyObject *__pyx_pw_5arrex_4list_9typedlist_7reserve(PyObject *__pyx_v_self, PyObject *__pyx_v_amount) { +static PyObject *__pyx_pw_5arrex_4list_9typedlist_5empty(CYTHON_UNUSED PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5arrex_4list_9typedlist_4empty, " empty(dtype, size)\n\t\t\n\t\t\tcreate a new typedlist with the given `size` and unitialized elements of type `dtype`\n\t\t"); +static PyMethodDef __pyx_mdef_5arrex_4list_9typedlist_5empty = {"empty", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9typedlist_5empty, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_4empty}; +static PyObject *__pyx_pw_5arrex_4list_9typedlist_5empty(CYTHON_UNUSED PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_dtype = 0; + PyObject *__pyx_v_size = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("reserve (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_9typedlist_6reserve(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), ((PyObject *)__pyx_v_amount)); + __Pyx_RefNannySetupContext("empty (wrapper)", 0); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dtype,&__pyx_n_s_size,0}; + PyObject* values[2] = {0,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dtype)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 187, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_size)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 187, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("empty", 1, 2, 2, 1); __PYX_ERR(0, 187, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "empty") < 0)) __PYX_ERR(0, 187, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + } + __pyx_v_dtype = values[0]; + __pyx_v_size = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("empty", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 187, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("arrex.list.typedlist.empty", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5arrex_4list_9typedlist_4empty(__pyx_v_dtype, __pyx_v_size); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5arrex_4list_9typedlist_6reserve(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_amount) { - size_t __pyx_v_asked; +static PyObject *__pyx_pf_5arrex_4list_9typedlist_4empty(PyObject *__pyx_v_dtype, PyObject *__pyx_v_size) { + struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_array = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; + PyObject *__pyx_t_2 = NULL; size_t __pyx_t_3; - int __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("reserve", 0); + __Pyx_RefNannySetupContext("empty", 0); - /* "arrex/list.pyx":253 - * if there is not enough of allocated memory, the memory is reallocated immediately. + /* "arrex/list.pyx":193 + * create a new typedlist with the given `size` and unitialized elements of type `dtype` * ''' - * if amount < 0: # <<<<<<<<<<<<<< - * raise ValueError('amount must be positive') - * cdef size_t asked = self.size + (amount) * self.dtype.dsize + * cdef typedlist array = typedlist(dtype=dtype, reserve=size) # <<<<<<<<<<<<<< + * array.size = array.allocated + * return array */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_amount, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 253, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_dtype) < 0) __PYX_ERR(0, 193, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reserve, __pyx_v_size) < 0) __PYX_ERR(0, 193, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5arrex_4list_typedlist), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(__pyx_t_2)) { - - /* "arrex/list.pyx":254 - * ''' - * if amount < 0: - * raise ValueError('amount must be positive') # <<<<<<<<<<<<<< - * cdef size_t asked = self.size + (amount) * self.dtype.dsize - * if asked > self.allocated: - */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 254, __pyx_L1_error) + __pyx_v_array = ((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_t_2); + __pyx_t_2 = 0; - /* "arrex/list.pyx":253 - * if there is not enough of allocated memory, the memory is reallocated immediately. + /* "arrex/list.pyx":194 * ''' - * if amount < 0: # <<<<<<<<<<<<<< - * raise ValueError('amount must be positive') - * cdef size_t asked = self.size + (amount) * self.dtype.dsize - */ - } - - /* "arrex/list.pyx":255 - * if amount < 0: - * raise ValueError('amount must be positive') - * cdef size_t asked = self.size + (amount) * self.dtype.dsize # <<<<<<<<<<<<<< - * if asked > self.allocated: - * self._reallocate(asked) - */ - __pyx_t_3 = __Pyx_PyInt_As_size_t(__pyx_v_amount); if (unlikely((__pyx_t_3 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 255, __pyx_L1_error) - __pyx_v_asked = (__pyx_v_self->size + (((size_t)__pyx_t_3) * __pyx_v_self->dtype->dsize)); - - /* "arrex/list.pyx":256 - * raise ValueError('amount must be positive') - * cdef size_t asked = self.size + (amount) * self.dtype.dsize - * if asked > self.allocated: # <<<<<<<<<<<<<< - * self._reallocate(asked) + * cdef typedlist array = typedlist(dtype=dtype, reserve=size) + * array.size = array.allocated # <<<<<<<<<<<<<< + * return array * */ - __pyx_t_2 = ((__pyx_v_asked > __pyx_v_self->allocated) != 0); - if (__pyx_t_2) { + __pyx_t_3 = __pyx_v_array->allocated; + __pyx_v_array->size = __pyx_t_3; - /* "arrex/list.pyx":257 - * cdef size_t asked = self.size + (amount) * self.dtype.dsize - * if asked > self.allocated: - * self._reallocate(asked) # <<<<<<<<<<<<<< + /* "arrex/list.pyx":195 + * cdef typedlist array = typedlist(dtype=dtype, reserve=size) + * array.size = array.allocated + * return array # <<<<<<<<<<<<<< * - * cpdef int append(self, value) except -1: - */ - __pyx_t_4 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_reallocate(__pyx_v_self, __pyx_v_asked); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 257, __pyx_L1_error) - - /* "arrex/list.pyx":256 - * raise ValueError('amount must be positive') - * cdef size_t asked = self.size + (amount) * self.dtype.dsize - * if asked > self.allocated: # <<<<<<<<<<<<<< - * self._reallocate(asked) * */ - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_array); + __pyx_r = ((PyObject *)__pyx_v_array); + goto __pyx_L0; - /* "arrex/list.pyx":246 - * # python interface - * - * def reserve(self, amount): # <<<<<<<<<<<<<< - * ''' reserve(amount: int) + /* "arrex/list.pyx":187 + * return array * + * @staticmethod # <<<<<<<<<<<<<< + * def empty(dtype, size): + * ''' empty(dtype, size) */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("arrex.list.typedlist.reserve", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("arrex.list.typedlist.empty", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_array); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "arrex/list.pyx":259 - * self._reallocate(asked) +/* "arrex/list.pyx":200 + * # convenient internal functions * - * cpdef int append(self, value) except -1: # <<<<<<<<<<<<<< - * ''' append(value) + * cdef object _getitem(self, void* place): # <<<<<<<<<<<<<< + * return self.dtype.c_unpack(self.dtype, place) * */ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_9append(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_f_5arrex_4list_9typedlist_append(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_value, int __pyx_skip_dispatch) { - int __pyx_r; +static PyObject *__pyx_f_5arrex_4list_9typedlist__getitem(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, void *__pyx_v_place) { + 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; - int __pyx_t_5; - int __pyx_t_6; - size_t __pyx_t_7; - size_t __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("append", 0); - /* Check if called by wrapper */ - if (unlikely(__pyx_skip_dispatch)) ; - /* Check if overridden in Python */ - else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { - #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS - static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; - if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { - PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); - #endif - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_append); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_5arrex_4list_9typedlist_9append)) { - __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_value) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_value); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 259, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_5; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - } - #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS - __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); - __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); - if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { - __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; - } - #endif - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS - } - #endif - } - - /* "arrex/list.pyx":266 - * if there is not enough allocated memory, reallocate enough to amortize the realocation time over the multiple appends - * ''' - * if self.allocated < self.size + self.dtype.dsize: # <<<<<<<<<<<<<< - * self._reallocate(self.allocated*2 or self.dtype.dsize) - * - */ - __pyx_t_6 = ((__pyx_v_self->allocated < (__pyx_v_self->size + __pyx_v_self->dtype->dsize)) != 0); - if (__pyx_t_6) { - - /* "arrex/list.pyx":267 - * ''' - * if self.allocated < self.size + self.dtype.dsize: - * self._reallocate(self.allocated*2 or self.dtype.dsize) # <<<<<<<<<<<<<< - * - * self._setitem(self.ptr + self.size, value) - */ - __pyx_t_8 = (__pyx_v_self->allocated * 2); - if (!__pyx_t_8) { - } else { - __pyx_t_7 = __pyx_t_8; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_7 = __pyx_v_self->dtype->dsize; - __pyx_L4_bool_binop_done:; - __pyx_t_5 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_reallocate(__pyx_v_self, __pyx_t_7); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 267, __pyx_L1_error) - - /* "arrex/list.pyx":266 - * if there is not enough allocated memory, reallocate enough to amortize the realocation time over the multiple appends - * ''' - * if self.allocated < self.size + self.dtype.dsize: # <<<<<<<<<<<<<< - * self._reallocate(self.allocated*2 or self.dtype.dsize) - * - */ - } - - /* "arrex/list.pyx":269 - * self._reallocate(self.allocated*2 or self.dtype.dsize) - * - * self._setitem(self.ptr + self.size, value) # <<<<<<<<<<<<<< - * self.size += self.dtype.dsize - * - */ - __pyx_t_5 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_setitem(__pyx_v_self, (__pyx_v_self->ptr + __pyx_v_self->size), __pyx_v_value); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 269, __pyx_L1_error) + __Pyx_RefNannySetupContext("_getitem", 0); - /* "arrex/list.pyx":270 + /* "arrex/list.pyx":201 * - * self._setitem(self.ptr + self.size, value) - * self.size += self.dtype.dsize # <<<<<<<<<<<<<< + * cdef object _getitem(self, void* place): + * return self.dtype.c_unpack(self.dtype, place) # <<<<<<<<<<<<<< * - * def pop(self, index=None): + * cdef int _setitem(self, void* place, obj) except -1: */ - __pyx_v_self->size = (__pyx_v_self->size + __pyx_v_self->dtype->dsize); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_v_self->dtype); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = __pyx_v_self->dtype->c_unpack(__pyx_t_1, __pyx_v_place); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 201, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "arrex/list.pyx":259 - * self._reallocate(asked) + /* "arrex/list.pyx":200 + * # convenient internal functions * - * cpdef int append(self, value) except -1: # <<<<<<<<<<<<<< - * ''' append(value) + * cdef object _getitem(self, void* place): # <<<<<<<<<<<<<< + * return self.dtype.c_unpack(self.dtype, place) * */ /* function exit code */ - __pyx_r = 0; - 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_AddTraceback("arrex.list.typedlist.append", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __Pyx_AddTraceback("arrex.list.typedlist._getitem", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_9append(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static char __pyx_doc_5arrex_4list_9typedlist_8append[] = " append(value)\n\t\t\n\t\t\tappend the given object at the end of the array\n\t\t\n\t\t\tif there is not enough allocated memory, reallocate enough to amortize the realocation time over the multiple appends\n\t\t"; -static PyObject *__pyx_pw_5arrex_4list_9typedlist_9append(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("append (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_9typedlist_8append(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), ((PyObject *)__pyx_v_value)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} +/* "arrex/list.pyx":203 + * return self.dtype.c_unpack(self.dtype, place) + * + * cdef int _setitem(self, void* place, obj) except -1: # <<<<<<<<<<<<<< + * return self.dtype.c_pack(self.dtype, place, obj) + * + */ -static PyObject *__pyx_pf_5arrex_4list_9typedlist_8append(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_value) { - PyObject *__pyx_r = NULL; +static int __pyx_f_5arrex_4list_9typedlist__setitem(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, void *__pyx_v_place, PyObject *__pyx_v_obj) { + int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("append", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_5arrex_4list_9typedlist_append(__pyx_v_self, __pyx_v_value, 1); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 259, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __Pyx_RefNannySetupContext("_setitem", 0); + + /* "arrex/list.pyx":204 + * + * cdef int _setitem(self, void* place, obj) except -1: + * return self.dtype.c_pack(self.dtype, place, obj) # <<<<<<<<<<<<<< + * + * cdef int _use(self, buffer) except -1: + */ + __pyx_t_1 = ((PyObject *)__pyx_v_self->dtype); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = __pyx_v_self->dtype->c_pack(__pyx_t_1, __pyx_v_place, __pyx_v_obj); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 204, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; goto __pyx_L0; + /* "arrex/list.pyx":203 + * return self.dtype.c_unpack(self.dtype, place) + * + * cdef int _setitem(self, void* place, obj) except -1: # <<<<<<<<<<<<<< + * return self.dtype.c_pack(self.dtype, place, obj) + * + */ + /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("arrex.list.typedlist.append", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("arrex.list.typedlist._setitem", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "arrex/list.pyx":272 - * self.size += self.dtype.dsize +/* "arrex/list.pyx":206 + * return self.dtype.c_pack(self.dtype, place, obj) * - * def pop(self, index=None): # <<<<<<<<<<<<<< - * ''' pop(index=None) -> object + * cdef int _use(self, buffer) except -1: # <<<<<<<<<<<<<< + * cdef Py_buffer view * */ -/* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_11pop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5arrex_4list_9typedlist_10pop[] = " pop(index=None) -> object\n\t\t\n\t\t\tremove the element at index, returning it. If no index is specified, it will pop the last one .\n\t\t"; -static PyObject *__pyx_pw_5arrex_4list_9typedlist_11pop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_index = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("pop (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_index,0}; - PyObject* values[1] = {0}; - values[0] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_index); - if (value) { values[0] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pop") < 0)) __PYX_ERR(0, 272, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_index = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("pop", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 272, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("arrex.list.typedlist.pop", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5arrex_4list_9typedlist_10pop(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), __pyx_v_index); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5arrex_4list_9typedlist_10pop(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_index) { - size_t __pyx_v_i; - char *__pyx_v_start; - PyObject *__pyx_v_e = NULL; - PyObject *__pyx_r = NULL; +static int __pyx_f_5arrex_4list_9typedlist__use(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_buffer) { + Py_buffer __pyx_v_view; + int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("pop", 0); + __Pyx_RefNannySetupContext("_use", 0); - /* "arrex/list.pyx":280 - * cdef char * start - * - * if not self.size: # <<<<<<<<<<<<<< - * raise IndexError('pop from empty list') + /* "arrex/list.pyx":209 + * cdef Py_buffer view * + * PyObject_GetBuffer(buffer, &view, PyBUF_SIMPLE) # <<<<<<<<<<<<<< + * self.ptr = view.buf + * self.allocated = view.len */ - __pyx_t_1 = ((!(__pyx_v_self->size != 0)) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_1 = PyObject_GetBuffer(__pyx_v_buffer, (&__pyx_v_view), PyBUF_SIMPLE); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 209, __pyx_L1_error) - /* "arrex/list.pyx":281 - * - * if not self.size: - * raise IndexError('pop from empty list') # <<<<<<<<<<<<<< + /* "arrex/list.pyx":210 * - * if index is None: + * PyObject_GetBuffer(buffer, &view, PyBUF_SIMPLE) + * self.ptr = view.buf # <<<<<<<<<<<<<< + * self.allocated = view.len + * self.owner = view.obj */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 281, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 281, __pyx_L1_error) + __pyx_v_self->ptr = ((char *)__pyx_v_view.buf); - /* "arrex/list.pyx":280 - * cdef char * start - * - * if not self.size: # <<<<<<<<<<<<<< - * raise IndexError('pop from empty list') - * + /* "arrex/list.pyx":211 + * PyObject_GetBuffer(buffer, &view, PyBUF_SIMPLE) + * self.ptr = view.buf + * self.allocated = view.len # <<<<<<<<<<<<<< + * self.owner = view.obj + * PyBuffer_Release(&view) */ - } + __pyx_t_2 = __pyx_v_view.len; + __pyx_v_self->allocated = __pyx_t_2; - /* "arrex/list.pyx":283 - * raise IndexError('pop from empty list') + /* "arrex/list.pyx":212 + * self.ptr = view.buf + * self.allocated = view.len + * self.owner = view.obj # <<<<<<<<<<<<<< + * PyBuffer_Release(&view) * - * if index is None: # <<<<<<<<<<<<<< - * e = self._getitem(self.ptr + self.size - self.dtype.dsize) - * self.size -= self.dtype.dsize */ - __pyx_t_1 = (__pyx_v_index == Py_None); - __pyx_t_3 = (__pyx_t_1 != 0); - if (__pyx_t_3) { + __pyx_t_3 = __pyx_v_view.obj; + __Pyx_INCREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_self->owner); + __Pyx_DECREF(__pyx_v_self->owner); + __pyx_v_self->owner = __pyx_t_3; + __pyx_t_3 = 0; - /* "arrex/list.pyx":284 + /* "arrex/list.pyx":213 + * self.allocated = view.len + * self.owner = view.obj + * PyBuffer_Release(&view) # <<<<<<<<<<<<<< * - * if index is None: - * e = self._getitem(self.ptr + self.size - self.dtype.dsize) # <<<<<<<<<<<<<< - * self.size -= self.dtype.dsize - * return e + * cdef int _reallocate(self, size_t size) except -1: */ - __pyx_t_2 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_getitem(__pyx_v_self, ((__pyx_v_self->ptr + __pyx_v_self->size) - __pyx_v_self->dtype->dsize)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 284, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_e = __pyx_t_2; - __pyx_t_2 = 0; + PyBuffer_Release((&__pyx_v_view)); - /* "arrex/list.pyx":285 - * if index is None: - * e = self._getitem(self.ptr + self.size - self.dtype.dsize) - * self.size -= self.dtype.dsize # <<<<<<<<<<<<<< - * return e - * else: + /* "arrex/list.pyx":206 + * return self.dtype.c_pack(self.dtype, place, obj) + * + * cdef int _use(self, buffer) except -1: # <<<<<<<<<<<<<< + * cdef Py_buffer view + * */ - __pyx_v_self->size = (__pyx_v_self->size - __pyx_v_self->dtype->dsize); - /* "arrex/list.pyx":286 - * e = self._getitem(self.ptr + self.size - self.dtype.dsize) - * self.size -= self.dtype.dsize - * return e # <<<<<<<<<<<<<< - * else: - * i = self._index(index) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_e); - __pyx_r = __pyx_v_e; - goto __pyx_L0; + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("arrex.list.typedlist._use", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "arrex/list.pyx":283 - * raise IndexError('pop from empty list') +/* "arrex/list.pyx":215 + * PyBuffer_Release(&view) * - * if index is None: # <<<<<<<<<<<<<< - * e = self._getitem(self.ptr + self.size - self.dtype.dsize) - * self.size -= self.dtype.dsize + * cdef int _reallocate(self, size_t size) except -1: # <<<<<<<<<<<<<< + * lastowner = self.owner + * lastptr = self.ptr */ - } - /* "arrex/list.pyx":288 - * return e - * else: - * i = self._index(index) # <<<<<<<<<<<<<< +static int __pyx_f_5arrex_4list_9typedlist__reallocate(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, size_t __pyx_v_size) { + CYTHON_UNUSED PyObject *__pyx_v_lastowner = NULL; + char *__pyx_v_lastptr; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + char *__pyx_t_2; + size_t __pyx_t_3; + size_t __pyx_t_4; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_reallocate", 0); + + /* "arrex/list.pyx":216 + * + * cdef int _reallocate(self, size_t size) except -1: + * lastowner = self.owner # <<<<<<<<<<<<<< + * lastptr = self.ptr * - * start = self.ptr + i*self.dtype.dsize */ - /*else*/ { - __pyx_t_4 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_index(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1L))) __PYX_ERR(0, 288, __pyx_L1_error) - __pyx_v_i = __pyx_t_4; + __pyx_t_1 = __pyx_v_self->owner; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_lastowner = __pyx_t_1; + __pyx_t_1 = 0; - /* "arrex/list.pyx":290 - * i = self._index(index) + /* "arrex/list.pyx":217 + * cdef int _reallocate(self, size_t size) except -1: + * lastowner = self.owner + * lastptr = self.ptr # <<<<<<<<<<<<<< * - * start = self.ptr + i*self.dtype.dsize # <<<<<<<<<<<<<< - * e = self._getitem(start) - * memmove(start, start + self.dtype.dsize, self.size-(i+1)*self.dtype.dsize) + * # buffer protocol is less efficient that PyBytes_AS_STRING so we use it directly here where we know that owner is bytes */ - __pyx_v_start = (__pyx_v_self->ptr + (__pyx_v_i * __pyx_v_self->dtype->dsize)); + __pyx_t_2 = __pyx_v_self->ptr; + __pyx_v_lastptr = __pyx_t_2; - /* "arrex/list.pyx":291 + /* "arrex/list.pyx":220 * - * start = self.ptr + i*self.dtype.dsize - * e = self._getitem(start) # <<<<<<<<<<<<<< - * memmove(start, start + self.dtype.dsize, self.size-(i+1)*self.dtype.dsize) - * self.size -= self.dtype.dsize + * # buffer protocol is less efficient that PyBytes_AS_STRING so we use it directly here where we know that owner is bytes + * self.owner = PyBytes_FromStringAndSize(NULL, size) # <<<<<<<<<<<<<< + * self.ptr = PyBytes_AS_STRING(self.owner) + * #cdef buffer buff = buffer(size) */ - __pyx_t_2 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_getitem(__pyx_v_self, __pyx_v_start); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 291, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_e = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_1 = PyBytes_FromStringAndSize(NULL, __pyx_v_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->owner); + __Pyx_DECREF(__pyx_v_self->owner); + __pyx_v_self->owner = __pyx_t_1; + __pyx_t_1 = 0; - /* "arrex/list.pyx":292 - * start = self.ptr + i*self.dtype.dsize - * e = self._getitem(start) - * memmove(start, start + self.dtype.dsize, self.size-(i+1)*self.dtype.dsize) # <<<<<<<<<<<<<< - * self.size -= self.dtype.dsize - * return e + /* "arrex/list.pyx":221 + * # buffer protocol is less efficient that PyBytes_AS_STRING so we use it directly here where we know that owner is bytes + * self.owner = PyBytes_FromStringAndSize(NULL, size) + * self.ptr = PyBytes_AS_STRING(self.owner) # <<<<<<<<<<<<<< + * #cdef buffer buff = buffer(size) + * #self.owner = buff */ - (void)(memmove(__pyx_v_start, (__pyx_v_start + __pyx_v_self->dtype->dsize), (__pyx_v_self->size - ((__pyx_v_i + 1) * __pyx_v_self->dtype->dsize)))); + __pyx_t_1 = __pyx_v_self->owner; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_self->ptr = PyBytes_AS_STRING(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "arrex/list.pyx":293 - * e = self._getitem(start) - * memmove(start, start + self.dtype.dsize, self.size-(i+1)*self.dtype.dsize) - * self.size -= self.dtype.dsize # <<<<<<<<<<<<<< - * return e + /* "arrex/list.pyx":228 + * #print('** reallocate', sys.getrefcount(self.owner), sys.getrefcount(lastowner), lastowner is None) * + * self.allocated = size # <<<<<<<<<<<<<< + * self.size = min(size, self.size) + * memcpy(self.ptr, lastptr, self.size) */ - __pyx_v_self->size = (__pyx_v_self->size - __pyx_v_self->dtype->dsize); + __pyx_v_self->allocated = __pyx_v_size; - /* "arrex/list.pyx":294 - * memmove(start, start + self.dtype.dsize, self.size-(i+1)*self.dtype.dsize) - * self.size -= self.dtype.dsize - * return e # <<<<<<<<<<<<<< + /* "arrex/list.pyx":229 + * + * self.allocated = size + * self.size = min(size, self.size) # <<<<<<<<<<<<<< + * memcpy(self.ptr, lastptr, self.size) * - * def insert(self, index, value): */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_e); - __pyx_r = __pyx_v_e; - goto __pyx_L0; + __pyx_t_3 = __pyx_v_self->size; + __pyx_t_4 = __pyx_v_size; + if ((__pyx_t_3 < __pyx_t_4)) { + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; } + __pyx_v_self->size = __pyx_t_5; - /* "arrex/list.pyx":272 - * self.size += self.dtype.dsize + /* "arrex/list.pyx":230 + * self.allocated = size + * self.size = min(size, self.size) + * memcpy(self.ptr, lastptr, self.size) # <<<<<<<<<<<<<< * - * def pop(self, index=None): # <<<<<<<<<<<<<< - * ''' pop(index=None) -> object + * cdef size_t _len(self): + */ + (void)(memcpy(__pyx_v_self->ptr, __pyx_v_lastptr, __pyx_v_self->size)); + + /* "arrex/list.pyx":215 + * PyBuffer_Release(&view) * + * cdef int _reallocate(self, size_t size) except -1: # <<<<<<<<<<<<<< + * lastowner = self.owner + * lastptr = self.ptr */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("arrex.list.typedlist.pop", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("arrex.list.typedlist._reallocate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_e); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_lastowner); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "arrex/list.pyx":296 - * return e +/* "arrex/list.pyx":232 + * memcpy(self.ptr, lastptr, self.size) * - * def insert(self, index, value): # <<<<<<<<<<<<<< - * ''' insert(index, value) + * cdef size_t _len(self): # <<<<<<<<<<<<<< + * return self.size // self.dtype.dsize * */ -/* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_13insert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5arrex_4list_9typedlist_12insert[] = " insert(index, value)\n\t\t\n\t\t\tinsert value at index \n\t\t"; -static PyObject *__pyx_pw_5arrex_4list_9typedlist_13insert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_index = 0; - PyObject *__pyx_v_value = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; +static size_t __pyx_f_5arrex_4list_9typedlist__len(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self) { + size_t __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("insert (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_index,&__pyx_n_s_value,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_index)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("insert", 1, 2, 2, 1); __PYX_ERR(0, 296, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "insert") < 0)) __PYX_ERR(0, 296, __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_index = values[0]; - __pyx_v_value = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("insert", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 296, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("arrex.list.typedlist.insert", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5arrex_4list_9typedlist_12insert(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), __pyx_v_index, __pyx_v_value); + __Pyx_RefNannySetupContext("_len", 0); + + /* "arrex/list.pyx":233 + * + * cdef size_t _len(self): + * return self.size // self.dtype.dsize # <<<<<<<<<<<<<< + * + * cdef Py_ssize_t _index(self, index) except -1: + */ + __pyx_r = (__pyx_v_self->size / __pyx_v_self->dtype->dsize); + goto __pyx_L0; + + /* "arrex/list.pyx":232 + * memcpy(self.ptr, lastptr, self.size) + * + * cdef size_t _len(self): # <<<<<<<<<<<<<< + * return self.size // self.dtype.dsize + * + */ /* function exit code */ + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5arrex_4list_9typedlist_12insert(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { +/* "arrex/list.pyx":235 + * return self.size // self.dtype.dsize + * + * cdef Py_ssize_t _index(self, index) except -1: # <<<<<<<<<<<<<< + * ''' return a C index (0 < i < l) from a python object ''' + * cdef Py_ssize_t i = index + */ + +static Py_ssize_t __pyx_f_5arrex_4list_9typedlist__index(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_index) { Py_ssize_t __pyx_v_i; Py_ssize_t __pyx_v_l; - size_t __pyx_v_j; - char *__pyx_v_start; - PyObject *__pyx_r = NULL; + Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; - int __pyx_t_2; + size_t __pyx_t_2; int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - size_t __pyx_t_5; - size_t __pyx_t_6; - int __pyx_t_7; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("insert", 0); + __Pyx_RefNannySetupContext("_index", 0); - /* "arrex/list.pyx":302 - * ''' - * + /* "arrex/list.pyx":237 + * cdef Py_ssize_t _index(self, index) except -1: + * ''' return a C index (0 < i < l) from a python object ''' * cdef Py_ssize_t i = index # <<<<<<<<<<<<<< * cdef Py_ssize_t l = self._len() * if i < 0: i += l */ - __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 302, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 237, __pyx_L1_error) __pyx_v_i = __pyx_t_1; - /* "arrex/list.pyx":303 - * + /* "arrex/list.pyx":238 + * ''' return a C index (0 < i < l) from a python object ''' * cdef Py_ssize_t i = index * cdef Py_ssize_t l = self._len() # <<<<<<<<<<<<<< * if i < 0: i += l - * if i < 0 or i > l: + * if i < 0 or i >= l: */ - __pyx_v_l = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_len(__pyx_v_self); + __pyx_t_2 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_len(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 238, __pyx_L1_error) + __pyx_v_l = __pyx_t_2; - /* "arrex/list.pyx":304 + /* "arrex/list.pyx":239 * cdef Py_ssize_t i = index * cdef Py_ssize_t l = self._len() * if i < 0: i += l # <<<<<<<<<<<<<< - * if i < 0 or i > l: + * if i < 0 or i >= l: * raise IndexError('index out of range') */ - __pyx_t_2 = ((__pyx_v_i < 0) != 0); - if (__pyx_t_2) { + __pyx_t_3 = (__pyx_v_i < 0); + if (__pyx_t_3) { __pyx_v_i = (__pyx_v_i + __pyx_v_l); } - /* "arrex/list.pyx":305 + /* "arrex/list.pyx":240 * cdef Py_ssize_t l = self._len() * if i < 0: i += l - * if i < 0 or i > l: # <<<<<<<<<<<<<< + * if i < 0 or i >= l: # <<<<<<<<<<<<<< * raise IndexError('index out of range') - * cdef size_t j = i + * return i */ - __pyx_t_3 = ((__pyx_v_i < 0) != 0); - if (!__pyx_t_3) { + __pyx_t_4 = (__pyx_v_i < 0); + if (!__pyx_t_4) { } else { - __pyx_t_2 = __pyx_t_3; + __pyx_t_3 = __pyx_t_4; goto __pyx_L5_bool_binop_done; } - __pyx_t_3 = ((__pyx_v_i > __pyx_v_l) != 0); - __pyx_t_2 = __pyx_t_3; + __pyx_t_4 = (__pyx_v_i >= __pyx_v_l); + __pyx_t_3 = __pyx_t_4; __pyx_L5_bool_binop_done:; - if (unlikely(__pyx_t_2)) { + if (unlikely(__pyx_t_3)) { - /* "arrex/list.pyx":306 + /* "arrex/list.pyx":241 * if i < 0: i += l - * if i < 0 or i > l: + * if i < 0 or i >= l: * raise IndexError('index out of range') # <<<<<<<<<<<<<< - * cdef size_t j = i + * return i * */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 306, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 306, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 241, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __PYX_ERR(0, 241, __pyx_L1_error) - /* "arrex/list.pyx":305 + /* "arrex/list.pyx":240 * cdef Py_ssize_t l = self._len() * if i < 0: i += l - * if i < 0 or i > l: # <<<<<<<<<<<<<< + * if i < 0 or i >= l: # <<<<<<<<<<<<<< * raise IndexError('index out of range') - * cdef size_t j = i + * return i */ } - /* "arrex/list.pyx":307 - * if i < 0 or i > l: + /* "arrex/list.pyx":242 + * if i < 0 or i >= l: * raise IndexError('index out of range') - * cdef size_t j = i # <<<<<<<<<<<<<< - * - * if self.allocated - self.size < self.dtype.dsize: - */ - __pyx_v_j = __pyx_v_i; - - /* "arrex/list.pyx":309 - * cdef size_t j = i - * - * if self.allocated - self.size < self.dtype.dsize: # <<<<<<<<<<<<<< - * self._reallocate(self.allocated*2 or self.dtype.dsize) - * - */ - __pyx_t_2 = (((__pyx_v_self->allocated - __pyx_v_self->size) < __pyx_v_self->dtype->dsize) != 0); - if (__pyx_t_2) { - - /* "arrex/list.pyx":310 - * - * if self.allocated - self.size < self.dtype.dsize: - * self._reallocate(self.allocated*2 or self.dtype.dsize) # <<<<<<<<<<<<<< - * - * cdef char * start = self.ptr + j*self.dtype.dsize - */ - __pyx_t_6 = (__pyx_v_self->allocated * 2); - if (!__pyx_t_6) { - } else { - __pyx_t_5 = __pyx_t_6; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_5 = __pyx_v_self->dtype->dsize; - __pyx_L8_bool_binop_done:; - __pyx_t_7 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_reallocate(__pyx_v_self, __pyx_t_5); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 310, __pyx_L1_error) - - /* "arrex/list.pyx":309 - * cdef size_t j = i - * - * if self.allocated - self.size < self.dtype.dsize: # <<<<<<<<<<<<<< - * self._reallocate(self.allocated*2 or self.dtype.dsize) - * - */ - } - - /* "arrex/list.pyx":312 - * self._reallocate(self.allocated*2 or self.dtype.dsize) - * - * cdef char * start = self.ptr + j*self.dtype.dsize # <<<<<<<<<<<<<< - * memmove(start+self.dtype.dsize, start, self.size-j*self.dtype.dsize) - * self._setitem(start, value) - */ - __pyx_v_start = (__pyx_v_self->ptr + (__pyx_v_j * __pyx_v_self->dtype->dsize)); - - /* "arrex/list.pyx":313 - * - * cdef char * start = self.ptr + j*self.dtype.dsize - * memmove(start+self.dtype.dsize, start, self.size-j*self.dtype.dsize) # <<<<<<<<<<<<<< - * self._setitem(start, value) - * self.size += self.dtype.dsize - */ - (void)(memmove((__pyx_v_start + __pyx_v_self->dtype->dsize), __pyx_v_start, (__pyx_v_self->size - (__pyx_v_j * __pyx_v_self->dtype->dsize)))); - - /* "arrex/list.pyx":314 - * cdef char * start = self.ptr + j*self.dtype.dsize - * memmove(start+self.dtype.dsize, start, self.size-j*self.dtype.dsize) - * self._setitem(start, value) # <<<<<<<<<<<<<< - * self.size += self.dtype.dsize - * - */ - __pyx_t_7 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_setitem(__pyx_v_self, __pyx_v_start, __pyx_v_value); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 314, __pyx_L1_error) - - /* "arrex/list.pyx":315 - * memmove(start+self.dtype.dsize, start, self.size-j*self.dtype.dsize) - * self._setitem(start, value) - * self.size += self.dtype.dsize # <<<<<<<<<<<<<< + * return i # <<<<<<<<<<<<<< * - * def clear(self): + * # python interface */ - __pyx_v_self->size = (__pyx_v_self->size + __pyx_v_self->dtype->dsize); + __pyx_r = __pyx_v_i; + goto __pyx_L0; - /* "arrex/list.pyx":296 - * return e - * - * def insert(self, index, value): # <<<<<<<<<<<<<< - * ''' insert(index, value) + /* "arrex/list.pyx":235 + * return self.size // self.dtype.dsize * + * cdef Py_ssize_t _index(self, index) except -1: # <<<<<<<<<<<<<< + * ''' return a C index (0 < i < l) from a python object ''' + * cdef Py_ssize_t i = index */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("arrex.list.typedlist.insert", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("arrex.list.typedlist._index", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1L; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "arrex/list.pyx":317 - * self.size += self.dtype.dsize +/* "arrex/list.pyx":246 + * # python interface + * + * def reserve(self, amount): # <<<<<<<<<<<<<< + * ''' reserve(amount: int) * - * def clear(self): # <<<<<<<<<<<<<< - * ''' remove all elements from the array but does not deallocate, very fast operation ''' - * self.size = 0 */ /* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_15clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5arrex_4list_9typedlist_14clear[] = " remove all elements from the array but does not deallocate, very fast operation "; -static PyObject *__pyx_pw_5arrex_4list_9typedlist_15clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_5arrex_4list_9typedlist_7reserve(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5arrex_4list_9typedlist_6reserve, " reserve(amount: int)\n\t\t\n\t\t\tMake sure there is enough allocated memory to append the given amount of elements. \n\t\t\n\t\t\tif there is not enough of allocated memory, the memory is reallocated immediately.\n\t\t"); +static PyMethodDef __pyx_mdef_5arrex_4list_9typedlist_7reserve = {"reserve", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9typedlist_7reserve, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_6reserve}; +static PyObject *__pyx_pw_5arrex_4list_9typedlist_7reserve(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_amount = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("clear (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_9typedlist_14clear(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self)); + __Pyx_RefNannySetupContext("reserve (wrapper)", 0); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_amount,0}; + PyObject* values[1] = {0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_amount)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 246, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "reserve") < 0)) __PYX_ERR(0, 246, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_amount = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("reserve", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 246, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("arrex.list.typedlist.reserve", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5arrex_4list_9typedlist_6reserve(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), __pyx_v_amount); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5arrex_4list_9typedlist_14clear(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self) { +static PyObject *__pyx_pf_5arrex_4list_9typedlist_6reserve(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_amount) { + size_t __pyx_v_asked; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("clear", 0); + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + size_t __pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("reserve", 0); - /* "arrex/list.pyx":319 - * def clear(self): - * ''' remove all elements from the array but does not deallocate, very fast operation ''' - * self.size = 0 # <<<<<<<<<<<<<< + /* "arrex/list.pyx":253 + * if there is not enough of allocated memory, the memory is reallocated immediately. + * ''' + * if amount < 0: # <<<<<<<<<<<<<< + * raise ValueError('amount must be positive') + * cdef size_t asked = self.size + (amount) * self.dtype.dsize + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_amount, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 253, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(__pyx_t_2)) { + + /* "arrex/list.pyx":254 + * ''' + * if amount < 0: + * raise ValueError('amount must be positive') # <<<<<<<<<<<<<< + * cdef size_t asked = self.size + (amount) * self.dtype.dsize + * if asked > self.allocated: + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 254, __pyx_L1_error) + + /* "arrex/list.pyx":253 + * if there is not enough of allocated memory, the memory is reallocated immediately. + * ''' + * if amount < 0: # <<<<<<<<<<<<<< + * raise ValueError('amount must be positive') + * cdef size_t asked = self.size + (amount) * self.dtype.dsize + */ + } + + /* "arrex/list.pyx":255 + * if amount < 0: + * raise ValueError('amount must be positive') + * cdef size_t asked = self.size + (amount) * self.dtype.dsize # <<<<<<<<<<<<<< + * if asked > self.allocated: + * self._reallocate(asked) + */ + __pyx_t_3 = __Pyx_PyInt_As_size_t(__pyx_v_amount); if (unlikely((__pyx_t_3 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 255, __pyx_L1_error) + __pyx_v_asked = (__pyx_v_self->size + (((size_t)__pyx_t_3) * __pyx_v_self->dtype->dsize)); + + /* "arrex/list.pyx":256 + * raise ValueError('amount must be positive') + * cdef size_t asked = self.size + (amount) * self.dtype.dsize + * if asked > self.allocated: # <<<<<<<<<<<<<< + * self._reallocate(asked) * - * cpdef int extend(self, other) except *: */ - __pyx_v_self->size = 0; + __pyx_t_2 = (__pyx_v_asked > __pyx_v_self->allocated); + if (__pyx_t_2) { - /* "arrex/list.pyx":317 - * self.size += self.dtype.dsize + /* "arrex/list.pyx":257 + * cdef size_t asked = self.size + (amount) * self.dtype.dsize + * if asked > self.allocated: + * self._reallocate(asked) # <<<<<<<<<<<<<< + * + * cpdef int append(self, value) except -1: + */ + __pyx_t_4 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_reallocate(__pyx_v_self, __pyx_v_asked); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 257, __pyx_L1_error) + + /* "arrex/list.pyx":256 + * raise ValueError('amount must be positive') + * cdef size_t asked = self.size + (amount) * self.dtype.dsize + * if asked > self.allocated: # <<<<<<<<<<<<<< + * self._reallocate(asked) + * + */ + } + + /* "arrex/list.pyx":246 + * # python interface + * + * def reserve(self, amount): # <<<<<<<<<<<<<< + * ''' reserve(amount: int) * - * def clear(self): # <<<<<<<<<<<<<< - * ''' remove all elements from the array but does not deallocate, very fast operation ''' - * self.size = 0 */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("arrex.list.typedlist.reserve", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "arrex/list.pyx":321 - * self.size = 0 +/* "arrex/list.pyx":259 + * self._reallocate(asked) * - * cpdef int extend(self, other) except *: # <<<<<<<<<<<<<< - * ''' extend(iterable) + * cpdef int append(self, value) except -1: # <<<<<<<<<<<<<< + * ''' append(value) * */ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_17extend(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static int __pyx_f_5arrex_4list_9typedlist_extend(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_skip_dispatch) { - Py_buffer __pyx_v_view; - Py_ssize_t __pyx_v_l; - PyObject *__pyx_v_o = NULL; +static PyObject *__pyx_pw_5arrex_4list_9typedlist_9append(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static int __pyx_f_5arrex_4list_9typedlist_append(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_value, int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4358,27 +6465,30 @@ static int __pyx_f_5arrex_4list_9typedlist_extend(struct __pyx_obj_5arrex_4list_ int __pyx_t_6; size_t __pyx_t_7; size_t __pyx_t_8; - size_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - PyObject *(*__pyx_t_11)(PyObject *); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("extend", 0); + __Pyx_RefNannySetupContext("append", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ - else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { - PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_extend); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 321, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_append); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_5arrex_4list_9typedlist_17extend)) { + #ifdef __Pyx_CyFunction_USED + if (!__Pyx_IsCyOrPyCFunction(__pyx_t_1) + #else + if (!PyCFunction_Check(__pyx_t_1) + #endif + || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_5arrex_4list_9typedlist_9append)) { __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + __pyx_t_5 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { @@ -4386,14 +6496,18 @@ static int __pyx_f_5arrex_4list_9typedlist_extend(struct __pyx_obj_5arrex_4list_ __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; } } - __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_other) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_other); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 321, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 321, __pyx_L1_error) + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_value}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 259, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 259, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -4402,7 +6516,7 @@ static int __pyx_f_5arrex_4list_9typedlist_extend(struct __pyx_obj_5arrex_4list_ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); - if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) { __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; } #endif @@ -4412,251 +6526,65 @@ static int __pyx_f_5arrex_4list_9typedlist_extend(struct __pyx_obj_5arrex_4list_ #endif } - /* "arrex/list.pyx":329 - * cdef Py_ssize_t l - * - * if PyObject_CheckBuffer(other): # <<<<<<<<<<<<<< - * PyObject_GetBuffer(other, &view, PyBUF_SIMPLE) + /* "arrex/list.pyx":266 + * if there is not enough allocated memory, reallocate enough to amortize the realocation time over the multiple appends + * ''' + * if self.allocated < self.size + self.dtype.dsize: # <<<<<<<<<<<<<< + * self._reallocate(self.allocated*2 or self.dtype.dsize) * */ - __pyx_t_6 = (PyObject_CheckBuffer(__pyx_v_other) != 0); + __pyx_t_6 = (__pyx_v_self->allocated < (__pyx_v_self->size + __pyx_v_self->dtype->dsize)); if (__pyx_t_6) { - /* "arrex/list.pyx":330 - * - * if PyObject_CheckBuffer(other): - * PyObject_GetBuffer(other, &view, PyBUF_SIMPLE) # <<<<<<<<<<<<<< + /* "arrex/list.pyx":267 + * ''' + * if self.allocated < self.size + self.dtype.dsize: + * self._reallocate(self.allocated*2 or self.dtype.dsize) # <<<<<<<<<<<<<< * - * if view.len % self.dtype.dsize: + * self._setitem(self.ptr + self.size, value) */ - __pyx_t_5 = PyObject_GetBuffer(__pyx_v_other, (&__pyx_v_view), PyBUF_SIMPLE); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 330, __pyx_L1_error) + __pyx_t_8 = (__pyx_v_self->allocated * 2); + if (!__pyx_t_8) { + } else { + __pyx_t_7 = __pyx_t_8; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_7 = __pyx_v_self->dtype->dsize; + __pyx_L4_bool_binop_done:; + __pyx_t_5 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_reallocate(__pyx_v_self, __pyx_t_7); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 267, __pyx_L1_error) - /* "arrex/list.pyx":332 - * PyObject_GetBuffer(other, &view, PyBUF_SIMPLE) + /* "arrex/list.pyx":266 + * if there is not enough allocated memory, reallocate enough to amortize the realocation time over the multiple appends + * ''' + * if self.allocated < self.size + self.dtype.dsize: # <<<<<<<<<<<<<< + * self._reallocate(self.allocated*2 or self.dtype.dsize) * - * if view.len % self.dtype.dsize: # <<<<<<<<<<<<<< - * PyBuffer_Release(&view) - * raise TypeError('the given buffer must have a byte size multiple of dtype size') */ - __pyx_t_6 = ((__pyx_v_view.len % __pyx_v_self->dtype->dsize) != 0); - if (unlikely(__pyx_t_6)) { + } - /* "arrex/list.pyx":333 + /* "arrex/list.pyx":269 + * self._reallocate(self.allocated*2 or self.dtype.dsize) * - * if view.len % self.dtype.dsize: - * PyBuffer_Release(&view) # <<<<<<<<<<<<<< - * raise TypeError('the given buffer must have a byte size multiple of dtype size') + * self._setitem(self.ptr + self.size, value) # <<<<<<<<<<<<<< + * self.size += self.dtype.dsize * */ - PyBuffer_Release((&__pyx_v_view)); + __pyx_t_5 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_setitem(__pyx_v_self, (__pyx_v_self->ptr + __pyx_v_self->size), __pyx_v_value); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 269, __pyx_L1_error) - /* "arrex/list.pyx":334 - * if view.len % self.dtype.dsize: - * PyBuffer_Release(&view) - * raise TypeError('the given buffer must have a byte size multiple of dtype size') # <<<<<<<<<<<<<< + /* "arrex/list.pyx":270 * - * if view.len > self.allocated - self.size: - */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 334, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 334, __pyx_L1_error) - - /* "arrex/list.pyx":332 - * PyObject_GetBuffer(other, &view, PyBUF_SIMPLE) + * self._setitem(self.ptr + self.size, value) + * self.size += self.dtype.dsize # <<<<<<<<<<<<<< * - * if view.len % self.dtype.dsize: # <<<<<<<<<<<<<< - * PyBuffer_Release(&view) - * raise TypeError('the given buffer must have a byte size multiple of dtype size') + * def pop(self, index=None): */ - } + __pyx_v_self->size = (__pyx_v_self->size + __pyx_v_self->dtype->dsize); - /* "arrex/list.pyx":336 - * raise TypeError('the given buffer must have a byte size multiple of dtype size') - * - * if view.len > self.allocated - self.size: # <<<<<<<<<<<<<< - * self._reallocate(max(2*self.size, self.size + view.len)) - * memcpy(self.ptr+self.size, view.buf, view.len) - */ - __pyx_t_6 = ((((size_t)__pyx_v_view.len) > (__pyx_v_self->allocated - __pyx_v_self->size)) != 0); - if (__pyx_t_6) { - - /* "arrex/list.pyx":337 - * - * if view.len > self.allocated - self.size: - * self._reallocate(max(2*self.size, self.size + view.len)) # <<<<<<<<<<<<<< - * memcpy(self.ptr+self.size, view.buf, view.len) - * self.size += view.len - */ - __pyx_t_7 = (__pyx_v_self->size + __pyx_v_view.len); - __pyx_t_8 = (2 * __pyx_v_self->size); - if (((__pyx_t_7 > __pyx_t_8) != 0)) { - __pyx_t_9 = __pyx_t_7; - } else { - __pyx_t_9 = __pyx_t_8; - } - __pyx_t_5 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_reallocate(__pyx_v_self, __pyx_t_9); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 337, __pyx_L1_error) - - /* "arrex/list.pyx":336 - * raise TypeError('the given buffer must have a byte size multiple of dtype size') - * - * if view.len > self.allocated - self.size: # <<<<<<<<<<<<<< - * self._reallocate(max(2*self.size, self.size + view.len)) - * memcpy(self.ptr+self.size, view.buf, view.len) - */ - } - - /* "arrex/list.pyx":338 - * if view.len > self.allocated - self.size: - * self._reallocate(max(2*self.size, self.size + view.len)) - * memcpy(self.ptr+self.size, view.buf, view.len) # <<<<<<<<<<<<<< - * self.size += view.len - * - */ - (void)(memcpy((__pyx_v_self->ptr + __pyx_v_self->size), __pyx_v_view.buf, __pyx_v_view.len)); - - /* "arrex/list.pyx":339 - * self._reallocate(max(2*self.size, self.size + view.len)) - * memcpy(self.ptr+self.size, view.buf, view.len) - * self.size += view.len # <<<<<<<<<<<<<< - * - * PyBuffer_Release(&view) - */ - __pyx_v_self->size = (__pyx_v_self->size + __pyx_v_view.len); - - /* "arrex/list.pyx":341 - * self.size += view.len - * - * PyBuffer_Release(&view) # <<<<<<<<<<<<<< - * - * else: - */ - PyBuffer_Release((&__pyx_v_view)); - - /* "arrex/list.pyx":329 - * cdef Py_ssize_t l - * - * if PyObject_CheckBuffer(other): # <<<<<<<<<<<<<< - * PyObject_GetBuffer(other, &view, PyBUF_SIMPLE) - * - */ - goto __pyx_L3; - } - - /* "arrex/list.pyx":344 - * - * else: - * l = PyObject_LengthHint(other, 0) # <<<<<<<<<<<<<< - * if l*self.dtype.dsize > self.allocated - self.size: - * self._reallocate(self.size + l*self.dtype.dsize) - */ - /*else*/ { - __pyx_v_l = PyObject_LengthHint(__pyx_v_other, 0); - - /* "arrex/list.pyx":345 - * else: - * l = PyObject_LengthHint(other, 0) - * if l*self.dtype.dsize > self.allocated - self.size: # <<<<<<<<<<<<<< - * self._reallocate(self.size + l*self.dtype.dsize) - * for o in other: - */ - __pyx_t_6 = (((__pyx_v_l * __pyx_v_self->dtype->dsize) > (__pyx_v_self->allocated - __pyx_v_self->size)) != 0); - if (__pyx_t_6) { - - /* "arrex/list.pyx":346 - * l = PyObject_LengthHint(other, 0) - * if l*self.dtype.dsize > self.allocated - self.size: - * self._reallocate(self.size + l*self.dtype.dsize) # <<<<<<<<<<<<<< - * for o in other: - * self.append(o) - */ - __pyx_t_5 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_reallocate(__pyx_v_self, (__pyx_v_self->size + (__pyx_v_l * __pyx_v_self->dtype->dsize))); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 346, __pyx_L1_error) - - /* "arrex/list.pyx":345 - * else: - * l = PyObject_LengthHint(other, 0) - * if l*self.dtype.dsize > self.allocated - self.size: # <<<<<<<<<<<<<< - * self._reallocate(self.size + l*self.dtype.dsize) - * for o in other: - */ - } - - /* "arrex/list.pyx":347 - * if l*self.dtype.dsize > self.allocated - self.size: - * self._reallocate(self.size + l*self.dtype.dsize) - * for o in other: # <<<<<<<<<<<<<< - * self.append(o) - * - */ - if (likely(PyList_CheckExact(__pyx_v_other)) || PyTuple_CheckExact(__pyx_v_other)) { - __pyx_t_1 = __pyx_v_other; __Pyx_INCREF(__pyx_t_1); __pyx_t_10 = 0; - __pyx_t_11 = NULL; - } else { - __pyx_t_10 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_other); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 347, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_11 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 347, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_11)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_10); __Pyx_INCREF(__pyx_t_2); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 347, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 347, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } else { - if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_10); __Pyx_INCREF(__pyx_t_2); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 347, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 347, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } - } else { - __pyx_t_2 = __pyx_t_11(__pyx_t_1); - if (unlikely(!__pyx_t_2)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 347, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_XDECREF_SET(__pyx_v_o, __pyx_t_2); - __pyx_t_2 = 0; - - /* "arrex/list.pyx":348 - * self._reallocate(self.size + l*self.dtype.dsize) - * for o in other: - * self.append(o) # <<<<<<<<<<<<<< - * - * def __iadd__(self, other): - */ - __pyx_t_5 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->append(__pyx_v_self, __pyx_v_o, 0); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 348, __pyx_L1_error) - - /* "arrex/list.pyx":347 - * if l*self.dtype.dsize > self.allocated - self.size: - * self._reallocate(self.size + l*self.dtype.dsize) - * for o in other: # <<<<<<<<<<<<<< - * self.append(o) - * - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __pyx_L3:; - - /* "arrex/list.pyx":321 - * self.size = 0 - * - * cpdef int extend(self, other) except *: # <<<<<<<<<<<<<< - * ''' extend(iterable) + /* "arrex/list.pyx":259 + * self._reallocate(asked) + * + * cpdef int append(self, value) except -1: # <<<<<<<<<<<<<< + * ''' append(value) * */ @@ -4668,29 +6596,86 @@ static int __pyx_f_5arrex_4list_9typedlist_extend(struct __pyx_obj_5arrex_4list_ __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("arrex.list.typedlist.extend", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_AddTraceback("arrex.list.typedlist.append", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_o); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_17extend(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static char __pyx_doc_5arrex_4list_9typedlist_16extend[] = " extend(iterable)\n\t\t\n\t\t\tappend all elements from the other array \n\t\t"; -static PyObject *__pyx_pw_5arrex_4list_9typedlist_17extend(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { +static PyObject *__pyx_pw_5arrex_4list_9typedlist_9append(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5arrex_4list_9typedlist_8append, " append(value)\n\t\t\n\t\t\tappend the given object at the end of the array\n\t\t\n\t\t\tif there is not enough allocated memory, reallocate enough to amortize the realocation time over the multiple appends\n\t\t"); +static PyMethodDef __pyx_mdef_5arrex_4list_9typedlist_9append = {"append", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9typedlist_9append, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_8append}; +static PyObject *__pyx_pw_5arrex_4list_9typedlist_9append(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_value = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("extend (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_9typedlist_16extend(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), ((PyObject *)__pyx_v_other)); + __Pyx_RefNannySetupContext("append (wrapper)", 0); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_value,0}; + PyObject* values[1] = {0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_value)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 259, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "append") < 0)) __PYX_ERR(0, 259, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_value = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("append", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 259, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("arrex.list.typedlist.append", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5arrex_4list_9typedlist_8append(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), __pyx_v_value); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5arrex_4list_9typedlist_16extend(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_other) { +static PyObject *__pyx_pf_5arrex_4list_9typedlist_8append(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_value) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -4698,10 +6683,10 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_16extend(struct __pyx_obj_5arr int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("extend", 0); + __Pyx_RefNannySetupContext("append", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_5arrex_4list_9typedlist_extend(__pyx_v_self, __pyx_v_other, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 321, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 321, __pyx_L1_error) + __pyx_t_1 = __pyx_f_5arrex_4list_9typedlist_append(__pyx_v_self, __pyx_v_value, 1); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 259, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -4710,7 +6695,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_16extend(struct __pyx_obj_5arr /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("arrex.list.typedlist.extend", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("arrex.list.typedlist.append", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4718,563 +6703,551 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_16extend(struct __pyx_obj_5arr return __pyx_r; } -/* "arrex/list.pyx":350 - * self.append(o) +/* "arrex/list.pyx":272 + * self.size += self.dtype.dsize + * + * def pop(self, index=None): # <<<<<<<<<<<<<< + * ''' pop(index=None) -> object * - * def __iadd__(self, other): # <<<<<<<<<<<<<< - * self.extend(other) - * return self */ /* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_19__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_19__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__iadd__ (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_9typedlist_18__iadd__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), ((PyObject *)__pyx_v_other)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5arrex_4list_9typedlist_18__iadd__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_other) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__iadd__", 0); - - /* "arrex/list.pyx":351 - * - * def __iadd__(self, other): - * self.extend(other) # <<<<<<<<<<<<<< - * return self - * - */ - ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->extend(__pyx_v_self, __pyx_v_other, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 351, __pyx_L1_error) - - /* "arrex/list.pyx":352 - * def __iadd__(self, other): - * self.extend(other) - * return self # <<<<<<<<<<<<<< - * - * def __add__(typedlist self, other): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "arrex/list.pyx":350 - * self.append(o) - * - * def __iadd__(self, other): # <<<<<<<<<<<<<< - * self.extend(other) - * return self - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("arrex.list.typedlist.__iadd__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "arrex/list.pyx":354 - * return self - * - * def __add__(typedlist self, other): # <<<<<<<<<<<<<< - * ''' concatenation of two arrays ''' - * cdef typedlist result - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_21__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static char __pyx_doc_5arrex_4list_9typedlist_20__add__[] = " concatenation of two arrays "; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_5arrex_4list_9typedlist_20__add__; -#endif -static PyObject *__pyx_pw_5arrex_4list_9typedlist_21__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { +static PyObject *__pyx_pw_5arrex_4list_9typedlist_11pop(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5arrex_4list_9typedlist_10pop, " pop(index=None) -> object\n\t\t\n\t\t\tremove the element at index, returning it. If no index is specified, it will pop the last one .\n\t\t"); +static PyMethodDef __pyx_mdef_5arrex_4list_9typedlist_11pop = {"pop", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9typedlist_11pop, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_10pop}; +static PyObject *__pyx_pw_5arrex_4list_9typedlist_11pop(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_index = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__add__ (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_self), __pyx_ptype_5arrex_4list_typedlist, 1, "self", 0))) __PYX_ERR(0, 354, __pyx_L1_error) - __pyx_r = __pyx_pf_5arrex_4list_9typedlist_20__add__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), ((PyObject *)__pyx_v_other)); + __Pyx_RefNannySetupContext("pop (wrapper)", 0); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_index,0}; + PyObject* values[1] = {0}; + values[0] = ((PyObject *)Py_None); + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_index); + if (value) { values[0] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 272, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "pop") < 0)) __PYX_ERR(0, 272, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_index = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("pop", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 272, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("arrex.list.typedlist.pop", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5arrex_4list_9typedlist_10pop(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), __pyx_v_index); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5arrex_4list_9typedlist_20__add__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_other) { - struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_result = 0; - Py_buffer __pyx_v_view; +static PyObject *__pyx_pf_5arrex_4list_9typedlist_10pop(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_index) { + size_t __pyx_v_i; + char *__pyx_v_start; + PyObject *__pyx_v_e = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - size_t __pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__add__", 0); + __Pyx_RefNannySetupContext("pop", 0); - /* "arrex/list.pyx":359 - * cdef Py_buffer view + /* "arrex/list.pyx":280 + * cdef char * start * - * if PyObject_CheckBuffer(other): # <<<<<<<<<<<<<< - * PyObject_GetBuffer(other, &view, PyBUF_SIMPLE) + * if not self.size: # <<<<<<<<<<<<<< + * raise IndexError('pop from empty list') * */ - __pyx_t_1 = (PyObject_CheckBuffer(__pyx_v_other) != 0); - if (__pyx_t_1) { + __pyx_t_1 = (!(__pyx_v_self->size != 0)); + if (unlikely(__pyx_t_1)) { - /* "arrex/list.pyx":360 + /* "arrex/list.pyx":281 * - * if PyObject_CheckBuffer(other): - * PyObject_GetBuffer(other, &view, PyBUF_SIMPLE) # <<<<<<<<<<<<<< + * if not self.size: + * raise IndexError('pop from empty list') # <<<<<<<<<<<<<< * - * if view.len % self.dtype.dsize: + * if index is None: */ - __pyx_t_2 = PyObject_GetBuffer(__pyx_v_other, (&__pyx_v_view), PyBUF_SIMPLE); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 360, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 281, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 281, __pyx_L1_error) - /* "arrex/list.pyx":362 - * PyObject_GetBuffer(other, &view, PyBUF_SIMPLE) + /* "arrex/list.pyx":280 + * cdef char * start + * + * if not self.size: # <<<<<<<<<<<<<< + * raise IndexError('pop from empty list') * - * if view.len % self.dtype.dsize: # <<<<<<<<<<<<<< - * PyBuffer_Release(&view) - * raise TypeError('the given buffer must have a byte size multiple of dtype size') */ - __pyx_t_1 = ((__pyx_v_view.len % __pyx_v_self->dtype->dsize) != 0); - if (unlikely(__pyx_t_1)) { + } - /* "arrex/list.pyx":363 - * - * if view.len % self.dtype.dsize: - * PyBuffer_Release(&view) # <<<<<<<<<<<<<< - * raise TypeError('the given buffer must have a byte size multiple of dtype size') + /* "arrex/list.pyx":283 + * raise IndexError('pop from empty list') * + * if index is None: # <<<<<<<<<<<<<< + * e = self._getitem(self.ptr + self.size - self.dtype.dsize) + * self.size -= self.dtype.dsize */ - PyBuffer_Release((&__pyx_v_view)); + __pyx_t_1 = (__pyx_v_index == Py_None); + if (__pyx_t_1) { - /* "arrex/list.pyx":364 - * if view.len % self.dtype.dsize: - * PyBuffer_Release(&view) - * raise TypeError('the given buffer must have a byte size multiple of dtype size') # <<<<<<<<<<<<<< + /* "arrex/list.pyx":284 * - * result = typedlist.__new__(typedlist) + * if index is None: + * e = self._getitem(self.ptr + self.size - self.dtype.dsize) # <<<<<<<<<<<<<< + * self.size -= self.dtype.dsize + * return e */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 364, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 364, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_getitem(__pyx_v_self, ((__pyx_v_self->ptr + __pyx_v_self->size) - __pyx_v_self->dtype->dsize)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 284, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_e = __pyx_t_2; + __pyx_t_2 = 0; - /* "arrex/list.pyx":362 - * PyObject_GetBuffer(other, &view, PyBUF_SIMPLE) - * - * if view.len % self.dtype.dsize: # <<<<<<<<<<<<<< - * PyBuffer_Release(&view) - * raise TypeError('the given buffer must have a byte size multiple of dtype size') + /* "arrex/list.pyx":285 + * if index is None: + * e = self._getitem(self.ptr + self.size - self.dtype.dsize) + * self.size -= self.dtype.dsize # <<<<<<<<<<<<<< + * return e + * else: */ - } + __pyx_v_self->size = (__pyx_v_self->size - __pyx_v_self->dtype->dsize); - /* "arrex/list.pyx":366 - * raise TypeError('the given buffer must have a byte size multiple of dtype size') - * - * result = typedlist.__new__(typedlist) # <<<<<<<<<<<<<< - * result.dtype = self.dtype - * result._reallocate(self.size + view.len) + /* "arrex/list.pyx":286 + * e = self._getitem(self.ptr + self.size - self.dtype.dsize) + * self.size -= self.dtype.dsize + * return e # <<<<<<<<<<<<<< + * else: + * i = self._index(index) */ - __pyx_t_3 = ((PyObject *)__pyx_tp_new_5arrex_4list_typedlist(((PyTypeObject *)__pyx_ptype_5arrex_4list_typedlist), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 366, __pyx_L1_error) - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_v_result = ((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_t_3); - __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_e); + __pyx_r = __pyx_v_e; + goto __pyx_L0; - /* "arrex/list.pyx":367 + /* "arrex/list.pyx":283 + * raise IndexError('pop from empty list') * - * result = typedlist.__new__(typedlist) - * result.dtype = self.dtype # <<<<<<<<<<<<<< - * result._reallocate(self.size + view.len) - * memcpy(result.ptr, self.ptr, self.size) + * if index is None: # <<<<<<<<<<<<<< + * e = self._getitem(self.ptr + self.size - self.dtype.dsize) + * self.size -= self.dtype.dsize */ - __pyx_t_3 = ((PyObject *)__pyx_v_self->dtype); - __Pyx_INCREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_v_result->dtype); - __Pyx_DECREF(((PyObject *)__pyx_v_result->dtype)); - __pyx_v_result->dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_3); - __pyx_t_3 = 0; + } - /* "arrex/list.pyx":368 - * result = typedlist.__new__(typedlist) - * result.dtype = self.dtype - * result._reallocate(self.size + view.len) # <<<<<<<<<<<<<< - * memcpy(result.ptr, self.ptr, self.size) - * memcpy(result.ptr+self.size, view.buf, view.len) + /* "arrex/list.pyx":288 + * return e + * else: + * i = self._index(index) # <<<<<<<<<<<<<< + * + * start = self.ptr + i*self.dtype.dsize */ - __pyx_t_2 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_result->__pyx_vtab)->_reallocate(__pyx_v_result, (__pyx_v_self->size + __pyx_v_view.len)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 368, __pyx_L1_error) + /*else*/ { + __pyx_t_3 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_index(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1L))) __PYX_ERR(0, 288, __pyx_L1_error) + __pyx_v_i = __pyx_t_3; - /* "arrex/list.pyx":369 - * result.dtype = self.dtype - * result._reallocate(self.size + view.len) - * memcpy(result.ptr, self.ptr, self.size) # <<<<<<<<<<<<<< - * memcpy(result.ptr+self.size, view.buf, view.len) - * result.size = result.allocated + /* "arrex/list.pyx":290 + * i = self._index(index) + * + * start = self.ptr + i*self.dtype.dsize # <<<<<<<<<<<<<< + * e = self._getitem(start) + * memmove(start, start + self.dtype.dsize, self.size-(i+1)*self.dtype.dsize) */ - (void)(memcpy(__pyx_v_result->ptr, __pyx_v_self->ptr, __pyx_v_self->size)); + __pyx_v_start = (__pyx_v_self->ptr + (__pyx_v_i * __pyx_v_self->dtype->dsize)); - /* "arrex/list.pyx":370 - * result._reallocate(self.size + view.len) - * memcpy(result.ptr, self.ptr, self.size) - * memcpy(result.ptr+self.size, view.buf, view.len) # <<<<<<<<<<<<<< - * result.size = result.allocated - * - */ - (void)(memcpy((__pyx_v_result->ptr + __pyx_v_self->size), __pyx_v_view.buf, __pyx_v_view.len)); - - /* "arrex/list.pyx":371 - * memcpy(result.ptr, self.ptr, self.size) - * memcpy(result.ptr+self.size, view.buf, view.len) - * result.size = result.allocated # <<<<<<<<<<<<<< - * - * PyBuffer_Release(&view) - */ - __pyx_t_4 = __pyx_v_result->allocated; - __pyx_v_result->size = __pyx_t_4; - - /* "arrex/list.pyx":373 - * result.size = result.allocated - * - * PyBuffer_Release(&view) # <<<<<<<<<<<<<< - * return result - * - */ - PyBuffer_Release((&__pyx_v_view)); - - /* "arrex/list.pyx":374 - * - * PyBuffer_Release(&view) - * return result # <<<<<<<<<<<<<< - * - * elif hasattr(other, '__iter__'): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = ((PyObject *)__pyx_v_result); - goto __pyx_L0; - - /* "arrex/list.pyx":359 - * cdef Py_buffer view - * - * if PyObject_CheckBuffer(other): # <<<<<<<<<<<<<< - * PyObject_GetBuffer(other, &view, PyBUF_SIMPLE) - * - */ - } - - /* "arrex/list.pyx":376 - * return result - * - * elif hasattr(other, '__iter__'): # <<<<<<<<<<<<<< - * result = typedlist(None, self.dtype) - * result.extend(self) - */ - __pyx_t_1 = __Pyx_HasAttr(__pyx_v_other, __pyx_n_u_iter); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 376, __pyx_L1_error) - __pyx_t_5 = (__pyx_t_1 != 0); - if (__pyx_t_5) { - - /* "arrex/list.pyx":377 + /* "arrex/list.pyx":291 * - * elif hasattr(other, '__iter__'): - * result = typedlist(None, self.dtype) # <<<<<<<<<<<<<< - * result.extend(self) - * result.extend(other) + * start = self.ptr + i*self.dtype.dsize + * e = self._getitem(start) # <<<<<<<<<<<<<< + * memmove(start, start + self.dtype.dsize, self.size-(i+1)*self.dtype.dsize) + * self.size -= self.dtype.dsize */ - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 377, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None); - __Pyx_INCREF(((PyObject *)__pyx_v_self->dtype)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self->dtype)); - PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self->dtype)); - __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5arrex_4list_typedlist), __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 377, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result = ((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_t_6); - __pyx_t_6 = 0; + __pyx_t_2 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_getitem(__pyx_v_self, __pyx_v_start); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 291, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_e = __pyx_t_2; + __pyx_t_2 = 0; - /* "arrex/list.pyx":378 - * elif hasattr(other, '__iter__'): - * result = typedlist(None, self.dtype) - * result.extend(self) # <<<<<<<<<<<<<< - * result.extend(other) - * return result + /* "arrex/list.pyx":292 + * start = self.ptr + i*self.dtype.dsize + * e = self._getitem(start) + * memmove(start, start + self.dtype.dsize, self.size-(i+1)*self.dtype.dsize) # <<<<<<<<<<<<<< + * self.size -= self.dtype.dsize + * return e */ - ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_result->__pyx_vtab)->extend(__pyx_v_result, ((PyObject *)__pyx_v_self), 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 378, __pyx_L1_error) + (void)(memmove(__pyx_v_start, (__pyx_v_start + __pyx_v_self->dtype->dsize), (__pyx_v_self->size - ((__pyx_v_i + 1) * __pyx_v_self->dtype->dsize)))); - /* "arrex/list.pyx":379 - * result = typedlist(None, self.dtype) - * result.extend(self) - * result.extend(other) # <<<<<<<<<<<<<< - * return result + /* "arrex/list.pyx":293 + * e = self._getitem(start) + * memmove(start, start + self.dtype.dsize, self.size-(i+1)*self.dtype.dsize) + * self.size -= self.dtype.dsize # <<<<<<<<<<<<<< + * return e * */ - ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_result->__pyx_vtab)->extend(__pyx_v_result, __pyx_v_other, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 379, __pyx_L1_error) + __pyx_v_self->size = (__pyx_v_self->size - __pyx_v_self->dtype->dsize); - /* "arrex/list.pyx":380 - * result.extend(self) - * result.extend(other) - * return result # <<<<<<<<<<<<<< + /* "arrex/list.pyx":294 + * memmove(start, start + self.dtype.dsize, self.size-(i+1)*self.dtype.dsize) + * self.size -= self.dtype.dsize + * return e # <<<<<<<<<<<<<< * - * else: + * def insert(self, index, value): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = ((PyObject *)__pyx_v_result); + __Pyx_INCREF(__pyx_v_e); + __pyx_r = __pyx_v_e; goto __pyx_L0; - - /* "arrex/list.pyx":376 - * return result - * - * elif hasattr(other, '__iter__'): # <<<<<<<<<<<<<< - * result = typedlist(None, self.dtype) - * result.extend(self) - */ } - /* "arrex/list.pyx":383 - * - * else: - * return NotImplemented # <<<<<<<<<<<<<< + /* "arrex/list.pyx":272 + * self.size += self.dtype.dsize * - * def __mul__(self, n): - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_builtin_NotImplemented); - __pyx_r = __pyx_builtin_NotImplemented; - goto __pyx_L0; - } - - /* "arrex/list.pyx":354 - * return self + * def pop(self, index=None): # <<<<<<<<<<<<<< + * ''' pop(index=None) -> object * - * def __add__(typedlist self, other): # <<<<<<<<<<<<<< - * ''' concatenation of two arrays ''' - * cdef typedlist result */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("arrex.list.typedlist.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("arrex.list.typedlist.pop", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XDECREF(__pyx_v_e); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "arrex/list.pyx":385 - * return NotImplemented +/* "arrex/list.pyx":296 + * return e + * + * def insert(self, index, value): # <<<<<<<<<<<<<< + * ''' insert(index, value) * - * def __mul__(self, n): # <<<<<<<<<<<<<< - * ''' duplicate the sequence by a certain number ''' - * #if isinstance(n, int): */ /* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_23__mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_n); /*proto*/ -static char __pyx_doc_5arrex_4list_9typedlist_22__mul__[] = " duplicate the sequence by a certain number "; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_5arrex_4list_9typedlist_22__mul__; +static PyObject *__pyx_pw_5arrex_4list_9typedlist_13insert(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds #endif -static PyObject *__pyx_pw_5arrex_4list_9typedlist_23__mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_n) { +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5arrex_4list_9typedlist_12insert, " insert(index, value)\n\t\t\n\t\t\tinsert value at index \n\t\t"); +static PyMethodDef __pyx_mdef_5arrex_4list_9typedlist_13insert = {"insert", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9typedlist_13insert, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_12insert}; +static PyObject *__pyx_pw_5arrex_4list_9typedlist_13insert(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_index = 0; + PyObject *__pyx_v_value = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__mul__ (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_9typedlist_22__mul__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_n)); + __Pyx_RefNannySetupContext("insert (wrapper)", 0); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_index,&__pyx_n_s_value,0}; + PyObject* values[2] = {0,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_index)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 296, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_value)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 296, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("insert", 1, 2, 2, 1); __PYX_ERR(0, 296, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "insert") < 0)) __PYX_ERR(0, 296, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + } + __pyx_v_index = values[0]; + __pyx_v_value = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("insert", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 296, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("arrex.list.typedlist.insert", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5arrex_4list_9typedlist_12insert(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), __pyx_v_index, __pyx_v_value); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5arrex_4list_9typedlist_22__mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_n) { +static PyObject *__pyx_pf_5arrex_4list_9typedlist_12insert(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_l; + size_t __pyx_v_j; + char *__pyx_v_start; 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; + Py_ssize_t __pyx_t_1; + size_t __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + int __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__mul__", 0); + __Pyx_RefNannySetupContext("insert", 0); - /* "arrex/list.pyx":388 - * ''' duplicate the sequence by a certain number ''' - * #if isinstance(n, int): - * if PyNumber_Check(n): # <<<<<<<<<<<<<< - * return typedlist(bytes(self)*n, dtype=self.dtype) - * else: + /* "arrex/list.pyx":302 + * ''' + * + * cdef Py_ssize_t i = index # <<<<<<<<<<<<<< + * cdef Py_ssize_t l = self._len() + * if i < 0: i += l */ - __pyx_t_1 = (PyNumber_Check(__pyx_v_n) != 0); - if (__pyx_t_1) { + __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 302, __pyx_L1_error) + __pyx_v_i = __pyx_t_1; - /* "arrex/list.pyx":389 - * #if isinstance(n, int): - * if PyNumber_Check(n): - * return typedlist(bytes(self)*n, dtype=self.dtype) # <<<<<<<<<<<<<< - * else: - * return NotImplemented + /* "arrex/list.pyx":303 + * + * cdef Py_ssize_t i = index + * cdef Py_ssize_t l = self._len() # <<<<<<<<<<<<<< + * if i < 0: i += l + * if i < 0 or i > l: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 389, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_v_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 389, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 389, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 389, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 389, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 389, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5arrex_4list_typedlist), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 389, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; + __pyx_t_2 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_len(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 303, __pyx_L1_error) + __pyx_v_l = __pyx_t_2; - /* "arrex/list.pyx":388 - * ''' duplicate the sequence by a certain number ''' - * #if isinstance(n, int): - * if PyNumber_Check(n): # <<<<<<<<<<<<<< - * return typedlist(bytes(self)*n, dtype=self.dtype) - * else: + /* "arrex/list.pyx":304 + * cdef Py_ssize_t i = index + * cdef Py_ssize_t l = self._len() + * if i < 0: i += l # <<<<<<<<<<<<<< + * if i < 0 or i > l: + * raise IndexError('index out of range') */ + __pyx_t_3 = (__pyx_v_i < 0); + if (__pyx_t_3) { + __pyx_v_i = (__pyx_v_i + __pyx_v_l); } - /* "arrex/list.pyx":391 - * return typedlist(bytes(self)*n, dtype=self.dtype) - * else: - * return NotImplemented # <<<<<<<<<<<<<< + /* "arrex/list.pyx":305 + * cdef Py_ssize_t l = self._len() + * if i < 0: i += l + * if i < 0 or i > l: # <<<<<<<<<<<<<< + * raise IndexError('index out of range') + * cdef size_t j = i + */ + __pyx_t_4 = (__pyx_v_i < 0); + if (!__pyx_t_4) { + } else { + __pyx_t_3 = __pyx_t_4; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_4 = (__pyx_v_i > __pyx_v_l); + __pyx_t_3 = __pyx_t_4; + __pyx_L5_bool_binop_done:; + if (unlikely(__pyx_t_3)) { + + /* "arrex/list.pyx":306 + * if i < 0: i += l + * if i < 0 or i > l: + * raise IndexError('index out of range') # <<<<<<<<<<<<<< + * cdef size_t j = i * - * def capacity(self): */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_builtin_NotImplemented); - __pyx_r = __pyx_builtin_NotImplemented; - goto __pyx_L0; + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 306, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __PYX_ERR(0, 306, __pyx_L1_error) + + /* "arrex/list.pyx":305 + * cdef Py_ssize_t l = self._len() + * if i < 0: i += l + * if i < 0 or i > l: # <<<<<<<<<<<<<< + * raise IndexError('index out of range') + * cdef size_t j = i + */ } - /* "arrex/list.pyx":385 - * return NotImplemented + /* "arrex/list.pyx":307 + * if i < 0 or i > l: + * raise IndexError('index out of range') + * cdef size_t j = i # <<<<<<<<<<<<<< * - * def __mul__(self, n): # <<<<<<<<<<<<<< - * ''' duplicate the sequence by a certain number ''' - * #if isinstance(n, int): + * if self.allocated - self.size < self.dtype.dsize: */ + __pyx_v_j = __pyx_v_i; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("arrex.list.typedlist.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "arrex/list.pyx":309 + * cdef size_t j = i + * + * if self.allocated - self.size < self.dtype.dsize: # <<<<<<<<<<<<<< + * self._reallocate(self.allocated*2 or self.dtype.dsize) + * + */ + __pyx_t_3 = ((__pyx_v_self->allocated - __pyx_v_self->size) < __pyx_v_self->dtype->dsize); + if (__pyx_t_3) { -/* "arrex/list.pyx":393 - * return NotImplemented + /* "arrex/list.pyx":310 * - * def capacity(self): # <<<<<<<<<<<<<< - * ''' capacity() + * if self.allocated - self.size < self.dtype.dsize: + * self._reallocate(self.allocated*2 or self.dtype.dsize) # <<<<<<<<<<<<<< * + * cdef char * start = self.ptr + j*self.dtype.dsize */ + __pyx_t_6 = (__pyx_v_self->allocated * 2); + if (!__pyx_t_6) { + } else { + __pyx_t_2 = __pyx_t_6; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_2 = __pyx_v_self->dtype->dsize; + __pyx_L8_bool_binop_done:; + __pyx_t_7 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_reallocate(__pyx_v_self, __pyx_t_2); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 310, __pyx_L1_error) -/* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_25capacity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5arrex_4list_9typedlist_24capacity[] = " capacity()\n\t\t\n\t\t\treturn the total number of elements that can be stored with the current allocated memory \n\t\t"; -static PyObject *__pyx_pw_5arrex_4list_9typedlist_25capacity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("capacity (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_9typedlist_24capacity(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self)); + /* "arrex/list.pyx":309 + * cdef size_t j = i + * + * if self.allocated - self.size < self.dtype.dsize: # <<<<<<<<<<<<<< + * self._reallocate(self.allocated*2 or self.dtype.dsize) + * + */ + } - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "arrex/list.pyx":312 + * self._reallocate(self.allocated*2 or self.dtype.dsize) + * + * cdef char * start = self.ptr + j*self.dtype.dsize # <<<<<<<<<<<<<< + * memmove(start+self.dtype.dsize, start, self.size-j*self.dtype.dsize) + * self._setitem(start, value) + */ + __pyx_v_start = (__pyx_v_self->ptr + (__pyx_v_j * __pyx_v_self->dtype->dsize)); -static PyObject *__pyx_pf_5arrex_4list_9typedlist_24capacity(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self) { - 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("capacity", 0); + /* "arrex/list.pyx":313 + * + * cdef char * start = self.ptr + j*self.dtype.dsize + * memmove(start+self.dtype.dsize, start, self.size-j*self.dtype.dsize) # <<<<<<<<<<<<<< + * self._setitem(start, value) + * self.size += self.dtype.dsize + */ + (void)(memmove((__pyx_v_start + __pyx_v_self->dtype->dsize), __pyx_v_start, (__pyx_v_self->size - (__pyx_v_j * __pyx_v_self->dtype->dsize)))); - /* "arrex/list.pyx":398 - * return the total number of elements that can be stored with the current allocated memory - * ''' - * return self.allocated // self.dtype.dsize # <<<<<<<<<<<<<< + /* "arrex/list.pyx":314 + * cdef char * start = self.ptr + j*self.dtype.dsize + * memmove(start+self.dtype.dsize, start, self.size-j*self.dtype.dsize) + * self._setitem(start, value) # <<<<<<<<<<<<<< + * self.size += self.dtype.dsize * - * def shrink(self): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_FromSize_t((__pyx_v_self->allocated / __pyx_v_self->dtype->dsize)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 398, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_t_7 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_setitem(__pyx_v_self, __pyx_v_start, __pyx_v_value); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 314, __pyx_L1_error) - /* "arrex/list.pyx":393 - * return NotImplemented + /* "arrex/list.pyx":315 + * memmove(start+self.dtype.dsize, start, self.size-j*self.dtype.dsize) + * self._setitem(start, value) + * self.size += self.dtype.dsize # <<<<<<<<<<<<<< * - * def capacity(self): # <<<<<<<<<<<<<< - * ''' capacity() + * def clear(self): + */ + __pyx_v_self->size = (__pyx_v_self->size + __pyx_v_self->dtype->dsize); + + /* "arrex/list.pyx":296 + * return e + * + * def insert(self, index, value): # <<<<<<<<<<<<<< + * ''' insert(index, value) * */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("arrex.list.typedlist.capacity", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("arrex.list.typedlist.insert", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5282,1031 +7255,1364 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_24capacity(struct __pyx_obj_5a return __pyx_r; } -/* "arrex/list.pyx":400 - * return self.allocated // self.dtype.dsize - * - * def shrink(self): # <<<<<<<<<<<<<< - * ''' shrink() +/* "arrex/list.pyx":317 + * self.size += self.dtype.dsize * + * def clear(self): # <<<<<<<<<<<<<< + * ''' remove all elements from the array but does not deallocate, very fast operation ''' + * self.size = 0 */ /* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_27shrink(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5arrex_4list_9typedlist_26shrink[] = " shrink()\n\t\t\n\t\t\treallocate the array to have allocated the exact current size of the array \n\t\t"; -static PyObject *__pyx_pw_5arrex_4list_9typedlist_27shrink(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_5arrex_4list_9typedlist_15clear(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5arrex_4list_9typedlist_14clear, " remove all elements from the array but does not deallocate, very fast operation "); +static PyMethodDef __pyx_mdef_5arrex_4list_9typedlist_15clear = {"clear", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9typedlist_15clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_14clear}; +static PyObject *__pyx_pw_5arrex_4list_9typedlist_15clear(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("shrink (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_9typedlist_26shrink(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self)); + __Pyx_RefNannySetupContext("clear (wrapper)", 0); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("clear", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "clear", 0))) return NULL; + __pyx_r = __pyx_pf_5arrex_4list_9typedlist_14clear(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5arrex_4list_9typedlist_26shrink(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self) { +static PyObject *__pyx_pf_5arrex_4list_9typedlist_14clear(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("shrink", 0); + __Pyx_RefNannySetupContext("clear", 0); - /* "arrex/list.pyx":405 - * reallocate the array to have allocated the exact current size of the array - * ''' - * self._reallocate(self.size) # <<<<<<<<<<<<<< + /* "arrex/list.pyx":319 + * def clear(self): + * ''' remove all elements from the array but does not deallocate, very fast operation ''' + * self.size = 0 # <<<<<<<<<<<<<< * - * def __len__(self): + * cpdef int extend(self, other) except *: */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_reallocate(__pyx_v_self, __pyx_v_self->size); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 405, __pyx_L1_error) + __pyx_v_self->size = 0; - /* "arrex/list.pyx":400 - * return self.allocated // self.dtype.dsize - * - * def shrink(self): # <<<<<<<<<<<<<< - * ''' shrink() + /* "arrex/list.pyx":317 + * self.size += self.dtype.dsize * + * def clear(self): # <<<<<<<<<<<<<< + * ''' remove all elements from the array but does not deallocate, very fast operation ''' + * self.size = 0 */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("arrex.list.typedlist.shrink", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "arrex/list.pyx":407 - * self._reallocate(self.size) +/* "arrex/list.pyx":321 + * self.size = 0 * - * def __len__(self): # <<<<<<<<<<<<<< - * ''' return the current amount of elements inserted ''' - * return self._len() - */ - -/* Python wrapper */ -static Py_ssize_t __pyx_pw_5arrex_4list_9typedlist_29__len__(PyObject *__pyx_v_self); /*proto*/ -static char __pyx_doc_5arrex_4list_9typedlist_28__len__[] = " return the current amount of elements inserted "; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_5arrex_4list_9typedlist_28__len__; -#endif -static Py_ssize_t __pyx_pw_5arrex_4list_9typedlist_29__len__(PyObject *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_9typedlist_28__len__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static Py_ssize_t __pyx_pf_5arrex_4list_9typedlist_28__len__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__", 0); - - /* "arrex/list.pyx":409 - * def __len__(self): - * ''' return the current amount of elements inserted ''' - * return self._len() # <<<<<<<<<<<<<< - * - * def __getitem__(self, index): - */ - __pyx_r = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_len(__pyx_v_self); - goto __pyx_L0; - - /* "arrex/list.pyx":407 - * self._reallocate(self.size) - * - * def __len__(self): # <<<<<<<<<<<<<< - * ''' return the current amount of elements inserted ''' - * return self._len() - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "arrex/list.pyx":411 - * return self._len() - * - * def __getitem__(self, index): # <<<<<<<<<<<<<< - * ''' self[index] + * cpdef int extend(self, other) except *: # <<<<<<<<<<<<<< + * ''' extend(iterable) * */ -/* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_31__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ -static char __pyx_doc_5arrex_4list_9typedlist_30__getitem__[] = " self[index]\n\t\t\n\t\t\tcurrently supports:\n\t\t\t\n\t\t\t\t- indices\n\t\t\t\t- negative indices\n\t\t\t\t- slices with step=1\n\t\t"; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_5arrex_4list_9typedlist_30__getitem__; +static PyObject *__pyx_pw_5arrex_4list_9typedlist_17extend(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds #endif -static PyObject *__pyx_pw_5arrex_4list_9typedlist_31__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_9typedlist_30__getitem__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), ((PyObject *)__pyx_v_index)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5arrex_4list_9typedlist_30__getitem__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_index) { - struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_view = 0; - Py_ssize_t __pyx_v_start; - Py_ssize_t __pyx_v_stop; - Py_ssize_t __pyx_v_step; - PyObject *__pyx_r = NULL; +); /*proto*/ +static int __pyx_f_5arrex_4list_9typedlist_extend(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_skip_dispatch) { + Py_buffer __pyx_v_view; + Py_ssize_t __pyx_v_l; + PyObject *__pyx_v_o = NULL; + int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; + PyObject *__pyx_t_4 = NULL; int __pyx_t_5; - size_t __pyx_t_6; + int __pyx_t_6; + size_t __pyx_t_7; + size_t __pyx_t_8; + size_t __pyx_t_9; + Py_ssize_t __pyx_t_10; + PyObject *(*__pyx_t_11)(PyObject *); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getitem__", 0); + __Pyx_RefNannySetupContext("extend", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_extend); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #ifdef __Pyx_CyFunction_USED + if (!__Pyx_IsCyOrPyCFunction(__pyx_t_1) + #else + if (!PyCFunction_Check(__pyx_t_1) + #endif + || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_5arrex_4list_9typedlist_17extend)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } + } + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_other}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } - /* "arrex/list.pyx":424 - * - * #if isinstance(index, int): - * if PyNumber_Check(index): # <<<<<<<<<<<<<< - * return self._getitem(self.ptr + self._index(index)*self.dtype.dsize) + /* "arrex/list.pyx":329 + * cdef Py_ssize_t l * - */ - __pyx_t_1 = (PyNumber_Check(__pyx_v_index) != 0); - if (__pyx_t_1) { - - /* "arrex/list.pyx":425 - * #if isinstance(index, int): - * if PyNumber_Check(index): - * return self._getitem(self.ptr + self._index(index)*self.dtype.dsize) # <<<<<<<<<<<<<< + * if PyObject_CheckBuffer(other): # <<<<<<<<<<<<<< + * PyObject_GetBuffer(other, &view, PyBUF_SIMPLE) * - * elif isinstance(index, slice): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_index(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1L))) __PYX_ERR(0, 425, __pyx_L1_error) - __pyx_t_3 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_getitem(__pyx_v_self, (__pyx_v_self->ptr + (__pyx_t_2 * __pyx_v_self->dtype->dsize))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 425, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; + __pyx_t_6 = PyObject_CheckBuffer(__pyx_v_other); + if (__pyx_t_6) { - /* "arrex/list.pyx":424 + /* "arrex/list.pyx":330 * - * #if isinstance(index, int): - * if PyNumber_Check(index): # <<<<<<<<<<<<<< - * return self._getitem(self.ptr + self._index(index)*self.dtype.dsize) + * if PyObject_CheckBuffer(other): + * PyObject_GetBuffer(other, &view, PyBUF_SIMPLE) # <<<<<<<<<<<<<< * + * if view.len % self.dtype.dsize: */ - } + __pyx_t_5 = PyObject_GetBuffer(__pyx_v_other, (&__pyx_v_view), PyBUF_SIMPLE); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 330, __pyx_L1_error) - /* "arrex/list.pyx":427 - * return self._getitem(self.ptr + self._index(index)*self.dtype.dsize) + /* "arrex/list.pyx":332 + * PyObject_GetBuffer(other, &view, PyBUF_SIMPLE) * - * elif isinstance(index, slice): # <<<<<<<<<<<<<< - * if PySlice_Unpack(index, &start, &stop, &step): - * raise IndexError('incorrect slice') + * if view.len % self.dtype.dsize: # <<<<<<<<<<<<<< + * PyBuffer_Release(&view) + * raise TypeError('the given buffer must have a byte size multiple of dtype size') */ - __pyx_t_1 = PySlice_Check(__pyx_v_index); - __pyx_t_4 = (__pyx_t_1 != 0); - if (likely(__pyx_t_4)) { + __pyx_t_6 = ((__pyx_v_view.len % __pyx_v_self->dtype->dsize) != 0); + if (unlikely(__pyx_t_6)) { - /* "arrex/list.pyx":428 + /* "arrex/list.pyx":333 + * + * if view.len % self.dtype.dsize: + * PyBuffer_Release(&view) # <<<<<<<<<<<<<< + * raise TypeError('the given buffer must have a byte size multiple of dtype size') * - * elif isinstance(index, slice): - * if PySlice_Unpack(index, &start, &stop, &step): # <<<<<<<<<<<<<< - * raise IndexError('incorrect slice') - * if step != 1: */ - __pyx_t_5 = PySlice_Unpack(__pyx_v_index, (&__pyx_v_start), (&__pyx_v_stop), (&__pyx_v_step)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 428, __pyx_L1_error) - __pyx_t_4 = (__pyx_t_5 != 0); - if (unlikely(__pyx_t_4)) { + PyBuffer_Release((&__pyx_v_view)); - /* "arrex/list.pyx":429 - * elif isinstance(index, slice): - * if PySlice_Unpack(index, &start, &stop, &step): - * raise IndexError('incorrect slice') # <<<<<<<<<<<<<< - * if step != 1: - * raise IndexError('slice step is not supported') + /* "arrex/list.pyx":334 + * if view.len % self.dtype.dsize: + * PyBuffer_Release(&view) + * raise TypeError('the given buffer must have a byte size multiple of dtype size') # <<<<<<<<<<<<<< + * + * if view.len > self.allocated - self.size: */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 429, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 334, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 334, __pyx_L1_error) - /* "arrex/list.pyx":428 + /* "arrex/list.pyx":332 + * PyObject_GetBuffer(other, &view, PyBUF_SIMPLE) * - * elif isinstance(index, slice): - * if PySlice_Unpack(index, &start, &stop, &step): # <<<<<<<<<<<<<< - * raise IndexError('incorrect slice') - * if step != 1: + * if view.len % self.dtype.dsize: # <<<<<<<<<<<<<< + * PyBuffer_Release(&view) + * raise TypeError('the given buffer must have a byte size multiple of dtype size') */ } - /* "arrex/list.pyx":430 - * if PySlice_Unpack(index, &start, &stop, &step): - * raise IndexError('incorrect slice') - * if step != 1: # <<<<<<<<<<<<<< - * raise IndexError('slice step is not supported') - * PySlice_AdjustIndices(self._len(), &start, &stop, step) + /* "arrex/list.pyx":336 + * raise TypeError('the given buffer must have a byte size multiple of dtype size') + * + * if view.len > self.allocated - self.size: # <<<<<<<<<<<<<< + * self._reallocate(max(2*self.size, self.size + view.len)) + * memcpy(self.ptr+self.size, view.buf, view.len) */ - __pyx_t_4 = ((__pyx_v_step != 1) != 0); - if (unlikely(__pyx_t_4)) { + __pyx_t_6 = (((size_t)__pyx_v_view.len) > (__pyx_v_self->allocated - __pyx_v_self->size)); + if (__pyx_t_6) { - /* "arrex/list.pyx":431 - * raise IndexError('incorrect slice') - * if step != 1: - * raise IndexError('slice step is not supported') # <<<<<<<<<<<<<< - * PySlice_AdjustIndices(self._len(), &start, &stop, step) - * if stop < start: + /* "arrex/list.pyx":337 + * + * if view.len > self.allocated - self.size: + * self._reallocate(max(2*self.size, self.size + view.len)) # <<<<<<<<<<<<<< + * memcpy(self.ptr+self.size, view.buf, view.len) + * self.size += view.len */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 431, __pyx_L1_error) + __pyx_t_7 = (__pyx_v_self->size + __pyx_v_view.len); + __pyx_t_8 = (2 * __pyx_v_self->size); + if ((__pyx_t_7 > __pyx_t_8)) { + __pyx_t_9 = __pyx_t_7; + } else { + __pyx_t_9 = __pyx_t_8; + } + __pyx_t_5 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_reallocate(__pyx_v_self, __pyx_t_9); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 337, __pyx_L1_error) - /* "arrex/list.pyx":430 - * if PySlice_Unpack(index, &start, &stop, &step): - * raise IndexError('incorrect slice') - * if step != 1: # <<<<<<<<<<<<<< - * raise IndexError('slice step is not supported') - * PySlice_AdjustIndices(self._len(), &start, &stop, step) + /* "arrex/list.pyx":336 + * raise TypeError('the given buffer must have a byte size multiple of dtype size') + * + * if view.len > self.allocated - self.size: # <<<<<<<<<<<<<< + * self._reallocate(max(2*self.size, self.size + view.len)) + * memcpy(self.ptr+self.size, view.buf, view.len) */ } - /* "arrex/list.pyx":432 - * if step != 1: - * raise IndexError('slice step is not supported') - * PySlice_AdjustIndices(self._len(), &start, &stop, step) # <<<<<<<<<<<<<< - * if stop < start: - * stop = start - */ - (void)(PySlice_AdjustIndices(((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_len(__pyx_v_self), (&__pyx_v_start), (&__pyx_v_stop), __pyx_v_step)); - - /* "arrex/list.pyx":433 - * raise IndexError('slice step is not supported') - * PySlice_AdjustIndices(self._len(), &start, &stop, step) - * if stop < start: # <<<<<<<<<<<<<< - * stop = start + /* "arrex/list.pyx":338 + * if view.len > self.allocated - self.size: + * self._reallocate(max(2*self.size, self.size + view.len)) + * memcpy(self.ptr+self.size, view.buf, view.len) # <<<<<<<<<<<<<< + * self.size += view.len * */ - __pyx_t_4 = ((__pyx_v_stop < __pyx_v_start) != 0); - if (__pyx_t_4) { + (void)(memcpy((__pyx_v_self->ptr + __pyx_v_self->size), __pyx_v_view.buf, __pyx_v_view.len)); - /* "arrex/list.pyx":434 - * PySlice_AdjustIndices(self._len(), &start, &stop, step) - * if stop < start: - * stop = start # <<<<<<<<<<<<<< + /* "arrex/list.pyx":339 + * self._reallocate(max(2*self.size, self.size + view.len)) + * memcpy(self.ptr+self.size, view.buf, view.len) + * self.size += view.len # <<<<<<<<<<<<<< * - * view = typedlist.__new__(typedlist) + * PyBuffer_Release(&view) */ - __pyx_v_stop = __pyx_v_start; + __pyx_v_self->size = (__pyx_v_self->size + __pyx_v_view.len); - /* "arrex/list.pyx":433 - * raise IndexError('slice step is not supported') - * PySlice_AdjustIndices(self._len(), &start, &stop, step) - * if stop < start: # <<<<<<<<<<<<<< - * stop = start + /* "arrex/list.pyx":341 + * self.size += view.len * - */ - } - - /* "arrex/list.pyx":436 - * stop = start + * PyBuffer_Release(&view) # <<<<<<<<<<<<<< * - * view = typedlist.__new__(typedlist) # <<<<<<<<<<<<<< - * view.ptr = self.ptr + start*self.dtype.dsize - * view.size = (stop-start)*self.dtype.dsize + * else: */ - __pyx_t_3 = ((PyObject *)__pyx_tp_new_5arrex_4list_typedlist(((PyTypeObject *)__pyx_ptype_5arrex_4list_typedlist), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 436, __pyx_L1_error) - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_v_view = ((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_t_3); - __pyx_t_3 = 0; + PyBuffer_Release((&__pyx_v_view)); - /* "arrex/list.pyx":437 + /* "arrex/list.pyx":329 + * cdef Py_ssize_t l + * + * if PyObject_CheckBuffer(other): # <<<<<<<<<<<<<< + * PyObject_GetBuffer(other, &view, PyBUF_SIMPLE) * - * view = typedlist.__new__(typedlist) - * view.ptr = self.ptr + start*self.dtype.dsize # <<<<<<<<<<<<<< - * view.size = (stop-start)*self.dtype.dsize - * view.allocated = view.size */ - __pyx_v_view->ptr = (__pyx_v_self->ptr + (__pyx_v_start * __pyx_v_self->dtype->dsize)); + goto __pyx_L3; + } - /* "arrex/list.pyx":438 - * view = typedlist.__new__(typedlist) - * view.ptr = self.ptr + start*self.dtype.dsize - * view.size = (stop-start)*self.dtype.dsize # <<<<<<<<<<<<<< - * view.allocated = view.size - * view.owner = self.owner + /* "arrex/list.pyx":344 + * + * else: + * l = PyObject_LengthHint(other, 0) # <<<<<<<<<<<<<< + * if l*self.dtype.dsize > self.allocated - self.size: + * self._reallocate(self.size + l*self.dtype.dsize) */ - __pyx_v_view->size = ((__pyx_v_stop - __pyx_v_start) * __pyx_v_self->dtype->dsize); + /*else*/ { + __pyx_v_l = PyObject_LengthHint(__pyx_v_other, 0); - /* "arrex/list.pyx":439 - * view.ptr = self.ptr + start*self.dtype.dsize - * view.size = (stop-start)*self.dtype.dsize - * view.allocated = view.size # <<<<<<<<<<<<<< - * view.owner = self.owner - * view.dtype = self.dtype + /* "arrex/list.pyx":345 + * else: + * l = PyObject_LengthHint(other, 0) + * if l*self.dtype.dsize > self.allocated - self.size: # <<<<<<<<<<<<<< + * self._reallocate(self.size + l*self.dtype.dsize) + * for o in other: */ - __pyx_t_6 = __pyx_v_view->size; - __pyx_v_view->allocated = __pyx_t_6; + __pyx_t_6 = ((__pyx_v_l * __pyx_v_self->dtype->dsize) > (__pyx_v_self->allocated - __pyx_v_self->size)); + if (__pyx_t_6) { - /* "arrex/list.pyx":440 - * view.size = (stop-start)*self.dtype.dsize - * view.allocated = view.size - * view.owner = self.owner # <<<<<<<<<<<<<< - * view.dtype = self.dtype - * return view + /* "arrex/list.pyx":346 + * l = PyObject_LengthHint(other, 0) + * if l*self.dtype.dsize > self.allocated - self.size: + * self._reallocate(self.size + l*self.dtype.dsize) # <<<<<<<<<<<<<< + * for o in other: + * self.append(o) */ - __pyx_t_3 = __pyx_v_self->owner; - __Pyx_INCREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_v_view->owner); - __Pyx_DECREF(__pyx_v_view->owner); - __pyx_v_view->owner = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_5 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_reallocate(__pyx_v_self, (__pyx_v_self->size + (__pyx_v_l * __pyx_v_self->dtype->dsize))); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 346, __pyx_L1_error) - /* "arrex/list.pyx":441 - * view.allocated = view.size - * view.owner = self.owner - * view.dtype = self.dtype # <<<<<<<<<<<<<< - * return view - * + /* "arrex/list.pyx":345 + * else: + * l = PyObject_LengthHint(other, 0) + * if l*self.dtype.dsize > self.allocated - self.size: # <<<<<<<<<<<<<< + * self._reallocate(self.size + l*self.dtype.dsize) + * for o in other: */ - __pyx_t_3 = ((PyObject *)__pyx_v_self->dtype); - __Pyx_INCREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_v_view->dtype); - __Pyx_DECREF(((PyObject *)__pyx_v_view->dtype)); - __pyx_v_view->dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_3); - __pyx_t_3 = 0; + } - /* "arrex/list.pyx":442 - * view.owner = self.owner - * view.dtype = self.dtype - * return view # <<<<<<<<<<<<<< + /* "arrex/list.pyx":347 + * if l*self.dtype.dsize > self.allocated - self.size: + * self._reallocate(self.size + l*self.dtype.dsize) + * for o in other: # <<<<<<<<<<<<<< + * self.append(o) * - * else: */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_view)); - __pyx_r = ((PyObject *)__pyx_v_view); - goto __pyx_L0; + if (likely(PyList_CheckExact(__pyx_v_other)) || PyTuple_CheckExact(__pyx_v_other)) { + __pyx_t_1 = __pyx_v_other; __Pyx_INCREF(__pyx_t_1); __pyx_t_10 = 0; + __pyx_t_11 = NULL; + } else { + __pyx_t_10 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_other); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 347, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_11 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 347, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_11)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_10); __Pyx_INCREF(__pyx_t_2); __pyx_t_10++; if (unlikely((0 < 0))) __PYX_ERR(0, 347, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 347, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } else { + if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_10); __Pyx_INCREF(__pyx_t_2); __pyx_t_10++; if (unlikely((0 < 0))) __PYX_ERR(0, 347, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 347, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } + } else { + __pyx_t_2 = __pyx_t_11(__pyx_t_1); + if (unlikely(!__pyx_t_2)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 347, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_XDECREF_SET(__pyx_v_o, __pyx_t_2); + __pyx_t_2 = 0; - /* "arrex/list.pyx":427 - * return self._getitem(self.ptr + self._index(index)*self.dtype.dsize) + /* "arrex/list.pyx":348 + * self._reallocate(self.size + l*self.dtype.dsize) + * for o in other: + * self.append(o) # <<<<<<<<<<<<<< * - * elif isinstance(index, slice): # <<<<<<<<<<<<<< - * if PySlice_Unpack(index, &start, &stop, &step): - * raise IndexError('incorrect slice') + * def __iadd__(self, other): */ - } + __pyx_t_5 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->append(__pyx_v_self, __pyx_v_o, 0); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 348, __pyx_L1_error) - /* "arrex/list.pyx":445 - * - * else: - * raise IndexError('index must be int or slice') # <<<<<<<<<<<<<< + /* "arrex/list.pyx":347 + * if l*self.dtype.dsize > self.allocated - self.size: + * self._reallocate(self.size + l*self.dtype.dsize) + * for o in other: # <<<<<<<<<<<<<< + * self.append(o) * - * def __setitem__(self, index, value): */ - /*else*/ { - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 445, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 445, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } + __pyx_L3:; - /* "arrex/list.pyx":411 - * return self._len() + /* "arrex/list.pyx":321 + * self.size = 0 * - * def __getitem__(self, index): # <<<<<<<<<<<<<< - * ''' self[index] + * cpdef int extend(self, other) except *: # <<<<<<<<<<<<<< + * ''' extend(iterable) * */ /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("arrex.list.typedlist.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("arrex.list.typedlist.extend", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_view); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_o); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "arrex/list.pyx":447 - * raise IndexError('index must be int or slice') +/* Python wrapper */ +static PyObject *__pyx_pw_5arrex_4list_9typedlist_17extend(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5arrex_4list_9typedlist_16extend, " extend(iterable)\n\t\t\n\t\t\tappend all elements from the other array \n\t\t"); +static PyMethodDef __pyx_mdef_5arrex_4list_9typedlist_17extend = {"extend", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9typedlist_17extend, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_16extend}; +static PyObject *__pyx_pw_5arrex_4list_9typedlist_17extend(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_other = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("extend (wrapper)", 0); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_other,0}; + PyObject* values[1] = {0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_other)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 321, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "extend") < 0)) __PYX_ERR(0, 321, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_other = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("extend", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 321, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("arrex.list.typedlist.extend", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5arrex_4list_9typedlist_16extend(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), __pyx_v_other); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5arrex_4list_9typedlist_16extend(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_other) { + 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("extend", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_5arrex_4list_9typedlist_extend(__pyx_v_self, __pyx_v_other, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 321, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("arrex.list.typedlist.extend", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "arrex/list.pyx":350 + * self.append(o) * - * def __setitem__(self, index, value): # <<<<<<<<<<<<<< - * cdef Py_buffer view - * cdef Py_ssize_t start, stop, step + * def __iadd__(self, other): # <<<<<<<<<<<<<< + * self.extend(other) + * return self */ /* Python wrapper */ -static int __pyx_pw_5arrex_4list_9typedlist_33__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_5arrex_4list_9typedlist_33__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { - int __pyx_r; +static PyObject *__pyx_pw_5arrex_4list_9typedlist_19__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pw_5arrex_4list_9typedlist_19__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_9typedlist_32__setitem__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannySetupContext("__iadd__ (wrapper)", 0); + __pyx_r = __pyx_pf_5arrex_4list_9typedlist_18__iadd__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), ((PyObject *)__pyx_v_other)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_5arrex_4list_9typedlist_32__setitem__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { - Py_buffer __pyx_v_view; - Py_ssize_t __pyx_v_start; - Py_ssize_t __pyx_v_stop; - Py_ssize_t __pyx_v_step; - size_t __pyx_v_newsize; - int __pyx_r; +static PyObject *__pyx_pf_5arrex_4list_9typedlist_18__iadd__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - Py_ssize_t __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - size_t __pyx_t_6; - size_t __pyx_t_7; - size_t __pyx_t_8; - PyObject *__pyx_t_9 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setitem__", 0); + __Pyx_RefNannySetupContext("__iadd__", 0); - /* "arrex/list.pyx":453 + /* "arrex/list.pyx":351 * - * #if isinstance(index, int): - * if PyNumber_Check(index): # <<<<<<<<<<<<<< - * self._setitem(self.ptr + self._index(index)*self.dtype.dsize, value) + * def __iadd__(self, other): + * self.extend(other) # <<<<<<<<<<<<<< + * return self * */ - __pyx_t_1 = (PyNumber_Check(__pyx_v_index) != 0); - if (__pyx_t_1) { + ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->extend(__pyx_v_self, __pyx_v_other, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 351, __pyx_L1_error) - /* "arrex/list.pyx":454 - * #if isinstance(index, int): - * if PyNumber_Check(index): - * self._setitem(self.ptr + self._index(index)*self.dtype.dsize, value) # <<<<<<<<<<<<<< + /* "arrex/list.pyx":352 + * def __iadd__(self, other): + * self.extend(other) + * return self # <<<<<<<<<<<<<< * - * elif isinstance(index, slice): + * def __add__(typedlist self, other): */ - __pyx_t_2 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_index(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1L))) __PYX_ERR(0, 454, __pyx_L1_error) - __pyx_t_3 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_setitem(__pyx_v_self, (__pyx_v_self->ptr + (__pyx_t_2 * __pyx_v_self->dtype->dsize)), __pyx_v_value); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 454, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; - /* "arrex/list.pyx":453 - * - * #if isinstance(index, int): - * if PyNumber_Check(index): # <<<<<<<<<<<<<< - * self._setitem(self.ptr + self._index(index)*self.dtype.dsize, value) + /* "arrex/list.pyx":350 + * self.append(o) * + * def __iadd__(self, other): # <<<<<<<<<<<<<< + * self.extend(other) + * return self */ - goto __pyx_L3; - } - /* "arrex/list.pyx":456 - * self._setitem(self.ptr + self._index(index)*self.dtype.dsize, value) + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("arrex.list.typedlist.__iadd__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "arrex/list.pyx":354 + * return self * - * elif isinstance(index, slice): # <<<<<<<<<<<<<< - * if PySlice_Unpack(index, &start, &stop, &step): - * raise IndexError('incorrect slice') + * def __add__(typedlist self, other): # <<<<<<<<<<<<<< + * ''' concatenation of two arrays ''' + * cdef typedlist result */ - __pyx_t_1 = PySlice_Check(__pyx_v_index); - __pyx_t_4 = (__pyx_t_1 != 0); - if (likely(__pyx_t_4)) { - /* "arrex/list.pyx":457 +/* Python wrapper */ +static PyObject *__pyx_pw_5arrex_4list_9typedlist_21__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5arrex_4list_9typedlist_20__add__, " concatenation of two arrays "); +#if CYTHON_UPDATE_DESCRIPTOR_DOC +struct wrapperbase __pyx_wrapperbase_5arrex_4list_9typedlist_20__add__; +#endif +static PyObject *__pyx_pw_5arrex_4list_9typedlist_21__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__add__ (wrapper)", 0); + __pyx_r = __pyx_pf_5arrex_4list_9typedlist_20__add__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), ((PyObject *)__pyx_v_other)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5arrex_4list_9typedlist_20__add__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_other) { + struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_result = 0; + Py_buffer __pyx_v_view; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__add__", 0); + + /* "arrex/list.pyx":359 + * cdef Py_buffer view + * + * if PyObject_CheckBuffer(other): # <<<<<<<<<<<<<< + * PyObject_GetBuffer(other, &view, PyBUF_SIMPLE) * - * elif isinstance(index, slice): - * if PySlice_Unpack(index, &start, &stop, &step): # <<<<<<<<<<<<<< - * raise IndexError('incorrect slice') - * if step != 1: */ - __pyx_t_3 = PySlice_Unpack(__pyx_v_index, (&__pyx_v_start), (&__pyx_v_stop), (&__pyx_v_step)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 457, __pyx_L1_error) - __pyx_t_4 = (__pyx_t_3 != 0); - if (unlikely(__pyx_t_4)) { + __pyx_t_1 = PyObject_CheckBuffer(__pyx_v_other); + if (__pyx_t_1) { - /* "arrex/list.pyx":458 - * elif isinstance(index, slice): - * if PySlice_Unpack(index, &start, &stop, &step): - * raise IndexError('incorrect slice') # <<<<<<<<<<<<<< - * if step != 1: - * raise IndexError('slice step is not supported') + /* "arrex/list.pyx":360 + * + * if PyObject_CheckBuffer(other): + * PyObject_GetBuffer(other, &view, PyBUF_SIMPLE) # <<<<<<<<<<<<<< + * + * if view.len % self.dtype.dsize: */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 458, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_Raise(__pyx_t_5, 0, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __PYX_ERR(0, 458, __pyx_L1_error) + __pyx_t_2 = PyObject_GetBuffer(__pyx_v_other, (&__pyx_v_view), PyBUF_SIMPLE); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 360, __pyx_L1_error) - /* "arrex/list.pyx":457 + /* "arrex/list.pyx":362 + * PyObject_GetBuffer(other, &view, PyBUF_SIMPLE) * - * elif isinstance(index, slice): - * if PySlice_Unpack(index, &start, &stop, &step): # <<<<<<<<<<<<<< - * raise IndexError('incorrect slice') - * if step != 1: + * if view.len % self.dtype.dsize: # <<<<<<<<<<<<<< + * PyBuffer_Release(&view) + * raise TypeError('the given buffer must have a byte size multiple of dtype size') */ - } + __pyx_t_1 = ((__pyx_v_view.len % __pyx_v_self->dtype->dsize) != 0); + if (unlikely(__pyx_t_1)) { - /* "arrex/list.pyx":459 - * if PySlice_Unpack(index, &start, &stop, &step): - * raise IndexError('incorrect slice') - * if step != 1: # <<<<<<<<<<<<<< - * raise IndexError('slice step is not supported') - * PySlice_AdjustIndices(self._len(), &start, &stop, step) + /* "arrex/list.pyx":363 + * + * if view.len % self.dtype.dsize: + * PyBuffer_Release(&view) # <<<<<<<<<<<<<< + * raise TypeError('the given buffer must have a byte size multiple of dtype size') + * */ - __pyx_t_4 = ((__pyx_v_step != 1) != 0); - if (unlikely(__pyx_t_4)) { + PyBuffer_Release((&__pyx_v_view)); - /* "arrex/list.pyx":460 - * raise IndexError('incorrect slice') - * if step != 1: - * raise IndexError('slice step is not supported') # <<<<<<<<<<<<<< - * PySlice_AdjustIndices(self._len(), &start, &stop, step) - * if stop < start: + /* "arrex/list.pyx":364 + * if view.len % self.dtype.dsize: + * PyBuffer_Release(&view) + * raise TypeError('the given buffer must have a byte size multiple of dtype size') # <<<<<<<<<<<<<< + * + * result = typedlist.__new__(typedlist) */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 460, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_Raise(__pyx_t_5, 0, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __PYX_ERR(0, 460, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 364, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 364, __pyx_L1_error) - /* "arrex/list.pyx":459 - * if PySlice_Unpack(index, &start, &stop, &step): - * raise IndexError('incorrect slice') - * if step != 1: # <<<<<<<<<<<<<< - * raise IndexError('slice step is not supported') - * PySlice_AdjustIndices(self._len(), &start, &stop, step) + /* "arrex/list.pyx":362 + * PyObject_GetBuffer(other, &view, PyBUF_SIMPLE) + * + * if view.len % self.dtype.dsize: # <<<<<<<<<<<<<< + * PyBuffer_Release(&view) + * raise TypeError('the given buffer must have a byte size multiple of dtype size') */ } - /* "arrex/list.pyx":461 - * if step != 1: - * raise IndexError('slice step is not supported') - * PySlice_AdjustIndices(self._len(), &start, &stop, step) # <<<<<<<<<<<<<< - * if stop < start: - * stop = start - */ - (void)(PySlice_AdjustIndices(((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_len(__pyx_v_self), (&__pyx_v_start), (&__pyx_v_stop), __pyx_v_step)); - - /* "arrex/list.pyx":462 - * raise IndexError('slice step is not supported') - * PySlice_AdjustIndices(self._len(), &start, &stop, step) - * if stop < start: # <<<<<<<<<<<<<< - * stop = start + /* "arrex/list.pyx":366 + * raise TypeError('the given buffer must have a byte size multiple of dtype size') * + * result = typedlist.__new__(typedlist) # <<<<<<<<<<<<<< + * result.dtype = self.dtype + * result._reallocate(self.size + view.len) */ - __pyx_t_4 = ((__pyx_v_stop < __pyx_v_start) != 0); - if (__pyx_t_4) { + __pyx_t_3 = ((PyObject *)__pyx_tp_new_5arrex_4list_typedlist(((PyTypeObject *)__pyx_ptype_5arrex_4list_typedlist), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 366, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + __pyx_v_result = ((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_t_3); + __pyx_t_3 = 0; - /* "arrex/list.pyx":463 - * PySlice_AdjustIndices(self._len(), &start, &stop, step) - * if stop < start: - * stop = start # <<<<<<<<<<<<<< + /* "arrex/list.pyx":367 * - * if PyObject_CheckBuffer(value): + * result = typedlist.__new__(typedlist) + * result.dtype = self.dtype # <<<<<<<<<<<<<< + * result._reallocate(self.size + view.len) + * memcpy(result.ptr, self.ptr, self.size) */ - __pyx_v_stop = __pyx_v_start; + __pyx_t_3 = ((PyObject *)__pyx_v_self->dtype); + __Pyx_INCREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF((PyObject *)__pyx_v_result->dtype); + __Pyx_DECREF((PyObject *)__pyx_v_result->dtype); + __pyx_v_result->dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_3); + __pyx_t_3 = 0; - /* "arrex/list.pyx":462 - * raise IndexError('slice step is not supported') - * PySlice_AdjustIndices(self._len(), &start, &stop, step) - * if stop < start: # <<<<<<<<<<<<<< - * stop = start - * + /* "arrex/list.pyx":368 + * result = typedlist.__new__(typedlist) + * result.dtype = self.dtype + * result._reallocate(self.size + view.len) # <<<<<<<<<<<<<< + * memcpy(result.ptr, self.ptr, self.size) + * memcpy(result.ptr+self.size, view.buf, view.len) */ - } + __pyx_t_2 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_result->__pyx_vtab)->_reallocate(__pyx_v_result, (__pyx_v_self->size + __pyx_v_view.len)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 368, __pyx_L1_error) - /* "arrex/list.pyx":465 - * stop = start - * - * if PyObject_CheckBuffer(value): # <<<<<<<<<<<<<< - * PyObject_GetBuffer(value, &view, PyBUF_SIMPLE) - * start *= self.dtype.dsize + /* "arrex/list.pyx":369 + * result.dtype = self.dtype + * result._reallocate(self.size + view.len) + * memcpy(result.ptr, self.ptr, self.size) # <<<<<<<<<<<<<< + * memcpy(result.ptr+self.size, view.buf, view.len) + * result.size = result.allocated */ - __pyx_t_4 = (PyObject_CheckBuffer(__pyx_v_value) != 0); - if (__pyx_t_4) { + (void)(memcpy(__pyx_v_result->ptr, __pyx_v_self->ptr, __pyx_v_self->size)); - /* "arrex/list.pyx":466 + /* "arrex/list.pyx":370 + * result._reallocate(self.size + view.len) + * memcpy(result.ptr, self.ptr, self.size) + * memcpy(result.ptr+self.size, view.buf, view.len) # <<<<<<<<<<<<<< + * result.size = result.allocated * - * if PyObject_CheckBuffer(value): - * PyObject_GetBuffer(value, &view, PyBUF_SIMPLE) # <<<<<<<<<<<<<< - * start *= self.dtype.dsize - * stop *= self.dtype.dsize */ - __pyx_t_3 = PyObject_GetBuffer(__pyx_v_value, (&__pyx_v_view), PyBUF_SIMPLE); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 466, __pyx_L1_error) + (void)(memcpy((__pyx_v_result->ptr + __pyx_v_self->size), __pyx_v_view.buf, __pyx_v_view.len)); - /* "arrex/list.pyx":467 - * if PyObject_CheckBuffer(value): - * PyObject_GetBuffer(value, &view, PyBUF_SIMPLE) - * start *= self.dtype.dsize # <<<<<<<<<<<<<< - * stop *= self.dtype.dsize + /* "arrex/list.pyx":371 + * memcpy(result.ptr, self.ptr, self.size) + * memcpy(result.ptr+self.size, view.buf, view.len) + * result.size = result.allocated # <<<<<<<<<<<<<< * + * PyBuffer_Release(&view) */ - __pyx_v_start = (__pyx_v_start * __pyx_v_self->dtype->dsize); + __pyx_t_4 = __pyx_v_result->allocated; + __pyx_v_result->size = __pyx_t_4; - /* "arrex/list.pyx":468 - * PyObject_GetBuffer(value, &view, PyBUF_SIMPLE) - * start *= self.dtype.dsize - * stop *= self.dtype.dsize # <<<<<<<<<<<<<< + /* "arrex/list.pyx":373 + * result.size = result.allocated + * + * PyBuffer_Release(&view) # <<<<<<<<<<<<<< + * return result * - * if view.len != stop-start: */ - __pyx_v_stop = (__pyx_v_stop * __pyx_v_self->dtype->dsize); + PyBuffer_Release((&__pyx_v_view)); - /* "arrex/list.pyx":470 - * stop *= self.dtype.dsize + /* "arrex/list.pyx":374 * - * if view.len != stop-start: # <<<<<<<<<<<<<< - * if view.len % self.dtype.dsize: - * PyBuffer_Release(&view) + * PyBuffer_Release(&view) + * return result # <<<<<<<<<<<<<< + * + * elif hasattr(other, '__iter__'): */ - __pyx_t_4 = ((__pyx_v_view.len != (__pyx_v_stop - __pyx_v_start)) != 0); - if (__pyx_t_4) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; - /* "arrex/list.pyx":471 + /* "arrex/list.pyx":359 + * cdef Py_buffer view + * + * if PyObject_CheckBuffer(other): # <<<<<<<<<<<<<< + * PyObject_GetBuffer(other, &view, PyBUF_SIMPLE) * - * if view.len != stop-start: - * if view.len % self.dtype.dsize: # <<<<<<<<<<<<<< - * PyBuffer_Release(&view) - * raise TypeError('the given buffer must have a byte size multiple of dtype size') */ - __pyx_t_4 = ((__pyx_v_view.len % __pyx_v_self->dtype->dsize) != 0); - if (unlikely(__pyx_t_4)) { + } - /* "arrex/list.pyx":472 - * if view.len != stop-start: - * if view.len % self.dtype.dsize: - * PyBuffer_Release(&view) # <<<<<<<<<<<<<< - * raise TypeError('the given buffer must have a byte size multiple of dtype size') + /* "arrex/list.pyx":376 + * return result * + * elif hasattr(other, '__iter__'): # <<<<<<<<<<<<<< + * result = typedlist(None, self.dtype) + * result.extend(self) */ - PyBuffer_Release((&__pyx_v_view)); + __pyx_t_1 = __Pyx_HasAttr(__pyx_v_other, __pyx_n_u_iter); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 376, __pyx_L1_error) + if (__pyx_t_1) { - /* "arrex/list.pyx":473 - * if view.len % self.dtype.dsize: - * PyBuffer_Release(&view) - * raise TypeError('the given buffer must have a byte size multiple of dtype size') # <<<<<<<<<<<<<< + /* "arrex/list.pyx":377 * - * newsize = self.size + view.len + start - stop + * elif hasattr(other, '__iter__'): + * result = typedlist(None, self.dtype) # <<<<<<<<<<<<<< + * result.extend(self) + * result.extend(other) */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 473, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_Raise(__pyx_t_5, 0, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __PYX_ERR(0, 473, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 377, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None); + __Pyx_INCREF((PyObject *)__pyx_v_self->dtype); + __Pyx_GIVEREF((PyObject *)__pyx_v_self->dtype); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self->dtype)); + __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5arrex_4list_typedlist), __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 377, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result = ((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_t_5); + __pyx_t_5 = 0; - /* "arrex/list.pyx":471 - * - * if view.len != stop-start: - * if view.len % self.dtype.dsize: # <<<<<<<<<<<<<< - * PyBuffer_Release(&view) - * raise TypeError('the given buffer must have a byte size multiple of dtype size') + /* "arrex/list.pyx":378 + * elif hasattr(other, '__iter__'): + * result = typedlist(None, self.dtype) + * result.extend(self) # <<<<<<<<<<<<<< + * result.extend(other) + * return result */ - } + ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_result->__pyx_vtab)->extend(__pyx_v_result, ((PyObject *)__pyx_v_self), 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 378, __pyx_L1_error) - /* "arrex/list.pyx":475 - * raise TypeError('the given buffer must have a byte size multiple of dtype size') + /* "arrex/list.pyx":379 + * result = typedlist(None, self.dtype) + * result.extend(self) + * result.extend(other) # <<<<<<<<<<<<<< + * return result * - * newsize = self.size + view.len + start - stop # <<<<<<<<<<<<<< - * if newsize > self.allocated: - * self._reallocate(max(2*self.size, newsize)) */ - __pyx_v_newsize = (((__pyx_v_self->size + __pyx_v_view.len) + __pyx_v_start) - __pyx_v_stop); + ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_result->__pyx_vtab)->extend(__pyx_v_result, __pyx_v_other, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 379, __pyx_L1_error) - /* "arrex/list.pyx":476 - * - * newsize = self.size + view.len + start - stop - * if newsize > self.allocated: # <<<<<<<<<<<<<< - * self._reallocate(max(2*self.size, newsize)) + /* "arrex/list.pyx":380 + * result.extend(self) + * result.extend(other) + * return result # <<<<<<<<<<<<<< * + * else: */ - __pyx_t_4 = ((__pyx_v_newsize > __pyx_v_self->allocated) != 0); - if (__pyx_t_4) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; - /* "arrex/list.pyx":477 - * newsize = self.size + view.len + start - stop - * if newsize > self.allocated: - * self._reallocate(max(2*self.size, newsize)) # <<<<<<<<<<<<<< + /* "arrex/list.pyx":376 + * return result * - * memmove(self.ptr+start+view.len, self.ptr+stop, self.size-stop) + * elif hasattr(other, '__iter__'): # <<<<<<<<<<<<<< + * result = typedlist(None, self.dtype) + * result.extend(self) */ - __pyx_t_6 = __pyx_v_newsize; - __pyx_t_7 = (2 * __pyx_v_self->size); - if (((__pyx_t_6 > __pyx_t_7) != 0)) { - __pyx_t_8 = __pyx_t_6; - } else { - __pyx_t_8 = __pyx_t_7; - } - __pyx_t_3 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_reallocate(__pyx_v_self, __pyx_t_8); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 477, __pyx_L1_error) + } - /* "arrex/list.pyx":476 + /* "arrex/list.pyx":383 * - * newsize = self.size + view.len + start - stop - * if newsize > self.allocated: # <<<<<<<<<<<<<< - * self._reallocate(max(2*self.size, newsize)) + * else: + * return NotImplemented # <<<<<<<<<<<<<< * + * def __mul__(self, n): */ - } + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_builtin_NotImplemented); + __pyx_r = __pyx_builtin_NotImplemented; + goto __pyx_L0; + } - /* "arrex/list.pyx":479 - * self._reallocate(max(2*self.size, newsize)) + /* "arrex/list.pyx":354 + * return self * - * memmove(self.ptr+start+view.len, self.ptr+stop, self.size-stop) # <<<<<<<<<<<<<< - * self.size = newsize - * - */ - (void)(memmove(((__pyx_v_self->ptr + __pyx_v_start) + __pyx_v_view.len), (__pyx_v_self->ptr + __pyx_v_stop), (__pyx_v_self->size - __pyx_v_stop))); - - /* "arrex/list.pyx":480 - * - * memmove(self.ptr+start+view.len, self.ptr+stop, self.size-stop) - * self.size = newsize # <<<<<<<<<<<<<< - * - * memcpy(self.ptr+start, view.buf, view.len) - */ - __pyx_v_self->size = __pyx_v_newsize; - - /* "arrex/list.pyx":470 - * stop *= self.dtype.dsize - * - * if view.len != stop-start: # <<<<<<<<<<<<<< - * if view.len % self.dtype.dsize: - * PyBuffer_Release(&view) + * def __add__(typedlist self, other): # <<<<<<<<<<<<<< + * ''' concatenation of two arrays ''' + * cdef typedlist result */ - } - /* "arrex/list.pyx":482 - * self.size = newsize - * - * memcpy(self.ptr+start, view.buf, view.len) # <<<<<<<<<<<<<< - * - * PyBuffer_Release(&view) - */ - (void)(memcpy((__pyx_v_self->ptr + __pyx_v_start), __pyx_v_view.buf, __pyx_v_view.len)); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("arrex.list.typedlist.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "arrex/list.pyx":484 - * memcpy(self.ptr+start, view.buf, view.len) - * - * PyBuffer_Release(&view) # <<<<<<<<<<<<<< +/* "arrex/list.pyx":385 + * return NotImplemented * - * elif hasattr(value, '__iter__'): + * def __mul__(self, n): # <<<<<<<<<<<<<< + * ''' duplicate the sequence by a certain number ''' + * #if isinstance(n, int): */ - PyBuffer_Release((&__pyx_v_view)); - /* "arrex/list.pyx":465 - * stop = start - * - * if PyObject_CheckBuffer(value): # <<<<<<<<<<<<<< - * PyObject_GetBuffer(value, &view, PyBUF_SIMPLE) - * start *= self.dtype.dsize - */ - goto __pyx_L7; - } +/* Python wrapper */ +static PyObject *__pyx_pw_5arrex_4list_9typedlist_23__mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_n); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5arrex_4list_9typedlist_22__mul__, " duplicate the sequence by a certain number "); +#if CYTHON_UPDATE_DESCRIPTOR_DOC +struct wrapperbase __pyx_wrapperbase_5arrex_4list_9typedlist_22__mul__; +#endif +static PyObject *__pyx_pw_5arrex_4list_9typedlist_23__mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_n) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__mul__ (wrapper)", 0); + __pyx_r = __pyx_pf_5arrex_4list_9typedlist_22__mul__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), ((PyObject *)__pyx_v_n)); - /* "arrex/list.pyx":486 - * PyBuffer_Release(&view) - * - * elif hasattr(value, '__iter__'): # <<<<<<<<<<<<<< - * self[index] = typedlist(value, self.dtype) - * - */ - __pyx_t_4 = __Pyx_HasAttr(__pyx_v_value, __pyx_n_u_iter); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 486, __pyx_L1_error) - __pyx_t_1 = (__pyx_t_4 != 0); - if (likely(__pyx_t_1)) { + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "arrex/list.pyx":487 - * - * elif hasattr(value, '__iter__'): - * self[index] = typedlist(value, self.dtype) # <<<<<<<<<<<<<< - * - * else: - */ - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 487, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_value); - __Pyx_INCREF(((PyObject *)__pyx_v_self->dtype)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self->dtype)); - PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_self->dtype)); - __pyx_t_9 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5arrex_4list_typedlist), __pyx_t_5, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 487, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_v_index, __pyx_t_9) < 0)) __PYX_ERR(0, 487, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; +static PyObject *__pyx_pf_5arrex_4list_9typedlist_22__mul__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_n) { + 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; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__mul__", 0); - /* "arrex/list.pyx":486 - * PyBuffer_Release(&view) - * - * elif hasattr(value, '__iter__'): # <<<<<<<<<<<<<< - * self[index] = typedlist(value, self.dtype) - * + /* "arrex/list.pyx":388 + * ''' duplicate the sequence by a certain number ''' + * #if isinstance(n, int): + * if PyNumber_Check(n): # <<<<<<<<<<<<<< + * return typedlist(bytes(self)*n, dtype=self.dtype) + * else: */ - goto __pyx_L7; - } + __pyx_t_1 = PyNumber_Check(__pyx_v_n); + if (__pyx_t_1) { - /* "arrex/list.pyx":490 - * - * else: - * raise IndexError('the assigned value must be a buffer or an iterable') # <<<<<<<<<<<<<< - * + /* "arrex/list.pyx":389 + * #if isinstance(n, int): + * if PyNumber_Check(n): + * return typedlist(bytes(self)*n, dtype=self.dtype) # <<<<<<<<<<<<<< * else: + * return NotImplemented */ - /*else*/ { - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 490, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_Raise(__pyx_t_9, 0, 0, 0); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __PYX_ERR(0, 490, __pyx_L1_error) - } - __pyx_L7:; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 389, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_v_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 389, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 389, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 389, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, ((PyObject *)__pyx_v_self->dtype)) < 0) __PYX_ERR(0, 389, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5arrex_4list_typedlist), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 389, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; - /* "arrex/list.pyx":456 - * self._setitem(self.ptr + self._index(index)*self.dtype.dsize, value) - * - * elif isinstance(index, slice): # <<<<<<<<<<<<<< - * if PySlice_Unpack(index, &start, &stop, &step): - * raise IndexError('incorrect slice') + /* "arrex/list.pyx":388 + * ''' duplicate the sequence by a certain number ''' + * #if isinstance(n, int): + * if PyNumber_Check(n): # <<<<<<<<<<<<<< + * return typedlist(bytes(self)*n, dtype=self.dtype) + * else: */ - goto __pyx_L3; } - /* "arrex/list.pyx":493 - * + /* "arrex/list.pyx":391 + * return typedlist(bytes(self)*n, dtype=self.dtype) * else: - * raise IndexError('index must be int or slice') # <<<<<<<<<<<<<< + * return NotImplemented # <<<<<<<<<<<<<< * - * def __delitem__(self, index): + * def capacity(self): */ /*else*/ { - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 493, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_Raise(__pyx_t_9, 0, 0, 0); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __PYX_ERR(0, 493, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_builtin_NotImplemented); + __pyx_r = __pyx_builtin_NotImplemented; + goto __pyx_L0; } - __pyx_L3:; - /* "arrex/list.pyx":447 - * raise IndexError('index must be int or slice') + /* "arrex/list.pyx":385 + * return NotImplemented * - * def __setitem__(self, index, value): # <<<<<<<<<<<<<< - * cdef Py_buffer view - * cdef Py_ssize_t start, stop, step + * def __mul__(self, n): # <<<<<<<<<<<<<< + * ''' duplicate the sequence by a certain number ''' + * #if isinstance(n, int): */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("arrex.list.typedlist.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("arrex.list.typedlist.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "arrex/list.pyx":495 - * raise IndexError('index must be int or slice') +/* "arrex/list.pyx":393 + * return NotImplemented * - * def __delitem__(self, index): # <<<<<<<<<<<<<< - * cdef Py_ssize_t start, stop, step + * def capacity(self): # <<<<<<<<<<<<<< + * ''' capacity() * */ /* Python wrapper */ -static int __pyx_pw_5arrex_4list_9typedlist_35__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ -static int __pyx_pw_5arrex_4list_9typedlist_35__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { - int __pyx_r; +static PyObject *__pyx_pw_5arrex_4list_9typedlist_25capacity(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5arrex_4list_9typedlist_24capacity, " capacity()\n\t\t\n\t\t\treturn the total number of elements that can be stored with the current allocated memory \n\t\t"); +static PyMethodDef __pyx_mdef_5arrex_4list_9typedlist_25capacity = {"capacity", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9typedlist_25capacity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_24capacity}; +static PyObject *__pyx_pw_5arrex_4list_9typedlist_25capacity(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__delitem__ (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_9typedlist_34__delitem__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), ((PyObject *)__pyx_v_index)); + __Pyx_RefNannySetupContext("capacity (wrapper)", 0); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("capacity", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "capacity", 0))) return NULL; + __pyx_r = __pyx_pf_5arrex_4list_9typedlist_24capacity(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_5arrex_4list_9typedlist_34__delitem__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_index) { - Py_ssize_t __pyx_v_start; - Py_ssize_t __pyx_v_stop; - Py_ssize_t __pyx_v_step; - int __pyx_r; +static PyObject *__pyx_pf_5arrex_4list_9typedlist_24capacity(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__delitem__", 0); + __Pyx_RefNannySetupContext("capacity", 0); - /* "arrex/list.pyx":498 - * cdef Py_ssize_t start, stop, step + /* "arrex/list.pyx":398 + * return the total number of elements that can be stored with the current allocated memory + * ''' + * return self.allocated // self.dtype.dsize # <<<<<<<<<<<<<< * - * if PyNumber_Check(index): # <<<<<<<<<<<<<< - * start = index - * stop = index+1 + * def shrink(self): */ - __pyx_t_1 = (PyNumber_Check(__pyx_v_index) != 0); - if (__pyx_t_1) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_FromSize_t((__pyx_v_self->allocated / __pyx_v_self->dtype->dsize)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 398, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "arrex/list.pyx":499 + /* "arrex/list.pyx":393 + * return NotImplemented + * + * def capacity(self): # <<<<<<<<<<<<<< + * ''' capacity() * - * if PyNumber_Check(index): - * start = index # <<<<<<<<<<<<<< - * stop = index+1 - * elif isinstance(index, slice): */ - __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 499, __pyx_L1_error) - __pyx_v_start = __pyx_t_2; - /* "arrex/list.pyx":500 + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("arrex.list.typedlist.capacity", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "arrex/list.pyx":400 + * return self.allocated // self.dtype.dsize + * + * def shrink(self): # <<<<<<<<<<<<<< + * ''' shrink() + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_5arrex_4list_9typedlist_27shrink(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5arrex_4list_9typedlist_26shrink, " shrink()\n\t\t\n\t\t\treallocate the array to have allocated the exact current size of the array \n\t\t"); +static PyMethodDef __pyx_mdef_5arrex_4list_9typedlist_27shrink = {"shrink", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9typedlist_27shrink, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_26shrink}; +static PyObject *__pyx_pw_5arrex_4list_9typedlist_27shrink(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("shrink (wrapper)", 0); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("shrink", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "shrink", 0))) return NULL; + __pyx_r = __pyx_pf_5arrex_4list_9typedlist_26shrink(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5arrex_4list_9typedlist_26shrink(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("shrink", 0); + + /* "arrex/list.pyx":405 + * reallocate the array to have allocated the exact current size of the array + * ''' + * self._reallocate(self.size) # <<<<<<<<<<<<<< + * + * def __len__(self): + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_reallocate(__pyx_v_self, __pyx_v_self->size); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 405, __pyx_L1_error) + + /* "arrex/list.pyx":400 + * return self.allocated // self.dtype.dsize + * + * def shrink(self): # <<<<<<<<<<<<<< + * ''' shrink() + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("arrex.list.typedlist.shrink", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "arrex/list.pyx":407 + * self._reallocate(self.size) + * + * def __len__(self): # <<<<<<<<<<<<<< + * ''' return the current amount of elements inserted ''' + * return self._len() + */ + +/* Python wrapper */ +static Py_ssize_t __pyx_pw_5arrex_4list_9typedlist_29__len__(PyObject *__pyx_v_self); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5arrex_4list_9typedlist_28__len__, " return the current amount of elements inserted "); +#if CYTHON_UPDATE_DESCRIPTOR_DOC +struct wrapperbase __pyx_wrapperbase_5arrex_4list_9typedlist_28__len__; +#endif +static Py_ssize_t __pyx_pw_5arrex_4list_9typedlist_29__len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_r = __pyx_pf_5arrex_4list_9typedlist_28__len__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_pf_5arrex_4list_9typedlist_28__len__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + size_t __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__len__", 0); + + /* "arrex/list.pyx":409 + * def __len__(self): + * ''' return the current amount of elements inserted ''' + * return self._len() # <<<<<<<<<<<<<< + * + * def __getitem__(self, index): + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_len(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 409, __pyx_L1_error) + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "arrex/list.pyx":407 + * self._reallocate(self.size) + * + * def __len__(self): # <<<<<<<<<<<<<< + * ''' return the current amount of elements inserted ''' + * return self._len() + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("arrex.list.typedlist.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "arrex/list.pyx":411 + * return self._len() + * + * def __getitem__(self, index): # <<<<<<<<<<<<<< + * ''' self[index] + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_5arrex_4list_9typedlist_31__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5arrex_4list_9typedlist_30__getitem__, " self[index]\n\t\t\n\t\t\tcurrently supports:\n\t\t\t\n\t\t\t\t- indices\n\t\t\t\t- negative indices\n\t\t\t\t- slices with step=1\n\t\t"); +#if CYTHON_UPDATE_DESCRIPTOR_DOC +struct wrapperbase __pyx_wrapperbase_5arrex_4list_9typedlist_30__getitem__; +#endif +static PyObject *__pyx_pw_5arrex_4list_9typedlist_31__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_r = __pyx_pf_5arrex_4list_9typedlist_30__getitem__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), ((PyObject *)__pyx_v_index)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5arrex_4list_9typedlist_30__getitem__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_index) { + struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_view = 0; + Py_ssize_t __pyx_v_start; + Py_ssize_t __pyx_v_stop; + Py_ssize_t __pyx_v_step; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "arrex/list.pyx":424 + * + * #if isinstance(index, int): + * if PyNumber_Check(index): # <<<<<<<<<<<<<< + * return self._getitem(self.ptr + self._index(index)*self.dtype.dsize) + * + */ + __pyx_t_1 = PyNumber_Check(__pyx_v_index); + if (__pyx_t_1) { + + /* "arrex/list.pyx":425 + * #if isinstance(index, int): * if PyNumber_Check(index): - * start = index - * stop = index+1 # <<<<<<<<<<<<<< + * return self._getitem(self.ptr + self._index(index)*self.dtype.dsize) # <<<<<<<<<<<<<< + * * elif isinstance(index, slice): - * if PySlice_Unpack(index, &start, &stop, &step): */ - __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_index, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 500, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_index(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1L))) __PYX_ERR(0, 425, __pyx_L1_error) + __pyx_t_3 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_getitem(__pyx_v_self, (__pyx_v_self->ptr + (__pyx_t_2 * __pyx_v_self->dtype->dsize))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 425, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 500, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_stop = __pyx_t_2; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; - /* "arrex/list.pyx":498 - * cdef Py_ssize_t start, stop, step + /* "arrex/list.pyx":424 * + * #if isinstance(index, int): * if PyNumber_Check(index): # <<<<<<<<<<<<<< - * start = index - * stop = index+1 + * return self._getitem(self.ptr + self._index(index)*self.dtype.dsize) + * */ - goto __pyx_L3; } - /* "arrex/list.pyx":501 - * start = index - * stop = index+1 + /* "arrex/list.pyx":427 + * return self._getitem(self.ptr + self._index(index)*self.dtype.dsize) + * * elif isinstance(index, slice): # <<<<<<<<<<<<<< * if PySlice_Unpack(index, &start, &stop, &step): * raise IndexError('incorrect slice') */ __pyx_t_1 = PySlice_Check(__pyx_v_index); - __pyx_t_4 = (__pyx_t_1 != 0); - if (likely(__pyx_t_4)) { + if (likely(__pyx_t_1)) { - /* "arrex/list.pyx":502 - * stop = index+1 + /* "arrex/list.pyx":428 + * * elif isinstance(index, slice): * if PySlice_Unpack(index, &start, &stop, &step): # <<<<<<<<<<<<<< * raise IndexError('incorrect slice') * if step != 1: */ - __pyx_t_5 = PySlice_Unpack(__pyx_v_index, (&__pyx_v_start), (&__pyx_v_stop), (&__pyx_v_step)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 502, __pyx_L1_error) - __pyx_t_4 = (__pyx_t_5 != 0); - if (unlikely(__pyx_t_4)) { + __pyx_t_4 = PySlice_Unpack(__pyx_v_index, (&__pyx_v_start), (&__pyx_v_stop), (&__pyx_v_step)); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 428, __pyx_L1_error) + __pyx_t_1 = (__pyx_t_4 != 0); + if (unlikely(__pyx_t_1)) { - /* "arrex/list.pyx":503 + /* "arrex/list.pyx":429 * elif isinstance(index, slice): * if PySlice_Unpack(index, &start, &stop, &step): * raise IndexError('incorrect slice') # <<<<<<<<<<<<<< * if step != 1: * raise IndexError('slice step is not supported') */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 503, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 429, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 503, __pyx_L1_error) + __PYX_ERR(0, 429, __pyx_L1_error) - /* "arrex/list.pyx":502 - * stop = index+1 + /* "arrex/list.pyx":428 + * * elif isinstance(index, slice): * if PySlice_Unpack(index, &start, &stop, &step): # <<<<<<<<<<<<<< * raise IndexError('incorrect slice') @@ -6314,30 +8620,30 @@ static int __pyx_pf_5arrex_4list_9typedlist_34__delitem__(struct __pyx_obj_5arre */ } - /* "arrex/list.pyx":504 + /* "arrex/list.pyx":430 * if PySlice_Unpack(index, &start, &stop, &step): * raise IndexError('incorrect slice') * if step != 1: # <<<<<<<<<<<<<< * raise IndexError('slice step is not supported') * PySlice_AdjustIndices(self._len(), &start, &stop, step) */ - __pyx_t_4 = ((__pyx_v_step != 1) != 0); - if (unlikely(__pyx_t_4)) { + __pyx_t_1 = (__pyx_v_step != 1); + if (unlikely(__pyx_t_1)) { - /* "arrex/list.pyx":505 + /* "arrex/list.pyx":431 * raise IndexError('incorrect slice') * if step != 1: * raise IndexError('slice step is not supported') # <<<<<<<<<<<<<< * PySlice_AdjustIndices(self._len(), &start, &stop, step) - * else: + * if stop < start: */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 505, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 431, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 505, __pyx_L1_error) + __PYX_ERR(0, 431, __pyx_L1_error) - /* "arrex/list.pyx":504 + /* "arrex/list.pyx":430 * if PySlice_Unpack(index, &start, &stop, &step): * raise IndexError('incorrect slice') * if step != 1: # <<<<<<<<<<<<<< @@ -6346,2916 +8652,3025 @@ static int __pyx_pf_5arrex_4list_9typedlist_34__delitem__(struct __pyx_obj_5arre */ } - /* "arrex/list.pyx":506 + /* "arrex/list.pyx":432 * if step != 1: * raise IndexError('slice step is not supported') * PySlice_AdjustIndices(self._len(), &start, &stop, step) # <<<<<<<<<<<<<< - * else: - * raise IndexError('index must be int or slice') + * if stop < start: + * stop = start */ - (void)(PySlice_AdjustIndices(((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_len(__pyx_v_self), (&__pyx_v_start), (&__pyx_v_stop), __pyx_v_step)); + __pyx_t_5 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_len(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 432, __pyx_L1_error) + (void)(PySlice_AdjustIndices(__pyx_t_5, (&__pyx_v_start), (&__pyx_v_stop), __pyx_v_step)); - /* "arrex/list.pyx":501 - * start = index - * stop = index+1 - * elif isinstance(index, slice): # <<<<<<<<<<<<<< - * if PySlice_Unpack(index, &start, &stop, &step): - * raise IndexError('incorrect slice') + /* "arrex/list.pyx":433 + * raise IndexError('slice step is not supported') + * PySlice_AdjustIndices(self._len(), &start, &stop, step) + * if stop < start: # <<<<<<<<<<<<<< + * stop = start + * */ - goto __pyx_L3; - } + __pyx_t_1 = (__pyx_v_stop < __pyx_v_start); + if (__pyx_t_1) { - /* "arrex/list.pyx":508 + /* "arrex/list.pyx":434 * PySlice_AdjustIndices(self._len(), &start, &stop, step) - * else: - * raise IndexError('index must be int or slice') # <<<<<<<<<<<<<< + * if stop < start: + * stop = start # <<<<<<<<<<<<<< * - * start *= self.dtype.dsize + * view = typedlist.__new__(typedlist) */ - /*else*/ { - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 508, __pyx_L1_error) - } - __pyx_L3:; + __pyx_v_stop = __pyx_v_start; - /* "arrex/list.pyx":510 - * raise IndexError('index must be int or slice') + /* "arrex/list.pyx":433 + * raise IndexError('slice step is not supported') + * PySlice_AdjustIndices(self._len(), &start, &stop, step) + * if stop < start: # <<<<<<<<<<<<<< + * stop = start * - * start *= self.dtype.dsize # <<<<<<<<<<<<<< - * stop *= self.dtype.dsize - * memmove(self.ptr+start, self.ptr+stop, self.size-stop) */ - __pyx_v_start = (__pyx_v_start * __pyx_v_self->dtype->dsize); + } - /* "arrex/list.pyx":511 + /* "arrex/list.pyx":436 + * stop = start * - * start *= self.dtype.dsize - * stop *= self.dtype.dsize # <<<<<<<<<<<<<< - * memmove(self.ptr+start, self.ptr+stop, self.size-stop) - * self.size = self.size + start - stop + * view = typedlist.__new__(typedlist) # <<<<<<<<<<<<<< + * view.ptr = self.ptr + start*self.dtype.dsize + * view.size = (stop-start)*self.dtype.dsize */ - __pyx_v_stop = (__pyx_v_stop * __pyx_v_self->dtype->dsize); + __pyx_t_3 = ((PyObject *)__pyx_tp_new_5arrex_4list_typedlist(((PyTypeObject *)__pyx_ptype_5arrex_4list_typedlist), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 436, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + __pyx_v_view = ((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_t_3); + __pyx_t_3 = 0; - /* "arrex/list.pyx":512 - * start *= self.dtype.dsize - * stop *= self.dtype.dsize - * memmove(self.ptr+start, self.ptr+stop, self.size-stop) # <<<<<<<<<<<<<< - * self.size = self.size + start - stop + /* "arrex/list.pyx":437 * + * view = typedlist.__new__(typedlist) + * view.ptr = self.ptr + start*self.dtype.dsize # <<<<<<<<<<<<<< + * view.size = (stop-start)*self.dtype.dsize + * view.allocated = view.size */ - (void)(memmove((__pyx_v_self->ptr + __pyx_v_start), (__pyx_v_self->ptr + __pyx_v_stop), (__pyx_v_self->size - __pyx_v_stop))); + __pyx_v_view->ptr = (__pyx_v_self->ptr + (__pyx_v_start * __pyx_v_self->dtype->dsize)); - /* "arrex/list.pyx":513 - * stop *= self.dtype.dsize - * memmove(self.ptr+start, self.ptr+stop, self.size-stop) - * self.size = self.size + start - stop # <<<<<<<<<<<<<< + /* "arrex/list.pyx":438 + * view = typedlist.__new__(typedlist) + * view.ptr = self.ptr + start*self.dtype.dsize + * view.size = (stop-start)*self.dtype.dsize # <<<<<<<<<<<<<< + * view.allocated = view.size + * view.owner = self.owner + */ + __pyx_v_view->size = ((__pyx_v_stop - __pyx_v_start) * __pyx_v_self->dtype->dsize); + + /* "arrex/list.pyx":439 + * view.ptr = self.ptr + start*self.dtype.dsize + * view.size = (stop-start)*self.dtype.dsize + * view.allocated = view.size # <<<<<<<<<<<<<< + * view.owner = self.owner + * view.dtype = self.dtype + */ + __pyx_t_5 = __pyx_v_view->size; + __pyx_v_view->allocated = __pyx_t_5; + + /* "arrex/list.pyx":440 + * view.size = (stop-start)*self.dtype.dsize + * view.allocated = view.size + * view.owner = self.owner # <<<<<<<<<<<<<< + * view.dtype = self.dtype + * return view + */ + __pyx_t_3 = __pyx_v_self->owner; + __Pyx_INCREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_view->owner); + __Pyx_DECREF(__pyx_v_view->owner); + __pyx_v_view->owner = __pyx_t_3; + __pyx_t_3 = 0; + + /* "arrex/list.pyx":441 + * view.allocated = view.size + * view.owner = self.owner + * view.dtype = self.dtype # <<<<<<<<<<<<<< + * return view * + */ + __pyx_t_3 = ((PyObject *)__pyx_v_self->dtype); + __Pyx_INCREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF((PyObject *)__pyx_v_view->dtype); + __Pyx_DECREF((PyObject *)__pyx_v_view->dtype); + __pyx_v_view->dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "arrex/list.pyx":442 + * view.owner = self.owner + * view.dtype = self.dtype + * return view # <<<<<<<<<<<<<< * + * else: */ - __pyx_v_self->size = ((__pyx_v_self->size + __pyx_v_start) - __pyx_v_stop); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_view); + __pyx_r = ((PyObject *)__pyx_v_view); + goto __pyx_L0; - /* "arrex/list.pyx":495 - * raise IndexError('index must be int or slice') + /* "arrex/list.pyx":427 + * return self._getitem(self.ptr + self._index(index)*self.dtype.dsize) * - * def __delitem__(self, index): # <<<<<<<<<<<<<< - * cdef Py_ssize_t start, stop, step + * elif isinstance(index, slice): # <<<<<<<<<<<<<< + * if PySlice_Unpack(index, &start, &stop, &step): + * raise IndexError('incorrect slice') + */ + } + + /* "arrex/list.pyx":445 + * + * else: + * raise IndexError('index must be int or slice') # <<<<<<<<<<<<<< + * + * def __setitem__(self, index, value): + */ + /*else*/ { + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 445, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 445, __pyx_L1_error) + } + + /* "arrex/list.pyx":411 + * return self._len() + * + * def __getitem__(self, index): # <<<<<<<<<<<<<< + * ''' self[index] * */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("arrex.list.typedlist.__delitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __Pyx_AddTraceback("arrex.list.typedlist.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_view); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "arrex/list.pyx":516 - * +/* "arrex/list.pyx":447 + * raise IndexError('index must be int or slice') * - * def __iter__(self): # <<<<<<<<<<<<<< - * ''' yield successive elements in the list ''' - * cdef arrayiter it = arrayiter.__new__(arrayiter) + * def __setitem__(self, index, value): # <<<<<<<<<<<<<< + * cdef Py_buffer view + * cdef Py_ssize_t start, stop, step */ /* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_37__iter__(PyObject *__pyx_v_self); /*proto*/ -static char __pyx_doc_5arrex_4list_9typedlist_36__iter__[] = " yield successive elements in the list "; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_5arrex_4list_9typedlist_36__iter__; -#endif -static PyObject *__pyx_pw_5arrex_4list_9typedlist_37__iter__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; +static int __pyx_pw_5arrex_4list_9typedlist_33__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_5arrex_4list_9typedlist_33__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_9typedlist_36__iter__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_r = __pyx_pf_5arrex_4list_9typedlist_32__setitem__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5arrex_4list_9typedlist_36__iter__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self) { - struct __pyx_obj_5arrex_4list_arrayiter *__pyx_v_it = 0; - PyObject *__pyx_r = NULL; +static int __pyx_pf_5arrex_4list_9typedlist_32__setitem__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + Py_buffer __pyx_v_view; + Py_ssize_t __pyx_v_start; + Py_ssize_t __pyx_v_stop; + Py_ssize_t __pyx_v_step; + size_t __pyx_v_newsize; + int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + size_t __pyx_t_6; + size_t __pyx_t_7; + PyObject *__pyx_t_8 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__iter__", 0); + __Pyx_RefNannySetupContext("__setitem__", 0); - /* "arrex/list.pyx":518 - * def __iter__(self): - * ''' yield successive elements in the list ''' - * cdef arrayiter it = arrayiter.__new__(arrayiter) # <<<<<<<<<<<<<< - * it.array = self - * it.position = 0 + /* "arrex/list.pyx":453 + * + * #if isinstance(index, int): + * if PyNumber_Check(index): # <<<<<<<<<<<<<< + * self._setitem(self.ptr + self._index(index)*self.dtype.dsize, value) + * */ - __pyx_t_1 = ((PyObject *)__pyx_tp_new_5arrex_4list_arrayiter(((PyTypeObject *)__pyx_ptype_5arrex_4list_arrayiter), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 518, __pyx_L1_error) - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_v_it = ((struct __pyx_obj_5arrex_4list_arrayiter *)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Check(__pyx_v_index); + if (__pyx_t_1) { - /* "arrex/list.pyx":519 - * ''' yield successive elements in the list ''' - * cdef arrayiter it = arrayiter.__new__(arrayiter) - * it.array = self # <<<<<<<<<<<<<< - * it.position = 0 - * return it + /* "arrex/list.pyx":454 + * #if isinstance(index, int): + * if PyNumber_Check(index): + * self._setitem(self.ptr + self._index(index)*self.dtype.dsize, value) # <<<<<<<<<<<<<< + * + * elif isinstance(index, slice): */ - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - __Pyx_GOTREF(__pyx_v_it->array); - __Pyx_DECREF(((PyObject *)__pyx_v_it->array)); - __pyx_v_it->array = __pyx_v_self; + __pyx_t_2 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_index(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1L))) __PYX_ERR(0, 454, __pyx_L1_error) + __pyx_t_3 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_setitem(__pyx_v_self, (__pyx_v_self->ptr + (__pyx_t_2 * __pyx_v_self->dtype->dsize)), __pyx_v_value); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 454, __pyx_L1_error) - /* "arrex/list.pyx":520 - * cdef arrayiter it = arrayiter.__new__(arrayiter) - * it.array = self - * it.position = 0 # <<<<<<<<<<<<<< - * return it + /* "arrex/list.pyx":453 + * + * #if isinstance(index, int): + * if PyNumber_Check(index): # <<<<<<<<<<<<<< + * self._setitem(self.ptr + self._index(index)*self.dtype.dsize, value) * */ - __pyx_v_it->position = 0; + goto __pyx_L3; + } - /* "arrex/list.pyx":521 - * it.array = self - * it.position = 0 - * return it # <<<<<<<<<<<<<< + /* "arrex/list.pyx":456 + * self._setitem(self.ptr + self._index(index)*self.dtype.dsize, value) * - * def __repr__(self): + * elif isinstance(index, slice): # <<<<<<<<<<<<<< + * if PySlice_Unpack(index, &start, &stop, &step): + * raise IndexError('incorrect slice') */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_it)); - __pyx_r = ((PyObject *)__pyx_v_it); - goto __pyx_L0; + __pyx_t_1 = PySlice_Check(__pyx_v_index); + if (likely(__pyx_t_1)) { - /* "arrex/list.pyx":516 - * + /* "arrex/list.pyx":457 * - * def __iter__(self): # <<<<<<<<<<<<<< - * ''' yield successive elements in the list ''' - * cdef arrayiter it = arrayiter.__new__(arrayiter) + * elif isinstance(index, slice): + * if PySlice_Unpack(index, &start, &stop, &step): # <<<<<<<<<<<<<< + * raise IndexError('incorrect slice') + * if step != 1: */ + __pyx_t_3 = PySlice_Unpack(__pyx_v_index, (&__pyx_v_start), (&__pyx_v_stop), (&__pyx_v_step)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 457, __pyx_L1_error) + __pyx_t_1 = (__pyx_t_3 != 0); + if (unlikely(__pyx_t_1)) { - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("arrex.list.typedlist.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_it); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "arrex/list.pyx":458 + * elif isinstance(index, slice): + * if PySlice_Unpack(index, &start, &stop, &step): + * raise IndexError('incorrect slice') # <<<<<<<<<<<<<< + * if step != 1: + * raise IndexError('slice step is not supported') + */ + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 458, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 458, __pyx_L1_error) -/* "arrex/list.pyx":523 - * return it + /* "arrex/list.pyx":457 * - * def __repr__(self): # <<<<<<<<<<<<<< - * cdef size_t i - * text = 'typedlist([' + * elif isinstance(index, slice): + * if PySlice_Unpack(index, &start, &stop, &step): # <<<<<<<<<<<<<< + * raise IndexError('incorrect slice') + * if step != 1: */ + } -/* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_39__repr__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_39__repr__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_9typedlist_38__repr__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self)); + /* "arrex/list.pyx":459 + * if PySlice_Unpack(index, &start, &stop, &step): + * raise IndexError('incorrect slice') + * if step != 1: # <<<<<<<<<<<<<< + * raise IndexError('slice step is not supported') + * PySlice_AdjustIndices(self._len(), &start, &stop, step) + */ + __pyx_t_1 = (__pyx_v_step != 1); + if (unlikely(__pyx_t_1)) { - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "arrex/list.pyx":460 + * raise IndexError('incorrect slice') + * if step != 1: + * raise IndexError('slice step is not supported') # <<<<<<<<<<<<<< + * PySlice_AdjustIndices(self._len(), &start, &stop, step) + * if stop < start: + */ + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 460, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 460, __pyx_L1_error) -static PyObject *__pyx_pf_5arrex_4list_9typedlist_38__repr__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self) { - size_t __pyx_v_i; - PyObject *__pyx_v_text = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - size_t __pyx_t_1; - size_t __pyx_t_2; - size_t __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__repr__", 0); + /* "arrex/list.pyx":459 + * if PySlice_Unpack(index, &start, &stop, &step): + * raise IndexError('incorrect slice') + * if step != 1: # <<<<<<<<<<<<<< + * raise IndexError('slice step is not supported') + * PySlice_AdjustIndices(self._len(), &start, &stop, step) + */ + } - /* "arrex/list.pyx":525 - * def __repr__(self): - * cdef size_t i - * text = 'typedlist([' # <<<<<<<<<<<<<< - * for i in range(self._len()): - * if i: text += ', ' + /* "arrex/list.pyx":461 + * if step != 1: + * raise IndexError('slice step is not supported') + * PySlice_AdjustIndices(self._len(), &start, &stop, step) # <<<<<<<<<<<<<< + * if stop < start: + * stop = start */ - __Pyx_INCREF(__pyx_kp_u_typedlist); - __pyx_v_text = __pyx_kp_u_typedlist; + __pyx_t_5 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_len(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 461, __pyx_L1_error) + (void)(PySlice_AdjustIndices(__pyx_t_5, (&__pyx_v_start), (&__pyx_v_stop), __pyx_v_step)); - /* "arrex/list.pyx":526 - * cdef size_t i - * text = 'typedlist([' - * for i in range(self._len()): # <<<<<<<<<<<<<< - * if i: text += ', ' - * text += repr(self._getitem(self.ptr + i*self.dtype.dsize)) + /* "arrex/list.pyx":462 + * raise IndexError('slice step is not supported') + * PySlice_AdjustIndices(self._len(), &start, &stop, step) + * if stop < start: # <<<<<<<<<<<<<< + * stop = start + * */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_len(__pyx_v_self); - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; + __pyx_t_1 = (__pyx_v_stop < __pyx_v_start); + if (__pyx_t_1) { - /* "arrex/list.pyx":527 - * text = 'typedlist([' - * for i in range(self._len()): - * if i: text += ', ' # <<<<<<<<<<<<<< - * text += repr(self._getitem(self.ptr + i*self.dtype.dsize)) - * text += '])' + /* "arrex/list.pyx":463 + * PySlice_AdjustIndices(self._len(), &start, &stop, step) + * if stop < start: + * stop = start # <<<<<<<<<<<<<< + * + * if PyObject_CheckBuffer(value): */ - __pyx_t_4 = (__pyx_v_i != 0); - if (__pyx_t_4) { - __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_text, __pyx_kp_u__12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 527, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_5); - __pyx_t_5 = 0; - } + __pyx_v_stop = __pyx_v_start; - /* "arrex/list.pyx":528 - * for i in range(self._len()): - * if i: text += ', ' - * text += repr(self._getitem(self.ptr + i*self.dtype.dsize)) # <<<<<<<<<<<<<< - * text += '])' - * return text + /* "arrex/list.pyx":462 + * raise IndexError('slice step is not supported') + * PySlice_AdjustIndices(self._len(), &start, &stop, step) + * if stop < start: # <<<<<<<<<<<<<< + * stop = start + * */ - __pyx_t_5 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_getitem(__pyx_v_self, (__pyx_v_self->ptr + (__pyx_v_i * __pyx_v_self->dtype->dsize))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 528, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_Repr(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 528, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_text, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 528, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_5); - __pyx_t_5 = 0; - } + } - /* "arrex/list.pyx":529 - * if i: text += ', ' - * text += repr(self._getitem(self.ptr + i*self.dtype.dsize)) - * text += '])' # <<<<<<<<<<<<<< - * return text + /* "arrex/list.pyx":465 + * stop = start * + * if PyObject_CheckBuffer(value): # <<<<<<<<<<<<<< + * PyObject_GetBuffer(value, &view, PyBUF_SIMPLE) + * start *= self.dtype.dsize */ - __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_text, __pyx_kp_u__13); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 529, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_5); - __pyx_t_5 = 0; + __pyx_t_1 = PyObject_CheckBuffer(__pyx_v_value); + if (__pyx_t_1) { - /* "arrex/list.pyx":530 - * text += repr(self._getitem(self.ptr + i*self.dtype.dsize)) - * text += '])' - * return text # <<<<<<<<<<<<<< + /* "arrex/list.pyx":466 * - * def __eq__(self, other): + * if PyObject_CheckBuffer(value): + * PyObject_GetBuffer(value, &view, PyBUF_SIMPLE) # <<<<<<<<<<<<<< + * start *= self.dtype.dsize + * stop *= self.dtype.dsize */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_text); - __pyx_r = __pyx_v_text; - goto __pyx_L0; + __pyx_t_3 = PyObject_GetBuffer(__pyx_v_value, (&__pyx_v_view), PyBUF_SIMPLE); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 466, __pyx_L1_error) - /* "arrex/list.pyx":523 - * return it + /* "arrex/list.pyx":467 + * if PyObject_CheckBuffer(value): + * PyObject_GetBuffer(value, &view, PyBUF_SIMPLE) + * start *= self.dtype.dsize # <<<<<<<<<<<<<< + * stop *= self.dtype.dsize * - * def __repr__(self): # <<<<<<<<<<<<<< - * cdef size_t i - * text = 'typedlist([' */ + __pyx_v_start = (__pyx_v_start * __pyx_v_self->dtype->dsize); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("arrex.list.typedlist.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_text); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "arrex/list.pyx":468 + * PyObject_GetBuffer(value, &view, PyBUF_SIMPLE) + * start *= self.dtype.dsize + * stop *= self.dtype.dsize # <<<<<<<<<<<<<< + * + * if view.len != stop-start: + */ + __pyx_v_stop = (__pyx_v_stop * __pyx_v_self->dtype->dsize); -/* "arrex/list.pyx":532 - * return text + /* "arrex/list.pyx":470 + * stop *= self.dtype.dsize * - * def __eq__(self, other): # <<<<<<<<<<<<<< - * ''' return True if other is a typedlist and its buffer byte contents is the same ''' - * if not isinstance(other, typedlist): return False + * if view.len != stop-start: # <<<<<<<<<<<<<< + * if view.len % self.dtype.dsize: + * PyBuffer_Release(&view) */ + __pyx_t_1 = (__pyx_v_view.len != (__pyx_v_stop - __pyx_v_start)); + if (__pyx_t_1) { -/* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_41__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static char __pyx_doc_5arrex_4list_9typedlist_40__eq__[] = " return True if other is a typedlist and its buffer byte contents is the same "; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_5arrex_4list_9typedlist_40__eq__; -#endif -static PyObject *__pyx_pw_5arrex_4list_9typedlist_41__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__eq__ (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_9typedlist_40__eq__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), ((PyObject *)__pyx_v_other)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "arrex/list.pyx":471 + * + * if view.len != stop-start: + * if view.len % self.dtype.dsize: # <<<<<<<<<<<<<< + * PyBuffer_Release(&view) + * raise TypeError('the given buffer must have a byte size multiple of dtype size') + */ + __pyx_t_1 = ((__pyx_v_view.len % __pyx_v_self->dtype->dsize) != 0); + if (unlikely(__pyx_t_1)) { -static PyObject *__pyx_pf_5arrex_4list_9typedlist_40__eq__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_other) { - struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_o = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__eq__", 0); + /* "arrex/list.pyx":472 + * if view.len != stop-start: + * if view.len % self.dtype.dsize: + * PyBuffer_Release(&view) # <<<<<<<<<<<<<< + * raise TypeError('the given buffer must have a byte size multiple of dtype size') + * + */ + PyBuffer_Release((&__pyx_v_view)); - /* "arrex/list.pyx":534 - * def __eq__(self, other): - * ''' return True if other is a typedlist and its buffer byte contents is the same ''' - * if not isinstance(other, typedlist): return False # <<<<<<<<<<<<<< - * cdef typedlist o = other - * if self.size != o.size: return False + /* "arrex/list.pyx":473 + * if view.len % self.dtype.dsize: + * PyBuffer_Release(&view) + * raise TypeError('the given buffer must have a byte size multiple of dtype size') # <<<<<<<<<<<<<< + * + * newsize = self.size + view.len + start - stop */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_other, __pyx_ptype_5arrex_4list_typedlist); - __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); - if (__pyx_t_2) { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_False); - __pyx_r = Py_False; - goto __pyx_L0; - } + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 473, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 473, __pyx_L1_error) - /* "arrex/list.pyx":535 - * ''' return True if other is a typedlist and its buffer byte contents is the same ''' - * if not isinstance(other, typedlist): return False - * cdef typedlist o = other # <<<<<<<<<<<<<< - * if self.size != o.size: return False - * return 0 == memcmp(self.ptr, o.ptr, self.size) + /* "arrex/list.pyx":471 + * + * if view.len != stop-start: + * if view.len % self.dtype.dsize: # <<<<<<<<<<<<<< + * PyBuffer_Release(&view) + * raise TypeError('the given buffer must have a byte size multiple of dtype size') */ - if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_5arrex_4list_typedlist))))) __PYX_ERR(0, 535, __pyx_L1_error) - __pyx_t_3 = __pyx_v_other; - __Pyx_INCREF(__pyx_t_3); - __pyx_v_o = ((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_t_3); - __pyx_t_3 = 0; + } - /* "arrex/list.pyx":536 - * if not isinstance(other, typedlist): return False - * cdef typedlist o = other - * if self.size != o.size: return False # <<<<<<<<<<<<<< - * return 0 == memcmp(self.ptr, o.ptr, self.size) + /* "arrex/list.pyx":475 + * raise TypeError('the given buffer must have a byte size multiple of dtype size') * + * newsize = self.size + view.len + start - stop # <<<<<<<<<<<<<< + * if newsize > self.allocated: + * self._reallocate(max(2*self.size, newsize)) */ - __pyx_t_2 = ((__pyx_v_self->size != __pyx_v_o->size) != 0); - if (__pyx_t_2) { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_False); - __pyx_r = Py_False; - goto __pyx_L0; - } + __pyx_v_newsize = (((__pyx_v_self->size + __pyx_v_view.len) + __pyx_v_start) - __pyx_v_stop); - /* "arrex/list.pyx":537 - * cdef typedlist o = other - * if self.size != o.size: return False - * return 0 == memcmp(self.ptr, o.ptr, self.size) # <<<<<<<<<<<<<< + /* "arrex/list.pyx":476 + * + * newsize = self.size + view.len + start - stop + * if newsize > self.allocated: # <<<<<<<<<<<<<< + * self._reallocate(max(2*self.size, newsize)) * - * def __copy__(self): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyBool_FromLong((0 == memcmp(__pyx_v_self->ptr, __pyx_v_o->ptr, __pyx_v_self->size))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; + __pyx_t_1 = (__pyx_v_newsize > __pyx_v_self->allocated); + if (__pyx_t_1) { - /* "arrex/list.pyx":532 - * return text + /* "arrex/list.pyx":477 + * newsize = self.size + view.len + start - stop + * if newsize > self.allocated: + * self._reallocate(max(2*self.size, newsize)) # <<<<<<<<<<<<<< * - * def __eq__(self, other): # <<<<<<<<<<<<<< - * ''' return True if other is a typedlist and its buffer byte contents is the same ''' - * if not isinstance(other, typedlist): return False + * memmove(self.ptr+start+view.len, self.ptr+stop, self.size-stop) */ + __pyx_t_5 = __pyx_v_newsize; + __pyx_t_6 = (2 * __pyx_v_self->size); + if ((__pyx_t_5 > __pyx_t_6)) { + __pyx_t_7 = __pyx_t_5; + } else { + __pyx_t_7 = __pyx_t_6; + } + __pyx_t_3 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_reallocate(__pyx_v_self, __pyx_t_7); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 477, __pyx_L1_error) - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("arrex.list.typedlist.__eq__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_o); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "arrex/list.pyx":476 + * + * newsize = self.size + view.len + start - stop + * if newsize > self.allocated: # <<<<<<<<<<<<<< + * self._reallocate(max(2*self.size, newsize)) + * + */ + } -/* "arrex/list.pyx":539 - * return 0 == memcmp(self.ptr, o.ptr, self.size) + /* "arrex/list.pyx":479 + * self._reallocate(max(2*self.size, newsize)) + * + * memmove(self.ptr+start+view.len, self.ptr+stop, self.size-stop) # <<<<<<<<<<<<<< + * self.size = newsize * - * def __copy__(self): # <<<<<<<<<<<<<< - * ''' shallow copy will create a copy of that array referencing the same buffer ''' - * return self[:] */ + (void)(memmove(((__pyx_v_self->ptr + __pyx_v_start) + __pyx_v_view.len), (__pyx_v_self->ptr + __pyx_v_stop), (__pyx_v_self->size - __pyx_v_stop))); -/* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_43__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5arrex_4list_9typedlist_42__copy__[] = " shallow copy will create a copy of that array referencing the same buffer "; -static PyObject *__pyx_pw_5arrex_4list_9typedlist_43__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__copy__ (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_9typedlist_42__copy__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self)); + /* "arrex/list.pyx":480 + * + * memmove(self.ptr+start+view.len, self.ptr+stop, self.size-stop) + * self.size = newsize # <<<<<<<<<<<<<< + * + * memcpy(self.ptr+start, view.buf, view.len) + */ + __pyx_v_self->size = __pyx_v_newsize; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "arrex/list.pyx":470 + * stop *= self.dtype.dsize + * + * if view.len != stop-start: # <<<<<<<<<<<<<< + * if view.len % self.dtype.dsize: + * PyBuffer_Release(&view) + */ + } -static PyObject *__pyx_pf_5arrex_4list_9typedlist_42__copy__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self) { - 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("__copy__", 0); + /* "arrex/list.pyx":482 + * self.size = newsize + * + * memcpy(self.ptr+start, view.buf, view.len) # <<<<<<<<<<<<<< + * + * PyBuffer_Release(&view) + */ + (void)(memcpy((__pyx_v_self->ptr + __pyx_v_start), __pyx_v_view.buf, __pyx_v_view.len)); - /* "arrex/list.pyx":541 - * def __copy__(self): - * ''' shallow copy will create a copy of that array referencing the same buffer ''' - * return self[:] # <<<<<<<<<<<<<< + /* "arrex/list.pyx":484 + * memcpy(self.ptr+start, view.buf, view.len) * - * def __deepcopy__(self, memo): + * PyBuffer_Release(&view) # <<<<<<<<<<<<<< + * + * elif hasattr(value, '__iter__'): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetSlice(((PyObject *)__pyx_v_self), 0, 0, NULL, NULL, &__pyx_slice__14, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 541, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + PyBuffer_Release((&__pyx_v_view)); - /* "arrex/list.pyx":539 - * return 0 == memcmp(self.ptr, o.ptr, self.size) + /* "arrex/list.pyx":465 + * stop = start * - * def __copy__(self): # <<<<<<<<<<<<<< - * ''' shallow copy will create a copy of that array referencing the same buffer ''' - * return self[:] + * if PyObject_CheckBuffer(value): # <<<<<<<<<<<<<< + * PyObject_GetBuffer(value, &view, PyBUF_SIMPLE) + * start *= self.dtype.dsize */ + goto __pyx_L7; + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("arrex.list.typedlist.__copy__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "arrex/list.pyx":486 + * PyBuffer_Release(&view) + * + * elif hasattr(value, '__iter__'): # <<<<<<<<<<<<<< + * self[index] = typedlist(value, self.dtype) + * + */ + __pyx_t_1 = __Pyx_HasAttr(__pyx_v_value, __pyx_n_u_iter); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 486, __pyx_L1_error) + if (likely(__pyx_t_1)) { -/* "arrex/list.pyx":543 - * return self[:] + /* "arrex/list.pyx":487 * - * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< - * ''' deep recursive copy, will duplicate the viewed data in the underlying buffer ''' - * return typedlist(PyBytes_FromStringAndSize(self.ptr, self.size), self.dtype) + * elif hasattr(value, '__iter__'): + * self[index] = typedlist(value, self.dtype) # <<<<<<<<<<<<<< + * + * else: */ + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 487, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_value); + __Pyx_INCREF((PyObject *)__pyx_v_self->dtype); + __Pyx_GIVEREF((PyObject *)__pyx_v_self->dtype); + PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_self->dtype)); + __pyx_t_8 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5arrex_4list_typedlist), __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 487, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_v_index, __pyx_t_8) < 0))) __PYX_ERR(0, 487, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; -/* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_45__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/ -static char __pyx_doc_5arrex_4list_9typedlist_44__deepcopy__[] = " deep recursive copy, will duplicate the viewed data in the underlying buffer "; -static PyObject *__pyx_pw_5arrex_4list_9typedlist_45__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_9typedlist_44__deepcopy__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), ((PyObject *)__pyx_v_memo)); + /* "arrex/list.pyx":486 + * PyBuffer_Release(&view) + * + * elif hasattr(value, '__iter__'): # <<<<<<<<<<<<<< + * self[index] = typedlist(value, self.dtype) + * + */ + goto __pyx_L7; + } - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "arrex/list.pyx":490 + * + * else: + * raise IndexError('the assigned value must be a buffer or an iterable') # <<<<<<<<<<<<<< + * + * else: + */ + /*else*/ { + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 490, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(0, 490, __pyx_L1_error) + } + __pyx_L7:; -static PyObject *__pyx_pf_5arrex_4list_9typedlist_44__deepcopy__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_memo) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__deepcopy__", 0); + /* "arrex/list.pyx":456 + * self._setitem(self.ptr + self._index(index)*self.dtype.dsize, value) + * + * elif isinstance(index, slice): # <<<<<<<<<<<<<< + * if PySlice_Unpack(index, &start, &stop, &step): + * raise IndexError('incorrect slice') + */ + goto __pyx_L3; + } - /* "arrex/list.pyx":545 - * def __deepcopy__(self, memo): - * ''' deep recursive copy, will duplicate the viewed data in the underlying buffer ''' - * return typedlist(PyBytes_FromStringAndSize(self.ptr, self.size), self.dtype) # <<<<<<<<<<<<<< + /* "arrex/list.pyx":493 * - * def __reduce_ex__(self, protocol): + * else: + * raise IndexError('index must be int or slice') # <<<<<<<<<<<<<< + * + * def __delitem__(self, index): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyBytes_FromStringAndSize(((char *)__pyx_v_self->ptr), __pyx_v_self->size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 545, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 545, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_v_self->dtype)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self->dtype)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->dtype)); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5arrex_4list_typedlist), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 545, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + /*else*/ { + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 493, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(0, 493, __pyx_L1_error) + } + __pyx_L3:; - /* "arrex/list.pyx":543 - * return self[:] + /* "arrex/list.pyx":447 + * raise IndexError('index must be int or slice') * - * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< - * ''' deep recursive copy, will duplicate the viewed data in the underlying buffer ''' - * return typedlist(PyBytes_FromStringAndSize(self.ptr, self.size), self.dtype) + * def __setitem__(self, index, value): # <<<<<<<<<<<<<< + * cdef Py_buffer view + * cdef Py_ssize_t start, stop, step */ /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("arrex.list.typedlist.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("arrex.list.typedlist.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "arrex/list.pyx":547 - * return typedlist(PyBytes_FromStringAndSize(self.ptr, self.size), self.dtype) +/* "arrex/list.pyx":495 + * raise IndexError('index must be int or slice') + * + * def __delitem__(self, index): # <<<<<<<<<<<<<< + * cdef Py_ssize_t start, stop, step * - * def __reduce_ex__(self, protocol): # <<<<<<<<<<<<<< - * ''' serialization protocol ''' - * cdef Py_buffer view */ /* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_47__reduce_ex__(PyObject *__pyx_v_self, PyObject *__pyx_v_protocol); /*proto*/ -static char __pyx_doc_5arrex_4list_9typedlist_46__reduce_ex__[] = " serialization protocol "; -static PyObject *__pyx_pw_5arrex_4list_9typedlist_47__reduce_ex__(PyObject *__pyx_v_self, PyObject *__pyx_v_protocol) { - PyObject *__pyx_r = 0; +static int __pyx_pw_5arrex_4list_9typedlist_35__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ +static int __pyx_pw_5arrex_4list_9typedlist_35__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_ex__ (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_9typedlist_46__reduce_ex__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), ((PyObject *)__pyx_v_protocol)); + __Pyx_RefNannySetupContext("__delitem__ (wrapper)", 0); + __pyx_r = __pyx_pf_5arrex_4list_9typedlist_34__delitem__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), ((PyObject *)__pyx_v_index)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5arrex_4list_9typedlist_46__reduce_ex__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_protocol) { - Py_buffer __pyx_v_view; - PyObject *__pyx_v_stuff = NULL; - PyObject *__pyx_r = NULL; +static int __pyx_pf_5arrex_4list_9typedlist_34__delitem__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_index) { + Py_ssize_t __pyx_v_start; + Py_ssize_t __pyx_v_stop; + Py_ssize_t __pyx_v_step; + int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + size_t __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_ex__", 0); + __Pyx_RefNannySetupContext("__delitem__", 0); - /* "arrex/list.pyx":551 - * cdef Py_buffer view + /* "arrex/list.pyx":498 + * cdef Py_ssize_t start, stop, step * - * if protocol >= 5: # <<<<<<<<<<<<<< - * if not PyObject_CheckBuffer(self.owner): - * raise RuntimeError("the buffer owner doens't implement the buffer protocol") + * if PyNumber_Check(index): # <<<<<<<<<<<<<< + * start = index + * stop = index+1 */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_protocol, __pyx_int_5, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 551, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 551, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + __pyx_t_1 = PyNumber_Check(__pyx_v_index); + if (__pyx_t_1) { - /* "arrex/list.pyx":552 + /* "arrex/list.pyx":499 * - * if protocol >= 5: - * if not PyObject_CheckBuffer(self.owner): # <<<<<<<<<<<<<< - * raise RuntimeError("the buffer owner doens't implement the buffer protocol") - * PyObject_GetBuffer(self.owner, &view, PyBUF_SIMPLE) + * if PyNumber_Check(index): + * start = index # <<<<<<<<<<<<<< + * stop = index+1 + * elif isinstance(index, slice): */ - __pyx_t_1 = __pyx_v_self->owner; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((!(PyObject_CheckBuffer(__pyx_t_1) != 0)) != 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(__pyx_t_2)) { + __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 499, __pyx_L1_error) + __pyx_v_start = __pyx_t_2; - /* "arrex/list.pyx":553 - * if protocol >= 5: - * if not PyObject_CheckBuffer(self.owner): - * raise RuntimeError("the buffer owner doens't implement the buffer protocol") # <<<<<<<<<<<<<< - * PyObject_GetBuffer(self.owner, &view, PyBUF_SIMPLE) - * stuff = ( + /* "arrex/list.pyx":500 + * if PyNumber_Check(index): + * start = index + * stop = index+1 # <<<<<<<<<<<<<< + * elif isinstance(index, slice): + * if PySlice_Unpack(index, &start, &stop, &step): */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 553, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 553, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_index, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 500, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 500, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_stop = __pyx_t_2; - /* "arrex/list.pyx":552 + /* "arrex/list.pyx":498 + * cdef Py_ssize_t start, stop, step * - * if protocol >= 5: - * if not PyObject_CheckBuffer(self.owner): # <<<<<<<<<<<<<< - * raise RuntimeError("the buffer owner doens't implement the buffer protocol") - * PyObject_GetBuffer(self.owner, &view, PyBUF_SIMPLE) - */ - } - - /* "arrex/list.pyx":554 - * if not PyObject_CheckBuffer(self.owner): - * raise RuntimeError("the buffer owner doens't implement the buffer protocol") - * PyObject_GetBuffer(self.owner, &view, PyBUF_SIMPLE) # <<<<<<<<<<<<<< - * stuff = ( - * PickleBuffer(self.owner), + * if PyNumber_Check(index): # <<<<<<<<<<<<<< + * start = index + * stop = index+1 */ - __pyx_t_1 = __pyx_v_self->owner; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetBuffer(__pyx_t_1, (&__pyx_v_view), PyBUF_SIMPLE); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 554, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L3; + } - /* "arrex/list.pyx":556 - * PyObject_GetBuffer(self.owner, &view, PyBUF_SIMPLE) - * stuff = ( - * PickleBuffer(self.owner), # <<<<<<<<<<<<<< - * self.dtype, - * self.ptr - view.buf, + /* "arrex/list.pyx":501 + * start = index + * stop = index+1 + * elif isinstance(index, slice): # <<<<<<<<<<<<<< + * if PySlice_Unpack(index, &start, &stop, &step): + * raise IndexError('incorrect slice') */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_PickleBuffer); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_self->owner) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_self->owner); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = PySlice_Check(__pyx_v_index); + if (likely(__pyx_t_1)) { - /* "arrex/list.pyx":558 - * PickleBuffer(self.owner), - * self.dtype, - * self.ptr - view.buf, # <<<<<<<<<<<<<< - * self.size, - * ) + /* "arrex/list.pyx":502 + * stop = index+1 + * elif isinstance(index, slice): + * if PySlice_Unpack(index, &start, &stop, &step): # <<<<<<<<<<<<<< + * raise IndexError('incorrect slice') + * if step != 1: */ - __pyx_t_4 = __Pyx_PyInt_From_ptrdiff_t((__pyx_v_self->ptr - ((char *)__pyx_v_view.buf))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 558, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_4 = PySlice_Unpack(__pyx_v_index, (&__pyx_v_start), (&__pyx_v_stop), (&__pyx_v_step)); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 502, __pyx_L1_error) + __pyx_t_1 = (__pyx_t_4 != 0); + if (unlikely(__pyx_t_1)) { - /* "arrex/list.pyx":559 - * self.dtype, - * self.ptr - view.buf, - * self.size, # <<<<<<<<<<<<<< - * ) - * PyBuffer_Release(&view) + /* "arrex/list.pyx":503 + * elif isinstance(index, slice): + * if PySlice_Unpack(index, &start, &stop, &step): + * raise IndexError('incorrect slice') # <<<<<<<<<<<<<< + * if step != 1: + * raise IndexError('slice step is not supported') */ - __pyx_t_5 = __Pyx_PyInt_FromSize_t(__pyx_v_self->size); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 559, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 503, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 503, __pyx_L1_error) - /* "arrex/list.pyx":556 - * PyObject_GetBuffer(self.owner, &view, PyBUF_SIMPLE) - * stuff = ( - * PickleBuffer(self.owner), # <<<<<<<<<<<<<< - * self.dtype, - * self.ptr - view.buf, + /* "arrex/list.pyx":502 + * stop = index+1 + * elif isinstance(index, slice): + * if PySlice_Unpack(index, &start, &stop, &step): # <<<<<<<<<<<<<< + * raise IndexError('incorrect slice') + * if step != 1: */ - __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_v_self->dtype)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self->dtype)); - PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_self->dtype)); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_5); - __pyx_t_1 = 0; - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_v_stuff = ((PyObject*)__pyx_t_6); - __pyx_t_6 = 0; + } - /* "arrex/list.pyx":561 - * self.size, - * ) - * PyBuffer_Release(&view) # <<<<<<<<<<<<<< - * return self._rebuild, stuff, None + /* "arrex/list.pyx":504 + * if PySlice_Unpack(index, &start, &stop, &step): + * raise IndexError('incorrect slice') + * if step != 1: # <<<<<<<<<<<<<< + * raise IndexError('slice step is not supported') + * PySlice_AdjustIndices(self._len(), &start, &stop, step) + */ + __pyx_t_1 = (__pyx_v_step != 1); + if (unlikely(__pyx_t_1)) { + + /* "arrex/list.pyx":505 + * raise IndexError('incorrect slice') + * if step != 1: + * raise IndexError('slice step is not supported') # <<<<<<<<<<<<<< + * PySlice_AdjustIndices(self._len(), &start, &stop, step) * else: */ - PyBuffer_Release((&__pyx_v_view)); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 505, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 505, __pyx_L1_error) - /* "arrex/list.pyx":562 - * ) - * PyBuffer_Release(&view) - * return self._rebuild, stuff, None # <<<<<<<<<<<<<< + /* "arrex/list.pyx":504 + * if PySlice_Unpack(index, &start, &stop, &step): + * raise IndexError('incorrect slice') + * if step != 1: # <<<<<<<<<<<<<< + * raise IndexError('slice step is not supported') + * PySlice_AdjustIndices(self._len(), &start, &stop, step) + */ + } + + /* "arrex/list.pyx":506 + * if step != 1: + * raise IndexError('slice step is not supported') + * PySlice_AdjustIndices(self._len(), &start, &stop, step) # <<<<<<<<<<<<<< * else: - * return self._rebuild, ( + * raise IndexError('index must be int or slice') */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_rebuild); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 562, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 562, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); - __Pyx_INCREF(__pyx_v_stuff); - __Pyx_GIVEREF(__pyx_v_stuff); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_stuff); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_5, 2, Py_None); - __pyx_t_6 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; + __pyx_t_5 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_len(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 506, __pyx_L1_error) + (void)(PySlice_AdjustIndices(__pyx_t_5, (&__pyx_v_start), (&__pyx_v_stop), __pyx_v_step)); - /* "arrex/list.pyx":551 - * cdef Py_buffer view - * - * if protocol >= 5: # <<<<<<<<<<<<<< - * if not PyObject_CheckBuffer(self.owner): - * raise RuntimeError("the buffer owner doens't implement the buffer protocol") + /* "arrex/list.pyx":501 + * start = index + * stop = index+1 + * elif isinstance(index, slice): # <<<<<<<<<<<<<< + * if PySlice_Unpack(index, &start, &stop, &step): + * raise IndexError('incorrect slice') */ + goto __pyx_L3; } - /* "arrex/list.pyx":564 - * return self._rebuild, stuff, None + /* "arrex/list.pyx":508 + * PySlice_AdjustIndices(self._len(), &start, &stop, step) * else: - * return self._rebuild, ( # <<<<<<<<<<<<<< - * PyBytes_FromStringAndSize(self.ptr, self.size), - * self.dtype, + * raise IndexError('index must be int or slice') # <<<<<<<<<<<<<< + * + * start *= self.dtype.dsize */ /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_rebuild); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 564, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 508, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 508, __pyx_L1_error) + } + __pyx_L3:; - /* "arrex/list.pyx":565 - * else: - * return self._rebuild, ( - * PyBytes_FromStringAndSize(self.ptr, self.size), # <<<<<<<<<<<<<< - * self.dtype, - * 0, + /* "arrex/list.pyx":510 + * raise IndexError('index must be int or slice') + * + * start *= self.dtype.dsize # <<<<<<<<<<<<<< + * stop *= self.dtype.dsize + * memmove(self.ptr+start, self.ptr+stop, self.size-stop) */ - __pyx_t_6 = PyBytes_FromStringAndSize(((char *)__pyx_v_self->ptr), __pyx_v_self->size); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 565, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); + __pyx_v_start = (__pyx_v_start * __pyx_v_self->dtype->dsize); - /* "arrex/list.pyx":568 - * self.dtype, - * 0, - * self.size, # <<<<<<<<<<<<<< - * ) + /* "arrex/list.pyx":511 * + * start *= self.dtype.dsize + * stop *= self.dtype.dsize # <<<<<<<<<<<<<< + * memmove(self.ptr+start, self.ptr+stop, self.size-stop) + * self.size = self.size + start - stop */ - __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_self->size); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 568, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + __pyx_v_stop = (__pyx_v_stop * __pyx_v_self->dtype->dsize); - /* "arrex/list.pyx":565 - * else: - * return self._rebuild, ( - * PyBytes_FromStringAndSize(self.ptr, self.size), # <<<<<<<<<<<<<< - * self.dtype, - * 0, + /* "arrex/list.pyx":512 + * start *= self.dtype.dsize + * stop *= self.dtype.dsize + * memmove(self.ptr+start, self.ptr+stop, self.size-stop) # <<<<<<<<<<<<<< + * self.size = self.size + start - stop + * */ - __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 565, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6); - __Pyx_INCREF(((PyObject *)__pyx_v_self->dtype)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self->dtype)); - PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self->dtype)); - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_int_0); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_4); - __pyx_t_6 = 0; - __pyx_t_4 = 0; + (void)(memmove((__pyx_v_self->ptr + __pyx_v_start), (__pyx_v_self->ptr + __pyx_v_stop), (__pyx_v_self->size - __pyx_v_stop))); - /* "arrex/list.pyx":564 - * return self._rebuild, stuff, None - * else: - * return self._rebuild, ( # <<<<<<<<<<<<<< - * PyBytes_FromStringAndSize(self.ptr, self.size), - * self.dtype, + /* "arrex/list.pyx":513 + * stop *= self.dtype.dsize + * memmove(self.ptr+start, self.ptr+stop, self.size-stop) + * self.size = self.size + start - stop # <<<<<<<<<<<<<< + * + * */ - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 564, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); - __pyx_t_5 = 0; - __pyx_t_1 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - } + __pyx_v_self->size = ((__pyx_v_self->size + __pyx_v_start) - __pyx_v_stop); - /* "arrex/list.pyx":547 - * return typedlist(PyBytes_FromStringAndSize(self.ptr, self.size), self.dtype) + /* "arrex/list.pyx":495 + * raise IndexError('index must be int or slice') + * + * def __delitem__(self, index): # <<<<<<<<<<<<<< + * cdef Py_ssize_t start, stop, step * - * def __reduce_ex__(self, protocol): # <<<<<<<<<<<<<< - * ''' serialization protocol ''' - * cdef Py_buffer view */ /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("arrex.list.typedlist.__reduce_ex__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("arrex.list.typedlist.__delitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_stuff); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "arrex/list.pyx":572 +/* "arrex/list.pyx":516 * - * @classmethod - * def _rebuild(cls, owner, dtype, size_t start, size_t size): # <<<<<<<<<<<<<< - * new = typedlist(owner, dtype) - * assert start <= size + * + * def __iter__(self): # <<<<<<<<<<<<<< + * ''' yield successive elements in the list ''' + * cdef arrayiter it = arrayiter.__new__(arrayiter) */ /* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_49_rebuild(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_49_rebuild(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_owner = 0; - PyObject *__pyx_v_dtype = 0; - size_t __pyx_v_start; - size_t __pyx_v_size; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +static PyObject *__pyx_pw_5arrex_4list_9typedlist_37__iter__(PyObject *__pyx_v_self); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5arrex_4list_9typedlist_36__iter__, " yield successive elements in the list "); +#if CYTHON_UPDATE_DESCRIPTOR_DOC +struct wrapperbase __pyx_wrapperbase_5arrex_4list_9typedlist_36__iter__; +#endif +static PyObject *__pyx_pw_5arrex_4list_9typedlist_37__iter__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_rebuild (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_owner,&__pyx_n_s_dtype,&__pyx_n_s_start,&__pyx_n_s_size,0}; - PyObject* values[4] = {0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_owner)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_rebuild", 1, 4, 4, 1); __PYX_ERR(0, 572, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_start)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_rebuild", 1, 4, 4, 2); __PYX_ERR(0, 572, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_rebuild", 1, 4, 4, 3); __PYX_ERR(0, 572, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_rebuild") < 0)) __PYX_ERR(0, 572, __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_owner = values[0]; - __pyx_v_dtype = values[1]; - __pyx_v_start = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_start == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 572, __pyx_L3_error) - __pyx_v_size = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_size == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 572, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_rebuild", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 572, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("arrex.list.typedlist._rebuild", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5arrex_4list_9typedlist_48_rebuild(((PyTypeObject*)__pyx_v_cls), __pyx_v_owner, __pyx_v_dtype, __pyx_v_start, __pyx_v_size); + __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); + __pyx_r = __pyx_pf_5arrex_4list_9typedlist_36__iter__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5arrex_4list_9typedlist_48_rebuild(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_owner, PyObject *__pyx_v_dtype, size_t __pyx_v_start, size_t __pyx_v_size) { - struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_new = NULL; +static PyObject *__pyx_pf_5arrex_4list_9typedlist_36__iter__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self) { + struct __pyx_obj_5arrex_4list_arrayiter *__pyx_v_it = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_rebuild", 0); - - /* "arrex/list.pyx":573 - * @classmethod - * def _rebuild(cls, owner, dtype, size_t start, size_t size): - * new = typedlist(owner, dtype) # <<<<<<<<<<<<<< - * assert start <= size - * assert size <= new.size - */ - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_owner); - __Pyx_GIVEREF(__pyx_v_owner); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_owner); - __Pyx_INCREF(__pyx_v_dtype); - __Pyx_GIVEREF(__pyx_v_dtype); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_dtype); - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5arrex_4list_typedlist), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_new = ((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "arrex/list.pyx":574 - * def _rebuild(cls, owner, dtype, size_t start, size_t size): - * new = typedlist(owner, dtype) - * assert start <= size # <<<<<<<<<<<<<< - * assert size <= new.size - * new.ptr = new.ptr + start - */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - if (unlikely(!((__pyx_v_start <= __pyx_v_size) != 0))) { - PyErr_SetNone(PyExc_AssertionError); - __PYX_ERR(0, 574, __pyx_L1_error) - } - } - #endif + __Pyx_RefNannySetupContext("__iter__", 0); - /* "arrex/list.pyx":575 - * new = typedlist(owner, dtype) - * assert start <= size - * assert size <= new.size # <<<<<<<<<<<<<< - * new.ptr = new.ptr + start - * new.size = size + /* "arrex/list.pyx":518 + * def __iter__(self): + * ''' yield successive elements in the list ''' + * cdef arrayiter it = arrayiter.__new__(arrayiter) # <<<<<<<<<<<<<< + * it.array = self + * it.position = 0 */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - if (unlikely(!((__pyx_v_size <= __pyx_v_new->size) != 0))) { - PyErr_SetNone(PyExc_AssertionError); - __PYX_ERR(0, 575, __pyx_L1_error) - } - } - #endif + __pyx_t_1 = ((PyObject *)__pyx_tp_new_5arrex_4list_arrayiter(((PyTypeObject *)__pyx_ptype_5arrex_4list_arrayiter), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 518, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + __pyx_v_it = ((struct __pyx_obj_5arrex_4list_arrayiter *)__pyx_t_1); + __pyx_t_1 = 0; - /* "arrex/list.pyx":576 - * assert start <= size - * assert size <= new.size - * new.ptr = new.ptr + start # <<<<<<<<<<<<<< - * new.size = size - * return new + /* "arrex/list.pyx":519 + * ''' yield successive elements in the list ''' + * cdef arrayiter it = arrayiter.__new__(arrayiter) + * it.array = self # <<<<<<<<<<<<<< + * it.position = 0 + * return it */ - __pyx_v_new->ptr = (__pyx_v_new->ptr + __pyx_v_start); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + __Pyx_GOTREF((PyObject *)__pyx_v_it->array); + __Pyx_DECREF((PyObject *)__pyx_v_it->array); + __pyx_v_it->array = __pyx_v_self; - /* "arrex/list.pyx":577 - * assert size <= new.size - * new.ptr = new.ptr + start - * new.size = size # <<<<<<<<<<<<<< - * return new + /* "arrex/list.pyx":520 + * cdef arrayiter it = arrayiter.__new__(arrayiter) + * it.array = self + * it.position = 0 # <<<<<<<<<<<<<< + * return it * */ - __pyx_v_new->size = __pyx_v_size; + __pyx_v_it->position = 0; - /* "arrex/list.pyx":578 - * new.ptr = new.ptr + start - * new.size = size - * return new # <<<<<<<<<<<<<< + /* "arrex/list.pyx":521 + * it.array = self + * it.position = 0 + * return it # <<<<<<<<<<<<<< * - * def __getbuffer__(self, Py_buffer *view, int flags): + * def __repr__(self): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_new)); - __pyx_r = ((PyObject *)__pyx_v_new); + __Pyx_INCREF((PyObject *)__pyx_v_it); + __pyx_r = ((PyObject *)__pyx_v_it); goto __pyx_L0; - /* "arrex/list.pyx":572 + /* "arrex/list.pyx":516 * - * @classmethod - * def _rebuild(cls, owner, dtype, size_t start, size_t size): # <<<<<<<<<<<<<< - * new = typedlist(owner, dtype) - * assert start <= size + * + * def __iter__(self): # <<<<<<<<<<<<<< + * ''' yield successive elements in the list ''' + * cdef arrayiter it = arrayiter.__new__(arrayiter) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("arrex.list.typedlist._rebuild", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("arrex.list.typedlist.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_new); + __Pyx_XDECREF((PyObject *)__pyx_v_it); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "arrex/list.pyx":580 - * return new +/* "arrex/list.pyx":523 + * return it * - * def __getbuffer__(self, Py_buffer *view, int flags): # <<<<<<<<<<<<<< - * cdef arrayexposer exp = arrayexposer.__new__(arrayexposer) - * exp.owner = self.owner + * def __repr__(self): # <<<<<<<<<<<<<< + * cdef size_t i + * text = 'typedlist([' */ /* Python wrapper */ -static CYTHON_UNUSED int __pyx_pw_5arrex_4list_9typedlist_51__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_view, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_pw_5arrex_4list_9typedlist_51__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_view, int __pyx_v_flags) { - int __pyx_r; +static PyObject *__pyx_pw_5arrex_4list_9typedlist_39__repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5arrex_4list_9typedlist_39__repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_9typedlist_50__getbuffer__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), ((Py_buffer *)__pyx_v_view), ((int)__pyx_v_flags)); + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_r = __pyx_pf_5arrex_4list_9typedlist_38__repr__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_5arrex_4list_9typedlist_50__getbuffer__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, Py_buffer *__pyx_v_view, int __pyx_v_flags) { - struct __pyx_obj_5arrex_4list_arrayexposer *__pyx_v_exp = 0; - PyObject *__pyx_v_fmt = NULL; - int __pyx_r; +static PyObject *__pyx_pf_5arrex_4list_9typedlist_38__repr__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self) { + size_t __pyx_v_i; + PyObject *__pyx_v_text = NULL; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - char *__pyx_t_2; + size_t __pyx_t_1; + size_t __pyx_t_2; size_t __pyx_t_3; int __pyx_t_4; - int __pyx_t_5; - Py_ssize_t *__pyx_t_6; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - if (__pyx_v_view == NULL) { - PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); - return -1; - } - __Pyx_RefNannySetupContext("__getbuffer__", 0); - __pyx_v_view->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_view->obj); + __Pyx_RefNannySetupContext("__repr__", 0); - /* "arrex/list.pyx":581 - * - * def __getbuffer__(self, Py_buffer *view, int flags): - * cdef arrayexposer exp = arrayexposer.__new__(arrayexposer) # <<<<<<<<<<<<<< - * exp.owner = self.owner - * exp.shape[0] = self._len() + /* "arrex/list.pyx":525 + * def __repr__(self): + * cdef size_t i + * text = 'typedlist([' # <<<<<<<<<<<<<< + * for i in range(self._len()): + * if i: text += ', ' */ - __pyx_t_1 = ((PyObject *)__pyx_tp_new_5arrex_4list_arrayexposer(((PyTypeObject *)__pyx_ptype_5arrex_4list_arrayexposer), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 581, __pyx_L1_error) - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_v_exp = ((struct __pyx_obj_5arrex_4list_arrayexposer *)__pyx_t_1); - __pyx_t_1 = 0; + __Pyx_INCREF(__pyx_kp_u_typedlist); + __pyx_v_text = __pyx_kp_u_typedlist; - /* "arrex/list.pyx":582 - * def __getbuffer__(self, Py_buffer *view, int flags): - * cdef arrayexposer exp = arrayexposer.__new__(arrayexposer) - * exp.owner = self.owner # <<<<<<<<<<<<<< - * exp.shape[0] = self._len() - * + /* "arrex/list.pyx":526 + * cdef size_t i + * text = 'typedlist([' + * for i in range(self._len()): # <<<<<<<<<<<<<< + * if i: text += ', ' + * text += repr(self._getitem(self.ptr + i*self.dtype.dsize)) */ - __pyx_t_1 = __pyx_v_self->owner; - __Pyx_INCREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_exp->owner); - __Pyx_DECREF(__pyx_v_exp->owner); - __pyx_v_exp->owner = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_1 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_len(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 526, __pyx_L1_error) + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "arrex/list.pyx":583 - * cdef arrayexposer exp = arrayexposer.__new__(arrayexposer) - * exp.owner = self.owner - * exp.shape[0] = self._len() # <<<<<<<<<<<<<< - * - * assign_buffer_obj(view, None) + /* "arrex/list.pyx":527 + * text = 'typedlist([' + * for i in range(self._len()): + * if i: text += ', ' # <<<<<<<<<<<<<< + * text += repr(self._getitem(self.ptr + i*self.dtype.dsize)) + * text += '])' */ - (__pyx_v_exp->shape[0]) = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_len(__pyx_v_self); - - /* "arrex/list.pyx":585 - * exp.shape[0] = self._len() - * - * assign_buffer_obj(view, None) # <<<<<<<<<<<<<< - * view.obj = exp - * view.buf = self.ptr - */ - assign_buffer_obj(__pyx_v_view, Py_None); - - /* "arrex/list.pyx":586 - * - * assign_buffer_obj(view, None) - * view.obj = exp # <<<<<<<<<<<<<< - * view.buf = self.ptr - * view.len = self.size - */ - __Pyx_INCREF(((PyObject *)__pyx_v_exp)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_exp)); - __Pyx_GOTREF(__pyx_v_view->obj); - __Pyx_DECREF(__pyx_v_view->obj); - __pyx_v_view->obj = ((PyObject *)__pyx_v_exp); + __pyx_t_4 = (__pyx_v_i != 0); + if (__pyx_t_4) { + __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_text, __pyx_kp_u__12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 527, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_5); + __pyx_t_5 = 0; + } - /* "arrex/list.pyx":587 - * assign_buffer_obj(view, None) - * view.obj = exp - * view.buf = self.ptr # <<<<<<<<<<<<<< - * view.len = self.size - * view.ndim = 1 + /* "arrex/list.pyx":528 + * for i in range(self._len()): + * if i: text += ', ' + * text += repr(self._getitem(self.ptr + i*self.dtype.dsize)) # <<<<<<<<<<<<<< + * text += '])' + * return text */ - __pyx_t_2 = __pyx_v_self->ptr; - __pyx_v_view->buf = __pyx_t_2; + __pyx_t_5 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_getitem(__pyx_v_self, (__pyx_v_self->ptr + (__pyx_v_i * __pyx_v_self->dtype->dsize))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 528, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyObject_Repr(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 528, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_text, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 528, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_5); + __pyx_t_5 = 0; + } - /* "arrex/list.pyx":588 - * view.obj = exp - * view.buf = self.ptr - * view.len = self.size # <<<<<<<<<<<<<< - * view.ndim = 1 + /* "arrex/list.pyx":529 + * if i: text += ', ' + * text += repr(self._getitem(self.ptr + i*self.dtype.dsize)) + * text += '])' # <<<<<<<<<<<<<< + * return text * */ - __pyx_t_3 = __pyx_v_self->size; - __pyx_v_view->len = __pyx_t_3; + __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_text, __pyx_kp_u__13); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 529, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_5); + __pyx_t_5 = 0; - /* "arrex/list.pyx":589 - * view.buf = self.ptr - * view.len = self.size - * view.ndim = 1 # <<<<<<<<<<<<<< + /* "arrex/list.pyx":530 + * text += repr(self._getitem(self.ptr + i*self.dtype.dsize)) + * text += '])' + * return text # <<<<<<<<<<<<<< * - * if flags & PyBUF_FORMAT: + * def __eq__(self, other): */ - __pyx_v_view->ndim = 1; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_text); + __pyx_r = __pyx_v_text; + goto __pyx_L0; - /* "arrex/list.pyx":591 - * view.ndim = 1 + /* "arrex/list.pyx":523 + * return it * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * fmt = self.dtype.layout - * if fmt is not None: + * def __repr__(self): # <<<<<<<<<<<<<< + * cdef size_t i + * text = 'typedlist([' */ - __pyx_t_4 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); - if (__pyx_t_4) { - /* "arrex/list.pyx":592 - * - * if flags & PyBUF_FORMAT: - * fmt = self.dtype.layout # <<<<<<<<<<<<<< - * if fmt is not None: - * view.itemsize = self.dtype.dsize - */ - __pyx_t_1 = __pyx_v_self->dtype->layout; - __Pyx_INCREF(__pyx_t_1); - __pyx_v_fmt = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("arrex.list.typedlist.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_text); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "arrex/list.pyx":593 - * if flags & PyBUF_FORMAT: - * fmt = self.dtype.layout - * if fmt is not None: # <<<<<<<<<<<<<< - * view.itemsize = self.dtype.dsize - * view.format = PyBytes_AS_STRING(fmt) +/* "arrex/list.pyx":532 + * return text + * + * def __eq__(self, other): # <<<<<<<<<<<<<< + * ''' return True if other is a typedlist and its buffer byte contents is the same ''' + * if not isinstance(other, typedlist): return False */ - __pyx_t_4 = (__pyx_v_fmt != ((PyObject*)Py_None)); - __pyx_t_5 = (__pyx_t_4 != 0); - if (__pyx_t_5) { - /* "arrex/list.pyx":594 - * fmt = self.dtype.layout - * if fmt is not None: - * view.itemsize = self.dtype.dsize # <<<<<<<<<<<<<< - * view.format = PyBytes_AS_STRING(fmt) - * else: - */ - __pyx_t_3 = __pyx_v_self->dtype->dsize; - __pyx_v_view->itemsize = __pyx_t_3; +/* Python wrapper */ +static PyObject *__pyx_pw_5arrex_4list_9typedlist_41__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5arrex_4list_9typedlist_40__eq__, " return True if other is a typedlist and its buffer byte contents is the same "); +#if CYTHON_UPDATE_DESCRIPTOR_DOC +struct wrapperbase __pyx_wrapperbase_5arrex_4list_9typedlist_40__eq__; +#endif +static PyObject *__pyx_pw_5arrex_4list_9typedlist_41__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__eq__ (wrapper)", 0); + __pyx_r = __pyx_pf_5arrex_4list_9typedlist_40__eq__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), ((PyObject *)__pyx_v_other)); - /* "arrex/list.pyx":595 - * if fmt is not None: - * view.itemsize = self.dtype.dsize - * view.format = PyBytes_AS_STRING(fmt) # <<<<<<<<<<<<<< - * else: - * view.itemsize = 1 - */ - __pyx_v_view->format = PyBytes_AS_STRING(__pyx_v_fmt); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "arrex/list.pyx":593 - * if flags & PyBUF_FORMAT: - * fmt = self.dtype.layout - * if fmt is not None: # <<<<<<<<<<<<<< - * view.itemsize = self.dtype.dsize - * view.format = PyBytes_AS_STRING(fmt) - */ - goto __pyx_L4; - } +static PyObject *__pyx_pf_5arrex_4list_9typedlist_40__eq__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_other) { + struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_o = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__eq__", 0); - /* "arrex/list.pyx":597 - * view.format = PyBytes_AS_STRING(fmt) - * else: - * view.itemsize = 1 # <<<<<<<<<<<<<< - * view.format = 'B' - * else: + /* "arrex/list.pyx":534 + * def __eq__(self, other): + * ''' return True if other is a typedlist and its buffer byte contents is the same ''' + * if not isinstance(other, typedlist): return False # <<<<<<<<<<<<<< + * cdef typedlist o = other + * if self.size != o.size: return False */ - /*else*/ { - __pyx_v_view->itemsize = 1; + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_other, __pyx_ptype_5arrex_4list_typedlist); + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_False); + __pyx_r = Py_False; + goto __pyx_L0; + } - /* "arrex/list.pyx":598 - * else: - * view.itemsize = 1 - * view.format = 'B' # <<<<<<<<<<<<<< - * else: - * view.itemsize = 1 + /* "arrex/list.pyx":535 + * ''' return True if other is a typedlist and its buffer byte contents is the same ''' + * if not isinstance(other, typedlist): return False + * cdef typedlist o = other # <<<<<<<<<<<<<< + * if self.size != o.size: return False + * return 0 == memcmp(self.ptr, o.ptr, self.size) */ - __pyx_v_view->format = ((char *)"B"); - } - __pyx_L4:; + if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_5arrex_4list_typedlist))))) __PYX_ERR(0, 535, __pyx_L1_error) + __pyx_t_3 = __pyx_v_other; + __Pyx_INCREF(__pyx_t_3); + __pyx_v_o = ((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_t_3); + __pyx_t_3 = 0; - /* "arrex/list.pyx":591 - * view.ndim = 1 + /* "arrex/list.pyx":536 + * if not isinstance(other, typedlist): return False + * cdef typedlist o = other + * if self.size != o.size: return False # <<<<<<<<<<<<<< + * return 0 == memcmp(self.ptr, o.ptr, self.size) * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * fmt = self.dtype.layout - * if fmt is not None: */ - goto __pyx_L3; + __pyx_t_2 = (__pyx_v_self->size != __pyx_v_o->size); + if (__pyx_t_2) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_False); + __pyx_r = Py_False; + goto __pyx_L0; } - /* "arrex/list.pyx":600 - * view.format = 'B' - * else: - * view.itemsize = 1 # <<<<<<<<<<<<<< - * view.format = NULL + /* "arrex/list.pyx":537 + * cdef typedlist o = other + * if self.size != o.size: return False + * return 0 == memcmp(self.ptr, o.ptr, self.size) # <<<<<<<<<<<<<< * + * def __copy__(self): */ - /*else*/ { - __pyx_v_view->itemsize = 1; + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyBool_FromLong((0 == memcmp(__pyx_v_self->ptr, __pyx_v_o->ptr, __pyx_v_self->size))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 537, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; - /* "arrex/list.pyx":601 - * else: - * view.itemsize = 1 - * view.format = NULL # <<<<<<<<<<<<<< + /* "arrex/list.pyx":532 + * return text * - * if flags & PyBUF_ND: + * def __eq__(self, other): # <<<<<<<<<<<<<< + * ''' return True if other is a typedlist and its buffer byte contents is the same ''' + * if not isinstance(other, typedlist): return False */ - __pyx_v_view->format = NULL; - } - __pyx_L3:; - /* "arrex/list.pyx":603 - * view.format = NULL - * - * if flags & PyBUF_ND: # <<<<<<<<<<<<<< - * view.suboffsets = NULL - * view.strides = &view.itemsize - */ - __pyx_t_5 = ((__pyx_v_flags & PyBUF_ND) != 0); - if (__pyx_t_5) { + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("arrex.list.typedlist.__eq__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_o); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "arrex/list.pyx":604 +/* "arrex/list.pyx":539 + * return 0 == memcmp(self.ptr, o.ptr, self.size) * - * if flags & PyBUF_ND: - * view.suboffsets = NULL # <<<<<<<<<<<<<< - * view.strides = &view.itemsize - * view.shape = exp.shape + * def __copy__(self): # <<<<<<<<<<<<<< + * ''' shallow copy will create a copy of that array referencing the same buffer ''' + * return self[:] */ - __pyx_v_view->suboffsets = NULL; - /* "arrex/list.pyx":605 - * if flags & PyBUF_ND: - * view.suboffsets = NULL - * view.strides = &view.itemsize # <<<<<<<<<<<<<< - * view.shape = exp.shape - * else: - */ - __pyx_v_view->strides = (&__pyx_v_view->itemsize); +/* Python wrapper */ +static PyObject *__pyx_pw_5arrex_4list_9typedlist_43__copy__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5arrex_4list_9typedlist_42__copy__, " shallow copy will create a copy of that array referencing the same buffer "); +static PyMethodDef __pyx_mdef_5arrex_4list_9typedlist_43__copy__ = {"__copy__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9typedlist_43__copy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_42__copy__}; +static PyObject *__pyx_pw_5arrex_4list_9typedlist_43__copy__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__copy__ (wrapper)", 0); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__copy__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__copy__", 0))) return NULL; + __pyx_r = __pyx_pf_5arrex_4list_9typedlist_42__copy__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self)); - /* "arrex/list.pyx":606 - * view.suboffsets = NULL - * view.strides = &view.itemsize - * view.shape = exp.shape # <<<<<<<<<<<<<< - * else: - * view.shape = NULL - */ - __pyx_t_6 = __pyx_v_exp->shape; - __pyx_v_view->shape = __pyx_t_6; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "arrex/list.pyx":603 - * view.format = NULL - * - * if flags & PyBUF_ND: # <<<<<<<<<<<<<< - * view.suboffsets = NULL - * view.strides = &view.itemsize - */ - goto __pyx_L5; - } +static PyObject *__pyx_pf_5arrex_4list_9typedlist_42__copy__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self) { + 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("__copy__", 0); - /* "arrex/list.pyx":608 - * view.shape = exp.shape - * else: - * view.shape = NULL # <<<<<<<<<<<<<< - * + /* "arrex/list.pyx":541 + * def __copy__(self): + * ''' shallow copy will create a copy of that array referencing the same buffer ''' + * return self[:] # <<<<<<<<<<<<<< * + * def __deepcopy__(self, memo): */ - /*else*/ { - __pyx_v_view->shape = NULL; - } - __pyx_L5:; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetSlice(((PyObject *)__pyx_v_self), 0, 0, NULL, NULL, &__pyx_slice__14, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 541, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "arrex/list.pyx":580 - * return new + /* "arrex/list.pyx":539 + * return 0 == memcmp(self.ptr, o.ptr, self.size) * - * def __getbuffer__(self, Py_buffer *view, int flags): # <<<<<<<<<<<<<< - * cdef arrayexposer exp = arrayexposer.__new__(arrayexposer) - * exp.owner = self.owner + * def __copy__(self): # <<<<<<<<<<<<<< + * ''' shallow copy will create a copy of that array referencing the same buffer ''' + * return self[:] */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("arrex.list.typedlist.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - if (__pyx_v_view->obj != NULL) { - __Pyx_GOTREF(__pyx_v_view->obj); - __Pyx_DECREF(__pyx_v_view->obj); __pyx_v_view->obj = 0; - } - goto __pyx_L2; + __Pyx_AddTraceback("arrex.list.typedlist.__copy__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - if (__pyx_v_view->obj == Py_None) { - __Pyx_GOTREF(__pyx_v_view->obj); - __Pyx_DECREF(__pyx_v_view->obj); __pyx_v_view->obj = 0; - } - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_exp); - __Pyx_XDECREF(__pyx_v_fmt); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "arrex/list.pyx":611 - * +/* "arrex/list.pyx":543 + * return self[:] * - * def __releasebuffer__(self, Py_buffer *view): # <<<<<<<<<<<<<< - * cdef arrayexposer exp = view.obj - * print('** release buffer', sys.getrefcount(exp.owner)) + * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< + * ''' deep recursive copy, will duplicate the viewed data in the underlying buffer ''' + * return typedlist(PyBytes_FromStringAndSize(self.ptr, self.size), self.dtype) */ /* Python wrapper */ -static CYTHON_UNUSED void __pyx_pw_5arrex_4list_9typedlist_53__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_view); /*proto*/ -static CYTHON_UNUSED void __pyx_pw_5arrex_4list_9typedlist_53__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_view) { +static PyObject *__pyx_pw_5arrex_4list_9typedlist_45__deepcopy__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5arrex_4list_9typedlist_44__deepcopy__, " deep recursive copy, will duplicate the viewed data in the underlying buffer "); +static PyMethodDef __pyx_mdef_5arrex_4list_9typedlist_45__deepcopy__ = {"__deepcopy__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9typedlist_45__deepcopy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_44__deepcopy__}; +static PyObject *__pyx_pw_5arrex_4list_9typedlist_45__deepcopy__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v_memo = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); - __pyx_pf_5arrex_4list_9typedlist_52__releasebuffer__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), ((Py_buffer *)__pyx_v_view)); + __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_memo,0}; + PyObject* values[1] = {0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_memo)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 543, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__deepcopy__") < 0)) __PYX_ERR(0, 543, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_memo = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__deepcopy__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 543, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("arrex.list.typedlist.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5arrex_4list_9typedlist_44__deepcopy__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), __pyx_v_memo); /* function exit code */ __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static void __pyx_pf_5arrex_4list_9typedlist_52__releasebuffer__(CYTHON_UNUSED struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, Py_buffer *__pyx_v_view) { - struct __pyx_obj_5arrex_4list_arrayexposer *__pyx_v_exp = 0; +static PyObject *__pyx_pf_5arrex_4list_9typedlist_44__deepcopy__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_memo) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__releasebuffer__", 0); + __Pyx_RefNannySetupContext("__deepcopy__", 0); - /* "arrex/list.pyx":612 + /* "arrex/list.pyx":545 + * def __deepcopy__(self, memo): + * ''' deep recursive copy, will duplicate the viewed data in the underlying buffer ''' + * return typedlist(PyBytes_FromStringAndSize(self.ptr, self.size), self.dtype) # <<<<<<<<<<<<<< * - * def __releasebuffer__(self, Py_buffer *view): - * cdef arrayexposer exp = view.obj # <<<<<<<<<<<<<< - * print('** release buffer', sys.getrefcount(exp.owner)) - * exp.owner = None - */ - if (!(likely(((__pyx_v_view->obj) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_view->obj, __pyx_ptype_5arrex_4list_arrayexposer))))) __PYX_ERR(0, 612, __pyx_L1_error) - __pyx_t_1 = __pyx_v_view->obj; - __Pyx_INCREF(__pyx_t_1); - __pyx_v_exp = ((struct __pyx_obj_5arrex_4list_arrayexposer *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "arrex/list.pyx":613 - * def __releasebuffer__(self, Py_buffer *view): - * cdef arrayexposer exp = view.obj - * print('** release buffer', sys.getrefcount(exp.owner)) # <<<<<<<<<<<<<< - * exp.owner = None - * view.obj = None + * def __reduce_ex__(self, protocol): */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 613, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_getrefcount); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 613, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_exp->owner) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_exp->owner); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 613, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyBytes_FromStringAndSize(((char *)__pyx_v_self->ptr), __pyx_v_self->size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 545, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 613, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_kp_u_release_buffer); - __Pyx_GIVEREF(__pyx_kp_u_release_buffer); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_release_buffer); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 545, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_INCREF((PyObject *)__pyx_v_self->dtype); + __Pyx_GIVEREF((PyObject *)__pyx_v_self->dtype); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->dtype)); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 613, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5arrex_4list_typedlist), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 545, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "arrex/list.pyx":614 - * cdef arrayexposer exp = view.obj - * print('** release buffer', sys.getrefcount(exp.owner)) - * exp.owner = None # <<<<<<<<<<<<<< - * view.obj = None + /* "arrex/list.pyx":543 + * return self[:] * - */ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_exp->owner); - __Pyx_DECREF(__pyx_v_exp->owner); - __pyx_v_exp->owner = Py_None; - - /* "arrex/list.pyx":615 - * print('** release buffer', sys.getrefcount(exp.owner)) - * exp.owner = None - * view.obj = None # <<<<<<<<<<<<<< - * - * def reverse(self): - */ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_view->obj); - __Pyx_DECREF(__pyx_v_view->obj); - __pyx_v_view->obj = Py_None; - - /* "arrex/list.pyx":611 - * - * - * def __releasebuffer__(self, Py_buffer *view): # <<<<<<<<<<<<<< - * cdef arrayexposer exp = view.obj - * print('** release buffer', sys.getrefcount(exp.owner)) + * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< + * ''' deep recursive copy, will duplicate the viewed data in the underlying buffer ''' + * return typedlist(PyBytes_FromStringAndSize(self.ptr, self.size), self.dtype) */ /* function exit code */ - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_WriteUnraisable("arrex.list.typedlist.__releasebuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_AddTraceback("arrex.list.typedlist.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_exp); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "arrex/list.pyx":617 - * view.obj = None - * - * def reverse(self): # <<<<<<<<<<<<<< - * ''' reverse() +/* "arrex/list.pyx":547 + * return typedlist(PyBytes_FromStringAndSize(self.ptr, self.size), self.dtype) * + * def __reduce_ex__(self, protocol): # <<<<<<<<<<<<<< + * ''' serialization protocol ''' + * cdef Py_buffer view */ /* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_55reverse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5arrex_4list_9typedlist_54reverse[] = " reverse()\n\t\t\n\t\t\treverse the order of elementd contained \n\t\t"; -static PyObject *__pyx_pw_5arrex_4list_9typedlist_55reverse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_5arrex_4list_9typedlist_47__reduce_ex__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5arrex_4list_9typedlist_46__reduce_ex__, " serialization protocol "); +static PyMethodDef __pyx_mdef_5arrex_4list_9typedlist_47__reduce_ex__ = {"__reduce_ex__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9typedlist_47__reduce_ex__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_46__reduce_ex__}; +static PyObject *__pyx_pw_5arrex_4list_9typedlist_47__reduce_ex__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_protocol = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("reverse (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_9typedlist_54reverse(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__reduce_ex__ (wrapper)", 0); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_protocol,0}; + PyObject* values[1] = {0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_protocol)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 547, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__reduce_ex__") < 0)) __PYX_ERR(0, 547, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_protocol = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__reduce_ex__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 547, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("arrex.list.typedlist.__reduce_ex__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5arrex_4list_9typedlist_46__reduce_ex__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), __pyx_v_protocol); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5arrex_4list_9typedlist_54reverse(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self) { - char *__pyx_v_temp; - char *__pyx_v_first; - char *__pyx_v_last; +static PyObject *__pyx_pf_5arrex_4list_9typedlist_46__reduce_ex__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_protocol) { + Py_buffer __pyx_v_view; + PyObject *__pyx_v_stuff = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - char *__pyx_t_1; + PyObject *__pyx_t_1 = NULL; int __pyx_t_2; - __Pyx_RefNannySetupContext("reverse", 0); + 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; + __Pyx_RefNannySetupContext("__reduce_ex__", 0); - /* "arrex/list.pyx":627 - * cdef size_t i + /* "arrex/list.pyx":551 + * cdef Py_buffer view * - * temp = PyMem_Malloc(self.dtype.dsize) # <<<<<<<<<<<<<< - * first = self.ptr - * last = self.ptr + self.size - self.dtype.dsize + * if protocol >= 5: # <<<<<<<<<<<<<< + * if not PyObject_CheckBuffer(self.owner): + * raise RuntimeError("the buffer owner doens't implement the buffer protocol") */ - __pyx_v_temp = ((char *)PyMem_Malloc(__pyx_v_self->dtype->dsize)); + __pyx_t_1 = PyObject_RichCompare(__pyx_v_protocol, __pyx_int_5, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 551, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 551, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { - /* "arrex/list.pyx":628 + /* "arrex/list.pyx":552 * - * temp = PyMem_Malloc(self.dtype.dsize) - * first = self.ptr # <<<<<<<<<<<<<< - * last = self.ptr + self.size - self.dtype.dsize - * while first < last: - */ - __pyx_t_1 = __pyx_v_self->ptr; - __pyx_v_first = __pyx_t_1; - - /* "arrex/list.pyx":629 - * temp = PyMem_Malloc(self.dtype.dsize) - * first = self.ptr - * last = self.ptr + self.size - self.dtype.dsize # <<<<<<<<<<<<<< - * while first < last: - * memcpy(temp, first, self.dtype.dsize) + * if protocol >= 5: + * if not PyObject_CheckBuffer(self.owner): # <<<<<<<<<<<<<< + * raise RuntimeError("the buffer owner doens't implement the buffer protocol") + * PyObject_GetBuffer(self.owner, &view, PyBUF_SIMPLE) */ - __pyx_v_last = ((__pyx_v_self->ptr + __pyx_v_self->size) - __pyx_v_self->dtype->dsize); + __pyx_t_1 = __pyx_v_self->owner; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = (!PyObject_CheckBuffer(__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(__pyx_t_2)) { - /* "arrex/list.pyx":630 - * first = self.ptr - * last = self.ptr + self.size - self.dtype.dsize - * while first < last: # <<<<<<<<<<<<<< - * memcpy(temp, first, self.dtype.dsize) - * memcpy(first, last, self.dtype.dsize) + /* "arrex/list.pyx":553 + * if protocol >= 5: + * if not PyObject_CheckBuffer(self.owner): + * raise RuntimeError("the buffer owner doens't implement the buffer protocol") # <<<<<<<<<<<<<< + * PyObject_GetBuffer(self.owner, &view, PyBUF_SIMPLE) + * stuff = ( */ - while (1) { - __pyx_t_2 = ((((size_t)__pyx_v_first) < ((size_t)__pyx_v_last)) != 0); - if (!__pyx_t_2) break; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 553, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 553, __pyx_L1_error) - /* "arrex/list.pyx":631 - * last = self.ptr + self.size - self.dtype.dsize - * while first < last: - * memcpy(temp, first, self.dtype.dsize) # <<<<<<<<<<<<<< - * memcpy(first, last, self.dtype.dsize) - * memcpy(last, temp, self.dtype.dsize) + /* "arrex/list.pyx":552 + * + * if protocol >= 5: + * if not PyObject_CheckBuffer(self.owner): # <<<<<<<<<<<<<< + * raise RuntimeError("the buffer owner doens't implement the buffer protocol") + * PyObject_GetBuffer(self.owner, &view, PyBUF_SIMPLE) */ - (void)(memcpy(__pyx_v_temp, __pyx_v_first, __pyx_v_self->dtype->dsize)); + } - /* "arrex/list.pyx":632 - * while first < last: - * memcpy(temp, first, self.dtype.dsize) - * memcpy(first, last, self.dtype.dsize) # <<<<<<<<<<<<<< - * memcpy(last, temp, self.dtype.dsize) - * first += self.dtype.dsize + /* "arrex/list.pyx":554 + * if not PyObject_CheckBuffer(self.owner): + * raise RuntimeError("the buffer owner doens't implement the buffer protocol") + * PyObject_GetBuffer(self.owner, &view, PyBUF_SIMPLE) # <<<<<<<<<<<<<< + * stuff = ( + * PickleBuffer(self.owner), */ - (void)(memcpy(__pyx_v_first, __pyx_v_last, __pyx_v_self->dtype->dsize)); + __pyx_t_1 = __pyx_v_self->owner; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetBuffer(__pyx_t_1, (&__pyx_v_view), PyBUF_SIMPLE); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 554, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "arrex/list.pyx":633 - * memcpy(temp, first, self.dtype.dsize) - * memcpy(first, last, self.dtype.dsize) - * memcpy(last, temp, self.dtype.dsize) # <<<<<<<<<<<<<< - * first += self.dtype.dsize - * last -= self.dtype.dsize + /* "arrex/list.pyx":556 + * PyObject_GetBuffer(self.owner, &view, PyBUF_SIMPLE) + * stuff = ( + * PickleBuffer(self.owner), # <<<<<<<<<<<<<< + * self.dtype, + * self.ptr - view.buf, */ - (void)(memcpy(__pyx_v_last, __pyx_v_temp, __pyx_v_self->dtype->dsize)); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_PickleBuffer); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + __pyx_t_3 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_3 = 1; + } + } + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_self->owner}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_3, 1+__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } - /* "arrex/list.pyx":634 - * memcpy(first, last, self.dtype.dsize) - * memcpy(last, temp, self.dtype.dsize) - * first += self.dtype.dsize # <<<<<<<<<<<<<< - * last -= self.dtype.dsize - * PyMem_Free(temp) + /* "arrex/list.pyx":558 + * PickleBuffer(self.owner), + * self.dtype, + * self.ptr - view.buf, # <<<<<<<<<<<<<< + * self.size, + * ) */ - __pyx_v_first = (__pyx_v_first + __pyx_v_self->dtype->dsize); + __pyx_t_4 = __Pyx_PyInt_From_ptrdiff_t((__pyx_v_self->ptr - ((char *)__pyx_v_view.buf))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 558, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); - /* "arrex/list.pyx":635 - * memcpy(last, temp, self.dtype.dsize) - * first += self.dtype.dsize - * last -= self.dtype.dsize # <<<<<<<<<<<<<< - * PyMem_Free(temp) - * + /* "arrex/list.pyx":559 + * self.dtype, + * self.ptr - view.buf, + * self.size, # <<<<<<<<<<<<<< + * ) + * PyBuffer_Release(&view) */ - __pyx_v_last = (__pyx_v_last - __pyx_v_self->dtype->dsize); - } + __pyx_t_5 = __Pyx_PyInt_FromSize_t(__pyx_v_self->size); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 559, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); - /* "arrex/list.pyx":636 - * first += self.dtype.dsize - * last -= self.dtype.dsize - * PyMem_Free(temp) # <<<<<<<<<<<<<< - * - * def index(self, value): + /* "arrex/list.pyx":556 + * PyObject_GetBuffer(self.owner, &view, PyBUF_SIMPLE) + * stuff = ( + * PickleBuffer(self.owner), # <<<<<<<<<<<<<< + * self.dtype, + * self.ptr - view.buf, */ - PyMem_Free(__pyx_v_temp); + __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); + __Pyx_INCREF((PyObject *)__pyx_v_self->dtype); + __Pyx_GIVEREF((PyObject *)__pyx_v_self->dtype); + PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_self->dtype)); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_5); + __pyx_t_1 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_v_stuff = ((PyObject*)__pyx_t_6); + __pyx_t_6 = 0; - /* "arrex/list.pyx":617 - * view.obj = None + /* "arrex/list.pyx":561 + * self.size, + * ) + * PyBuffer_Release(&view) # <<<<<<<<<<<<<< + * return self._rebuild, stuff, None + * else: + */ + PyBuffer_Release((&__pyx_v_view)); + + /* "arrex/list.pyx":562 + * ) + * PyBuffer_Release(&view) + * return self._rebuild, stuff, None # <<<<<<<<<<<<<< + * else: + * return self._rebuild, ( + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_rebuild); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 562, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 562, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); + __Pyx_INCREF(__pyx_v_stuff); + __Pyx_GIVEREF(__pyx_v_stuff); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_stuff); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_5, 2, Py_None); + __pyx_t_6 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "arrex/list.pyx":551 + * cdef Py_buffer view * - * def reverse(self): # <<<<<<<<<<<<<< - * ''' reverse() + * if protocol >= 5: # <<<<<<<<<<<<<< + * if not PyObject_CheckBuffer(self.owner): + * raise RuntimeError("the buffer owner doens't implement the buffer protocol") + */ + } + + /* "arrex/list.pyx":564 + * return self._rebuild, stuff, None + * else: + * return self._rebuild, ( # <<<<<<<<<<<<<< + * PyBytes_FromStringAndSize(self.ptr, self.size), + * self.dtype, + */ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_rebuild); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 564, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + + /* "arrex/list.pyx":565 + * else: + * return self._rebuild, ( + * PyBytes_FromStringAndSize(self.ptr, self.size), # <<<<<<<<<<<<<< + * self.dtype, + * 0, + */ + __pyx_t_6 = PyBytes_FromStringAndSize(((char *)__pyx_v_self->ptr), __pyx_v_self->size); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 565, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + + /* "arrex/list.pyx":568 + * self.dtype, + * 0, + * self.size, # <<<<<<<<<<<<<< + * ) + * + */ + __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_self->size); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 568, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + + /* "arrex/list.pyx":565 + * else: + * return self._rebuild, ( + * PyBytes_FromStringAndSize(self.ptr, self.size), # <<<<<<<<<<<<<< + * self.dtype, + * 0, + */ + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 565, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6); + __Pyx_INCREF((PyObject *)__pyx_v_self->dtype); + __Pyx_GIVEREF((PyObject *)__pyx_v_self->dtype); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self->dtype)); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_int_0); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_4); + __pyx_t_6 = 0; + __pyx_t_4 = 0; + + /* "arrex/list.pyx":564 + * return self._rebuild, stuff, None + * else: + * return self._rebuild, ( # <<<<<<<<<<<<<< + * PyBytes_FromStringAndSize(self.ptr, self.size), + * self.dtype, + */ + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 564, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); + __pyx_t_5 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + + /* "arrex/list.pyx":547 + * return typedlist(PyBytes_FromStringAndSize(self.ptr, self.size), self.dtype) * + * def __reduce_ex__(self, protocol): # <<<<<<<<<<<<<< + * ''' serialization protocol ''' + * cdef Py_buffer view */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("arrex.list.typedlist.__reduce_ex__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_stuff); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "arrex/list.pyx":638 - * PyMem_Free(temp) - * - * def index(self, value): # <<<<<<<<<<<<<< - * ''' index(value) +/* "arrex/list.pyx":571 + * ) * + * @classmethod # <<<<<<<<<<<<<< + * def _rebuild(cls, owner, dtype, size_t start, size_t size): + * new = typedlist(owner, dtype) */ /* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_57index(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static char __pyx_doc_5arrex_4list_9typedlist_56index[] = " index(value)\n\t\t\n\t\t\treturn the index of the first element binarily equal to the given one \n\t\t"; -static PyObject *__pyx_pw_5arrex_4list_9typedlist_57index(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +static PyObject *__pyx_pw_5arrex_4list_9typedlist_49_rebuild(PyObject *__pyx_v_cls, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5arrex_4list_9typedlist_49_rebuild = {"_rebuild", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9typedlist_49_rebuild, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5arrex_4list_9typedlist_49_rebuild(PyObject *__pyx_v_cls, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_owner = 0; + PyObject *__pyx_v_dtype = 0; + size_t __pyx_v_start; + size_t __pyx_v_size; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("index (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_9typedlist_56index(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannySetupContext("_rebuild (wrapper)", 0); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_owner,&__pyx_n_s_dtype,&__pyx_n_s_start,&__pyx_n_s_size,0}; + PyObject* values[4] = {0,0,0,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_owner)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 571, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dtype)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 571, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("_rebuild", 1, 4, 4, 1); __PYX_ERR(0, 571, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_start)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 571, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("_rebuild", 1, 4, 4, 2); __PYX_ERR(0, 571, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_size)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 571, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("_rebuild", 1, 4, 4, 3); __PYX_ERR(0, 571, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_rebuild") < 0)) __PYX_ERR(0, 571, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 4)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + } + __pyx_v_owner = values[0]; + __pyx_v_dtype = values[1]; + __pyx_v_start = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_start == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 572, __pyx_L3_error) + __pyx_v_size = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_size == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 572, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_rebuild", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 571, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("arrex.list.typedlist._rebuild", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5arrex_4list_9typedlist_48_rebuild(((PyTypeObject*)__pyx_v_cls), __pyx_v_owner, __pyx_v_dtype, __pyx_v_start, __pyx_v_size); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5arrex_4list_9typedlist_56index(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_value) { - size_t __pyx_v_i; - size_t __pyx_v_j; - char *__pyx_v_data; - char *__pyx_v_val; +static PyObject *__pyx_pf_5arrex_4list_9typedlist_48_rebuild(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_owner, PyObject *__pyx_v_dtype, size_t __pyx_v_start, size_t __pyx_v_size) { + struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_new = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("index", 0); + __Pyx_RefNannySetupContext("_rebuild", 0); - /* "arrex/list.pyx":647 - * cdef char *val - * - * data = self.ptr # <<<<<<<<<<<<<< - * val = PyMem_Malloc(self.dtype.dsize) - * self._setitem(val, value) + /* "arrex/list.pyx":573 + * @classmethod + * def _rebuild(cls, owner, dtype, size_t start, size_t size): + * new = typedlist(owner, dtype) # <<<<<<<<<<<<<< + * assert start <= size + * assert size <= new.size */ - __pyx_v_data = ((char *)__pyx_v_self->ptr); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 573, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_owner); + __Pyx_GIVEREF(__pyx_v_owner); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_owner); + __Pyx_INCREF(__pyx_v_dtype); + __Pyx_GIVEREF(__pyx_v_dtype); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_dtype); + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5arrex_4list_typedlist), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 573, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_new = ((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_t_2); + __pyx_t_2 = 0; - /* "arrex/list.pyx":648 - * - * data = self.ptr - * val = PyMem_Malloc(self.dtype.dsize) # <<<<<<<<<<<<<< - * self._setitem(val, value) - * - */ - __pyx_v_val = ((char *)PyMem_Malloc(__pyx_v_self->dtype->dsize)); - - /* "arrex/list.pyx":649 - * data = self.ptr - * val = PyMem_Malloc(self.dtype.dsize) - * self._setitem(val, value) # <<<<<<<<<<<<<< - * - * i = 0 - */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_setitem(__pyx_v_self, __pyx_v_val, __pyx_v_value); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 649, __pyx_L1_error) - - /* "arrex/list.pyx":651 - * self._setitem(val, value) - * - * i = 0 # <<<<<<<<<<<<<< - * while i < self.size: - * j = 0 - */ - __pyx_v_i = 0; - - /* "arrex/list.pyx":652 - * - * i = 0 - * while i < self.size: # <<<<<<<<<<<<<< - * j = 0 - * while data[i+j] == val[j] and j < self.dtype.dsize: - */ - while (1) { - __pyx_t_2 = ((__pyx_v_i < __pyx_v_self->size) != 0); - if (!__pyx_t_2) break; - - /* "arrex/list.pyx":653 - * i = 0 - * while i < self.size: - * j = 0 # <<<<<<<<<<<<<< - * while data[i+j] == val[j] and j < self.dtype.dsize: - * j += 1 - */ - __pyx_v_j = 0; - - /* "arrex/list.pyx":654 - * while i < self.size: - * j = 0 - * while data[i+j] == val[j] and j < self.dtype.dsize: # <<<<<<<<<<<<<< - * j += 1 - * if j == self.dtype.dsize: - */ - while (1) { - __pyx_t_3 = (((__pyx_v_data[(__pyx_v_i + __pyx_v_j)]) == (__pyx_v_val[__pyx_v_j])) != 0); - if (__pyx_t_3) { - } else { - __pyx_t_2 = __pyx_t_3; - goto __pyx_L7_bool_binop_done; - } - __pyx_t_3 = ((__pyx_v_j < __pyx_v_self->dtype->dsize) != 0); - __pyx_t_2 = __pyx_t_3; - __pyx_L7_bool_binop_done:; - if (!__pyx_t_2) break; - - /* "arrex/list.pyx":655 - * j = 0 - * while data[i+j] == val[j] and j < self.dtype.dsize: - * j += 1 # <<<<<<<<<<<<<< - * if j == self.dtype.dsize: - * PyMem_Free(val) + /* "arrex/list.pyx":574 + * def _rebuild(cls, owner, dtype, size_t start, size_t size): + * new = typedlist(owner, dtype) + * assert start <= size # <<<<<<<<<<<<<< + * assert size <= new.size + * new.ptr = new.ptr + start */ - __pyx_v_j = (__pyx_v_j + 1); + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_3 = (__pyx_v_start <= __pyx_v_size); + if (unlikely(!__pyx_t_3)) { + __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0); + __PYX_ERR(0, 574, __pyx_L1_error) } + } + #else + if ((1)); else __PYX_ERR(0, 574, __pyx_L1_error) + #endif - /* "arrex/list.pyx":656 - * while data[i+j] == val[j] and j < self.dtype.dsize: - * j += 1 - * if j == self.dtype.dsize: # <<<<<<<<<<<<<< - * PyMem_Free(val) - * return i//self.dtype.dsize - */ - __pyx_t_2 = ((__pyx_v_j == __pyx_v_self->dtype->dsize) != 0); - if (__pyx_t_2) { - - /* "arrex/list.pyx":657 - * j += 1 - * if j == self.dtype.dsize: - * PyMem_Free(val) # <<<<<<<<<<<<<< - * return i//self.dtype.dsize - * i += self.dtype.dsize - */ - PyMem_Free(__pyx_v_val); - - /* "arrex/list.pyx":658 - * if j == self.dtype.dsize: - * PyMem_Free(val) - * return i//self.dtype.dsize # <<<<<<<<<<<<<< - * i += self.dtype.dsize - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyInt_FromSize_t((__pyx_v_i / __pyx_v_self->dtype->dsize)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 658, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - - /* "arrex/list.pyx":656 - * while data[i+j] == val[j] and j < self.dtype.dsize: - * j += 1 - * if j == self.dtype.dsize: # <<<<<<<<<<<<<< - * PyMem_Free(val) - * return i//self.dtype.dsize + /* "arrex/list.pyx":575 + * new = typedlist(owner, dtype) + * assert start <= size + * assert size <= new.size # <<<<<<<<<<<<<< + * new.ptr = new.ptr + start + * new.size = size */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_3 = (__pyx_v_size <= __pyx_v_new->size); + if (unlikely(!__pyx_t_3)) { + __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0); + __PYX_ERR(0, 575, __pyx_L1_error) } + } + #else + if ((1)); else __PYX_ERR(0, 575, __pyx_L1_error) + #endif - /* "arrex/list.pyx":659 - * PyMem_Free(val) - * return i//self.dtype.dsize - * i += self.dtype.dsize # <<<<<<<<<<<<<< - * - * PyMem_Free(val) + /* "arrex/list.pyx":576 + * assert start <= size + * assert size <= new.size + * new.ptr = new.ptr + start # <<<<<<<<<<<<<< + * new.size = size + * return new */ - __pyx_v_i = (__pyx_v_i + __pyx_v_self->dtype->dsize); - } + __pyx_v_new->ptr = (__pyx_v_new->ptr + __pyx_v_start); - /* "arrex/list.pyx":661 - * i += self.dtype.dsize - * - * PyMem_Free(val) # <<<<<<<<<<<<<< - * raise IndexError('value not found') + /* "arrex/list.pyx":577 + * assert size <= new.size + * new.ptr = new.ptr + start + * new.size = size # <<<<<<<<<<<<<< + * return new * */ - PyMem_Free(__pyx_v_val); + __pyx_v_new->size = __pyx_v_size; - /* "arrex/list.pyx":662 - * - * PyMem_Free(val) - * raise IndexError('value not found') # <<<<<<<<<<<<<< - * + /* "arrex/list.pyx":578 + * new.ptr = new.ptr + start + * new.size = size + * return new # <<<<<<<<<<<<<< * + * def __getbuffer__(self, Py_buffer *view, int flags): */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 662, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 662, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_new); + __pyx_r = ((PyObject *)__pyx_v_new); + goto __pyx_L0; - /* "arrex/list.pyx":638 - * PyMem_Free(temp) - * - * def index(self, value): # <<<<<<<<<<<<<< - * ''' index(value) + /* "arrex/list.pyx":571 + * ) * + * @classmethod # <<<<<<<<<<<<<< + * def _rebuild(cls, owner, dtype, size_t start, size_t size): + * new = typedlist(owner, dtype) */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("arrex.list.typedlist.index", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("arrex.list.typedlist._rebuild", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_new); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "arrex/list.pyx":115 - * - * cdef char *ptr - * cdef readonly size_t size # <<<<<<<<<<<<<< - * cdef readonly size_t allocated +/* "arrex/list.pyx":580 + * return new * + * def __getbuffer__(self, Py_buffer *view, int flags): # <<<<<<<<<<<<<< + * cdef arrayexposer exp = arrayexposer.__new__(arrayexposer) + * exp.owner = self.owner */ /* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_4size_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_4size_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; +CYTHON_UNUSED static int __pyx_pw_5arrex_4list_9typedlist_51__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_view, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_pw_5arrex_4list_9typedlist_51__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_view, int __pyx_v_flags) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_9typedlist_4size___get__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_r = __pyx_pf_5arrex_4list_9typedlist_50__getbuffer__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), ((Py_buffer *)__pyx_v_view), ((int)__pyx_v_flags)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5arrex_4list_9typedlist_4size___get__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self) { - PyObject *__pyx_r = NULL; +static int __pyx_pf_5arrex_4list_9typedlist_50__getbuffer__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, Py_buffer *__pyx_v_view, int __pyx_v_flags) { + struct __pyx_obj_5arrex_4list_arrayexposer *__pyx_v_exp = 0; + PyObject *__pyx_v_fmt = NULL; + int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + size_t __pyx_t_2; + char *__pyx_t_3; + int __pyx_t_4; + Py_ssize_t *__pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 115, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("arrex.list.typedlist.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + if (unlikely(__pyx_v_view == NULL)) { + PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); + return -1; + } + __Pyx_RefNannySetupContext("__getbuffer__", 0); + __pyx_v_view->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_view->obj); -/* "arrex/list.pyx":116 - * cdef char *ptr - * cdef readonly size_t size - * cdef readonly size_t allocated # <<<<<<<<<<<<<< + /* "arrex/list.pyx":581 * - * cdef DDType dtype + * def __getbuffer__(self, Py_buffer *view, int flags): + * cdef arrayexposer exp = arrayexposer.__new__(arrayexposer) # <<<<<<<<<<<<<< + * exp.owner = self.owner + * exp.shape[0] = self._len() */ + __pyx_t_1 = ((PyObject *)__pyx_tp_new_5arrex_4list_arrayexposer(((PyTypeObject *)__pyx_ptype_5arrex_4list_arrayexposer), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 581, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + __pyx_v_exp = ((struct __pyx_obj_5arrex_4list_arrayexposer *)__pyx_t_1); + __pyx_t_1 = 0; -/* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_9allocated_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_9allocated_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_9typedlist_9allocated___get__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5arrex_4list_9typedlist_9allocated___get__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self) { - 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("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->allocated); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; + /* "arrex/list.pyx":582 + * def __getbuffer__(self, Py_buffer *view, int flags): + * cdef arrayexposer exp = arrayexposer.__new__(arrayexposer) + * exp.owner = self.owner # <<<<<<<<<<<<<< + * exp.shape[0] = self._len() + * + */ + __pyx_t_1 = __pyx_v_self->owner; + __Pyx_INCREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_exp->owner); + __Pyx_DECREF(__pyx_v_exp->owner); + __pyx_v_exp->owner = __pyx_t_1; __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("arrex.list.typedlist.allocated.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -/* "arrex/list.pyx":120 - * cdef DDType dtype + /* "arrex/list.pyx":583 + * cdef arrayexposer exp = arrayexposer.__new__(arrayexposer) + * exp.owner = self.owner + * exp.shape[0] = self._len() # <<<<<<<<<<<<<< * - * cdef readonly object owner # <<<<<<<<<<<<<< + * assign_buffer_obj(view, None) + */ + __pyx_t_2 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_len(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 583, __pyx_L1_error) + (__pyx_v_exp->shape[0]) = __pyx_t_2; + + /* "arrex/list.pyx":585 + * exp.shape[0] = self._len() * - * @property + * assign_buffer_obj(view, None) # <<<<<<<<<<<<<< + * view.obj = exp + * view.buf = self.ptr */ + assign_buffer_obj(__pyx_v_view, Py_None); -/* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_5owner_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5arrex_4list_9typedlist_5owner_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_9typedlist_5owner___get__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self)); + /* "arrex/list.pyx":586 + * + * assign_buffer_obj(view, None) + * view.obj = exp # <<<<<<<<<<<<<< + * view.buf = self.ptr + * view.len = self.size + */ + __Pyx_INCREF((PyObject *)__pyx_v_exp); + __Pyx_GIVEREF((PyObject *)__pyx_v_exp); + __Pyx_GOTREF(__pyx_v_view->obj); + __Pyx_DECREF(__pyx_v_view->obj); + __pyx_v_view->obj = ((PyObject *)__pyx_v_exp); - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "arrex/list.pyx":587 + * assign_buffer_obj(view, None) + * view.obj = exp + * view.buf = self.ptr # <<<<<<<<<<<<<< + * view.len = self.size + * view.ndim = 1 + */ + __pyx_t_3 = __pyx_v_self->ptr; + __pyx_v_view->buf = __pyx_t_3; -static PyObject *__pyx_pf_5arrex_4list_9typedlist_5owner___get__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->owner); - __pyx_r = __pyx_v_self->owner; - goto __pyx_L0; + /* "arrex/list.pyx":588 + * view.obj = exp + * view.buf = self.ptr + * view.len = self.size # <<<<<<<<<<<<<< + * view.ndim = 1 + * + */ + __pyx_t_2 = __pyx_v_self->size; + __pyx_v_view->len = __pyx_t_2; - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "arrex/list.pyx":589 + * view.buf = self.ptr + * view.len = self.size + * view.ndim = 1 # <<<<<<<<<<<<<< + * + * if flags & PyBUF_FORMAT: + */ + __pyx_v_view->ndim = 1; -/* "arrex/list.pyx":668 - * cdef class arrayexposer: - * ''' very simple object that just holds the data for the buffer objects ''' - * cdef readonly object owner # <<<<<<<<<<<<<< - * cdef Py_ssize_t shape[1] + /* "arrex/list.pyx":591 + * view.ndim = 1 * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * fmt = self.dtype.layout + * if fmt is not None: */ + __pyx_t_4 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_4) { -/* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_12arrayexposer_5owner_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5arrex_4list_12arrayexposer_5owner_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_12arrayexposer_5owner___get__(((struct __pyx_obj_5arrex_4list_arrayexposer *)__pyx_v_self)); + /* "arrex/list.pyx":592 + * + * if flags & PyBUF_FORMAT: + * fmt = self.dtype.layout # <<<<<<<<<<<<<< + * if fmt is not None: + * view.itemsize = self.dtype.dsize + */ + __pyx_t_1 = __pyx_v_self->dtype->layout; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_fmt = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "arrex/list.pyx":593 + * if flags & PyBUF_FORMAT: + * fmt = self.dtype.layout + * if fmt is not None: # <<<<<<<<<<<<<< + * view.itemsize = self.dtype.dsize + * view.format = PyBytes_AS_STRING(fmt) + */ + __pyx_t_4 = (__pyx_v_fmt != ((PyObject*)Py_None)); + if (__pyx_t_4) { -static PyObject *__pyx_pf_5arrex_4list_12arrayexposer_5owner___get__(struct __pyx_obj_5arrex_4list_arrayexposer *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->owner); - __pyx_r = __pyx_v_self->owner; - goto __pyx_L0; + /* "arrex/list.pyx":594 + * fmt = self.dtype.layout + * if fmt is not None: + * view.itemsize = self.dtype.dsize # <<<<<<<<<<<<<< + * view.format = PyBytes_AS_STRING(fmt) + * else: + */ + __pyx_t_2 = __pyx_v_self->dtype->dsize; + __pyx_v_view->itemsize = __pyx_t_2; - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "arrex/list.pyx":595 + * if fmt is not None: + * view.itemsize = self.dtype.dsize + * view.format = PyBytes_AS_STRING(fmt) # <<<<<<<<<<<<<< + * else: + * view.itemsize = 1 + */ + __pyx_v_view->format = PyBytes_AS_STRING(__pyx_v_fmt); -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * cdef tuple state - * cdef object _dict + /* "arrex/list.pyx":593 + * if flags & PyBUF_FORMAT: + * fmt = self.dtype.layout + * if fmt is not None: # <<<<<<<<<<<<<< + * view.itemsize = self.dtype.dsize + * view.format = PyBytes_AS_STRING(fmt) */ + goto __pyx_L4; + } -/* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_12arrayexposer_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5arrex_4list_12arrayexposer_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_12arrayexposer___reduce_cython__(((struct __pyx_obj_5arrex_4list_arrayexposer *)__pyx_v_self)); + /* "arrex/list.pyx":597 + * view.format = PyBytes_AS_STRING(fmt) + * else: + * view.itemsize = 1 # <<<<<<<<<<<<<< + * view.format = 'B' + * else: + */ + /*else*/ { + __pyx_v_view->itemsize = 1; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "arrex/list.pyx":598 + * else: + * view.itemsize = 1 + * view.format = 'B' # <<<<<<<<<<<<<< + * else: + * view.itemsize = 1 + */ + __pyx_v_view->format = ((char *)"B"); + } + __pyx_L4:; -static PyObject *__pyx_pf_5arrex_4list_12arrayexposer___reduce_cython__(struct __pyx_obj_5arrex_4list_arrayexposer *__pyx_v_self) { - PyObject *__pyx_v_state = 0; - PyObject *__pyx_v__dict = 0; - int __pyx_v_use_setstate; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); + /* "arrex/list.pyx":591 + * view.ndim = 1 + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * fmt = self.dtype.layout + * if fmt is not None: + */ + goto __pyx_L3; + } - /* "(tree fragment)":5 - * cdef object _dict - * cdef bint use_setstate - * state = (self.owner, self.shape) # <<<<<<<<<<<<<< - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: + /* "arrex/list.pyx":600 + * view.format = 'B' + * else: + * view.itemsize = 1 # <<<<<<<<<<<<<< + * view.format = NULL + * */ - __pyx_t_1 = __Pyx_carray_to_py_Py_ssize_t(__pyx_v_self->shape, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_self->owner); - __Pyx_GIVEREF(__pyx_v_self->owner); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self->owner); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_v_state = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; + /*else*/ { + __pyx_v_view->itemsize = 1; - /* "(tree fragment)":6 - * cdef bint use_setstate - * state = (self.owner, self.shape) - * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< - * if _dict is not None: - * state += (_dict,) + /* "arrex/list.pyx":601 + * else: + * view.itemsize = 1 + * view.format = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_ND: */ - __pyx_t_2 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v__dict = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_v_view->format = NULL; + } + __pyx_L3:; - /* "(tree fragment)":7 - * state = (self.owner, self.shape) - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: # <<<<<<<<<<<<<< - * state += (_dict,) - * use_setstate = True + /* "arrex/list.pyx":603 + * view.format = NULL + * + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< + * view.suboffsets = NULL + * view.strides = &view.itemsize */ - __pyx_t_3 = (__pyx_v__dict != Py_None); - __pyx_t_4 = (__pyx_t_3 != 0); + __pyx_t_4 = ((__pyx_v_flags & PyBUF_ND) != 0); if (__pyx_t_4) { - /* "(tree fragment)":8 - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: - * state += (_dict,) # <<<<<<<<<<<<<< - * use_setstate = True - * else: - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v__dict); - __Pyx_GIVEREF(__pyx_v__dict); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v__dict); - __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_1)); - __pyx_t_1 = 0; - - /* "(tree fragment)":9 - * if _dict is not None: - * state += (_dict,) - * use_setstate = True # <<<<<<<<<<<<<< - * else: - * use_setstate = self.owner is not None - */ - __pyx_v_use_setstate = 1; - - /* "(tree fragment)":7 - * state = (self.owner, self.shape) - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: # <<<<<<<<<<<<<< - * state += (_dict,) - * use_setstate = True - */ - goto __pyx_L3; - } - - /* "(tree fragment)":11 - * use_setstate = True - * else: - * use_setstate = self.owner is not None # <<<<<<<<<<<<<< - * if use_setstate: - * return __pyx_unpickle_arrayexposer, (type(self), 0xc9dda6f, None), state + /* "arrex/list.pyx":604 + * + * if flags & PyBUF_ND: + * view.suboffsets = NULL # <<<<<<<<<<<<<< + * view.strides = &view.itemsize + * view.shape = exp.shape */ - /*else*/ { - __pyx_t_4 = (__pyx_v_self->owner != Py_None); - __pyx_v_use_setstate = __pyx_t_4; - } - __pyx_L3:; + __pyx_v_view->suboffsets = NULL; - /* "(tree fragment)":12 - * else: - * use_setstate = self.owner is not None - * if use_setstate: # <<<<<<<<<<<<<< - * return __pyx_unpickle_arrayexposer, (type(self), 0xc9dda6f, None), state - * else: + /* "arrex/list.pyx":605 + * if flags & PyBUF_ND: + * view.suboffsets = NULL + * view.strides = &view.itemsize # <<<<<<<<<<<<<< + * view.shape = exp.shape + * else: */ - __pyx_t_4 = (__pyx_v_use_setstate != 0); - if (__pyx_t_4) { + __pyx_v_view->strides = (&__pyx_v_view->itemsize); - /* "(tree fragment)":13 - * use_setstate = self.owner is not None - * if use_setstate: - * return __pyx_unpickle_arrayexposer, (type(self), 0xc9dda6f, None), state # <<<<<<<<<<<<<< - * else: - * return __pyx_unpickle_arrayexposer, (type(self), 0xc9dda6f, state) + /* "arrex/list.pyx":606 + * view.suboffsets = NULL + * view.strides = &view.itemsize + * view.shape = exp.shape # <<<<<<<<<<<<<< + * else: + * view.shape = NULL */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pyx_unpickle_arrayexposer); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_INCREF(__pyx_int_211671663); - __Pyx_GIVEREF(__pyx_int_211671663); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_211671663); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_2, 2, Py_None); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); - __Pyx_INCREF(__pyx_v_state); - __Pyx_GIVEREF(__pyx_v_state); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; + __pyx_t_5 = __pyx_v_exp->shape; + __pyx_v_view->shape = __pyx_t_5; - /* "(tree fragment)":12 - * else: - * use_setstate = self.owner is not None - * if use_setstate: # <<<<<<<<<<<<<< - * return __pyx_unpickle_arrayexposer, (type(self), 0xc9dda6f, None), state - * else: + /* "arrex/list.pyx":603 + * view.format = NULL + * + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< + * view.suboffsets = NULL + * view.strides = &view.itemsize */ + goto __pyx_L5; } - /* "(tree fragment)":15 - * return __pyx_unpickle_arrayexposer, (type(self), 0xc9dda6f, None), state - * else: - * return __pyx_unpickle_arrayexposer, (type(self), 0xc9dda6f, state) # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * __pyx_unpickle_arrayexposer__set_state(self, __pyx_state) + /* "arrex/list.pyx":608 + * view.shape = exp.shape + * else: + * view.shape = NULL # <<<<<<<<<<<<<< + * + * */ /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_arrayexposer); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_INCREF(__pyx_int_211671663); - __Pyx_GIVEREF(__pyx_int_211671663); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_211671663); - __Pyx_INCREF(__pyx_v_state); - __Pyx_GIVEREF(__pyx_v_state); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_state); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); - __pyx_t_5 = 0; - __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_v_view->shape = NULL; } + __pyx_L5:; - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * cdef tuple state - * cdef object _dict + /* "arrex/list.pyx":580 + * return new + * + * def __getbuffer__(self, Py_buffer *view, int flags): # <<<<<<<<<<<<<< + * cdef arrayexposer exp = arrayexposer.__new__(arrayexposer) + * exp.owner = self.owner */ /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("arrex.list.arrayexposer.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("arrex.list.typedlist.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_view->obj != NULL) { + __Pyx_GOTREF(__pyx_v_view->obj); + __Pyx_DECREF(__pyx_v_view->obj); __pyx_v_view->obj = 0; + } + goto __pyx_L2; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_state); - __Pyx_XDECREF(__pyx_v__dict); - __Pyx_XGIVEREF(__pyx_r); + if (__pyx_v_view->obj == Py_None) { + __Pyx_GOTREF(__pyx_v_view->obj); + __Pyx_DECREF(__pyx_v_view->obj); __pyx_v_view->obj = 0; + } + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_exp); + __Pyx_XDECREF(__pyx_v_fmt); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":16 - * else: - * return __pyx_unpickle_arrayexposer, (type(self), 0xc9dda6f, state) - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * __pyx_unpickle_arrayexposer__set_state(self, __pyx_state) +/* "arrex/list.pyx":611 + * + * + * def __releasebuffer__(self, Py_buffer *view): # <<<<<<<<<<<<<< + * cdef arrayexposer exp = view.obj + * print('** release buffer', sys.getrefcount(exp.owner)) */ /* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_12arrayexposer_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw_5arrex_4list_12arrayexposer_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = 0; +CYTHON_UNUSED static void __pyx_pw_5arrex_4list_9typedlist_53__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_view); /*proto*/ +CYTHON_UNUSED static void __pyx_pw_5arrex_4list_9typedlist_53__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_view) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_12arrayexposer_2__setstate_cython__(((struct __pyx_obj_5arrex_4list_arrayexposer *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); + __pyx_pf_5arrex_4list_9typedlist_52__releasebuffer__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), ((Py_buffer *)__pyx_v_view)); /* function exit code */ __Pyx_RefNannyFinishContext(); - return __pyx_r; } -static PyObject *__pyx_pf_5arrex_4list_12arrayexposer_2__setstate_cython__(struct __pyx_obj_5arrex_4list_arrayexposer *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; +static void __pyx_pf_5arrex_4list_9typedlist_52__releasebuffer__(CYTHON_UNUSED struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, Py_buffer *__pyx_v_view) { + struct __pyx_obj_5arrex_4list_arrayexposer *__pyx_v_exp = 0; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); + __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "(tree fragment)":17 - * return __pyx_unpickle_arrayexposer, (type(self), 0xc9dda6f, state) - * def __setstate_cython__(self, __pyx_state): - * __pyx_unpickle_arrayexposer__set_state(self, __pyx_state) # <<<<<<<<<<<<<< + /* "arrex/list.pyx":612 + * + * def __releasebuffer__(self, Py_buffer *view): + * cdef arrayexposer exp = view.obj # <<<<<<<<<<<<<< + * print('** release buffer', sys.getrefcount(exp.owner)) + * exp.owner = None */ - if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error) - __pyx_t_1 = __pyx_f_5arrex_4list___pyx_unpickle_arrayexposer__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_v_view->obj) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_view->obj, __pyx_ptype_5arrex_4list_arrayexposer))))) __PYX_ERR(0, 612, __pyx_L1_error) + __pyx_t_1 = __pyx_v_view->obj; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_exp = ((struct __pyx_obj_5arrex_4list_arrayexposer *)__pyx_t_1); + __pyx_t_1 = 0; - /* "(tree fragment)":16 - * else: - * return __pyx_unpickle_arrayexposer, (type(self), 0xc9dda6f, state) - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * __pyx_unpickle_arrayexposer__set_state(self, __pyx_state) + /* "arrex/list.pyx":613 + * def __releasebuffer__(self, Py_buffer *view): + * cdef arrayexposer exp = view.obj + * print('** release buffer', sys.getrefcount(exp.owner)) # <<<<<<<<<<<<<< + * exp.owner = None + * view.obj = None */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 613, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_getrefcount); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 613, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_4 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_4 = 1; + } + } + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_exp->owner}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 613, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 613, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_kp_u_release_buffer); + __Pyx_GIVEREF(__pyx_kp_u_release_buffer); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_release_buffer); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 613, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("arrex.list.arrayexposer.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "arrex/list.pyx":677 - * cdef size_t position - * - * def __init__(self): # <<<<<<<<<<<<<< - * raise TypeError('arrayiter must not be instanciated explicitely') + /* "arrex/list.pyx":614 + * cdef arrayexposer exp = view.obj + * print('** release buffer', sys.getrefcount(exp.owner)) + * exp.owner = None # <<<<<<<<<<<<<< + * view.obj = None * */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_exp->owner); + __Pyx_DECREF(__pyx_v_exp->owner); + __pyx_v_exp->owner = Py_None; -/* Python wrapper */ -static int __pyx_pw_5arrex_4list_9arrayiter_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_5arrex_4list_9arrayiter_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - 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; - __pyx_r = __pyx_pf_5arrex_4list_9arrayiter___init__(((struct __pyx_obj_5arrex_4list_arrayiter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_5arrex_4list_9arrayiter___init__(CYTHON_UNUSED struct __pyx_obj_5arrex_4list_arrayiter *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__", 0); - - /* "arrex/list.pyx":678 - * - * def __init__(self): - * raise TypeError('arrayiter must not be instanciated explicitely') # <<<<<<<<<<<<<< + /* "arrex/list.pyx":615 + * print('** release buffer', sys.getrefcount(exp.owner)) + * exp.owner = None + * view.obj = None # <<<<<<<<<<<<<< * - * def __iter__(self): + * def reverse(self): */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 678, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 678, __pyx_L1_error) + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_view->obj); + __Pyx_DECREF(__pyx_v_view->obj); + __pyx_v_view->obj = Py_None; - /* "arrex/list.pyx":677 - * cdef size_t position + /* "arrex/list.pyx":611 * - * def __init__(self): # <<<<<<<<<<<<<< - * raise TypeError('arrayiter must not be instanciated explicitely') * + * def __releasebuffer__(self, Py_buffer *view): # <<<<<<<<<<<<<< + * cdef arrayexposer exp = view.obj + * print('** release buffer', sys.getrefcount(exp.owner)) */ /* function exit code */ + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("arrex.list.arrayiter.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_WriteUnraisable("arrex.list.typedlist.__releasebuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_exp); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "arrex/list.pyx":680 - * raise TypeError('arrayiter must not be instanciated explicitely') +/* "arrex/list.pyx":617 + * view.obj = None * - * def __iter__(self): # <<<<<<<<<<<<<< - * return self + * def reverse(self): # <<<<<<<<<<<<<< + * ''' reverse() * */ /* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_9arrayiter_3__iter__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5arrex_4list_9arrayiter_3__iter__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_5arrex_4list_9typedlist_55reverse(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5arrex_4list_9typedlist_54reverse, " reverse()\n\t\t\n\t\t\treverse the order of elementd contained \n\t\t"); +static PyMethodDef __pyx_mdef_5arrex_4list_9typedlist_55reverse = {"reverse", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9typedlist_55reverse, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_54reverse}; +static PyObject *__pyx_pw_5arrex_4list_9typedlist_55reverse(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_9arrayiter_2__iter__(((struct __pyx_obj_5arrex_4list_arrayiter *)__pyx_v_self)); + __Pyx_RefNannySetupContext("reverse (wrapper)", 0); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("reverse", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "reverse", 0))) return NULL; + __pyx_r = __pyx_pf_5arrex_4list_9typedlist_54reverse(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5arrex_4list_9arrayiter_2__iter__(struct __pyx_obj_5arrex_4list_arrayiter *__pyx_v_self) { +static PyObject *__pyx_pf_5arrex_4list_9typedlist_54reverse(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self) { + char *__pyx_v_temp; + char *__pyx_v_first; + char *__pyx_v_last; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__iter__", 0); + char *__pyx_t_1; + int __pyx_t_2; + __Pyx_RefNannySetupContext("reverse", 0); - /* "arrex/list.pyx":681 - * - * def __iter__(self): - * return self # <<<<<<<<<<<<<< + /* "arrex/list.pyx":627 + * cdef size_t i * - * def __next__(self): + * temp = PyMem_Malloc(self.dtype.dsize) # <<<<<<<<<<<<<< + * first = self.ptr + * last = self.ptr + self.size - self.dtype.dsize */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; + __pyx_v_temp = ((char *)PyMem_Malloc(__pyx_v_self->dtype->dsize)); - /* "arrex/list.pyx":680 - * raise TypeError('arrayiter must not be instanciated explicitely') - * - * def __iter__(self): # <<<<<<<<<<<<<< - * return self + /* "arrex/list.pyx":628 * + * temp = PyMem_Malloc(self.dtype.dsize) + * first = self.ptr # <<<<<<<<<<<<<< + * last = self.ptr + self.size - self.dtype.dsize + * while first < last: */ + __pyx_t_1 = __pyx_v_self->ptr; + __pyx_v_first = __pyx_t_1; - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "arrex/list.pyx":629 + * temp = PyMem_Malloc(self.dtype.dsize) + * first = self.ptr + * last = self.ptr + self.size - self.dtype.dsize # <<<<<<<<<<<<<< + * while first < last: + * memcpy(temp, first, self.dtype.dsize) + */ + __pyx_v_last = ((__pyx_v_self->ptr + __pyx_v_self->size) - __pyx_v_self->dtype->dsize); -/* "arrex/list.pyx":683 - * return self - * - * def __next__(self): # <<<<<<<<<<<<<< - * if self.position + self.array.dtype.dsize > self.array.size: - * raise StopIteration + /* "arrex/list.pyx":630 + * first = self.ptr + * last = self.ptr + self.size - self.dtype.dsize + * while first < last: # <<<<<<<<<<<<<< + * memcpy(temp, first, self.dtype.dsize) + * memcpy(first, last, self.dtype.dsize) */ + while (1) { + __pyx_t_2 = (((size_t)__pyx_v_first) < ((size_t)__pyx_v_last)); + if (!__pyx_t_2) break; -/* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_9arrayiter_5__next__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5arrex_4list_9arrayiter_5__next__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__next__ (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_9arrayiter_4__next__(((struct __pyx_obj_5arrex_4list_arrayiter *)__pyx_v_self)); + /* "arrex/list.pyx":631 + * last = self.ptr + self.size - self.dtype.dsize + * while first < last: + * memcpy(temp, first, self.dtype.dsize) # <<<<<<<<<<<<<< + * memcpy(first, last, self.dtype.dsize) + * memcpy(last, temp, self.dtype.dsize) + */ + (void)(memcpy(__pyx_v_temp, __pyx_v_first, __pyx_v_self->dtype->dsize)); - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "arrex/list.pyx":632 + * while first < last: + * memcpy(temp, first, self.dtype.dsize) + * memcpy(first, last, self.dtype.dsize) # <<<<<<<<<<<<<< + * memcpy(last, temp, self.dtype.dsize) + * first += self.dtype.dsize + */ + (void)(memcpy(__pyx_v_first, __pyx_v_last, __pyx_v_self->dtype->dsize)); -static PyObject *__pyx_pf_5arrex_4list_9arrayiter_4__next__(struct __pyx_obj_5arrex_4list_arrayiter *__pyx_v_self) { - PyObject *__pyx_v_item = NULL; - 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("__next__", 0); - - /* "arrex/list.pyx":684 - * - * def __next__(self): - * if self.position + self.array.dtype.dsize > self.array.size: # <<<<<<<<<<<<<< - * raise StopIteration - * item = self.array._getitem(self.array.ptr + self.position) + /* "arrex/list.pyx":633 + * memcpy(temp, first, self.dtype.dsize) + * memcpy(first, last, self.dtype.dsize) + * memcpy(last, temp, self.dtype.dsize) # <<<<<<<<<<<<<< + * first += self.dtype.dsize + * last -= self.dtype.dsize */ - __pyx_t_1 = (((__pyx_v_self->position + __pyx_v_self->array->dtype->dsize) > __pyx_v_self->array->size) != 0); - if (unlikely(__pyx_t_1)) { + (void)(memcpy(__pyx_v_last, __pyx_v_temp, __pyx_v_self->dtype->dsize)); - /* "arrex/list.pyx":685 - * def __next__(self): - * if self.position + self.array.dtype.dsize > self.array.size: - * raise StopIteration # <<<<<<<<<<<<<< - * item = self.array._getitem(self.array.ptr + self.position) - * self.position += self.array.dtype.dsize + /* "arrex/list.pyx":634 + * memcpy(first, last, self.dtype.dsize) + * memcpy(last, temp, self.dtype.dsize) + * first += self.dtype.dsize # <<<<<<<<<<<<<< + * last -= self.dtype.dsize + * PyMem_Free(temp) */ - __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0); - __PYX_ERR(0, 685, __pyx_L1_error) + __pyx_v_first = (__pyx_v_first + __pyx_v_self->dtype->dsize); - /* "arrex/list.pyx":684 + /* "arrex/list.pyx":635 + * memcpy(last, temp, self.dtype.dsize) + * first += self.dtype.dsize + * last -= self.dtype.dsize # <<<<<<<<<<<<<< + * PyMem_Free(temp) * - * def __next__(self): - * if self.position + self.array.dtype.dsize > self.array.size: # <<<<<<<<<<<<<< - * raise StopIteration - * item = self.array._getitem(self.array.ptr + self.position) */ + __pyx_v_last = (__pyx_v_last - __pyx_v_self->dtype->dsize); } - /* "arrex/list.pyx":686 - * if self.position + self.array.dtype.dsize > self.array.size: - * raise StopIteration - * item = self.array._getitem(self.array.ptr + self.position) # <<<<<<<<<<<<<< - * self.position += self.array.dtype.dsize - * return item - */ - __pyx_t_2 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->array->__pyx_vtab)->_getitem(__pyx_v_self->array, (__pyx_v_self->array->ptr + __pyx_v_self->position)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 686, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_item = __pyx_t_2; - __pyx_t_2 = 0; - - /* "arrex/list.pyx":687 - * raise StopIteration - * item = self.array._getitem(self.array.ptr + self.position) - * self.position += self.array.dtype.dsize # <<<<<<<<<<<<<< - * return item + /* "arrex/list.pyx":636 + * first += self.dtype.dsize + * last -= self.dtype.dsize + * PyMem_Free(temp) # <<<<<<<<<<<<<< * + * def index(self, value): */ - __pyx_v_self->position = (__pyx_v_self->position + __pyx_v_self->array->dtype->dsize); + PyMem_Free(__pyx_v_temp); - /* "arrex/list.pyx":688 - * item = self.array._getitem(self.array.ptr + self.position) - * self.position += self.array.dtype.dsize - * return item # <<<<<<<<<<<<<< - * + /* "arrex/list.pyx":617 + * view.obj = None * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_item); - __pyx_r = __pyx_v_item; - goto __pyx_L0; - - /* "arrex/list.pyx":683 - * return self + * def reverse(self): # <<<<<<<<<<<<<< + * ''' reverse() * - * def __next__(self): # <<<<<<<<<<<<<< - * if self.position + self.array.dtype.dsize > self.array.size: - * raise StopIteration */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("arrex.list.arrayiter.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_item); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * cdef tuple state - * cdef object _dict +/* "arrex/list.pyx":638 + * PyMem_Free(temp) + * + * def index(self, value): # <<<<<<<<<<<<<< + * ''' index(value) + * */ /* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_9arrayiter_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5arrex_4list_9arrayiter_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_5arrex_4list_9typedlist_57index(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5arrex_4list_9typedlist_56index, " index(value)\n\t\t\n\t\t\treturn the index of the first element binarily equal to the given one \n\t\t"); +static PyMethodDef __pyx_mdef_5arrex_4list_9typedlist_57index = {"index", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9typedlist_57index, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_56index}; +static PyObject *__pyx_pw_5arrex_4list_9typedlist_57index(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_value = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_9arrayiter_6__reduce_cython__(((struct __pyx_obj_5arrex_4list_arrayiter *)__pyx_v_self)); + __Pyx_RefNannySetupContext("index (wrapper)", 0); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_value,0}; + PyObject* values[1] = {0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_value)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 638, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "index") < 0)) __PYX_ERR(0, 638, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_value = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("index", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 638, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("arrex.list.typedlist.index", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5arrex_4list_9typedlist_56index(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self), __pyx_v_value); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5arrex_4list_9arrayiter_6__reduce_cython__(struct __pyx_obj_5arrex_4list_arrayiter *__pyx_v_self) { - PyObject *__pyx_v_state = 0; - PyObject *__pyx_v__dict = 0; - int __pyx_v_use_setstate; +static PyObject *__pyx_pf_5arrex_4list_9typedlist_56index(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self, PyObject *__pyx_v_value) { + size_t __pyx_v_i; + size_t __pyx_v_j; + char *__pyx_v_data; + char *__pyx_v_val; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + int __pyx_t_1; + int __pyx_t_2; int __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); + __Pyx_RefNannySetupContext("index", 0); - /* "(tree fragment)":5 - * cdef object _dict - * cdef bint use_setstate - * state = (self.array, self.position) # <<<<<<<<<<<<<< - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: + /* "arrex/list.pyx":647 + * cdef char *val + * + * data = self.ptr # <<<<<<<<<<<<<< + * val = PyMem_Malloc(self.dtype.dsize) + * self._setitem(val, value) */ - __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->position); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_v_self->array)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self->array)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self->array)); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_v_state = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_v_data = ((char *)__pyx_v_self->ptr); - /* "(tree fragment)":6 - * cdef bint use_setstate - * state = (self.array, self.position) - * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< - * if _dict is not None: - * state += (_dict,) + /* "arrex/list.pyx":648 + * + * data = self.ptr + * val = PyMem_Malloc(self.dtype.dsize) # <<<<<<<<<<<<<< + * self._setitem(val, value) + * */ - __pyx_t_2 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v__dict = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_v_val = ((char *)PyMem_Malloc(__pyx_v_self->dtype->dsize)); - /* "(tree fragment)":7 - * state = (self.array, self.position) - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: # <<<<<<<<<<<<<< - * state += (_dict,) - * use_setstate = True + /* "arrex/list.pyx":649 + * data = self.ptr + * val = PyMem_Malloc(self.dtype.dsize) + * self._setitem(val, value) # <<<<<<<<<<<<<< + * + * i = 0 */ - __pyx_t_3 = (__pyx_v__dict != Py_None); - __pyx_t_4 = (__pyx_t_3 != 0); - if (__pyx_t_4) { + __pyx_t_1 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_setitem(__pyx_v_self, __pyx_v_val, __pyx_v_value); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 649, __pyx_L1_error) - /* "(tree fragment)":8 - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: - * state += (_dict,) # <<<<<<<<<<<<<< - * use_setstate = True - * else: + /* "arrex/list.pyx":651 + * self._setitem(val, value) + * + * i = 0 # <<<<<<<<<<<<<< + * while i < self.size: + * j = 0 */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v__dict); - __Pyx_GIVEREF(__pyx_v__dict); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v__dict); - __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_1)); - __pyx_t_1 = 0; + __pyx_v_i = 0; - /* "(tree fragment)":9 - * if _dict is not None: - * state += (_dict,) - * use_setstate = True # <<<<<<<<<<<<<< - * else: - * use_setstate = self.array is not None + /* "arrex/list.pyx":652 + * + * i = 0 + * while i < self.size: # <<<<<<<<<<<<<< + * j = 0 + * while data[i+j] == val[j] and j < self.dtype.dsize: */ - __pyx_v_use_setstate = 1; + while (1) { + __pyx_t_2 = (__pyx_v_i < __pyx_v_self->size); + if (!__pyx_t_2) break; - /* "(tree fragment)":7 - * state = (self.array, self.position) - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: # <<<<<<<<<<<<<< - * state += (_dict,) - * use_setstate = True + /* "arrex/list.pyx":653 + * i = 0 + * while i < self.size: + * j = 0 # <<<<<<<<<<<<<< + * while data[i+j] == val[j] and j < self.dtype.dsize: + * j += 1 */ - goto __pyx_L3; - } + __pyx_v_j = 0; - /* "(tree fragment)":11 - * use_setstate = True - * else: - * use_setstate = self.array is not None # <<<<<<<<<<<<<< - * if use_setstate: - * return __pyx_unpickle_arrayiter, (type(self), 0x194d213, None), state + /* "arrex/list.pyx":654 + * while i < self.size: + * j = 0 + * while data[i+j] == val[j] and j < self.dtype.dsize: # <<<<<<<<<<<<<< + * j += 1 + * if j == self.dtype.dsize: */ - /*else*/ { - __pyx_t_4 = (((PyObject *)__pyx_v_self->array) != Py_None); - __pyx_v_use_setstate = __pyx_t_4; - } - __pyx_L3:; + while (1) { + __pyx_t_3 = ((__pyx_v_data[(__pyx_v_i + __pyx_v_j)]) == (__pyx_v_val[__pyx_v_j])); + if (__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_3 = (__pyx_v_j < __pyx_v_self->dtype->dsize); + __pyx_t_2 = __pyx_t_3; + __pyx_L7_bool_binop_done:; + if (!__pyx_t_2) break; - /* "(tree fragment)":12 - * else: - * use_setstate = self.array is not None - * if use_setstate: # <<<<<<<<<<<<<< - * return __pyx_unpickle_arrayiter, (type(self), 0x194d213, None), state - * else: + /* "arrex/list.pyx":655 + * j = 0 + * while data[i+j] == val[j] and j < self.dtype.dsize: + * j += 1 # <<<<<<<<<<<<<< + * if j == self.dtype.dsize: + * PyMem_Free(val) */ - __pyx_t_4 = (__pyx_v_use_setstate != 0); - if (__pyx_t_4) { + __pyx_v_j = (__pyx_v_j + 1); + } - /* "(tree fragment)":13 - * use_setstate = self.array is not None - * if use_setstate: - * return __pyx_unpickle_arrayiter, (type(self), 0x194d213, None), state # <<<<<<<<<<<<<< - * else: - * return __pyx_unpickle_arrayiter, (type(self), 0x194d213, state) + /* "arrex/list.pyx":656 + * while data[i+j] == val[j] and j < self.dtype.dsize: + * j += 1 + * if j == self.dtype.dsize: # <<<<<<<<<<<<<< + * PyMem_Free(val) + * return i//self.dtype.dsize */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pyx_unpickle_arrayiter); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_INCREF(__pyx_int_26530323); - __Pyx_GIVEREF(__pyx_int_26530323); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_26530323); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_2, 2, Py_None); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); - __Pyx_INCREF(__pyx_v_state); - __Pyx_GIVEREF(__pyx_v_state); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; + __pyx_t_2 = (__pyx_v_j == __pyx_v_self->dtype->dsize); + if (__pyx_t_2) { - /* "(tree fragment)":12 - * else: - * use_setstate = self.array is not None - * if use_setstate: # <<<<<<<<<<<<<< - * return __pyx_unpickle_arrayiter, (type(self), 0x194d213, None), state - * else: + /* "arrex/list.pyx":657 + * j += 1 + * if j == self.dtype.dsize: + * PyMem_Free(val) # <<<<<<<<<<<<<< + * return i//self.dtype.dsize + * i += self.dtype.dsize */ - } + PyMem_Free(__pyx_v_val); - /* "(tree fragment)":15 - * return __pyx_unpickle_arrayiter, (type(self), 0x194d213, None), state - * else: - * return __pyx_unpickle_arrayiter, (type(self), 0x194d213, state) # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * __pyx_unpickle_arrayiter__set_state(self, __pyx_state) + /* "arrex/list.pyx":658 + * if j == self.dtype.dsize: + * PyMem_Free(val) + * return i//self.dtype.dsize # <<<<<<<<<<<<<< + * i += self.dtype.dsize + * */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_arrayiter); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_INCREF(__pyx_int_26530323); - __Pyx_GIVEREF(__pyx_int_26530323); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_26530323); - __Pyx_INCREF(__pyx_v_state); - __Pyx_GIVEREF(__pyx_v_state); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_state); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); - __pyx_t_5 = 0; - __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PyInt_FromSize_t((__pyx_v_i / __pyx_v_self->dtype->dsize)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 658, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "arrex/list.pyx":656 + * while data[i+j] == val[j] and j < self.dtype.dsize: + * j += 1 + * if j == self.dtype.dsize: # <<<<<<<<<<<<<< + * PyMem_Free(val) + * return i//self.dtype.dsize + */ + } + + /* "arrex/list.pyx":659 + * PyMem_Free(val) + * return i//self.dtype.dsize + * i += self.dtype.dsize # <<<<<<<<<<<<<< + * + * PyMem_Free(val) + */ + __pyx_v_i = (__pyx_v_i + __pyx_v_self->dtype->dsize); } - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * cdef tuple state - * cdef object _dict + /* "arrex/list.pyx":661 + * i += self.dtype.dsize + * + * PyMem_Free(val) # <<<<<<<<<<<<<< + * raise IndexError('value not found') + * + */ + PyMem_Free(__pyx_v_val); + + /* "arrex/list.pyx":662 + * + * PyMem_Free(val) + * raise IndexError('value not found') # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 662, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 662, __pyx_L1_error) + + /* "arrex/list.pyx":638 + * PyMem_Free(temp) + * + * def index(self, value): # <<<<<<<<<<<<<< + * ''' index(value) + * */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("arrex.list.arrayiter.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("arrex.list.typedlist.index", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_state); - __Pyx_XDECREF(__pyx_v__dict); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":16 - * else: - * return __pyx_unpickle_arrayiter, (type(self), 0x194d213, state) - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * __pyx_unpickle_arrayiter__set_state(self, __pyx_state) +/* "arrex/list.pyx":115 + * + * cdef char *ptr + * cdef readonly size_t size # <<<<<<<<<<<<<< + * cdef readonly size_t allocated + * */ /* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_9arrayiter_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw_5arrex_4list_9arrayiter_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pw_5arrex_4list_9typedlist_4size_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5arrex_4list_9typedlist_4size_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_5arrex_4list_9arrayiter_8__setstate_cython__(((struct __pyx_obj_5arrex_4list_arrayiter *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_5arrex_4list_9typedlist_4size___get__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5arrex_4list_9arrayiter_8__setstate_cython__(struct __pyx_obj_5arrex_4list_arrayiter *__pyx_v_self, PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pf_5arrex_4list_9typedlist_4size___get__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self) { 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("__setstate_cython__", 0); - - /* "(tree fragment)":17 - * return __pyx_unpickle_arrayiter, (type(self), 0x194d213, state) - * def __setstate_cython__(self, __pyx_state): - * __pyx_unpickle_arrayiter__set_state(self, __pyx_state) # <<<<<<<<<<<<<< - */ - if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error) - __pyx_t_1 = __pyx_f_5arrex_4list___pyx_unpickle_arrayiter__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "(tree fragment)":16 - * else: - * return __pyx_unpickle_arrayiter, (type(self), 0x194d213, state) - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * __pyx_unpickle_arrayiter__set_state(self, __pyx_state) - */ + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("arrex.list.arrayiter.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("arrex.list.typedlist.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -9263,1870 +11678,2332 @@ static PyObject *__pyx_pf_5arrex_4list_9arrayiter_8__setstate_cython__(struct __ return __pyx_r; } -/* "(tree fragment)":1 - * def __pyx_unpickle_arrayexposer(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result +/* "arrex/list.pyx":116 + * cdef char *ptr + * cdef readonly size_t size + * cdef readonly size_t allocated # <<<<<<<<<<<<<< + * + * cdef DDType dtype */ /* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_1__pyx_unpickle_arrayexposer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_5arrex_4list_1__pyx_unpickle_arrayexposer = {"__pyx_unpickle_arrayexposer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5arrex_4list_1__pyx_unpickle_arrayexposer, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_5arrex_4list_1__pyx_unpickle_arrayexposer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v___pyx_type = 0; - long __pyx_v___pyx_checksum; - PyObject *__pyx_v___pyx_state = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +static PyObject *__pyx_pw_5arrex_4list_9typedlist_9allocated_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5arrex_4list_9typedlist_9allocated_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__pyx_unpickle_arrayexposer (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_arrayexposer", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_arrayexposer", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_arrayexposer") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0]; - __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) - __pyx_v___pyx_state = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_arrayexposer", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("arrex.list.__pyx_unpickle_arrayexposer", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5arrex_4list___pyx_unpickle_arrayexposer(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_5arrex_4list_9typedlist_9allocated___get__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5arrex_4list___pyx_unpickle_arrayexposer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_v___pyx_PickleError = 0; - PyObject *__pyx_v___pyx_result = 0; +static PyObject *__pyx_pf_5arrex_4list_9typedlist_9allocated___get__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self) { 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_t_6; + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_unpickle_arrayexposer", 0); + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->allocated); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "(tree fragment)":4 - * cdef object __pyx_PickleError - * cdef object __pyx_result - * if __pyx_checksum != 0xc9dda6f: # <<<<<<<<<<<<<< - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (%s vs 0xc9dda6f = (owner, shape))" % __pyx_checksum) - */ - __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xc9dda6f) != 0); - if (__pyx_t_1) { + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("arrex.list.typedlist.allocated.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "(tree fragment)":5 - * cdef object __pyx_result - * if __pyx_checksum != 0xc9dda6f: - * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< - * raise __pyx_PickleError("Incompatible checksums (%s vs 0xc9dda6f = (owner, shape))" % __pyx_checksum) - * __pyx_result = arrayexposer.__new__(__pyx_type) +/* "arrex/list.pyx":120 + * cdef DDType dtype + * + * cdef readonly object owner # <<<<<<<<<<<<<< + * + * @property */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_n_s_PickleError); - __Pyx_GIVEREF(__pyx_n_s_PickleError); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError); - __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_2); - __pyx_v___pyx_PickleError = __pyx_t_2; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "(tree fragment)":6 - * if __pyx_checksum != 0xc9dda6f: - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (%s vs 0xc9dda6f = (owner, shape))" % __pyx_checksum) # <<<<<<<<<<<<<< - * __pyx_result = arrayexposer.__new__(__pyx_type) - * if __pyx_state is not None: - */ - __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xc9, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_INCREF(__pyx_v___pyx_PickleError); - __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(1, 6, __pyx_L1_error) +/* Python wrapper */ +static PyObject *__pyx_pw_5arrex_4list_9typedlist_5owner_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5arrex_4list_9typedlist_5owner_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_5arrex_4list_9typedlist_5owner___get__(((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_v_self)); - /* "(tree fragment)":4 - * cdef object __pyx_PickleError - * cdef object __pyx_result - * if __pyx_checksum != 0xc9dda6f: # <<<<<<<<<<<<<< - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (%s vs 0xc9dda6f = (owner, shape))" % __pyx_checksum) - */ - } + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "(tree fragment)":7 - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (%s vs 0xc9dda6f = (owner, shape))" % __pyx_checksum) - * __pyx_result = arrayexposer.__new__(__pyx_type) # <<<<<<<<<<<<<< - * if __pyx_state is not None: - * __pyx_unpickle_arrayexposer__set_state( __pyx_result, __pyx_state) - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5arrex_4list_arrayexposer), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v___pyx_result = __pyx_t_3; - __pyx_t_3 = 0; +static PyObject *__pyx_pf_5arrex_4list_9typedlist_5owner___get__(struct __pyx_obj_5arrex_4list_typedlist *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->owner); + __pyx_r = __pyx_v_self->owner; + goto __pyx_L0; - /* "(tree fragment)":8 - * raise __pyx_PickleError("Incompatible checksums (%s vs 0xc9dda6f = (owner, shape))" % __pyx_checksum) - * __pyx_result = arrayexposer.__new__(__pyx_type) - * if __pyx_state is not None: # <<<<<<<<<<<<<< - * __pyx_unpickle_arrayexposer__set_state( __pyx_result, __pyx_state) - * return __pyx_result - */ - __pyx_t_1 = (__pyx_v___pyx_state != Py_None); - __pyx_t_6 = (__pyx_t_1 != 0); - if (__pyx_t_6) { + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "(tree fragment)":9 - * __pyx_result = arrayexposer.__new__(__pyx_type) - * if __pyx_state is not None: - * __pyx_unpickle_arrayexposer__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< - * return __pyx_result - * cdef __pyx_unpickle_arrayexposer__set_state(arrayexposer __pyx_result, tuple __pyx_state): +/* "arrex/list.pyx":668 + * cdef class arrayexposer: + * ''' very simple object that just holds the data for the buffer objects ''' + * cdef readonly object owner # <<<<<<<<<<<<<< + * cdef Py_ssize_t shape[1] + * */ - if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error) - __pyx_t_3 = __pyx_f_5arrex_4list___pyx_unpickle_arrayexposer__set_state(((struct __pyx_obj_5arrex_4list_arrayexposer *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "(tree fragment)":8 - * raise __pyx_PickleError("Incompatible checksums (%s vs 0xc9dda6f = (owner, shape))" % __pyx_checksum) - * __pyx_result = arrayexposer.__new__(__pyx_type) - * if __pyx_state is not None: # <<<<<<<<<<<<<< - * __pyx_unpickle_arrayexposer__set_state( __pyx_result, __pyx_state) - * return __pyx_result - */ - } +/* Python wrapper */ +static PyObject *__pyx_pw_5arrex_4list_12arrayexposer_5owner_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5arrex_4list_12arrayexposer_5owner_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_5arrex_4list_12arrayexposer_5owner___get__(((struct __pyx_obj_5arrex_4list_arrayexposer *)__pyx_v_self)); - /* "(tree fragment)":10 - * if __pyx_state is not None: - * __pyx_unpickle_arrayexposer__set_state( __pyx_result, __pyx_state) - * return __pyx_result # <<<<<<<<<<<<<< - * cdef __pyx_unpickle_arrayexposer__set_state(arrayexposer __pyx_result, tuple __pyx_state): - * __pyx_result.owner = __pyx_state[0]; __pyx_result.shape = __pyx_state[1] - */ + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5arrex_4list_12arrayexposer_5owner___get__(struct __pyx_obj_5arrex_4list_arrayexposer *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v___pyx_result); - __pyx_r = __pyx_v___pyx_result; + __Pyx_INCREF(__pyx_v_self->owner); + __pyx_r = __pyx_v_self->owner; goto __pyx_L0; - /* "(tree fragment)":1 - * def __pyx_unpickle_arrayexposer(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result - */ - /* function exit code */ - __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("arrex.list.__pyx_unpickle_arrayexposer", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v___pyx_PickleError); - __Pyx_XDECREF(__pyx_v___pyx_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":11 - * __pyx_unpickle_arrayexposer__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_arrayexposer__set_state(arrayexposer __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.owner = __pyx_state[0]; __pyx_result.shape = __pyx_state[1] - * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict */ -static PyObject *__pyx_f_5arrex_4list___pyx_unpickle_arrayexposer__set_state(struct __pyx_obj_5arrex_4list_arrayexposer *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { +/* Python wrapper */ +static PyObject *__pyx_pw_5arrex_4list_12arrayexposer_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5arrex_4list_12arrayexposer_1__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_12arrayexposer_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5arrex_4list_12arrayexposer_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; + __pyx_r = __pyx_pf_5arrex_4list_12arrayexposer___reduce_cython__(((struct __pyx_obj_5arrex_4list_arrayexposer *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5arrex_4list_12arrayexposer___reduce_cython__(struct __pyx_obj_5arrex_4list_arrayexposer *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2[1]; + PyObject *__pyx_t_2 = NULL; int __pyx_t_3; - Py_ssize_t __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_unpickle_arrayexposer__set_state", 0); + __Pyx_RefNannySetupContext("__reduce_cython__", 0); - /* "(tree fragment)":12 - * return __pyx_result - * cdef __pyx_unpickle_arrayexposer__set_state(arrayexposer __pyx_result, tuple __pyx_state): - * __pyx_result.owner = __pyx_state[0]; __pyx_result.shape = __pyx_state[1] # <<<<<<<<<<<<<< - * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): - * __pyx_result.__dict__.update(__pyx_state[2]) + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = (self.owner, self.shape) # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: */ - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 12, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_t_1 = __Pyx_carray_to_py_Py_ssize_t(__pyx_v_self->shape, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_self->owner); + __Pyx_GIVEREF(__pyx_v_self->owner); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self->owner); __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v___pyx_result->owner); - __Pyx_DECREF(__pyx_v___pyx_result->owner); - __pyx_v___pyx_result->owner = __pyx_t_1; + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __pyx_t_1 = 0; - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 12, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(__Pyx_carray_from_py_Py_ssize_t(__pyx_t_1, __pyx_t_2, 1) < 0)) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - memcpy(&(__pyx_v___pyx_result->shape[0]), __pyx_t_2, sizeof(__pyx_v___pyx_result->shape[0]) * (1)); + __pyx_v_state = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; - /* "(tree fragment)":13 - * cdef __pyx_unpickle_arrayexposer__set_state(arrayexposer __pyx_result, tuple __pyx_state): - * __pyx_result.owner = __pyx_state[0]; __pyx_result.shape = __pyx_state[1] - * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< - * __pyx_result.__dict__.update(__pyx_state[2]) + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = (self.owner, self.shape) + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None: + * state += (_dict,) */ - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(1, 13, __pyx_L1_error) - } - __pyx_t_4 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error) - __pyx_t_5 = ((__pyx_t_4 > 2) != 0); - if (__pyx_t_5) { - } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error) - __pyx_t_6 = (__pyx_t_5 != 0); - __pyx_t_3 = __pyx_t_6; - __pyx_L4_bool_binop_done:; + __pyx_t_2 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v__dict = __pyx_t_2; + __pyx_t_2 = 0; + + /* "(tree fragment)":7 + * state = (self.owner, self.shape) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True + */ + __pyx_t_3 = (__pyx_v__dict != Py_None); if (__pyx_t_3) { - /* "(tree fragment)":14 - * __pyx_result.owner = __pyx_state[0]; __pyx_result.shape = __pyx_state[1] - * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): - * __pyx_result.__dict__.update(__pyx_state[2]) # <<<<<<<<<<<<<< + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_update); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 14, __pyx_L1_error) - } - __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7); - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v__dict); + __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_1)); + __pyx_t_1 = 0; - /* "(tree fragment)":13 - * cdef __pyx_unpickle_arrayexposer__set_state(arrayexposer __pyx_result, tuple __pyx_state): - * __pyx_result.owner = __pyx_state[0]; __pyx_result.shape = __pyx_state[1] - * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< - * __pyx_result.__dict__.update(__pyx_state[2]) + /* "(tree fragment)":9 + * if _dict is not None: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = self.owner is not None + */ + __pyx_v_use_setstate = 1; + + /* "(tree fragment)":7 + * state = (self.owner, self.shape) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True */ + goto __pyx_L3; } /* "(tree fragment)":11 - * __pyx_unpickle_arrayexposer__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_arrayexposer__set_state(arrayexposer __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.owner = __pyx_state[0]; __pyx_result.shape = __pyx_state[1] - * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): + * use_setstate = True + * else: + * use_setstate = self.owner is not None # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_arrayexposer, (type(self), 0x5a3d340, None), state + */ + /*else*/ { + __pyx_t_3 = (__pyx_v_self->owner != Py_None); + __pyx_v_use_setstate = __pyx_t_3; + } + __pyx_L3:; + + /* "(tree fragment)":12 + * else: + * use_setstate = self.owner is not None + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_arrayexposer, (type(self), 0x5a3d340, None), state + * else: + */ + if (__pyx_v_use_setstate) { + + /* "(tree fragment)":13 + * use_setstate = self.owner is not None + * if use_setstate: + * return __pyx_unpickle_arrayexposer, (type(self), 0x5a3d340, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_arrayexposer, (type(self), 0x5a3d340, state) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pyx_unpickle_arrayexposer); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_INCREF(__pyx_int_94622528); + __Pyx_GIVEREF(__pyx_int_94622528); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_94622528); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_2, 2, Py_None); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "(tree fragment)":12 + * else: + * use_setstate = self.owner is not None + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_arrayexposer, (type(self), 0x5a3d340, None), state + * else: + */ + } + + /* "(tree fragment)":15 + * return __pyx_unpickle_arrayexposer, (type(self), 0x5a3d340, None), state + * else: + * return __pyx_unpickle_arrayexposer, (type(self), 0x5a3d340, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_arrayexposer__set_state(self, __pyx_state) + */ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_arrayexposer); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_INCREF(__pyx_int_94622528); + __Pyx_GIVEREF(__pyx_int_94622528); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_94622528); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_state); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); + __pyx_t_4 = 0; + __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + } + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict */ /* function exit code */ - __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_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("arrex.list.__pyx_unpickle_arrayexposer__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("arrex.list.arrayexposer.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":1 - * def __pyx_unpickle_arrayiter(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_arrayexposer, (type(self), 0x5a3d340, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_arrayexposer__set_state(self, __pyx_state) */ /* Python wrapper */ -static PyObject *__pyx_pw_5arrex_4list_3__pyx_unpickle_arrayiter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_5arrex_4list_3__pyx_unpickle_arrayiter = {"__pyx_unpickle_arrayiter", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5arrex_4list_3__pyx_unpickle_arrayiter, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_5arrex_4list_3__pyx_unpickle_arrayiter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v___pyx_type = 0; - long __pyx_v___pyx_checksum; +static PyObject *__pyx_pw_5arrex_4list_12arrayexposer_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5arrex_4list_12arrayexposer_3__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_12arrayexposer_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5arrex_4list_12arrayexposer_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__pyx_unpickle_arrayiter (wrapper)", 0); + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + PyObject* values[1] = {0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 16, __pyx_L3_error) else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_arrayiter", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_arrayiter", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error) - } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_arrayiter") < 0)) __PYX_ERR(1, 1, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 16, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + } else if (unlikely(__pyx_nargs != 1)) { 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[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } - __pyx_v___pyx_type = values[0]; - __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) - __pyx_v___pyx_state = values[2]; + __pyx_v___pyx_state = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_arrayiter", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 16, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("arrex.list.__pyx_unpickle_arrayiter", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("arrex.list.arrayexposer.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5arrex_4list_2__pyx_unpickle_arrayiter(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + __pyx_r = __pyx_pf_5arrex_4list_12arrayexposer_2__setstate_cython__(((struct __pyx_obj_5arrex_4list_arrayexposer *)__pyx_v_self), __pyx_v___pyx_state); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5arrex_4list_2__pyx_unpickle_arrayiter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_v___pyx_PickleError = 0; - PyObject *__pyx_v___pyx_result = 0; +static PyObject *__pyx_pf_5arrex_4list_12arrayexposer_2__setstate_cython__(struct __pyx_obj_5arrex_4list_arrayexposer *__pyx_v_self, PyObject *__pyx_v___pyx_state) { 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_t_6; + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_unpickle_arrayiter", 0); + __Pyx_RefNannySetupContext("__setstate_cython__", 0); - /* "(tree fragment)":4 - * cdef object __pyx_PickleError - * cdef object __pyx_result - * if __pyx_checksum != 0x194d213: # <<<<<<<<<<<<<< - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (%s vs 0x194d213 = (array, position))" % __pyx_checksum) + /* "(tree fragment)":17 + * return __pyx_unpickle_arrayexposer, (type(self), 0x5a3d340, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_arrayexposer__set_state(self, __pyx_state) # <<<<<<<<<<<<<< */ - __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x194d213) != 0); - if (__pyx_t_1) { + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 17, __pyx_L1_error) + __pyx_t_1 = __pyx_f_5arrex_4list___pyx_unpickle_arrayexposer__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "(tree fragment)":5 - * cdef object __pyx_result - * if __pyx_checksum != 0x194d213: - * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< - * raise __pyx_PickleError("Incompatible checksums (%s vs 0x194d213 = (array, position))" % __pyx_checksum) - * __pyx_result = arrayiter.__new__(__pyx_type) + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_arrayexposer, (type(self), 0x5a3d340, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_arrayexposer__set_state(self, __pyx_state) */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_n_s_PickleError); - __Pyx_GIVEREF(__pyx_n_s_PickleError); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError); - __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_2); - __pyx_v___pyx_PickleError = __pyx_t_2; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "(tree fragment)":6 - * if __pyx_checksum != 0x194d213: - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (%s vs 0x194d213 = (array, position))" % __pyx_checksum) # <<<<<<<<<<<<<< - * __pyx_result = arrayiter.__new__(__pyx_type) - * if __pyx_state is not None: - */ - __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x19, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_INCREF(__pyx_v___pyx_PickleError); - __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(1, 6, __pyx_L1_error) + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("arrex.list.arrayexposer.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "(tree fragment)":4 - * cdef object __pyx_PickleError - * cdef object __pyx_result - * if __pyx_checksum != 0x194d213: # <<<<<<<<<<<<<< - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (%s vs 0x194d213 = (array, position))" % __pyx_checksum) +/* "arrex/list.pyx":677 + * cdef size_t position + * + * def __init__(self): # <<<<<<<<<<<<<< + * raise TypeError('arrayiter must not be instanciated explicitely') + * */ - } - /* "(tree fragment)":7 - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (%s vs 0x194d213 = (array, position))" % __pyx_checksum) - * __pyx_result = arrayiter.__new__(__pyx_type) # <<<<<<<<<<<<<< - * if __pyx_state is not None: - * __pyx_unpickle_arrayiter__set_state( __pyx_result, __pyx_state) - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5arrex_4list_arrayiter), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v___pyx_result = __pyx_t_3; - __pyx_t_3 = 0; +/* Python wrapper */ +static int __pyx_pw_5arrex_4list_9arrayiter_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_5arrex_4list_9arrayiter_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, __pyx_nargs); return -1;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; + __pyx_r = __pyx_pf_5arrex_4list_9arrayiter___init__(((struct __pyx_obj_5arrex_4list_arrayiter *)__pyx_v_self)); - /* "(tree fragment)":8 - * raise __pyx_PickleError("Incompatible checksums (%s vs 0x194d213 = (array, position))" % __pyx_checksum) - * __pyx_result = arrayiter.__new__(__pyx_type) - * if __pyx_state is not None: # <<<<<<<<<<<<<< - * __pyx_unpickle_arrayiter__set_state( __pyx_result, __pyx_state) - * return __pyx_result + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5arrex_4list_9arrayiter___init__(CYTHON_UNUSED struct __pyx_obj_5arrex_4list_arrayiter *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "arrex/list.pyx":678 + * + * def __init__(self): + * raise TypeError('arrayiter must not be instanciated explicitely') # <<<<<<<<<<<<<< + * + * def __iter__(self): */ - __pyx_t_1 = (__pyx_v___pyx_state != Py_None); - __pyx_t_6 = (__pyx_t_1 != 0); - if (__pyx_t_6) { + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 678, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 678, __pyx_L1_error) - /* "(tree fragment)":9 - * __pyx_result = arrayiter.__new__(__pyx_type) - * if __pyx_state is not None: - * __pyx_unpickle_arrayiter__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< - * return __pyx_result - * cdef __pyx_unpickle_arrayiter__set_state(arrayiter __pyx_result, tuple __pyx_state): + /* "arrex/list.pyx":677 + * cdef size_t position + * + * def __init__(self): # <<<<<<<<<<<<<< + * raise TypeError('arrayiter must not be instanciated explicitely') + * */ - if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error) - __pyx_t_3 = __pyx_f_5arrex_4list___pyx_unpickle_arrayiter__set_state(((struct __pyx_obj_5arrex_4list_arrayiter *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "(tree fragment)":8 - * raise __pyx_PickleError("Incompatible checksums (%s vs 0x194d213 = (array, position))" % __pyx_checksum) - * __pyx_result = arrayiter.__new__(__pyx_type) - * if __pyx_state is not None: # <<<<<<<<<<<<<< - * __pyx_unpickle_arrayiter__set_state( __pyx_result, __pyx_state) - * return __pyx_result + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("arrex.list.arrayiter.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "arrex/list.pyx":680 + * raise TypeError('arrayiter must not be instanciated explicitely') + * + * def __iter__(self): # <<<<<<<<<<<<<< + * return self + * */ - } - /* "(tree fragment)":10 - * if __pyx_state is not None: - * __pyx_unpickle_arrayiter__set_state( __pyx_result, __pyx_state) - * return __pyx_result # <<<<<<<<<<<<<< - * cdef __pyx_unpickle_arrayiter__set_state(arrayiter __pyx_result, tuple __pyx_state): - * __pyx_result.array = __pyx_state[0]; __pyx_result.position = __pyx_state[1] +/* Python wrapper */ +static PyObject *__pyx_pw_5arrex_4list_9arrayiter_3__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5arrex_4list_9arrayiter_3__iter__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); + __pyx_r = __pyx_pf_5arrex_4list_9arrayiter_2__iter__(((struct __pyx_obj_5arrex_4list_arrayiter *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5arrex_4list_9arrayiter_2__iter__(struct __pyx_obj_5arrex_4list_arrayiter *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__", 0); + + /* "arrex/list.pyx":681 + * + * def __iter__(self): + * return self # <<<<<<<<<<<<<< + * + * def __next__(self): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v___pyx_result); - __pyx_r = __pyx_v___pyx_result; + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0; - /* "(tree fragment)":1 - * def __pyx_unpickle_arrayiter(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result + /* "arrex/list.pyx":680 + * raise TypeError('arrayiter must not be instanciated explicitely') + * + * def __iter__(self): # <<<<<<<<<<<<<< + * return self + * */ /* function exit code */ - __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("arrex.list.__pyx_unpickle_arrayiter", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v___pyx_PickleError); - __Pyx_XDECREF(__pyx_v___pyx_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":11 - * __pyx_unpickle_arrayiter__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_arrayiter__set_state(arrayiter __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.array = __pyx_state[0]; __pyx_result.position = __pyx_state[1] - * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): +/* "arrex/list.pyx":683 + * return self + * + * def __next__(self): # <<<<<<<<<<<<<< + * if self.position + self.array.dtype.dsize > self.array.size: + * raise StopIteration */ -static PyObject *__pyx_f_5arrex_4list___pyx_unpickle_arrayiter__set_state(struct __pyx_obj_5arrex_4list_arrayiter *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; +/* Python wrapper */ +static PyObject *__pyx_pw_5arrex_4list_9arrayiter_5__next__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5arrex_4list_9arrayiter_5__next__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - size_t __pyx_t_2; - int __pyx_t_3; - Py_ssize_t __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_unpickle_arrayiter__set_state", 0); - - /* "(tree fragment)":12 - * return __pyx_result - * cdef __pyx_unpickle_arrayiter__set_state(arrayiter __pyx_result, tuple __pyx_state): - * __pyx_result.array = __pyx_state[0]; __pyx_result.position = __pyx_state[1] # <<<<<<<<<<<<<< - * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): - * __pyx_result.__dict__.update(__pyx_state[2]) - */ - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 12, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5arrex_4list_typedlist))))) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v___pyx_result->array); - __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->array)); - __pyx_v___pyx_result->array = ((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_t_1); - __pyx_t_1 = 0; - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 12, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v___pyx_result->position = __pyx_t_2; - - /* "(tree fragment)":13 - * cdef __pyx_unpickle_arrayiter__set_state(arrayiter __pyx_result, tuple __pyx_state): - * __pyx_result.array = __pyx_state[0]; __pyx_result.position = __pyx_state[1] - * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< - * __pyx_result.__dict__.update(__pyx_state[2]) - */ - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(1, 13, __pyx_L1_error) - } - __pyx_t_4 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error) - __pyx_t_5 = ((__pyx_t_4 > 2) != 0); - if (__pyx_t_5) { - } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error) - __pyx_t_6 = (__pyx_t_5 != 0); - __pyx_t_3 = __pyx_t_6; - __pyx_L4_bool_binop_done:; - if (__pyx_t_3) { - - /* "(tree fragment)":14 - * __pyx_result.array = __pyx_state[0]; __pyx_result.position = __pyx_state[1] - * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): - * __pyx_result.__dict__.update(__pyx_state[2]) # <<<<<<<<<<<<<< - */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_update); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 14, __pyx_L1_error) - } - __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7); - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "(tree fragment)":13 - * cdef __pyx_unpickle_arrayiter__set_state(arrayiter __pyx_result, tuple __pyx_state): - * __pyx_result.array = __pyx_state[0]; __pyx_result.position = __pyx_state[1] - * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< - * __pyx_result.__dict__.update(__pyx_state[2]) - */ - } - - /* "(tree fragment)":11 - * __pyx_unpickle_arrayiter__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_arrayiter__set_state(arrayiter __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.array = __pyx_state[0]; __pyx_result.position = __pyx_state[1] - * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): - */ + __Pyx_RefNannySetupContext("__next__ (wrapper)", 0); + __pyx_r = __pyx_pf_5arrex_4list_9arrayiter_4__next__(((struct __pyx_obj_5arrex_4list_arrayiter *)__pyx_v_self)); /* function exit code */ - __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_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("arrex.list.__pyx_unpickle_arrayiter__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "carray.to_py":112 - * - * @cname("__Pyx_carray_to_py_Py_ssize_t") - * cdef inline list __Pyx_carray_to_py_Py_ssize_t(base_type *v, Py_ssize_t length): # <<<<<<<<<<<<<< - * cdef size_t i - * cdef object value - */ - -static CYTHON_INLINE PyObject *__Pyx_carray_to_py_Py_ssize_t(Py_ssize_t *__pyx_v_v, Py_ssize_t __pyx_v_length) { - size_t __pyx_v_i; - PyObject *__pyx_v_value = 0; - PyObject *__pyx_v_l = NULL; +static PyObject *__pyx_pf_5arrex_4list_9arrayiter_4__next__(struct __pyx_obj_5arrex_4list_arrayiter *__pyx_v_self) { + PyObject *__pyx_v_item = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - size_t __pyx_t_2; - size_t __pyx_t_3; - size_t __pyx_t_4; + int __pyx_error_without_exception = 0; /* StopIteration */ + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__Pyx_carray_to_py_Py_ssize_t", 0); + __Pyx_RefNannySetupContext("__next__", 0); - /* "carray.to_py":115 - * cdef size_t i - * cdef object value - * l = PyList_New(length) # <<<<<<<<<<<<<< - * for i in range(length): - * value = v[i] + /* "arrex/list.pyx":684 + * + * def __next__(self): + * if self.position + self.array.dtype.dsize > self.array.size: # <<<<<<<<<<<<<< + * raise StopIteration + * item = self.array._getitem(self.array.ptr + self.position) */ - __pyx_t_1 = PyList_New(__pyx_v_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 115, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_l = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_1 = ((__pyx_v_self->position + __pyx_v_self->array->dtype->dsize) > __pyx_v_self->array->size); + if (unlikely(__pyx_t_1)) { - /* "carray.to_py":116 - * cdef object value - * l = PyList_New(length) - * for i in range(length): # <<<<<<<<<<<<<< - * value = v[i] - * Py_INCREF(value) + /* "arrex/list.pyx":685 + * def __next__(self): + * if self.position + self.array.dtype.dsize > self.array.size: + * raise StopIteration # <<<<<<<<<<<<<< + * item = self.array._getitem(self.array.ptr + self.position) + * self.position += self.array.dtype.dsize */ - __pyx_t_2 = ((size_t)__pyx_v_length); - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; + __pyx_error_without_exception = 1; + goto __pyx_L1_error;; - /* "carray.to_py":117 - * l = PyList_New(length) - * for i in range(length): - * value = v[i] # <<<<<<<<<<<<<< - * Py_INCREF(value) - * PyList_SET_ITEM(l, i, value) + /* "arrex/list.pyx":684 + * + * def __next__(self): + * if self.position + self.array.dtype.dsize > self.array.size: # <<<<<<<<<<<<<< + * raise StopIteration + * item = self.array._getitem(self.array.ptr + self.position) */ - __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_1); - __pyx_t_1 = 0; + } - /* "carray.to_py":118 - * for i in range(length): - * value = v[i] - * Py_INCREF(value) # <<<<<<<<<<<<<< - * PyList_SET_ITEM(l, i, value) - * return l + /* "arrex/list.pyx":686 + * if self.position + self.array.dtype.dsize > self.array.size: + * raise StopIteration + * item = self.array._getitem(self.array.ptr + self.position) # <<<<<<<<<<<<<< + * self.position += self.array.dtype.dsize + * return item */ - Py_INCREF(__pyx_v_value); + __pyx_t_2 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->array->__pyx_vtab)->_getitem(__pyx_v_self->array, (__pyx_v_self->array->ptr + __pyx_v_self->position)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 686, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_item = __pyx_t_2; + __pyx_t_2 = 0; - /* "carray.to_py":119 - * value = v[i] - * Py_INCREF(value) - * PyList_SET_ITEM(l, i, value) # <<<<<<<<<<<<<< - * return l + /* "arrex/list.pyx":687 + * raise StopIteration + * item = self.array._getitem(self.array.ptr + self.position) + * self.position += self.array.dtype.dsize # <<<<<<<<<<<<<< + * return item * */ - PyList_SET_ITEM(__pyx_v_l, __pyx_v_i, __pyx_v_value); - } + __pyx_v_self->position = (__pyx_v_self->position + __pyx_v_self->array->dtype->dsize); - /* "carray.to_py":120 - * Py_INCREF(value) - * PyList_SET_ITEM(l, i, value) - * return l # <<<<<<<<<<<<<< + /* "arrex/list.pyx":688 + * item = self.array._getitem(self.array.ptr + self.position) + * self.position += self.array.dtype.dsize + * return item # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_l); - __pyx_r = __pyx_v_l; + __Pyx_INCREF(__pyx_v_item); + __pyx_r = __pyx_v_item; goto __pyx_L0; - /* "carray.to_py":112 + /* "arrex/list.pyx":683 + * return self * - * @cname("__Pyx_carray_to_py_Py_ssize_t") - * cdef inline list __Pyx_carray_to_py_Py_ssize_t(base_type *v, Py_ssize_t length): # <<<<<<<<<<<<<< - * cdef size_t i - * cdef object value + * def __next__(self): # <<<<<<<<<<<<<< + * if self.position + self.array.dtype.dsize > self.array.size: + * raise StopIteration */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("carray.to_py.__Pyx_carray_to_py_Py_ssize_t", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_2); + if (!__pyx_error_without_exception) { + __Pyx_AddTraceback("arrex.list.arrayiter.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_value); - __Pyx_XDECREF(__pyx_v_l); + __Pyx_XDECREF(__pyx_v_item); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "carray.to_py":124 - * - * @cname("__Pyx_carray_to_tuple_Py_ssize_t") - * cdef inline tuple __Pyx_carray_to_tuple_Py_ssize_t(base_type *v, Py_ssize_t length): # <<<<<<<<<<<<<< - * cdef size_t i - * cdef object value +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict */ -static CYTHON_INLINE PyObject *__Pyx_carray_to_tuple_Py_ssize_t(Py_ssize_t *__pyx_v_v, Py_ssize_t __pyx_v_length) { - size_t __pyx_v_i; - PyObject *__pyx_v_value = 0; - PyObject *__pyx_v_t = NULL; - PyObject *__pyx_r = NULL; +/* Python wrapper */ +static PyObject *__pyx_pw_5arrex_4list_9arrayiter_7__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5arrex_4list_9arrayiter_7__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9arrayiter_7__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5arrex_4list_9arrayiter_7__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - size_t __pyx_t_2; - size_t __pyx_t_3; - size_t __pyx_t_4; + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; + __pyx_r = __pyx_pf_5arrex_4list_9arrayiter_6__reduce_cython__(((struct __pyx_obj_5arrex_4list_arrayiter *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5arrex_4list_9arrayiter_6__reduce_cython__(struct __pyx_obj_5arrex_4list_arrayiter *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__Pyx_carray_to_tuple_Py_ssize_t", 0); + __Pyx_RefNannySetupContext("__reduce_cython__", 0); - /* "carray.to_py":127 - * cdef size_t i - * cdef object value - * t = PyTuple_New(length) # <<<<<<<<<<<<<< - * for i in range(length): - * value = v[i] + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = (self.array, self.position) # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: */ - __pyx_t_1 = PyTuple_New(__pyx_v_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 127, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->position); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_v_t = ((PyObject*)__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF((PyObject *)__pyx_v_self->array); + __Pyx_GIVEREF((PyObject *)__pyx_v_self->array); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self->array)); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __pyx_t_1 = 0; + __pyx_v_state = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; - /* "carray.to_py":128 - * cdef object value - * t = PyTuple_New(length) - * for i in range(length): # <<<<<<<<<<<<<< - * value = v[i] - * Py_INCREF(value) + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = (self.array, self.position) + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None: + * state += (_dict,) */ - __pyx_t_2 = ((size_t)__pyx_v_length); - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; + __pyx_t_2 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v__dict = __pyx_t_2; + __pyx_t_2 = 0; - /* "carray.to_py":129 - * t = PyTuple_New(length) - * for i in range(length): - * value = v[i] # <<<<<<<<<<<<<< - * Py_INCREF(value) - * PyTuple_SET_ITEM(t, i, value) + /* "(tree fragment)":7 + * state = (self.array, self.position) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True + */ + __pyx_t_3 = (__pyx_v__dict != Py_None); + if (__pyx_t_3) { + + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: */ - __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 129, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v__dict); + __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_1)); __pyx_t_1 = 0; - /* "carray.to_py":130 - * for i in range(length): - * value = v[i] - * Py_INCREF(value) # <<<<<<<<<<<<<< - * PyTuple_SET_ITEM(t, i, value) - * return t + /* "(tree fragment)":9 + * if _dict is not None: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = self.array is not None */ - Py_INCREF(__pyx_v_value); + __pyx_v_use_setstate = 1; - /* "carray.to_py":131 - * value = v[i] - * Py_INCREF(value) - * PyTuple_SET_ITEM(t, i, value) # <<<<<<<<<<<<<< - * return t + /* "(tree fragment)":7 + * state = (self.array, self.position) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True */ - PyTuple_SET_ITEM(__pyx_v_t, __pyx_v_i, __pyx_v_value); + goto __pyx_L3; } - /* "carray.to_py":132 - * Py_INCREF(value) - * PyTuple_SET_ITEM(t, i, value) - * return t # <<<<<<<<<<<<<< + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = self.array is not None # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_arrayiter, (type(self), 0x75ae3e5, None), state */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_t); - __pyx_r = __pyx_v_t; - goto __pyx_L0; + /*else*/ { + __pyx_t_3 = (((PyObject *)__pyx_v_self->array) != Py_None); + __pyx_v_use_setstate = __pyx_t_3; + } + __pyx_L3:; - /* "carray.to_py":124 - * - * @cname("__Pyx_carray_to_tuple_Py_ssize_t") - * cdef inline tuple __Pyx_carray_to_tuple_Py_ssize_t(base_type *v, Py_ssize_t length): # <<<<<<<<<<<<<< - * cdef size_t i - * cdef object value + /* "(tree fragment)":12 + * else: + * use_setstate = self.array is not None + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_arrayiter, (type(self), 0x75ae3e5, None), state + * else: + */ + if (__pyx_v_use_setstate) { + + /* "(tree fragment)":13 + * use_setstate = self.array is not None + * if use_setstate: + * return __pyx_unpickle_arrayiter, (type(self), 0x75ae3e5, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_arrayiter, (type(self), 0x75ae3e5, state) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pyx_unpickle_arrayiter); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_INCREF(__pyx_int_123397093); + __Pyx_GIVEREF(__pyx_int_123397093); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_123397093); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_2, 2, Py_None); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "(tree fragment)":12 + * else: + * use_setstate = self.array is not None + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_arrayiter, (type(self), 0x75ae3e5, None), state + * else: + */ + } + + /* "(tree fragment)":15 + * return __pyx_unpickle_arrayiter, (type(self), 0x75ae3e5, None), state + * else: + * return __pyx_unpickle_arrayiter, (type(self), 0x75ae3e5, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_arrayiter__set_state(self, __pyx_state) + */ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_arrayiter); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_INCREF(__pyx_int_123397093); + __Pyx_GIVEREF(__pyx_int_123397093); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_123397093); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_state); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); + __pyx_t_4 = 0; + __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + } + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("carray.to_py.__Pyx_carray_to_tuple_Py_ssize_t", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("arrex.list.arrayiter.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_value); - __Pyx_XDECREF(__pyx_v_t); + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "carray.from_py":77 - * - * @cname("__Pyx_carray_from_py_Py_ssize_t") - * cdef int __Pyx_carray_from_py_Py_ssize_t(object o, base_type *v, Py_ssize_t length) except -1: # <<<<<<<<<<<<<< - * cdef Py_ssize_t i = length - * try: +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_arrayiter, (type(self), 0x75ae3e5, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_arrayiter__set_state(self, __pyx_state) */ -static int __Pyx_carray_from_py_Py_ssize_t(PyObject *__pyx_v_o, Py_ssize_t *__pyx_v_v, Py_ssize_t __pyx_v_length) { - Py_ssize_t __pyx_v_i; - PyObject *__pyx_v_item = NULL; - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - Py_ssize_t __pyx_t_8; - PyObject *(*__pyx_t_9)(PyObject *); - PyObject *__pyx_t_10 = NULL; - Py_ssize_t __pyx_t_11; - char const *__pyx_t_12; +/* Python wrapper */ +static PyObject *__pyx_pw_5arrex_4list_9arrayiter_9__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5arrex_4list_9arrayiter_9__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9arrayiter_9__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5arrex_4list_9arrayiter_9__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__Pyx_carray_from_py_Py_ssize_t", 0); - - /* "carray.from_py":78 - * @cname("__Pyx_carray_from_py_Py_ssize_t") - * cdef int __Pyx_carray_from_py_Py_ssize_t(object o, base_type *v, Py_ssize_t length) except -1: - * cdef Py_ssize_t i = length # <<<<<<<<<<<<<< - * try: - * i = len(o) - */ - __pyx_v_i = __pyx_v_length; - - /* "carray.from_py":79 - * cdef int __Pyx_carray_from_py_Py_ssize_t(object o, base_type *v, Py_ssize_t length) except -1: - * cdef Py_ssize_t i = length - * try: # <<<<<<<<<<<<<< - * i = len(o) - * except (TypeError, OverflowError): - */ + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + PyObject* values[1] = {0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 16, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 16, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v___pyx_state = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 16, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("arrex.list.arrayiter.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5arrex_4list_9arrayiter_8__setstate_cython__(((struct __pyx_obj_5arrex_4list_arrayiter *)__pyx_v_self), __pyx_v___pyx_state); - /* "carray.from_py":80 - * cdef Py_ssize_t i = length - * try: - * i = len(o) # <<<<<<<<<<<<<< - * except (TypeError, OverflowError): - * pass - */ - __pyx_t_4 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 80, __pyx_L3_error) - __pyx_v_i = __pyx_t_4; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "carray.from_py":79 - * cdef int __Pyx_carray_from_py_Py_ssize_t(object o, base_type *v, Py_ssize_t length) except -1: - * cdef Py_ssize_t i = length - * try: # <<<<<<<<<<<<<< - * i = len(o) - * except (TypeError, OverflowError): - */ - } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8_try_end; - __pyx_L3_error:; +static PyObject *__pyx_pf_5arrex_4list_9arrayiter_8__setstate_cython__(struct __pyx_obj_5arrex_4list_arrayiter *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + 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("__setstate_cython__", 0); - /* "carray.from_py":81 - * try: - * i = len(o) - * except (TypeError, OverflowError): # <<<<<<<<<<<<<< - * pass - * if i == length: + /* "(tree fragment)":17 + * return __pyx_unpickle_arrayiter, (type(self), 0x75ae3e5, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_arrayiter__set_state(self, __pyx_state) # <<<<<<<<<<<<<< */ - __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError) || __Pyx_PyErr_ExceptionMatches(__pyx_builtin_OverflowError); - if (__pyx_t_5) { - __Pyx_ErrRestore(0,0,0); - goto __pyx_L4_exception_handled; - } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 17, __pyx_L1_error) + __pyx_t_1 = __pyx_f_5arrex_4list___pyx_unpickle_arrayiter__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "carray.from_py":79 - * cdef int __Pyx_carray_from_py_Py_ssize_t(object o, base_type *v, Py_ssize_t length) except -1: - * cdef Py_ssize_t i = length - * try: # <<<<<<<<<<<<<< - * i = len(o) - * except (TypeError, OverflowError): + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_arrayiter, (type(self), 0x75ae3e5, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_arrayiter__set_state(self, __pyx_state) */ - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L4_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - __pyx_L8_try_end:; - } - /* "carray.from_py":83 - * except (TypeError, OverflowError): - * pass - * if i == length: # <<<<<<<<<<<<<< - * for i, item in enumerate(o): - * if i >= length: - */ - __pyx_t_6 = ((__pyx_v_i == __pyx_v_length) != 0); - if (__pyx_t_6) { + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("arrex.list.arrayiter.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "carray.from_py":84 - * pass - * if i == length: - * for i, item in enumerate(o): # <<<<<<<<<<<<<< - * if i >= length: - * break +/* "(tree fragment)":1 + * def __pyx_unpickle_arrayexposer(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result */ - __pyx_t_4 = 0; - if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) { - __pyx_t_7 = __pyx_v_o; __Pyx_INCREF(__pyx_t_7); __pyx_t_8 = 0; - __pyx_t_9 = NULL; - } else { - __pyx_t_8 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = Py_TYPE(__pyx_t_7)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 84, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_9)) { - if (likely(PyList_CheckExact(__pyx_t_7))) { - if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_7)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_10 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(1, 84, __pyx_L1_error) - #else - __pyx_t_10 = PySequence_ITEM(__pyx_t_7, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - #endif - } else { - if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_7)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(1, 84, __pyx_L1_error) - #else - __pyx_t_10 = PySequence_ITEM(__pyx_t_7, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - #endif + +/* Python wrapper */ +static PyObject *__pyx_pw_5arrex_4list_1__pyx_unpickle_arrayexposer(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5arrex_4list_1__pyx_unpickle_arrayexposer = {"__pyx_unpickle_arrayexposer", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_1__pyx_unpickle_arrayexposer, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5arrex_4list_1__pyx_unpickle_arrayexposer(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__pyx_unpickle_arrayexposer (wrapper)", 0); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; + PyObject* values[3] = {0,0,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_arrayexposer", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error) } - } else { - __pyx_t_10 = __pyx_t_9(__pyx_t_7); - if (unlikely(!__pyx_t_10)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(1, 84, __pyx_L1_error) - } - break; + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_arrayexposer", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error) } - __Pyx_GOTREF(__pyx_t_10); } - __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_10); - __pyx_t_10 = 0; - __pyx_v_i = __pyx_t_4; - __pyx_t_4 = (__pyx_t_4 + 1); - - /* "carray.from_py":85 - * if i == length: - * for i, item in enumerate(o): - * if i >= length: # <<<<<<<<<<<<<< - * break - * v[i] = item - */ - __pyx_t_6 = ((__pyx_v_i >= __pyx_v_length) != 0); - if (__pyx_t_6) { - - /* "carray.from_py":86 - * for i, item in enumerate(o): - * if i >= length: - * break # <<<<<<<<<<<<<< - * v[i] = item - * else: - */ - goto __pyx_L11_break; - - /* "carray.from_py":85 - * if i == length: - * for i, item in enumerate(o): - * if i >= length: # <<<<<<<<<<<<<< - * break - * v[i] = item - */ + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle_arrayexposer") < 0)) __PYX_ERR(1, 1, __pyx_L3_error) } - - /* "carray.from_py":87 - * if i >= length: - * break - * v[i] = item # <<<<<<<<<<<<<< - * else: - * i += 1 # convert index to length - */ - __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_item); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 87, __pyx_L1_error) - (__pyx_v_v[__pyx_v_i]) = __pyx_t_11; - - /* "carray.from_py":84 - * pass - * if i == length: - * for i, item in enumerate(o): # <<<<<<<<<<<<<< - * if i >= length: - * break - */ + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); } - /*else*/ { + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + __pyx_v___pyx_state = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_arrayexposer", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 1, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("arrex.list.__pyx_unpickle_arrayexposer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5arrex_4list___pyx_unpickle_arrayexposer(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); - /* "carray.from_py":89 - * v[i] = item - * else: - * i += 1 # convert index to length # <<<<<<<<<<<<<< - * if i == length: - * return 0 + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5arrex_4list___pyx_unpickle_arrayexposer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_PickleError = 0; + PyObject *__pyx_v___pyx_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_arrayexposer", 0); + + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x5a3d340, 0xa9252af, 0xc9dda6f): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x5a3d340, 0xa9252af, 0xc9dda6f) = (owner, shape))" % __pyx_checksum */ - __pyx_v_i = (__pyx_v_i + 1); + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__18, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { - /* "carray.from_py":90 - * else: - * i += 1 # convert index to length - * if i == length: # <<<<<<<<<<<<<< - * return 0 - * + /* "(tree fragment)":5 + * cdef object __pyx_result + * if __pyx_checksum not in (0x5a3d340, 0xa9252af, 0xc9dda6f): + * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x5a3d340, 0xa9252af, 0xc9dda6f) = (owner, shape))" % __pyx_checksum + * __pyx_result = arrayexposer.__new__(__pyx_type) */ - __pyx_t_6 = ((__pyx_v_i == __pyx_v_length) != 0); - if (__pyx_t_6) { + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_n_s_PickleError); + __Pyx_GIVEREF(__pyx_n_s_PickleError); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError); + __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_1); + __pyx_v___pyx_PickleError = __pyx_t_1; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "carray.from_py":91 - * i += 1 # convert index to length - * if i == length: - * return 0 # <<<<<<<<<<<<<< - * - * PyErr_Format( + /* "(tree fragment)":6 + * if __pyx_checksum not in (0x5a3d340, 0xa9252af, 0xc9dda6f): + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x5a3d340, 0xa9252af, 0xc9dda6f) = (owner, shape))" % __pyx_checksum # <<<<<<<<<<<<<< + * __pyx_result = arrayexposer.__new__(__pyx_type) + * if __pyx_state is not None: */ - __pyx_r = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L0; + __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 6, __pyx_L1_error) - /* "carray.from_py":90 - * else: - * i += 1 # convert index to length - * if i == length: # <<<<<<<<<<<<<< - * return 0 - * + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x5a3d340, 0xa9252af, 0xc9dda6f): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x5a3d340, 0xa9252af, 0xc9dda6f) = (owner, shape))" % __pyx_checksum */ - } + } + + /* "(tree fragment)":7 + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x5a3d340, 0xa9252af, 0xc9dda6f) = (owner, shape))" % __pyx_checksum + * __pyx_result = arrayexposer.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_arrayexposer__set_state( __pyx_result, __pyx_state) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5arrex_4list_arrayexposer), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; } + } + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_v___pyx_result = __pyx_t_1; + __pyx_t_1 = 0; - /* "carray.from_py":84 - * pass - * if i == length: - * for i, item in enumerate(o): # <<<<<<<<<<<<<< - * if i >= length: - * break + /* "(tree fragment)":8 + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x5a3d340, 0xa9252af, 0xc9dda6f) = (owner, shape))" % __pyx_checksum + * __pyx_result = arrayexposer.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_arrayexposer__set_state( __pyx_result, __pyx_state) + * return __pyx_result */ - __pyx_L11_break:; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_2 = (__pyx_v___pyx_state != Py_None); + if (__pyx_t_2) { - /* "carray.from_py":83 - * except (TypeError, OverflowError): - * pass - * if i == length: # <<<<<<<<<<<<<< - * for i, item in enumerate(o): - * if i >= length: + /* "(tree fragment)":9 + * __pyx_result = arrayexposer.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_arrayexposer__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_arrayexposer__set_state(arrayexposer __pyx_result, tuple __pyx_state): */ - } + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 9, __pyx_L1_error) + __pyx_t_1 = __pyx_f_5arrex_4list___pyx_unpickle_arrayexposer__set_state(((struct __pyx_obj_5arrex_4list_arrayexposer *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "carray.from_py":96 - * IndexError, - * ("too many values found during array assignment, expected %zd" - * if i >= length else # <<<<<<<<<<<<<< - * "not enough values found during array assignment, expected %zd, got %zd"), - * length, i) + /* "(tree fragment)":8 + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x5a3d340, 0xa9252af, 0xc9dda6f) = (owner, shape))" % __pyx_checksum + * __pyx_result = arrayexposer.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_arrayexposer__set_state( __pyx_result, __pyx_state) + * return __pyx_result */ - if (((__pyx_v_i >= __pyx_v_length) != 0)) { - __pyx_t_12 = ((char const *)"too many values found during array assignment, expected %zd"); - } else { - __pyx_t_12 = ((char const *)"not enough values found during array assignment, expected %zd, got %zd"); } - /* "carray.from_py":93 - * return 0 - * - * PyErr_Format( # <<<<<<<<<<<<<< - * IndexError, - * ("too many values found during array assignment, expected %zd" + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_arrayexposer__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_arrayexposer__set_state(arrayexposer __pyx_result, tuple __pyx_state): + * __pyx_result.owner = __pyx_state[0]; __pyx_result.shape = __pyx_state[1] */ - __pyx_t_7 = PyErr_Format(__pyx_builtin_IndexError, __pyx_t_12, __pyx_v_length, __pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 93, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; + goto __pyx_L0; - /* "carray.from_py":77 - * - * @cname("__Pyx_carray_from_py_Py_ssize_t") - * cdef int __Pyx_carray_from_py_Py_ssize_t(object o, base_type *v, Py_ssize_t length) except -1: # <<<<<<<<<<<<<< - * cdef Py_ssize_t i = length - * try: + /* "(tree fragment)":1 + * def __pyx_unpickle_arrayexposer(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("carray.from_py.__Pyx_carray_from_py_Py_ssize_t", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("arrex.list.__pyx_unpickle_arrayexposer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_item); + __Pyx_XDECREF(__pyx_v___pyx_PickleError); + __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static struct __pyx_vtabstruct_5arrex_4list_typedlist __pyx_vtable_5arrex_4list_typedlist; - -static PyObject *__pyx_tp_new_5arrex_4list_typedlist(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5arrex_4list_typedlist *p; - PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); - } - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_5arrex_4list_typedlist *)o); - p->__pyx_vtab = __pyx_vtabptr_5arrex_4list_typedlist; - p->dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)Py_None); Py_INCREF(Py_None); - p->owner = Py_None; Py_INCREF(Py_None); - return o; -} -static void __pyx_tp_dealloc_5arrex_4list_typedlist(PyObject *o) { - struct __pyx_obj_5arrex_4list_typedlist *p = (struct __pyx_obj_5arrex_4list_typedlist *)o; - #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - PyObject_GC_UnTrack(o); - Py_CLEAR(p->dtype); - Py_CLEAR(p->owner); - (*Py_TYPE(o)->tp_free)(o); -} +/* "(tree fragment)":11 + * __pyx_unpickle_arrayexposer__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_arrayexposer__set_state(arrayexposer __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< + * __pyx_result.owner = __pyx_state[0]; __pyx_result.shape = __pyx_state[1] + * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): + */ -static int __pyx_tp_traverse_5arrex_4list_typedlist(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_5arrex_4list_typedlist *p = (struct __pyx_obj_5arrex_4list_typedlist *)o; - if (p->dtype) { - e = (*v)(((PyObject *)p->dtype), a); if (e) return e; - } - if (p->owner) { - e = (*v)(p->owner, a); if (e) return e; - } - return 0; -} +static PyObject *__pyx_f_5arrex_4list___pyx_unpickle_arrayexposer__set_state(struct __pyx_obj_5arrex_4list_arrayexposer *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2[1]; + int __pyx_t_3; + Py_ssize_t __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_arrayexposer__set_state", 0); -static int __pyx_tp_clear_5arrex_4list_typedlist(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_5arrex_4list_typedlist *p = (struct __pyx_obj_5arrex_4list_typedlist *)o; - tmp = ((PyObject*)p->dtype); - p->dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->owner); - p->owner = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} -static PyObject *__pyx_sq_item_5arrex_4list_typedlist(PyObject *o, Py_ssize_t i) { - PyObject *r; - PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; - r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); - Py_DECREF(x); - return r; -} + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_arrayexposer__set_state(arrayexposer __pyx_result, tuple __pyx_state): + * __pyx_result.owner = __pyx_state[0]; __pyx_result.shape = __pyx_state[1] # <<<<<<<<<<<<<< + * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[2]) + */ + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->owner); + __Pyx_DECREF(__pyx_v___pyx_result->owner); + __pyx_v___pyx_result->owner = __pyx_t_1; + __pyx_t_1 = 0; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((__Pyx_carray_from_py_Py_ssize_t(__pyx_t_1, __pyx_t_2, 1) < 0))) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + memcpy(&(__pyx_v___pyx_result->shape[0]), __pyx_t_2, sizeof(__pyx_v___pyx_result->shape[0]) * (1)); -static int __pyx_mp_ass_subscript_5arrex_4list_typedlist(PyObject *o, PyObject *i, PyObject *v) { - if (v) { - return __pyx_pw_5arrex_4list_9typedlist_33__setitem__(o, i, v); + /* "(tree fragment)":13 + * cdef __pyx_unpickle_arrayexposer__set_state(arrayexposer __pyx_result, tuple __pyx_state): + * __pyx_result.owner = __pyx_state[0]; __pyx_result.shape = __pyx_state[1] + * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[2]) + */ + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 13, __pyx_L1_error) } - else { - return __pyx_pw_5arrex_4list_9typedlist_35__delitem__(o, i); + __pyx_t_4 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + __pyx_t_5 = (__pyx_t_4 > 2); + if (__pyx_t_5) { + } else { + __pyx_t_3 = __pyx_t_5; + goto __pyx_L4_bool_binop_done; } -} + __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + __pyx_t_3 = __pyx_t_5; + __pyx_L4_bool_binop_done:; + if (__pyx_t_3) { -static PyObject *__pyx_tp_richcompare_5arrex_4list_typedlist(PyObject *o1, PyObject *o2, int op) { - switch (op) { - case Py_EQ: { - return __pyx_pw_5arrex_4list_9typedlist_41__eq__(o1, o2); + /* "(tree fragment)":14 + * __pyx_result.owner = __pyx_state[0]; __pyx_result.shape = __pyx_state[1] + * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[2]) # <<<<<<<<<<<<<< + */ + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 14, __pyx_L1_error) } - case Py_NE: { - PyObject *ret; - ret = __pyx_pw_5arrex_4list_9typedlist_41__eq__(o1, o2); - if (likely(ret && ret != Py_NotImplemented)) { - int b = __Pyx_PyObject_IsTrue(ret); Py_DECREF(ret); - if (unlikely(b < 0)) return NULL; - ret = (b) ? Py_False : Py_True; - Py_INCREF(ret); + __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = NULL; + __pyx_t_9 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + __pyx_t_9 = 1; } - return ret; } - default: { - return __Pyx_NewRef(Py_NotImplemented); + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_6}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":13 + * cdef __pyx_unpickle_arrayexposer__set_state(arrayexposer __pyx_result, tuple __pyx_state): + * __pyx_result.owner = __pyx_state[0]; __pyx_result.shape = __pyx_state[1] + * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[2]) + */ } -} -static PyObject *__pyx_getprop_5arrex_4list_9typedlist_dtype(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5arrex_4list_9typedlist_5dtype_1__get__(o); -} + /* "(tree fragment)":11 + * __pyx_unpickle_arrayexposer__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_arrayexposer__set_state(arrayexposer __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< + * __pyx_result.owner = __pyx_state[0]; __pyx_result.shape = __pyx_state[1] + * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): + */ -static PyObject *__pyx_getprop_5arrex_4list_9typedlist_ddtype(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5arrex_4list_9typedlist_6ddtype_1__get__(o); + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("arrex.list.__pyx_unpickle_arrayexposer__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static PyObject *__pyx_getprop_5arrex_4list_9typedlist_size(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5arrex_4list_9typedlist_4size_1__get__(o); -} +/* "(tree fragment)":1 + * def __pyx_unpickle_arrayiter(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ -static PyObject *__pyx_getprop_5arrex_4list_9typedlist_allocated(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5arrex_4list_9typedlist_9allocated_1__get__(o); -} +/* Python wrapper */ +static PyObject *__pyx_pw_5arrex_4list_3__pyx_unpickle_arrayiter(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5arrex_4list_3__pyx_unpickle_arrayiter = {"__pyx_unpickle_arrayiter", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_3__pyx_unpickle_arrayiter, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5arrex_4list_3__pyx_unpickle_arrayiter(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__pyx_unpickle_arrayiter (wrapper)", 0); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; + PyObject* values[3] = {0,0,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_arrayiter", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_arrayiter", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle_arrayiter") < 0)) __PYX_ERR(1, 1, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + __pyx_v___pyx_state = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_arrayiter", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 1, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("arrex.list.__pyx_unpickle_arrayiter", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5arrex_4list_2__pyx_unpickle_arrayiter(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); -static PyObject *__pyx_getprop_5arrex_4list_9typedlist_owner(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5arrex_4list_9typedlist_5owner_1__get__(o); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static PyMethodDef __pyx_methods_5arrex_4list_typedlist[] = { - {"full", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5arrex_4list_9typedlist_3full, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_2full}, - {"empty", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5arrex_4list_9typedlist_5empty, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_4empty}, - {"reserve", (PyCFunction)__pyx_pw_5arrex_4list_9typedlist_7reserve, METH_O, __pyx_doc_5arrex_4list_9typedlist_6reserve}, - {"append", (PyCFunction)__pyx_pw_5arrex_4list_9typedlist_9append, METH_O, __pyx_doc_5arrex_4list_9typedlist_8append}, - {"pop", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5arrex_4list_9typedlist_11pop, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_10pop}, - {"insert", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5arrex_4list_9typedlist_13insert, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_12insert}, - {"clear", (PyCFunction)__pyx_pw_5arrex_4list_9typedlist_15clear, METH_NOARGS, __pyx_doc_5arrex_4list_9typedlist_14clear}, - {"extend", (PyCFunction)__pyx_pw_5arrex_4list_9typedlist_17extend, METH_O, __pyx_doc_5arrex_4list_9typedlist_16extend}, - {"capacity", (PyCFunction)__pyx_pw_5arrex_4list_9typedlist_25capacity, METH_NOARGS, __pyx_doc_5arrex_4list_9typedlist_24capacity}, - {"shrink", (PyCFunction)__pyx_pw_5arrex_4list_9typedlist_27shrink, METH_NOARGS, __pyx_doc_5arrex_4list_9typedlist_26shrink}, - {"__copy__", (PyCFunction)__pyx_pw_5arrex_4list_9typedlist_43__copy__, METH_NOARGS, __pyx_doc_5arrex_4list_9typedlist_42__copy__}, - {"__deepcopy__", (PyCFunction)__pyx_pw_5arrex_4list_9typedlist_45__deepcopy__, METH_O, __pyx_doc_5arrex_4list_9typedlist_44__deepcopy__}, - {"__reduce_ex__", (PyCFunction)__pyx_pw_5arrex_4list_9typedlist_47__reduce_ex__, METH_O, __pyx_doc_5arrex_4list_9typedlist_46__reduce_ex__}, - {"_rebuild", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5arrex_4list_9typedlist_49_rebuild, METH_VARARGS|METH_KEYWORDS, 0}, - {"reverse", (PyCFunction)__pyx_pw_5arrex_4list_9typedlist_55reverse, METH_NOARGS, __pyx_doc_5arrex_4list_9typedlist_54reverse}, - {"index", (PyCFunction)__pyx_pw_5arrex_4list_9typedlist_57index, METH_O, __pyx_doc_5arrex_4list_9typedlist_56index}, - {0, 0, 0, 0} -}; +static PyObject *__pyx_pf_5arrex_4list_2__pyx_unpickle_arrayiter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_PickleError = 0; + PyObject *__pyx_v___pyx_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_arrayiter", 0); -static struct PyGetSetDef __pyx_getsets_5arrex_4list_typedlist[] = { - {(char *)"dtype", __pyx_getprop_5arrex_4list_9typedlist_dtype, 0, (char *)" the python dtype object, or the ddtype if there is not dtype ", 0}, - {(char *)"ddtype", __pyx_getprop_5arrex_4list_9typedlist_ddtype, 0, (char *)" the declaration of the dtype, a DDType instance ", 0}, - {(char *)"size", __pyx_getprop_5arrex_4list_9typedlist_size, 0, (char *)0, 0}, - {(char *)"allocated", __pyx_getprop_5arrex_4list_9typedlist_allocated, 0, (char *)0, 0}, - {(char *)"owner", __pyx_getprop_5arrex_4list_9typedlist_owner, 0, (char *)0, 0}, - {0, 0, 0, 0, 0} -}; + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x75ae3e5, 0xbde5f15, 0x194d213): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x75ae3e5, 0xbde5f15, 0x194d213) = (array, position))" % __pyx_checksum + */ + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__20, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { -static PyNumberMethods __pyx_tp_as_number_typedlist = { - __pyx_pw_5arrex_4list_9typedlist_21__add__, /*nb_add*/ - 0, /*nb_subtract*/ - __pyx_pw_5arrex_4list_9typedlist_23__mul__, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000) - 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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000) - 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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000) - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000) - 0, /*nb_hex*/ - #endif - __pyx_pw_5arrex_4list_9typedlist_19__iadd__, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000) - 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*/ - 0, /*nb_index*/ - #if PY_VERSION_HEX >= 0x03050000 - 0, /*nb_matrix_multiply*/ - #endif - #if PY_VERSION_HEX >= 0x03050000 - 0, /*nb_inplace_matrix_multiply*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_typedlist = { - __pyx_pw_5arrex_4list_9typedlist_29__len__, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_5arrex_4list_typedlist, /*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_typedlist = { - __pyx_pw_5arrex_4list_9typedlist_29__len__, /*mp_length*/ - __pyx_pw_5arrex_4list_9typedlist_31__getitem__, /*mp_subscript*/ - __pyx_mp_ass_subscript_5arrex_4list_typedlist, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_typedlist = { - #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 - __pyx_pw_5arrex_4list_9typedlist_51__getbuffer__, /*bf_getbuffer*/ - __pyx_pw_5arrex_4list_9typedlist_53__releasebuffer__, /*bf_releasebuffer*/ -}; + /* "(tree fragment)":5 + * cdef object __pyx_result + * if __pyx_checksum not in (0x75ae3e5, 0xbde5f15, 0x194d213): + * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x75ae3e5, 0xbde5f15, 0x194d213) = (array, position))" % __pyx_checksum + * __pyx_result = arrayiter.__new__(__pyx_type) + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_n_s_PickleError); + __Pyx_GIVEREF(__pyx_n_s_PickleError); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError); + __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_1); + __pyx_v___pyx_PickleError = __pyx_t_1; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; -static PyTypeObject __pyx_type_5arrex_4list_typedlist = { - PyVarObject_HEAD_INIT(0, 0) - "arrex.list.typedlist", /*tp_name*/ - sizeof(struct __pyx_obj_5arrex_4list_typedlist), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5arrex_4list_typedlist, /*tp_dealloc*/ - #if PY_VERSION_HEX < 0x030800b4 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 - 0, /*tp_vectorcall_offset*/ - #endif - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - __pyx_pw_5arrex_4list_9typedlist_39__repr__, /*tp_repr*/ - &__pyx_tp_as_number_typedlist, /*tp_as_number*/ - &__pyx_tp_as_sequence_typedlist, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_typedlist, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_typedlist, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - " list-like array that stores objects as packed data. \n\t\tThe objects added must necessarily be packed objects (builtin objects with no references).\n\t\t\n\t\tThis is a dynamically sized, borrowing array, which mean the internal buffer of data is reallocated on insertion, but can be used to view and extract from any buffer.\n\t\t\n\t\tMethods added to the signature of list:\n\t\t\n\t\t\t`reserve(n)` reallocate if necessary to make sure n elements can \n\t\t\t be inserted without reallocation\n\t\t\t`capacity() -> int` return the current number of elements that can be \n\t\t\t contained without reallocation\n\t\t\t`shrink()` shorten the allocated memory to fit the current content\n\t\t\t\n\t\t\talso the slices do not copy the content\n\t\t\n\t\t\n\t\tUse it as a list:\n\t\t\n\t\t\t>>> a = typedlist(dtype=vec3)\n\t\t\t>>> \n\t\t\t>>> # build from an iterable\n\t\t\t>>> a = typedlist([], dtype=vec3)\n\t\t\t>>> \n\t\t\t>>> # append some data\n\t\t\t>>> a.append(vec3(1,2,3))\n\t\t\t>>> \n\t\t\t>>> # extend with an iterable\n\t\t\t>>> a.extend(vec3(i) for i in range(5))\n\t\t\t>>> \n\t\t\t>>> len(a)\t# the current number of elements\n\t\t\t6\n\t\t\t>>> \n\t\t\t>>> a.owner\t# the current data buffer\n\t\t\tb'.........'\n\t\t\t\n\t\tUse it as a slice:\n\t\t\n\t\t\t>>> # no data is copied\n\t\t\t>>> myslice = a[:5]\n\t\t\ttypedlist(....)\n\t\t\t\n\t\tUse it as a view on top of a random buffer\n\t\t\n\t\t\t>>> a = np.ones((6,3), dtype='f4')\n\t\t\t>>> myslice = typedlist(a, dtype=vec3)\n\t\t\t\n\t\tIt does support the buffer protocol, so it can be converted in a great variety of well known arrays, even without any copy\n\t\t\n\t\t\t>>> np.array(typedlist([....]))\n\t\t\n\t\t\n\t\tConstructors:\n\t\t\t\n\t\t\t.. py:function:: typedlist()\n\t\t\t.. py:function:: typedlist(dtype, reserve=None)\n\t\t\t.. py:function:: typedlist(iterable, dtype, reserve=None)\n\t\t\t.. py:function:: typedlist(buffer, dtyp""e)\n\t\t\t\n\t\tAttributes:\n\t\t\t\n\t\t\tsize (int): byte size of the current content\n\t\t\tallocated (int): byte size of the memory allocated memory\n\t\t\towner: object realy owning the data instead of the current `typedlist`\n\t\t\t\n\t\t\tdtype (type): the python data type\n\t\t\tddtype (DDType): the data type declaration\n\t", /*tp_doc*/ - __pyx_tp_traverse_5arrex_4list_typedlist, /*tp_traverse*/ - __pyx_tp_clear_5arrex_4list_typedlist, /*tp_clear*/ - __pyx_tp_richcompare_5arrex_4list_typedlist, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - __pyx_pw_5arrex_4list_9typedlist_37__iter__, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_5arrex_4list_typedlist, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_5arrex_4list_typedlist, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pw_5arrex_4list_9typedlist_1__init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_5arrex_4list_typedlist, /*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*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif - #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, /*tp_vectorcall*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 - 0, /*tp_print*/ - #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 - 0, /*tp_pypy_flags*/ - #endif -}; + /* "(tree fragment)":6 + * if __pyx_checksum not in (0x75ae3e5, 0xbde5f15, 0x194d213): + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x75ae3e5, 0xbde5f15, 0x194d213) = (array, position))" % __pyx_checksum # <<<<<<<<<<<<<< + * __pyx_result = arrayiter.__new__(__pyx_type) + * if __pyx_state is not None: + */ + __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 6, __pyx_L1_error) -static PyObject *__pyx_tp_new_5arrex_4list_arrayexposer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5arrex_4list_arrayexposer *p; - PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x75ae3e5, 0xbde5f15, 0x194d213): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x75ae3e5, 0xbde5f15, 0x194d213) = (array, position))" % __pyx_checksum + */ } - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_5arrex_4list_arrayexposer *)o); - p->owner = Py_None; Py_INCREF(Py_None); - return o; -} -static void __pyx_tp_dealloc_5arrex_4list_arrayexposer(PyObject *o) { - struct __pyx_obj_5arrex_4list_arrayexposer *p = (struct __pyx_obj_5arrex_4list_arrayexposer *)o; - #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; + /* "(tree fragment)":7 + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x75ae3e5, 0xbde5f15, 0x194d213) = (array, position))" % __pyx_checksum + * __pyx_result = arrayiter.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_arrayiter__set_state( __pyx_result, __pyx_state) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5arrex_4list_arrayiter), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } } - #endif - PyObject_GC_UnTrack(o); - Py_CLEAR(p->owner); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_5arrex_4list_arrayexposer(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_5arrex_4list_arrayexposer *p = (struct __pyx_obj_5arrex_4list_arrayexposer *)o; - if (p->owner) { - e = (*v)(p->owner, a); if (e) return e; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } - return 0; -} - -static int __pyx_tp_clear_5arrex_4list_arrayexposer(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_5arrex_4list_arrayexposer *p = (struct __pyx_obj_5arrex_4list_arrayexposer *)o; - tmp = ((PyObject*)p->owner); - p->owner = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} + __pyx_v___pyx_result = __pyx_t_1; + __pyx_t_1 = 0; -static PyObject *__pyx_getprop_5arrex_4list_12arrayexposer_owner(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5arrex_4list_12arrayexposer_5owner_1__get__(o); -} + /* "(tree fragment)":8 + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x75ae3e5, 0xbde5f15, 0x194d213) = (array, position))" % __pyx_checksum + * __pyx_result = arrayiter.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_arrayiter__set_state( __pyx_result, __pyx_state) + * return __pyx_result + */ + __pyx_t_2 = (__pyx_v___pyx_state != Py_None); + if (__pyx_t_2) { -static PyMethodDef __pyx_methods_5arrex_4list_arrayexposer[] = { - {"__reduce_cython__", (PyCFunction)__pyx_pw_5arrex_4list_12arrayexposer_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw_5arrex_4list_12arrayexposer_3__setstate_cython__, METH_O, 0}, - {0, 0, 0, 0} -}; + /* "(tree fragment)":9 + * __pyx_result = arrayiter.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_arrayiter__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_arrayiter__set_state(arrayiter __pyx_result, tuple __pyx_state): + */ + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 9, __pyx_L1_error) + __pyx_t_1 = __pyx_f_5arrex_4list___pyx_unpickle_arrayiter__set_state(((struct __pyx_obj_5arrex_4list_arrayiter *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; -static struct PyGetSetDef __pyx_getsets_5arrex_4list_arrayexposer[] = { - {(char *)"owner", __pyx_getprop_5arrex_4list_12arrayexposer_owner, 0, (char *)0, 0}, - {0, 0, 0, 0, 0} -}; + /* "(tree fragment)":8 + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x75ae3e5, 0xbde5f15, 0x194d213) = (array, position))" % __pyx_checksum + * __pyx_result = arrayiter.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_arrayiter__set_state( __pyx_result, __pyx_state) + * return __pyx_result + */ + } -static PyTypeObject __pyx_type_5arrex_4list_arrayexposer = { - PyVarObject_HEAD_INIT(0, 0) - "arrex.list.arrayexposer", /*tp_name*/ - sizeof(struct __pyx_obj_5arrex_4list_arrayexposer), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5arrex_4list_arrayexposer, /*tp_dealloc*/ - #if PY_VERSION_HEX < 0x030800b4 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 - 0, /*tp_vectorcall_offset*/ - #endif - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - " very simple object that just holds the data for the buffer objects ", /*tp_doc*/ - __pyx_tp_traverse_5arrex_4list_arrayexposer, /*tp_traverse*/ - __pyx_tp_clear_5arrex_4list_arrayexposer, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_5arrex_4list_arrayexposer, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_5arrex_4list_arrayexposer, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_5arrex_4list_arrayexposer, /*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*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif - #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, /*tp_vectorcall*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 - 0, /*tp_print*/ - #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 - 0, /*tp_pypy_flags*/ - #endif -}; + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_arrayiter__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_arrayiter__set_state(arrayiter __pyx_result, tuple __pyx_state): + * __pyx_result.array = __pyx_state[0]; __pyx_result.position = __pyx_state[1] + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; + goto __pyx_L0; -static PyObject *__pyx_tp_new_5arrex_4list_arrayiter(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5arrex_4list_arrayiter *p; + /* "(tree fragment)":1 + * def __pyx_unpickle_arrayiter(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("arrex.list.__pyx_unpickle_arrayiter", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_PickleError); + __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":11 + * __pyx_unpickle_arrayiter__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_arrayiter__set_state(arrayiter __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< + * __pyx_result.array = __pyx_state[0]; __pyx_result.position = __pyx_state[1] + * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): + */ + +static PyObject *__pyx_f_5arrex_4list___pyx_unpickle_arrayiter__set_state(struct __pyx_obj_5arrex_4list_arrayiter *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + size_t __pyx_t_2; + int __pyx_t_3; + Py_ssize_t __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_arrayiter__set_state", 0); + + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_arrayiter__set_state(arrayiter __pyx_result, tuple __pyx_state): + * __pyx_result.array = __pyx_state[0]; __pyx_result.position = __pyx_state[1] # <<<<<<<<<<<<<< + * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[2]) + */ + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5arrex_4list_typedlist))))) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v___pyx_result->array); + __Pyx_DECREF((PyObject *)__pyx_v___pyx_result->array); + __pyx_v___pyx_result->array = ((struct __pyx_obj_5arrex_4list_typedlist *)__pyx_t_1); + __pyx_t_1 = 0; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v___pyx_result->position = __pyx_t_2; + + /* "(tree fragment)":13 + * cdef __pyx_unpickle_arrayiter__set_state(arrayiter __pyx_result, tuple __pyx_state): + * __pyx_result.array = __pyx_state[0]; __pyx_result.position = __pyx_state[1] + * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[2]) + */ + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 13, __pyx_L1_error) + } + __pyx_t_4 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + __pyx_t_5 = (__pyx_t_4 > 2); + if (__pyx_t_5) { + } else { + __pyx_t_3 = __pyx_t_5; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + __pyx_t_3 = __pyx_t_5; + __pyx_L4_bool_binop_done:; + if (__pyx_t_3) { + + /* "(tree fragment)":14 + * __pyx_result.array = __pyx_state[0]; __pyx_result.position = __pyx_state[1] + * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[2]) # <<<<<<<<<<<<<< + */ + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 14, __pyx_L1_error) + } + __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = NULL; + __pyx_t_9 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + __pyx_t_9 = 1; + } + } + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_6}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":13 + * cdef __pyx_unpickle_arrayiter__set_state(arrayiter __pyx_result, tuple __pyx_state): + * __pyx_result.array = __pyx_state[0]; __pyx_result.position = __pyx_state[1] + * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[2]) + */ + } + + /* "(tree fragment)":11 + * __pyx_unpickle_arrayiter__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_arrayiter__set_state(arrayiter __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< + * __pyx_result.array = __pyx_state[0]; __pyx_result.position = __pyx_state[1] + * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("arrex.list.__pyx_unpickle_arrayiter__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static struct __pyx_vtabstruct_5arrex_4list_typedlist __pyx_vtable_5arrex_4list_typedlist; + +static PyObject *__pyx_tp_new_5arrex_4list_typedlist(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_5arrex_4list_typedlist *p; PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { o = (*t->tp_alloc)(t, 0); } else { o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_5arrex_4list_arrayiter *)o); - p->array = ((struct __pyx_obj_5arrex_4list_typedlist *)Py_None); Py_INCREF(Py_None); + #endif + p = ((struct __pyx_obj_5arrex_4list_typedlist *)o); + p->__pyx_vtab = __pyx_vtabptr_5arrex_4list_typedlist; + p->dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)Py_None); Py_INCREF(Py_None); + p->owner = Py_None; Py_INCREF(Py_None); return o; } -static void __pyx_tp_dealloc_5arrex_4list_arrayiter(PyObject *o) { - struct __pyx_obj_5arrex_4list_arrayiter *p = (struct __pyx_obj_5arrex_4list_arrayiter *)o; +static void __pyx_tp_dealloc_5arrex_4list_typedlist(PyObject *o) { + struct __pyx_obj_5arrex_4list_typedlist *p = (struct __pyx_obj_5arrex_4list_typedlist *)o; #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5arrex_4list_typedlist) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } } #endif PyObject_GC_UnTrack(o); - Py_CLEAR(p->array); + Py_CLEAR(p->dtype); + Py_CLEAR(p->owner); (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_5arrex_4list_arrayiter(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_5arrex_4list_typedlist(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_5arrex_4list_arrayiter *p = (struct __pyx_obj_5arrex_4list_arrayiter *)o; - if (p->array) { - e = (*v)(((PyObject *)p->array), a); if (e) return e; + struct __pyx_obj_5arrex_4list_typedlist *p = (struct __pyx_obj_5arrex_4list_typedlist *)o; + if (p->dtype) { + e = (*v)(((PyObject *)p->dtype), a); if (e) return e; + } + if (p->owner) { + e = (*v)(p->owner, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_5arrex_4list_arrayiter(PyObject *o) { +static int __pyx_tp_clear_5arrex_4list_typedlist(PyObject *o) { PyObject* tmp; - struct __pyx_obj_5arrex_4list_arrayiter *p = (struct __pyx_obj_5arrex_4list_arrayiter *)o; - tmp = ((PyObject*)p->array); - p->array = ((struct __pyx_obj_5arrex_4list_typedlist *)Py_None); Py_INCREF(Py_None); + struct __pyx_obj_5arrex_4list_typedlist *p = (struct __pyx_obj_5arrex_4list_typedlist *)o; + tmp = ((PyObject*)p->dtype); + p->dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->owner); + p->owner = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } +static PyObject *__pyx_sq_item_5arrex_4list_typedlist(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} -static PyObject *__pyx_specialmethod___pyx_pw_5arrex_4list_9arrayiter_5__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {return __pyx_pw_5arrex_4list_9arrayiter_5__next__(self);} +static int __pyx_mp_ass_subscript_5arrex_4list_typedlist(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_pw_5arrex_4list_9typedlist_33__setitem__(o, i, v); + } + else { + return __pyx_pw_5arrex_4list_9typedlist_35__delitem__(o, i); + } +} -static PyMethodDef __pyx_methods_5arrex_4list_arrayiter[] = { - {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_5arrex_4list_9arrayiter_5__next__, METH_NOARGS|METH_COEXIST, 0}, - {"__reduce_cython__", (PyCFunction)__pyx_pw_5arrex_4list_9arrayiter_7__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw_5arrex_4list_9arrayiter_9__setstate_cython__, METH_O, 0}, +static PyObject *__pyx_tp_richcompare_5arrex_4list_typedlist(PyObject *o1, PyObject *o2, int op) { + switch (op) { + case Py_EQ: { + return __pyx_pw_5arrex_4list_9typedlist_41__eq__(o1, o2); + } + case Py_NE: { + PyObject *ret; + ret = __pyx_pw_5arrex_4list_9typedlist_41__eq__(o1, o2); + if (likely(ret && ret != Py_NotImplemented)) { + int b = __Pyx_PyObject_IsTrue(ret); + Py_DECREF(ret); + if (unlikely(b < 0)) return NULL; + ret = (b) ? Py_False : Py_True; + Py_INCREF(ret); + } + return ret; + } + default: { + return __Pyx_NewRef(Py_NotImplemented); + } + } +} + +static CYTHON_INLINE PyObject *__pyx_nb_add_5arrex_4list_typedlist_maybe_call_slot(PyTypeObject* type, PyObject *left, PyObject *right ) { + binaryfunc slot; +#if CYTHON_USE_TYPE_SLOTS || PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY + slot = type->tp_as_number ? type->tp_as_number->nb_add : NULL; +#else + slot = (binaryfunc) PyType_GetSlot(type, Py_nb_add); +#endif + return slot ? slot(left, right ) : __Pyx_NewRef(Py_NotImplemented); +} +static PyObject *__pyx_nb_add_5arrex_4list_typedlist(PyObject *left, PyObject *right ) { + int maybe_self_is_left, maybe_self_is_right = 0; + maybe_self_is_left = Py_TYPE(left) == Py_TYPE(right) +#if CYTHON_USE_TYPE_SLOTS + || (Py_TYPE(left)->tp_as_number && Py_TYPE(left)->tp_as_number->nb_add == &__pyx_nb_add_5arrex_4list_typedlist) +#endif + || __Pyx_TypeCheck(left, __pyx_ptype_5arrex_4list_typedlist); + if (maybe_self_is_left) { + PyObject *res; + res = __pyx_pw_5arrex_4list_9typedlist_21__add__(left, right); + if (res != Py_NotImplemented) return res; + Py_DECREF(res); + } + maybe_self_is_right = Py_TYPE(left) == Py_TYPE(right) +#if CYTHON_USE_TYPE_SLOTS + || (Py_TYPE(right)->tp_as_number && Py_TYPE(right)->tp_as_number->nb_add == &__pyx_nb_add_5arrex_4list_typedlist) +#endif + || PyType_IsSubtype(Py_TYPE(right), __pyx_ptype_5arrex_4list_typedlist); + if (maybe_self_is_right) { + return __pyx_nb_add_5arrex_4list_typedlist_maybe_call_slot(__Pyx_PyType_GetSlot(__pyx_ptype_5arrex_4list_typedlist, tp_base, PyTypeObject*), left, right ); + } + return __Pyx_NewRef(Py_NotImplemented); +} + + + +static CYTHON_INLINE PyObject *__pyx_nb_multiply_5arrex_4list_typedlist_maybe_call_slot(PyTypeObject* type, PyObject *left, PyObject *right ) { + binaryfunc slot; +#if CYTHON_USE_TYPE_SLOTS || PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY + slot = type->tp_as_number ? type->tp_as_number->nb_multiply : NULL; +#else + slot = (binaryfunc) PyType_GetSlot(type, Py_nb_multiply); +#endif + return slot ? slot(left, right ) : __Pyx_NewRef(Py_NotImplemented); +} +static PyObject *__pyx_nb_multiply_5arrex_4list_typedlist(PyObject *left, PyObject *right ) { + int maybe_self_is_left, maybe_self_is_right = 0; + maybe_self_is_left = Py_TYPE(left) == Py_TYPE(right) +#if CYTHON_USE_TYPE_SLOTS + || (Py_TYPE(left)->tp_as_number && Py_TYPE(left)->tp_as_number->nb_multiply == &__pyx_nb_multiply_5arrex_4list_typedlist) +#endif + || __Pyx_TypeCheck(left, __pyx_ptype_5arrex_4list_typedlist); + if (maybe_self_is_left) { + PyObject *res; + res = __pyx_pw_5arrex_4list_9typedlist_23__mul__(left, right); + if (res != Py_NotImplemented) return res; + Py_DECREF(res); + } + maybe_self_is_right = Py_TYPE(left) == Py_TYPE(right) +#if CYTHON_USE_TYPE_SLOTS + || (Py_TYPE(right)->tp_as_number && Py_TYPE(right)->tp_as_number->nb_multiply == &__pyx_nb_multiply_5arrex_4list_typedlist) +#endif + || PyType_IsSubtype(Py_TYPE(right), __pyx_ptype_5arrex_4list_typedlist); + if (maybe_self_is_right) { + return __pyx_nb_multiply_5arrex_4list_typedlist_maybe_call_slot(__Pyx_PyType_GetSlot(__pyx_ptype_5arrex_4list_typedlist, tp_base, PyTypeObject*), left, right ); + } + return __Pyx_NewRef(Py_NotImplemented); +} + + + +static PyObject *__pyx_getprop_5arrex_4list_9typedlist_dtype(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5arrex_4list_9typedlist_5dtype_1__get__(o); +} + +static PyObject *__pyx_getprop_5arrex_4list_9typedlist_ddtype(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5arrex_4list_9typedlist_6ddtype_1__get__(o); +} + +static PyObject *__pyx_getprop_5arrex_4list_9typedlist_size(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5arrex_4list_9typedlist_4size_1__get__(o); +} + +static PyObject *__pyx_getprop_5arrex_4list_9typedlist_allocated(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5arrex_4list_9typedlist_9allocated_1__get__(o); +} + +static PyObject *__pyx_getprop_5arrex_4list_9typedlist_owner(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5arrex_4list_9typedlist_5owner_1__get__(o); +} + +static PyObject *__pyx_specialmethod___pyx_pw_5arrex_4list_9typedlist_39__repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) { + return __pyx_pw_5arrex_4list_9typedlist_39__repr__(self); +} + +static PyMethodDef __pyx_methods_5arrex_4list_typedlist[] = { + {"full", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9typedlist_3full, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_2full}, + {"empty", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9typedlist_5empty, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_4empty}, + {"reserve", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9typedlist_7reserve, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_6reserve}, + {"pop", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9typedlist_11pop, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_10pop}, + {"insert", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9typedlist_13insert, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_12insert}, + {"clear", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9typedlist_15clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_14clear}, + {"capacity", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9typedlist_25capacity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_24capacity}, + {"shrink", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9typedlist_27shrink, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_26shrink}, + {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_pw_5arrex_4list_9typedlist_39__repr__, METH_NOARGS|METH_COEXIST, 0}, + {"__copy__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9typedlist_43__copy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_42__copy__}, + {"__deepcopy__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9typedlist_45__deepcopy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_44__deepcopy__}, + {"__reduce_ex__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9typedlist_47__reduce_ex__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_46__reduce_ex__}, + {"_rebuild", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9typedlist_49_rebuild, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"reverse", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9typedlist_55reverse, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_54reverse}, + {"index", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9typedlist_57index, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5arrex_4list_9typedlist_56index}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5arrex_4list_arrayiter = { +static struct PyGetSetDef __pyx_getsets_5arrex_4list_typedlist[] = { + {(char *)"dtype", __pyx_getprop_5arrex_4list_9typedlist_dtype, 0, (char *)PyDoc_STR(" the python dtype object, or the ddtype if there is not dtype "), 0}, + {(char *)"ddtype", __pyx_getprop_5arrex_4list_9typedlist_ddtype, 0, (char *)PyDoc_STR(" the declaration of the dtype, a DDType instance "), 0}, + {(char *)"size", __pyx_getprop_5arrex_4list_9typedlist_size, 0, (char *)0, 0}, + {(char *)"allocated", __pyx_getprop_5arrex_4list_9typedlist_allocated, 0, (char *)0, 0}, + {(char *)"owner", __pyx_getprop_5arrex_4list_9typedlist_owner, 0, (char *)0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +#if !CYTHON_COMPILING_IN_LIMITED_API + +static PyBufferProcs __pyx_tp_as_buffer_typedlist = { + #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 + __pyx_pw_5arrex_4list_9typedlist_51__getbuffer__, /*bf_getbuffer*/ + __pyx_pw_5arrex_4list_9typedlist_53__releasebuffer__, /*bf_releasebuffer*/ +}; +#endif +static PyType_Slot __pyx_type_5arrex_4list_typedlist_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5arrex_4list_typedlist}, + {Py_tp_repr, (void *)__pyx_pw_5arrex_4list_9typedlist_39__repr__}, + {Py_nb_add, (void *)__pyx_nb_add_5arrex_4list_typedlist}, + {Py_nb_multiply, (void *)__pyx_nb_multiply_5arrex_4list_typedlist}, + {Py_nb_inplace_add, (void *)__pyx_pw_5arrex_4list_9typedlist_19__iadd__}, + {Py_sq_length, (void *)__pyx_pw_5arrex_4list_9typedlist_29__len__}, + {Py_sq_item, (void *)__pyx_sq_item_5arrex_4list_typedlist}, + {Py_mp_length, (void *)__pyx_pw_5arrex_4list_9typedlist_29__len__}, + {Py_mp_subscript, (void *)__pyx_pw_5arrex_4list_9typedlist_31__getitem__}, + {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_5arrex_4list_typedlist}, + #if defined(Py_bf_getbuffer) + {Py_bf_getbuffer, (void *)__pyx_pw_5arrex_4list_9typedlist_51__getbuffer__}, + #endif + #if defined(Py_bf_releasebuffer) + {Py_bf_releasebuffer, (void *)__pyx_pw_5arrex_4list_9typedlist_53__releasebuffer__}, + #endif + {Py_tp_doc, (void *)PyDoc_STR(" list-like array that stores objects as packed data. \n\t\tThe objects added must necessarily be packed objects (builtin objects with no references).\n\t\t\n\t\tThis is a dynamically sized, borrowing array, which mean the internal buffer of data is reallocated on insertion, but can be used to view and extract from any buffer.\n\t\t\n\t\tMethods added to the signature of list:\n\t\t\n\t\t\t`reserve(n)` reallocate if necessary to make sure n elements can \n\t\t\t be inserted without reallocation\n\t\t\t`capacity() -> int` return the current number of elements that can be \n\t\t\t contained without reallocation\n\t\t\t`shrink()` shorten the allocated memory to fit the current content\n\t\t\t\n\t\t\talso the slices do not copy the content\n\t\t\n\t\t\n\t\tUse it as a list:\n\t\t\n\t\t\t>>> a = typedlist(dtype=vec3)\n\t\t\t>>> \n\t\t\t>>> # build from an iterable\n\t\t\t>>> a = typedlist([], dtype=vec3)\n\t\t\t>>> \n\t\t\t>>> # append some data\n\t\t\t>>> a.append(vec3(1,2,3))\n\t\t\t>>> \n\t\t\t>>> # extend with an iterable\n\t\t\t>>> a.extend(vec3(i) for i in range(5))\n\t\t\t>>> \n\t\t\t>>> len(a)\t# the current number of elements\n\t\t\t6\n\t\t\t>>> \n\t\t\t>>> a.owner\t# the current data buffer\n\t\t\tb'.........'\n\t\t\t\n\t\tUse it as a slice:\n\t\t\n\t\t\t>>> # no data is copied\n\t\t\t>>> myslice = a[:5]\n\t\t\ttypedlist(....)\n\t\t\t\n\t\tUse it as a view on top of a random buffer\n\t\t\n\t\t\t>>> a = np.ones((6,3), dtype='f4')\n\t\t\t>>> myslice = typedlist(a, dtype=vec3)\n\t\t\t\n\t\tIt does support the buffer protocol, so it can be converted in a great variety of well known arrays, even without any copy\n\t\t\n\t\t\t>>> np.array(typedlist([....]))\n\t\t\n\t\t\n\t\tConstructors:\n\t\t\t\n\t\t\t.. py:function:: typedlist()\n\t\t\t.. py:function:: typedlist(dtype, reserve=None)\n\t\t\t.. py:function:: typedlist(iterable, dtype, reserve=None)\n\t\t\t.. py:function:: typedlist(buffer, dtyp""e)\n\t\t\t\n\t\tAttributes:\n\t\t\t\n\t\t\tsize (int): byte size of the current content\n\t\t\tallocated (int): byte size of the memory allocated memory\n\t\t\towner: object realy owning the data instead of the current `typedlist`\n\t\t\t\n\t\t\tdtype (type): the python data type\n\t\t\tddtype (DDType): the data type declaration\n\t")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5arrex_4list_typedlist}, + {Py_tp_clear, (void *)__pyx_tp_clear_5arrex_4list_typedlist}, + {Py_tp_richcompare, (void *)__pyx_tp_richcompare_5arrex_4list_typedlist}, + {Py_tp_iter, (void *)__pyx_pw_5arrex_4list_9typedlist_37__iter__}, + {Py_tp_methods, (void *)__pyx_methods_5arrex_4list_typedlist}, + {Py_tp_getset, (void *)__pyx_getsets_5arrex_4list_typedlist}, + {Py_tp_init, (void *)__pyx_pw_5arrex_4list_9typedlist_1__init__}, + {Py_tp_new, (void *)__pyx_tp_new_5arrex_4list_typedlist}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5arrex_4list_typedlist_spec = { + "arrex.list.typedlist", + sizeof(struct __pyx_obj_5arrex_4list_typedlist), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type_5arrex_4list_typedlist_slots, +}; +#else + +static PyNumberMethods __pyx_tp_as_number_typedlist = { + __pyx_nb_add_5arrex_4list_typedlist, /*nb_add*/ + 0, /*nb_subtract*/ + __pyx_nb_multiply_5arrex_4list_typedlist, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000) + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_bool*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000) + 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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000) + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000) + 0, /*nb_hex*/ + #endif + __pyx_pw_5arrex_4list_9typedlist_19__iadd__, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000) + 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*/ + 0, /*nb_index*/ + #if PY_VERSION_HEX >= 0x03050000 + 0, /*nb_matrix_multiply*/ + #endif + #if PY_VERSION_HEX >= 0x03050000 + 0, /*nb_inplace_matrix_multiply*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_typedlist = { + __pyx_pw_5arrex_4list_9typedlist_29__len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_5arrex_4list_typedlist, /*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_typedlist = { + __pyx_pw_5arrex_4list_9typedlist_29__len__, /*mp_length*/ + __pyx_pw_5arrex_4list_9typedlist_31__getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_5arrex_4list_typedlist, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_typedlist = { + #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 + __pyx_pw_5arrex_4list_9typedlist_51__getbuffer__, /*bf_getbuffer*/ + __pyx_pw_5arrex_4list_9typedlist_53__releasebuffer__, /*bf_releasebuffer*/ +}; + +static PyTypeObject __pyx_type_5arrex_4list_typedlist = { PyVarObject_HEAD_INIT(0, 0) - "arrex.list.arrayiter", /*tp_name*/ - sizeof(struct __pyx_obj_5arrex_4list_arrayiter), /*tp_basicsize*/ + "arrex.list.""typedlist", /*tp_name*/ + sizeof(struct __pyx_obj_5arrex_4list_typedlist), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5arrex_4list_arrayiter, /*tp_dealloc*/ + __pyx_tp_dealloc_5arrex_4list_typedlist, /*tp_dealloc*/ #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ #endif @@ -11141,35 +14018,37 @@ static PyTypeObject __pyx_type_5arrex_4list_arrayiter = { #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ + __pyx_pw_5arrex_4list_9typedlist_39__repr__, /*tp_repr*/ + &__pyx_tp_as_number_typedlist, /*tp_as_number*/ + &__pyx_tp_as_sequence_typedlist, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_typedlist, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ + &__pyx_tp_as_buffer_typedlist, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_5arrex_4list_arrayiter, /*tp_traverse*/ - __pyx_tp_clear_5arrex_4list_arrayiter, /*tp_clear*/ - 0, /*tp_richcompare*/ + PyDoc_STR(" list-like array that stores objects as packed data. \n\t\tThe objects added must necessarily be packed objects (builtin objects with no references).\n\t\t\n\t\tThis is a dynamically sized, borrowing array, which mean the internal buffer of data is reallocated on insertion, but can be used to view and extract from any buffer.\n\t\t\n\t\tMethods added to the signature of list:\n\t\t\n\t\t\t`reserve(n)` reallocate if necessary to make sure n elements can \n\t\t\t be inserted without reallocation\n\t\t\t`capacity() -> int` return the current number of elements that can be \n\t\t\t contained without reallocation\n\t\t\t`shrink()` shorten the allocated memory to fit the current content\n\t\t\t\n\t\t\talso the slices do not copy the content\n\t\t\n\t\t\n\t\tUse it as a list:\n\t\t\n\t\t\t>>> a = typedlist(dtype=vec3)\n\t\t\t>>> \n\t\t\t>>> # build from an iterable\n\t\t\t>>> a = typedlist([], dtype=vec3)\n\t\t\t>>> \n\t\t\t>>> # append some data\n\t\t\t>>> a.append(vec3(1,2,3))\n\t\t\t>>> \n\t\t\t>>> # extend with an iterable\n\t\t\t>>> a.extend(vec3(i) for i in range(5))\n\t\t\t>>> \n\t\t\t>>> len(a)\t# the current number of elements\n\t\t\t6\n\t\t\t>>> \n\t\t\t>>> a.owner\t# the current data buffer\n\t\t\tb'.........'\n\t\t\t\n\t\tUse it as a slice:\n\t\t\n\t\t\t>>> # no data is copied\n\t\t\t>>> myslice = a[:5]\n\t\t\ttypedlist(....)\n\t\t\t\n\t\tUse it as a view on top of a random buffer\n\t\t\n\t\t\t>>> a = np.ones((6,3), dtype='f4')\n\t\t\t>>> myslice = typedlist(a, dtype=vec3)\n\t\t\t\n\t\tIt does support the buffer protocol, so it can be converted in a great variety of well known arrays, even without any copy\n\t\t\n\t\t\t>>> np.array(typedlist([....]))\n\t\t\n\t\t\n\t\tConstructors:\n\t\t\t\n\t\t\t.. py:function:: typedlist()\n\t\t\t.. py:function:: typedlist(dtype, reserve=None)\n\t\t\t.. py:function:: typedlist(iterable, dtype, reserve=None)\n\t\t\t.. py:function:: typedlist(buffer, dtyp""e)\n\t\t\t\n\t\tAttributes:\n\t\t\t\n\t\t\tsize (int): byte size of the current content\n\t\t\tallocated (int): byte size of the memory allocated memory\n\t\t\towner: object realy owning the data instead of the current `typedlist`\n\t\t\t\n\t\t\tdtype (type): the python data type\n\t\t\tddtype (DDType): the data type declaration\n\t"), /*tp_doc*/ + __pyx_tp_traverse_5arrex_4list_typedlist, /*tp_traverse*/ + __pyx_tp_clear_5arrex_4list_typedlist, /*tp_clear*/ + __pyx_tp_richcompare_5arrex_4list_typedlist, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - __pyx_pw_5arrex_4list_9arrayiter_3__iter__, /*tp_iter*/ - __pyx_pw_5arrex_4list_9arrayiter_5__next__, /*tp_iternext*/ - __pyx_methods_5arrex_4list_arrayiter, /*tp_methods*/ + __pyx_pw_5arrex_4list_9typedlist_37__iter__, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_5arrex_4list_typedlist, /*tp_methods*/ 0, /*tp_members*/ - 0, /*tp_getset*/ + __pyx_getsets_5arrex_4list_typedlist, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS 0, /*tp_dictoffset*/ - __pyx_pw_5arrex_4list_9arrayiter_1__init__, /*tp_init*/ + #endif + __pyx_pw_5arrex_4list_9typedlist_1__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5arrex_4list_arrayiter, /*tp_new*/ + __pyx_tp_new_5arrex_4list_typedlist, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -11180,219 +14059,596 @@ static PyTypeObject __pyx_type_5arrex_4list_arrayiter = { 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif #endif #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + #if __PYX_NEED_TP_PRINT_SLOT == 1 0, /*tp_print*/ #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, /*tp_pypy_flags*/ #endif }; +#endif -static PyMethodDef __pyx_methods[] = { +static PyObject *__pyx_tp_new_5arrex_4list_arrayexposer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_5arrex_4list_arrayexposer *p; + PyObject *o; + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + #endif + p = ((struct __pyx_obj_5arrex_4list_arrayexposer *)o); + p->owner = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_5arrex_4list_arrayexposer(PyObject *o) { + struct __pyx_obj_5arrex_4list_arrayexposer *p = (struct __pyx_obj_5arrex_4list_arrayexposer *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5arrex_4list_arrayexposer) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->owner); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_5arrex_4list_arrayexposer(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5arrex_4list_arrayexposer *p = (struct __pyx_obj_5arrex_4list_arrayexposer *)o; + if (p->owner) { + e = (*v)(p->owner, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_5arrex_4list_arrayexposer(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_5arrex_4list_arrayexposer *p = (struct __pyx_obj_5arrex_4list_arrayexposer *)o; + tmp = ((PyObject*)p->owner); + p->owner = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_5arrex_4list_12arrayexposer_owner(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5arrex_4list_12arrayexposer_5owner_1__get__(o); +} + +static PyMethodDef __pyx_methods_5arrex_4list_arrayexposer[] = { + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_12arrayexposer_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_12arrayexposer_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, {0, 0, 0, 0} }; -#if PY_MAJOR_VERSION >= 3 -#if CYTHON_PEP489_MULTI_PHASE_INIT -static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ -static int __pyx_pymod_exec_list(PyObject* module); /*proto*/ -static PyModuleDef_Slot __pyx_moduledef_slots[] = { - {Py_mod_create, (void*)__pyx_pymod_create}, - {Py_mod_exec, (void*)__pyx_pymod_exec_list}, - {0, NULL} +static struct PyGetSetDef __pyx_getsets_5arrex_4list_arrayexposer[] = { + {(char *)"owner", __pyx_getprop_5arrex_4list_12arrayexposer_owner, 0, (char *)0, 0}, + {0, 0, 0, 0, 0} }; -#endif +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5arrex_4list_arrayexposer_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5arrex_4list_arrayexposer}, + {Py_tp_doc, (void *)PyDoc_STR(" very simple object that just holds the data for the buffer objects ")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5arrex_4list_arrayexposer}, + {Py_tp_clear, (void *)__pyx_tp_clear_5arrex_4list_arrayexposer}, + {Py_tp_methods, (void *)__pyx_methods_5arrex_4list_arrayexposer}, + {Py_tp_getset, (void *)__pyx_getsets_5arrex_4list_arrayexposer}, + {Py_tp_new, (void *)__pyx_tp_new_5arrex_4list_arrayexposer}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5arrex_4list_arrayexposer_spec = { + "arrex.list.arrayexposer", + sizeof(struct __pyx_obj_5arrex_4list_arrayexposer), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type_5arrex_4list_arrayexposer_slots, +}; +#else -static struct PyModuleDef __pyx_moduledef = { - PyModuleDef_HEAD_INIT, - "list", - 0, /* m_doc */ - #if CYTHON_PEP489_MULTI_PHASE_INIT - 0, /* m_size */ - #else - -1, /* m_size */ +static PyTypeObject __pyx_type_5arrex_4list_arrayexposer = { + PyVarObject_HEAD_INIT(0, 0) + "arrex.list.""arrayexposer", /*tp_name*/ + sizeof(struct __pyx_obj_5arrex_4list_arrayexposer), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5arrex_4list_arrayexposer, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ #endif - __pyx_methods /* m_methods */, - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_moduledef_slots, /* m_slots */ + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + PyDoc_STR(" very simple object that just holds the data for the buffer objects "), /*tp_doc*/ + __pyx_tp_traverse_5arrex_4list_arrayexposer, /*tp_traverse*/ + __pyx_tp_clear_5arrex_4list_arrayexposer, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_5arrex_4list_arrayexposer, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_5arrex_4list_arrayexposer, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5arrex_4list_arrayexposer, /*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*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ #else - NULL, /* m_reload */ + NULL, /*tp_finalize*/ + #endif + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ #endif - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ }; #endif -#ifndef CYTHON_SMALL_CODE -#if defined(__clang__) - #define CYTHON_SMALL_CODE -#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) - #define CYTHON_SMALL_CODE __attribute__((cold)) -#else - #define CYTHON_SMALL_CODE -#endif -#endif -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_s_Incompatible_checksums_s_vs_0x19, __pyx_k_Incompatible_checksums_s_vs_0x19, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x19), 0, 0, 1, 0}, - {&__pyx_kp_s_Incompatible_checksums_s_vs_0xc9, __pyx_k_Incompatible_checksums_s_vs_0xc9, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xc9), 0, 0, 1, 0}, - {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1}, - {&__pyx_n_s_NotImplemented, __pyx_k_NotImplemented, sizeof(__pyx_k_NotImplemented), 0, 0, 1, 1}, - {&__pyx_n_s_OverflowError, __pyx_k_OverflowError, sizeof(__pyx_k_OverflowError), 0, 0, 1, 1}, - {&__pyx_n_s_PickleBuffer, __pyx_k_PickleBuffer, sizeof(__pyx_k_PickleBuffer), 0, 0, 1, 1}, - {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1}, - {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1}, - {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1}, - {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, - {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, - {&__pyx_kp_u__12, __pyx_k__12, sizeof(__pyx_k__12), 0, 1, 0, 0}, - {&__pyx_kp_u__13, __pyx_k__13, sizeof(__pyx_k__13), 0, 1, 0, 0}, - {&__pyx_kp_u_amount_must_be_positive, __pyx_k_amount_must_be_positive, sizeof(__pyx_k_amount_must_be_positive), 0, 1, 0, 0}, - {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1}, - {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1}, - {&__pyx_n_s_arrayexposer, __pyx_k_arrayexposer, sizeof(__pyx_k_arrayexposer), 0, 0, 1, 1}, - {&__pyx_n_s_arrayiter, __pyx_k_arrayiter, sizeof(__pyx_k_arrayiter), 0, 0, 1, 1}, - {&__pyx_kp_u_arrayiter_must_not_be_instanciat, __pyx_k_arrayiter_must_not_be_instanciat, sizeof(__pyx_k_arrayiter_must_not_be_instanciat), 0, 1, 0, 0}, - {&__pyx_n_s_arrex_list, __pyx_k_arrex_list, sizeof(__pyx_k_arrex_list), 0, 0, 1, 1}, - {&__pyx_kp_s_arrex_list_pyx, __pyx_k_arrex_list_pyx, sizeof(__pyx_k_arrex_list_pyx), 0, 0, 1, 0}, - {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, - {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1}, - {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, - {&__pyx_kp_u_dtype_must_be_a_dtype_declaratio, __pyx_k_dtype_must_be_a_dtype_declaratio, sizeof(__pyx_k_dtype_must_be_a_dtype_declaratio), 0, 1, 0, 0}, - {&__pyx_kp_u_dtype_must_be_provided_when_it_c, __pyx_k_dtype_must_be_provided_when_it_c, sizeof(__pyx_k_dtype_must_be_provided_when_it_c), 0, 1, 0, 0}, - {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1}, - {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, - {&__pyx_n_s_extend, __pyx_k_extend, sizeof(__pyx_k_extend), 0, 0, 1, 1}, - {&__pyx_n_s_full, __pyx_k_full, sizeof(__pyx_k_full), 0, 0, 1, 1}, - {&__pyx_n_s_getrefcount, __pyx_k_getrefcount, sizeof(__pyx_k_getrefcount), 0, 0, 1, 1}, - {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, - {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_kp_u_incorrect_slice, __pyx_k_incorrect_slice, sizeof(__pyx_k_incorrect_slice), 0, 1, 0, 0}, - {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1}, - {&__pyx_kp_u_index_must_be_int_or_slice, __pyx_k_index_must_be_int_or_slice, sizeof(__pyx_k_index_must_be_int_or_slice), 0, 1, 0, 0}, - {&__pyx_kp_u_index_out_of_range, __pyx_k_index_out_of_range, sizeof(__pyx_k_index_out_of_range), 0, 1, 0, 0}, - {&__pyx_n_u_iter, __pyx_k_iter, sizeof(__pyx_k_iter), 0, 1, 0, 1}, - {&__pyx_n_s_iterable, __pyx_k_iterable, sizeof(__pyx_k_iterable), 0, 0, 1, 1}, - {&__pyx_kp_u_iterable_is_empty, __pyx_k_iterable_is_empty, sizeof(__pyx_k_iterable_is_empty), 0, 1, 0, 0}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, - {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1}, - {&__pyx_n_u_next, __pyx_k_next, sizeof(__pyx_k_next), 0, 1, 0, 1}, - {&__pyx_n_s_owner, __pyx_k_owner, sizeof(__pyx_k_owner), 0, 0, 1, 1}, - {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1}, - {&__pyx_kp_u_pop_from_empty_list, __pyx_k_pop_from_empty_list, sizeof(__pyx_k_pop_from_empty_list), 0, 1, 0, 0}, - {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_unpickle_arrayexposer, __pyx_k_pyx_unpickle_arrayexposer, sizeof(__pyx_k_pyx_unpickle_arrayexposer), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_unpickle_arrayiter, __pyx_k_pyx_unpickle_arrayiter, sizeof(__pyx_k_pyx_unpickle_arrayiter), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, - {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, - {&__pyx_n_s_rebuild, __pyx_k_rebuild, sizeof(__pyx_k_rebuild), 0, 0, 1, 1}, - {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, - {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, - {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, - {&__pyx_kp_u_release_buffer, __pyx_k_release_buffer, sizeof(__pyx_k_release_buffer), 0, 1, 0, 0}, - {&__pyx_n_s_reserve, __pyx_k_reserve, sizeof(__pyx_k_reserve), 0, 0, 1, 1}, - {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, - {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, - {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, - {&__pyx_kp_u_slice_step_is_not_supported, __pyx_k_slice_step_is_not_supported, sizeof(__pyx_k_slice_step_is_not_supported), 0, 1, 0, 0}, - {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, - {&__pyx_n_s_staticmethod, __pyx_k_staticmethod, sizeof(__pyx_k_staticmethod), 0, 0, 1, 1}, - {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, - {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1}, - {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_kp_u_the_assigned_value_must_be_a_buf, __pyx_k_the_assigned_value_must_be_a_buf, sizeof(__pyx_k_the_assigned_value_must_be_a_buf), 0, 1, 0, 0}, - {&__pyx_kp_u_the_buffer_owner_doens_t_impleme, __pyx_k_the_buffer_owner_doens_t_impleme, sizeof(__pyx_k_the_buffer_owner_doens_t_impleme), 0, 1, 0, 0}, - {&__pyx_kp_u_the_given_buffer_must_have_a_byt, __pyx_k_the_given_buffer_must_have_a_byt, sizeof(__pyx_k_the_given_buffer_must_have_a_byt), 0, 1, 0, 0}, - {&__pyx_kp_u_typedlist, __pyx_k_typedlist, sizeof(__pyx_k_typedlist), 0, 1, 0, 0}, - {&__pyx_n_s_typedlist_2, __pyx_k_typedlist_2, sizeof(__pyx_k_typedlist_2), 0, 0, 1, 1}, - {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1}, - {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1}, - {&__pyx_kp_u_value_not_found, __pyx_k_value_not_found, sizeof(__pyx_k_value_not_found), 0, 1, 0, 0}, - {0, 0, 0, 0, 0, 0, 0} -}; -static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_staticmethod = __Pyx_GetBuiltinName(__pyx_n_s_staticmethod); if (!__pyx_builtin_staticmethod) __PYX_ERR(0, 174, __pyx_L1_error) - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 146, __pyx_L1_error) - __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) __PYX_ERR(0, 147, __pyx_L1_error) - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 148, __pyx_L1_error) - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 182, __pyx_L1_error) - __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(0, 241, __pyx_L1_error) - __pyx_builtin_NotImplemented = __Pyx_GetBuiltinName(__pyx_n_s_NotImplemented); if (!__pyx_builtin_NotImplemented) __PYX_ERR(0, 383, __pyx_L1_error) - __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 553, __pyx_L1_error) - __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) __PYX_ERR(0, 613, __pyx_L1_error) - __pyx_builtin_OverflowError = __Pyx_GetBuiltinName(__pyx_n_s_OverflowError); if (!__pyx_builtin_OverflowError) __PYX_ERR(1, 81, __pyx_L1_error) - __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 84, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; +static PyObject *__pyx_tp_new_5arrex_4list_arrayiter(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_5arrex_4list_arrayiter *p; + PyObject *o; + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + #endif + p = ((struct __pyx_obj_5arrex_4list_arrayiter *)o); + p->array = ((struct __pyx_obj_5arrex_4list_typedlist *)Py_None); Py_INCREF(Py_None); + return o; } -static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - - /* "arrex/list.pyx":146 - * dtype = type(next(iter(iterable))) - * else: - * raise TypeError('dtype must be provided when it cannot be deduced from the iterable') # <<<<<<<<<<<<<< - * except StopIteration: - * raise ValueError('iterable is empty') - */ - __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_dtype_must_be_provided_when_it_c); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 146, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple_); - __Pyx_GIVEREF(__pyx_tuple_); +static void __pyx_tp_dealloc_5arrex_4list_arrayiter(PyObject *o) { + struct __pyx_obj_5arrex_4list_arrayiter *p = (struct __pyx_obj_5arrex_4list_arrayiter *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5arrex_4list_arrayiter) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->array); + (*Py_TYPE(o)->tp_free)(o); +} - /* "arrex/list.pyx":148 - * raise TypeError('dtype must be provided when it cannot be deduced from the iterable') - * except StopIteration: - * raise ValueError('iterable is empty') # <<<<<<<<<<<<<< - * - * # initialize the internal structure - */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_iterable_is_empty); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__2); - __Pyx_GIVEREF(__pyx_tuple__2); +static int __pyx_tp_traverse_5arrex_4list_arrayiter(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5arrex_4list_arrayiter *p = (struct __pyx_obj_5arrex_4list_arrayiter *)o; + if (p->array) { + e = (*v)(((PyObject *)p->array), a); if (e) return e; + } + return 0; +} - /* "arrex/list.pyx":157 - * self.dtype = declared(dtype) - * if not self.dtype: - * raise TypeError('dtype must be a dtype declaration instance, or a key for a declared dtype') # <<<<<<<<<<<<<< - * - * # borrow a buffer - */ - __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_dtype_must_be_a_dtype_declaratio); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 157, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__3); - __Pyx_GIVEREF(__pyx_tuple__3); +static int __pyx_tp_clear_5arrex_4list_arrayiter(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_5arrex_4list_arrayiter *p = (struct __pyx_obj_5arrex_4list_arrayiter *)o; + tmp = ((PyObject*)p->array); + p->array = ((struct __pyx_obj_5arrex_4list_typedlist *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} - /* "arrex/list.pyx":241 - * if i < 0: i += l - * if i < 0 or i >= l: - * raise IndexError('index out of range') # <<<<<<<<<<<<<< - * return i - * - */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_index_out_of_range); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 241, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__4); - __Pyx_GIVEREF(__pyx_tuple__4); +static PyObject *__pyx_specialmethod___pyx_pw_5arrex_4list_9arrayiter_5__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) { + PyObject *res = __pyx_pw_5arrex_4list_9arrayiter_5__next__(self); + if (!res && !PyErr_Occurred()) { PyErr_SetNone(PyExc_StopIteration); } + return res; +} - /* "arrex/list.pyx":254 - * ''' - * if amount < 0: - * raise ValueError('amount must be positive') # <<<<<<<<<<<<<< - * cdef size_t asked = self.size + (amount) * self.dtype.dsize +static PyMethodDef __pyx_methods_5arrex_4list_arrayiter[] = { + {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_5arrex_4list_9arrayiter_5__next__, METH_NOARGS|METH_COEXIST, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9arrayiter_7__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5arrex_4list_9arrayiter_9__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5arrex_4list_arrayiter_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5arrex_4list_arrayiter}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5arrex_4list_arrayiter}, + {Py_tp_clear, (void *)__pyx_tp_clear_5arrex_4list_arrayiter}, + {Py_tp_iter, (void *)__pyx_pw_5arrex_4list_9arrayiter_3__iter__}, + {Py_tp_iternext, (void *)__pyx_pw_5arrex_4list_9arrayiter_5__next__}, + {Py_tp_methods, (void *)__pyx_methods_5arrex_4list_arrayiter}, + {Py_tp_init, (void *)__pyx_pw_5arrex_4list_9arrayiter_1__init__}, + {Py_tp_new, (void *)__pyx_tp_new_5arrex_4list_arrayiter}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5arrex_4list_arrayiter_spec = { + "arrex.list.arrayiter", + sizeof(struct __pyx_obj_5arrex_4list_arrayiter), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type_5arrex_4list_arrayiter_slots, +}; +#else + +static PyTypeObject __pyx_type_5arrex_4list_arrayiter = { + PyVarObject_HEAD_INIT(0, 0) + "arrex.list.""arrayiter", /*tp_name*/ + sizeof(struct __pyx_obj_5arrex_4list_arrayiter), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5arrex_4list_arrayiter, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_5arrex_4list_arrayiter, /*tp_traverse*/ + __pyx_tp_clear_5arrex_4list_arrayiter, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pw_5arrex_4list_9arrayiter_3__iter__, /*tp_iter*/ + __pyx_pw_5arrex_4list_9arrayiter_5__next__, /*tp_iternext*/ + __pyx_methods_5arrex_4list_arrayiter, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + __pyx_pw_5arrex_4list_9arrayiter_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5arrex_4list_arrayiter, /*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*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; +#ifndef CYTHON_SMALL_CODE +#if defined(__clang__) + #define CYTHON_SMALL_CODE +#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) + #define CYTHON_SMALL_CODE __attribute__((cold)) +#else + #define CYTHON_SMALL_CODE +#endif +#endif +/* #### Code section: pystring_table ### */ + +static int __Pyx_CreateStringTabAndInitStrings(void) { + __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_n_s_AssertionError, __pyx_k_AssertionError, sizeof(__pyx_k_AssertionError), 0, 0, 1, 1}, + {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_k_Incompatible_checksums_0x_x_vs_0, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0), 0, 0, 1, 0}, + {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_2, __pyx_k_Incompatible_checksums_0x_x_vs_0_2, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0_2), 0, 0, 1, 0}, + {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1}, + {&__pyx_n_s_NotImplemented, __pyx_k_NotImplemented, sizeof(__pyx_k_NotImplemented), 0, 0, 1, 1}, + {&__pyx_n_s_OverflowError, __pyx_k_OverflowError, sizeof(__pyx_k_OverflowError), 0, 0, 1, 1}, + {&__pyx_n_s_PickleBuffer, __pyx_k_PickleBuffer, sizeof(__pyx_k_PickleBuffer), 0, 0, 1, 1}, + {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1}, + {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1}, + {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, + {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, + {&__pyx_kp_u__12, __pyx_k__12, sizeof(__pyx_k__12), 0, 1, 0, 0}, + {&__pyx_kp_u__13, __pyx_k__13, sizeof(__pyx_k__13), 0, 1, 0, 0}, + {&__pyx_kp_u__19, __pyx_k__19, sizeof(__pyx_k__19), 0, 1, 0, 0}, + {&__pyx_n_s__21, __pyx_k__21, sizeof(__pyx_k__21), 0, 0, 1, 1}, + {&__pyx_n_s__61, __pyx_k__61, sizeof(__pyx_k__61), 0, 0, 1, 1}, + {&__pyx_n_s_amount, __pyx_k_amount, sizeof(__pyx_k_amount), 0, 0, 1, 1}, + {&__pyx_kp_u_amount_must_be_positive, __pyx_k_amount_must_be_positive, sizeof(__pyx_k_amount_must_be_positive), 0, 1, 0, 0}, + {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1}, + {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1}, + {&__pyx_n_s_arrayexposer, __pyx_k_arrayexposer, sizeof(__pyx_k_arrayexposer), 0, 0, 1, 1}, + {&__pyx_n_s_arrayexposer___reduce_cython, __pyx_k_arrayexposer___reduce_cython, sizeof(__pyx_k_arrayexposer___reduce_cython), 0, 0, 1, 1}, + {&__pyx_n_s_arrayexposer___setstate_cython, __pyx_k_arrayexposer___setstate_cython, sizeof(__pyx_k_arrayexposer___setstate_cython), 0, 0, 1, 1}, + {&__pyx_n_s_arrayiter, __pyx_k_arrayiter, sizeof(__pyx_k_arrayiter), 0, 0, 1, 1}, + {&__pyx_n_s_arrayiter___reduce_cython, __pyx_k_arrayiter___reduce_cython, sizeof(__pyx_k_arrayiter___reduce_cython), 0, 0, 1, 1}, + {&__pyx_n_s_arrayiter___setstate_cython, __pyx_k_arrayiter___setstate_cython, sizeof(__pyx_k_arrayiter___setstate_cython), 0, 0, 1, 1}, + {&__pyx_kp_u_arrayiter_must_not_be_instanciat, __pyx_k_arrayiter_must_not_be_instanciat, sizeof(__pyx_k_arrayiter_must_not_be_instanciat), 0, 1, 0, 0}, + {&__pyx_n_s_arrex_list, __pyx_k_arrex_list, sizeof(__pyx_k_arrex_list), 0, 0, 1, 1}, + {&__pyx_kp_s_arrex_list_pyx, __pyx_k_arrex_list_pyx, sizeof(__pyx_k_arrex_list_pyx), 0, 0, 1, 0}, + {&__pyx_n_s_asked, __pyx_k_asked, sizeof(__pyx_k_asked), 0, 0, 1, 1}, + {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1}, + {&__pyx_n_s_capacity, __pyx_k_capacity, sizeof(__pyx_k_capacity), 0, 0, 1, 1}, + {&__pyx_n_s_clear, __pyx_k_clear, sizeof(__pyx_k_clear), 0, 0, 1, 1}, + {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, + {&__pyx_n_s_cls, __pyx_k_cls, sizeof(__pyx_k_cls), 0, 0, 1, 1}, + {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1}, + {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1}, + {&__pyx_n_s_deepcopy, __pyx_k_deepcopy, sizeof(__pyx_k_deepcopy), 0, 0, 1, 1}, + {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1}, + {&__pyx_n_s_dict_2, __pyx_k_dict_2, sizeof(__pyx_k_dict_2), 0, 0, 1, 1}, + {&__pyx_kp_u_disable, __pyx_k_disable, sizeof(__pyx_k_disable), 0, 1, 0, 0}, + {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, + {&__pyx_kp_u_dtype_must_be_a_dtype_declaratio, __pyx_k_dtype_must_be_a_dtype_declaratio, sizeof(__pyx_k_dtype_must_be_a_dtype_declaratio), 0, 1, 0, 0}, + {&__pyx_kp_u_dtype_must_be_provided_when_it_c, __pyx_k_dtype_must_be_provided_when_it_c, sizeof(__pyx_k_dtype_must_be_provided_when_it_c), 0, 1, 0, 0}, + {&__pyx_n_s_e, __pyx_k_e, sizeof(__pyx_k_e), 0, 0, 1, 1}, + {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1}, + {&__pyx_kp_u_enable, __pyx_k_enable, sizeof(__pyx_k_enable), 0, 1, 0, 0}, + {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, + {&__pyx_n_s_extend, __pyx_k_extend, sizeof(__pyx_k_extend), 0, 0, 1, 1}, + {&__pyx_n_s_first, __pyx_k_first, sizeof(__pyx_k_first), 0, 0, 1, 1}, + {&__pyx_n_s_full, __pyx_k_full, sizeof(__pyx_k_full), 0, 0, 1, 1}, + {&__pyx_kp_u_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0, 0}, + {&__pyx_n_s_getrefcount, __pyx_k_getrefcount, sizeof(__pyx_k_getrefcount), 0, 0, 1, 1}, + {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, + {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, + {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, + {&__pyx_kp_u_incorrect_slice, __pyx_k_incorrect_slice, sizeof(__pyx_k_incorrect_slice), 0, 1, 0, 0}, + {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1}, + {&__pyx_kp_u_index_must_be_int_or_slice, __pyx_k_index_must_be_int_or_slice, sizeof(__pyx_k_index_must_be_int_or_slice), 0, 1, 0, 0}, + {&__pyx_kp_u_index_out_of_range, __pyx_k_index_out_of_range, sizeof(__pyx_k_index_out_of_range), 0, 1, 0, 0}, + {&__pyx_n_s_initializing, __pyx_k_initializing, sizeof(__pyx_k_initializing), 0, 0, 1, 1}, + {&__pyx_n_s_insert, __pyx_k_insert, sizeof(__pyx_k_insert), 0, 0, 1, 1}, + {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1}, + {&__pyx_kp_u_isenabled, __pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0, 0}, + {&__pyx_n_u_iter, __pyx_k_iter, sizeof(__pyx_k_iter), 0, 1, 0, 1}, + {&__pyx_n_s_iterable, __pyx_k_iterable, sizeof(__pyx_k_iterable), 0, 0, 1, 1}, + {&__pyx_kp_u_iterable_is_empty, __pyx_k_iterable_is_empty, sizeof(__pyx_k_iterable_is_empty), 0, 1, 0, 0}, + {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1}, + {&__pyx_n_s_l, __pyx_k_l, sizeof(__pyx_k_l), 0, 0, 1, 1}, + {&__pyx_n_s_last, __pyx_k_last, sizeof(__pyx_k_last), 0, 0, 1, 1}, + {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, + {&__pyx_n_s_memo, __pyx_k_memo, sizeof(__pyx_k_memo), 0, 0, 1, 1}, + {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, + {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1}, + {&__pyx_n_s_new_2, __pyx_k_new_2, sizeof(__pyx_k_new_2), 0, 0, 1, 1}, + {&__pyx_n_u_next, __pyx_k_next, sizeof(__pyx_k_next), 0, 1, 0, 1}, + {&__pyx_n_s_other, __pyx_k_other, sizeof(__pyx_k_other), 0, 0, 1, 1}, + {&__pyx_n_s_owner, __pyx_k_owner, sizeof(__pyx_k_owner), 0, 0, 1, 1}, + {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1}, + {&__pyx_n_s_pop, __pyx_k_pop, sizeof(__pyx_k_pop), 0, 0, 1, 1}, + {&__pyx_kp_u_pop_from_empty_list, __pyx_k_pop_from_empty_list, sizeof(__pyx_k_pop_from_empty_list), 0, 1, 0, 0}, + {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1}, + {&__pyx_n_s_protocol, __pyx_k_protocol, sizeof(__pyx_k_protocol), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_unpickle_arrayexposer, __pyx_k_pyx_unpickle_arrayexposer, sizeof(__pyx_k_pyx_unpickle_arrayexposer), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_unpickle_arrayiter, __pyx_k_pyx_unpickle_arrayiter, sizeof(__pyx_k_pyx_unpickle_arrayiter), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, + {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, + {&__pyx_n_s_rebuild, __pyx_k_rebuild, sizeof(__pyx_k_rebuild), 0, 0, 1, 1}, + {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, + {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, + {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, + {&__pyx_kp_u_release_buffer, __pyx_k_release_buffer, sizeof(__pyx_k_release_buffer), 0, 1, 0, 0}, + {&__pyx_n_s_reserve, __pyx_k_reserve, sizeof(__pyx_k_reserve), 0, 0, 1, 1}, + {&__pyx_n_s_reverse, __pyx_k_reverse, sizeof(__pyx_k_reverse), 0, 0, 1, 1}, + {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1}, + {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, + {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, + {&__pyx_n_s_shrink, __pyx_k_shrink, sizeof(__pyx_k_shrink), 0, 0, 1, 1}, + {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, + {&__pyx_kp_u_slice_step_is_not_supported, __pyx_k_slice_step_is_not_supported, sizeof(__pyx_k_slice_step_is_not_supported), 0, 1, 0, 0}, + {&__pyx_n_s_spec, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1}, + {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, + {&__pyx_n_s_state, __pyx_k_state, sizeof(__pyx_k_state), 0, 0, 1, 1}, + {&__pyx_n_s_staticmethod, __pyx_k_staticmethod, sizeof(__pyx_k_staticmethod), 0, 0, 1, 1}, + {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, + {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1}, + {&__pyx_n_s_stuff, __pyx_k_stuff, sizeof(__pyx_k_stuff), 0, 0, 1, 1}, + {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1}, + {&__pyx_n_s_temp, __pyx_k_temp, sizeof(__pyx_k_temp), 0, 0, 1, 1}, + {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_kp_u_the_assigned_value_must_be_a_buf, __pyx_k_the_assigned_value_must_be_a_buf, sizeof(__pyx_k_the_assigned_value_must_be_a_buf), 0, 1, 0, 0}, + {&__pyx_kp_u_the_buffer_owner_doens_t_impleme, __pyx_k_the_buffer_owner_doens_t_impleme, sizeof(__pyx_k_the_buffer_owner_doens_t_impleme), 0, 1, 0, 0}, + {&__pyx_kp_u_the_given_buffer_must_have_a_byt, __pyx_k_the_given_buffer_must_have_a_byt, sizeof(__pyx_k_the_given_buffer_must_have_a_byt), 0, 1, 0, 0}, + {&__pyx_kp_u_typedlist, __pyx_k_typedlist, sizeof(__pyx_k_typedlist), 0, 1, 0, 0}, + {&__pyx_n_s_typedlist_2, __pyx_k_typedlist_2, sizeof(__pyx_k_typedlist_2), 0, 0, 1, 1}, + {&__pyx_n_s_typedlist___copy, __pyx_k_typedlist___copy, sizeof(__pyx_k_typedlist___copy), 0, 0, 1, 1}, + {&__pyx_n_s_typedlist___deepcopy, __pyx_k_typedlist___deepcopy, sizeof(__pyx_k_typedlist___deepcopy), 0, 0, 1, 1}, + {&__pyx_n_s_typedlist___reduce_ex, __pyx_k_typedlist___reduce_ex, sizeof(__pyx_k_typedlist___reduce_ex), 0, 0, 1, 1}, + {&__pyx_n_s_typedlist__rebuild, __pyx_k_typedlist__rebuild, sizeof(__pyx_k_typedlist__rebuild), 0, 0, 1, 1}, + {&__pyx_n_s_typedlist_append, __pyx_k_typedlist_append, sizeof(__pyx_k_typedlist_append), 0, 0, 1, 1}, + {&__pyx_n_s_typedlist_capacity, __pyx_k_typedlist_capacity, sizeof(__pyx_k_typedlist_capacity), 0, 0, 1, 1}, + {&__pyx_n_s_typedlist_clear, __pyx_k_typedlist_clear, sizeof(__pyx_k_typedlist_clear), 0, 0, 1, 1}, + {&__pyx_n_s_typedlist_empty, __pyx_k_typedlist_empty, sizeof(__pyx_k_typedlist_empty), 0, 0, 1, 1}, + {&__pyx_n_s_typedlist_extend, __pyx_k_typedlist_extend, sizeof(__pyx_k_typedlist_extend), 0, 0, 1, 1}, + {&__pyx_n_s_typedlist_full, __pyx_k_typedlist_full, sizeof(__pyx_k_typedlist_full), 0, 0, 1, 1}, + {&__pyx_n_s_typedlist_index, __pyx_k_typedlist_index, sizeof(__pyx_k_typedlist_index), 0, 0, 1, 1}, + {&__pyx_n_s_typedlist_insert, __pyx_k_typedlist_insert, sizeof(__pyx_k_typedlist_insert), 0, 0, 1, 1}, + {&__pyx_n_s_typedlist_pop, __pyx_k_typedlist_pop, sizeof(__pyx_k_typedlist_pop), 0, 0, 1, 1}, + {&__pyx_n_s_typedlist_reserve, __pyx_k_typedlist_reserve, sizeof(__pyx_k_typedlist_reserve), 0, 0, 1, 1}, + {&__pyx_n_s_typedlist_reverse, __pyx_k_typedlist_reverse, sizeof(__pyx_k_typedlist_reverse), 0, 0, 1, 1}, + {&__pyx_n_s_typedlist_shrink, __pyx_k_typedlist_shrink, sizeof(__pyx_k_typedlist_shrink), 0, 0, 1, 1}, + {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1}, + {&__pyx_n_s_use_setstate, __pyx_k_use_setstate, sizeof(__pyx_k_use_setstate), 0, 0, 1, 1}, + {&__pyx_n_s_val, __pyx_k_val, sizeof(__pyx_k_val), 0, 0, 1, 1}, + {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1}, + {&__pyx_kp_u_value_not_found, __pyx_k_value_not_found, sizeof(__pyx_k_value_not_found), 0, 1, 0, 0}, + {&__pyx_n_s_view, __pyx_k_view, sizeof(__pyx_k_view), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} + }; + return __Pyx_InitStrings(__pyx_string_tab); +} +/* #### Code section: cached_builtins ### */ +static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_staticmethod = __Pyx_GetBuiltinName(__pyx_n_s_staticmethod); if (!__pyx_builtin_staticmethod) __PYX_ERR(0, 174, __pyx_L1_error) + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 146, __pyx_L1_error) + __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) __PYX_ERR(0, 147, __pyx_L1_error) + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 148, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 182, __pyx_L1_error) + __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_builtin_NotImplemented = __Pyx_GetBuiltinName(__pyx_n_s_NotImplemented); if (!__pyx_builtin_NotImplemented) __PYX_ERR(0, 383, __pyx_L1_error) + __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 553, __pyx_L1_error) + __pyx_builtin_AssertionError = __Pyx_GetBuiltinName(__pyx_n_s_AssertionError); if (!__pyx_builtin_AssertionError) __PYX_ERR(0, 574, __pyx_L1_error) + __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) __PYX_ERR(0, 613, __pyx_L1_error) + __pyx_builtin_OverflowError = __Pyx_GetBuiltinName(__pyx_n_s_OverflowError); if (!__pyx_builtin_OverflowError) __PYX_ERR(1, 83, __pyx_L1_error) + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 86, __pyx_L1_error) + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: cached_constants ### */ + +static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "arrex/list.pyx":146 + * dtype = type(next(iter(iterable))) + * else: + * raise TypeError('dtype must be provided when it cannot be deduced from the iterable') # <<<<<<<<<<<<<< + * except StopIteration: + * raise ValueError('iterable is empty') + */ + __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_dtype_must_be_provided_when_it_c); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple_); + __Pyx_GIVEREF(__pyx_tuple_); + + /* "arrex/list.pyx":148 + * raise TypeError('dtype must be provided when it cannot be deduced from the iterable') + * except StopIteration: + * raise ValueError('iterable is empty') # <<<<<<<<<<<<<< + * + * # initialize the internal structure + */ + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_iterable_is_empty); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__2); + __Pyx_GIVEREF(__pyx_tuple__2); + + /* "arrex/list.pyx":157 + * self.dtype = declared(dtype) + * if not self.dtype: + * raise TypeError('dtype must be a dtype declaration instance, or a key for a declared dtype') # <<<<<<<<<<<<<< + * + * # borrow a buffer + */ + __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_dtype_must_be_a_dtype_declaratio); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 157, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__3); + __Pyx_GIVEREF(__pyx_tuple__3); + + /* "arrex/list.pyx":241 + * if i < 0: i += l + * if i < 0 or i >= l: + * raise IndexError('index out of range') # <<<<<<<<<<<<<< + * return i + * + */ + __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_index_out_of_range); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 241, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__4); + __Pyx_GIVEREF(__pyx_tuple__4); + + /* "arrex/list.pyx":254 + * ''' + * if amount < 0: + * raise ValueError('amount must be positive') # <<<<<<<<<<<<<< + * cdef size_t asked = self.size + (amount) * self.dtype.dsize * if asked > self.allocated: */ __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_amount_must_be_positive); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 254, __pyx_L1_error) @@ -11509,88 +14765,315 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_tuple__17); __Pyx_GIVEREF(__pyx_tuple__17); - /* "arrex/list.pyx":175 - * - * @staticmethod - * def full(value, size, dtype=None): # <<<<<<<<<<<<<< - * ''' full(value, size) - * + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x5a3d340, 0xa9252af, 0xc9dda6f): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x5a3d340, 0xa9252af, 0xc9dda6f) = (owner, shape))" % __pyx_checksum */ - __pyx_tuple__18 = PyTuple_Pack(5, __pyx_n_s_value, __pyx_n_s_size, __pyx_n_s_dtype, __pyx_n_s_i, __pyx_n_s_array); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_tuple__18 = PyTuple_Pack(3, __pyx_int_94622528, __pyx_int_177361583, __pyx_int_211671663); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__18); __Pyx_GIVEREF(__pyx_tuple__18); - __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_arrex_list_pyx, __pyx_n_s_full, 175, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 175, __pyx_L1_error) - - /* "arrex/list.pyx":188 - * - * @staticmethod - * def empty(dtype, size): # <<<<<<<<<<<<<< - * ''' empty(dtype, size) - * - */ - __pyx_tuple__20 = PyTuple_Pack(3, __pyx_n_s_dtype, __pyx_n_s_size, __pyx_n_s_array); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 188, __pyx_L1_error) + __pyx_tuple__20 = PyTuple_Pack(3, __pyx_int_123397093, __pyx_int_199122709, __pyx_int_26530323); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__20); __Pyx_GIVEREF(__pyx_tuple__20); - __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_arrex_list_pyx, __pyx_n_s_empty, 188, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 188, __pyx_L1_error) - /* "(tree fragment)":1 - * def __pyx_unpickle_arrayexposer(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result + /* "arrex/list.pyx":174 + * self.extend(iterable) + * + * @staticmethod # <<<<<<<<<<<<<< + * def full(value, size, dtype=None): + * ''' full(value, size) */ - __pyx_tuple__22 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_tuple__22 = PyTuple_Pack(5, __pyx_n_s_value, __pyx_n_s_size, __pyx_n_s_dtype, __pyx_n_s_i, __pyx_n_s_array); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 174, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__22); __Pyx_GIVEREF(__pyx_tuple__22); - __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_arrayexposer, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(1, 1, __pyx_L1_error) - __pyx_tuple__24 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_arrex_list_pyx, __pyx_n_s_full, 174, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 174, __pyx_L1_error) + __pyx_tuple__24 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 174, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__24); __Pyx_GIVEREF(__pyx_tuple__24); - __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_arrayiter, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} -static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_26530323 = PyInt_FromLong(26530323L); if (unlikely(!__pyx_int_26530323)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_211671663 = PyInt_FromLong(211671663L); if (unlikely(!__pyx_int_211671663)) __PYX_ERR(0, 1, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} + /* "arrex/list.pyx":187 + * return array + * + * @staticmethod # <<<<<<<<<<<<<< + * def empty(dtype, size): + * ''' empty(dtype, size) + */ + __pyx_tuple__25 = PyTuple_Pack(3, __pyx_n_s_dtype, __pyx_n_s_size, __pyx_n_s_array); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__25); + __Pyx_GIVEREF(__pyx_tuple__25); + __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_arrex_list_pyx, __pyx_n_s_empty, 187, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 187, __pyx_L1_error) -static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ + /* "arrex/list.pyx":246 + * # python interface + * + * def reserve(self, amount): # <<<<<<<<<<<<<< + * ''' reserve(amount: int) + * + */ + __pyx_tuple__27 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_amount, __pyx_n_s_asked); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 246, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__27); + __Pyx_GIVEREF(__pyx_tuple__27); + __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_arrex_list_pyx, __pyx_n_s_reserve, 246, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 246, __pyx_L1_error) -static int __Pyx_modinit_global_init_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); - /*--- Global init code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} + /* "arrex/list.pyx":259 + * self._reallocate(asked) + * + * cpdef int append(self, value) except -1: # <<<<<<<<<<<<<< + * ''' append(value) + * + */ + __pyx_tuple__29 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_value); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 259, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__29); + __Pyx_GIVEREF(__pyx_tuple__29); + __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_arrex_list_pyx, __pyx_n_s_append, 259, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 259, __pyx_L1_error) -static int __Pyx_modinit_variable_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); - /*--- Variable export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} + /* "arrex/list.pyx":272 + * self.size += self.dtype.dsize + * + * def pop(self, index=None): # <<<<<<<<<<<<<< + * ''' pop(index=None) -> object + * + */ + __pyx_tuple__31 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_index, __pyx_n_s_i, __pyx_n_s_start, __pyx_n_s_e); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 272, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__31); + __Pyx_GIVEREF(__pyx_tuple__31); + __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_arrex_list_pyx, __pyx_n_s_pop, 272, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 272, __pyx_L1_error) -static int __Pyx_modinit_function_export_code(void) { - __Pyx_RefNannyDeclarations + /* "arrex/list.pyx":296 + * return e + * + * def insert(self, index, value): # <<<<<<<<<<<<<< + * ''' insert(index, value) + * + */ + __pyx_tuple__33 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_index, __pyx_n_s_value, __pyx_n_s_i, __pyx_n_s_l, __pyx_n_s_j, __pyx_n_s_start); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 296, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__33); + __Pyx_GIVEREF(__pyx_tuple__33); + __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_arrex_list_pyx, __pyx_n_s_insert, 296, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 296, __pyx_L1_error) + + /* "arrex/list.pyx":317 + * self.size += self.dtype.dsize + * + * def clear(self): # <<<<<<<<<<<<<< + * ''' remove all elements from the array but does not deallocate, very fast operation ''' + * self.size = 0 + */ + __pyx_tuple__35 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 317, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__35); + __Pyx_GIVEREF(__pyx_tuple__35); + __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_arrex_list_pyx, __pyx_n_s_clear, 317, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 317, __pyx_L1_error) + + /* "arrex/list.pyx":321 + * self.size = 0 + * + * cpdef int extend(self, other) except *: # <<<<<<<<<<<<<< + * ''' extend(iterable) + * + */ + __pyx_tuple__37 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_other); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__37); + __Pyx_GIVEREF(__pyx_tuple__37); + __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_arrex_list_pyx, __pyx_n_s_extend, 321, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 321, __pyx_L1_error) + + /* "arrex/list.pyx":393 + * return NotImplemented + * + * def capacity(self): # <<<<<<<<<<<<<< + * ''' capacity() + * + */ + __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_arrex_list_pyx, __pyx_n_s_capacity, 393, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 393, __pyx_L1_error) + + /* "arrex/list.pyx":400 + * return self.allocated // self.dtype.dsize + * + * def shrink(self): # <<<<<<<<<<<<<< + * ''' shrink() + * + */ + __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_arrex_list_pyx, __pyx_n_s_shrink, 400, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 400, __pyx_L1_error) + + /* "arrex/list.pyx":539 + * return 0 == memcmp(self.ptr, o.ptr, self.size) + * + * def __copy__(self): # <<<<<<<<<<<<<< + * ''' shallow copy will create a copy of that array referencing the same buffer ''' + * return self[:] + */ + __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_arrex_list_pyx, __pyx_n_s_copy, 539, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 539, __pyx_L1_error) + + /* "arrex/list.pyx":543 + * return self[:] + * + * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< + * ''' deep recursive copy, will duplicate the viewed data in the underlying buffer ''' + * return typedlist(PyBytes_FromStringAndSize(self.ptr, self.size), self.dtype) + */ + __pyx_tuple__42 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_memo); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 543, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__42); + __Pyx_GIVEREF(__pyx_tuple__42); + __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_arrex_list_pyx, __pyx_n_s_deepcopy, 543, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 543, __pyx_L1_error) + + /* "arrex/list.pyx":547 + * return typedlist(PyBytes_FromStringAndSize(self.ptr, self.size), self.dtype) + * + * def __reduce_ex__(self, protocol): # <<<<<<<<<<<<<< + * ''' serialization protocol ''' + * cdef Py_buffer view + */ + __pyx_tuple__44 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_protocol, __pyx_n_s_view, __pyx_n_s_stuff); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 547, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__44); + __Pyx_GIVEREF(__pyx_tuple__44); + __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_arrex_list_pyx, __pyx_n_s_reduce_ex, 547, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 547, __pyx_L1_error) + + /* "arrex/list.pyx":571 + * ) + * + * @classmethod # <<<<<<<<<<<<<< + * def _rebuild(cls, owner, dtype, size_t start, size_t size): + * new = typedlist(owner, dtype) + */ + __pyx_tuple__46 = PyTuple_Pack(6, __pyx_n_s_cls, __pyx_n_s_owner, __pyx_n_s_dtype, __pyx_n_s_start, __pyx_n_s_size, __pyx_n_s_new_2); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 571, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__46); + __Pyx_GIVEREF(__pyx_tuple__46); + __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_arrex_list_pyx, __pyx_n_s_rebuild, 571, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 571, __pyx_L1_error) + + /* "arrex/list.pyx":617 + * view.obj = None + * + * def reverse(self): # <<<<<<<<<<<<<< + * ''' reverse() + * + */ + __pyx_tuple__48 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_temp, __pyx_n_s_first, __pyx_n_s_last, __pyx_n_s_i); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__48); + __Pyx_GIVEREF(__pyx_tuple__48); + __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_arrex_list_pyx, __pyx_n_s_reverse, 617, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 617, __pyx_L1_error) + + /* "arrex/list.pyx":638 + * PyMem_Free(temp) + * + * def index(self, value): # <<<<<<<<<<<<<< + * ''' index(value) + * + */ + __pyx_tuple__50 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_value, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_data, __pyx_n_s_val); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 638, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__50); + __Pyx_GIVEREF(__pyx_tuple__50); + __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_arrex_list_pyx, __pyx_n_s_index, 638, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 638, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict + */ + __pyx_tuple__52 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_state, __pyx_n_s_dict_2, __pyx_n_s_use_setstate); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__52); + __Pyx_GIVEREF(__pyx_tuple__52); + __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(1, 1, __pyx_L1_error) + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_arrayexposer, (type(self), 0x5a3d340, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_arrayexposer__set_state(self, __pyx_state) + */ + __pyx_tuple__54 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pyx_state); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__54); + __Pyx_GIVEREF(__pyx_tuple__54); + __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(1, 16, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict + */ + __pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) __PYX_ERR(1, 1, __pyx_L1_error) + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_arrayiter, (type(self), 0x75ae3e5, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_arrayiter__set_state(self, __pyx_state) + */ + __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(1, 16, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __pyx_unpickle_arrayexposer(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ + __pyx_tuple__58 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__58); + __Pyx_GIVEREF(__pyx_tuple__58); + __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__58, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_arrayexposer, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__58, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_arrayiter, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__60)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} +/* #### Code section: init_constants ### */ + +static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { + if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error); + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_26530323 = PyInt_FromLong(26530323L); if (unlikely(!__pyx_int_26530323)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_94622528 = PyInt_FromLong(94622528L); if (unlikely(!__pyx_int_94622528)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_123397093 = PyInt_FromLong(123397093L); if (unlikely(!__pyx_int_123397093)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_177361583 = PyInt_FromLong(177361583L); if (unlikely(!__pyx_int_177361583)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_199122709 = PyInt_FromLong(199122709L); if (unlikely(!__pyx_int_199122709)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_211671663 = PyInt_FromLong(211671663L); if (unlikely(!__pyx_int_211671663)) __PYX_ERR(0, 1, __pyx_L1_error) + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: init_globals ### */ + +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { + /* AssertionsEnabled.init */ + __Pyx_init_assertions_enabled(); + +if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: init_module ### */ + +static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ + +static int __Pyx_modinit_global_init_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); + /*--- Global init code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_export_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); + /*--- Variable export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_export_code(void) { + __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); /*--- Function export code ---*/ __Pyx_RefNannyFinishContext(); @@ -11613,96 +15096,145 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_vtable_5arrex_4list_typedlist._index = (Py_ssize_t (*)(struct __pyx_obj_5arrex_4list_typedlist *, PyObject *))__pyx_f_5arrex_4list_9typedlist__index; __pyx_vtable_5arrex_4list_typedlist.append = (int (*)(struct __pyx_obj_5arrex_4list_typedlist *, PyObject *, int __pyx_skip_dispatch))__pyx_f_5arrex_4list_9typedlist_append; __pyx_vtable_5arrex_4list_typedlist.extend = (int (*)(struct __pyx_obj_5arrex_4list_typedlist *, PyObject *, int __pyx_skip_dispatch))__pyx_f_5arrex_4list_9typedlist_extend; - if (PyType_Ready(&__pyx_type_5arrex_4list_typedlist) < 0) __PYX_ERR(0, 45, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type_5arrex_4list_typedlist.tp_print = 0; + #if CYTHON_USE_TYPE_SPECS + __pyx_ptype_5arrex_4list_typedlist = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5arrex_4list_typedlist_spec, NULL); if (unlikely(!__pyx_ptype_5arrex_4list_typedlist)) __PYX_ERR(0, 45, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_ptype_5arrex_4list_typedlist->tp_as_buffer = &__pyx_tp_as_buffer_typedlist; + #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) + /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ + #elif defined(_MSC_VER) + #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") + #else + #warning "The buffer protocol is not supported in the Limited C-API < 3.11." + #endif + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5arrex_4list_typedlist_spec, __pyx_ptype_5arrex_4list_typedlist) < 0) __PYX_ERR(0, 45, __pyx_L1_error) + #else + __pyx_ptype_5arrex_4list_typedlist = &__pyx_type_5arrex_4list_typedlist; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_ptype_5arrex_4list_typedlist) < 0) __PYX_ERR(0, 45, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_ptype_5arrex_4list_typedlist->tp_print = 0; #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5arrex_4list_typedlist.tp_dictoffset && __pyx_type_5arrex_4list_typedlist.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_5arrex_4list_typedlist.tp_getattro = __Pyx_PyObject_GenericGetAttr; + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5arrex_4list_typedlist->tp_dictoffset && __pyx_ptype_5arrex_4list_typedlist->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_ptype_5arrex_4list_typedlist->tp_getattro = __Pyx_PyObject_GenericGetAttr; } - #if CYTHON_COMPILING_IN_CPYTHON + #endif + #if CYTHON_UPDATE_DESCRIPTOR_DOC { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_5arrex_4list_typedlist, "__add__"); if (unlikely(!wrapper)) __PYX_ERR(0, 45, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_ptype_5arrex_4list_typedlist, "__add__"); if (unlikely(!wrapper)) __PYX_ERR(0, 45, __pyx_L1_error) + if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) { __pyx_wrapperbase_5arrex_4list_9typedlist_20__add__ = *((PyWrapperDescrObject *)wrapper)->d_base; __pyx_wrapperbase_5arrex_4list_9typedlist_20__add__.doc = __pyx_doc_5arrex_4list_9typedlist_20__add__; ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5arrex_4list_9typedlist_20__add__; } } #endif - #if CYTHON_COMPILING_IN_CPYTHON + #if CYTHON_UPDATE_DESCRIPTOR_DOC { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_5arrex_4list_typedlist, "__mul__"); if (unlikely(!wrapper)) __PYX_ERR(0, 45, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_ptype_5arrex_4list_typedlist, "__mul__"); if (unlikely(!wrapper)) __PYX_ERR(0, 45, __pyx_L1_error) + if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) { __pyx_wrapperbase_5arrex_4list_9typedlist_22__mul__ = *((PyWrapperDescrObject *)wrapper)->d_base; __pyx_wrapperbase_5arrex_4list_9typedlist_22__mul__.doc = __pyx_doc_5arrex_4list_9typedlist_22__mul__; ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5arrex_4list_9typedlist_22__mul__; } } #endif - #if CYTHON_COMPILING_IN_CPYTHON + #if CYTHON_UPDATE_DESCRIPTOR_DOC { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_5arrex_4list_typedlist, "__len__"); if (unlikely(!wrapper)) __PYX_ERR(0, 45, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_ptype_5arrex_4list_typedlist, "__len__"); if (unlikely(!wrapper)) __PYX_ERR(0, 45, __pyx_L1_error) + if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) { __pyx_wrapperbase_5arrex_4list_9typedlist_28__len__ = *((PyWrapperDescrObject *)wrapper)->d_base; __pyx_wrapperbase_5arrex_4list_9typedlist_28__len__.doc = __pyx_doc_5arrex_4list_9typedlist_28__len__; ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5arrex_4list_9typedlist_28__len__; } } #endif - #if CYTHON_COMPILING_IN_CPYTHON + #if CYTHON_UPDATE_DESCRIPTOR_DOC { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_5arrex_4list_typedlist, "__getitem__"); if (unlikely(!wrapper)) __PYX_ERR(0, 45, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_ptype_5arrex_4list_typedlist, "__getitem__"); if (unlikely(!wrapper)) __PYX_ERR(0, 45, __pyx_L1_error) + if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) { __pyx_wrapperbase_5arrex_4list_9typedlist_30__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base; __pyx_wrapperbase_5arrex_4list_9typedlist_30__getitem__.doc = __pyx_doc_5arrex_4list_9typedlist_30__getitem__; ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5arrex_4list_9typedlist_30__getitem__; } } #endif - #if CYTHON_COMPILING_IN_CPYTHON + #if CYTHON_UPDATE_DESCRIPTOR_DOC { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_5arrex_4list_typedlist, "__iter__"); if (unlikely(!wrapper)) __PYX_ERR(0, 45, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_ptype_5arrex_4list_typedlist, "__iter__"); if (unlikely(!wrapper)) __PYX_ERR(0, 45, __pyx_L1_error) + if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) { __pyx_wrapperbase_5arrex_4list_9typedlist_36__iter__ = *((PyWrapperDescrObject *)wrapper)->d_base; __pyx_wrapperbase_5arrex_4list_9typedlist_36__iter__.doc = __pyx_doc_5arrex_4list_9typedlist_36__iter__; ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5arrex_4list_9typedlist_36__iter__; } } #endif - #if CYTHON_COMPILING_IN_CPYTHON + #if CYTHON_UPDATE_DESCRIPTOR_DOC { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_5arrex_4list_typedlist, "__eq__"); if (unlikely(!wrapper)) __PYX_ERR(0, 45, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_ptype_5arrex_4list_typedlist, "__eq__"); if (unlikely(!wrapper)) __PYX_ERR(0, 45, __pyx_L1_error) + if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) { __pyx_wrapperbase_5arrex_4list_9typedlist_40__eq__ = *((PyWrapperDescrObject *)wrapper)->d_base; __pyx_wrapperbase_5arrex_4list_9typedlist_40__eq__.doc = __pyx_doc_5arrex_4list_9typedlist_40__eq__; ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5arrex_4list_9typedlist_40__eq__; } } #endif - if (__Pyx_SetVtable(__pyx_type_5arrex_4list_typedlist.tp_dict, __pyx_vtabptr_5arrex_4list_typedlist) < 0) __PYX_ERR(0, 45, __pyx_L1_error) - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_typedlist_2, (PyObject *)&__pyx_type_5arrex_4list_typedlist) < 0) __PYX_ERR(0, 45, __pyx_L1_error) - __pyx_ptype_5arrex_4list_typedlist = &__pyx_type_5arrex_4list_typedlist; - if (PyType_Ready(&__pyx_type_5arrex_4list_arrayexposer) < 0) __PYX_ERR(0, 666, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type_5arrex_4list_arrayexposer.tp_print = 0; + if (__Pyx_SetVtable(__pyx_ptype_5arrex_4list_typedlist, __pyx_vtabptr_5arrex_4list_typedlist) < 0) __PYX_ERR(0, 45, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_MergeVtables(__pyx_ptype_5arrex_4list_typedlist) < 0) __PYX_ERR(0, 45, __pyx_L1_error) #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5arrex_4list_arrayexposer.tp_dictoffset && __pyx_type_5arrex_4list_arrayexposer.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_5arrex_4list_arrayexposer.tp_getattro = __Pyx_PyObject_GenericGetAttr; - } - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_arrayexposer, (PyObject *)&__pyx_type_5arrex_4list_arrayexposer) < 0) __PYX_ERR(0, 666, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5arrex_4list_arrayexposer) < 0) __PYX_ERR(0, 666, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_typedlist_2, (PyObject *) __pyx_ptype_5arrex_4list_typedlist) < 0) __PYX_ERR(0, 45, __pyx_L1_error) + #if CYTHON_USE_TYPE_SPECS + __pyx_ptype_5arrex_4list_arrayexposer = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5arrex_4list_arrayexposer_spec, NULL); if (unlikely(!__pyx_ptype_5arrex_4list_arrayexposer)) __PYX_ERR(0, 666, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5arrex_4list_arrayexposer_spec, __pyx_ptype_5arrex_4list_arrayexposer) < 0) __PYX_ERR(0, 666, __pyx_L1_error) + #else __pyx_ptype_5arrex_4list_arrayexposer = &__pyx_type_5arrex_4list_arrayexposer; - if (PyType_Ready(&__pyx_type_5arrex_4list_arrayiter) < 0) __PYX_ERR(0, 673, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type_5arrex_4list_arrayiter.tp_print = 0; #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5arrex_4list_arrayiter.tp_dictoffset && __pyx_type_5arrex_4list_arrayiter.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_5arrex_4list_arrayiter.tp_getattro = __Pyx_PyObject_GenericGetAttr; + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_ptype_5arrex_4list_arrayexposer) < 0) __PYX_ERR(0, 666, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_ptype_5arrex_4list_arrayexposer->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5arrex_4list_arrayexposer->tp_dictoffset && __pyx_ptype_5arrex_4list_arrayexposer->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_ptype_5arrex_4list_arrayexposer->tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_arrayiter, (PyObject *)&__pyx_type_5arrex_4list_arrayiter) < 0) __PYX_ERR(0, 673, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5arrex_4list_arrayiter) < 0) __PYX_ERR(0, 673, __pyx_L1_error) + #endif + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_arrayexposer, (PyObject *) __pyx_ptype_5arrex_4list_arrayexposer) < 0) __PYX_ERR(0, 666, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_5arrex_4list_arrayexposer) < 0) __PYX_ERR(0, 666, __pyx_L1_error) + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_ptype_5arrex_4list_arrayiter = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5arrex_4list_arrayiter_spec, NULL); if (unlikely(!__pyx_ptype_5arrex_4list_arrayiter)) __PYX_ERR(0, 673, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5arrex_4list_arrayiter_spec, __pyx_ptype_5arrex_4list_arrayiter) < 0) __PYX_ERR(0, 673, __pyx_L1_error) + #else __pyx_ptype_5arrex_4list_arrayiter = &__pyx_type_5arrex_4list_arrayiter; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_ptype_5arrex_4list_arrayiter) < 0) __PYX_ERR(0, 673, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_ptype_5arrex_4list_arrayiter->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5arrex_4list_arrayiter->tp_dictoffset && __pyx_ptype_5arrex_4list_arrayiter->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_ptype_5arrex_4list_arrayiter->tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + #endif + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_arrayiter, (PyObject *) __pyx_ptype_5arrex_4list_arrayiter) < 0) __PYX_ERR(0, 673, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_5arrex_4list_arrayiter) < 0) __PYX_ERR(0, 673, __pyx_L1_error) + #endif __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -11718,31 +15250,29 @@ static int __Pyx_modinit_type_import_code(void) { int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); /*--- Type import code ---*/ - __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error) + __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_0_0(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 - sizeof(PyTypeObject), + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_0(PyTypeObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_0(PyTypeObject), #else - sizeof(PyHeapTypeObject), + sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_0(PyHeapTypeObject), #endif - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error) + __Pyx_ImportType_CheckSize_Warn_3_0_0); if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 8, __pyx_L1_error) + __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(3, 8, __pyx_L1_error) + __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType_3_0_0(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_0(PyBoolObject),__Pyx_ImportType_CheckSize_Warn_3_0_0); if (!__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(4, 8, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15, __pyx_L1_error) + __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(4, 15, __pyx_L1_error) + __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType_3_0_0(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_0(PyComplexObject),__Pyx_ImportType_CheckSize_Warn_3_0_0); if (!__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(5, 15, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyImport_ImportModule("arrex.dtypes"); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 14, __pyx_L1_error) + __pyx_t_1 = PyImport_ImportModule("arrex.dtypes"); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_5arrex_6dtypes_DDType = __Pyx_ImportType(__pyx_t_1, "arrex.dtypes", "DDType", sizeof(struct __pyx_obj_5arrex_6dtypes_DDType), __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5arrex_6dtypes_DDType) __PYX_ERR(5, 14, __pyx_L1_error) + __pyx_ptype_5arrex_6dtypes_DDType = __Pyx_ImportType_3_0_0(__pyx_t_1, "arrex.dtypes", "DDType", sizeof(struct __pyx_obj_5arrex_6dtypes_DDType), __PYX_GET_STRUCT_ALIGNMENT_3_0_0(struct __pyx_obj_5arrex_6dtypes_DDType),__Pyx_ImportType_CheckSize_Warn_3_0_0); if (!__pyx_ptype_5arrex_6dtypes_DDType) __PYX_ERR(6, 14, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; @@ -11770,7 +15300,7 @@ static int __Pyx_modinit_function_import_code(void) { /*--- Function import code ---*/ __pyx_t_1 = PyImport_ImportModule("arrex.dtypes"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_ImportFunction(__pyx_t_1, "declared", (void (**)(void))&__pyx_f_5arrex_6dtypes_declared, "struct __pyx_obj_5arrex_6dtypes_DDType *(PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportFunction_3_0_0(__pyx_t_1, "declared", (void (**)(void))&__pyx_f_5arrex_6dtypes_declared, "struct __pyx_obj_5arrex_6dtypes_DDType *(PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; @@ -11781,6 +15311,55 @@ static int __Pyx_modinit_function_import_code(void) { } +#if PY_MAJOR_VERSION >= 3 +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec_list(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_list}, + {0, NULL} +}; +#endif + +#ifdef __cplusplus +namespace { + struct PyModuleDef __pyx_moduledef = + #else + static struct PyModuleDef __pyx_moduledef = + #endif + { + PyModuleDef_HEAD_INIT, + "list", + 0, /* m_doc */ + #if CYTHON_PEP489_MULTI_PHASE_INIT + 0, /* m_size */ + #elif CYTHON_USE_MODULE_STATE + sizeof(__pyx_mstate), /* m_size */ + #else + -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + #if CYTHON_USE_MODULE_STATE + __pyx_m_traverse, /* m_traverse */ + __pyx_m_clear, /* m_clear */ + NULL /* m_free */ + #else + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ + #endif + }; + #ifdef __cplusplus +} /* anonymous namespace */ +#endif +#endif + #ifndef CYTHON_NO_PYINIT_EXPORT #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC #elif PY_MAJOR_VERSION < 3 @@ -11831,12 +15410,21 @@ static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { } return 0; } -static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none) +#else +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) +#endif +{ PyObject *value = PyObject_GetAttrString(spec, from_name); int result = 0; if (likely(value)) { if (allow_none || value != Py_None) { +#if CYTHON_COMPILING_IN_LIMITED_API + result = PyModule_AddObject(module, to_name, value); +#else result = PyDict_SetItemString(moddict, to_name, value); +#endif } Py_DECREF(value); } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { @@ -11846,8 +15434,9 @@ static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject } return result; } -static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { +static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { PyObject *module = NULL, *moddict, *modname; + CYTHON_UNUSED_VAR(def); if (__Pyx_check_single_interpreter()) return NULL; if (__pyx_m) @@ -11857,8 +15446,12 @@ static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNU module = PyModule_NewObject(modname); Py_DECREF(modname); if (unlikely(!module)) goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + moddict = module; +#else moddict = PyModule_GetDict(module); if (unlikely(!moddict)) goto bad; +#endif if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; @@ -11874,8 +15467,13 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec_list(PyObject *__pyx_pyinit_module #endif #endif { + int stringtab_initialized = 0; + #if CYTHON_USE_MODULE_STATE + int pystate_addmodule_run = 0; + #endif PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -11889,6 +15487,35 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec_list(PyObject *__pyx_pyinit_module #elif PY_MAJOR_VERSION >= 3 if (__pyx_m) return __Pyx_NewRef(__pyx_m); #endif + /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_m = __pyx_pyinit_module; + Py_INCREF(__pyx_m); + #else + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4("list", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #elif CYTHON_USE_MODULE_STATE + __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + { + int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef); + __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to list pseudovariable */ + if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + pystate_addmodule_run = 1; + } + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #endif + CYTHON_UNUSED_VAR(__pyx_t_1); + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_d); + __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_b); + __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_cython_runtime); + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { @@ -11907,48 +15534,31 @@ if (!__Pyx_RefNanny) { __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_AsyncGen_USED - if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS PyEval_InitThreads(); #endif - /*--- Module creation code ---*/ - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_m = __pyx_pyinit_module; - Py_INCREF(__pyx_m); - #else - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("list", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_b); - __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_cython_runtime); - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + stringtab_initialized = 1; if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) @@ -11960,7 +15570,7 @@ if (!__Pyx_RefNanny) { { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) if (!PyDict_GetItemString(modules, "arrex.list")) { - if (unlikely(PyDict_SetItemString(modules, "arrex.list", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((PyDict_SetItemString(modules, "arrex.list", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) } } #endif @@ -11972,10 +15582,10 @@ if (!__Pyx_RefNanny) { (void)__Pyx_modinit_global_init_code(); (void)__Pyx_modinit_variable_export_code(); (void)__Pyx_modinit_function_export_code(); - if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_type_init_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_type_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) (void)__Pyx_modinit_variable_import_code(); - if (unlikely(__Pyx_modinit_function_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_function_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Execution code ---*/ #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) @@ -11988,10 +15598,10 @@ if (!__Pyx_RefNanny) { * from pickle import PickleBuffer * import sys */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_struct, __pyx_t_1) < 0) __PYX_ERR(0, 13, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_struct, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_struct, __pyx_t_2) < 0) __PYX_ERR(0, 13, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "arrex/list.pyx":14 * @@ -12000,19 +15610,19 @@ if (!__Pyx_RefNanny) { * import sys * */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_PickleBuffer); __Pyx_GIVEREF(__pyx_n_s_PickleBuffer); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleBuffer); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error) + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleBuffer); + __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleBuffer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_PickleBuffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_PickleBuffer, __pyx_t_1) < 0) __PYX_ERR(0, 14, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_PickleBuffer, __pyx_t_2) < 0) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "arrex/list.pyx":15 * import struct @@ -12021,78 +15631,197 @@ if (!__Pyx_RefNanny) { * * cdef extern from "Python.h": */ - __pyx_t_2 = __Pyx_Import(__pyx_n_s_sys, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_2) < 0) __PYX_ERR(0, 15, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_ImportDottedModule(__pyx_n_s_sys, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_3) < 0) __PYX_ERR(0, 15, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "arrex/list.pyx":175 + /* "arrex/list.pyx":174 + * self.extend(iterable) * - * @staticmethod - * def full(value, size, dtype=None): # <<<<<<<<<<<<<< + * @staticmethod # <<<<<<<<<<<<<< + * def full(value, size, dtype=None): * ''' full(value, size) - * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5arrex_4list_9typedlist_3full, NULL, __pyx_n_s_arrex_list); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_4list_9typedlist_3full, __Pyx_CYFUNCTION_STATICMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_typedlist_full, NULL, __pyx_n_s_arrex_list, __pyx_d, ((PyObject *)__pyx_codeobj__23)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 174, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__24); + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_4list_typedlist->tp_dict, __pyx_n_s_full, __pyx_t_3) < 0) __PYX_ERR(0, 174, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + PyType_Modified(__pyx_ptype_5arrex_4list_typedlist); + __Pyx_GetNameInClass(__pyx_t_3, (PyObject *)__pyx_ptype_5arrex_4list_typedlist, __pyx_n_s_full); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 174, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 174, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_4list_typedlist->tp_dict, __pyx_n_s_full, __pyx_t_2) < 0) __PYX_ERR(0, 175, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_4list_typedlist->tp_dict, __pyx_n_s_full, __pyx_t_2) < 0) __PYX_ERR(0, 174, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_5arrex_4list_typedlist); - /* "arrex/list.pyx":174 - * self.extend(iterable) + /* "arrex/list.pyx":187 + * return array * * @staticmethod # <<<<<<<<<<<<<< - * def full(value, size, dtype=None): - * ''' full(value, size) + * def empty(dtype, size): + * ''' empty(dtype, size) */ - __Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_5arrex_4list_typedlist, __pyx_n_s_full); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_4list_9typedlist_5empty, __Pyx_CYFUNCTION_STATICMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_typedlist_empty, NULL, __pyx_n_s_arrex_list, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 187, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_4list_typedlist->tp_dict, __pyx_n_s_empty, __pyx_t_2) < 0) __PYX_ERR(0, 187, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_4list_typedlist->tp_dict, __pyx_n_s_full, __pyx_t_1) < 0) __PYX_ERR(0, 175, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyType_Modified(__pyx_ptype_5arrex_4list_typedlist); + __Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_5arrex_4list_typedlist, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_4list_typedlist->tp_dict, __pyx_n_s_empty, __pyx_t_3) < 0) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_5arrex_4list_typedlist); - /* "arrex/list.pyx":188 + /* "arrex/list.pyx":246 + * # python interface * - * @staticmethod - * def empty(dtype, size): # <<<<<<<<<<<<<< - * ''' empty(dtype, size) + * def reserve(self, amount): # <<<<<<<<<<<<<< + * ''' reserve(amount: int) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5arrex_4list_9typedlist_5empty, NULL, __pyx_n_s_arrex_list); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 188, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_4list_typedlist->tp_dict, __pyx_n_s_empty, __pyx_t_1) < 0) __PYX_ERR(0, 188, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_4list_9typedlist_7reserve, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_typedlist_reserve, NULL, __pyx_n_s_arrex_list, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 246, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_4list_typedlist->tp_dict, __pyx_n_s_reserve, __pyx_t_3) < 0) __PYX_ERR(0, 246, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_5arrex_4list_typedlist); - /* "arrex/list.pyx":187 - * return array + /* "arrex/list.pyx":259 + * self._reallocate(asked) + * + * cpdef int append(self, value) except -1: # <<<<<<<<<<<<<< + * ''' append(value) * - * @staticmethod # <<<<<<<<<<<<<< - * def empty(dtype, size): - * ''' empty(dtype, size) */ - __Pyx_GetNameInClass(__pyx_t_1, (PyObject *)__pyx_ptype_5arrex_4list_typedlist, __pyx_n_s_empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 188, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 187, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_4list_typedlist->tp_dict, __pyx_n_s_empty, __pyx_t_2) < 0) __PYX_ERR(0, 188, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_4list_9typedlist_9append, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_typedlist_append, NULL, __pyx_n_s_arrex_list, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 259, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_4list_typedlist->tp_dict, __pyx_n_s_append, __pyx_t_3) < 0) __PYX_ERR(0, 259, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_5arrex_4list_typedlist); - /* "arrex/list.pyx":572 + /* "arrex/list.pyx":272 + * self.size += self.dtype.dsize + * + * def pop(self, index=None): # <<<<<<<<<<<<<< + * ''' pop(index=None) -> object * - * @classmethod - * def _rebuild(cls, owner, dtype, size_t start, size_t size): # <<<<<<<<<<<<<< - * new = typedlist(owner, dtype) - * assert start <= size */ - __Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_5arrex_4list_typedlist, __pyx_n_s_rebuild); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 572, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_4list_9typedlist_11pop, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_typedlist_pop, NULL, __pyx_n_s_arrex_list, __pyx_d, ((PyObject *)__pyx_codeobj__32)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 272, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__24); + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_4list_typedlist->tp_dict, __pyx_n_s_pop, __pyx_t_3) < 0) __PYX_ERR(0, 272, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + PyType_Modified(__pyx_ptype_5arrex_4list_typedlist); + + /* "arrex/list.pyx":296 + * return e + * + * def insert(self, index, value): # <<<<<<<<<<<<<< + * ''' insert(index, value) + * + */ + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_4list_9typedlist_13insert, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_typedlist_insert, NULL, __pyx_n_s_arrex_list, __pyx_d, ((PyObject *)__pyx_codeobj__34)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 296, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_4list_typedlist->tp_dict, __pyx_n_s_insert, __pyx_t_3) < 0) __PYX_ERR(0, 296, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + PyType_Modified(__pyx_ptype_5arrex_4list_typedlist); + + /* "arrex/list.pyx":317 + * self.size += self.dtype.dsize + * + * def clear(self): # <<<<<<<<<<<<<< + * ''' remove all elements from the array but does not deallocate, very fast operation ''' + * self.size = 0 + */ + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_4list_9typedlist_15clear, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_typedlist_clear, NULL, __pyx_n_s_arrex_list, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 317, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_4list_typedlist->tp_dict, __pyx_n_s_clear, __pyx_t_3) < 0) __PYX_ERR(0, 317, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + PyType_Modified(__pyx_ptype_5arrex_4list_typedlist); + + /* "arrex/list.pyx":321 + * self.size = 0 + * + * cpdef int extend(self, other) except *: # <<<<<<<<<<<<<< + * ''' extend(iterable) + * + */ + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_4list_9typedlist_17extend, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_typedlist_extend, NULL, __pyx_n_s_arrex_list, __pyx_d, ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_4list_typedlist->tp_dict, __pyx_n_s_extend, __pyx_t_3) < 0) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + PyType_Modified(__pyx_ptype_5arrex_4list_typedlist); + + /* "arrex/list.pyx":393 + * return NotImplemented + * + * def capacity(self): # <<<<<<<<<<<<<< + * ''' capacity() + * + */ + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_4list_9typedlist_25capacity, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_typedlist_capacity, NULL, __pyx_n_s_arrex_list, __pyx_d, ((PyObject *)__pyx_codeobj__39)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 393, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_4list_typedlist->tp_dict, __pyx_n_s_capacity, __pyx_t_3) < 0) __PYX_ERR(0, 393, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + PyType_Modified(__pyx_ptype_5arrex_4list_typedlist); + + /* "arrex/list.pyx":400 + * return self.allocated // self.dtype.dsize + * + * def shrink(self): # <<<<<<<<<<<<<< + * ''' shrink() + * + */ + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_4list_9typedlist_27shrink, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_typedlist_shrink, NULL, __pyx_n_s_arrex_list, __pyx_d, ((PyObject *)__pyx_codeobj__40)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 400, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_4list_typedlist->tp_dict, __pyx_n_s_shrink, __pyx_t_3) < 0) __PYX_ERR(0, 400, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + PyType_Modified(__pyx_ptype_5arrex_4list_typedlist); + + /* "arrex/list.pyx":539 + * return 0 == memcmp(self.ptr, o.ptr, self.size) + * + * def __copy__(self): # <<<<<<<<<<<<<< + * ''' shallow copy will create a copy of that array referencing the same buffer ''' + * return self[:] + */ + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_4list_9typedlist_43__copy__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_typedlist___copy, NULL, __pyx_n_s_arrex_list, __pyx_d, ((PyObject *)__pyx_codeobj__41)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 539, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_4list_typedlist->tp_dict, __pyx_n_s_copy, __pyx_t_3) < 0) __PYX_ERR(0, 539, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + PyType_Modified(__pyx_ptype_5arrex_4list_typedlist); + + /* "arrex/list.pyx":543 + * return self[:] + * + * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< + * ''' deep recursive copy, will duplicate the viewed data in the underlying buffer ''' + * return typedlist(PyBytes_FromStringAndSize(self.ptr, self.size), self.dtype) + */ + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_4list_9typedlist_45__deepcopy__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_typedlist___deepcopy, NULL, __pyx_n_s_arrex_list, __pyx_d, ((PyObject *)__pyx_codeobj__43)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 543, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_4list_typedlist->tp_dict, __pyx_n_s_deepcopy, __pyx_t_3) < 0) __PYX_ERR(0, 543, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + PyType_Modified(__pyx_ptype_5arrex_4list_typedlist); + + /* "arrex/list.pyx":547 + * return typedlist(PyBytes_FromStringAndSize(self.ptr, self.size), self.dtype) + * + * def __reduce_ex__(self, protocol): # <<<<<<<<<<<<<< + * ''' serialization protocol ''' + * cdef Py_buffer view + */ + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_4list_9typedlist_47__reduce_ex__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_typedlist___reduce_ex, NULL, __pyx_n_s_arrex_list, __pyx_d, ((PyObject *)__pyx_codeobj__45)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 547, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_4list_typedlist->tp_dict, __pyx_n_s_reduce_ex, __pyx_t_3) < 0) __PYX_ERR(0, 547, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + PyType_Modified(__pyx_ptype_5arrex_4list_typedlist); /* "arrex/list.pyx":571 * ) @@ -12101,22 +15830,101 @@ if (!__Pyx_RefNanny) { * def _rebuild(cls, owner, dtype, size_t start, size_t size): * new = typedlist(owner, dtype) */ - __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 571, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_4list_9typedlist_49_rebuild, __Pyx_CYFUNCTION_CLASSMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_typedlist__rebuild, NULL, __pyx_n_s_arrex_list, __pyx_d, ((PyObject *)__pyx_codeobj__47)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 571, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_4list_typedlist->tp_dict, __pyx_n_s_rebuild, __pyx_t_3) < 0) __PYX_ERR(0, 571, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + PyType_Modified(__pyx_ptype_5arrex_4list_typedlist); + __Pyx_GetNameInClass(__pyx_t_3, (PyObject *)__pyx_ptype_5arrex_4list_typedlist, __pyx_n_s_rebuild); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 571, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 571, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_4list_typedlist->tp_dict, __pyx_n_s_rebuild, __pyx_t_2) < 0) __PYX_ERR(0, 571, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_5arrex_4list_typedlist); + + /* "arrex/list.pyx":617 + * view.obj = None + * + * def reverse(self): # <<<<<<<<<<<<<< + * ''' reverse() + * + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_4list_9typedlist_55reverse, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_typedlist_reverse, NULL, __pyx_n_s_arrex_list, __pyx_d, ((PyObject *)__pyx_codeobj__49)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_4list_typedlist->tp_dict, __pyx_n_s_reverse, __pyx_t_2) < 0) __PYX_ERR(0, 617, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_5arrex_4list_typedlist); + + /* "arrex/list.pyx":638 + * PyMem_Free(temp) + * + * def index(self, value): # <<<<<<<<<<<<<< + * ''' index(value) + * + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_4list_9typedlist_57index, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_typedlist_index, NULL, __pyx_n_s_arrex_list, __pyx_d, ((PyObject *)__pyx_codeobj__51)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 638, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_4list_typedlist->tp_dict, __pyx_n_s_index, __pyx_t_2) < 0) __PYX_ERR(0, 638, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_4list_typedlist->tp_dict, __pyx_n_s_rebuild, __pyx_t_1) < 0) __PYX_ERR(0, 572, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_5arrex_4list_typedlist); + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_4list_12arrayexposer_1__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_arrayexposer___reduce_cython, NULL, __pyx_n_s_arrex_list, __pyx_d, ((PyObject *)__pyx_codeobj__53)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_4list_arrayexposer->tp_dict, __pyx_n_s_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_5arrex_4list_arrayexposer); + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_arrayexposer, (type(self), 0x5a3d340, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_arrayexposer__set_state(self, __pyx_state) + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_4list_12arrayexposer_3__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_arrayexposer___setstate_cython, NULL, __pyx_n_s_arrex_list, __pyx_d, ((PyObject *)__pyx_codeobj__55)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_4list_arrayexposer->tp_dict, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_5arrex_4list_arrayexposer); + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_4list_9arrayiter_7__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_arrayiter___reduce_cython, NULL, __pyx_n_s_arrex_list, __pyx_d, ((PyObject *)__pyx_codeobj__56)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_4list_arrayiter->tp_dict, __pyx_n_s_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_5arrex_4list_arrayiter); + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_arrayiter, (type(self), 0x75ae3e5, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_arrayiter__set_state(self, __pyx_state) + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_4list_9arrayiter_9__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_arrayiter___setstate_cython, NULL, __pyx_n_s_arrex_list, __pyx_d, ((PyObject *)__pyx_codeobj__57)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_4list_arrayiter->tp_dict, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_5arrex_4list_arrayiter); + /* "(tree fragment)":1 * def __pyx_unpickle_arrayexposer(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< * cdef object __pyx_PickleError * cdef object __pyx_result */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5arrex_4list_1__pyx_unpickle_arrayexposer, NULL, __pyx_n_s_arrex_list); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_arrayexposer, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_4list_1__pyx_unpickle_arrayexposer, 0, __pyx_n_s_pyx_unpickle_arrayexposer, NULL, __pyx_n_s_arrex_list, __pyx_d, ((PyObject *)__pyx_codeobj__59)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_arrayexposer, __pyx_t_2) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "(tree fragment)":11 * __pyx_unpickle_arrayexposer__set_state( __pyx_result, __pyx_state) @@ -12125,40 +15933,42 @@ if (!__Pyx_RefNanny) { * __pyx_result.owner = __pyx_state[0]; __pyx_result.shape = __pyx_state[1] * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5arrex_4list_3__pyx_unpickle_arrayiter, NULL, __pyx_n_s_arrex_list); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_arrayiter, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5arrex_4list_3__pyx_unpickle_arrayiter, 0, __pyx_n_s_pyx_unpickle_arrayiter, NULL, __pyx_n_s_arrex_list, __pyx_d, ((PyObject *)__pyx_codeobj__60)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_arrayiter, __pyx_t_2) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "arrex/list.pyx":1 * # cython: language_level=3, cdivision=True # <<<<<<<<<<<<<< * * cimport cython */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "carray.from_py":77 - * - * @cname("__Pyx_carray_from_py_Py_ssize_t") - * cdef int __Pyx_carray_from_py_Py_ssize_t(object o, base_type *v, Py_ssize_t length) except -1: # <<<<<<<<<<<<<< - * cdef Py_ssize_t i = length - * try: - */ + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /*--- Wrapped vars code ---*/ goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); if (__pyx_m) { - if (__pyx_d) { + if (__pyx_d && stringtab_initialized) { __Pyx_AddTraceback("init arrex.list", __pyx_clineno, __pyx_lineno, __pyx_filename); } + #if !CYTHON_USE_MODULE_STATE Py_CLEAR(__pyx_m); + #else + Py_DECREF(__pyx_m); + if (pystate_addmodule_run) { + PyObject *tp, *value, *tb; + PyErr_Fetch(&tp, &value, &tb); + PyState_RemoveModule(&__pyx_moduledef); + PyErr_Restore(tp, value, tb); + } + #endif } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init arrex.list"); } @@ -12172,6 +15982,22 @@ if (!__Pyx_RefNanny) { return; #endif } +/* #### Code section: cleanup_globals ### */ +/* #### Code section: cleanup_module ### */ +/* #### Code section: main_method ### */ +/* #### Code section: utility_code_pragmas ### */ +#ifdef _MSC_VER +#pragma warning( push ) +/* Warning 4127: conditional expression is constant + * Cython uses constant conditional expressions to allow in inline functions to be optimized at + * compile-time, so this warning is not useful + */ +#pragma warning( disable : 4127 ) +#endif + + + +/* #### Code section: utility_code_def ### */ /* --- Runtime support code --- */ /* Refnanny */ @@ -12191,6 +16017,106 @@ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { } #endif +/* PyErrExceptionMatches */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; i= 0x030C00A6 + PyObject *current_exception = tstate->current_exception; + if (unlikely(!current_exception)) return 0; + exc_type = (PyObject*) Py_TYPE(current_exception); + if (exc_type == err) return 1; +#else + exc_type = tstate->curexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; +#endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(exc_type); + #endif + if (unlikely(PyTuple_Check(err))) { + result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + } else { + result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(exc_type); + #endif + return result; +} +#endif + +/* PyErrFetchRestore */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject *tmp_value; + assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); + if (value) { + #if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) + #endif + PyException_SetTraceback(value, tb); + } + tmp_value = tstate->current_exception; + tstate->current_exception = value; + Py_XDECREF(tmp_value); +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + 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); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject* exc_value; + exc_value = tstate->current_exception; + tstate->current_exception = 0; + *value = exc_value; + *type = NULL; + *tb = NULL; + if (exc_value) { + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + #if CYTHON_COMPILING_IN_CPYTHON + *tb = ((PyBaseExceptionObject*) exc_value)->traceback; + Py_XINCREF(*tb); + #else + *tb = PyException_GetTraceback(exc_value); + #endif + } +#else + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#endif +} +#endif + /* PyObjectGetAttrStr */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { @@ -12204,1669 +16130,3708 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject return PyObject_GetAttr(obj, attr_name); } #endif - -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); - if (unlikely(!result)) { - PyErr_Format(PyExc_NameError, -#if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); + +/* PyObjectGetAttrStrNoError */ +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +} + +/* GetBuiltinName */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name); + if (unlikely(!result) && !PyErr_Occurred()) { + PyErr_Format(PyExc_NameError, +#if PY_MAJOR_VERSION >= 3 + "name '%U' is not defined", name); +#else + "name '%.200s' is not defined", PyString_AS_STRING(name)); +#endif + } + return result; +} + +/* GetTopmostException */ +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE +static _PyErr_StackItem * +__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) +{ + _PyErr_StackItem *exc_info = tstate->exc_info; + while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) && + exc_info->previous_item != NULL) + { + exc_info = exc_info->previous_item; + } + return exc_info; +} +#endif + +/* SaveResetException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + PyObject *exc_value = exc_info->exc_value; + if (exc_value == NULL || exc_value == Py_None) { + *value = NULL; + *type = NULL; + *tb = NULL; + } else { + *value = exc_value; + Py_INCREF(*value); + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + *tb = PyException_GetTraceback(exc_value); + } + #elif CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + *type = exc_info->exc_type; + *value = exc_info->exc_value; + *tb = exc_info->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #else + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #endif +} +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + PyObject *tmp_value = exc_info->exc_value; + exc_info->exc_value = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); + #else + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = type; + exc_info->exc_value = value; + exc_info->exc_traceback = tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); + #endif +} +#endif + +/* FastTypeChecks */ +#if CYTHON_COMPILING_IN_CPYTHON +static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { + while (a) { + a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); + if (a == b) + return 1; + } + return b == &PyBaseObject_Type; +} +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (a == b) return 1; + mro = a->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(a, b); +} +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (cls == a || cls == b) return 1; + mro = cls->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + PyObject *base = PyTuple_GET_ITEM(mro, i); + if (base == (PyObject *)a || base == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); +} +#if PY_MAJOR_VERSION == 2 +static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { + PyObject *exception, *value, *tb; + int res; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&exception, &value, &tb); + res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; + } + if (!res) { + res = PyObject_IsSubclass(err, exc_type2); + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; + } + } + __Pyx_ErrRestore(exception, value, tb); + return res; +} +#else +static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { + if (exc_type1) { + return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); + } else { + return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); + } +} +#endif +static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + assert(PyExceptionClass_Check(exc_type)); + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; iob_item, n); + return res; +} +static CYTHON_INLINE PyObject * +__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return PyList_New(0); + } + res = PyList_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); + return res; +} +#endif + +/* BytesEquals */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); +#else + if (s1 == s2) { + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + const char *ps1, *ps2; + Py_ssize_t length = PyBytes_GET_SIZE(s1); + if (length != PyBytes_GET_SIZE(s2)) + return (equals == Py_NE); + ps1 = PyBytes_AS_STRING(s1); + ps2 = PyBytes_AS_STRING(s2); + if (ps1[0] != ps2[0]) { + return (equals == Py_NE); + } else if (length == 1) { + return (equals == Py_EQ); + } else { + int result; +#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) + Py_hash_t hash1, hash2; + hash1 = ((PyBytesObject*)s1)->ob_shash; + hash2 = ((PyBytesObject*)s2)->ob_shash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + return (equals == Py_NE); + } +#endif + result = memcmp(ps1, ps2, (size_t)length); + 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; + } +#endif +} + +/* UnicodeEquals */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); +#else +#if PY_MAJOR_VERSION < 3 + PyObject* owned_ref = NULL; +#endif + int s1_is_unicode, s2_is_unicode; + if (s1 == s2) { + goto return_eq; + } + s1_is_unicode = PyUnicode_CheckExact(s1); + s2_is_unicode = PyUnicode_CheckExact(s2); +#if PY_MAJOR_VERSION < 3 + if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { + owned_ref = PyUnicode_FromObject(s2); + if (unlikely(!owned_ref)) + return -1; + s2 = owned_ref; + s2_is_unicode = 1; + } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { + owned_ref = PyUnicode_FromObject(s1); + if (unlikely(!owned_ref)) + return -1; + s1 = owned_ref; + s1_is_unicode = 1; + } else if (((!s2_is_unicode) & (!s1_is_unicode))) { + return __Pyx_PyBytes_Equals(s1, s2, equals); + } +#endif + if (s1_is_unicode & s2_is_unicode) { + Py_ssize_t length; + int kind; + void *data1, *data2; + if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) + return -1; + length = __Pyx_PyUnicode_GET_LENGTH(s1); + if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { + goto return_ne; + } +#if CYTHON_USE_UNICODE_INTERNALS + { + Py_hash_t hash1, hash2; + #if CYTHON_PEP393_ENABLED + hash1 = ((PyASCIIObject*)s1)->hash; + hash2 = ((PyASCIIObject*)s2)->hash; + #else + hash1 = ((PyUnicodeObject*)s1)->hash; + hash2 = ((PyUnicodeObject*)s2)->hash; + #endif + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + goto return_ne; + } + } +#endif + kind = __Pyx_PyUnicode_KIND(s1); + if (kind != __Pyx_PyUnicode_KIND(s2)) { + goto return_ne; + } + data1 = __Pyx_PyUnicode_DATA(s1); + data2 = __Pyx_PyUnicode_DATA(s2); + if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { + goto return_ne; + } else if (length == 1) { + goto return_eq; + } else { + int result = memcmp(data1, data2, (size_t)(length * kind)); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & s2_is_unicode) { + goto return_ne; + } else if ((s2 == Py_None) & s1_is_unicode) { + goto return_ne; + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +return_eq: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ); +return_ne: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_NE); +#endif +} + +/* fastcall */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) +{ + Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames); + for (i = 0; i < n; i++) + { + if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i]; + } + for (i = 0; i < n; i++) + { + int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ); + if (unlikely(eq != 0)) { + if (unlikely(eq < 0)) return NULL; // error + return kwvalues[i]; + } + } + return NULL; // not found (no exception set) +} +#endif + +/* RaiseDoubleKeywords */ +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_AsString(kw_name)); + #endif +} + +/* ParseKeywords */ +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject *const *kwvalues, + 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; + int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)); + while (1) { + if (kwds_is_tuple) { + if (pos >= PyTuple_GET_SIZE(kwds)) break; + key = PyTuple_GET_ITEM(kwds, pos); + value = kwvalues[pos]; + pos++; + } + else + { + if (!PyDict_Next(kwds, &pos, &key, &value)) break; + } + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = ( + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key) + ); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + #if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_TypeError, + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +/* RaiseArgTupleInvalid */ +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, + "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +/* GetAttr */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { +#if CYTHON_USE_TYPE_SLOTS +#if PY_MAJOR_VERSION >= 3 + if (likely(PyUnicode_Check(n))) +#else + if (likely(PyString_Check(n))) +#endif + return __Pyx_PyObject_GetAttrStr(o, n); +#endif + return PyObject_GetAttr(o, n); +} + +/* HasAttr */ +static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { + PyObject *r; + if (unlikely(!__Pyx_PyBaseString_Check(n))) { + PyErr_SetString(PyExc_TypeError, + "hasattr(): attribute name must be string"); + return -1; + } + r = __Pyx_GetAttr(o, n); + if (!r) { + PyErr_Clear(); + return 0; + } else { + Py_DECREF(r); + return 1; + } +} + +/* IterNext */ +static PyObject *__Pyx_PyIter_Next2Default(PyObject* defval) { + PyObject* exc_type; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + exc_type = __Pyx_PyErr_CurrentExceptionType(); + if (unlikely(exc_type)) { + if (!defval || unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) + return NULL; + __Pyx_PyErr_Clear(); + Py_INCREF(defval); + return defval; + } + if (defval) { + Py_INCREF(defval); + return defval; + } + __Pyx_PyErr_SetNone(PyExc_StopIteration); + return NULL; +} +static void __Pyx_PyIter_Next_ErrorNoIterator(PyObject *iterator) { + __Pyx_TypeName iterator_type_name = __Pyx_PyType_GetName(Py_TYPE(iterator)); + PyErr_Format(PyExc_TypeError, + __Pyx_FMT_TYPENAME " object is not an iterator", iterator_type_name); + __Pyx_DECREF_TypeName(iterator_type_name); +} +static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) { + PyObject* next; + iternextfunc iternext = Py_TYPE(iterator)->tp_iternext; + if (likely(iternext)) { +#if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY + next = iternext(iterator); + if (likely(next)) + return next; +#if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(iternext == &_PyObject_NextNotImplemented)) + return NULL; +#endif +#else + next = PyIter_Next(iterator); + if (likely(next)) + return next; +#endif + } else if (CYTHON_USE_TYPE_SLOTS || unlikely(!PyIter_Check(iterator))) { + __Pyx_PyIter_Next_ErrorNoIterator(iterator); + return NULL; + } +#if !CYTHON_USE_TYPE_SLOTS + else { + next = PyIter_Next(iterator); + if (likely(next)) + return next; + } +#endif + return __Pyx_PyIter_Next2Default(defval); +} + +/* PyObjectCall */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *result; + ternaryfunc call = Py_TYPE(func)->tp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = (*call)(func, arg, kw); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* RaiseException */ +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + __Pyx_PyThreadState_declare + CYTHON_UNUSED_VAR(cause); + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + } + if (PyType_Check(type)) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; + 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; + } + } + __Pyx_PyThreadState_assign + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} +#else +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + 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)) { + PyObject *instance_class = NULL; + if (value && PyExceptionInstance_Check(value)) { + instance_class = (PyObject*) Py_TYPE(value); + if (instance_class != type) { + int is_subclass = PyObject_IsSubclass(instance_class, type); + if (!is_subclass) { + instance_class = NULL; + } else if (unlikely(is_subclass == -1)) { + goto bad; + } else { + type = instance_class; + } + } + } + if (!instance_class) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyObject_Call(type, args, NULL); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + if (cause) { + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else 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; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { + #if PY_VERSION_HEX >= 0x030C00A6 + PyException_SetTraceback(value, tb); + #elif CYTHON_FAST_THREAD_STATE + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); + Py_INCREF(tb); + PyErr_Restore(tmp_type, tmp_value, tb); + Py_XDECREF(tmp_tb); +#endif + } +bad: + Py_XDECREF(owned_instance); + return; +} +#endif + +/* GetException */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) +#else +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) +#endif +{ + PyObject *local_type = NULL, *local_value, *local_tb = NULL; +#if CYTHON_FAST_THREAD_STATE + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if PY_VERSION_HEX >= 0x030C00A6 + local_value = tstate->current_exception; + tstate->current_exception = 0; + if (likely(local_value)) { + local_type = (PyObject*) Py_TYPE(local_value); + Py_INCREF(local_type); + local_tb = PyException_GetTraceback(local_value); + } + #else + local_type = tstate->curexc_type; + local_value = tstate->curexc_value; + local_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + #endif +#else + PyErr_Fetch(&local_type, &local_value, &local_tb); +#endif + PyErr_NormalizeException(&local_type, &local_value, &local_tb); +#if CYTHON_FAST_THREAD_STATE && PY_VERSION_HEX >= 0x030C00A6 + if (unlikely(tstate->current_exception)) +#elif CYTHON_FAST_THREAD_STATE + if (unlikely(tstate->curexc_type)) +#else + if (unlikely(PyErr_Occurred())) +#endif + goto bad; + #if PY_MAJOR_VERSION >= 3 + if (local_tb) { + if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) + goto bad; + } + #endif + Py_XINCREF(local_tb); + Py_XINCREF(local_type); + Py_XINCREF(local_value); + *type = local_type; + *value = local_value; + *tb = local_tb; +#if CYTHON_FAST_THREAD_STATE + #if CYTHON_USE_EXC_INFO_STACK + { + _PyErr_StackItem *exc_info = tstate->exc_info; + #if PY_VERSION_HEX >= 0x030B00a4 + tmp_value = exc_info->exc_value; + exc_info->exc_value = local_value; + tmp_type = NULL; + tmp_tb = NULL; + Py_XDECREF(local_type); + Py_XDECREF(local_tb); + #else + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = local_type; + exc_info->exc_value = local_value; + exc_info->exc_traceback = local_tb; + #endif + } + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = local_type; + tstate->exc_value = local_value; + tstate->exc_traceback = local_tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_SetExcInfo(local_type, local_value, local_tb); +#endif + return 0; +bad: + *type = 0; + *value = 0; + *tb = 0; + Py_XDECREF(local_type); + Py_XDECREF(local_value); + Py_XDECREF(local_tb); + return -1; +} + +/* PyDictVersioning */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { +#if CYTHON_COMPILING_IN_CPYTHON + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); +#endif + } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; +} +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); +} +#endif + +/* PyFunctionFastCall */ +#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL +static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, + PyObject *globals) { + PyFrameObject *f; + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject **fastlocals; + Py_ssize_t i; + PyObject *result; + assert(globals != NULL); + /* XXX Perhaps we should create a specialized + PyFrame_New() that doesn't take locals, but does + take builtins without sanity checking them. + */ + assert(tstate != NULL); + f = PyFrame_New(tstate, co, globals, NULL); + if (f == NULL) { + return NULL; + } + fastlocals = __Pyx_PyFrame_GetLocalsplus(f); + for (i = 0; i < na; i++) { + Py_INCREF(*args); + fastlocals[i] = *args++; + } + result = PyEval_EvalFrameEx(f,0); + ++tstate->recursion_depth; + Py_DECREF(f); + --tstate->recursion_depth; + return result; +} +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { + PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); + PyObject *globals = PyFunction_GET_GLOBALS(func); + PyObject *argdefs = PyFunction_GET_DEFAULTS(func); + PyObject *closure; +#if PY_MAJOR_VERSION >= 3 + PyObject *kwdefs; +#endif + PyObject *kwtuple, **k; + PyObject **d; + Py_ssize_t nd; + Py_ssize_t nk; + PyObject *result; + assert(kwargs == NULL || PyDict_Check(kwargs)); + nk = kwargs ? PyDict_Size(kwargs) : 0; + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) { + return NULL; + } + if ( +#if PY_MAJOR_VERSION >= 3 + co->co_kwonlyargcount == 0 && +#endif + likely(kwargs == NULL || nk == 0) && + co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { + if (argdefs == NULL && co->co_argcount == nargs) { + result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); + goto done; + } + else if (nargs == 0 && argdefs != NULL + && co->co_argcount == Py_SIZE(argdefs)) { + /* function called with no arguments, but all parameters have + a default value: use default values as arguments .*/ + args = &PyTuple_GET_ITEM(argdefs, 0); + result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); + goto done; + } + } + if (kwargs != NULL) { + Py_ssize_t pos, i; + kwtuple = PyTuple_New(2 * nk); + if (kwtuple == NULL) { + result = NULL; + goto done; + } + k = &PyTuple_GET_ITEM(kwtuple, 0); + pos = i = 0; + while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { + Py_INCREF(k[i]); + Py_INCREF(k[i+1]); + i += 2; + } + nk = i / 2; + } + else { + kwtuple = NULL; + k = NULL; + } + closure = PyFunction_GET_CLOSURE(func); +#if PY_MAJOR_VERSION >= 3 + kwdefs = PyFunction_GET_KW_DEFAULTS(func); +#endif + if (argdefs != NULL) { + d = &PyTuple_GET_ITEM(argdefs, 0); + nd = Py_SIZE(argdefs); + } + else { + d = NULL; + nd = 0; + } +#if PY_MAJOR_VERSION >= 3 + result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, + args, (int)nargs, + k, (int)nk, + d, (int)nd, kwdefs, closure); +#else + result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, + args, (int)nargs, + k, (int)nk, + d, (int)nd, closure); +#endif + Py_XDECREF(kwtuple); +done: + Py_LeaveRecursiveCall(); + return result; +} +#endif + +/* PyObjectCallMethO */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = PyCFunction_GET_FUNCTION(func); + self = PyCFunction_GET_SELF(func); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectFastCall */ +static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) { + PyObject *argstuple; + PyObject *result; + size_t i; + argstuple = PyTuple_New((Py_ssize_t)nargs); + if (unlikely(!argstuple)) return NULL; + for (i = 0; i < nargs; i++) { + Py_INCREF(args[i]); + PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]); + } + result = __Pyx_PyObject_Call(func, argstuple, kwargs); + Py_DECREF(argstuple); + return result; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) { + Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); +#if CYTHON_COMPILING_IN_CPYTHON + if (nargs == 0 && kwargs == NULL) { +#if defined(__Pyx_CyFunction_USED) && defined(NDEBUG) + if (__Pyx_IsCyOrPyCFunction(func)) +#else + if (PyCFunction_Check(func)) +#endif + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { + return __Pyx_PyObject_CallMethO(func, NULL); + } + } + } + else if (nargs == 1 && kwargs == NULL) { + if (PyCFunction_Check(func)) + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, args[0]); + } + } + } +#endif + #if PY_VERSION_HEX < 0x030800B1 + #if CYTHON_FAST_PYCCALL + if (PyCFunction_Check(func)) { + if (kwargs) { + return _PyCFunction_FastCallDict(func, args, nargs, kwargs); + } else { + return _PyCFunction_FastCallKeywords(func, args, nargs, NULL); + } + } + #if PY_VERSION_HEX >= 0x030700A1 + if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) { + return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL); + } + #endif + #endif + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs); + } + #endif + #endif + #if CYTHON_VECTORCALL + vectorcallfunc f = _PyVectorcall_Function(func); + if (f) { + return f(func, args, (size_t)nargs, kwargs); + } + #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL + if (__Pyx_CyFunction_CheckExact(func)) { + __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func); + if (f) return f(func, args, (size_t)nargs, kwargs); + } + #endif + if (nargs == 0) { + return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs); + } + return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); +} + +/* KeywordStringCheck */ +static int __Pyx_CheckKeywordStrings( + PyObject *kw, + const char* function_name, + int kw_allowed) +{ + PyObject* key = 0; + Py_ssize_t pos = 0; +#if CYTHON_COMPILING_IN_PYPY + if (!kw_allowed && PyDict_Next(kw, &pos, &key, 0)) + goto invalid_keyword; + return 1; +#else + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) { + if (unlikely(PyTuple_GET_SIZE(kw) == 0)) + return 1; + if (!kw_allowed) { + key = PyTuple_GET_ITEM(kw, 0); + goto invalid_keyword; + } +#if PY_VERSION_HEX < 0x03090000 + for (pos = 0; pos < PyTuple_GET_SIZE(kw); pos++) { + key = PyTuple_GET_ITEM(kw, pos); + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; + } +#endif + return 1; + } + while (PyDict_Next(kw, &pos, &key, 0)) { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_Check(key))) + #endif + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; + } + if (!kw_allowed && unlikely(key)) + goto invalid_keyword; + return 1; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + return 0; +#endif +invalid_keyword: + #if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_TypeError, + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif + return 0; +} + +/* PyObjectCallOneArg */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *args[2] = {NULL, arg}; + return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* PyIntBinop */ +#if !CYTHON_COMPILING_IN_PYPY +static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_MAYBE_UNUSED_VAR(inplace); + CYTHON_UNUSED_VAR(zerodivision_check); + #if PY_MAJOR_VERSION < 3 + if (likely(PyInt_CheckExact(op1))) { + const long b = intval; + long x; + long a = PyInt_AS_LONG(op1); + + x = (long)((unsigned long)a + (unsigned long)b); + if (likely((x^a) >= 0 || (x^b) >= 0)) + return PyInt_FromLong(x); + return PyLong_Type.tp_as_number->nb_add(op1, op2); + } + #endif + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(PyLong_CheckExact(op1))) { + const long b = intval; + long a, x; +#ifdef HAVE_LONG_LONG + const PY_LONG_LONG llb = intval; + PY_LONG_LONG lla, llx; +#endif + if (unlikely(__Pyx_PyLong_IsZero(op1))) { + return __Pyx_NewRef(op2); + } + if (likely(__Pyx_PyLong_IsCompact(op1))) { + a = __Pyx_PyLong_CompactValue(op1); + } else { + const digit* digits = __Pyx_PyLong_Digits(op1); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1); + switch (size) { + case -2: + if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { + lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif + } + CYTHON_FALLTHROUGH; + case 2: + if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { + lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif + } + CYTHON_FALLTHROUGH; + case -3: + if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { + lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif + } + CYTHON_FALLTHROUGH; + case 3: + if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { + lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif + } + CYTHON_FALLTHROUGH; + case -4: + if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { + a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { + lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif + } + CYTHON_FALLTHROUGH; + case 4: + if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { + a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { + lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif + } + CYTHON_FALLTHROUGH; + default: return PyLong_Type.tp_as_number->nb_add(op1, op2); + } + } + x = a + b; + return PyLong_FromLong(x); +#ifdef HAVE_LONG_LONG + long_long: + llx = lla + llb; + return PyLong_FromLongLong(llx); +#endif + + + } + #endif + if (PyFloat_CheckExact(op1)) { + const long b = intval; +#if CYTHON_COMPILING_IN_LIMITED_API + double a = __pyx_PyFloat_AsDouble(op1); #else - "name '%.200s' is not defined", PyString_AS_STRING(name)); + double a = PyFloat_AS_DOUBLE(op1); #endif + double result; + + PyFPE_START_PROTECT("add", return NULL) + result = ((double)a) + (double)b; + PyFPE_END_PROTECT(result) + return PyFloat_FromDouble(result); } - return result; + return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2); } +#endif -/* RaiseDoubleKeywords */ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ +/* ExtTypeTest */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + __Pyx_TypeName obj_type_name; + __Pyx_TypeName type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(__Pyx_TypeCheck(obj, type))) + return 1; + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + type_name = __Pyx_PyType_GetName(type); 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_AsString(kw_name)); - #endif + "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME, + obj_type_name, type_name); + __Pyx_DECREF_TypeName(obj_type_name); + __Pyx_DECREF_TypeName(type_name); + return 0; } -/* ParseKeywords */ -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; - continue; +/* SliceObject */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj, + Py_ssize_t cstart, Py_ssize_t cstop, + PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, + int has_cstart, int has_cstop, int wraparound) { + __Pyx_TypeName obj_type_name; +#if CYTHON_USE_TYPE_SLOTS + PyMappingMethods* mp; +#if PY_MAJOR_VERSION < 3 + PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence; + if (likely(ms && ms->sq_slice)) { + if (!has_cstart) { + if (_py_start && (*_py_start != Py_None)) { + cstart = __Pyx_PyIndex_AsSsize_t(*_py_start); + if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; + } else + cstart = 0; } - name = first_kw_arg; - #if PY_MAJOR_VERSION < 3 - if (likely(PyString_Check(key))) { - while (*name) { - if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) - && _PyString_Eq(**name, key)) { - values[name-argnames] = value; - break; + if (!has_cstop) { + if (_py_stop && (*_py_stop != Py_None)) { + cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop); + if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; + } else + cstop = PY_SSIZE_T_MAX; + } + if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) { + Py_ssize_t l = ms->sq_length(obj); + if (likely(l >= 0)) { + if (cstop < 0) { + cstop += l; + if (cstop < 0) cstop = 0; } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - if ((**argname == key) || ( - (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) - && _PyString_Eq(**argname, key))) { - goto arg_passed_twice; - } - argname++; + if (cstart < 0) { + cstart += l; + if (cstart < 0) cstart = 0; } + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + goto bad; + PyErr_Clear(); } - } else - #endif - if (likely(PyUnicode_Check(key))) { - while (*name) { - int cmp = (**name == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : - #endif - PyUnicode_Compare(**name, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) { - values[name-argnames] = value; - break; - } - name++; + } + return ms->sq_slice(obj, cstart, cstop); + } +#else + CYTHON_UNUSED_VAR(wraparound); +#endif + mp = Py_TYPE(obj)->tp_as_mapping; + if (likely(mp && mp->mp_subscript)) +#else + CYTHON_UNUSED_VAR(wraparound); +#endif + { + PyObject* result; + PyObject *py_slice, *py_start, *py_stop; + if (_py_slice) { + py_slice = *_py_slice; + } else { + PyObject* owned_start = NULL; + PyObject* owned_stop = NULL; + if (_py_start) { + py_start = *_py_start; + } else { + if (has_cstart) { + owned_start = py_start = PyInt_FromSsize_t(cstart); + if (unlikely(!py_start)) goto bad; + } else + py_start = Py_None; } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - int cmp = (**argname == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : - #endif - PyUnicode_Compare(**argname, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) goto arg_passed_twice; - argname++; - } + if (_py_stop) { + py_stop = *_py_stop; + } else { + if (has_cstop) { + owned_stop = py_stop = PyInt_FromSsize_t(cstop); + if (unlikely(!py_stop)) { + Py_XDECREF(owned_start); + goto bad; + } + } else + py_stop = Py_None; } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; + py_slice = PySlice_New(py_start, py_stop, Py_None); + Py_XDECREF(owned_start); + Py_XDECREF(owned_stop); + if (unlikely(!py_slice)) goto bad; + } +#if CYTHON_USE_TYPE_SLOTS + result = mp->mp_subscript(obj, py_slice); +#else + result = PyObject_GetItem(obj, py_slice); +#endif + if (!_py_slice) { + Py_DECREF(py_slice); } + return result; } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - goto bad; -invalid_keyword: + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif + "'" __Pyx_FMT_TYPENAME "' object is unsliceable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); bad: - return -1; -} - -/* RaiseArgTupleInvalid */ -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, - "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); + return NULL; } -/* GetAttr */ -static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { -#if CYTHON_USE_TYPE_SLOTS -#if PY_MAJOR_VERSION >= 3 - if (likely(PyUnicode_Check(n))) +/* GetModuleGlobalName */ +#if CYTHON_USE_DICT_VERSIONS +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) #else - if (likely(PyString_Check(n))) -#endif - return __Pyx_PyObject_GetAttrStr(o, n); +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) #endif - return PyObject_GetAttr(o, n); -} - -/* HasAttr */ -static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { - PyObject *r; - if (unlikely(!__Pyx_PyBaseString_Check(n))) { - PyErr_SetString(PyExc_TypeError, - "hasattr(): attribute name must be string"); - return -1; - } - r = __Pyx_GetAttr(o, n); - if (unlikely(!r)) { - PyErr_Clear(); - return 0; - } else { - Py_DECREF(r); - return 1; +{ + PyObject *result; +#if !CYTHON_AVOID_BORROWED_REFS +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 + result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } else if (unlikely(PyErr_Occurred())) { + return NULL; } -} - -/* PyErrFetchRestore */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - 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_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} -#endif - -/* IterNext */ -static PyObject *__Pyx_PyIter_Next2Default(PyObject* defval) { - PyObject* exc_type; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - exc_type = __Pyx_PyErr_Occurred(); - if (unlikely(exc_type)) { - if (!defval || unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) - return NULL; - __Pyx_PyErr_Clear(); - Py_INCREF(defval); - return defval; +#elif CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!__pyx_m)) { + return NULL; } - if (defval) { - Py_INCREF(defval); - return defval; + result = PyObject_GetAttr(__pyx_m, name); + if (likely(result)) { + return result; } - __Pyx_PyErr_SetNone(PyExc_StopIteration); - return NULL; -} -static void __Pyx_PyIter_Next_ErrorNoIterator(PyObject *iterator) { - PyErr_Format(PyExc_TypeError, - "%.200s object is not an iterator", Py_TYPE(iterator)->tp_name); -} -static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) { - PyObject* next; - iternextfunc iternext = Py_TYPE(iterator)->tp_iternext; - if (likely(iternext)) { -#if CYTHON_USE_TYPE_SLOTS - next = iternext(iterator); - if (likely(next)) - return next; - #if PY_VERSION_HEX >= 0x02070000 - if (unlikely(iternext == &_PyObject_NextNotImplemented)) - return NULL; - #endif #else - next = PyIter_Next(iterator); - if (likely(next)) - return next; -#endif - } else if (CYTHON_USE_TYPE_SLOTS || unlikely(!PyIter_Check(iterator))) { - __Pyx_PyIter_Next_ErrorNoIterator(iterator); - return NULL; - } -#if !CYTHON_USE_TYPE_SLOTS - else { - next = PyIter_Next(iterator); - if (likely(next)) - return next; + result = PyDict_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); } #endif - return __Pyx_PyIter_Next2Default(defval); -} - -/* PyObjectCall */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = Py_TYPE(func)->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); +#else + result = PyObject_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); } - return result; -} + PyErr_Clear(); #endif + return __Pyx_GetBuiltinName(name); +} -/* RaiseException */ -#if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, - CYTHON_UNUSED PyObject *cause) { +/* WriteUnraisableException */ +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename, + int full_traceback, int nogil) { + PyObject *old_exc, *old_val, *old_tb; + PyObject *ctx; __Pyx_PyThreadState_declare - Py_XINCREF(type); - if (!value || value == Py_None) - value = NULL; - else - Py_INCREF(value); - if (!tb || tb == Py_None) - tb = NULL; - else { - Py_INCREF(tb); - if (!PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - } - if (PyType_Check(type)) { -#if CYTHON_COMPILING_IN_PYPY - if (!value) { - Py_INCREF(Py_None); - value = Py_None; - } +#ifdef WITH_THREAD + PyGILState_STATE state; + if (nogil) + state = PyGILState_Ensure(); + else state = (PyGILState_STATE)0; #endif - PyErr_NormalizeException(&type, &value, &tb); + CYTHON_UNUSED_VAR(clineno); + CYTHON_UNUSED_VAR(lineno); + CYTHON_UNUSED_VAR(filename); + CYTHON_MAYBE_UNUSED_VAR(nogil); + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + if (full_traceback) { + Py_XINCREF(old_exc); + Py_XINCREF(old_val); + Py_XINCREF(old_tb); + __Pyx_ErrRestore(old_exc, old_val, old_tb); + PyErr_PrintEx(1); + } + #if PY_MAJOR_VERSION < 3 + ctx = PyString_FromString(name); + #else + ctx = PyUnicode_FromString(name); + #endif + __Pyx_ErrRestore(old_exc, old_val, old_tb); + if (!ctx) { + PyErr_WriteUnraisable(Py_None); } else { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; - } - value = type; - 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; + PyErr_WriteUnraisable(ctx); + Py_DECREF(ctx); + } +#ifdef WITH_THREAD + if (nogil) + PyGILState_Release(state); +#endif +} + +/* GetAttr3 */ +static PyObject *__Pyx_GetAttr3Default(PyObject *d) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + return NULL; + __Pyx_PyErr_Clear(); + Py_INCREF(d); + return d; +} +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { + PyObject *r; +#if CYTHON_USE_TYPE_SLOTS + if (likely(PyString_Check(n))) { + r = __Pyx_PyObject_GetAttrStrNoError(o, n); + if (unlikely(!r) && likely(!PyErr_Occurred())) { + r = __Pyx_NewRef(d); } + return r; } - __Pyx_PyThreadState_assign - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; +#endif + r = PyObject_GetAttr(o, n); + return (likely(r)) ? r : __Pyx_GetAttr3Default(d); } -#else -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - PyObject* owned_instance = NULL; - 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"); + +/* RaiseUnexpectedTypeError */ +static int +__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) +{ + __Pyx_TypeName obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, + expected, obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* Import */ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + PyObject *module = 0; + PyObject *empty_dict = 0; + PyObject *empty_list = 0; + #if PY_MAJOR_VERSION < 3 + PyObject *py_import; + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); + if (unlikely(!py_import)) 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"); + if (!from_list) { + empty_list = PyList_New(0); + if (unlikely(!empty_list)) goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (PyExceptionClass_Check(type)) { - PyObject *instance_class = NULL; - if (value && PyExceptionInstance_Check(value)) { - instance_class = (PyObject*) Py_TYPE(value); - if (instance_class != type) { - int is_subclass = PyObject_IsSubclass(instance_class, type); - if (!is_subclass) { - instance_class = NULL; - } else if (unlikely(is_subclass == -1)) { - goto bad; - } else { - type = instance_class; + from_list = empty_list; + } + #endif + empty_dict = PyDict_New(); + if (unlikely(!empty_dict)) + goto bad; + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { + #if CYTHON_COMPILING_IN_LIMITED_API + module = PyImport_ImportModuleLevelObject( + name, empty_dict, empty_dict, from_list, 1); + #else + module = PyImport_ImportModuleLevelObject( + name, __pyx_d, empty_dict, from_list, 1); + #endif + if (unlikely(!module)) { + if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError))) + goto bad; + PyErr_Clear(); } } + level = 0; } - if (!instance_class) { - PyObject *args; - if (!value) - args = PyTuple_New(0); - else if (PyTuple_Check(value)) { - Py_INCREF(value); - args = value; - } else - args = PyTuple_Pack(1, value); - if (!args) - goto bad; - owned_instance = PyObject_Call(type, args, NULL); - Py_DECREF(args); - if (!owned_instance) - goto bad; - value = owned_instance; - if (!PyExceptionInstance_Check(value)) { - PyErr_Format(PyExc_TypeError, - "calling %R should have returned an instance of " - "BaseException, not %R", - type, Py_TYPE(value)); - goto bad; - } - } - } else { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } - if (cause) { - PyObject *fixed_cause; - if (cause == Py_None) { - fixed_cause = NULL; - } else if (PyExceptionClass_Check(cause)) { - fixed_cause = PyObject_CallObject(cause, NULL); - if (fixed_cause == NULL) + #endif + if (!module) { + #if PY_MAJOR_VERSION < 3 + PyObject *py_level = PyInt_FromLong(level); + if (unlikely(!py_level)) 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; - } - PyException_SetCause(value, fixed_cause); - } - PyErr_SetObject(type, value); - if (tb) { -#if CYTHON_COMPILING_IN_PYPY - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); - Py_INCREF(tb); - PyErr_Restore(tmp_type, tmp_value, tb); - Py_XDECREF(tmp_tb); -#else - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); + module = PyObject_CallFunctionObjArgs(py_import, + name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL); + Py_DECREF(py_level); + #else + #if CYTHON_COMPILING_IN_LIMITED_API + module = PyImport_ImportModuleLevelObject( + name, empty_dict, empty_dict, from_list, level); + #else + module = PyImport_ImportModuleLevelObject( + name, __pyx_d, empty_dict, from_list, level); + #endif + #endif } -#endif } bad: - Py_XDECREF(owned_instance); - return; + Py_XDECREF(empty_dict); + Py_XDECREF(empty_list); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_import); + #endif + return module; } -#endif -/* GetTopmostException */ -#if CYTHON_USE_EXC_INFO_STACK -static _PyErr_StackItem * -__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) -{ - _PyErr_StackItem *exc_info = tstate->exc_info; - while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) && - exc_info->previous_item != NULL) - { - exc_info = exc_info->previous_item; +/* ImportFrom */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { + PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); + if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + const char* module_name_str = 0; + PyObject* module_name = 0; + PyObject* module_dot = 0; + PyObject* full_name = 0; + PyErr_Clear(); + module_name_str = PyModule_GetName(module); + if (unlikely(!module_name_str)) { goto modbad; } + module_name = PyUnicode_FromString(module_name_str); + if (unlikely(!module_name)) { goto modbad; } + module_dot = PyUnicode_Concat(module_name, __pyx_kp_u__19); + if (unlikely(!module_dot)) { goto modbad; } + full_name = PyUnicode_Concat(module_dot, name); + if (unlikely(!full_name)) { goto modbad; } + #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) + { + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + goto modbad; + value = PyObject_GetItem(modules, full_name); + } + #else + value = PyImport_GetModule(full_name); + #endif + modbad: + Py_XDECREF(full_name); + Py_XDECREF(module_dot); + Py_XDECREF(module_name); } - return exc_info; + if (unlikely(!value)) { + PyErr_Format(PyExc_ImportError, + #if PY_MAJOR_VERSION < 3 + "cannot import name %.230s", PyString_AS_STRING(name)); + #else + "cannot import name %S", name); + #endif + } + return value; } -#endif -/* SaveResetException */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - #if CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); - *type = exc_info->exc_type; - *value = exc_info->exc_value; - *tb = exc_info->exc_traceback; - #else - *type = tstate->exc_type; - *value = tstate->exc_value; - *tb = tstate->exc_traceback; - #endif - Py_XINCREF(*type); - Py_XINCREF(*value); - Py_XINCREF(*tb); -} -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - #if CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = type; - exc_info->exc_value = value; - exc_info->exc_traceback = tb; - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = type; - tstate->exc_value = value; - tstate->exc_traceback = tb; - #endif - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); +/* GetItemInt */ +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (unlikely(!j)) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; } -#endif - -/* PyErrExceptionMatches */ -#if CYTHON_FAST_THREAD_STATE -static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; icurexc_type; - if (exc_type == err) return 1; - if (unlikely(!exc_type)) return 0; - if (unlikely(PyTuple_Check(err))) - return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); - return __Pyx_PyErr_GivenExceptionMatches(exc_type, err); -} -#endif - -/* GetException */ -#if CYTHON_FAST_THREAD_STATE -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) -#else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) -#endif -{ - PyObject *local_type, *local_value, *local_tb; -#if CYTHON_FAST_THREAD_STATE - PyObject *tmp_type, *tmp_value, *tmp_tb; - local_type = tstate->curexc_type; - local_value = tstate->curexc_value; - local_tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); #else - PyErr_Fetch(&local_type, &local_value, &local_tb); + return PySequence_GetItem(o, i); #endif - PyErr_NormalizeException(&local_type, &local_value, &local_tb); -#if CYTHON_FAST_THREAD_STATE - if (unlikely(tstate->curexc_type)) +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyTuple_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); #else - if (unlikely(PyErr_Occurred())) + return PySequence_GetItem(o, i); #endif - goto bad; - #if PY_MAJOR_VERSION >= 3 - if (local_tb) { - if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) - goto bad; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } } - #endif - Py_XINCREF(local_tb); - Py_XINCREF(local_type); - Py_XINCREF(local_value); - *type = local_type; - *value = local_value; - *tb = local_tb; -#if CYTHON_FAST_THREAD_STATE - #if CYTHON_USE_EXC_INFO_STACK - { - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = local_type; - exc_info->exc_value = local_value; - exc_info->exc_traceback = local_tb; + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } else { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (mm && mm->mp_subscript) { + PyObject *r, *key = PyInt_FromSsize_t(i); + if (unlikely(!key)) return NULL; + r = mm->mp_subscript(o, key); + Py_DECREF(key); + return r; + } + if (likely(sm && sm->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); + } + } + return sm->sq_item(o, i); + } } - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = local_type; - tstate->exc_value = local_value; - tstate->exc_traceback = local_tb; - #endif - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); #else - PyErr_SetExcInfo(local_type, local_value, local_tb); + if (is_list || PySequence_Check(o)) { + return PySequence_GetItem(o, i); + } #endif - return 0; -bad: - *type = 0; - *value = 0; - *tb = 0; - Py_XDECREF(local_type); - Py_XDECREF(local_value); - Py_XDECREF(local_tb); - return -1; + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } -/* PyDictVersioning */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { - PyObject **dictptr = NULL; - Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; - if (offset) { -#if CYTHON_COMPILING_IN_CPYTHON - dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +/* FixUpExtensionType */ +#if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { +#if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + CYTHON_UNUSED_VAR(spec); + CYTHON_UNUSED_VAR(type); #else - dictptr = _PyObject_GetDictPtr(obj); + const PyType_Slot *slot = spec->slots; + while (slot && slot->slot && slot->slot != Py_tp_members) + slot++; + if (slot && slot->slot == Py_tp_members) { + int changed = 0; +#if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON) + const +#endif + PyMemberDef *memb = (PyMemberDef*) slot->pfunc; + while (memb && memb->name) { + if (memb->name[0] == '_' && memb->name[1] == '_') { +#if PY_VERSION_HEX < 0x030900b1 + if (strcmp(memb->name, "__weaklistoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_weaklistoffset = memb->offset; + changed = 1; + } + else if (strcmp(memb->name, "__dictoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_dictoffset = memb->offset; + changed = 1; + } +#if CYTHON_METH_FASTCALL + else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); +#if PY_VERSION_HEX >= 0x030800b4 + type->tp_vectorcall_offset = memb->offset; +#else + type->tp_print = (printfunc) memb->offset; +#endif + changed = 1; + } #endif +#else + if ((0)); +#endif +#if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON + else if (strcmp(memb->name, "__module__") == 0) { + PyObject *descr; + assert(memb->type == T_OBJECT); + assert(memb->flags == 0 || memb->flags == READONLY); + descr = PyDescr_NewMember(type, memb); + if (unlikely(!descr)) + return -1; + if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) { + Py_DECREF(descr); + return -1; + } + Py_DECREF(descr); + changed = 1; + } +#endif + } + memb++; + } + if (changed) + PyType_Modified(type); } - return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; -} -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) - return 0; - return obj_dict_version == __Pyx_get_object_dict_version(obj); +#endif + return 0; } #endif -/* PyCFunctionFastCall */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - int flags = PyCFunction_GET_FLAGS(func); - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { - return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); - } else { - return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); - } +/* PyObjectCallNoArg */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { + PyObject *arg = NULL; + return __Pyx_PyObject_FastCall(func, (&arg)+1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); } -#endif -/* PyFunctionFastCall */ -#if CYTHON_FAST_PYCALL -static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, - PyObject *globals) { - PyFrameObject *f; - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject **fastlocals; - Py_ssize_t i; - PyObject *result; - assert(globals != NULL); - /* XXX Perhaps we should create a specialized - PyFrame_New() that doesn't take locals, but does - take builtins without sanity checking them. - */ - assert(tstate != NULL); - f = PyFrame_New(tstate, co, globals, NULL); - if (f == NULL) { - return NULL; - } - fastlocals = __Pyx_PyFrame_GetLocalsplus(f); - for (i = 0; i < na; i++) { - Py_INCREF(*args); - fastlocals[i] = *args++; +/* PyObjectGetMethod */ +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { + PyObject *attr; +#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP + __Pyx_TypeName type_name; + PyTypeObject *tp = Py_TYPE(obj); + PyObject *descr; + descrgetfunc f = NULL; + PyObject **dictptr, *dict; + int meth_found = 0; + assert (*method == NULL); + if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) { + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; } - result = PyEval_EvalFrameEx(f,0); - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; - return result; -} -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { - PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); - PyObject *globals = PyFunction_GET_GLOBALS(func); - PyObject *argdefs = PyFunction_GET_DEFAULTS(func); - PyObject *closure; -#if PY_MAJOR_VERSION >= 3 - PyObject *kwdefs; -#endif - PyObject *kwtuple, **k; - PyObject **d; - Py_ssize_t nd; - Py_ssize_t nk; - PyObject *result; - assert(kwargs == NULL || PyDict_Check(kwargs)); - nk = kwargs ? PyDict_Size(kwargs) : 0; - if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { - return NULL; + if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) { + return 0; } - if ( -#if PY_MAJOR_VERSION >= 3 - co->co_kwonlyargcount == 0 && + descr = _PyType_Lookup(tp, name); + if (likely(descr != NULL)) { + Py_INCREF(descr); +#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR + if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR)) +#elif PY_MAJOR_VERSION >= 3 + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) + #else + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type))) + #endif +#else + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr))) + #else + if (likely(PyFunction_Check(descr))) + #endif #endif - likely(kwargs == NULL || nk == 0) && - co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { - if (argdefs == NULL && co->co_argcount == nargs) { - result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); - goto done; - } - else if (nargs == 0 && argdefs != NULL - && co->co_argcount == Py_SIZE(argdefs)) { - /* function called with no arguments, but all parameters have - a default value: use default values as arguments .*/ - args = &PyTuple_GET_ITEM(argdefs, 0); - result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); - goto done; + { + meth_found = 1; + } else { + f = Py_TYPE(descr)->tp_descr_get; + if (f != NULL && PyDescr_IsData(descr)) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } } } - if (kwargs != NULL) { - Py_ssize_t pos, i; - kwtuple = PyTuple_New(2 * nk); - if (kwtuple == NULL) { - result = NULL; - goto done; - } - k = &PyTuple_GET_ITEM(kwtuple, 0); - pos = i = 0; - while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { - Py_INCREF(k[i]); - Py_INCREF(k[i+1]); - i += 2; + dictptr = _PyObject_GetDictPtr(obj); + if (dictptr != NULL && (dict = *dictptr) != NULL) { + Py_INCREF(dict); + attr = __Pyx_PyDict_GetItemStr(dict, name); + if (attr != NULL) { + Py_INCREF(attr); + Py_DECREF(dict); + Py_XDECREF(descr); + goto try_unpack; } - nk = i / 2; + Py_DECREF(dict); } - else { - kwtuple = NULL; - k = NULL; + if (meth_found) { + *method = descr; + return 1; } - closure = PyFunction_GET_CLOSURE(func); -#if PY_MAJOR_VERSION >= 3 - kwdefs = PyFunction_GET_KW_DEFAULTS(func); -#endif - if (argdefs != NULL) { - d = &PyTuple_GET_ITEM(argdefs, 0); - nd = Py_SIZE(argdefs); + if (f != NULL) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; } - else { - d = NULL; - nd = 0; + if (likely(descr != NULL)) { + *method = descr; + return 0; } + type_name = __Pyx_PyType_GetName(tp); + PyErr_Format(PyExc_AttributeError, #if PY_MAJOR_VERSION >= 3 - result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, - args, (int)nargs, - k, (int)nk, - d, (int)nd, kwdefs, closure); + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, name); #else - result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, - args, (int)nargs, - k, (int)nk, - d, (int)nd, closure); + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", + type_name, PyString_AS_STRING(name)); #endif - Py_XDECREF(kwtuple); -done: - Py_LeaveRecursiveCall(); - return result; -} + __Pyx_DECREF_TypeName(type_name); + return 0; +#else + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; #endif +try_unpack: +#if CYTHON_UNPACK_METHODS + if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) { + PyObject *function = PyMethod_GET_FUNCTION(attr); + Py_INCREF(function); + Py_DECREF(attr); + *method = function; + return 1; + } #endif + *method = attr; + return 0; +} -/* PyObjectCall2Args */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { - PyObject *args, *result = NULL; - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyFunction_FastCall(function, args, 2); - } - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyCFunction_FastCall(function, args, 2); +/* PyObjectCallMethod0 */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { + PyObject *method = NULL, *result = NULL; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_CallOneArg(method, obj); + Py_DECREF(method); + return result; } - #endif - args = PyTuple_New(2); - if (unlikely(!args)) goto done; - Py_INCREF(arg1); - PyTuple_SET_ITEM(args, 0, arg1); - Py_INCREF(arg2); - PyTuple_SET_ITEM(args, 1, arg2); - Py_INCREF(function); - result = __Pyx_PyObject_Call(function, args, NULL); - Py_DECREF(args); - Py_DECREF(function); -done: + if (unlikely(!method)) goto bad; + result = __Pyx_PyObject_CallNoArg(method); + Py_DECREF(method); +bad: return result; } -/* PyObjectCallMethO */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); +/* ValidateBasesTuple */ +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) { + Py_ssize_t i, n = PyTuple_GET_SIZE(bases); + for (i = 1; i < n; i++) + { + PyObject *b0 = PyTuple_GET_ITEM(bases, i); + PyTypeObject *b; +#if PY_MAJOR_VERSION < 3 + if (PyClass_Check(b0)) + { + PyErr_Format(PyExc_TypeError, "base class '%.200s' is an old-style class", + PyString_AS_STRING(((PyClassObject*)b0)->cl_name)); + return -1; + } +#endif + b = (PyTypeObject*) b0; + if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE)) + { + __Pyx_TypeName b_name = __Pyx_PyType_GetName(b); + PyErr_Format(PyExc_TypeError, + "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name); + __Pyx_DECREF_TypeName(b_name); + return -1; + } + if (dictoffset == 0 && b->tp_dictoffset) + { + __Pyx_TypeName b_name = __Pyx_PyType_GetName(b); + PyErr_Format(PyExc_TypeError, + "extension type '%.200s' has no __dict__ slot, " + "but base type '" __Pyx_FMT_TYPENAME "' has: " + "either add 'cdef dict __dict__' to the extension type " + "or add '__slots__ = [...]' to the base type", + type_name, b_name); + __Pyx_DECREF_TypeName(b_name); + return -1; + } } - return result; + return 0; } #endif -/* PyObjectCallOneArg */ -#if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); - } +/* PyType_Ready */ +static int __Pyx_PyType_Ready(PyTypeObject *t) { +#if CYTHON_USE_TYPE_SPECS || !(CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API) || defined(PYSTON_MAJOR_VERSION) + (void)__Pyx_PyObject_CallMethod0; +#if CYTHON_USE_TYPE_SPECS + (void)__Pyx_validate_bases_tuple; +#endif + return PyType_Ready(t); +#else + int r; + PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); + if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1)) + return -1; +#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION) + { + int gc_was_enabled; + #if PY_VERSION_HEX >= 0x030A00b1 + gc_was_enabled = PyGC_Disable(); + (void)__Pyx_PyObject_CallMethod0; + #else + PyObject *ret, *py_status; + PyObject *gc = NULL; + #if PY_VERSION_HEX >= 0x030700a1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) + gc = PyImport_GetModule(__pyx_kp_u_gc); + #endif + if (unlikely(!gc)) gc = PyImport_Import(__pyx_kp_u_gc); + if (unlikely(!gc)) return -1; + py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_isenabled); + if (unlikely(!py_status)) { + Py_DECREF(gc); + return -1; + } + gc_was_enabled = __Pyx_PyObject_IsTrue(py_status); + Py_DECREF(py_status); + if (gc_was_enabled > 0) { + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_disable); + if (unlikely(!ret)) { + Py_DECREF(gc); + return -1; + } + Py_DECREF(ret); + } else if (unlikely(gc_was_enabled == -1)) { + Py_DECREF(gc); + return -1; + } + #endif + t->tp_flags |= Py_TPFLAGS_HEAPTYPE; +#if PY_VERSION_HEX >= 0x030A0000 + t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE; #endif - if (likely(PyCFunction_Check(func))) { - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (__Pyx_PyFastCFunction_Check(func)) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); +#else + (void)__Pyx_PyObject_CallMethod0; #endif + r = PyType_Ready(t); +#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION) + t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE; + #if PY_VERSION_HEX >= 0x030A00b1 + if (gc_was_enabled) + PyGC_Enable(); + #else + if (gc_was_enabled) { + PyObject *tp, *v, *tb; + PyErr_Fetch(&tp, &v, &tb); + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_enable); + if (likely(ret || r == -1)) { + Py_XDECREF(ret); + PyErr_Restore(tp, v, tb); + } else { + Py_XDECREF(tp); + Py_XDECREF(v); + Py_XDECREF(tb); + r = -1; + } } + Py_DECREF(gc); + #endif } - return __Pyx__PyObject_CallOneArg(func, arg); +#endif + return r; +#endif } + +/* PyObject_GenericGetAttrNoDict */ +#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { + __Pyx_TypeName type_name = __Pyx_PyType_GetName(tp); + PyErr_Format(PyExc_AttributeError, +#if PY_MAJOR_VERSION >= 3 + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, attr_name); #else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", + type_name, PyString_AS_STRING(attr_name)); #endif - -/* ArgTypeTest */ -static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) -{ - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - else if (exact) { - #if PY_MAJOR_VERSION == 2 - if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; - #endif + __Pyx_DECREF_TypeName(type_name); + return NULL; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { + PyObject *descr; + PyTypeObject *tp = Py_TYPE(obj); + if (unlikely(!PyString_Check(attr_name))) { + return PyObject_GenericGetAttr(obj, attr_name); } - else { - if (likely(__Pyx_TypeCheck(obj, type))) return 1; + assert(!tp->tp_dictoffset); + descr = _PyType_Lookup(tp, attr_name); + if (unlikely(!descr)) { + return __Pyx_RaiseGenericGetAttributeError(tp, attr_name); } - PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); - return 0; -} - -/* PyIntBinop */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) { - (void)inplace; - (void)zerodivision_check; + Py_INCREF(descr); #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op1))) { - const long b = intval; - long x; - long a = PyInt_AS_LONG(op1); - x = (long)((unsigned long)a + b); - if (likely((x^a) >= 0 || (x^b) >= 0)) - return PyInt_FromLong(x); - return PyLong_Type.tp_as_number->nb_add(op1, op2); - } + if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS))) #endif - #if CYTHON_USE_PYLONG_INTERNALS - if (likely(PyLong_CheckExact(op1))) { - const long b = intval; - long a, x; -#ifdef HAVE_LONG_LONG - const PY_LONG_LONG llb = intval; - PY_LONG_LONG lla, llx; -#endif - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; - } else { - switch (size) { - case -2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case 2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case -3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case 3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case -4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case 4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - default: return PyLong_Type.tp_as_number->nb_add(op1, op2); - } + { + descrgetfunc f = Py_TYPE(descr)->tp_descr_get; + if (unlikely(f)) { + PyObject *res = f(descr, obj, (PyObject *)tp); + Py_DECREF(descr); + return res; } - x = a + b; - return PyLong_FromLong(x); -#ifdef HAVE_LONG_LONG - long_long: - llx = lla + llb; - return PyLong_FromLongLong(llx); -#endif - - } - #endif - if (PyFloat_CheckExact(op1)) { - const long b = intval; - double a = PyFloat_AS_DOUBLE(op1); - double result; - PyFPE_START_PROTECT("add", return NULL) - result = ((double)a) + (double)b; - PyFPE_END_PROTECT(result) - return PyFloat_FromDouble(result); + return descr; +} +#endif + +/* PyObject_GenericGetAttr */ +#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) { + if (unlikely(Py_TYPE(obj)->tp_dictoffset)) { + return PyObject_GenericGetAttr(obj, attr_name); } - return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2); + return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name); } #endif -/* ExtTypeTest */ -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - if (likely(__Pyx_TypeCheck(obj, type))) - return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", - Py_TYPE(obj)->tp_name, type->tp_name); +/* SetVTable */ +static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) { + PyObject *ob = PyCapsule_New(vtable, 0, 0); + if (unlikely(!ob)) + goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_n_s_pyx_vtable, ob) < 0)) +#else + if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_n_s_pyx_vtable, ob) < 0)) +#endif + goto bad; + Py_DECREF(ob); return 0; +bad: + Py_XDECREF(ob); + return -1; } -/* SliceObject */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj, - Py_ssize_t cstart, Py_ssize_t cstop, - PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, - int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { -#if CYTHON_USE_TYPE_SLOTS - PyMappingMethods* mp; -#if PY_MAJOR_VERSION < 3 - PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence; - if (likely(ms && ms->sq_slice)) { - if (!has_cstart) { - if (_py_start && (*_py_start != Py_None)) { - cstart = __Pyx_PyIndex_AsSsize_t(*_py_start); - if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; - } else - cstart = 0; - } - if (!has_cstop) { - if (_py_stop && (*_py_stop != Py_None)) { - cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop); - if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; - } else - cstop = PY_SSIZE_T_MAX; +/* GetVTable */ +static void* __Pyx_GetVtable(PyTypeObject *type) { + void* ptr; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_n_s_pyx_vtable); +#else + PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_n_s_pyx_vtable); +#endif + if (!ob) + goto bad; + ptr = PyCapsule_GetPointer(ob, 0); + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; +} + +/* MergeVTables */ +#if !CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_MergeVtables(PyTypeObject *type) { + int i; + void** base_vtables; + __Pyx_TypeName tp_base_name; + __Pyx_TypeName base_name; + void* unknown = (void*)-1; + PyObject* bases = type->tp_bases; + int base_depth = 0; + { + PyTypeObject* base = type->tp_base; + while (base) { + base_depth += 1; + base = base->tp_base; } - if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) { - Py_ssize_t l = ms->sq_length(obj); - if (likely(l >= 0)) { - if (cstop < 0) { - cstop += l; - if (cstop < 0) cstop = 0; - } - if (cstart < 0) { - cstart += l; - if (cstart < 0) cstart = 0; + } + base_vtables = (void**) malloc(sizeof(void*) * (size_t)(base_depth + 1)); + base_vtables[0] = unknown; + for (i = 1; i < PyTuple_GET_SIZE(bases); i++) { + void* base_vtable = __Pyx_GetVtable(((PyTypeObject*)PyTuple_GET_ITEM(bases, i))); + if (base_vtable != NULL) { + int j; + PyTypeObject* base = type->tp_base; + for (j = 0; j < base_depth; j++) { + if (base_vtables[j] == unknown) { + base_vtables[j] = __Pyx_GetVtable(base); + base_vtables[j + 1] = unknown; } - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + if (base_vtables[j] == base_vtable) { + break; + } else if (base_vtables[j] == NULL) { goto bad; - PyErr_Clear(); + } + base = base->tp_base; } } - return ms->sq_slice(obj, cstart, cstop); } + PyErr_Clear(); + free(base_vtables); + return 0; +bad: + tp_base_name = __Pyx_PyType_GetName(type->tp_base); + base_name = __Pyx_PyType_GetName((PyTypeObject*)PyTuple_GET_ITEM(bases, i)); + PyErr_Format(PyExc_TypeError, + "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name); + __Pyx_DECREF_TypeName(tp_base_name); + __Pyx_DECREF_TypeName(base_name); + free(base_vtables); + return -1; +} #endif - mp = Py_TYPE(obj)->tp_as_mapping; - if (likely(mp && mp->mp_subscript)) + +/* SetupReduce */ +#if !CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { + int ret; + PyObject *name_attr; + name_attr = __Pyx_PyObject_GetAttrStrNoError(meth, __pyx_n_s_name); + if (likely(name_attr)) { + ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); + } else { + ret = -1; + } + if (unlikely(ret < 0)) { + PyErr_Clear(); + ret = 0; + } + Py_XDECREF(name_attr); + return ret; +} +static int __Pyx_setup_reduce(PyObject* type_obj) { + int ret = 0; + PyObject *object_reduce = NULL; + PyObject *object_getstate = NULL; + PyObject *object_reduce_ex = NULL; + PyObject *reduce = NULL; + PyObject *reduce_ex = NULL; + PyObject *reduce_cython = NULL; + PyObject *setstate = NULL; + PyObject *setstate_cython = NULL; + PyObject *getstate = NULL; +#if CYTHON_USE_PYTYPE_LOOKUP + getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate); +#else + getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_getstate); + if (!getstate && PyErr_Occurred()) { + goto __PYX_BAD; + } #endif - { - PyObject* result; - PyObject *py_slice, *py_start, *py_stop; - if (_py_slice) { - py_slice = *_py_slice; - } else { - PyObject* owned_start = NULL; - PyObject* owned_stop = NULL; - if (_py_start) { - py_start = *_py_start; - } else { - if (has_cstart) { - owned_start = py_start = PyInt_FromSsize_t(cstart); - if (unlikely(!py_start)) goto bad; - } else - py_start = Py_None; + if (getstate) { +#if CYTHON_USE_PYTYPE_LOOKUP + object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_getstate); +#else + object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_n_s_getstate); + if (!object_getstate && PyErr_Occurred()) { + goto __PYX_BAD; + } +#endif + if (object_getstate != getstate) { + goto __PYX_GOOD; + } + } +#if CYTHON_USE_PYTYPE_LOOKUP + object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; +#else + object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; +#endif + reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD; + if (reduce_ex == object_reduce_ex) { +#if CYTHON_USE_PYTYPE_LOOKUP + object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; +#else + object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; +#endif + reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD; + if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) { + reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython); + if (likely(reduce_cython)) { + ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + } else if (reduce == object_reduce || PyErr_Occurred()) { + goto __PYX_BAD; } - if (_py_stop) { - py_stop = *_py_stop; - } else { - if (has_cstop) { - owned_stop = py_stop = PyInt_FromSsize_t(cstop); - if (unlikely(!py_stop)) { - Py_XDECREF(owned_start); - goto bad; - } - } else - py_stop = Py_None; + setstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate); + if (!setstate) PyErr_Clear(); + if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) { + setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython); + if (likely(setstate_cython)) { + ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + } else if (!setstate || PyErr_Occurred()) { + goto __PYX_BAD; + } } - py_slice = PySlice_New(py_start, py_stop, Py_None); - Py_XDECREF(owned_start); - Py_XDECREF(owned_stop); - if (unlikely(!py_slice)) goto bad; + PyType_Modified((PyTypeObject*)type_obj); } -#if CYTHON_USE_TYPE_SLOTS - result = mp->mp_subscript(obj, py_slice); + } + goto __PYX_GOOD; +__PYX_BAD: + if (!PyErr_Occurred()) { + __Pyx_TypeName type_obj_name = + __Pyx_PyType_GetName((PyTypeObject*)type_obj); + PyErr_Format(PyExc_RuntimeError, + "Unable to initialize pickling for " __Pyx_FMT_TYPENAME, type_obj_name); + __Pyx_DECREF_TypeName(type_obj_name); + } + ret = -1; +__PYX_GOOD: +#if !CYTHON_USE_PYTYPE_LOOKUP + Py_XDECREF(object_reduce); + Py_XDECREF(object_reduce_ex); + Py_XDECREF(object_getstate); + Py_XDECREF(getstate); +#endif + Py_XDECREF(reduce); + Py_XDECREF(reduce_ex); + Py_XDECREF(reduce_cython); + Py_XDECREF(setstate); + Py_XDECREF(setstate_cython); + return ret; +} +#endif + +/* TypeImport */ +#ifndef __PYX_HAVE_RT_ImportType_3_0_0 +#define __PYX_HAVE_RT_ImportType_3_0_0 +static PyTypeObject *__Pyx_ImportType_3_0_0(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_0 check_size) +{ + PyObject *result = 0; + char warning[200]; + Py_ssize_t basicsize; + Py_ssize_t itemsize; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_basicsize; + PyObject *py_itemsize; +#endif + result = PyObject_GetAttrString(module, class_name); + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%.200s.%.200s is not a type object", + module_name, class_name); + goto bad; + } +#if !CYTHON_COMPILING_IN_LIMITED_API + basicsize = ((PyTypeObject *)result)->tp_basicsize; + itemsize = ((PyTypeObject *)result)->tp_itemsize; #else - result = PyObject_GetItem(obj, py_slice); + py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); + if (!py_basicsize) + goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; + py_itemsize = PyObject_GetAttrString(result, "__itemsize__"); + if (!py_itemsize) + goto bad; + itemsize = PyLong_AsSsize_t(py_itemsize); + Py_DECREF(py_itemsize); + py_itemsize = 0; + if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; #endif - if (!_py_slice) { - Py_DECREF(py_slice); + if (itemsize) { + if (size % alignment) { + alignment = size % alignment; } - return result; + if (itemsize < (Py_ssize_t)alignment) + itemsize = (Py_ssize_t)alignment; + } + if ((size_t)(basicsize + itemsize) < size) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize+itemsize); + goto bad; + } + if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_0 && + ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd-%zd from PyObject", + module_name, class_name, size, basicsize, basicsize+itemsize); + goto bad; + } + else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_0 && (size_t)basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize); + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(result); + return NULL; +} +#endif + +/* ImportDottedModule */ +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx__ImportDottedModule_Error(PyObject *name, PyObject *parts_tuple, Py_ssize_t count) { + PyObject *partial_name = NULL, *slice = NULL, *sep = NULL; + if (unlikely(PyErr_Occurred())) { + PyErr_Clear(); + } + if (likely(PyTuple_GET_SIZE(parts_tuple) == count)) { + partial_name = name; + } else { + slice = PySequence_GetSlice(parts_tuple, 0, count); + if (unlikely(!slice)) + goto bad; + sep = PyUnicode_FromStringAndSize(".", 1); + if (unlikely(!sep)) + goto bad; + partial_name = PyUnicode_Join(sep, slice); } - PyErr_Format(PyExc_TypeError, - "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name); + PyErr_Format( +#if PY_MAJOR_VERSION < 3 + PyExc_ImportError, + "No module named '%s'", PyString_AS_STRING(partial_name)); +#else +#if PY_VERSION_HEX >= 0x030600B1 + PyExc_ModuleNotFoundError, +#else + PyExc_ImportError, +#endif + "No module named '%U'", partial_name); +#endif bad: + Py_XDECREF(sep); + Py_XDECREF(slice); + Py_XDECREF(partial_name); return NULL; } - -/* GetModuleGlobalName */ -#if CYTHON_USE_DICT_VERSIONS -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) -#else -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) #endif -{ - PyObject *result; -#if !CYTHON_AVOID_BORROWED_REFS -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 - result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } else if (unlikely(PyErr_Occurred())) { +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx__ImportDottedModule_Lookup(PyObject *name) { + PyObject *imported_module; +#if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) return NULL; - } + imported_module = __Pyx_PyDict_GetItemStr(modules, name); + Py_XINCREF(imported_module); #else - result = PyDict_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); + imported_module = PyImport_GetModule(name); +#endif + return imported_module; +} +#endif +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple) { + Py_ssize_t i, nparts; + nparts = PyTuple_GET_SIZE(parts_tuple); + for (i=1; i < nparts && module; i++) { + PyObject *part, *submodule; +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + part = PyTuple_GET_ITEM(parts_tuple, i); +#else + part = PySequence_ITEM(parts_tuple, i); +#endif + submodule = __Pyx_PyObject_GetAttrStrNoError(module, part); +#if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(part); +#endif + Py_DECREF(module); + module = submodule; } + if (unlikely(!module)) { + return __Pyx__ImportDottedModule_Error(name, parts_tuple, i); + } + return module; +} #endif +static PyObject *__Pyx__ImportDottedModule(PyObject *name, PyObject *parts_tuple) { +#if PY_MAJOR_VERSION < 3 + PyObject *module, *from_list, *star = __pyx_n_s__21; + CYTHON_UNUSED_VAR(parts_tuple); + from_list = PyList_New(1); + if (unlikely(!from_list)) + return NULL; + Py_INCREF(star); + PyList_SET_ITEM(from_list, 0, star); + module = __Pyx_Import(name, from_list, 0); + Py_DECREF(from_list); + return module; #else - result = PyObject_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); + PyObject *imported_module; + PyObject *module = __Pyx_Import(name, NULL, 0); + if (!parts_tuple || unlikely(!module)) + return module; + imported_module = __Pyx__ImportDottedModule_Lookup(name); + if (likely(imported_module)) { + Py_DECREF(module); + return imported_module; } PyErr_Clear(); + return __Pyx_ImportDottedModule_WalkParts(module, name, parts_tuple); #endif - return __Pyx_GetBuiltinName(name); } - -/* WriteUnraisableException */ -static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, - CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename, - int full_traceback, CYTHON_UNUSED int nogil) { - PyObject *old_exc, *old_val, *old_tb; - PyObject *ctx; - __Pyx_PyThreadState_declare -#ifdef WITH_THREAD - PyGILState_STATE state; - if (nogil) - state = PyGILState_Ensure(); -#ifdef _MSC_VER - else state = (PyGILState_STATE)-1; -#endif +static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030400B1 + PyObject *module = __Pyx__ImportDottedModule_Lookup(name); + if (likely(module)) { + PyObject *spec = __Pyx_PyObject_GetAttrStrNoError(module, __pyx_n_s_spec); + if (likely(spec)) { + PyObject *unsafe = __Pyx_PyObject_GetAttrStrNoError(spec, __pyx_n_s_initializing); + if (likely(!unsafe || !__Pyx_PyObject_IsTrue(unsafe))) { + Py_DECREF(spec); + spec = NULL; + } + Py_XDECREF(unsafe); + } + if (likely(!spec)) { + PyErr_Clear(); + return module; + } + Py_DECREF(spec); + Py_DECREF(module); + } else if (PyErr_Occurred()) { + PyErr_Clear(); + } #endif - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); - if (full_traceback) { - Py_XINCREF(old_exc); - Py_XINCREF(old_val); - Py_XINCREF(old_tb); - __Pyx_ErrRestore(old_exc, old_val, old_tb); - PyErr_PrintEx(1); + return __Pyx__ImportDottedModule(name, parts_tuple); +} + +/* FetchSharedCythonModule */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void) { + PyObject *abi_module = PyImport_AddModule((char*) __PYX_ABI_MODULE_NAME); + if (unlikely(!abi_module)) return NULL; + Py_INCREF(abi_module); + return abi_module; +} + +/* FetchCommonType */ +static int __Pyx_VerifyCachedType(PyObject *cached_type, + const char *name, + Py_ssize_t basicsize, + Py_ssize_t expected_basicsize) { + if (!PyType_Check(cached_type)) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s is not a type object", name); + return -1; } - #if PY_MAJOR_VERSION < 3 - ctx = PyString_FromString(name); - #else - ctx = PyUnicode_FromString(name); - #endif - __Pyx_ErrRestore(old_exc, old_val, old_tb); - if (!ctx) { - PyErr_WriteUnraisable(Py_None); - } else { - PyErr_WriteUnraisable(ctx); - Py_DECREF(ctx); + if (basicsize != expected_basicsize) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s has the wrong size, try recompiling", + name); + return -1; } -#ifdef WITH_THREAD - if (nogil) - PyGILState_Release(state); + return 0; +} +#if !CYTHON_USE_TYPE_SPECS +static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { + PyObject* abi_module; + const char* object_name; + PyTypeObject *cached_type = NULL; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) return NULL; + object_name = strrchr(type->tp_name, '.'); + object_name = object_name ? object_name+1 : type->tp_name; + cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name); + if (cached_type) { + if (__Pyx_VerifyCachedType( + (PyObject *)cached_type, + object_name, + cached_type->tp_basicsize, + type->tp_basicsize) < 0) { + goto bad; + } + goto done; + } + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + if (PyType_Ready(type) < 0) goto bad; + if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0) + goto bad; + Py_INCREF(type); + cached_type = type; +done: + Py_DECREF(abi_module); + return cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; +} +#else +static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) { + PyObject *abi_module, *cached_type = NULL; + const char* object_name = strrchr(spec->name, '.'); + object_name = object_name ? object_name+1 : spec->name; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) return NULL; + cached_type = PyObject_GetAttrString(abi_module, object_name); + if (cached_type) { + Py_ssize_t basicsize; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_basicsize; + py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); + if (unlikely(!py_basicsize)) goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; +#else + basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1; #endif + if (__Pyx_VerifyCachedType( + cached_type, + object_name, + basicsize, + spec->basicsize) < 0) { + goto bad; + } + goto done; + } + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + CYTHON_UNUSED_VAR(module); + cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases); + if (unlikely(!cached_type)) goto bad; + if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; + if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad; +done: + Py_DECREF(abi_module); + assert(cached_type == NULL || PyType_Check(cached_type)); + return (PyTypeObject *) cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; } +#endif -/* GetAttr3 */ -static PyObject *__Pyx_GetAttr3Default(PyObject *d) { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) +/* PyVectorcallFastCallDict */ +#if CYTHON_METH_FASTCALL +static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + PyObject *res = NULL; + PyObject *kwnames; + PyObject **newargs; + PyObject **kwvalues; + Py_ssize_t i, pos; + size_t j; + PyObject *key, *value; + unsigned long keys_are_strings; + Py_ssize_t nkw = PyDict_GET_SIZE(kw); + newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); + if (unlikely(newargs == NULL)) { + PyErr_NoMemory(); return NULL; - __Pyx_PyErr_Clear(); - Py_INCREF(d); - return d; + } + for (j = 0; j < nargs; j++) newargs[j] = args[j]; + kwnames = PyTuple_New(nkw); + if (unlikely(kwnames == NULL)) { + PyMem_Free(newargs); + return NULL; + } + kwvalues = newargs + nargs; + pos = i = 0; + keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; + while (PyDict_Next(kw, &pos, &key, &value)) { + keys_are_strings &= Py_TYPE(key)->tp_flags; + Py_INCREF(key); + Py_INCREF(value); + PyTuple_SET_ITEM(kwnames, i, key); + kwvalues[i] = value; + i++; + } + if (unlikely(!keys_are_strings)) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + goto cleanup; + } + res = vc(func, newargs, nargs, kwnames); +cleanup: + Py_DECREF(kwnames); + for (i = 0; i < nkw; i++) + Py_DECREF(kwvalues[i]); + PyMem_Free(newargs); + return res; } -static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { - PyObject *r = __Pyx_GetAttr(o, n); - return (likely(r)) ? r : __Pyx_GetAttr3Default(d); +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) { + return vc(func, args, nargs, NULL); + } + return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); } +#endif -/* KeywordStringCheck */ -static int __Pyx_CheckKeywordStrings( - PyObject *kwdict, - const char* function_name, - int kw_allowed) +/* CythonFunctionShared */ +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { +#if PY_VERSION_HEX < 0x030900B1 + __Pyx_Py_XDECREF_SET( + __Pyx_CyFunction_GetClassObj(f), + ((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#else + __Pyx_Py_XDECREF_SET( + ((PyCMethodObject *) (f))->mm_class, + (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#endif +} +static PyObject * +__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) { - PyObject* key = 0; - Py_ssize_t pos = 0; -#if CYTHON_COMPILING_IN_PYPY - if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0)) - goto invalid_keyword; - return 1; + CYTHON_UNUSED_VAR(closure); + if (unlikely(op->func_doc == NULL)) { + if (((PyCFunctionObject*)op)->m_ml->ml_doc) { +#if PY_MAJOR_VERSION >= 3 + op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); #else - while (PyDict_Next(kwdict, &pos, &key, 0)) { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_Check(key))) - #endif - if (unlikely(!PyUnicode_Check(key))) - goto invalid_keyword_type; + op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); +#endif + if (unlikely(op->func_doc == NULL)) + return NULL; + } else { + Py_INCREF(Py_None); + return Py_None; + } } - if ((!kw_allowed) && unlikely(key)) - goto invalid_keyword; - return 1; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); + Py_INCREF(op->func_doc); + return op->func_doc; +} +static int +__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (value == NULL) { + value = Py_None; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_doc, value); return 0; +} +static PyObject * +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(op->func_name == NULL)) { +#if PY_MAJOR_VERSION >= 3 + op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); +#else + op->func_name = PyString_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); #endif -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif - return 0; + if (unlikely(op->func_name == NULL)) + return NULL; + } + Py_INCREF(op->func_name); + return op->func_name; } - -/* Import */ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *empty_list = 0; - PyObject *module = 0; - PyObject *global_dict = 0; - PyObject *empty_dict = 0; - PyObject *list; - #if PY_MAJOR_VERSION < 3 - PyObject *py_import; - py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (!py_import) - goto bad; - #endif - if (from_list) - list = from_list; - else { - empty_list = PyList_New(0); - if (!empty_list) - goto bad; - list = empty_list; +static int +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) +#else + if (unlikely(value == NULL || !PyString_Check(value))) +#endif + { + PyErr_SetString(PyExc_TypeError, + "__name__ must be set to a string object"); + return -1; } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) - goto bad; - empty_dict = PyDict_New(); - if (!empty_dict) - goto bad; + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_name, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + Py_INCREF(op->func_qualname); + return op->func_qualname; +} +static int +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) +#else + if (unlikely(value == NULL || !PyString_Check(value))) +#endif { - #if PY_MAJOR_VERSION >= 3 - if (level == -1) { - if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, 1); - if (!module) { - if (!PyErr_ExceptionMatches(PyExc_ImportError)) - goto bad; - PyErr_Clear(); - } - } - level = 0; - } - #endif - if (!module) { - #if PY_MAJOR_VERSION < 3 - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, (PyObject *)NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, level); - #endif - } + PyErr_SetString(PyExc_TypeError, + "__qualname__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_qualname, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(op->func_dict == NULL)) { + op->func_dict = PyDict_New(); + if (unlikely(op->func_dict == NULL)) + return NULL; + } + Py_INCREF(op->func_dict); + return op->func_dict; +} +static int +__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL)) { + PyErr_SetString(PyExc_TypeError, + "function's dictionary may not be deleted"); + return -1; + } + if (unlikely(!PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "setting function's dictionary to a non-dict"); + return -1; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_dict, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + Py_INCREF(op->func_globals); + return op->func_globals; +} +static PyObject * +__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(op); + CYTHON_UNUSED_VAR(context); + Py_INCREF(Py_None); + return Py_None; +} +static PyObject * +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) +{ + PyObject* result = (op->func_code) ? op->func_code : Py_None; + CYTHON_UNUSED_VAR(context); + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { + int result = 0; + PyObject *res = op->defaults_getter((PyObject *) op); + if (unlikely(!res)) + return -1; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + op->defaults_tuple = PyTuple_GET_ITEM(res, 0); + Py_INCREF(op->defaults_tuple); + op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); + Py_INCREF(op->defaults_kwdict); + #else + op->defaults_tuple = PySequence_ITEM(res, 0); + if (unlikely(!op->defaults_tuple)) result = -1; + else { + op->defaults_kwdict = PySequence_ITEM(res, 1); + if (unlikely(!op->defaults_kwdict)) result = -1; } -bad: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(py_import); #endif - Py_XDECREF(empty_list); - Py_XDECREF(empty_dict); - return module; + Py_DECREF(res); + return result; } - -/* ImportFrom */ -static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { - PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); - if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Format(PyExc_ImportError, - #if PY_MAJOR_VERSION < 3 - "cannot import name %.230s", PyString_AS_STRING(name)); - #else - "cannot import name %S", name); - #endif +static int +__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value) { + value = Py_None; + } else if (unlikely(value != Py_None && !PyTuple_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__defaults__ must be set to a tuple object"); + return -1; } - return value; + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " + "currently affect the values used in function calls", 1); + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->defaults_tuple, value); + return 0; } - -/* GetItemInt */ -static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { - PyObject *r; - if (!j) return NULL; - r = PyObject_GetItem(o, j); - Py_DECREF(j); - return r; +static PyObject * +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = op->defaults_tuple; + CYTHON_UNUSED_VAR(context); + if (unlikely(!result)) { + if (op->defaults_getter) { + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; + result = op->defaults_tuple; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; } -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - Py_ssize_t wrapped_i = i; - if (wraparound & unlikely(i < 0)) { - wrapped_i += PyList_GET_SIZE(o); +static int +__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value) { + value = Py_None; + } else if (unlikely(value != Py_None && !PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__kwdefaults__ must be set to a dict object"); + return -1; } - if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, wrapped_i); - Py_INCREF(r); - return r; + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " + "currently affect the values used in function calls", 1); + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = op->defaults_kwdict; + CYTHON_UNUSED_VAR(context); + if (unlikely(!result)) { + if (op->defaults_getter) { + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; + result = op->defaults_kwdict; + } else { + result = Py_None; + } } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -#else - return PySequence_GetItem(o, i); -#endif + Py_INCREF(result); + return result; } -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - Py_ssize_t wrapped_i = i; - if (wraparound & unlikely(i < 0)) { - wrapped_i += PyTuple_GET_SIZE(o); +static int +__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value || value == Py_None) { + value = NULL; + } else if (unlikely(!PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__annotations__ must be set to a dict object"); + return -1; } - if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); - Py_INCREF(r); - return r; + Py_XINCREF(value); + __Pyx_Py_XDECREF_SET(op->func_annotations, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = op->func_annotations; + CYTHON_UNUSED_VAR(context); + if (unlikely(!result)) { + result = PyDict_New(); + if (unlikely(!result)) return NULL; + op->func_annotations = result; } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -#else - return PySequence_GetItem(o, i); -#endif + Py_INCREF(result); + return result; } -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS - if (is_list || PyList_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); - if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { - PyObject *r = PyList_GET_ITEM(o, n); - Py_INCREF(r); - return r; - } +static PyObject * +__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { + int is_coroutine; + CYTHON_UNUSED_VAR(context); + if (op->func_is_coroutine) { + return __Pyx_NewRef(op->func_is_coroutine); } - else if (PyTuple_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, n); - Py_INCREF(r); - return r; - } - } else { - PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; - if (likely(m && m->sq_item)) { - if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { - Py_ssize_t l = m->sq_length(o); - if (likely(l >= 0)) { - i += l; - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - return NULL; - PyErr_Clear(); - } - } - return m->sq_item(o, i); + is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; +#if PY_VERSION_HEX >= 0x03050000 + if (is_coroutine) { + PyObject *module, *fromlist, *marker = __pyx_n_s_is_coroutine; + fromlist = PyList_New(1); + if (unlikely(!fromlist)) return NULL; + Py_INCREF(marker); + PyList_SET_ITEM(fromlist, 0, marker); + module = PyImport_ImportModuleLevelObject(__pyx_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0); + Py_DECREF(fromlist); + if (unlikely(!module)) goto ignore; + op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker); + Py_DECREF(module); + if (likely(op->func_is_coroutine)) { + return __Pyx_NewRef(op->func_is_coroutine); } - } -#else - if (is_list || PySequence_Check(o)) { - return PySequence_GetItem(o, i); +ignore: + PyErr_Clear(); } #endif - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); + op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine); + return __Pyx_NewRef(op->func_is_coroutine); } - -/* PyObject_GenericGetAttrNoDict */ -#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 -static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { - PyErr_Format(PyExc_AttributeError, +static PyGetSetDef __pyx_CyFunction_getsets[] = { + {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, + {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, + {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, + {(char *) "_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; +static PyMemberDef __pyx_CyFunction_members[] = { + {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, +#if CYTHON_USE_TYPE_SPECS + {(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, +#if CYTHON_METH_FASTCALL +#if CYTHON_BACKPORT_VECTORCALL + {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, +#else + {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, +#endif +#endif +#if PY_VERSION_HEX < 0x030500A0 + {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, +#else + {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, +#endif +#endif + {0, 0, 0, 0, 0} +}; +static PyObject * +__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) +{ + CYTHON_UNUSED_VAR(args); #if PY_MAJOR_VERSION >= 3 - "'%.50s' object has no attribute '%U'", - tp->tp_name, attr_name); + Py_INCREF(m->func_qualname); + return m->func_qualname; #else - "'%.50s' object has no attribute '%.400s'", - tp->tp_name, PyString_AS_STRING(attr_name)); + return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name); #endif - return NULL; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { - PyObject *descr; - PyTypeObject *tp = Py_TYPE(obj); - if (unlikely(!PyString_Check(attr_name))) { - return PyObject_GenericGetAttr(obj, attr_name); - } - assert(!tp->tp_dictoffset); - descr = _PyType_Lookup(tp, attr_name); - if (unlikely(!descr)) { - return __Pyx_RaiseGenericGetAttributeError(tp, attr_name); - } - Py_INCREF(descr); - #if PY_MAJOR_VERSION < 3 - if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS))) - #endif - { - descrgetfunc f = Py_TYPE(descr)->tp_descr_get; - if (unlikely(f)) { - PyObject *res = f(descr, obj, (PyObject *)tp); - Py_DECREF(descr); - return res; - } - } - return descr; } +static PyMethodDef __pyx_CyFunction_methods[] = { + {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, + {0, 0, 0, 0} +}; +#if PY_VERSION_HEX < 0x030500A0 +#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) +#else +#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) #endif - -/* PyObject_GenericGetAttr */ -#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 -static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) { - if (unlikely(Py_TYPE(obj)->tp_dictoffset)) { - return PyObject_GenericGetAttr(obj, attr_name); +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + PyCFunctionObject *cf = (PyCFunctionObject*) op; + if (unlikely(op == NULL)) + return NULL; + op->flags = flags; + __Pyx_CyFunction_weakreflist(op) = NULL; + cf->m_ml = ml; + cf->m_self = (PyObject *) op; + Py_XINCREF(closure); + op->func_closure = closure; + Py_XINCREF(module); + cf->m_module = module; + op->func_dict = NULL; + op->func_name = NULL; + Py_INCREF(qualname); + op->func_qualname = qualname; + op->func_doc = NULL; +#if PY_VERSION_HEX < 0x030900B1 + op->func_classobj = NULL; +#else + ((PyCMethodObject*)op)->mm_class = NULL; +#endif + op->func_globals = globals; + Py_INCREF(op->func_globals); + Py_XINCREF(code); + op->func_code = code; + op->defaults_pyobjects = 0; + op->defaults_size = 0; + op->defaults = NULL; + op->defaults_tuple = NULL; + op->defaults_kwdict = NULL; + op->defaults_getter = NULL; + op->func_annotations = NULL; + op->func_is_coroutine = NULL; +#if CYTHON_METH_FASTCALL + switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { + case METH_NOARGS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; + break; + case METH_O: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; + break; + case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; + break; + case METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; + break; + case METH_VARARGS | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = NULL; + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + Py_DECREF(op); + return NULL; } - return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name); -} #endif - -/* SetVTable */ -static int __Pyx_SetVtable(PyObject *dict, void *vtable) { -#if PY_VERSION_HEX >= 0x02070000 - PyObject *ob = PyCapsule_New(vtable, 0, 0); + return (PyObject *) op; +} +static int +__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) +{ + Py_CLEAR(m->func_closure); + Py_CLEAR(((PyCFunctionObject*)m)->m_module); + Py_CLEAR(m->func_dict); + Py_CLEAR(m->func_name); + Py_CLEAR(m->func_qualname); + Py_CLEAR(m->func_doc); + Py_CLEAR(m->func_globals); + Py_CLEAR(m->func_code); +#if PY_VERSION_HEX < 0x030900B1 + Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); #else - PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); + { + PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; + ((PyCMethodObject *) (m))->mm_class = NULL; + Py_XDECREF(cls); + } #endif - if (!ob) - goto bad; - if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0) - goto bad; - Py_DECREF(ob); + Py_CLEAR(m->defaults_tuple); + Py_CLEAR(m->defaults_kwdict); + Py_CLEAR(m->func_annotations); + Py_CLEAR(m->func_is_coroutine); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_XDECREF(pydefaults[i]); + PyObject_Free(m->defaults); + m->defaults = NULL; + } return 0; -bad: - Py_XDECREF(ob); - return -1; } - -/* PyObjectGetAttrStrNoError */ -static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) - __Pyx_PyErr_Clear(); +static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + if (__Pyx_CyFunction_weakreflist(m) != NULL) + PyObject_ClearWeakRefs((PyObject *) m); + __Pyx_CyFunction_clear(m); + __Pyx_PyHeapTypeObject_GC_Del(m); } -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { - PyObject *result; -#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { - return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); - } -#endif - result = __Pyx_PyObject_GetAttrStr(obj, attr_name); - if (unlikely(!result)) { - __Pyx_PyObject_GetAttrStr_ClearAttributeError(); +static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + PyObject_GC_UnTrack(m); + __Pyx__CyFunction_dealloc(m); +} +static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) +{ + Py_VISIT(m->func_closure); + Py_VISIT(((PyCFunctionObject*)m)->m_module); + Py_VISIT(m->func_dict); + Py_VISIT(m->func_name); + Py_VISIT(m->func_qualname); + Py_VISIT(m->func_doc); + Py_VISIT(m->func_globals); + Py_VISIT(m->func_code); + Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); + Py_VISIT(m->defaults_tuple); + Py_VISIT(m->defaults_kwdict); + Py_VISIT(m->func_is_coroutine); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_VISIT(pydefaults[i]); } - return result; + return 0; } - -/* SetupReduce */ -static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { - int ret; - PyObject *name_attr; - name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name); - if (likely(name_attr)) { - ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); - } else { - ret = -1; - } - if (unlikely(ret < 0)) { - PyErr_Clear(); - ret = 0; - } - Py_XDECREF(name_attr); - return ret; +static PyObject* +__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) +{ +#if PY_MAJOR_VERSION >= 3 + return PyUnicode_FromFormat("", + op->func_qualname, (void *)op); +#else + return PyString_FromFormat("", + PyString_AsString(op->func_qualname), (void *)op); +#endif } -static int __Pyx_setup_reduce(PyObject* type_obj) { - int ret = 0; - PyObject *object_reduce = NULL; - PyObject *object_reduce_ex = NULL; - PyObject *reduce = NULL; - PyObject *reduce_ex = NULL; - PyObject *reduce_cython = NULL; - PyObject *setstate = NULL; - PyObject *setstate_cython = NULL; -#if CYTHON_USE_PYTYPE_LOOKUP - if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD; +static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { + PyCFunctionObject* f = (PyCFunctionObject*)func; + PyCFunction meth = f->m_ml->ml_meth; + Py_ssize_t size; + switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { + case METH_VARARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) + return (*meth)(self, arg); + break; + case METH_VARARGS | METH_KEYWORDS: + return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw); + case METH_NOARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { + size = PyTuple_GET_SIZE(arg); + if (likely(size == 0)) + return (*meth)(self, NULL); + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + f->m_ml->ml_name, size); + return NULL; + } + break; + case METH_O: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { + size = PyTuple_GET_SIZE(arg); + if (likely(size == 1)) { + PyObject *result, *arg0; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + arg0 = PyTuple_GET_ITEM(arg, 0); + #else + arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; + #endif + result = (*meth)(self, arg0); + #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(arg0); + #endif + return result; + } + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + f->m_ml->ml_name, size); + return NULL; + } + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + return NULL; + } + PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", + f->m_ml->ml_name); + return NULL; +} +static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw); +} +static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { + PyObject *result; + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; +#if CYTHON_METH_FASTCALL + __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); + if (vc) { +#if CYTHON_ASSUME_SAFE_MACROS + return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); #else - if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD; + (void) &__Pyx_PyVectorcall_FastCallDict; + return PyVectorcall_Call(func, args, kw); #endif -#if CYTHON_USE_PYTYPE_LOOKUP - object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; -#else - object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; + } #endif - reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD; - if (reduce_ex == object_reduce_ex) { -#if CYTHON_USE_PYTYPE_LOOKUP - object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + Py_ssize_t argc; + PyObject *new_args; + PyObject *self; + argc = PyTuple_GET_SIZE(args); + new_args = PyTuple_GetSlice(args, 1, argc); + if (unlikely(!new_args)) + return NULL; + self = PyTuple_GetItem(args, 0); + if (unlikely(!self)) { + Py_DECREF(new_args); +#if PY_MAJOR_VERSION > 2 + PyErr_Format(PyExc_TypeError, + "unbound method %.200S() needs an argument", + cyfunc->func_qualname); #else - object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; + PyErr_SetString(PyExc_TypeError, + "unbound method needs an argument"); #endif - reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD; - if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) { - reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython); - if (likely(reduce_cython)) { - ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - } else if (reduce == object_reduce || PyErr_Occurred()) { - goto __PYX_BAD; - } - setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate); - if (!setstate) PyErr_Clear(); - if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) { - setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython); - if (likely(setstate_cython)) { - ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - } else if (!setstate || PyErr_Occurred()) { - goto __PYX_BAD; - } - } - PyType_Modified((PyTypeObject*)type_obj); + return NULL; } + result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); + Py_DECREF(new_args); + } else { + result = __Pyx_CyFunction_Call(func, args, kw); + } + return result; +} +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) +{ + int ret = 0; + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + if (unlikely(nargs < 1)) { + PyErr_Format(PyExc_TypeError, "%.200s() needs an argument", + ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); + return -1; + } + ret = 1; + } + if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); + return -1; } - goto __PYX_GOOD; -__PYX_BAD: - if (!PyErr_Occurred()) - PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name); - ret = -1; -__PYX_GOOD: -#if !CYTHON_USE_PYTYPE_LOOKUP - Py_XDECREF(object_reduce); - Py_XDECREF(object_reduce_ex); -#endif - Py_XDECREF(reduce); - Py_XDECREF(reduce_ex); - Py_XDECREF(reduce_cython); - Py_XDECREF(setstate); - Py_XDECREF(setstate_cython); return ret; } - -/* TypeImport */ -#ifndef __PYX_HAVE_RT_ImportType -#define __PYX_HAVE_RT_ImportType -static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name, - size_t size, enum __Pyx_ImportType_CheckSize check_size) +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) { - PyObject *result = 0; - char warning[200]; - Py_ssize_t basicsize; -#ifdef Py_LIMITED_API - PyObject *py_basicsize; + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); #endif - result = PyObject_GetAttrString(module, class_name); - if (!result) - goto bad; - if (!PyType_Check(result)) { + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + if (unlikely(nargs != 0)) { PyErr_Format(PyExc_TypeError, - "%.200s.%.200s is not a type object", - module_name, class_name); - goto bad; + "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + def->ml_name, nargs); + return NULL; } -#ifndef Py_LIMITED_API - basicsize = ((PyTypeObject *)result)->tp_basicsize; + return def->ml_meth(self, NULL); +} +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; #else - py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); - if (!py_basicsize) - goto bad; - basicsize = PyLong_AsSsize_t(py_basicsize); - Py_DECREF(py_basicsize); - py_basicsize = 0; - if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) - goto bad; + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); #endif - if ((size_t)basicsize < size) { - PyErr_Format(PyExc_ValueError, - "%.200s.%.200s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); - goto bad; + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; } - if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) { - PyErr_Format(PyExc_ValueError, - "%.200s.%.200s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); - goto bad; + if (unlikely(nargs != 1)) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + def->ml_name, nargs); + return NULL; } - else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), - "%s.%s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); - if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + return def->ml_meth(self, args[0]); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; } - return (PyTypeObject *)result; -bad: - Py_XDECREF(result); - return NULL; + return ((_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames); } +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; + PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); #endif - -/* GetNameInClass */ -static PyObject *__Pyx_GetGlobalNameAfterAttributeLookup(PyObject *name) { - PyObject *result; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: return NULL; - __Pyx_PyErr_Clear(); - __Pyx_GetModuleGlobalNameUncached(result, name); - return result; + } + return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, (size_t)nargs, kwnames); +} +#endif +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_CyFunctionType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, + {Py_tp_repr, (void *)__Pyx_CyFunction_repr}, + {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, + {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, + {Py_tp_clear, (void *)__Pyx_CyFunction_clear}, + {Py_tp_methods, (void *)__pyx_CyFunction_methods}, + {Py_tp_members, (void *)__pyx_CyFunction_members}, + {Py_tp_getset, (void *)__pyx_CyFunction_getsets}, + {Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, + {0, 0}, +}; +static PyType_Spec __pyx_CyFunctionType_spec = { + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if (defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL) + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, + __pyx_CyFunctionType_slots +}; +#else +static PyTypeObject __pyx_CyFunctionType_type = { + PyVarObject_HEAD_INIT(0, 0) + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, + (destructor) __Pyx_CyFunction_dealloc, +#if !CYTHON_METH_FASTCALL + 0, +#elif CYTHON_BACKPORT_VECTORCALL + (printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall), +#else + offsetof(PyCFunctionObject, vectorcall), +#endif + 0, + 0, +#if PY_MAJOR_VERSION < 3 + 0, +#else + 0, +#endif + (reprfunc) __Pyx_CyFunction_repr, + 0, + 0, + 0, + 0, + __Pyx_CyFunction_CallAsMethod, + 0, + 0, + 0, + 0, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#ifdef _Py_TPFLAGS_HAVE_VECTORCALL + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, + 0, + (traverseproc) __Pyx_CyFunction_traverse, + (inquiry) __Pyx_CyFunction_clear, + 0, +#if PY_VERSION_HEX < 0x030500A0 + offsetof(__pyx_CyFunctionObject, func_weakreflist), +#else + offsetof(PyCFunctionObject, m_weakreflist), +#endif + 0, + 0, + __pyx_CyFunction_methods, + __pyx_CyFunction_members, + __pyx_CyFunction_getsets, + 0, + 0, + __Pyx_PyMethod_New, + 0, + offsetof(__pyx_CyFunctionObject, func_dict), + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, +#if PY_VERSION_HEX >= 0x030400a1 + 0, +#endif +#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, +#endif +#if __PYX_NEED_TP_PRINT_SLOT + 0, +#endif +#if PY_VERSION_HEX >= 0x030C0000 + 0, +#endif +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, +#endif +}; +#endif +static int __pyx_CyFunction_init(PyObject *module) { +#if CYTHON_USE_TYPE_SPECS + __pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL); +#else + CYTHON_UNUSED_VAR(module); + __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); +#endif + if (unlikely(__pyx_CyFunctionType == NULL)) { + return -1; + } + return 0; +} +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults = PyObject_Malloc(size); + if (unlikely(!m->defaults)) + return PyErr_NoMemory(); + memset(m->defaults, 0, size); + m->defaults_pyobjects = pyobjects; + m->defaults_size = size; + return m->defaults; } +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_tuple = tuple; + Py_INCREF(tuple); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_kwdict = dict; + Py_INCREF(dict); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->func_annotations = dict; + Py_INCREF(dict); +} + +/* CythonFunction */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + PyObject *op = __Pyx_CyFunction_Init( + PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType), + ml, flags, qualname, closure, module, globals, code + ); + if (likely(op)) { + PyObject_GC_Track(op); + } + return op; +} + +/* GetNameInClass */ static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name) { PyObject *result; - result = __Pyx_PyObject_GetAttrStr(nmspace, name); - if (!result) { - result = __Pyx_GetGlobalNameAfterAttributeLookup(name); + PyObject *dict; + assert(PyType_Check(nmspace)); +#if CYTHON_USE_TYPE_SLOTS + dict = ((PyTypeObject*)nmspace)->tp_dict; + Py_XINCREF(dict); +#else + dict = PyObject_GetAttr(nmspace, __pyx_n_s_dict); +#endif + if (likely(dict)) { + result = PyObject_GetItem(dict, name); + Py_DECREF(dict); + if (result) { + return result; + } } + PyErr_Clear(); + __Pyx_GetModuleGlobalNameUncached(result, name); return result; } @@ -13877,14 +19842,14 @@ static PyObject* __Pyx_Method_ClassMethod(PyObject *method) { return PyClassMethod_New(method); } #else -#if CYTHON_COMPILING_IN_PYSTON || CYTHON_COMPILING_IN_PYPY +#if CYTHON_COMPILING_IN_PYPY if (PyMethodDescr_Check(method)) #else #if PY_MAJOR_VERSION == 2 static PyTypeObject *methoddescr_type = NULL; - if (methoddescr_type == NULL) { + if (unlikely(methoddescr_type == NULL)) { PyObject *meth = PyObject_GetAttrString((PyObject*)&PyList_Type, "append"); - if (!meth) return NULL; + if (unlikely(!meth)) return NULL; methoddescr_type = Py_TYPE(meth); Py_DECREF(meth); } @@ -13913,12 +19878,13 @@ static PyObject* __Pyx_Method_ClassMethod(PyObject *method) { /* CLineInTraceback */ #ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) { +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { PyObject *use_cline; PyObject *ptype, *pvalue, *ptraceback; #if CYTHON_COMPILING_IN_CPYTHON PyObject **cython_runtime_dict; #endif + CYTHON_MAYBE_UNUSED_VAR(tstate); if (unlikely(!__pyx_cython_runtime)) { return c_line; } @@ -13932,7 +19898,7 @@ static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int } else #endif { - PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); + PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); if (use_cline_obj) { use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; Py_DECREF(use_cline_obj); @@ -13954,6 +19920,7 @@ static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int #endif /* CodeObjectCache */ +#if !CYTHON_COMPILING_IN_LIMITED_API static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { @@ -14032,11 +19999,28 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { __pyx_code_cache.count++; Py_INCREF(code_object); } +#endif /* AddTraceback */ #include "compile.h" #include "frameobject.h" #include "traceback.h" +#if PY_VERSION_HEX >= 0x030b00a6 + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif +#if CYTHON_COMPILING_IN_LIMITED_API +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + if (c_line) { + (void) __pyx_cfilenm; + (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); + } + _PyTraceback_Add(funcname, filename, py_line); +} +#else static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { @@ -14071,6 +20055,7 @@ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( 0, 0, 0, + 0, __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ @@ -14100,14 +20085,24 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject *ptype, *pvalue, *ptraceback; if (c_line) { c_line = __Pyx_CLineForTraceback(tstate, c_line); } py_code = __pyx_find_code_object(c_line ? -c_line : py_line); if (!py_code) { + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); - if (!py_code) goto bad; + if (!py_code) { + /* If the code object creation fails, then we should clear the + fetched exception references and propagate the new exception */ + Py_XDECREF(ptype); + Py_XDECREF(pvalue); + Py_XDECREF(ptraceback); + goto bad; + } + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); } py_frame = PyFrame_New( @@ -14123,6 +20118,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, Py_XDECREF(py_code); Py_XDECREF(py_frame); } +#endif /* CIntFromPyVerify */ #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ @@ -14159,7 +20155,7 @@ static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(size_t) < sizeof(long)) { + if ((sizeof(size_t) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -14173,40 +20169,45 @@ static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (size_t) 0; - case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0]) - case 2: - if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) { - return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(size_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 2 * PyLong_SHIFT)) { + return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) { - return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + break; + case 3: + if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 3 * PyLong_SHIFT)) { + return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) { - return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + break; + case 4: + if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 4 * PyLong_SHIFT)) { + return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -14219,109 +20220,181 @@ static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { goto raise_neg_overflow; } #endif - if (sizeof(size_t) <= sizeof(unsigned long)) { + if ((sizeof(size_t) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (size_t) 0; - case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, +digits[0]) - case -2: - if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { - return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(size_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { - return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + break; + case 2: + if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { - return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + break; + case -3: + if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { - return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + break; + case 3: + if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) { - return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + break; + case -4: + if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) { - return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + break; + case 4: + if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) { + return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(size_t) <= sizeof(long)) { + if ((sizeof(size_t) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(size_t) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else size_t val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (size_t) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (size_t) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (size_t) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (size_t) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (size_t) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(size_t) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((size_t) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(size_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((size_t) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((size_t) 1) << (sizeof(size_t) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (size_t) -1; } } else { @@ -14355,7 +20428,7 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { + if ((sizeof(int) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -14369,40 +20442,45 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -14415,109 +20493,181 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { goto raise_neg_overflow; } #endif - if (sizeof(int) <= sizeof(unsigned long)) { + if ((sizeof(int) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case -3: + if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case -4: + if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(int) <= sizeof(long)) { + if ((sizeof(int) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else int val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (int) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (int) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (int) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (int) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((int) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (int) -1; } } else { @@ -14551,7 +20701,7 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { + if ((sizeof(long) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -14565,40 +20715,45 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -14611,109 +20766,181 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { goto raise_neg_overflow; } #endif - if (sizeof(long) <= sizeof(unsigned long)) { + if ((sizeof(long) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) - case -2: - if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case -3: + if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case -4: + if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(long) <= sizeof(long)) { + if ((sizeof(long) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else long val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (long) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (long) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (long) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (long) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (long) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((long) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((long) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (long) -1; } } else { @@ -14848,115 +21075,52 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { } } -/* FastTypeChecks */ -#if CYTHON_COMPILING_IN_CPYTHON -static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { - while (a) { - a = a->tp_base; - if (a == b) - return 1; - } - return b == &PyBaseObject_Type; -} -static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { - PyObject *mro; - if (a == b) return 1; - mro = a->tp_mro; - if (likely(mro)) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(mro); - for (i = 0; i < n; i++) { - if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) - return 1; - } - return 0; - } - return __Pyx_InBases(a, b); -} -#if PY_MAJOR_VERSION == 2 -static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { - PyObject *exception, *value, *tb; - int res; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&exception, &value, &tb); - res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; - } - if (!res) { - res = PyObject_IsSubclass(err, exc_type2); - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; - } - } - __Pyx_ErrRestore(exception, value, tb); - return res; -} -#else -static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { - int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0; - if (!res) { - res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); - } - return res; -} -#endif -static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - assert(PyExceptionClass_Check(exc_type)); - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; i '9'); + break; + } + if (rt_from_call[i] != ctversion[i]) { + same = 0; + break; + } + } + if (!same) { + char rtversion[5] = {'\0'}; char message[200]; + for (i=0; i<4; ++i) { + if (rt_from_call[i] == '.') { + if (found_dot) break; + found_dot = 1; + } else if (rt_from_call[i] < '0' || rt_from_call[i] > '9') { + break; + } + rtversion[i] = rt_from_call[i]; + } PyOS_snprintf(message, sizeof(message), - "compiletime version %s of module '%.100s' " + "compile time version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); return PyErr_WarnEx(NULL, message, 1); @@ -14965,9 +21129,9 @@ static int __Pyx_check_binary_version(void) { } /* FunctionImport */ -#ifndef __PYX_HAVE_RT_ImportFunction -#define __PYX_HAVE_RT_ImportFunction -static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { +#ifndef __PYX_HAVE_RT_ImportFunction_3_0_0 +#define __PYX_HAVE_RT_ImportFunction_3_0_0 +static int __Pyx_ImportFunction_3_0_0(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { PyObject *d = 0; PyObject *cobj = 0; union { @@ -14984,7 +21148,6 @@ static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (** PyModule_GetName(module), funcname); goto bad; } -#if PY_VERSION_HEX >= 0x02070000 if (!PyCapsule_IsValid(cobj, sig)) { PyErr_Format(PyExc_TypeError, "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", @@ -14992,21 +21155,6 @@ static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (** goto bad; } tmp.p = PyCapsule_GetPointer(cobj, sig); -#else - {const char *desc, *s1, *s2; - desc = (const char *)PyCObject_GetDesc(cobj); - if (!desc) - goto bad; - s1 = desc; s2 = sig; - while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } - if (*s1 != *s2) { - PyErr_Format(PyExc_TypeError, - "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", - PyModule_GetName(module), funcname, sig, desc); - goto bad; - } - tmp.p = PyCObject_AsVoidPtr(cobj);} -#endif *f = tmp.fp; if (!(*f)) goto bad; @@ -15019,9 +21167,31 @@ static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (** #endif /* InitStrings */ +#if PY_MAJOR_VERSION >= 3 +static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) { + if (t.is_unicode | t.is_str) { + if (t.intern) { + *str = PyUnicode_InternFromString(t.s); + } else if (t.encoding) { + *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL); + } else { + *str = PyUnicode_FromStringAndSize(t.s, t.n - 1); + } + } else { + *str = PyBytes_FromStringAndSize(t.s, t.n - 1); + } + if (!*str) + return -1; + if (PyObject_Hash(*str) == -1) + return -1; + return 0; +} +#endif static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { - #if PY_MAJOR_VERSION < 3 + #if PY_MAJOR_VERSION >= 3 + __Pyx_InitString(*t, t->p); + #else if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { @@ -15029,23 +21199,11 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } - #else - 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; if (PyObject_Hash(*t->p) == -1) return -1; + #endif ++t; } return 0; @@ -15107,7 +21265,7 @@ static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ return __Pyx_PyUnicode_AsStringAndSize(o, length); } else #endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) +#if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) if (PyByteArray_Check(o)) { *length = PyByteArray_GET_SIZE(o); return PyByteArray_AS_STRING(o); @@ -15136,22 +21294,26 @@ static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { return retval; } static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { + __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result)); #if PY_MAJOR_VERSION >= 3 if (PyLong_Check(result)) { if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, - "__int__ returned non-int (type %.200s). " - "The ability to return an instance of a strict subclass of int " - "is deprecated, and may be removed in a future version of Python.", - Py_TYPE(result)->tp_name)) { + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " + "The ability to return an instance of a strict subclass of int is deprecated, " + "and may be removed in a future version of Python.", + result_type_name)) { + __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } + __Pyx_DECREF_TypeName(result_type_name); return result; } #endif PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type %.200s)", - type_name, type_name, Py_TYPE(result)->tp_name); + "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")", + type_name, type_name, result_type_name); + __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } @@ -15217,13 +21379,11 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { #endif if (likely(PyLong_CheckExact(b))) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)b)->ob_digit; - const Py_ssize_t size = Py_SIZE(b); - if (likely(__Pyx_sst_abs(size) <= 1)) { - ival = likely(size) ? digits[0] : 0; - if (size == -1) ival = -ival; - return ival; + if (likely(__Pyx_PyLong_IsCompact(b))) { + return __Pyx_PyLong_CompactValue(b); } else { + const digit* digits = __Pyx_PyLong_Digits(b); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); switch (size) { case 2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { @@ -15291,4 +21451,12 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { } +/* #### Code section: utility_code_pragmas_end ### */ +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + + + +/* #### Code section: end ### */ #endif /* Py_PYTHON_H */ diff --git a/arrex/numbers.c b/arrex/numbers.c index 828280b..314643c 100644 --- a/arrex/numbers.c +++ b/arrex/numbers.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.29.28 */ +/* Generated by Cython 3.0.0 */ /* BEGIN: Cython Metadata { @@ -16,20 +16,49 @@ END: Cython Metadata */ #ifndef PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN #endif /* PY_SSIZE_T_CLEAN */ +#if defined(CYTHON_LIMITED_API) && 0 + #ifndef Py_LIMITED_API + #if CYTHON_LIMITED_API+0 > 0x03030000 + #define Py_LIMITED_API CYTHON_LIMITED_API + #else + #define Py_LIMITED_API 0x03030000 + #endif + #endif +#endif + #include "Python.h" + + #if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyFloat_FromString(obj) PyFloat_FromString(obj) + #else + #define __Pyx_PyFloat_FromString(obj) PyFloat_FromString(obj, NULL) + #endif + + + #if PY_MAJOR_VERSION <= 2 + #define PyDict_GetItemWithError _PyDict_GetItemWithError + #endif + + + #if (PY_VERSION_HEX < 0x030700b1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030600)) && !defined(PyContextVar_Get) + #define PyContextVar_Get(var, d, v) ((d) ? ((void)(var), Py_INCREF(d), (v)[0] = (d), 0) : ((v)[0] = NULL, 0) ) + #endif + #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) - #error Cython requires Python 2.6+ or Python 3.3+. +#elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) + #error Cython requires Python 2.7+ or Python 3.3+. #else -#define CYTHON_ABI "0_29_28" -#define CYTHON_HEX_VERSION 0x001D1CF0 +#define CYTHON_ABI "3_0_0" +#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI +#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." +#define CYTHON_HEX_VERSION 0x030000F0 #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif -#if !defined(WIN32) && !defined(MS_WINDOWS) +#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif @@ -48,9 +77,7 @@ END: Cython Metadata */ #endif #define __PYX_COMMA , #ifndef HAVE_LONG_LONG - #if PY_VERSION_HEX >= 0x02070000 - #define HAVE_LONG_LONG - #endif + #define HAVE_LONG_LONG #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG @@ -58,12 +85,18 @@ END: Cython Metadata */ #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif -#ifdef PYPY_VERSION - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_PYSTON 0 +#if defined(GRAALVM_PYTHON) + /* For very preliminary testing purposes. Most variables are set the same as PyPy. + The existence of this section does not imply that anything works or is even tested */ + #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 1 + #define CYTHON_COMPILING_IN_NOGIL 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #if PY_VERSION_HEX < 0x03050000 @@ -88,27 +121,159 @@ END: Cython Metadata */ #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) + #endif #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 -#elif defined(PYSTON_VERSION) + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif +#elif defined(PYPY_VERSION) + #define CYTHON_COMPILING_IN_PYPY 1 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) + #endif + #if PY_VERSION_HEX < 0x03090000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00) + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif +#elif defined(CYTHON_LIMITED_API) #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 1 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 1 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 0 + #undef CYTHON_CLINE_IN_TRACEBACK + #define CYTHON_CLINE_IN_TRACEBACK 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 1 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #endif + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 1 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif +#elif defined(PY_NOGIL) + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 1 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 + #ifndef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 #ifndef CYTHON_USE_UNICODE_INTERNALS @@ -131,25 +296,29 @@ END: Cython Metadata */ #define CYTHON_FAST_THREAD_STATE 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 - #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 1 + #endif #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #else #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 1 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 0 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #ifndef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 1 #endif #if PY_MAJOR_VERSION < 3 @@ -158,10 +327,7 @@ END: Cython Metadata */ #elif !defined(CYTHON_USE_ASYNC_SLOTS) #define CYTHON_USE_ASYNC_SLOTS 1 #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #elif !defined(CYTHON_USE_PYLONG_INTERNALS) + #ifndef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 1 #endif #ifndef CYTHON_USE_PYLIST_INTERNALS @@ -185,34 +351,59 @@ END: Cython Metadata */ #ifndef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 1 #endif - #if PY_VERSION_HEX >= 0x030B00A4 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #elif !defined(CYTHON_FAST_THREAD_STATE) + #ifndef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 1 #endif + #ifndef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6) + #endif + #ifndef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1) + #endif #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030B00A1) + #define CYTHON_FAST_PYCALL 1 #endif - #ifndef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 #endif - #ifndef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 #endif - #ifndef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1) + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 #endif - #if PY_VERSION_HEX >= 0x030B00A4 + #if PY_VERSION_HEX < 0x030400a1 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #elif !defined(CYTHON_USE_TP_FINALIZE) + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #if PY_VERSION_HEX < 0x030600B1 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #elif !defined(CYTHON_USE_DICT_VERSIONS) + #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5) + #endif + #if PY_VERSION_HEX < 0x030700A3 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #elif !defined(CYTHON_USE_EXC_INFO_STACK) - #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3) + #define CYTHON_USE_EXC_INFO_STACK 1 + #endif + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 #endif #endif #if !defined(CYTHON_FAST_PYCCALL) #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif +#if !defined(CYTHON_VECTORCALL) +#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1) +#endif +#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1) #if CYTHON_USE_PYLONG_INTERNALS #if PY_MAJOR_VERSION < 3 #include "longintrepr.h" @@ -241,6 +432,17 @@ END: Cython Metadata */ #define CYTHON_RESTRICT #endif #endif +#ifndef CYTHON_UNUSED + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(maybe_unused) + #define CYTHON_UNUSED [[maybe_unused]] + #endif + #endif + #endif +#endif #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) @@ -254,13 +456,16 @@ END: Cython Metadata */ # define CYTHON_UNUSED # endif #endif -#ifndef CYTHON_MAYBE_UNUSED_VAR +#ifndef CYTHON_UNUSED_VAR # if defined(__cplusplus) - template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } + template void CYTHON_UNUSED_VAR( const T& ) { } # else -# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) +# define CYTHON_UNUSED_VAR(x) (void)(x) # endif #endif +#ifndef CYTHON_MAYBE_UNUSED_VAR + #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) +#endif #ifndef CYTHON_NCP_UNUSED # if CYTHON_COMPILING_IN_CPYTHON # define CYTHON_NCP_UNUSED @@ -272,24 +477,47 @@ END: Cython Metadata */ #ifdef _MSC_VER #ifndef _MSC_STDINT_H_ #if _MSC_VER < 1300 - typedef unsigned char uint8_t; - typedef unsigned int uint32_t; + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; #else - typedef unsigned __int8 uint8_t; - typedef unsigned __int32 uint32_t; + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; + #endif + #endif + #if _MSC_VER < 1300 + #ifdef _WIN64 + typedef unsigned long long __pyx_uintptr_t; + #else + typedef unsigned int __pyx_uintptr_t; + #endif + #else + #ifdef _WIN64 + typedef unsigned __int64 __pyx_uintptr_t; + #else + typedef unsigned __int32 __pyx_uintptr_t; #endif #endif #else - #include + #include + typedef uintptr_t __pyx_uintptr_t; #endif #ifndef CYTHON_FALLTHROUGH - #if defined(__cplusplus) && __cplusplus >= 201103L - #if __has_cpp_attribute(fallthrough) - #define CYTHON_FALLTHROUGH [[fallthrough]] - #elif __has_cpp_attribute(clang::fallthrough) - #define CYTHON_FALLTHROUGH [[clang::fallthrough]] - #elif __has_cpp_attribute(gnu::fallthrough) - #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #endif #endif #endif #ifndef CYTHON_FALLTHROUGH @@ -299,13 +527,26 @@ END: Cython Metadata */ #define CYTHON_FALLTHROUGH #endif #endif - #if defined(__clang__ ) && defined(__apple_build_version__) + #if defined(__clang__) && defined(__apple_build_version__) #if __apple_build_version__ < 7000000 #undef CYTHON_FALLTHROUGH #define CYTHON_FALLTHROUGH #endif #endif #endif +#ifdef __cplusplus + template + struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; + #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value) +#else + #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) +#endif +#if CYTHON_COMPILING_IN_PYPY == 1 + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000) +#else + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000) +#endif +#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) #ifndef CYTHON_INLINE #if defined(__clang__) @@ -321,35 +562,32 @@ END: Cython Metadata */ #endif #endif -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyClass_Type + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_DefaultClassType PyType_Type #if PY_VERSION_HEX >= 0x030B00A1 - static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f, + static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, PyObject *code, PyObject *c, PyObject* n, PyObject *v, PyObject *fv, PyObject *cell, PyObject* fn, PyObject *name, int fline, PyObject *lnos) { PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; - PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL; + PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *empty=NULL; const char *fn_cstr=NULL; const char *name_cstr=NULL; - PyCodeObject* co=NULL; + PyCodeObject *co=NULL, *result=NULL; PyObject *type, *value, *traceback; PyErr_Fetch(&type, &value, &traceback); if (!(kwds=PyDict_New())) goto end; if (!(argcount=PyLong_FromLong(a))) goto end; if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end; - if (!(posonlyargcount=PyLong_FromLong(0))) goto end; + if (!(posonlyargcount=PyLong_FromLong(p))) goto end; if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end; if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end; @@ -369,18 +607,11 @@ END: Cython Metadata */ if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; - if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too; - if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here - if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too; - Py_XDECREF((PyObject*)co); - co = (PyCodeObject*)call_result; - call_result = NULL; - if (0) { - cleanup_code_too: - Py_XDECREF((PyObject*)co); - co = NULL; - } - end: + if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto end; + if (!(empty = PyTuple_New(0))) goto end; + result = (PyCodeObject*) PyObject_Call(replace, empty, kwds); + end: + Py_XDECREF((PyObject*) co); Py_XDECREF(kwds); Py_XDECREF(argcount); Py_XDECREF(posonlyargcount); @@ -388,18 +619,56 @@ END: Cython Metadata */ Py_XDECREF(nlocals); Py_XDECREF(stacksize); Py_XDECREF(replace); - Py_XDECREF(call_result); Py_XDECREF(empty); if (type) { PyErr_Restore(type, value, traceback); } - return co; + return result; } +#elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif - #define __Pyx_DefaultClassType PyType_Type +#endif +#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) + #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) +#else + #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) + #define __Pyx_Py_Is(x, y) Py_Is(x, y) +#else + #define __Pyx_Py_Is(x, y) ((x) == (y)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) + #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) +#else + #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) + #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) +#else + #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) + #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) +#else + #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) +#endif +#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) +#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) +#else + #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) +#endif +#ifndef CO_COROUTINE + #define CO_COROUTINE 0x80 +#endif +#ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x200 #endif #ifndef Py_TPFLAGS_CHECKTYPES #define Py_TPFLAGS_CHECKTYPES 0 @@ -413,6 +682,12 @@ END: Cython Metadata */ #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif +#ifndef Py_TPFLAGS_SEQUENCE + #define Py_TPFLAGS_SEQUENCE 0 +#endif +#ifndef Py_TPFLAGS_MAPPING + #define Py_TPFLAGS_MAPPING 0 +#endif #ifndef METH_STACKLESS #define METH_STACKLESS 0 #endif @@ -427,30 +702,53 @@ END: Cython Metadata */ #define __Pyx_PyCFunctionFast _PyCFunctionFast #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords #endif -#if CYTHON_FAST_PYCCALL -#define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))))) +#if CYTHON_METH_FASTCALL + #define __Pyx_METH_FASTCALL METH_FASTCALL + #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast + #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords +#else + #define __Pyx_METH_FASTCALL METH_VARARGS + #define __Pyx_PyCFunction_FastCall PyCFunction + #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords +#endif +#if CYTHON_VECTORCALL + #define __pyx_vectorcallfunc vectorcallfunc + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET + #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) +#elif CYTHON_BACKPORT_VECTORCALL + typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args, + size_t nargsf, PyObject *kwnames); + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1)) + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)) +#else + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) +#endif +#if PY_VERSION_HEX < 0x030900B1 + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) + typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); #else -#define __Pyx_PyFastCFunction_Check(func) 0 + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) + #define __Pyx_PyCMethod PyCMethod +#endif +#ifndef METH_METHOD + #define METH_METHOD 0x200 #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) #define PyObject_Malloc(s) PyMem_Malloc(s) #define PyObject_Free(p) PyMem_Free(p) #define PyObject_Realloc(p) PyMem_Realloc(p) #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1 - #define PyMem_RawMalloc(n) PyMem_Malloc(n) - #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) - #define PyMem_RawFree(p) PyMem_Free(p) -#endif -#if CYTHON_COMPILING_IN_PYSTON - #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) #else #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) #endif -#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyThreadState_Current PyThreadState_Get() +#elif !CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_Current PyThreadState_GET() #elif PY_VERSION_HEX >= 0x03060000 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() @@ -459,6 +757,22 @@ END: Cython Metadata */ #else #define __Pyx_PyThreadState_Current _PyThreadState_Current #endif +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op) +{ + void *result; + result = PyModule_GetState(op); + if (!result) + Py_FatalError("Couldn't find the module state"); + return result; +} +#endif +#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) +#else + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) +#endif #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) #include "pythread.h" #define Py_tss_NEEDS_INIT 0 @@ -489,6 +803,28 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { return PyThread_get_key_value(*key); } #endif +#if PY_MAJOR_VERSION < 3 + #if CYTHON_COMPILING_IN_PYPY + #if PYPY_VERSION_NUM < 0x07030600 + #if defined(__cplusplus) && __cplusplus >= 201402L + [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]] + #elif defined(__GNUC__) || defined(__clang__) + __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))) + #elif defined(_MSC_VER) + __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")) + #endif + static CYTHON_INLINE int PyGILState_Check(void) { + return 0; + } + #else // PYPY_VERSION_NUM < 0x07030600 + #endif // PYPY_VERSION_NUM < 0x07030600 + #else + static CYTHON_INLINE int PyGILState_Check(void) { + PyThreadState * tstate = _PyThreadState_Current; + return tstate && (tstate == PyGILState_GetThisThreadState()); + } + #endif +#endif #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) #else @@ -501,34 +837,86 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS -#define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && CYTHON_USE_UNICODE_INTERNALS +#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { + PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); + if (res == NULL) PyErr_Clear(); + return res; +} +#elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000) +#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#else +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { +#if CYTHON_COMPILING_IN_PYPY + return PyDict_GetItem(dict, name); +#else + PyDictEntry *ep; + PyDictObject *mp = (PyDictObject*) dict; + long hash = ((PyStringObject *) name)->ob_shash; + assert(hash != -1); + ep = (mp->ma_lookup)(mp, name, hash); + if (ep == NULL) { + return NULL; + } + return ep->me_value; +#endif +} +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#endif +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) + #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) + #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext) #else -#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) + #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) + #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) + #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next +#endif +#if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000 +#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ + PyTypeObject *type = Py_TYPE(obj);\ + assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ + PyObject_GC_Del(obj);\ + Py_DECREF(type);\ +} +#else +#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) #endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) +#if CYTHON_COMPILING_IN_LIMITED_API #define CYTHON_PEP393_ENABLED 1 - #if defined(PyUnicode_IS_READY) - #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ - 0 : _PyUnicode_Ready((PyObject *)(op))) - #else #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) + #define __Pyx_PyUnicode_DATA(u) ((void*)u) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) +#elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_READY(op) (0) + #else + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ + 0 : _PyUnicode_Ready((PyObject *)(op))) #endif #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) + #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) - #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE) - #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) - #else - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) - #endif + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch) + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) #else - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) + #else + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) + #endif #endif #else #define CYTHON_PEP393_ENABLED 0 @@ -538,11 +926,11 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) - #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE)) #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) #endif #if CYTHON_COMPILING_IN_PYPY @@ -553,14 +941,20 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) #endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) +#if CYTHON_COMPILING_IN_PYPY + #if !defined(PyUnicode_DecodeUnicodeEscape) + #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) + #endif + #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500) + #undef PyUnicode_Contains + #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) + #endif + #if !defined(PyByteArray_Check) + #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) + #endif + #if !defined(PyObject_Format) + #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) + #endif #endif #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) @@ -589,8 +983,14 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) #endif +#if CYTHON_COMPILING_IN_CPYTHON + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#else + #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) +#endif #ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) + #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) #endif #if PY_VERSION_HEX >= 0x030900A4 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) @@ -609,6 +1009,8 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define __Pyx_Py3Int_Check(op) PyLong_Check(op) + #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong @@ -620,6 +1022,9 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define PyNumber_Int PyNumber_Long +#else + #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op)) + #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op)) #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject @@ -637,11 +1042,6 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t #endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) -#endif #if CYTHON_USE_ASYNC_SLOTS #if PY_VERSION_HEX >= 0x030500B1 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods @@ -660,8 +1060,10 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { } __Pyx_PyAsyncMethodsStruct; #endif -#if defined(WIN32) || defined(MS_WINDOWS) - #define _USE_MATH_DEFINES +#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) + #if !defined(_USE_MATH_DEFINES) + #define _USE_MATH_DEFINES + #endif #endif #include #ifdef NAN @@ -684,7 +1086,16 @@ static CYTHON_INLINE float __PYX_NAN() { #define __PYX_ERR(f_index, lineno, Ln_error) \ { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } -#ifndef __PYX_EXTERN_C +#ifdef CYTHON_EXTERN_C + #undef __PYX_EXTERN_C + #define __PYX_EXTERN_C CYTHON_EXTERN_C +#elif defined(__PYX_EXTERN_C) + #ifdef _MSC_VER + #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") + #else + #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. + #endif +#else #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else @@ -767,9 +1178,9 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) @@ -777,11 +1188,22 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const wchar_t *u) +{ + const wchar_t *u_end = u; + while (*u_end++) ; + return (size_t)(u_end - u - 1); +} +#else +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) +{ const Py_UNICODE *u_end = u; while (*u_end++) ; return (size_t)(u_end - u - 1); } +#endif +#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode @@ -807,7 +1229,52 @@ static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #else #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) #endif -#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) +#if CYTHON_USE_PYLONG_INTERNALS + #if PY_VERSION_HEX >= 0x030C00A7 + #ifndef _PyLong_SIGN_MASK + #define _PyLong_SIGN_MASK 3 + #endif + #ifndef _PyLong_NON_SIZE_BITS + #define _PyLong_NON_SIZE_BITS 3 + #endif + #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) + #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) + #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) + #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) + #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_SignedDigitCount(x)\ + ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) + #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) + #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) + #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) + #else + #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) + #endif + typedef Py_ssize_t __Pyx_compact_pylong; + typedef size_t __Pyx_compact_upylong; + #else // Py < 3.12 + #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) + #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) + #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) + #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) + #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) + #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) + #define __Pyx_PyLong_CompactValue(x)\ + ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) + typedef sdigit __Pyx_compact_pylong; + typedef digit __Pyx_compact_upylong; + #endif + #if PY_VERSION_HEX >= 0x030C00A5 + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) + #else + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) + #endif +#endif #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII static int __Pyx_sys_getdefaultencoding_not_ascii; static int __Pyx_init_sys_getdefaultencoding_params(void) { @@ -829,7 +1296,7 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { char ascii_chars[128]; int c; for (c = 0; c < 128; c++) { - ascii_chars[c] = c; + ascii_chars[c] = (char) c; } __Pyx_sys_getdefaultencoding_not_ascii = 1; ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); @@ -894,29 +1361,57 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { #endif /* __GNUC__ */ static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } +#if !CYTHON_USE_MODULE_STATE static PyObject *__pyx_m = NULL; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_cython_runtime = NULL; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static PyObject *__pyx_empty_unicode; +#endif static int __pyx_lineno; static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; +static const char * __pyx_cfilenm = __FILE__; static const char *__pyx_filename; +/* #### Code section: filename_table ### */ static const char *__pyx_f[] = { + "contextvars.pxd", "arrex/numbers.pyx", "type.pxd", "bool.pxd", "complex.pxd", "arrex/dtypes.pxd", }; +/* #### Code section: utility_code_proto_before_types ### */ +/* #### Code section: numeric_typedefs ### */ +/* #### Code section: complex_type_declarations ### */ +/* #### Code section: type_declarations ### */ /*--- Type declarations ---*/ struct __pyx_obj_5arrex_6dtypes_DDType; +struct __pyx_opt_args_7cpython_11contextvars_get_value; +struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default; + +/* "cpython/contextvars.pxd":112 + * + * + * cdef inline object get_value(var, default_value=None): # <<<<<<<<<<<<<< + * """Return a new reference to the value of the context variable, + * or the default value of the context variable, + */ +struct __pyx_opt_args_7cpython_11contextvars_get_value { + int __pyx_n; + PyObject *default_value; +}; + +/* "cpython/contextvars.pxd":129 + * + * + * cdef inline object get_value_no_default(var, default_value=None): # <<<<<<<<<<<<<< + * """Return a new reference to the value of the context variable, + * or the provided default value if no such value was found. + */ +struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default { + int __pyx_n; + PyObject *default_value; +}; struct __pyx_opt_args_5arrex_6dtypes_declare; /* "dtypes.pxd":11 @@ -964,6 +1459,7 @@ struct __pyx_obj_5arrex_6dtypes_DDType { PyObject *key; }; +/* #### Code section: utility_code_proto ### */ /* --- Runtime support code (head) --- */ /* Refnanny.proto */ @@ -972,11 +1468,11 @@ struct __pyx_obj_5arrex_6dtypes_DDType { #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 (*INCREF)(void*, PyObject*, Py_ssize_t); + void (*DECREF)(void*, PyObject*, Py_ssize_t); + void (*GOTREF)(void*, PyObject*, Py_ssize_t); + void (*GIVEREF)(void*, PyObject*, Py_ssize_t); + void* (*SetupContext)(const char*, Py_ssize_t, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; @@ -986,28 +1482,40 @@ struct __pyx_obj_5arrex_6dtypes_DDType { #define __Pyx_RefNannySetupContext(name, acquire_gil)\ if (acquire_gil) {\ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ PyGILState_Release(__pyx_gilstate_save);\ } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__)) + #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext() #endif + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } #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) + #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); else {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContextNogil() #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) @@ -1018,6 +1526,10 @@ struct __pyx_obj_5arrex_6dtypes_DDType { #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif +#define __Pyx_Py_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; Py_XDECREF(tmp);\ + } while (0) #define __Pyx_XDECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_XDECREF(tmp);\ @@ -1030,31 +1542,48 @@ struct __pyx_obj_5arrex_6dtypes_DDType { #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) /* TypeImport.proto */ -#ifndef __PYX_HAVE_RT_ImportType_proto -#define __PYX_HAVE_RT_ImportType_proto -enum __Pyx_ImportType_CheckSize { - __Pyx_ImportType_CheckSize_Error = 0, - __Pyx_ImportType_CheckSize_Warn = 1, - __Pyx_ImportType_CheckSize_Ignore = 2 +#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_0 +#define __PYX_HAVE_RT_ImportType_proto_3_0_0 +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +#include +#endif +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_0(s) alignof(s) +#else +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_0(s) sizeof(void*) +#endif +enum __Pyx_ImportType_CheckSize_3_0_0 { + __Pyx_ImportType_CheckSize_Error_3_0_0 = 0, + __Pyx_ImportType_CheckSize_Warn_3_0_0 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_0_0 = 2 }; -static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size); +static PyTypeObject *__Pyx_ImportType_3_0_0(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_0 check_size); #endif /* PyFunctionFastCall.proto */ #if CYTHON_FAST_PYCALL +#if !CYTHON_VECTORCALL #define __Pyx_PyFunction_FastCall(func, args, nargs)\ __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); -#else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) #endif #define __Pyx_BUILD_ASSERT_EXPR(cond)\ (sizeof(char [1 - 2*!(cond)]) - 1) #ifndef Py_MEMBER_SIZE #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) #endif -#if CYTHON_FAST_PYCALL +#if !CYTHON_VECTORCALL +#if PY_VERSION_HEX >= 0x03080000 + #include "frameobject.h" +#if PY_VERSION_HEX >= 0x030b00a6 + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif + #define __Pxy_PyFrame_Initialize_Offsets() + #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus) +#else static size_t __pyx_pyframe_localsplus_offset = 0; #include "frameobject.h" #define __Pxy_PyFrame_Initialize_Offsets()\ @@ -1062,7 +1591,8 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) #define __Pyx_PyFrame_GetLocalsplus(frame)\ (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) -#endif // CYTHON_FAST_PYCALL +#endif +#endif #endif /* PyObjectCall.proto */ @@ -1077,12 +1607,12 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); #endif +/* PyObjectFastCall.proto */ +#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs); + /* PyObjectCallNoArg.proto */ -#if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); -#else -#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) -#endif /* PyDictVersioning.proto */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS @@ -1110,22 +1640,30 @@ static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UIN #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); #endif -/* PyObjectGetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); +/* PyErrExceptionMatches.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); #else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) #endif /* PyThreadStateGet.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; -#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type +#if PY_VERSION_HEX >= 0x030C00A6 +#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) +#else +#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) +#endif #else #define __Pyx_PyThreadState_declare #define __Pyx_PyThreadState_assign -#define __Pyx_PyErr_Occurred() PyErr_Occurred() +#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) +#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() #endif /* PyErrFetchRestore.proto */ @@ -1137,7 +1675,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) #else #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) @@ -1153,6 +1691,16 @@ static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) #endif +/* PyObjectGetAttrStr.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +/* PyObjectGetAttrStrNoError.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + /* CLineInTraceback.proto */ #ifdef CYTHON_CLINE_IN_TRACEBACK #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) @@ -1161,6 +1709,7 @@ static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); #endif /* CodeObjectCache.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API typedef struct { PyCodeObject* code_object; int code_line; @@ -1174,13 +1723,14 @@ static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); +#endif /* AddTraceback.proto */ static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); /* GCCDiagnostics.proto */ -#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) #define __Pyx_HAS_GCC_DIAGNOSTIC #endif @@ -1232,6 +1782,19 @@ static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint64_t(uint64_t value); +/* FormatTypeName.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%U" +static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp); +#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) +#else +typedef const char *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%.200s" +#define __Pyx_PyType_GetName(tp) ((tp)->tp_name) +#define __Pyx_DECREF_TypeName(obj) +#endif + /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); @@ -1244,184 +1807,889 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); /* FastTypeChecks.proto */ #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); #else #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) #endif +#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); /* FunctionImport.proto */ -static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); +static int __Pyx_ImportFunction_3_0_0(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); +/* #### Code section: module_declarations ### */ +static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4real_real(PyComplexObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4imag_imag(PyComplexObject *__pyx_v_self); /* proto*/ + +/* Module declarations from "cython" */ + +/* Module declarations from "cpython.version" */ + +/* Module declarations from "__builtin__" */ + +/* Module declarations from "cpython.type" */ + +/* Module declarations from "libc.string" */ + +/* Module declarations from "libc.stdio" */ + +/* Module declarations from "cpython.object" */ + +/* Module declarations from "cpython.ref" */ -/* Module declarations from 'cython' */ +/* Module declarations from "cpython.exc" */ -/* Module declarations from 'cpython.version' */ +/* Module declarations from "cpython.module" */ -/* Module declarations from '__builtin__' */ +/* Module declarations from "cpython.mem" */ -/* Module declarations from 'cpython.type' */ -static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; +/* Module declarations from "cpython.tuple" */ -/* Module declarations from 'libc.string' */ +/* Module declarations from "cpython.list" */ -/* Module declarations from 'libc.stdio' */ +/* Module declarations from "cpython.sequence" */ -/* Module declarations from 'cpython.object' */ +/* Module declarations from "cpython.mapping" */ -/* Module declarations from 'cpython.ref' */ +/* Module declarations from "cpython.iterator" */ -/* Module declarations from 'cpython.exc' */ +/* Module declarations from "cpython.number" */ -/* Module declarations from 'cpython.module' */ +/* Module declarations from "cpython.int" */ -/* Module declarations from 'cpython.mem' */ +/* Module declarations from "__builtin__" */ -/* Module declarations from 'cpython.tuple' */ +/* Module declarations from "cpython.bool" */ -/* Module declarations from 'cpython.list' */ +/* Module declarations from "cpython.long" */ -/* Module declarations from 'cpython.sequence' */ +/* Module declarations from "cpython.float" */ -/* Module declarations from 'cpython.mapping' */ +/* Module declarations from "__builtin__" */ -/* Module declarations from 'cpython.iterator' */ +/* Module declarations from "cpython.complex" */ -/* Module declarations from 'cpython.number' */ +/* Module declarations from "cpython.string" */ -/* Module declarations from 'cpython.int' */ +/* Module declarations from "cpython.unicode" */ + +/* Module declarations from "cpython.pyport" */ + +/* Module declarations from "cpython.dict" */ + +/* Module declarations from "cpython.instance" */ + +/* Module declarations from "cpython.function" */ + +/* Module declarations from "cpython.method" */ + +/* Module declarations from "cpython.weakref" */ + +/* Module declarations from "cpython.getargs" */ + +/* Module declarations from "cpython.pythread" */ + +/* Module declarations from "cpython.pystate" */ + +/* Module declarations from "cpython.cobject" */ + +/* Module declarations from "cpython.oldbuffer" */ + +/* Module declarations from "cpython.set" */ + +/* Module declarations from "cpython.buffer" */ + +/* Module declarations from "cpython.bytes" */ + +/* Module declarations from "cpython.pycapsule" */ + +/* Module declarations from "cpython.contextvars" */ + +/* Module declarations from "cpython" */ + +/* Module declarations from "libc.stdint" */ + +/* Module declarations from "arrex.dtypes" */ +static struct __pyx_obj_5arrex_6dtypes_DDType *(*__pyx_f_5arrex_6dtypes_declare)(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_5arrex_6dtypes_declare *__pyx_optional_args); /*proto*/ +static struct __pyx_obj_5arrex_6dtypes_DDType *(*__pyx_f_5arrex_6dtypes_declared)(PyObject *, int __pyx_skip_dispatch); /*proto*/ + +/* Module declarations from "arrex.numbers" */ +static struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_v_5arrex_7numbers_decl = 0; +static int __pyx_f_5arrex_7numbers_pack_d(PyObject *, double *, PyObject *); /*proto*/ +static PyObject *__pyx_f_5arrex_7numbers_unpack_d(PyObject *, double *); /*proto*/ +static int __pyx_f_5arrex_7numbers_pack_f(PyObject *, float *, PyObject *); /*proto*/ +static PyObject *__pyx_f_5arrex_7numbers_unpack_f(PyObject *, float *); /*proto*/ +static int __pyx_f_5arrex_7numbers_pack_b(PyObject *, int8_t *, PyObject *); /*proto*/ +static PyObject *__pyx_f_5arrex_7numbers_unpack_b(PyObject *, int8_t *); /*proto*/ +static int __pyx_f_5arrex_7numbers_pack_B(PyObject *, uint8_t *, PyObject *); /*proto*/ +static PyObject *__pyx_f_5arrex_7numbers_unpack_B(PyObject *, uint8_t *); /*proto*/ +static int __pyx_f_5arrex_7numbers_pack_h(PyObject *, int16_t *, PyObject *); /*proto*/ +static PyObject *__pyx_f_5arrex_7numbers_unpack_h(PyObject *, int16_t *); /*proto*/ +static int __pyx_f_5arrex_7numbers_pack_H(PyObject *, uint16_t *, PyObject *); /*proto*/ +static PyObject *__pyx_f_5arrex_7numbers_unpack_H(PyObject *, uint16_t *); /*proto*/ +static int __pyx_f_5arrex_7numbers_pack_i(PyObject *, int32_t *, PyObject *); /*proto*/ +static PyObject *__pyx_f_5arrex_7numbers_unpack_i(PyObject *, int32_t *); /*proto*/ +static int __pyx_f_5arrex_7numbers_pack_I(PyObject *, uint32_t *, PyObject *); /*proto*/ +static PyObject *__pyx_f_5arrex_7numbers_unpack_I(PyObject *, uint32_t *); /*proto*/ +static int __pyx_f_5arrex_7numbers_pack_l(PyObject *, int64_t *, PyObject *); /*proto*/ +static PyObject *__pyx_f_5arrex_7numbers_unpack_l(PyObject *, int64_t *); /*proto*/ +static int __pyx_f_5arrex_7numbers_pack_L(PyObject *, uint64_t *, PyObject *); /*proto*/ +static PyObject *__pyx_f_5arrex_7numbers_unpack_L(PyObject *, uint64_t *); /*proto*/ +/* #### Code section: typeinfo ### */ +/* #### Code section: before_global_var ### */ +#define __Pyx_MODULE_NAME "arrex.numbers" +extern int __pyx_module_is_main_arrex__numbers; +int __pyx_module_is_main_arrex__numbers = 0; + +/* Implementation of "arrex.numbers" */ +/* #### Code section: global_var ### */ +/* #### Code section: string_decls ### */ +static const char __pyx_k_[] = "?"; +static const char __pyx_k_B[] = "B"; +static const char __pyx_k_H[] = "H"; +static const char __pyx_k_I[] = "I"; +static const char __pyx_k_L[] = "L"; +static const char __pyx_k_b[] = "b"; +static const char __pyx_k_d[] = "d"; +static const char __pyx_k_f[] = "f"; +static const char __pyx_k_h[] = "h"; +static const char __pyx_k_i[] = "i"; +static const char __pyx_k_l[] = "l"; +static const char __pyx_k_main[] = "__main__"; +static const char __pyx_k_name[] = "__name__"; +static const char __pyx_k_test[] = "__test__"; +static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; +/* #### Code section: decls ### */ +/* #### Code section: late_includes ### */ +/* #### Code section: module_state ### */ +typedef struct { + PyObject *__pyx_d; + PyObject *__pyx_b; + PyObject *__pyx_cython_runtime; + PyObject *__pyx_empty_tuple; + PyObject *__pyx_empty_bytes; + PyObject *__pyx_empty_unicode; + #ifdef __Pyx_CyFunction_USED + PyTypeObject *__pyx_CyFunctionType; + #endif + #ifdef __Pyx_FusedFunction_USED + PyTypeObject *__pyx_FusedFunctionType; + #endif + #ifdef __Pyx_Generator_USED + PyTypeObject *__pyx_GeneratorType; + #endif + #ifdef __Pyx_IterableCoroutine_USED + PyTypeObject *__pyx_IterableCoroutineType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineAwaitType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineType; + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyTypeObject *__pyx_ptype_7cpython_4type_type; + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyTypeObject *__pyx_ptype_7cpython_4bool_bool; + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyTypeObject *__pyx_ptype_7cpython_7complex_complex; + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyTypeObject *__pyx_ptype_5arrex_6dtypes_DDType; + #if CYTHON_USE_MODULE_STATE + #endif + PyObject *__pyx_n_s_; + PyObject *__pyx_n_b_B; + PyObject *__pyx_n_u_B; + PyObject *__pyx_n_b_H; + PyObject *__pyx_n_u_H; + PyObject *__pyx_n_b_I; + PyObject *__pyx_n_u_I; + PyObject *__pyx_n_b_L; + PyObject *__pyx_n_u_L; + PyObject *__pyx_n_b_b; + PyObject *__pyx_n_u_b; + PyObject *__pyx_n_s_cline_in_traceback; + PyObject *__pyx_n_b_d; + PyObject *__pyx_n_u_d; + PyObject *__pyx_n_b_f; + PyObject *__pyx_n_u_f; + PyObject *__pyx_n_b_h; + PyObject *__pyx_n_u_h; + PyObject *__pyx_n_b_i; + PyObject *__pyx_n_u_i; + PyObject *__pyx_n_b_l; + PyObject *__pyx_n_u_l; + PyObject *__pyx_n_s_main; + PyObject *__pyx_n_s_name; + PyObject *__pyx_n_s_test; +} __pyx_mstate; + +#if CYTHON_USE_MODULE_STATE +#ifdef __cplusplus +namespace { + extern struct PyModuleDef __pyx_moduledef; +} /* anonymous namespace */ +#else +static struct PyModuleDef __pyx_moduledef; +#endif -/* Module declarations from '__builtin__' */ +#define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o)) -/* Module declarations from 'cpython.bool' */ -static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0; +#define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef))) -/* Module declarations from 'cpython.long' */ +#define __pyx_m (PyState_FindModule(&__pyx_moduledef)) +#else +static __pyx_mstate __pyx_mstate_global_static = +#ifdef __cplusplus + {}; +#else + {0}; +#endif +static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static; +#endif +/* #### Code section: module_state_clear ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_clear(PyObject *m) { + __pyx_mstate *clear_module_state = __pyx_mstate(m); + if (!clear_module_state) return 0; + Py_CLEAR(clear_module_state->__pyx_d); + Py_CLEAR(clear_module_state->__pyx_b); + Py_CLEAR(clear_module_state->__pyx_cython_runtime); + Py_CLEAR(clear_module_state->__pyx_empty_tuple); + Py_CLEAR(clear_module_state->__pyx_empty_bytes); + Py_CLEAR(clear_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_CLEAR(clear_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_CLEAR(clear_module_state->__pyx_FusedFunctionType); + #endif + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type); + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4bool_bool); + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_7complex_complex); + Py_CLEAR(clear_module_state->__pyx_ptype_5arrex_6dtypes_DDType); + Py_CLEAR(clear_module_state->__pyx_n_s_); + Py_CLEAR(clear_module_state->__pyx_n_b_B); + Py_CLEAR(clear_module_state->__pyx_n_u_B); + Py_CLEAR(clear_module_state->__pyx_n_b_H); + Py_CLEAR(clear_module_state->__pyx_n_u_H); + Py_CLEAR(clear_module_state->__pyx_n_b_I); + Py_CLEAR(clear_module_state->__pyx_n_u_I); + Py_CLEAR(clear_module_state->__pyx_n_b_L); + Py_CLEAR(clear_module_state->__pyx_n_u_L); + Py_CLEAR(clear_module_state->__pyx_n_b_b); + Py_CLEAR(clear_module_state->__pyx_n_u_b); + Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); + Py_CLEAR(clear_module_state->__pyx_n_b_d); + Py_CLEAR(clear_module_state->__pyx_n_u_d); + Py_CLEAR(clear_module_state->__pyx_n_b_f); + Py_CLEAR(clear_module_state->__pyx_n_u_f); + Py_CLEAR(clear_module_state->__pyx_n_b_h); + Py_CLEAR(clear_module_state->__pyx_n_u_h); + Py_CLEAR(clear_module_state->__pyx_n_b_i); + Py_CLEAR(clear_module_state->__pyx_n_u_i); + Py_CLEAR(clear_module_state->__pyx_n_b_l); + Py_CLEAR(clear_module_state->__pyx_n_u_l); + Py_CLEAR(clear_module_state->__pyx_n_s_main); + Py_CLEAR(clear_module_state->__pyx_n_s_name); + Py_CLEAR(clear_module_state->__pyx_n_s_test); + return 0; +} +#endif +/* #### Code section: module_state_traverse ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { + __pyx_mstate *traverse_module_state = __pyx_mstate(m); + if (!traverse_module_state) return 0; + Py_VISIT(traverse_module_state->__pyx_d); + Py_VISIT(traverse_module_state->__pyx_b); + Py_VISIT(traverse_module_state->__pyx_cython_runtime); + Py_VISIT(traverse_module_state->__pyx_empty_tuple); + Py_VISIT(traverse_module_state->__pyx_empty_bytes); + Py_VISIT(traverse_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_VISIT(traverse_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_VISIT(traverse_module_state->__pyx_FusedFunctionType); + #endif + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type); + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4bool_bool); + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_7complex_complex); + Py_VISIT(traverse_module_state->__pyx_ptype_5arrex_6dtypes_DDType); + Py_VISIT(traverse_module_state->__pyx_n_s_); + Py_VISIT(traverse_module_state->__pyx_n_b_B); + Py_VISIT(traverse_module_state->__pyx_n_u_B); + Py_VISIT(traverse_module_state->__pyx_n_b_H); + Py_VISIT(traverse_module_state->__pyx_n_u_H); + Py_VISIT(traverse_module_state->__pyx_n_b_I); + Py_VISIT(traverse_module_state->__pyx_n_u_I); + Py_VISIT(traverse_module_state->__pyx_n_b_L); + Py_VISIT(traverse_module_state->__pyx_n_u_L); + Py_VISIT(traverse_module_state->__pyx_n_b_b); + Py_VISIT(traverse_module_state->__pyx_n_u_b); + Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); + Py_VISIT(traverse_module_state->__pyx_n_b_d); + Py_VISIT(traverse_module_state->__pyx_n_u_d); + Py_VISIT(traverse_module_state->__pyx_n_b_f); + Py_VISIT(traverse_module_state->__pyx_n_u_f); + Py_VISIT(traverse_module_state->__pyx_n_b_h); + Py_VISIT(traverse_module_state->__pyx_n_u_h); + Py_VISIT(traverse_module_state->__pyx_n_b_i); + Py_VISIT(traverse_module_state->__pyx_n_u_i); + Py_VISIT(traverse_module_state->__pyx_n_b_l); + Py_VISIT(traverse_module_state->__pyx_n_u_l); + Py_VISIT(traverse_module_state->__pyx_n_s_main); + Py_VISIT(traverse_module_state->__pyx_n_s_name); + Py_VISIT(traverse_module_state->__pyx_n_s_test); + return 0; +} +#endif +/* #### Code section: module_state_defines ### */ +#define __pyx_d __pyx_mstate_global->__pyx_d +#define __pyx_b __pyx_mstate_global->__pyx_b +#define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime +#define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple +#define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes +#define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode +#ifdef __Pyx_CyFunction_USED +#define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType +#endif +#ifdef __Pyx_FusedFunction_USED +#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType +#endif +#ifdef __Pyx_Generator_USED +#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType +#endif +#ifdef __Pyx_IterableCoroutine_USED +#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_7cpython_4type_type __pyx_mstate_global->__pyx_ptype_7cpython_4type_type +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_7cpython_4bool_bool __pyx_mstate_global->__pyx_ptype_7cpython_4bool_bool +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_7cpython_7complex_complex __pyx_mstate_global->__pyx_ptype_7cpython_7complex_complex +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_5arrex_6dtypes_DDType __pyx_mstate_global->__pyx_ptype_5arrex_6dtypes_DDType +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_n_s_ __pyx_mstate_global->__pyx_n_s_ +#define __pyx_n_b_B __pyx_mstate_global->__pyx_n_b_B +#define __pyx_n_u_B __pyx_mstate_global->__pyx_n_u_B +#define __pyx_n_b_H __pyx_mstate_global->__pyx_n_b_H +#define __pyx_n_u_H __pyx_mstate_global->__pyx_n_u_H +#define __pyx_n_b_I __pyx_mstate_global->__pyx_n_b_I +#define __pyx_n_u_I __pyx_mstate_global->__pyx_n_u_I +#define __pyx_n_b_L __pyx_mstate_global->__pyx_n_b_L +#define __pyx_n_u_L __pyx_mstate_global->__pyx_n_u_L +#define __pyx_n_b_b __pyx_mstate_global->__pyx_n_b_b +#define __pyx_n_u_b __pyx_mstate_global->__pyx_n_u_b +#define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback +#define __pyx_n_b_d __pyx_mstate_global->__pyx_n_b_d +#define __pyx_n_u_d __pyx_mstate_global->__pyx_n_u_d +#define __pyx_n_b_f __pyx_mstate_global->__pyx_n_b_f +#define __pyx_n_u_f __pyx_mstate_global->__pyx_n_u_f +#define __pyx_n_b_h __pyx_mstate_global->__pyx_n_b_h +#define __pyx_n_u_h __pyx_mstate_global->__pyx_n_u_h +#define __pyx_n_b_i __pyx_mstate_global->__pyx_n_b_i +#define __pyx_n_u_i __pyx_mstate_global->__pyx_n_u_i +#define __pyx_n_b_l __pyx_mstate_global->__pyx_n_b_l +#define __pyx_n_u_l __pyx_mstate_global->__pyx_n_u_l +#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main +#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name +#define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test +/* #### Code section: module_code ### */ -/* Module declarations from 'cpython.float' */ +/* "cpython/complex.pxd":19 + * + * @property + * cdef inline double real(self): # <<<<<<<<<<<<<< + * return self.cval.real + * + */ -/* Module declarations from '__builtin__' */ +static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4real_real(PyComplexObject *__pyx_v_self) { + double __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("real", 0); -/* Module declarations from 'cpython.complex' */ -static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0; + /* "cpython/complex.pxd":20 + * @property + * cdef inline double real(self): + * return self.cval.real # <<<<<<<<<<<<<< + * + * @property + */ + __pyx_r = __pyx_v_self->cval.real; + goto __pyx_L0; -/* Module declarations from 'cpython.string' */ + /* "cpython/complex.pxd":19 + * + * @property + * cdef inline double real(self): # <<<<<<<<<<<<<< + * return self.cval.real + * + */ -/* Module declarations from 'cpython.unicode' */ + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} -/* Module declarations from 'cpython.dict' */ +/* "cpython/complex.pxd":23 + * + * @property + * cdef inline double imag(self): # <<<<<<<<<<<<<< + * return self.cval.imag + * + */ -/* Module declarations from 'cpython.instance' */ +static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4imag_imag(PyComplexObject *__pyx_v_self) { + double __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("imag", 0); -/* Module declarations from 'cpython.function' */ + /* "cpython/complex.pxd":24 + * @property + * cdef inline double imag(self): + * return self.cval.imag # <<<<<<<<<<<<<< + * + * # PyTypeObject PyComplex_Type + */ + __pyx_r = __pyx_v_self->cval.imag; + goto __pyx_L0; -/* Module declarations from 'cpython.method' */ + /* "cpython/complex.pxd":23 + * + * @property + * cdef inline double imag(self): # <<<<<<<<<<<<<< + * return self.cval.imag + * + */ -/* Module declarations from 'cpython.weakref' */ + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} -/* Module declarations from 'cpython.getargs' */ +/* "cpython/contextvars.pxd":112 + * + * + * cdef inline object get_value(var, default_value=None): # <<<<<<<<<<<<<< + * """Return a new reference to the value of the context variable, + * or the default value of the context variable, + */ -/* Module declarations from 'cpython.pythread' */ +static CYTHON_INLINE PyObject *__pyx_f_7cpython_11contextvars_get_value(PyObject *__pyx_v_var, struct __pyx_opt_args_7cpython_11contextvars_get_value *__pyx_optional_args) { + PyObject *__pyx_v_default_value = ((PyObject *)Py_None); + PyObject *__pyx_v_value; + PyObject *__pyx_v_pyvalue = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_value", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_default_value = __pyx_optional_args->default_value; + } + } -/* Module declarations from 'cpython.pystate' */ + /* "cpython/contextvars.pxd":117 + * or None if no such value or default was found. + * """ + * cdef PyObject *value = NULL # <<<<<<<<<<<<<< + * PyContextVar_Get(var, NULL, &value) + * if value is NULL: + */ + __pyx_v_value = NULL; + + /* "cpython/contextvars.pxd":118 + * """ + * cdef PyObject *value = NULL + * PyContextVar_Get(var, NULL, &value) # <<<<<<<<<<<<<< + * if value is NULL: + * # context variable does not have a default + */ + __pyx_t_1 = PyContextVar_Get(__pyx_v_var, NULL, (&__pyx_v_value)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 118, __pyx_L1_error) + + /* "cpython/contextvars.pxd":119 + * cdef PyObject *value = NULL + * PyContextVar_Get(var, NULL, &value) + * if value is NULL: # <<<<<<<<<<<<<< + * # context variable does not have a default + * pyvalue = default_value + */ + __pyx_t_2 = (__pyx_v_value == NULL); + if (__pyx_t_2) { + + /* "cpython/contextvars.pxd":121 + * if value is NULL: + * # context variable does not have a default + * pyvalue = default_value # <<<<<<<<<<<<<< + * else: + * # value or default value of context variable + */ + __Pyx_INCREF(__pyx_v_default_value); + __pyx_v_pyvalue = __pyx_v_default_value; + + /* "cpython/contextvars.pxd":119 + * cdef PyObject *value = NULL + * PyContextVar_Get(var, NULL, &value) + * if value is NULL: # <<<<<<<<<<<<<< + * # context variable does not have a default + * pyvalue = default_value + */ + goto __pyx_L3; + } -/* Module declarations from 'cpython.cobject' */ + /* "cpython/contextvars.pxd":124 + * else: + * # value or default value of context variable + * pyvalue = value # <<<<<<<<<<<<<< + * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*' + * return pyvalue + */ + /*else*/ { + __pyx_t_3 = ((PyObject *)__pyx_v_value); + __Pyx_INCREF(__pyx_t_3); + __pyx_v_pyvalue = __pyx_t_3; + __pyx_t_3 = 0; + + /* "cpython/contextvars.pxd":125 + * # value or default value of context variable + * pyvalue = value + * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*' # <<<<<<<<<<<<<< + * return pyvalue + * + */ + Py_XDECREF(__pyx_v_value); + } + __pyx_L3:; -/* Module declarations from 'cpython.oldbuffer' */ + /* "cpython/contextvars.pxd":126 + * pyvalue = value + * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*' + * return pyvalue # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_pyvalue); + __pyx_r = __pyx_v_pyvalue; + goto __pyx_L0; -/* Module declarations from 'cpython.set' */ + /* "cpython/contextvars.pxd":112 + * + * + * cdef inline object get_value(var, default_value=None): # <<<<<<<<<<<<<< + * """Return a new reference to the value of the context variable, + * or the default value of the context variable, + */ -/* Module declarations from 'cpython.buffer' */ + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cpython.contextvars.get_value", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_pyvalue); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} -/* Module declarations from 'cpython.bytes' */ +/* "cpython/contextvars.pxd":129 + * + * + * cdef inline object get_value_no_default(var, default_value=None): # <<<<<<<<<<<<<< + * """Return a new reference to the value of the context variable, + * or the provided default value if no such value was found. + */ -/* Module declarations from 'cpython.pycapsule' */ +static CYTHON_INLINE PyObject *__pyx_f_7cpython_11contextvars_get_value_no_default(PyObject *__pyx_v_var, struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default *__pyx_optional_args) { + PyObject *__pyx_v_default_value = ((PyObject *)Py_None); + PyObject *__pyx_v_value; + PyObject *__pyx_v_pyvalue = NULL; + 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("get_value_no_default", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_default_value = __pyx_optional_args->default_value; + } + } -/* Module declarations from 'cpython' */ + /* "cpython/contextvars.pxd":135 + * Ignores the default value of the context variable, if any. + * """ + * cdef PyObject *value = NULL # <<<<<<<<<<<<<< + * PyContextVar_Get(var, default_value, &value) + * # value of context variable or 'default_value' + */ + __pyx_v_value = NULL; + + /* "cpython/contextvars.pxd":136 + * """ + * cdef PyObject *value = NULL + * PyContextVar_Get(var, default_value, &value) # <<<<<<<<<<<<<< + * # value of context variable or 'default_value' + * pyvalue = value + */ + __pyx_t_1 = PyContextVar_Get(__pyx_v_var, ((PyObject *)__pyx_v_default_value), (&__pyx_v_value)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 136, __pyx_L1_error) + + /* "cpython/contextvars.pxd":138 + * PyContextVar_Get(var, default_value, &value) + * # value of context variable or 'default_value' + * pyvalue = value # <<<<<<<<<<<<<< + * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*' + * return pyvalue + */ + __pyx_t_2 = ((PyObject *)__pyx_v_value); + __Pyx_INCREF(__pyx_t_2); + __pyx_v_pyvalue = __pyx_t_2; + __pyx_t_2 = 0; -/* Module declarations from 'libc.stdint' */ + /* "cpython/contextvars.pxd":139 + * # value of context variable or 'default_value' + * pyvalue = value + * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*' # <<<<<<<<<<<<<< + * return pyvalue + */ + Py_XDECREF(__pyx_v_value); -/* Module declarations from 'arrex.dtypes' */ -static PyTypeObject *__pyx_ptype_5arrex_6dtypes_DDType = 0; -static struct __pyx_obj_5arrex_6dtypes_DDType *(*__pyx_f_5arrex_6dtypes_declare)(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_5arrex_6dtypes_declare *__pyx_optional_args); /*proto*/ -static struct __pyx_obj_5arrex_6dtypes_DDType *(*__pyx_f_5arrex_6dtypes_declared)(PyObject *, int __pyx_skip_dispatch); /*proto*/ + /* "cpython/contextvars.pxd":140 + * pyvalue = value + * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*' + * return pyvalue # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_pyvalue); + __pyx_r = __pyx_v_pyvalue; + goto __pyx_L0; -/* Module declarations from 'arrex.numbers' */ -static struct __pyx_obj_5arrex_6dtypes_DDType *__pyx_v_5arrex_7numbers_decl = 0; -static int __pyx_f_5arrex_7numbers_pack_d(PyObject *, double *, PyObject *); /*proto*/ -static PyObject *__pyx_f_5arrex_7numbers_unpack_d(PyObject *, double *); /*proto*/ -static int __pyx_f_5arrex_7numbers_pack_f(PyObject *, float *, PyObject *); /*proto*/ -static PyObject *__pyx_f_5arrex_7numbers_unpack_f(PyObject *, float *); /*proto*/ -static int __pyx_f_5arrex_7numbers_pack_b(PyObject *, int8_t *, PyObject *); /*proto*/ -static PyObject *__pyx_f_5arrex_7numbers_unpack_b(PyObject *, int8_t *); /*proto*/ -static int __pyx_f_5arrex_7numbers_pack_B(PyObject *, uint8_t *, PyObject *); /*proto*/ -static PyObject *__pyx_f_5arrex_7numbers_unpack_B(PyObject *, uint8_t *); /*proto*/ -static int __pyx_f_5arrex_7numbers_pack_h(PyObject *, int16_t *, PyObject *); /*proto*/ -static PyObject *__pyx_f_5arrex_7numbers_unpack_h(PyObject *, int16_t *); /*proto*/ -static int __pyx_f_5arrex_7numbers_pack_H(PyObject *, uint16_t *, PyObject *); /*proto*/ -static PyObject *__pyx_f_5arrex_7numbers_unpack_H(PyObject *, uint16_t *); /*proto*/ -static int __pyx_f_5arrex_7numbers_pack_i(PyObject *, int32_t *, PyObject *); /*proto*/ -static PyObject *__pyx_f_5arrex_7numbers_unpack_i(PyObject *, int32_t *); /*proto*/ -static int __pyx_f_5arrex_7numbers_pack_I(PyObject *, uint32_t *, PyObject *); /*proto*/ -static PyObject *__pyx_f_5arrex_7numbers_unpack_I(PyObject *, uint32_t *); /*proto*/ -static int __pyx_f_5arrex_7numbers_pack_l(PyObject *, int64_t *, PyObject *); /*proto*/ -static PyObject *__pyx_f_5arrex_7numbers_unpack_l(PyObject *, int64_t *); /*proto*/ -static int __pyx_f_5arrex_7numbers_pack_L(PyObject *, uint64_t *, PyObject *); /*proto*/ -static PyObject *__pyx_f_5arrex_7numbers_unpack_L(PyObject *, uint64_t *); /*proto*/ -#define __Pyx_MODULE_NAME "arrex.numbers" -extern int __pyx_module_is_main_arrex__numbers; -int __pyx_module_is_main_arrex__numbers = 0; + /* "cpython/contextvars.pxd":129 + * + * + * cdef inline object get_value_no_default(var, default_value=None): # <<<<<<<<<<<<<< + * """Return a new reference to the value of the context variable, + * or the provided default value if no such value was found. + */ -/* Implementation of 'arrex.numbers' */ -static const char __pyx_k_B[] = "B"; -static const char __pyx_k_H[] = "H"; -static const char __pyx_k_I[] = "I"; -static const char __pyx_k_L[] = "L"; -static const char __pyx_k_b[] = "b"; -static const char __pyx_k_d[] = "d"; -static const char __pyx_k_f[] = "f"; -static const char __pyx_k_h[] = "h"; -static const char __pyx_k_i[] = "i"; -static const char __pyx_k_l[] = "l"; -static const char __pyx_k_main[] = "__main__"; -static const char __pyx_k_name[] = "__name__"; -static const char __pyx_k_test[] = "__test__"; -static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; -static PyObject *__pyx_n_b_B; -static PyObject *__pyx_n_u_B; -static PyObject *__pyx_n_b_H; -static PyObject *__pyx_n_u_H; -static PyObject *__pyx_n_b_I; -static PyObject *__pyx_n_u_I; -static PyObject *__pyx_n_b_L; -static PyObject *__pyx_n_u_L; -static PyObject *__pyx_n_b_b; -static PyObject *__pyx_n_u_b; -static PyObject *__pyx_n_s_cline_in_traceback; -static PyObject *__pyx_n_b_d; -static PyObject *__pyx_n_u_d; -static PyObject *__pyx_n_b_f; -static PyObject *__pyx_n_u_f; -static PyObject *__pyx_n_b_h; -static PyObject *__pyx_n_u_h; -static PyObject *__pyx_n_b_i; -static PyObject *__pyx_n_u_i; -static PyObject *__pyx_n_b_l; -static PyObject *__pyx_n_u_l; -static PyObject *__pyx_n_s_main; -static PyObject *__pyx_n_s_name; -static PyObject *__pyx_n_s_test; -/* Late includes */ + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cpython.contextvars.get_value_no_default", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_pyvalue); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} /* "arrex/numbers.pyx":13 * ### declare double @@ -1447,7 +2715,7 @@ static int __pyx_f_5arrex_7numbers_pack_d(CYTHON_UNUSED PyObject *__pyx_v_dtype, * cdef object unpack_d(object dtype, double* place): * return place[0] */ - __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_obj); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 14, __pyx_L1_error) + __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_obj); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 14, __pyx_L1_error) (__pyx_v_place[0]) = __pyx_t_1; /* "arrex/numbers.pyx":13 @@ -1494,7 +2762,7 @@ static PyObject *__pyx_f_5arrex_7numbers_unpack_d(CYTHON_UNUSED PyObject *__pyx_ * decl = DDType() */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble((__pyx_v_place[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) + __pyx_t_1 = PyFloat_FromDouble((__pyx_v_place[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1543,7 +2811,7 @@ static int __pyx_f_5arrex_7numbers_pack_f(CYTHON_UNUSED PyObject *__pyx_v_dtype, * cdef object unpack_f(object dtype, float* place): * return place[0] */ - __pyx_t_1 = __pyx_PyFloat_AsFloat(__pyx_v_obj); if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 30, __pyx_L1_error) + __pyx_t_1 = __pyx_PyFloat_AsFloat(__pyx_v_obj); if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 30, __pyx_L1_error) (__pyx_v_place[0]) = __pyx_t_1; /* "arrex/numbers.pyx":29 @@ -1590,7 +2858,7 @@ static PyObject *__pyx_f_5arrex_7numbers_unpack_f(CYTHON_UNUSED PyObject *__pyx_ * decl = DDType() */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble((__pyx_v_place[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error) + __pyx_t_1 = PyFloat_FromDouble((__pyx_v_place[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1639,7 +2907,7 @@ static int __pyx_f_5arrex_7numbers_pack_b(CYTHON_UNUSED PyObject *__pyx_v_dtype, * cdef object unpack_b(object dtype, int8_t* place): * return place[0] */ - __pyx_t_1 = __Pyx_PyInt_As_int8_t(__pyx_v_obj); if (unlikely((__pyx_t_1 == ((int8_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 46, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_As_int8_t(__pyx_v_obj); if (unlikely((__pyx_t_1 == ((int8_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 46, __pyx_L1_error) (__pyx_v_place[0]) = __pyx_t_1; /* "arrex/numbers.pyx":45 @@ -1686,7 +2954,7 @@ static PyObject *__pyx_f_5arrex_7numbers_unpack_b(CYTHON_UNUSED PyObject *__pyx_ * decl = DDType() */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int8_t((__pyx_v_place[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int8_t((__pyx_v_place[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 48, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1735,7 +3003,7 @@ static int __pyx_f_5arrex_7numbers_pack_B(CYTHON_UNUSED PyObject *__pyx_v_dtype, * cdef object unpack_B(object dtype, uint8_t* place): * return place[0] */ - __pyx_t_1 = __Pyx_PyInt_As_uint8_t(__pyx_v_obj); if (unlikely((__pyx_t_1 == ((uint8_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 62, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_As_uint8_t(__pyx_v_obj); if (unlikely((__pyx_t_1 == ((uint8_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 62, __pyx_L1_error) (__pyx_v_place[0]) = __pyx_t_1; /* "arrex/numbers.pyx":61 @@ -1782,7 +3050,7 @@ static PyObject *__pyx_f_5arrex_7numbers_unpack_B(CYTHON_UNUSED PyObject *__pyx_ * decl = DDType() */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_uint8_t((__pyx_v_place[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_uint8_t((__pyx_v_place[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1831,7 +3099,7 @@ static int __pyx_f_5arrex_7numbers_pack_h(CYTHON_UNUSED PyObject *__pyx_v_dtype, * cdef object unpack_h(object dtype, int16_t* place): * return place[0] */ - __pyx_t_1 = __Pyx_PyInt_As_int16_t(__pyx_v_obj); if (unlikely((__pyx_t_1 == ((int16_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_As_int16_t(__pyx_v_obj); if (unlikely((__pyx_t_1 == ((int16_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 78, __pyx_L1_error) (__pyx_v_place[0]) = __pyx_t_1; /* "arrex/numbers.pyx":77 @@ -1878,7 +3146,7 @@ static PyObject *__pyx_f_5arrex_7numbers_unpack_h(CYTHON_UNUSED PyObject *__pyx_ * decl = DDType() */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int16_t((__pyx_v_place[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int16_t((__pyx_v_place[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1927,7 +3195,7 @@ static int __pyx_f_5arrex_7numbers_pack_H(CYTHON_UNUSED PyObject *__pyx_v_dtype, * cdef object unpack_H(object dtype, uint16_t* place): * return place[0] */ - __pyx_t_1 = __Pyx_PyInt_As_uint16_t(__pyx_v_obj); if (unlikely((__pyx_t_1 == ((uint16_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 94, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_As_uint16_t(__pyx_v_obj); if (unlikely((__pyx_t_1 == ((uint16_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 94, __pyx_L1_error) (__pyx_v_place[0]) = __pyx_t_1; /* "arrex/numbers.pyx":93 @@ -1974,7 +3242,7 @@ static PyObject *__pyx_f_5arrex_7numbers_unpack_H(CYTHON_UNUSED PyObject *__pyx_ * decl = DDType() */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_uint16_t((__pyx_v_place[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_uint16_t((__pyx_v_place[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 96, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2023,7 +3291,7 @@ static int __pyx_f_5arrex_7numbers_pack_i(CYTHON_UNUSED PyObject *__pyx_v_dtype, * cdef object unpack_i(object dtype, int32_t* place): * return place[0] */ - __pyx_t_1 = __Pyx_PyInt_As_int32_t(__pyx_v_obj); if (unlikely((__pyx_t_1 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_As_int32_t(__pyx_v_obj); if (unlikely((__pyx_t_1 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 110, __pyx_L1_error) (__pyx_v_place[0]) = __pyx_t_1; /* "arrex/numbers.pyx":109 @@ -2070,7 +3338,7 @@ static PyObject *__pyx_f_5arrex_7numbers_unpack_i(CYTHON_UNUSED PyObject *__pyx_ * decl = DDType() */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int32_t((__pyx_v_place[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int32_t((__pyx_v_place[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2119,7 +3387,7 @@ static int __pyx_f_5arrex_7numbers_pack_I(CYTHON_UNUSED PyObject *__pyx_v_dtype, * cdef object unpack_I(object dtype, uint32_t* place): * return place[0] */ - __pyx_t_1 = __Pyx_PyInt_As_uint32_t(__pyx_v_obj); if (unlikely((__pyx_t_1 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 126, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_As_uint32_t(__pyx_v_obj); if (unlikely((__pyx_t_1 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 126, __pyx_L1_error) (__pyx_v_place[0]) = __pyx_t_1; /* "arrex/numbers.pyx":125 @@ -2166,7 +3434,7 @@ static PyObject *__pyx_f_5arrex_7numbers_unpack_I(CYTHON_UNUSED PyObject *__pyx_ * decl = DDType() */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_uint32_t((__pyx_v_place[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_uint32_t((__pyx_v_place[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 128, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2215,7 +3483,7 @@ static int __pyx_f_5arrex_7numbers_pack_l(CYTHON_UNUSED PyObject *__pyx_v_dtype, * cdef object unpack_l(object dtype, int64_t* place): * return place[0] */ - __pyx_t_1 = __Pyx_PyInt_As_int64_t(__pyx_v_obj); if (unlikely((__pyx_t_1 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 142, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_As_int64_t(__pyx_v_obj); if (unlikely((__pyx_t_1 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 142, __pyx_L1_error) (__pyx_v_place[0]) = __pyx_t_1; /* "arrex/numbers.pyx":141 @@ -2262,7 +3530,7 @@ static PyObject *__pyx_f_5arrex_7numbers_unpack_l(CYTHON_UNUSED PyObject *__pyx_ * decl = DDType() */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int64_t((__pyx_v_place[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int64_t((__pyx_v_place[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 144, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2311,7 +3579,7 @@ static int __pyx_f_5arrex_7numbers_pack_L(CYTHON_UNUSED PyObject *__pyx_v_dtype, * cdef object unpack_L(object dtype, uint64_t* place): * return place[0] */ - __pyx_t_1 = __Pyx_PyInt_As_uint64_t(__pyx_v_obj); if (unlikely((__pyx_t_1 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 158, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_As_uint64_t(__pyx_v_obj); if (unlikely((__pyx_t_1 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 158, __pyx_L1_error) (__pyx_v_place[0]) = __pyx_t_1; /* "arrex/numbers.pyx":157 @@ -2358,7 +3626,7 @@ static PyObject *__pyx_f_5arrex_7numbers_unpack_L(CYTHON_UNUSED PyObject *__pyx_ * decl = DDType() */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_uint64_t((__pyx_v_place[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_uint64_t((__pyx_v_place[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 160, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2374,50 +3642,18 @@ static PyObject *__pyx_f_5arrex_7numbers_unpack_L(CYTHON_UNUSED PyObject *__pyx_ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("arrex.numbers.unpack_L", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyMethodDef __pyx_methods[] = { - {0, 0, 0, 0} -}; - -#if PY_MAJOR_VERSION >= 3 -#if CYTHON_PEP489_MULTI_PHASE_INIT -static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ -static int __pyx_pymod_exec_numbers(PyObject* module); /*proto*/ -static PyModuleDef_Slot __pyx_moduledef_slots[] = { - {Py_mod_create, (void*)__pyx_pymod_create}, - {Py_mod_exec, (void*)__pyx_pymod_exec_numbers}, - {0, NULL} -}; -#endif + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("arrex.numbers.unpack_L", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} -static struct PyModuleDef __pyx_moduledef = { - PyModuleDef_HEAD_INIT, - "numbers", - 0, /* m_doc */ - #if CYTHON_PEP489_MULTI_PHASE_INIT - 0, /* m_size */ - #else - -1, /* m_size */ - #endif - __pyx_methods /* m_methods */, - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_moduledef_slots, /* m_slots */ - #else - NULL, /* m_reload */ - #endif - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} }; -#endif #ifndef CYTHON_SMALL_CODE #if defined(__clang__) #define CYTHON_SMALL_CODE @@ -2427,37 +3663,44 @@ static struct PyModuleDef __pyx_moduledef = { #define CYTHON_SMALL_CODE #endif #endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_n_b_B, __pyx_k_B, sizeof(__pyx_k_B), 0, 0, 0, 1}, - {&__pyx_n_u_B, __pyx_k_B, sizeof(__pyx_k_B), 0, 1, 0, 1}, - {&__pyx_n_b_H, __pyx_k_H, sizeof(__pyx_k_H), 0, 0, 0, 1}, - {&__pyx_n_u_H, __pyx_k_H, sizeof(__pyx_k_H), 0, 1, 0, 1}, - {&__pyx_n_b_I, __pyx_k_I, sizeof(__pyx_k_I), 0, 0, 0, 1}, - {&__pyx_n_u_I, __pyx_k_I, sizeof(__pyx_k_I), 0, 1, 0, 1}, - {&__pyx_n_b_L, __pyx_k_L, sizeof(__pyx_k_L), 0, 0, 0, 1}, - {&__pyx_n_u_L, __pyx_k_L, sizeof(__pyx_k_L), 0, 1, 0, 1}, - {&__pyx_n_b_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 0, 1}, - {&__pyx_n_u_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 1, 0, 1}, - {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, - {&__pyx_n_b_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 0, 1}, - {&__pyx_n_u_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 1, 0, 1}, - {&__pyx_n_b_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 0, 1}, - {&__pyx_n_u_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 1, 0, 1}, - {&__pyx_n_b_h, __pyx_k_h, sizeof(__pyx_k_h), 0, 0, 0, 1}, - {&__pyx_n_u_h, __pyx_k_h, sizeof(__pyx_k_h), 0, 1, 0, 1}, - {&__pyx_n_b_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 0, 1}, - {&__pyx_n_u_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 1, 0, 1}, - {&__pyx_n_b_l, __pyx_k_l, sizeof(__pyx_k_l), 0, 0, 0, 1}, - {&__pyx_n_u_l, __pyx_k_l, sizeof(__pyx_k_l), 0, 1, 0, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; +/* #### Code section: pystring_table ### */ + +static int __Pyx_CreateStringTabAndInitStrings(void) { + __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_n_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 1}, + {&__pyx_n_b_B, __pyx_k_B, sizeof(__pyx_k_B), 0, 0, 0, 1}, + {&__pyx_n_u_B, __pyx_k_B, sizeof(__pyx_k_B), 0, 1, 0, 1}, + {&__pyx_n_b_H, __pyx_k_H, sizeof(__pyx_k_H), 0, 0, 0, 1}, + {&__pyx_n_u_H, __pyx_k_H, sizeof(__pyx_k_H), 0, 1, 0, 1}, + {&__pyx_n_b_I, __pyx_k_I, sizeof(__pyx_k_I), 0, 0, 0, 1}, + {&__pyx_n_u_I, __pyx_k_I, sizeof(__pyx_k_I), 0, 1, 0, 1}, + {&__pyx_n_b_L, __pyx_k_L, sizeof(__pyx_k_L), 0, 0, 0, 1}, + {&__pyx_n_u_L, __pyx_k_L, sizeof(__pyx_k_L), 0, 1, 0, 1}, + {&__pyx_n_b_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 0, 1}, + {&__pyx_n_u_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 1, 0, 1}, + {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, + {&__pyx_n_b_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 0, 1}, + {&__pyx_n_u_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 1, 0, 1}, + {&__pyx_n_b_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 0, 1}, + {&__pyx_n_u_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 1, 0, 1}, + {&__pyx_n_b_h, __pyx_k_h, sizeof(__pyx_k_h), 0, 0, 0, 1}, + {&__pyx_n_u_h, __pyx_k_h, sizeof(__pyx_k_h), 0, 1, 0, 1}, + {&__pyx_n_b_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 0, 1}, + {&__pyx_n_u_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 1, 0, 1}, + {&__pyx_n_b_l, __pyx_k_l, sizeof(__pyx_k_l), 0, 0, 0, 1}, + {&__pyx_n_u_l, __pyx_k_l, sizeof(__pyx_k_l), 0, 1, 0, 1}, + {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, + {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, + {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} + }; + return __Pyx_InitStrings(__pyx_string_tab); +} +/* #### Code section: cached_builtins ### */ static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { return 0; } +/* #### Code section: cached_constants ### */ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations @@ -2465,13 +3708,20 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyFinishContext(); return 0; } +/* #### Code section: init_constants ### */ -static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); +static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { + if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(1, 1, __pyx_L1_error); return 0; __pyx_L1_error:; return -1; } +/* #### Code section: init_globals ### */ + +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { + return 0; +} +/* #### Code section: init_module ### */ static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ @@ -2522,31 +3772,29 @@ static int __Pyx_modinit_type_import_code(void) { int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); /*--- Type import code ---*/ - __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 9, __pyx_L1_error) + __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_0_0(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 - sizeof(PyTypeObject), + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_0(PyTypeObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_0(PyTypeObject), #else - sizeof(PyHeapTypeObject), + sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_0(PyHeapTypeObject), #endif - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_ImportType_CheckSize_Warn_3_0_0); if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 8, __pyx_L1_error) + __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 8, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(2, 8, __pyx_L1_error) + __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType_3_0_0(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_0(PyBoolObject),__Pyx_ImportType_CheckSize_Warn_3_0_0); if (!__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(3, 8, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 15, __pyx_L1_error) + __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(3, 15, __pyx_L1_error) + __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType_3_0_0(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_0(PyComplexObject),__Pyx_ImportType_CheckSize_Warn_3_0_0); if (!__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(4, 15, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyImport_ImportModule("arrex.dtypes"); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14, __pyx_L1_error) + __pyx_t_1 = PyImport_ImportModule("arrex.dtypes"); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_5arrex_6dtypes_DDType = __Pyx_ImportType(__pyx_t_1, "arrex.dtypes", "DDType", sizeof(struct __pyx_obj_5arrex_6dtypes_DDType), __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5arrex_6dtypes_DDType) __PYX_ERR(4, 14, __pyx_L1_error) + __pyx_ptype_5arrex_6dtypes_DDType = __Pyx_ImportType_3_0_0(__pyx_t_1, "arrex.dtypes", "DDType", sizeof(struct __pyx_obj_5arrex_6dtypes_DDType), __PYX_GET_STRUCT_ALIGNMENT_3_0_0(struct __pyx_obj_5arrex_6dtypes_DDType),__Pyx_ImportType_CheckSize_Warn_3_0_0); if (!__pyx_ptype_5arrex_6dtypes_DDType) __PYX_ERR(5, 14, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; @@ -2572,10 +3820,10 @@ static int __Pyx_modinit_function_import_code(void) { int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); /*--- Function import code ---*/ - __pyx_t_1 = PyImport_ImportModule("arrex.dtypes"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_t_1 = PyImport_ImportModule("arrex.dtypes"); if (!__pyx_t_1) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_ImportFunction(__pyx_t_1, "declare", (void (**)(void))&__pyx_f_5arrex_6dtypes_declare, "struct __pyx_obj_5arrex_6dtypes_DDType *(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_5arrex_6dtypes_declare *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportFunction(__pyx_t_1, "declared", (void (**)(void))&__pyx_f_5arrex_6dtypes_declared, "struct __pyx_obj_5arrex_6dtypes_DDType *(PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportFunction_3_0_0(__pyx_t_1, "declare", (void (**)(void))&__pyx_f_5arrex_6dtypes_declare, "struct __pyx_obj_5arrex_6dtypes_DDType *(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_5arrex_6dtypes_declare *__pyx_optional_args)") < 0) __PYX_ERR(1, 1, __pyx_L1_error) + if (__Pyx_ImportFunction_3_0_0(__pyx_t_1, "declared", (void (**)(void))&__pyx_f_5arrex_6dtypes_declared, "struct __pyx_obj_5arrex_6dtypes_DDType *(PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; @@ -2586,6 +3834,55 @@ static int __Pyx_modinit_function_import_code(void) { } +#if PY_MAJOR_VERSION >= 3 +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec_numbers(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_numbers}, + {0, NULL} +}; +#endif + +#ifdef __cplusplus +namespace { + struct PyModuleDef __pyx_moduledef = + #else + static struct PyModuleDef __pyx_moduledef = + #endif + { + PyModuleDef_HEAD_INIT, + "numbers", + 0, /* m_doc */ + #if CYTHON_PEP489_MULTI_PHASE_INIT + 0, /* m_size */ + #elif CYTHON_USE_MODULE_STATE + sizeof(__pyx_mstate), /* m_size */ + #else + -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + #if CYTHON_USE_MODULE_STATE + __pyx_m_traverse, /* m_traverse */ + __pyx_m_clear, /* m_clear */ + NULL /* m_free */ + #else + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ + #endif + }; + #ifdef __cplusplus +} /* anonymous namespace */ +#endif +#endif + #ifndef CYTHON_NO_PYINIT_EXPORT #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC #elif PY_MAJOR_VERSION < 3 @@ -2636,12 +3933,21 @@ static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { } return 0; } -static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none) +#else +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) +#endif +{ PyObject *value = PyObject_GetAttrString(spec, from_name); int result = 0; if (likely(value)) { if (allow_none || value != Py_None) { +#if CYTHON_COMPILING_IN_LIMITED_API + result = PyModule_AddObject(module, to_name, value); +#else result = PyDict_SetItemString(moddict, to_name, value); +#endif } Py_DECREF(value); } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { @@ -2651,8 +3957,9 @@ static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject } return result; } -static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { +static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { PyObject *module = NULL, *moddict, *modname; + CYTHON_UNUSED_VAR(def); if (__Pyx_check_single_interpreter()) return NULL; if (__pyx_m) @@ -2662,8 +3969,12 @@ static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNU module = PyModule_NewObject(modname); Py_DECREF(modname); if (unlikely(!module)) goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + moddict = module; +#else moddict = PyModule_GetDict(module); if (unlikely(!moddict)) goto bad; +#endif if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; @@ -2679,9 +3990,14 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec_numbers(PyObject *__pyx_pyinit_mod #endif #endif { + int stringtab_initialized = 0; + #if CYTHON_USE_MODULE_STATE + int pystate_addmodule_run = 0; + #endif PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - struct __pyx_opt_args_5arrex_6dtypes_declare __pyx_t_3; + PyObject *__pyx_t_3 = NULL; + struct __pyx_opt_args_5arrex_6dtypes_declare __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -2695,6 +4011,35 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec_numbers(PyObject *__pyx_pyinit_mod #elif PY_MAJOR_VERSION >= 3 if (__pyx_m) return __Pyx_NewRef(__pyx_m); #endif + /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_m = __pyx_pyinit_module; + Py_INCREF(__pyx_m); + #else + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4("numbers", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + if (unlikely(!__pyx_m)) __PYX_ERR(1, 1, __pyx_L1_error) + #elif CYTHON_USE_MODULE_STATE + __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error) + { + int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef); + __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to numbers pseudovariable */ + if (unlikely((add_module_result < 0))) __PYX_ERR(1, 1, __pyx_L1_error) + pystate_addmodule_run = 1; + } + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + if (unlikely(!__pyx_m)) __PYX_ERR(1, 1, __pyx_L1_error) + #endif + #endif + CYTHON_UNUSED_VAR(__pyx_t_1); + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(1, 1, __pyx_L1_error) + Py_INCREF(__pyx_d); + __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(1, 1, __pyx_L1_error) + Py_INCREF(__pyx_b); + __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(1, 1, __pyx_L1_error) + Py_INCREF(__pyx_cython_runtime); + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(1, 1, __pyx_L1_error) #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { @@ -2705,86 +4050,69 @@ if (!__Pyx_RefNanny) { } #endif __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_numbers(void)", 0); - if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_check_binary_version() < 0) __PYX_ERR(1, 1, __pyx_L1_error) #ifdef __Pxy_PyFrame_Initialize_Offsets __Pxy_PyFrame_Initialize_Offsets(); #endif - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(1, 1, __pyx_L1_error) #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(1, 1, __pyx_L1_error) #endif #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(1, 1, __pyx_L1_error) #endif #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(1, 1, __pyx_L1_error) #endif #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(1, 1, __pyx_L1_error) #endif #ifdef __Pyx_AsyncGen_USED - if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(1, 1, __pyx_L1_error) #endif #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(1, 1, __pyx_L1_error) #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS PyEval_InitThreads(); #endif - /*--- Module creation code ---*/ - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_m = __pyx_pyinit_module; - Py_INCREF(__pyx_m); - #else - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("numbers", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_b); - __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_cython_runtime); - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_InitConstants() < 0) __PYX_ERR(1, 1, __pyx_L1_error) + stringtab_initialized = 1; + if (__Pyx_InitGlobals() < 0) __PYX_ERR(1, 1, __pyx_L1_error) #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(1, 1, __pyx_L1_error) #endif if (__pyx_module_is_main_arrex__numbers) { - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(1, 1, __pyx_L1_error) } #if PY_MAJOR_VERSION >= 3 { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(1, 1, __pyx_L1_error) if (!PyDict_GetItemString(modules, "arrex.numbers")) { - if (unlikely(PyDict_SetItemString(modules, "arrex.numbers", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((PyDict_SetItemString(modules, "arrex.numbers", __pyx_m) < 0))) __PYX_ERR(1, 1, __pyx_L1_error) } } #endif /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(1, 1, __pyx_L1_error) /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(1, 1, __pyx_L1_error) /*--- Global type/function init code ---*/ (void)__Pyx_modinit_global_init_code(); (void)__Pyx_modinit_variable_export_code(); (void)__Pyx_modinit_function_export_code(); (void)__Pyx_modinit_type_init_code(); - if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_type_import_code() < 0))) __PYX_ERR(1, 1, __pyx_L1_error) (void)__Pyx_modinit_variable_import_code(); - if (unlikely(__Pyx_modinit_function_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_function_import_code() < 0))) __PYX_ERR(1, 1, __pyx_L1_error) /*--- Execution code ---*/ #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_patch_abc() < 0) __PYX_ERR(1, 1, __pyx_L1_error) #endif /* "arrex/numbers.pyx":18 @@ -2794,12 +4122,12 @@ if (!__Pyx_RefNanny) { * decl.dsize = sizeof(double) * decl.c_pack = pack_d */ - __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_5arrex_6dtypes_DDType)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(((PyObject *)__pyx_v_5arrex_7numbers_decl)); - __Pyx_DECREF_SET(__pyx_v_5arrex_7numbers_decl, ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_1)); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_5arrex_6dtypes_DDType)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XGOTREF((PyObject *)__pyx_v_5arrex_7numbers_decl); + __Pyx_DECREF_SET(__pyx_v_5arrex_7numbers_decl, ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_2)); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; /* "arrex/numbers.pyx":19 * @@ -2848,14 +4176,14 @@ if (!__Pyx_RefNanny) { * * */ - __pyx_t_1 = ((PyObject *)__pyx_v_5arrex_7numbers_decl); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_3.__pyx_n = 1; - __pyx_t_3.dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_1); - __pyx_t_2 = ((PyObject *)__pyx_f_5arrex_6dtypes_declare(__pyx_n_u_d, 0, &__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = ((PyObject *)__pyx_v_5arrex_7numbers_decl); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4.__pyx_n = 1; + __pyx_t_4.dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_2); + __pyx_t_3 = ((PyObject *)__pyx_f_5arrex_6dtypes_declare(__pyx_n_u_d, 0, &__pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "arrex/numbers.pyx":34 * return place[0] @@ -2864,12 +4192,12 @@ if (!__Pyx_RefNanny) { * decl.dsize = sizeof(float) * decl.c_pack = pack_f */ - __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_5arrex_6dtypes_DDType)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XGOTREF(((PyObject *)__pyx_v_5arrex_7numbers_decl)); - __Pyx_DECREF_SET(__pyx_v_5arrex_7numbers_decl, ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_2)); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_5arrex_6dtypes_DDType)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XGOTREF((PyObject *)__pyx_v_5arrex_7numbers_decl); + __Pyx_DECREF_SET(__pyx_v_5arrex_7numbers_decl, ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_3)); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; /* "arrex/numbers.pyx":35 * @@ -2918,14 +4246,14 @@ if (!__Pyx_RefNanny) { * * */ - __pyx_t_2 = ((PyObject *)__pyx_v_5arrex_7numbers_decl); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3.__pyx_n = 1; - __pyx_t_3.dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_2); - __pyx_t_1 = ((PyObject *)__pyx_f_5arrex_6dtypes_declare(__pyx_n_u_f, 0, &__pyx_t_3)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = ((PyObject *)__pyx_v_5arrex_7numbers_decl); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4.__pyx_n = 1; + __pyx_t_4.dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_3); + __pyx_t_2 = ((PyObject *)__pyx_f_5arrex_6dtypes_declare(__pyx_n_u_f, 0, &__pyx_t_4)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "arrex/numbers.pyx":50 * return place[0] @@ -2934,12 +4262,12 @@ if (!__Pyx_RefNanny) { * decl.dsize = sizeof(int8_t) * decl.c_pack = pack_b */ - __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_5arrex_6dtypes_DDType)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(((PyObject *)__pyx_v_5arrex_7numbers_decl)); - __Pyx_DECREF_SET(__pyx_v_5arrex_7numbers_decl, ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_1)); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_5arrex_6dtypes_DDType)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XGOTREF((PyObject *)__pyx_v_5arrex_7numbers_decl); + __Pyx_DECREF_SET(__pyx_v_5arrex_7numbers_decl, ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_2)); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; /* "arrex/numbers.pyx":51 * @@ -2988,14 +4316,14 @@ if (!__Pyx_RefNanny) { * * */ - __pyx_t_1 = ((PyObject *)__pyx_v_5arrex_7numbers_decl); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_3.__pyx_n = 1; - __pyx_t_3.dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_1); - __pyx_t_2 = ((PyObject *)__pyx_f_5arrex_6dtypes_declare(__pyx_n_u_b, 0, &__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = ((PyObject *)__pyx_v_5arrex_7numbers_decl); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4.__pyx_n = 1; + __pyx_t_4.dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_2); + __pyx_t_3 = ((PyObject *)__pyx_f_5arrex_6dtypes_declare(__pyx_n_u_b, 0, &__pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "arrex/numbers.pyx":66 * return place[0] @@ -3004,12 +4332,12 @@ if (!__Pyx_RefNanny) { * decl.dsize = sizeof(uint8_t) * decl.c_pack = pack_B */ - __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_5arrex_6dtypes_DDType)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XGOTREF(((PyObject *)__pyx_v_5arrex_7numbers_decl)); - __Pyx_DECREF_SET(__pyx_v_5arrex_7numbers_decl, ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_2)); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_5arrex_6dtypes_DDType)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XGOTREF((PyObject *)__pyx_v_5arrex_7numbers_decl); + __Pyx_DECREF_SET(__pyx_v_5arrex_7numbers_decl, ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_3)); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; /* "arrex/numbers.pyx":67 * @@ -3058,14 +4386,14 @@ if (!__Pyx_RefNanny) { * * */ - __pyx_t_2 = ((PyObject *)__pyx_v_5arrex_7numbers_decl); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3.__pyx_n = 1; - __pyx_t_3.dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_2); - __pyx_t_1 = ((PyObject *)__pyx_f_5arrex_6dtypes_declare(__pyx_n_u_B, 0, &__pyx_t_3)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = ((PyObject *)__pyx_v_5arrex_7numbers_decl); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4.__pyx_n = 1; + __pyx_t_4.dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_3); + __pyx_t_2 = ((PyObject *)__pyx_f_5arrex_6dtypes_declare(__pyx_n_u_B, 0, &__pyx_t_4)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 72, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "arrex/numbers.pyx":82 * return place[0] @@ -3074,12 +4402,12 @@ if (!__Pyx_RefNanny) { * decl.dsize = sizeof(int16_t) * decl.c_pack = pack_h */ - __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_5arrex_6dtypes_DDType)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(((PyObject *)__pyx_v_5arrex_7numbers_decl)); - __Pyx_DECREF_SET(__pyx_v_5arrex_7numbers_decl, ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_1)); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_5arrex_6dtypes_DDType)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 82, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XGOTREF((PyObject *)__pyx_v_5arrex_7numbers_decl); + __Pyx_DECREF_SET(__pyx_v_5arrex_7numbers_decl, ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_2)); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; /* "arrex/numbers.pyx":83 * @@ -3128,14 +4456,14 @@ if (!__Pyx_RefNanny) { * * */ - __pyx_t_1 = ((PyObject *)__pyx_v_5arrex_7numbers_decl); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_3.__pyx_n = 1; - __pyx_t_3.dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_1); - __pyx_t_2 = ((PyObject *)__pyx_f_5arrex_6dtypes_declare(__pyx_n_u_h, 0, &__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = ((PyObject *)__pyx_v_5arrex_7numbers_decl); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4.__pyx_n = 1; + __pyx_t_4.dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_2); + __pyx_t_3 = ((PyObject *)__pyx_f_5arrex_6dtypes_declare(__pyx_n_u_h, 0, &__pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "arrex/numbers.pyx":98 * return place[0] @@ -3144,12 +4472,12 @@ if (!__Pyx_RefNanny) { * decl.dsize = sizeof(uint16_t) * decl.c_pack = pack_H */ - __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_5arrex_6dtypes_DDType)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XGOTREF(((PyObject *)__pyx_v_5arrex_7numbers_decl)); - __Pyx_DECREF_SET(__pyx_v_5arrex_7numbers_decl, ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_2)); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_5arrex_6dtypes_DDType)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 98, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XGOTREF((PyObject *)__pyx_v_5arrex_7numbers_decl); + __Pyx_DECREF_SET(__pyx_v_5arrex_7numbers_decl, ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_3)); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; /* "arrex/numbers.pyx":99 * @@ -3198,14 +4526,14 @@ if (!__Pyx_RefNanny) { * * */ - __pyx_t_2 = ((PyObject *)__pyx_v_5arrex_7numbers_decl); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3.__pyx_n = 1; - __pyx_t_3.dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_2); - __pyx_t_1 = ((PyObject *)__pyx_f_5arrex_6dtypes_declare(__pyx_n_u_H, 0, &__pyx_t_3)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = ((PyObject *)__pyx_v_5arrex_7numbers_decl); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4.__pyx_n = 1; + __pyx_t_4.dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_3); + __pyx_t_2 = ((PyObject *)__pyx_f_5arrex_6dtypes_declare(__pyx_n_u_H, 0, &__pyx_t_4)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "arrex/numbers.pyx":114 * return place[0] @@ -3214,12 +4542,12 @@ if (!__Pyx_RefNanny) { * decl.dsize = sizeof(int32_t) * decl.c_pack = pack_i */ - __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_5arrex_6dtypes_DDType)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(((PyObject *)__pyx_v_5arrex_7numbers_decl)); - __Pyx_DECREF_SET(__pyx_v_5arrex_7numbers_decl, ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_1)); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_5arrex_6dtypes_DDType)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 114, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XGOTREF((PyObject *)__pyx_v_5arrex_7numbers_decl); + __Pyx_DECREF_SET(__pyx_v_5arrex_7numbers_decl, ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_2)); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; /* "arrex/numbers.pyx":115 * @@ -3268,14 +4596,14 @@ if (!__Pyx_RefNanny) { * * */ - __pyx_t_1 = ((PyObject *)__pyx_v_5arrex_7numbers_decl); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_3.__pyx_n = 1; - __pyx_t_3.dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_1); - __pyx_t_2 = ((PyObject *)__pyx_f_5arrex_6dtypes_declare(__pyx_n_u_i, 0, &__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 120, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = ((PyObject *)__pyx_v_5arrex_7numbers_decl); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4.__pyx_n = 1; + __pyx_t_4.dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_2); + __pyx_t_3 = ((PyObject *)__pyx_f_5arrex_6dtypes_declare(__pyx_n_u_i, 0, &__pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "arrex/numbers.pyx":130 * return place[0] @@ -3284,12 +4612,12 @@ if (!__Pyx_RefNanny) { * decl.dsize = sizeof(uint32_t) * decl.c_pack = pack_I */ - __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_5arrex_6dtypes_DDType)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XGOTREF(((PyObject *)__pyx_v_5arrex_7numbers_decl)); - __Pyx_DECREF_SET(__pyx_v_5arrex_7numbers_decl, ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_2)); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_5arrex_6dtypes_DDType)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XGOTREF((PyObject *)__pyx_v_5arrex_7numbers_decl); + __Pyx_DECREF_SET(__pyx_v_5arrex_7numbers_decl, ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_3)); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; /* "arrex/numbers.pyx":131 * @@ -3338,14 +4666,14 @@ if (!__Pyx_RefNanny) { * * */ - __pyx_t_2 = ((PyObject *)__pyx_v_5arrex_7numbers_decl); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3.__pyx_n = 1; - __pyx_t_3.dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_2); - __pyx_t_1 = ((PyObject *)__pyx_f_5arrex_6dtypes_declare(__pyx_n_u_I, 0, &__pyx_t_3)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = ((PyObject *)__pyx_v_5arrex_7numbers_decl); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4.__pyx_n = 1; + __pyx_t_4.dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_3); + __pyx_t_2 = ((PyObject *)__pyx_f_5arrex_6dtypes_declare(__pyx_n_u_I, 0, &__pyx_t_4)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 136, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "arrex/numbers.pyx":146 * return place[0] @@ -3354,12 +4682,12 @@ if (!__Pyx_RefNanny) { * decl.dsize = sizeof(int64_t) * decl.c_pack = pack_l */ - __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_5arrex_6dtypes_DDType)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(((PyObject *)__pyx_v_5arrex_7numbers_decl)); - __Pyx_DECREF_SET(__pyx_v_5arrex_7numbers_decl, ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_1)); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_5arrex_6dtypes_DDType)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XGOTREF((PyObject *)__pyx_v_5arrex_7numbers_decl); + __Pyx_DECREF_SET(__pyx_v_5arrex_7numbers_decl, ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_2)); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; /* "arrex/numbers.pyx":147 * @@ -3408,14 +4736,14 @@ if (!__Pyx_RefNanny) { * * */ - __pyx_t_1 = ((PyObject *)__pyx_v_5arrex_7numbers_decl); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_3.__pyx_n = 1; - __pyx_t_3.dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_1); - __pyx_t_2 = ((PyObject *)__pyx_f_5arrex_6dtypes_declare(__pyx_n_u_l, 0, &__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 152, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = ((PyObject *)__pyx_v_5arrex_7numbers_decl); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4.__pyx_n = 1; + __pyx_t_4.dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_2); + __pyx_t_3 = ((PyObject *)__pyx_f_5arrex_6dtypes_declare(__pyx_n_u_l, 0, &__pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 152, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "arrex/numbers.pyx":162 * return place[0] @@ -3424,12 +4752,12 @@ if (!__Pyx_RefNanny) { * decl.dsize = sizeof(uint64_t) * decl.c_pack = pack_L */ - __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_5arrex_6dtypes_DDType)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XGOTREF(((PyObject *)__pyx_v_5arrex_7numbers_decl)); - __Pyx_DECREF_SET(__pyx_v_5arrex_7numbers_decl, ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_2)); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_5arrex_6dtypes_DDType)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 162, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XGOTREF((PyObject *)__pyx_v_5arrex_7numbers_decl); + __Pyx_DECREF_SET(__pyx_v_5arrex_7numbers_decl, ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_3)); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; /* "arrex/numbers.pyx":163 * @@ -3478,14 +4806,14 @@ if (!__Pyx_RefNanny) { * * declare(float, declared('d')) */ - __pyx_t_2 = ((PyObject *)__pyx_v_5arrex_7numbers_decl); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3.__pyx_n = 1; - __pyx_t_3.dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_2); - __pyx_t_1 = ((PyObject *)__pyx_f_5arrex_6dtypes_declare(__pyx_n_u_L, 0, &__pyx_t_3)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 168, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = ((PyObject *)__pyx_v_5arrex_7numbers_decl); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4.__pyx_n = 1; + __pyx_t_4.dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_3); + __pyx_t_2 = ((PyObject *)__pyx_f_5arrex_6dtypes_declare(__pyx_n_u_L, 0, &__pyx_t_4)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 168, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "arrex/numbers.pyx":170 * declare('L', decl) @@ -3493,50 +4821,60 @@ if (!__Pyx_RefNanny) { * declare(float, declared('d')) # <<<<<<<<<<<<<< * declare(int, declared('l')) */ - __pyx_t_1 = ((PyObject *)__pyx_f_5arrex_6dtypes_declared(__pyx_n_u_d, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3.__pyx_n = 1; - __pyx_t_3.dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_1); - __pyx_t_2 = ((PyObject *)__pyx_f_5arrex_6dtypes_declare(((PyObject *)(&PyFloat_Type)), 0, &__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 170, __pyx_L1_error) + __pyx_t_2 = ((PyObject *)__pyx_f_5arrex_6dtypes_declared(__pyx_n_u_d, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 170, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4.__pyx_n = 1; + __pyx_t_4.dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_2); + __pyx_t_3 = ((PyObject *)__pyx_f_5arrex_6dtypes_declare(((PyObject *)(&PyFloat_Type)), 0, &__pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "arrex/numbers.pyx":171 * * declare(float, declared('d')) * declare(int, declared('l')) # <<<<<<<<<<<<<< */ - __pyx_t_2 = ((PyObject *)__pyx_f_5arrex_6dtypes_declared(__pyx_n_u_l, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error) + __pyx_t_3 = ((PyObject *)__pyx_f_5arrex_6dtypes_declared(__pyx_n_u_l, 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 171, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4.__pyx_n = 1; + __pyx_t_4.dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_3); + __pyx_t_2 = ((PyObject *)__pyx_f_5arrex_6dtypes_declare(((PyObject *)(&PyInt_Type)), 0, &__pyx_t_4)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3.__pyx_n = 1; - __pyx_t_3.dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_2); - __pyx_t_1 = ((PyObject *)__pyx_f_5arrex_6dtypes_declare(((PyObject *)(&PyInt_Type)), 0, &__pyx_t_3)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "arrex/numbers.pyx":1 * # cython: language_level=3, cdivision=True # <<<<<<<<<<<<<< * * cimport cython */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /*--- Wrapped vars code ---*/ goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); if (__pyx_m) { - if (__pyx_d) { + if (__pyx_d && stringtab_initialized) { __Pyx_AddTraceback("init arrex.numbers", __pyx_clineno, __pyx_lineno, __pyx_filename); } + #if !CYTHON_USE_MODULE_STATE Py_CLEAR(__pyx_m); + #else + Py_DECREF(__pyx_m); + if (pystate_addmodule_run) { + PyObject *tp, *value, *tb; + PyErr_Fetch(&tp, &value, &tb); + PyState_RemoveModule(&__pyx_moduledef); + PyErr_Restore(tp, value, tb); + } + #endif } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init arrex.numbers"); } @@ -3550,6 +4888,22 @@ if (!__Pyx_RefNanny) { return; #endif } +/* #### Code section: cleanup_globals ### */ +/* #### Code section: cleanup_module ### */ +/* #### Code section: main_method ### */ +/* #### Code section: utility_code_pragmas ### */ +#ifdef _MSC_VER +#pragma warning( push ) +/* Warning 4127: conditional expression is constant + * Cython uses constant conditional expressions to allow in inline functions to be optimized at + * compile-time, so this warning is not useful + */ +#pragma warning( disable : 4127 ) +#endif + + + +/* #### Code section: utility_code_def ### */ /* --- Runtime support code --- */ /* Refnanny */ @@ -3570,16 +4924,18 @@ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { #endif /* TypeImport */ -#ifndef __PYX_HAVE_RT_ImportType -#define __PYX_HAVE_RT_ImportType -static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name, - size_t size, enum __Pyx_ImportType_CheckSize check_size) +#ifndef __PYX_HAVE_RT_ImportType_3_0_0 +#define __PYX_HAVE_RT_ImportType_3_0_0 +static PyTypeObject *__Pyx_ImportType_3_0_0(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_0 check_size) { PyObject *result = 0; char warning[200]; Py_ssize_t basicsize; -#ifdef Py_LIMITED_API + Py_ssize_t itemsize; +#if CYTHON_COMPILING_IN_LIMITED_API PyObject *py_basicsize; + PyObject *py_itemsize; #endif result = PyObject_GetAttrString(module, class_name); if (!result) @@ -3590,8 +4946,9 @@ static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, module_name, class_name); goto bad; } -#ifndef Py_LIMITED_API +#if !CYTHON_COMPILING_IN_LIMITED_API basicsize = ((PyTypeObject *)result)->tp_basicsize; + itemsize = ((PyTypeObject *)result)->tp_itemsize; #else py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); if (!py_basicsize) @@ -3601,22 +4958,38 @@ static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, py_basicsize = 0; if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) goto bad; + py_itemsize = PyObject_GetAttrString(result, "__itemsize__"); + if (!py_itemsize) + goto bad; + itemsize = PyLong_AsSsize_t(py_itemsize); + Py_DECREF(py_itemsize); + py_itemsize = 0; + if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; #endif - if ((size_t)basicsize < size) { + if (itemsize) { + if (size % alignment) { + alignment = size % alignment; + } + if (itemsize < (Py_ssize_t)alignment) + itemsize = (Py_ssize_t)alignment; + } + if ((size_t)(basicsize + itemsize) < size) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); + module_name, class_name, size, basicsize+itemsize); goto bad; } - if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) { + if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_0 && + ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); + "Expected %zd from C header, got %zd-%zd from PyObject", + module_name, class_name, size, basicsize, basicsize+itemsize); goto bad; } - else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) { + else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_0 && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", @@ -3631,7 +5004,7 @@ static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, #endif /* PyFunctionFastCall */ -#if CYTHON_FAST_PYCALL +#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, PyObject *globals) { PyFrameObject *f; @@ -3660,7 +5033,6 @@ static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args --tstate->recursion_depth; return result; } -#if 1 || PY_VERSION_HEX < 0x030600B1 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); PyObject *globals = PyFunction_GET_GLOBALS(func); @@ -3676,7 +5048,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, PyObject *result; assert(kwargs == NULL || PyDict_Check(kwargs)); nk = kwargs ? PyDict_Size(kwargs) : 0; - if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) { return NULL; } if ( @@ -3747,7 +5119,6 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, return result; } #endif -#endif /* PyObjectCall */ #if CYTHON_COMPILING_IN_CPYTHON @@ -3789,27 +5160,88 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject } #endif -/* PyObjectCallNoArg */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, NULL, 0); +/* PyObjectFastCall */ +static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) { + PyObject *argstuple; + PyObject *result; + size_t i; + argstuple = PyTuple_New((Py_ssize_t)nargs); + if (unlikely(!argstuple)) return NULL; + for (i = 0; i < nargs; i++) { + Py_INCREF(args[i]); + PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]); } -#endif -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func))) + result = __Pyx_PyObject_Call(func, argstuple, kwargs); + Py_DECREF(argstuple); + return result; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) { + Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); +#if CYTHON_COMPILING_IN_CPYTHON + if (nargs == 0 && kwargs == NULL) { +#if defined(__Pyx_CyFunction_USED) && defined(NDEBUG) + if (__Pyx_IsCyOrPyCFunction(func)) #else - if (likely(PyCFunction_Check(func))) + if (PyCFunction_Check(func)) #endif - { - if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { - return __Pyx_PyObject_CallMethO(func, NULL); + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { + return __Pyx_PyObject_CallMethO(func, NULL); + } + } + } + else if (nargs == 1 && kwargs == NULL) { + if (PyCFunction_Check(func)) + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, args[0]); + } } } - return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); -} #endif + #if PY_VERSION_HEX < 0x030800B1 + #if CYTHON_FAST_PYCCALL + if (PyCFunction_Check(func)) { + if (kwargs) { + return _PyCFunction_FastCallDict(func, args, nargs, kwargs); + } else { + return _PyCFunction_FastCallKeywords(func, args, nargs, NULL); + } + } + #if PY_VERSION_HEX >= 0x030700A1 + if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) { + return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL); + } + #endif + #endif + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs); + } + #endif + #endif + #if CYTHON_VECTORCALL + vectorcallfunc f = _PyVectorcall_Function(func); + if (f) { + return f(func, args, (size_t)nargs, kwargs); + } + #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL + if (__Pyx_CyFunction_CheckExact(func)) { + __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func); + if (f) return f(func, args, (size_t)nargs, kwargs); + } + #endif + if (nargs == 0) { + return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs); + } + return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); +} + +/* PyObjectCallNoArg */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { + PyObject *arg = NULL; + return __Pyx_PyObject_FastCall(func, (&arg)+1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} /* PyDictVersioning */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS @@ -3836,24 +5268,66 @@ static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UIN return obj_dict_version == __Pyx_get_object_dict_version(obj); } #endif - -/* PyObjectGetAttrStr */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); + +/* PyErrExceptionMatches */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; i= 0x030C00A6 + PyObject *current_exception = tstate->current_exception; + if (unlikely(!current_exception)) return 0; + exc_type = (PyObject*) Py_TYPE(current_exception); + if (exc_type == err) return 1; +#else + exc_type = tstate->curexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; #endif - return PyObject_GetAttr(obj, attr_name); + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(exc_type); + #endif + if (unlikely(PyTuple_Check(err))) { + result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + } else { + result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(exc_type); + #endif + return result; } #endif /* PyErrFetchRestore */ #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject *tmp_value; + assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); + if (value) { + #if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) + #endif + PyException_SetTraceback(value, tb); + } + tmp_value = tstate->current_exception; + tstate->current_exception = value; + Py_XDECREF(tmp_value); +#else PyObject *tmp_type, *tmp_value, *tmp_tb; tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; @@ -3864,25 +5338,82 @@ static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObjec Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); +#endif } static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject* exc_value; + exc_value = tstate->current_exception; + tstate->current_exception = 0; + *value = exc_value; + *type = NULL; + *tb = NULL; + if (exc_value) { + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + #if CYTHON_COMPILING_IN_CPYTHON + *tb = ((PyBaseExceptionObject*) exc_value)->traceback; + Py_XINCREF(*tb); + #else + *tb = PyException_GetTraceback(exc_value); + #endif + } +#else *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; +#endif +} +#endif + +/* PyObjectGetAttrStr */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#endif + +/* PyObjectGetAttrStrNoError */ +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); } +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } #endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +} /* CLineInTraceback */ #ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) { +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { PyObject *use_cline; PyObject *ptype, *pvalue, *ptraceback; #if CYTHON_COMPILING_IN_CPYTHON PyObject **cython_runtime_dict; #endif + CYTHON_MAYBE_UNUSED_VAR(tstate); if (unlikely(!__pyx_cython_runtime)) { return c_line; } @@ -3896,7 +5427,7 @@ static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int } else #endif { - PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); + PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); if (use_cline_obj) { use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; Py_DECREF(use_cline_obj); @@ -3918,6 +5449,7 @@ static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int #endif /* CodeObjectCache */ +#if !CYTHON_COMPILING_IN_LIMITED_API static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { @@ -3996,11 +5528,28 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { __pyx_code_cache.count++; Py_INCREF(code_object); } +#endif /* AddTraceback */ #include "compile.h" #include "frameobject.h" #include "traceback.h" +#if PY_VERSION_HEX >= 0x030b00a6 + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif +#if CYTHON_COMPILING_IN_LIMITED_API +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + if (c_line) { + (void) __pyx_cfilenm; + (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); + } + _PyTraceback_Add(funcname, filename, py_line); +} +#else static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { @@ -4035,6 +5584,7 @@ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( 0, 0, 0, + 0, __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ @@ -4064,14 +5614,24 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject *ptype, *pvalue, *ptraceback; if (c_line) { c_line = __Pyx_CLineForTraceback(tstate, c_line); } py_code = __pyx_find_code_object(c_line ? -c_line : py_line); if (!py_code) { + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); - if (!py_code) goto bad; + if (!py_code) { + /* If the code object creation fails, then we should clear the + fetched exception references and propagate the new exception */ + Py_XDECREF(ptype); + Py_XDECREF(pvalue); + Py_XDECREF(ptraceback); + goto bad; + } + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); } py_frame = PyFrame_New( @@ -4087,6 +5647,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, Py_XDECREF(py_code); Py_XDECREF(py_frame); } +#endif /* CIntFromPyVerify */ #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ @@ -4123,7 +5684,7 @@ static CYTHON_INLINE int8_t __Pyx_PyInt_As_int8_t(PyObject *x) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(int8_t) < sizeof(long)) { + if ((sizeof(int8_t) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(int8_t, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -4137,40 +5698,45 @@ static CYTHON_INLINE int8_t __Pyx_PyInt_As_int8_t(PyObject *x) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int8_t) 0; - case 1: __PYX_VERIFY_RETURN_INT(int8_t, digit, digits[0]) - case 2: - if (8 * sizeof(int8_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int8_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int8_t) >= 2 * PyLong_SHIFT) { - return (int8_t) (((((int8_t)digits[1]) << PyLong_SHIFT) | (int8_t)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int8_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(int8_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int8_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int8_t) >= 2 * PyLong_SHIFT)) { + return (int8_t) (((((int8_t)digits[1]) << PyLong_SHIFT) | (int8_t)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(int8_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int8_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int8_t) >= 3 * PyLong_SHIFT) { - return (int8_t) (((((((int8_t)digits[2]) << PyLong_SHIFT) | (int8_t)digits[1]) << PyLong_SHIFT) | (int8_t)digits[0])); + break; + case 3: + if ((8 * sizeof(int8_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int8_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int8_t) >= 3 * PyLong_SHIFT)) { + return (int8_t) (((((((int8_t)digits[2]) << PyLong_SHIFT) | (int8_t)digits[1]) << PyLong_SHIFT) | (int8_t)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(int8_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int8_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int8_t) >= 4 * PyLong_SHIFT) { - return (int8_t) (((((((((int8_t)digits[3]) << PyLong_SHIFT) | (int8_t)digits[2]) << PyLong_SHIFT) | (int8_t)digits[1]) << PyLong_SHIFT) | (int8_t)digits[0])); + break; + case 4: + if ((8 * sizeof(int8_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int8_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int8_t) >= 4 * PyLong_SHIFT)) { + return (int8_t) (((((((((int8_t)digits[3]) << PyLong_SHIFT) | (int8_t)digits[2]) << PyLong_SHIFT) | (int8_t)digits[1]) << PyLong_SHIFT) | (int8_t)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -4183,109 +5749,181 @@ static CYTHON_INLINE int8_t __Pyx_PyInt_As_int8_t(PyObject *x) { goto raise_neg_overflow; } #endif - if (sizeof(int8_t) <= sizeof(unsigned long)) { + if ((sizeof(int8_t) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(int8_t, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int8_t) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(int8_t) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int8_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int8_t) 0; - case -1: __PYX_VERIFY_RETURN_INT(int8_t, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int8_t, digit, +digits[0]) - case -2: - if (8 * sizeof(int8_t) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int8_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int8_t) - 1 > 2 * PyLong_SHIFT) { - return (int8_t) (((int8_t)-1)*(((((int8_t)digits[1]) << PyLong_SHIFT) | (int8_t)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int8_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(int8_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int8_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int8_t) - 1 > 2 * PyLong_SHIFT)) { + return (int8_t) (((int8_t)-1)*(((((int8_t)digits[1]) << PyLong_SHIFT) | (int8_t)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(int8_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int8_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int8_t) - 1 > 2 * PyLong_SHIFT) { - return (int8_t) ((((((int8_t)digits[1]) << PyLong_SHIFT) | (int8_t)digits[0]))); + break; + case 2: + if ((8 * sizeof(int8_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int8_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int8_t) - 1 > 2 * PyLong_SHIFT)) { + return (int8_t) ((((((int8_t)digits[1]) << PyLong_SHIFT) | (int8_t)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(int8_t) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int8_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int8_t) - 1 > 3 * PyLong_SHIFT) { - return (int8_t) (((int8_t)-1)*(((((((int8_t)digits[2]) << PyLong_SHIFT) | (int8_t)digits[1]) << PyLong_SHIFT) | (int8_t)digits[0]))); + break; + case -3: + if ((8 * sizeof(int8_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int8_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int8_t) - 1 > 3 * PyLong_SHIFT)) { + return (int8_t) (((int8_t)-1)*(((((((int8_t)digits[2]) << PyLong_SHIFT) | (int8_t)digits[1]) << PyLong_SHIFT) | (int8_t)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(int8_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int8_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int8_t) - 1 > 3 * PyLong_SHIFT) { - return (int8_t) ((((((((int8_t)digits[2]) << PyLong_SHIFT) | (int8_t)digits[1]) << PyLong_SHIFT) | (int8_t)digits[0]))); + break; + case 3: + if ((8 * sizeof(int8_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int8_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int8_t) - 1 > 3 * PyLong_SHIFT)) { + return (int8_t) ((((((((int8_t)digits[2]) << PyLong_SHIFT) | (int8_t)digits[1]) << PyLong_SHIFT) | (int8_t)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(int8_t) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int8_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int8_t) - 1 > 4 * PyLong_SHIFT) { - return (int8_t) (((int8_t)-1)*(((((((((int8_t)digits[3]) << PyLong_SHIFT) | (int8_t)digits[2]) << PyLong_SHIFT) | (int8_t)digits[1]) << PyLong_SHIFT) | (int8_t)digits[0]))); + break; + case -4: + if ((8 * sizeof(int8_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int8_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int8_t) - 1 > 4 * PyLong_SHIFT)) { + return (int8_t) (((int8_t)-1)*(((((((((int8_t)digits[3]) << PyLong_SHIFT) | (int8_t)digits[2]) << PyLong_SHIFT) | (int8_t)digits[1]) << PyLong_SHIFT) | (int8_t)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(int8_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int8_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int8_t) - 1 > 4 * PyLong_SHIFT) { - return (int8_t) ((((((((((int8_t)digits[3]) << PyLong_SHIFT) | (int8_t)digits[2]) << PyLong_SHIFT) | (int8_t)digits[1]) << PyLong_SHIFT) | (int8_t)digits[0]))); + break; + case 4: + if ((8 * sizeof(int8_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int8_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int8_t) - 1 > 4 * PyLong_SHIFT)) { + return (int8_t) ((((((((((int8_t)digits[3]) << PyLong_SHIFT) | (int8_t)digits[2]) << PyLong_SHIFT) | (int8_t)digits[1]) << PyLong_SHIFT) | (int8_t)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(int8_t) <= sizeof(long)) { + if ((sizeof(int8_t) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(int8_t, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int8_t) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(int8_t) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int8_t, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else int8_t val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (int8_t) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (int8_t) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int8_t) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (int8_t) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (int8_t) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(int8_t) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((int8_t) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(int8_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int8_t) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((int8_t) 1) << (sizeof(int8_t) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (int8_t) -1; } } else { @@ -4357,7 +5995,7 @@ static CYTHON_INLINE uint8_t __Pyx_PyInt_As_uint8_t(PyObject *x) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(uint8_t) < sizeof(long)) { + if ((sizeof(uint8_t) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(uint8_t, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -4371,40 +6009,45 @@ static CYTHON_INLINE uint8_t __Pyx_PyInt_As_uint8_t(PyObject *x) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (uint8_t) 0; - case 1: __PYX_VERIFY_RETURN_INT(uint8_t, digit, digits[0]) - case 2: - if (8 * sizeof(uint8_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint8_t) >= 2 * PyLong_SHIFT) { - return (uint8_t) (((((uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint8_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(uint8_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint8_t) >= 2 * PyLong_SHIFT)) { + return (uint8_t) (((((uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(uint8_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint8_t) >= 3 * PyLong_SHIFT) { - return (uint8_t) (((((((uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])); + break; + case 3: + if ((8 * sizeof(uint8_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint8_t) >= 3 * PyLong_SHIFT)) { + return (uint8_t) (((((((uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(uint8_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint8_t) >= 4 * PyLong_SHIFT) { - return (uint8_t) (((((((((uint8_t)digits[3]) << PyLong_SHIFT) | (uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])); + break; + case 4: + if ((8 * sizeof(uint8_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint8_t) >= 4 * PyLong_SHIFT)) { + return (uint8_t) (((((((((uint8_t)digits[3]) << PyLong_SHIFT) | (uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -4417,109 +6060,181 @@ static CYTHON_INLINE uint8_t __Pyx_PyInt_As_uint8_t(PyObject *x) { goto raise_neg_overflow; } #endif - if (sizeof(uint8_t) <= sizeof(unsigned long)) { + if ((sizeof(uint8_t) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(uint8_t, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(uint8_t) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(uint8_t) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(uint8_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (uint8_t) 0; - case -1: __PYX_VERIFY_RETURN_INT(uint8_t, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(uint8_t, digit, +digits[0]) - case -2: - if (8 * sizeof(uint8_t) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint8_t) - 1 > 2 * PyLong_SHIFT) { - return (uint8_t) (((uint8_t)-1)*(((((uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint8_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(uint8_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint8_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint8_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint8_t) (((uint8_t)-1)*(((((uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(uint8_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint8_t) - 1 > 2 * PyLong_SHIFT) { - return (uint8_t) ((((((uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); + break; + case 2: + if ((8 * sizeof(uint8_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint8_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint8_t) ((((((uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(uint8_t) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint8_t) - 1 > 3 * PyLong_SHIFT) { - return (uint8_t) (((uint8_t)-1)*(((((((uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); + break; + case -3: + if ((8 * sizeof(uint8_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint8_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint8_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint8_t) (((uint8_t)-1)*(((((((uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(uint8_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint8_t) - 1 > 3 * PyLong_SHIFT) { - return (uint8_t) ((((((((uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); + break; + case 3: + if ((8 * sizeof(uint8_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint8_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint8_t) ((((((((uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(uint8_t) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint8_t) - 1 > 4 * PyLong_SHIFT) { - return (uint8_t) (((uint8_t)-1)*(((((((((uint8_t)digits[3]) << PyLong_SHIFT) | (uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); + break; + case -4: + if ((8 * sizeof(uint8_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint8_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint8_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint8_t) (((uint8_t)-1)*(((((((((uint8_t)digits[3]) << PyLong_SHIFT) | (uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(uint8_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint8_t) - 1 > 4 * PyLong_SHIFT) { - return (uint8_t) ((((((((((uint8_t)digits[3]) << PyLong_SHIFT) | (uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); + break; + case 4: + if ((8 * sizeof(uint8_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint8_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint8_t) ((((((((((uint8_t)digits[3]) << PyLong_SHIFT) | (uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(uint8_t) <= sizeof(long)) { + if ((sizeof(uint8_t) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(uint8_t, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(uint8_t) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(uint8_t) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(uint8_t, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else uint8_t val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (uint8_t) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (uint8_t) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (uint8_t) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (uint8_t) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (uint8_t) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(uint8_t) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((uint8_t) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(uint8_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((uint8_t) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((uint8_t) 1) << (sizeof(uint8_t) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (uint8_t) -1; } } else { @@ -4591,7 +6306,7 @@ static CYTHON_INLINE int16_t __Pyx_PyInt_As_int16_t(PyObject *x) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(int16_t) < sizeof(long)) { + if ((sizeof(int16_t) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(int16_t, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -4605,40 +6320,45 @@ static CYTHON_INLINE int16_t __Pyx_PyInt_As_int16_t(PyObject *x) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int16_t) 0; - case 1: __PYX_VERIFY_RETURN_INT(int16_t, digit, digits[0]) - case 2: - if (8 * sizeof(int16_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int16_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int16_t) >= 2 * PyLong_SHIFT) { - return (int16_t) (((((int16_t)digits[1]) << PyLong_SHIFT) | (int16_t)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int16_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(int16_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int16_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int16_t) >= 2 * PyLong_SHIFT)) { + return (int16_t) (((((int16_t)digits[1]) << PyLong_SHIFT) | (int16_t)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(int16_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int16_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int16_t) >= 3 * PyLong_SHIFT) { - return (int16_t) (((((((int16_t)digits[2]) << PyLong_SHIFT) | (int16_t)digits[1]) << PyLong_SHIFT) | (int16_t)digits[0])); + break; + case 3: + if ((8 * sizeof(int16_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int16_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int16_t) >= 3 * PyLong_SHIFT)) { + return (int16_t) (((((((int16_t)digits[2]) << PyLong_SHIFT) | (int16_t)digits[1]) << PyLong_SHIFT) | (int16_t)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(int16_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int16_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int16_t) >= 4 * PyLong_SHIFT) { - return (int16_t) (((((((((int16_t)digits[3]) << PyLong_SHIFT) | (int16_t)digits[2]) << PyLong_SHIFT) | (int16_t)digits[1]) << PyLong_SHIFT) | (int16_t)digits[0])); + break; + case 4: + if ((8 * sizeof(int16_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int16_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int16_t) >= 4 * PyLong_SHIFT)) { + return (int16_t) (((((((((int16_t)digits[3]) << PyLong_SHIFT) | (int16_t)digits[2]) << PyLong_SHIFT) | (int16_t)digits[1]) << PyLong_SHIFT) | (int16_t)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -4651,109 +6371,181 @@ static CYTHON_INLINE int16_t __Pyx_PyInt_As_int16_t(PyObject *x) { goto raise_neg_overflow; } #endif - if (sizeof(int16_t) <= sizeof(unsigned long)) { + if ((sizeof(int16_t) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(int16_t, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int16_t) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(int16_t) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int16_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int16_t) 0; - case -1: __PYX_VERIFY_RETURN_INT(int16_t, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int16_t, digit, +digits[0]) - case -2: - if (8 * sizeof(int16_t) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int16_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int16_t) - 1 > 2 * PyLong_SHIFT) { - return (int16_t) (((int16_t)-1)*(((((int16_t)digits[1]) << PyLong_SHIFT) | (int16_t)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int16_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(int16_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int16_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int16_t) - 1 > 2 * PyLong_SHIFT)) { + return (int16_t) (((int16_t)-1)*(((((int16_t)digits[1]) << PyLong_SHIFT) | (int16_t)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(int16_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int16_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int16_t) - 1 > 2 * PyLong_SHIFT) { - return (int16_t) ((((((int16_t)digits[1]) << PyLong_SHIFT) | (int16_t)digits[0]))); + break; + case 2: + if ((8 * sizeof(int16_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int16_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int16_t) - 1 > 2 * PyLong_SHIFT)) { + return (int16_t) ((((((int16_t)digits[1]) << PyLong_SHIFT) | (int16_t)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(int16_t) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int16_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int16_t) - 1 > 3 * PyLong_SHIFT) { - return (int16_t) (((int16_t)-1)*(((((((int16_t)digits[2]) << PyLong_SHIFT) | (int16_t)digits[1]) << PyLong_SHIFT) | (int16_t)digits[0]))); + break; + case -3: + if ((8 * sizeof(int16_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int16_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int16_t) - 1 > 3 * PyLong_SHIFT)) { + return (int16_t) (((int16_t)-1)*(((((((int16_t)digits[2]) << PyLong_SHIFT) | (int16_t)digits[1]) << PyLong_SHIFT) | (int16_t)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(int16_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int16_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int16_t) - 1 > 3 * PyLong_SHIFT) { - return (int16_t) ((((((((int16_t)digits[2]) << PyLong_SHIFT) | (int16_t)digits[1]) << PyLong_SHIFT) | (int16_t)digits[0]))); + break; + case 3: + if ((8 * sizeof(int16_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int16_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int16_t) - 1 > 3 * PyLong_SHIFT)) { + return (int16_t) ((((((((int16_t)digits[2]) << PyLong_SHIFT) | (int16_t)digits[1]) << PyLong_SHIFT) | (int16_t)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(int16_t) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int16_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int16_t) - 1 > 4 * PyLong_SHIFT) { - return (int16_t) (((int16_t)-1)*(((((((((int16_t)digits[3]) << PyLong_SHIFT) | (int16_t)digits[2]) << PyLong_SHIFT) | (int16_t)digits[1]) << PyLong_SHIFT) | (int16_t)digits[0]))); + break; + case -4: + if ((8 * sizeof(int16_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int16_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int16_t) - 1 > 4 * PyLong_SHIFT)) { + return (int16_t) (((int16_t)-1)*(((((((((int16_t)digits[3]) << PyLong_SHIFT) | (int16_t)digits[2]) << PyLong_SHIFT) | (int16_t)digits[1]) << PyLong_SHIFT) | (int16_t)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(int16_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int16_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int16_t) - 1 > 4 * PyLong_SHIFT) { - return (int16_t) ((((((((((int16_t)digits[3]) << PyLong_SHIFT) | (int16_t)digits[2]) << PyLong_SHIFT) | (int16_t)digits[1]) << PyLong_SHIFT) | (int16_t)digits[0]))); + break; + case 4: + if ((8 * sizeof(int16_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int16_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int16_t) - 1 > 4 * PyLong_SHIFT)) { + return (int16_t) ((((((((((int16_t)digits[3]) << PyLong_SHIFT) | (int16_t)digits[2]) << PyLong_SHIFT) | (int16_t)digits[1]) << PyLong_SHIFT) | (int16_t)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(int16_t) <= sizeof(long)) { + if ((sizeof(int16_t) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(int16_t, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int16_t) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(int16_t) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int16_t, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else int16_t val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (int16_t) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (int16_t) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int16_t) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (int16_t) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (int16_t) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(int16_t) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((int16_t) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(int16_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int16_t) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((int16_t) 1) << (sizeof(int16_t) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (int16_t) -1; } } else { @@ -4825,7 +6617,7 @@ static CYTHON_INLINE uint16_t __Pyx_PyInt_As_uint16_t(PyObject *x) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(uint16_t) < sizeof(long)) { + if ((sizeof(uint16_t) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(uint16_t, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -4839,40 +6631,45 @@ static CYTHON_INLINE uint16_t __Pyx_PyInt_As_uint16_t(PyObject *x) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (uint16_t) 0; - case 1: __PYX_VERIFY_RETURN_INT(uint16_t, digit, digits[0]) - case 2: - if (8 * sizeof(uint16_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint16_t) >= 2 * PyLong_SHIFT) { - return (uint16_t) (((((uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint16_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(uint16_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint16_t) >= 2 * PyLong_SHIFT)) { + return (uint16_t) (((((uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(uint16_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint16_t) >= 3 * PyLong_SHIFT) { - return (uint16_t) (((((((uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0])); + break; + case 3: + if ((8 * sizeof(uint16_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint16_t) >= 3 * PyLong_SHIFT)) { + return (uint16_t) (((((((uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(uint16_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint16_t) >= 4 * PyLong_SHIFT) { - return (uint16_t) (((((((((uint16_t)digits[3]) << PyLong_SHIFT) | (uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0])); + break; + case 4: + if ((8 * sizeof(uint16_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint16_t) >= 4 * PyLong_SHIFT)) { + return (uint16_t) (((((((((uint16_t)digits[3]) << PyLong_SHIFT) | (uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -4885,109 +6682,181 @@ static CYTHON_INLINE uint16_t __Pyx_PyInt_As_uint16_t(PyObject *x) { goto raise_neg_overflow; } #endif - if (sizeof(uint16_t) <= sizeof(unsigned long)) { + if ((sizeof(uint16_t) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(uint16_t, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(uint16_t) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(uint16_t) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(uint16_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (uint16_t) 0; - case -1: __PYX_VERIFY_RETURN_INT(uint16_t, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(uint16_t, digit, +digits[0]) - case -2: - if (8 * sizeof(uint16_t) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint16_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint16_t) - 1 > 2 * PyLong_SHIFT) { - return (uint16_t) (((uint16_t)-1)*(((((uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint16_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(uint16_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint16_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint16_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint16_t) (((uint16_t)-1)*(((((uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(uint16_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint16_t) - 1 > 2 * PyLong_SHIFT) { - return (uint16_t) ((((((uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]))); + break; + case 2: + if ((8 * sizeof(uint16_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint16_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint16_t) ((((((uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(uint16_t) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint16_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint16_t) - 1 > 3 * PyLong_SHIFT) { - return (uint16_t) (((uint16_t)-1)*(((((((uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]))); + break; + case -3: + if ((8 * sizeof(uint16_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint16_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint16_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint16_t) (((uint16_t)-1)*(((((((uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(uint16_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint16_t) - 1 > 3 * PyLong_SHIFT) { - return (uint16_t) ((((((((uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]))); + break; + case 3: + if ((8 * sizeof(uint16_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint16_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint16_t) ((((((((uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(uint16_t) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint16_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint16_t) - 1 > 4 * PyLong_SHIFT) { - return (uint16_t) (((uint16_t)-1)*(((((((((uint16_t)digits[3]) << PyLong_SHIFT) | (uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]))); + break; + case -4: + if ((8 * sizeof(uint16_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint16_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint16_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint16_t) (((uint16_t)-1)*(((((((((uint16_t)digits[3]) << PyLong_SHIFT) | (uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(uint16_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint16_t) - 1 > 4 * PyLong_SHIFT) { - return (uint16_t) ((((((((((uint16_t)digits[3]) << PyLong_SHIFT) | (uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]))); + break; + case 4: + if ((8 * sizeof(uint16_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint16_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint16_t) ((((((((((uint16_t)digits[3]) << PyLong_SHIFT) | (uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(uint16_t) <= sizeof(long)) { + if ((sizeof(uint16_t) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(uint16_t, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(uint16_t) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(uint16_t) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(uint16_t, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else uint16_t val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (uint16_t) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (uint16_t) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (uint16_t) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (uint16_t) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (uint16_t) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(uint16_t) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((uint16_t) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(uint16_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((uint16_t) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((uint16_t) 1) << (sizeof(uint16_t) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (uint16_t) -1; } } else { @@ -5059,7 +6928,7 @@ static CYTHON_INLINE int32_t __Pyx_PyInt_As_int32_t(PyObject *x) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(int32_t) < sizeof(long)) { + if ((sizeof(int32_t) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(int32_t, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -5073,40 +6942,45 @@ static CYTHON_INLINE int32_t __Pyx_PyInt_As_int32_t(PyObject *x) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int32_t) 0; - case 1: __PYX_VERIFY_RETURN_INT(int32_t, digit, digits[0]) - case 2: - if (8 * sizeof(int32_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int32_t) >= 2 * PyLong_SHIFT) { - return (int32_t) (((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int32_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(int32_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) >= 2 * PyLong_SHIFT)) { + return (int32_t) (((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(int32_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int32_t) >= 3 * PyLong_SHIFT) { - return (int32_t) (((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])); + break; + case 3: + if ((8 * sizeof(int32_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) >= 3 * PyLong_SHIFT)) { + return (int32_t) (((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(int32_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int32_t) >= 4 * PyLong_SHIFT) { - return (int32_t) (((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])); + break; + case 4: + if ((8 * sizeof(int32_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) >= 4 * PyLong_SHIFT)) { + return (int32_t) (((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -5119,109 +6993,181 @@ static CYTHON_INLINE int32_t __Pyx_PyInt_As_int32_t(PyObject *x) { goto raise_neg_overflow; } #endif - if (sizeof(int32_t) <= sizeof(unsigned long)) { + if ((sizeof(int32_t) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(int32_t, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int32_t) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(int32_t) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int32_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int32_t) 0; - case -1: __PYX_VERIFY_RETURN_INT(int32_t, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int32_t, digit, +digits[0]) - case -2: - if (8 * sizeof(int32_t) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT) { - return (int32_t) (((int32_t)-1)*(((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int32_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(int32_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT)) { + return (int32_t) (((int32_t)-1)*(((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(int32_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT) { - return (int32_t) ((((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + break; + case 2: + if ((8 * sizeof(int32_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT)) { + return (int32_t) ((((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT) { - return (int32_t) (((int32_t)-1)*(((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + break; + case -3: + if ((8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT)) { + return (int32_t) (((int32_t)-1)*(((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(int32_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT) { - return (int32_t) ((((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + break; + case 3: + if ((8 * sizeof(int32_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT)) { + return (int32_t) ((((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int32_t) - 1 > 4 * PyLong_SHIFT) { - return (int32_t) (((int32_t)-1)*(((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + break; + case -4: + if ((8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) - 1 > 4 * PyLong_SHIFT)) { + return (int32_t) (((int32_t)-1)*(((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(int32_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int32_t) - 1 > 4 * PyLong_SHIFT) { - return (int32_t) ((((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + break; + case 4: + if ((8 * sizeof(int32_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) - 1 > 4 * PyLong_SHIFT)) { + return (int32_t) ((((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(int32_t) <= sizeof(long)) { + if ((sizeof(int32_t) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(int32_t, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int32_t) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(int32_t) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int32_t, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else int32_t val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (int32_t) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (int32_t) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int32_t) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (int32_t) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (int32_t) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(int32_t) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((int32_t) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(int32_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int32_t) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((int32_t) 1) << (sizeof(int32_t) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (int32_t) -1; } } else { @@ -5293,7 +7239,7 @@ static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *x) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(uint32_t) < sizeof(long)) { + if ((sizeof(uint32_t) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(uint32_t, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -5307,40 +7253,45 @@ static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *x) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (uint32_t) 0; - case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, digits[0]) - case 2: - if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) >= 2 * PyLong_SHIFT) { - return (uint32_t) (((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint32_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(uint32_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) >= 2 * PyLong_SHIFT)) { + return (uint32_t) (((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(uint32_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) >= 3 * PyLong_SHIFT) { - return (uint32_t) (((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); + break; + case 3: + if ((8 * sizeof(uint32_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) >= 3 * PyLong_SHIFT)) { + return (uint32_t) (((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(uint32_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) >= 4 * PyLong_SHIFT) { - return (uint32_t) (((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); + break; + case 4: + if ((8 * sizeof(uint32_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) >= 4 * PyLong_SHIFT)) { + return (uint32_t) (((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -5353,109 +7304,181 @@ static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *x) { goto raise_neg_overflow; } #endif - if (sizeof(uint32_t) <= sizeof(unsigned long)) { + if ((sizeof(uint32_t) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (uint32_t) 0; - case -1: __PYX_VERIFY_RETURN_INT(uint32_t, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, +digits[0]) - case -2: - if (8 * sizeof(uint32_t) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { - return (uint32_t) (((uint32_t)-1)*(((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint32_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(uint32_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint32_t) (((uint32_t)-1)*(((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { - return (uint32_t) ((((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + break; + case 2: + if ((8 * sizeof(uint32_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint32_t) ((((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { - return (uint32_t) (((uint32_t)-1)*(((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + break; + case -3: + if ((8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint32_t) (((uint32_t)-1)*(((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(uint32_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { - return (uint32_t) ((((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + break; + case 3: + if ((8 * sizeof(uint32_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint32_t) ((((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) - 1 > 4 * PyLong_SHIFT) { - return (uint32_t) (((uint32_t)-1)*(((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + break; + case -4: + if ((8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint32_t) (((uint32_t)-1)*(((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(uint32_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) - 1 > 4 * PyLong_SHIFT) { - return (uint32_t) ((((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + break; + case 4: + if ((8 * sizeof(uint32_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint32_t) ((((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(uint32_t) <= sizeof(long)) { + if ((sizeof(uint32_t) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(uint32_t, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(uint32_t) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(uint32_t, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else uint32_t val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (uint32_t) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (uint32_t) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (uint32_t) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (uint32_t) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (uint32_t) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(uint32_t) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((uint32_t) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(uint32_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((uint32_t) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((uint32_t) 1) << (sizeof(uint32_t) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (uint32_t) -1; } } else { @@ -5527,7 +7550,7 @@ static CYTHON_INLINE int64_t __Pyx_PyInt_As_int64_t(PyObject *x) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(int64_t) < sizeof(long)) { + if ((sizeof(int64_t) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(int64_t, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -5541,40 +7564,45 @@ static CYTHON_INLINE int64_t __Pyx_PyInt_As_int64_t(PyObject *x) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int64_t) 0; - case 1: __PYX_VERIFY_RETURN_INT(int64_t, digit, digits[0]) - case 2: - if (8 * sizeof(int64_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int64_t) >= 2 * PyLong_SHIFT) { - return (int64_t) (((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int64_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(int64_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int64_t) >= 2 * PyLong_SHIFT)) { + return (int64_t) (((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(int64_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int64_t) >= 3 * PyLong_SHIFT) { - return (int64_t) (((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])); + break; + case 3: + if ((8 * sizeof(int64_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int64_t) >= 3 * PyLong_SHIFT)) { + return (int64_t) (((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(int64_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int64_t) >= 4 * PyLong_SHIFT) { - return (int64_t) (((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])); + break; + case 4: + if ((8 * sizeof(int64_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int64_t) >= 4 * PyLong_SHIFT)) { + return (int64_t) (((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -5587,109 +7615,181 @@ static CYTHON_INLINE int64_t __Pyx_PyInt_As_int64_t(PyObject *x) { goto raise_neg_overflow; } #endif - if (sizeof(int64_t) <= sizeof(unsigned long)) { + if ((sizeof(int64_t) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(int64_t, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int64_t) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(int64_t) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int64_t) 0; - case -1: __PYX_VERIFY_RETURN_INT(int64_t, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int64_t, digit, +digits[0]) - case -2: - if (8 * sizeof(int64_t) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT) { - return (int64_t) (((int64_t)-1)*(((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int64_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(int64_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT)) { + return (int64_t) (((int64_t)-1)*(((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(int64_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT) { - return (int64_t) ((((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]))); + break; + case 2: + if ((8 * sizeof(int64_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT)) { + return (int64_t) ((((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT) { - return (int64_t) (((int64_t)-1)*(((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]))); + break; + case -3: + if ((8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT)) { + return (int64_t) (((int64_t)-1)*(((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(int64_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT) { - return (int64_t) ((((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]))); + break; + case 3: + if ((8 * sizeof(int64_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT)) { + return (int64_t) ((((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int64_t) - 1 > 4 * PyLong_SHIFT) { - return (int64_t) (((int64_t)-1)*(((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]))); + break; + case -4: + if ((8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int64_t) - 1 > 4 * PyLong_SHIFT)) { + return (int64_t) (((int64_t)-1)*(((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(int64_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int64_t) - 1 > 4 * PyLong_SHIFT) { - return (int64_t) ((((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]))); + break; + case 4: + if ((8 * sizeof(int64_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int64_t) - 1 > 4 * PyLong_SHIFT)) { + return (int64_t) ((((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(int64_t) <= sizeof(long)) { + if ((sizeof(int64_t) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(int64_t, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int64_t) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(int64_t) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int64_t, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else int64_t val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (int64_t) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (int64_t) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int64_t) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (int64_t) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (int64_t) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(int64_t) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((int64_t) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(int64_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int64_t) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((int64_t) 1) << (sizeof(int64_t) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (int64_t) -1; } } else { @@ -5761,7 +7861,7 @@ static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *x) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(uint64_t) < sizeof(long)) { + if ((sizeof(uint64_t) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(uint64_t, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -5775,40 +7875,45 @@ static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *x) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (uint64_t) 0; - case 1: __PYX_VERIFY_RETURN_INT(uint64_t, digit, digits[0]) - case 2: - if (8 * sizeof(uint64_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint64_t) >= 2 * PyLong_SHIFT) { - return (uint64_t) (((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint64_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(uint64_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 2 * PyLong_SHIFT)) { + return (uint64_t) (((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(uint64_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint64_t) >= 3 * PyLong_SHIFT) { - return (uint64_t) (((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + break; + case 3: + if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 3 * PyLong_SHIFT)) { + return (uint64_t) (((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(uint64_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint64_t) >= 4 * PyLong_SHIFT) { - return (uint64_t) (((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + break; + case 4: + if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 4 * PyLong_SHIFT)) { + return (uint64_t) (((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -5821,109 +7926,181 @@ static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *x) { goto raise_neg_overflow; } #endif - if (sizeof(uint64_t) <= sizeof(unsigned long)) { + if ((sizeof(uint64_t) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (uint64_t) 0; - case -1: __PYX_VERIFY_RETURN_INT(uint64_t, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(uint64_t, digit, +digits[0]) - case -2: - if (8 * sizeof(uint64_t) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) { - return (uint64_t) (((uint64_t)-1)*(((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint64_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(uint64_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(uint64_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) { - return (uint64_t) ((((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + break; + case 2: + if ((8 * sizeof(uint64_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint64_t) ((((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) { - return (uint64_t) (((uint64_t)-1)*(((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + break; + case -3: + if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(uint64_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) { - return (uint64_t) ((((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + break; + case 3: + if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint64_t) ((((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT) { - return (uint64_t) (((uint64_t)-1)*(((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + break; + case -4: + if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(uint64_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT) { - return (uint64_t) ((((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + break; + case 4: + if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint64_t) ((((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(uint64_t) <= sizeof(long)) { + if ((sizeof(uint64_t) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(uint64_t, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(uint64_t) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(uint64_t, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else uint64_t val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (uint64_t) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (uint64_t) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (uint64_t) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (uint64_t) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (uint64_t) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(uint64_t) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((uint64_t) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(uint64_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((uint64_t) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((uint64_t) 1) << (sizeof(uint64_t) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (uint64_t) -1; } } else { @@ -5982,6 +8159,21 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint64_t(uint64_t value) { } } +/* FormatTypeName */ +#if CYTHON_COMPILING_IN_LIMITED_API +static __Pyx_TypeName +__Pyx_PyType_GetName(PyTypeObject* tp) +{ + PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_n_s_name); + if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { + PyErr_Clear(); + Py_XSETREF(name, __Pyx_NewRef(__pyx_n_s_)); + } + return name; +} +#endif + /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC @@ -6033,7 +8225,7 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { + if ((sizeof(long) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -6047,40 +8239,45 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -6093,109 +8290,181 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { goto raise_neg_overflow; } #endif - if (sizeof(long) <= sizeof(unsigned long)) { + if ((sizeof(long) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) - case -2: - if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case -3: + if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case -4: + if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(long) <= sizeof(long)) { + if ((sizeof(long) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else long val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (long) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (long) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (long) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (long) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (long) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((long) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((long) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (long) -1; } } else { @@ -6229,7 +8498,7 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { + if ((sizeof(int) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -6243,40 +8512,45 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -6289,109 +8563,181 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { goto raise_neg_overflow; } #endif - if (sizeof(int) <= sizeof(unsigned long)) { + if ((sizeof(int) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case -3: + if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case -4: + if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(int) <= sizeof(long)) { + if ((sizeof(int) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else int val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (int) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (int) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (int) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (int) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((int) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (int) -1; } } else { @@ -6416,7 +8762,7 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { #if CYTHON_COMPILING_IN_CPYTHON static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { while (a) { - a = a->tp_base; + a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); if (a == b) return 1; } @@ -6437,6 +8783,22 @@ static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { } return __Pyx_InBases(a, b); } +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (cls == a || cls == b) return 1; + mro = cls->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + PyObject *base = PyTuple_GET_ITEM(mro, i); + if (base == (PyObject *)a || base == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); +} #if PY_MAJOR_VERSION == 2 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { PyObject *exception, *value, *tb; @@ -6461,11 +8823,11 @@ static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc } #else static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { - int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0; - if (!res) { - res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); + if (exc_type1) { + return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); + } else { + return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); } - return res; } #endif static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { @@ -6514,13 +8876,35 @@ static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObj /* CheckBinaryVersion */ 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 ctversion[5]; + int same=1, i, found_dot; + const char* rt_from_call = Py_GetVersion(); + PyOS_snprintf(ctversion, 5, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + found_dot = 0; + for (i = 0; i < 4; i++) { + if (!ctversion[i]) { + same = (rt_from_call[i] < '0' || rt_from_call[i] > '9'); + break; + } + if (rt_from_call[i] != ctversion[i]) { + same = 0; + break; + } + } + if (!same) { + char rtversion[5] = {'\0'}; char message[200]; + for (i=0; i<4; ++i) { + if (rt_from_call[i] == '.') { + if (found_dot) break; + found_dot = 1; + } else if (rt_from_call[i] < '0' || rt_from_call[i] > '9') { + break; + } + rtversion[i] = rt_from_call[i]; + } PyOS_snprintf(message, sizeof(message), - "compiletime version %s of module '%.100s' " + "compile time version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); return PyErr_WarnEx(NULL, message, 1); @@ -6529,9 +8913,9 @@ static int __Pyx_check_binary_version(void) { } /* FunctionImport */ -#ifndef __PYX_HAVE_RT_ImportFunction -#define __PYX_HAVE_RT_ImportFunction -static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { +#ifndef __PYX_HAVE_RT_ImportFunction_3_0_0 +#define __PYX_HAVE_RT_ImportFunction_3_0_0 +static int __Pyx_ImportFunction_3_0_0(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { PyObject *d = 0; PyObject *cobj = 0; union { @@ -6548,7 +8932,6 @@ static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (** PyModule_GetName(module), funcname); goto bad; } -#if PY_VERSION_HEX >= 0x02070000 if (!PyCapsule_IsValid(cobj, sig)) { PyErr_Format(PyExc_TypeError, "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", @@ -6556,21 +8939,6 @@ static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (** goto bad; } tmp.p = PyCapsule_GetPointer(cobj, sig); -#else - {const char *desc, *s1, *s2; - desc = (const char *)PyCObject_GetDesc(cobj); - if (!desc) - goto bad; - s1 = desc; s2 = sig; - while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } - if (*s1 != *s2) { - PyErr_Format(PyExc_TypeError, - "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", - PyModule_GetName(module), funcname, sig, desc); - goto bad; - } - tmp.p = PyCObject_AsVoidPtr(cobj);} -#endif *f = tmp.fp; if (!(*f)) goto bad; @@ -6583,9 +8951,31 @@ static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (** #endif /* InitStrings */ +#if PY_MAJOR_VERSION >= 3 +static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) { + if (t.is_unicode | t.is_str) { + if (t.intern) { + *str = PyUnicode_InternFromString(t.s); + } else if (t.encoding) { + *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL); + } else { + *str = PyUnicode_FromStringAndSize(t.s, t.n - 1); + } + } else { + *str = PyBytes_FromStringAndSize(t.s, t.n - 1); + } + if (!*str) + return -1; + if (PyObject_Hash(*str) == -1) + return -1; + return 0; +} +#endif static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { - #if PY_MAJOR_VERSION < 3 + #if PY_MAJOR_VERSION >= 3 + __Pyx_InitString(*t, t->p); + #else if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { @@ -6593,23 +8983,11 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } - #else - 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; if (PyObject_Hash(*t->p) == -1) return -1; + #endif ++t; } return 0; @@ -6671,7 +9049,7 @@ static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ return __Pyx_PyUnicode_AsStringAndSize(o, length); } else #endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) +#if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) if (PyByteArray_Check(o)) { *length = PyByteArray_GET_SIZE(o); return PyByteArray_AS_STRING(o); @@ -6700,22 +9078,26 @@ static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { return retval; } static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { + __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result)); #if PY_MAJOR_VERSION >= 3 if (PyLong_Check(result)) { if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, - "__int__ returned non-int (type %.200s). " - "The ability to return an instance of a strict subclass of int " - "is deprecated, and may be removed in a future version of Python.", - Py_TYPE(result)->tp_name)) { + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " + "The ability to return an instance of a strict subclass of int is deprecated, " + "and may be removed in a future version of Python.", + result_type_name)) { + __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } + __Pyx_DECREF_TypeName(result_type_name); return result; } #endif PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type %.200s)", - type_name, type_name, Py_TYPE(result)->tp_name); + "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")", + type_name, type_name, result_type_name); + __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } @@ -6781,13 +9163,11 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { #endif if (likely(PyLong_CheckExact(b))) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)b)->ob_digit; - const Py_ssize_t size = Py_SIZE(b); - if (likely(__Pyx_sst_abs(size) <= 1)) { - ival = likely(size) ? digits[0] : 0; - if (size == -1) ival = -ival; - return ival; + if (likely(__Pyx_PyLong_IsCompact(b))) { + return __Pyx_PyLong_CompactValue(b); } else { + const digit* digits = __Pyx_PyLong_Digits(b); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); switch (size) { case 2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { @@ -6855,4 +9235,12 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { } +/* #### Code section: utility_code_pragmas_end ### */ +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + + + +/* #### Code section: end ### */ #endif /* Py_PYTHON_H */