From ed051c145d684d1ceeae6d763a6f8672cb2a5c87 Mon Sep 17 00:00:00 2001 From: jimy-byerley Date: Thu, 10 Feb 2022 12:53:26 +0100 Subject: [PATCH] updated C code on repo --- arrex/dtypes.c | 154 ++++- arrex/list.c | 1568 +++++++++++++++++++++++++++-------------------- arrex/numbers.c | 133 +++- 3 files changed, 1156 insertions(+), 699 deletions(-) diff --git a/arrex/dtypes.c b/arrex/dtypes.c index dc9a218..7af6fd6 100644 --- a/arrex/dtypes.c +++ b/arrex/dtypes.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.29.24 */ +/* Generated by Cython 0.29.26 */ /* BEGIN: Cython Metadata { @@ -22,8 +22,8 @@ END: Cython Metadata */ #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) #error Cython requires Python 2.6+ or Python 3.3+. #else -#define CYTHON_ABI "0_29_24" -#define CYTHON_HEX_VERSION 0x001D18F0 +#define CYTHON_ABI "0_29_26" +#define CYTHON_HEX_VERSION 0x001D1AF0 #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof @@ -170,7 +170,7 @@ END: Cython Metadata */ #ifndef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 1 #endif - #if PY_VERSION_HEX < 0x030300F0 + #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2 #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #elif !defined(CYTHON_USE_UNICODE_WRITER) @@ -189,7 +189,7 @@ END: Cython Metadata */ #define CYTHON_FAST_THREAD_STATE 1 #endif #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 1 + #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030B00A1) #endif #ifndef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) @@ -208,7 +208,9 @@ END: Cython Metadata */ #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif #if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" + #if PY_MAJOR_VERSION < 3 + #include "longintrepr.h" + #endif #undef SHIFT #undef BASE #undef MASK @@ -325,9 +327,68 @@ END: Cython Metadata */ #define __Pyx_DefaultClassType PyClass_Type #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" -#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2 - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) + #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, + 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; + const char *fn_cstr=NULL; + const char *name_cstr=NULL; + PyCodeObject* co=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 (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; + if (!(nlocals=PyLong_FromLong(l))) goto end; + if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end; + if (!(stacksize=PyLong_FromLong(s))) goto end; + if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end; + if (!(flags=PyLong_FromLong(f))) goto end; + if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end; + 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: + Py_XDECREF(kwds); + Py_XDECREF(argcount); + Py_XDECREF(posonlyargcount); + Py_XDECREF(kwonlyargcount); + 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; + } #else #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) @@ -565,10 +626,10 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #if PY_VERSION_HEX < 0x030200A4 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t PyInt_AsLong + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_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)) @@ -727,6 +788,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #if CYTHON_ASSUME_SAFE_MACROS #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else @@ -1112,6 +1174,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #ifndef Py_MEMBER_SIZE #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) #endif +#if CYTHON_FAST_PYCALL static size_t __pyx_pyframe_localsplus_offset = 0; #include "frameobject.h" #define __Pxy_PyFrame_Initialize_Offsets()\ @@ -1119,6 +1182,7 @@ 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 /* PyObjectCall.proto */ @@ -7460,6 +7524,9 @@ static PyTypeObject __pyx_type_5arrex_6dtypes_DDType = { #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif + #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000 + 0, /*tp_pypy_flags*/ + #endif }; static struct __pyx_vtabstruct_5arrex_6dtypes_DDTypeFunctions __pyx_vtable_5arrex_6dtypes_DDTypeFunctions; @@ -7622,6 +7689,9 @@ static PyTypeObject __pyx_type_5arrex_6dtypes_DDTypeFunctions = { #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif + #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000 + 0, /*tp_pypy_flags*/ + #endif }; static struct __pyx_vtabstruct_5arrex_6dtypes_DDTypeCType __pyx_vtable_5arrex_6dtypes_DDTypeCType; @@ -7763,6 +7833,9 @@ static PyTypeObject __pyx_type_5arrex_6dtypes_DDTypeCType = { #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif + #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000 + 0, /*tp_pypy_flags*/ + #endif }; static struct __pyx_vtabstruct_5arrex_6dtypes_DDTypeExtension __pyx_vtable_5arrex_6dtypes_DDTypeExtension; @@ -7925,6 +7998,9 @@ static PyTypeObject __pyx_type_5arrex_6dtypes_DDTypeExtension = { #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif + #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000 + 0, /*tp_pypy_flags*/ + #endif }; static PyObject *__pyx_tp_new_5arrex_6dtypes__head(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { @@ -8020,6 +8096,9 @@ static PyTypeObject __pyx_type_5arrex_6dtypes__head = { #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif + #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000 + 0, /*tp_pypy_flags*/ + #endif }; static struct __pyx_obj_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct *__pyx_freelist_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct[8]; @@ -8135,6 +8214,9 @@ static PyTypeObject __pyx_type_5arrex_6dtypes___pyx_scope_struct__DDTypeStruct = #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif + #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000 + 0, /*tp_pypy_flags*/ + #endif }; static PyMethodDef __pyx_methods[] = { @@ -10222,6 +10304,9 @@ static PyTypeObject __pyx_CyFunctionType_type = { #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, #endif +#if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000 + 0, +#endif }; static int __pyx_CyFunction_init(void) { __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); @@ -11206,7 +11291,7 @@ static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int } if (!use_cline) { c_line = 0; - PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); + (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); } else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { c_line = 0; @@ -11303,30 +11388,31 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; + PyCodeObject *py_code = NULL; + PyObject *py_funcname = NULL; #if PY_MAJOR_VERSION < 3 + PyObject *py_srcfile = NULL; py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif if (!py_srcfile) goto bad; + #endif if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + funcname = PyUnicode_AsUTF8(py_funcname); + if (!funcname) goto bad; #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); + if (!py_funcname) goto bad; #endif } - if (!py_funcname) goto bad; + #if PY_MAJOR_VERSION < 3 py_code = __Pyx_PyCode_New( 0, 0, @@ -11345,11 +11431,16 @@ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); + #else + py_code = PyCode_NewEmpty(filename, funcname, py_line); + #endif + Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline return py_code; bad: - Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_srcfile); + #endif return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, @@ -12430,6 +12521,23 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_DECREF(x); return ival; } +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { + if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { + return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); +#if PY_MAJOR_VERSION < 3 + } else if (likely(PyInt_CheckExact(o))) { + return PyInt_AS_LONG(o); +#endif + } else { + Py_ssize_t ival; + PyObject *x; + x = PyNumber_Index(o); + if (!x) return -1; + ival = PyInt_AsLong(x); + Py_DECREF(x); + return ival; + } +} static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); } diff --git a/arrex/list.c b/arrex/list.c index 81b4d8b..0f9e253 100644 --- a/arrex/list.c +++ b/arrex/list.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.29.24 */ +/* Generated by Cython 0.29.26 */ /* BEGIN: Cython Metadata { @@ -22,8 +22,8 @@ END: Cython Metadata */ #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) #error Cython requires Python 2.6+ or Python 3.3+. #else -#define CYTHON_ABI "0_29_24" -#define CYTHON_HEX_VERSION 0x001D18F0 +#define CYTHON_ABI "0_29_26" +#define CYTHON_HEX_VERSION 0x001D1AF0 #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof @@ -170,7 +170,7 @@ END: Cython Metadata */ #ifndef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 1 #endif - #if PY_VERSION_HEX < 0x030300F0 + #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2 #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #elif !defined(CYTHON_USE_UNICODE_WRITER) @@ -189,7 +189,7 @@ END: Cython Metadata */ #define CYTHON_FAST_THREAD_STATE 1 #endif #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 1 + #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030B00A1) #endif #ifndef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) @@ -208,7 +208,9 @@ END: Cython Metadata */ #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif #if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" + #if PY_MAJOR_VERSION < 3 + #include "longintrepr.h" + #endif #undef SHIFT #undef BASE #undef MASK @@ -325,9 +327,68 @@ END: Cython Metadata */ #define __Pyx_DefaultClassType PyClass_Type #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" -#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2 - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) + #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, + 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; + const char *fn_cstr=NULL; + const char *name_cstr=NULL; + PyCodeObject* co=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 (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; + if (!(nlocals=PyLong_FromLong(l))) goto end; + if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end; + if (!(stacksize=PyLong_FromLong(s))) goto end; + if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end; + if (!(flags=PyLong_FromLong(f))) goto end; + if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end; + 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: + Py_XDECREF(kwds); + Py_XDECREF(argcount); + Py_XDECREF(posonlyargcount); + Py_XDECREF(kwonlyargcount); + 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; + } #else #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) @@ -565,10 +626,10 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #if PY_VERSION_HEX < 0x030200A4 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t PyInt_AsLong + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_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)) @@ -740,6 +801,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #if CYTHON_ASSUME_SAFE_MACROS #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else @@ -931,7 +993,7 @@ struct __pyx_obj_5arrex_4list_typedlist { }; -/* "arrex/list.pyx":626 +/* "arrex/list.pyx":641 * * * cdef class arrayexposer: # <<<<<<<<<<<<<< @@ -945,7 +1007,7 @@ struct __pyx_obj_5arrex_4list_arrayexposer { }; -/* "arrex/list.pyx":633 +/* "arrex/list.pyx":648 * * * cdef class arrayiter: # <<<<<<<<<<<<<< @@ -1201,6 +1263,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #ifndef Py_MEMBER_SIZE #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) #endif +#if CYTHON_FAST_PYCALL static size_t __pyx_pyframe_localsplus_offset = 0; #include "frameobject.h" #define __Pxy_PyFrame_Initialize_Offsets()\ @@ -1208,6 +1271,7 @@ 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 */ @@ -1542,12 +1606,13 @@ static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_IndexError; static PyObject *__pyx_builtin_NotImplemented; +static PyObject *__pyx_builtin_RuntimeError; static PyObject *__pyx_builtin_print; static PyObject *__pyx_builtin_OverflowError; static PyObject *__pyx_builtin_enumerate; static const char __pyx_k_i[] = "i"; -static const char __pyx_k__12[] = ", "; -static const char __pyx_k__13[] = "])"; +static const char __pyx_k__13[] = ", "; +static const char __pyx_k__14[] = "])"; static const char __pyx_k_new[] = "__new__"; static const char __pyx_k_sys[] = "sys"; static const char __pyx_k_dict[] = "__dict__"; @@ -1584,7 +1649,7 @@ 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_pyx_state[] = "__pyx_state"; -static const char __pyx_k_reduce_ex[] = "reduce_ex"; +static const char __pyx_k_reduce_ex[] = "__reduce_ex__"; static const char __pyx_k_typedlist[] = "typedlist(["; static const char __pyx_k_IndexError[] = "IndexError"; static const char __pyx_k_ValueError[] = "ValueError"; @@ -1593,9 +1658,9 @@ static const char __pyx_k_pyx_result[] = "__pyx_result"; static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__"; static const char __pyx_k_PickleError[] = "PickleError"; static const char __pyx_k_getrefcount[] = "getrefcount"; -static const char __pyx_k_reduce_ex_2[] = "__reduce_ex__"; 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_pyx_checksum[] = "__pyx_checksum"; static const char __pyx_k_staticmethod[] = "staticmethod"; @@ -1614,6 +1679,7 @@ static const char __pyx_k_index_must_be_int[] = "index must be int"; static const char __pyx_k_iterable_is_empty[] = "iterable is empty"; 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_pop_from_empty_list[] = "pop from empty list"; 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_pyx_unpickle_arrayexposer[] = "__pyx_unpickle_arrayexposer"; @@ -1625,6 +1691,7 @@ static const char __pyx_k_arrayiter_must_not_be_instanciat[] = "arrayiter must n 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; @@ -1633,11 +1700,12 @@ 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__14; static PyObject *__pyx_kp_u_amount_must_be_positive; static PyObject *__pyx_n_s_append; static PyObject *__pyx_n_s_array; @@ -1673,6 +1741,7 @@ 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; @@ -1684,11 +1753,9 @@ 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_u_rebuild; static PyObject *__pyx_n_s_reduce; static PyObject *__pyx_n_s_reduce_cython; -static PyObject *__pyx_n_u_reduce_ex; -static PyObject *__pyx_n_s_reduce_ex_2; +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; @@ -1702,6 +1769,7 @@ 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; @@ -1767,10 +1835,10 @@ 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_slice__15; static PyObject *__pyx_tuple__10; static PyObject *__pyx_tuple__11; -static PyObject *__pyx_tuple__15; +static PyObject *__pyx_tuple__12; static PyObject *__pyx_tuple__16; static PyObject *__pyx_tuple__17; static PyObject *__pyx_tuple__18; @@ -3165,18 +3233,18 @@ static int __pyx_f_5arrex_4list_9typedlist__reallocate(struct __pyx_obj_5arrex_4 __pyx_v_self->ptr = PyBytes_AS_STRING(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "arrex/list.pyx":225 - * #self.owner = buff - * #self.ptr = buff.ptr - * self.allocated = size # <<<<<<<<<<<<<< - * + /* "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->allocated = __pyx_v_size; /* "arrex/list.pyx":229 - * #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) * @@ -3191,7 +3259,7 @@ static int __pyx_f_5arrex_4list_9typedlist__reallocate(struct __pyx_obj_5arrex_4 __pyx_v_self->size = __pyx_t_5; /* "arrex/list.pyx":230 - * + * self.allocated = size * self.size = min(size, self.size) * memcpy(self.ptr, lastptr, self.size) # <<<<<<<<<<<<<< * @@ -3580,16 +3648,16 @@ static int __pyx_f_5arrex_4list_9typedlist_append(struct __pyx_obj_5arrex_4list_ /* "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: # <<<<<<<<<<<<<< + * 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); + __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: + * if self.allocated < self.size + self.dtype.dsize: * self._reallocate(self.allocated*2 or self.dtype.dsize) # <<<<<<<<<<<<<< * * self._setitem(self.ptr + self.size, value) @@ -3607,7 +3675,7 @@ static int __pyx_f_5arrex_4list_9typedlist_append(struct __pyx_obj_5arrex_4list_ /* "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: # <<<<<<<<<<<<<< + * if self.allocated < self.size + self.dtype.dsize: # <<<<<<<<<<<<<< * self._reallocate(self.allocated*2 or self.dtype.dsize) * */ @@ -3770,81 +3838,162 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_10pop(struct __pyx_obj_5arrex_ PyObject *__pyx_v_e = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - size_t __pyx_t_1; - int __pyx_t_2; - Py_ssize_t __pyx_t_3; - PyObject *__pyx_t_4 = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + Py_ssize_t __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("pop", 0); - /* "arrex/list.pyx":278 - * ''' - * cdef size_t i - * i = self._index(index) if index is not None else self._len() # <<<<<<<<<<<<<< + /* "arrex/list.pyx":280 + * cdef void * start + * + * if not self.size: # <<<<<<<<<<<<<< + * raise IndexError('pop from empty list') + * + */ + __pyx_t_1 = ((!(__pyx_v_self->size != 0)) != 0); + if (unlikely(__pyx_t_1)) { + + /* "arrex/list.pyx":281 + * + * if not self.size: + * raise IndexError('pop from empty list') # <<<<<<<<<<<<<< + * + * if index is None: + */ + __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":280 + * cdef void * start + * + * if not self.size: # <<<<<<<<<<<<<< + * raise IndexError('pop from empty list') * - * cdef void * start = self.ptr + i*self.dtype.dsize */ - __pyx_t_2 = (__pyx_v_index != Py_None); - if ((__pyx_t_2 != 0)) { - __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, 278, __pyx_L1_error) - __pyx_t_1 = __pyx_t_3; - } else { - __pyx_t_1 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_len(__pyx_v_self); } - __pyx_v_i = __pyx_t_1; - /* "arrex/list.pyx":280 - * i = self._index(index) if index is not None else self._len() + /* "arrex/list.pyx":283 + * raise IndexError('pop from empty list') * - * cdef void * start = self.ptr + i*self.dtype.dsize # <<<<<<<<<<<<<< - * e = self._getitem(start) - * memmove(start, start + self.dtype.dsize, self.size-(i+1)*self.dtype.dsize) + * if index is None: # <<<<<<<<<<<<<< + * e = self._getitem(self.ptr + self.size - self.dtype.dsize) + * self.size -= self.dtype.dsize */ - __pyx_v_start = (__pyx_v_self->ptr + (__pyx_v_i * __pyx_v_self->dtype->dsize)); + __pyx_t_1 = (__pyx_v_index == Py_None); + __pyx_t_3 = (__pyx_t_1 != 0); + if (__pyx_t_3) { - /* "arrex/list.pyx":281 + /* "arrex/list.pyx":284 * - * cdef void * 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 + * if index is None: + * e = self._getitem(self.ptr + self.size - self.dtype.dsize) # <<<<<<<<<<<<<< + * self.size -= self.dtype.dsize + * return e */ - __pyx_t_4 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_getitem(__pyx_v_self, __pyx_v_start); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 281, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_v_e = __pyx_t_4; - __pyx_t_4 = 0; + __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":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":282 - * cdef void * 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":286 + * e = self._getitem(self.ptr + self.size - self.dtype.dsize) + * self.size -= self.dtype.dsize + * return e # <<<<<<<<<<<<<< + * else: + * i = self._index(index) */ - (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_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_e); + __pyx_r = __pyx_v_e; + goto __pyx_L0; - /* "arrex/list.pyx":283 - * 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":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 + */ + } + + /* "arrex/list.pyx":288 + * return e + * else: + * i = self._index(index) # <<<<<<<<<<<<<< + * + * 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; + + /* "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) + */ + __pyx_v_start = (__pyx_v_self->ptr + (__pyx_v_i * __pyx_v_self->dtype->dsize)); + + /* "arrex/list.pyx":291 + * + * 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_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":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 + */ + (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":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 * */ - __pyx_v_self->size = (__pyx_v_self->size - __pyx_v_self->dtype->dsize); + __pyx_v_self->size = (__pyx_v_self->size - __pyx_v_self->dtype->dsize); - /* "arrex/list.pyx":284 - * memmove(start, start + self.dtype.dsize, self.size-(i+1)*self.dtype.dsize) - * self.size -= self.dtype.dsize - * return e # <<<<<<<<<<<<<< + /* "arrex/list.pyx":294 + * memmove(start, start + self.dtype.dsize, self.size-(i+1)*self.dtype.dsize) + * self.size -= self.dtype.dsize + * return e # <<<<<<<<<<<<<< * * def insert(self, index, value): */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_e); - __pyx_r = __pyx_v_e; - goto __pyx_L0; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_e); + __pyx_r = __pyx_v_e; + goto __pyx_L0; + } /* "arrex/list.pyx":272 * self.size += self.dtype.dsize @@ -3856,7 +4005,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_10pop(struct __pyx_obj_5arrex_ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("arrex.list.typedlist.pop", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -3866,8 +4015,8 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_10pop(struct __pyx_obj_5arrex_ return __pyx_r; } -/* "arrex/list.pyx":286 - * return e +/* "arrex/list.pyx":296 + * return e * * def insert(self, index, value): # <<<<<<<<<<<<<< * ''' insert(index, value) @@ -3909,11 +4058,11 @@ static PyObject *__pyx_pw_5arrex_4list_9typedlist_13insert(PyObject *__pyx_v_sel 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, 286, __pyx_L3_error) + __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, 286, __pyx_L3_error) + 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; @@ -3926,7 +4075,7 @@ static PyObject *__pyx_pw_5arrex_4list_9typedlist_13insert(PyObject *__pyx_v_sel } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("insert", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 286, __pyx_L3_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(); @@ -3940,32 +4089,106 @@ static PyObject *__pyx_pw_5arrex_4list_9typedlist_13insert(PyObject *__pyx_v_sel } 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) { - size_t __pyx_v_i; + Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_l; + size_t __pyx_v_j; void *__pyx_v_start; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; int __pyx_t_2; - size_t __pyx_t_3; - size_t __pyx_t_4; - int __pyx_t_5; + 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_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("insert", 0); - /* "arrex/list.pyx":291 - * insert value at index + /* "arrex/list.pyx":302 * ''' - * cdef size_t i = self._index(index) # <<<<<<<<<<<<<< * - * if self.allocated - self.size < self.dtype.dsize: + * cdef Py_ssize_t i = index # <<<<<<<<<<<<<< + * cdef Py_ssize_t l = self._len() + * if i < 0: i += l */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_index(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1L))) __PYX_ERR(0, 291, __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, 302, __pyx_L1_error) __pyx_v_i = __pyx_t_1; - /* "arrex/list.pyx":293 - * cdef size_t i = self._index(index) + /* "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_v_l = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_len(__pyx_v_self); + + /* "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_2 = ((__pyx_v_i < 0) != 0); + if (__pyx_t_2) { + __pyx_v_i = (__pyx_v_i + __pyx_v_l); + } + + /* "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_3 = ((__pyx_v_i < 0) != 0); + 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)) { + + /* "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 + * + */ + __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) + + /* "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":307 + * 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) @@ -3974,25 +4197,25 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_12insert(struct __pyx_obj_5arr __pyx_t_2 = (((__pyx_v_self->allocated - __pyx_v_self->size) < __pyx_v_self->dtype->dsize) != 0); if (__pyx_t_2) { - /* "arrex/list.pyx":294 + /* "arrex/list.pyx":310 * * if self.allocated - self.size < self.dtype.dsize: * self._reallocate(self.allocated*2 or self.dtype.dsize) # <<<<<<<<<<<<<< * - * cdef void * start = self.ptr + i*self.dtype.dsize + * cdef void * start = self.ptr + j*self.dtype.dsize */ - __pyx_t_4 = (__pyx_v_self->allocated * 2); - if (!__pyx_t_4) { + __pyx_t_6 = (__pyx_v_self->allocated * 2); + if (!__pyx_t_6) { } else { - __pyx_t_3 = __pyx_t_4; - goto __pyx_L4_bool_binop_done; + __pyx_t_5 = __pyx_t_6; + goto __pyx_L8_bool_binop_done; } - __pyx_t_3 = __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_3); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 294, __pyx_L1_error) + __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":293 - * cdef size_t i = self._index(index) + /* "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) @@ -4000,35 +4223,35 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_12insert(struct __pyx_obj_5arr */ } - /* "arrex/list.pyx":296 + /* "arrex/list.pyx":312 * self._reallocate(self.allocated*2 or self.dtype.dsize) * - * cdef void * start = self.ptr + i*self.dtype.dsize # <<<<<<<<<<<<<< - * memmove(start+self.dtype.dsize, start, self.size-i*self.dtype.dsize) + * cdef void * 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_i * __pyx_v_self->dtype->dsize)); + __pyx_v_start = (__pyx_v_self->ptr + (__pyx_v_j * __pyx_v_self->dtype->dsize)); - /* "arrex/list.pyx":297 + /* "arrex/list.pyx":313 * - * cdef void * start = self.ptr + i*self.dtype.dsize - * memmove(start+self.dtype.dsize, start, self.size-i*self.dtype.dsize) # <<<<<<<<<<<<<< + * cdef void * 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_i * __pyx_v_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":298 - * cdef void * start = self.ptr + i*self.dtype.dsize - * memmove(start+self.dtype.dsize, start, self.size-i*self.dtype.dsize) + /* "arrex/list.pyx":314 + * cdef void * 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_5 = ((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_5 == ((int)-1))) __PYX_ERR(0, 298, __pyx_L1_error) + __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":299 - * memmove(start+self.dtype.dsize, start, self.size-i*self.dtype.dsize) + /* "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 # <<<<<<<<<<<<<< * @@ -4036,8 +4259,8 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_12insert(struct __pyx_obj_5arr */ __pyx_v_self->size = (__pyx_v_self->size + __pyx_v_self->dtype->dsize); - /* "arrex/list.pyx":286 - * return e + /* "arrex/list.pyx":296 + * return e * * def insert(self, index, value): # <<<<<<<<<<<<<< * ''' insert(index, value) @@ -4048,6 +4271,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_12insert(struct __pyx_obj_5arr __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_L0:; @@ -4056,7 +4280,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_12insert(struct __pyx_obj_5arr return __pyx_r; } -/* "arrex/list.pyx":301 +/* "arrex/list.pyx":317 * self.size += self.dtype.dsize * * def clear(self): # <<<<<<<<<<<<<< @@ -4083,7 +4307,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_14clear(struct __pyx_obj_5arre __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("clear", 0); - /* "arrex/list.pyx":303 + /* "arrex/list.pyx":319 * def clear(self): * ''' remove all elements from the array but does not deallocate, very fast operation ''' * self.size = 0 # <<<<<<<<<<<<<< @@ -4092,7 +4316,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_14clear(struct __pyx_obj_5arre */ __pyx_v_self->size = 0; - /* "arrex/list.pyx":301 + /* "arrex/list.pyx":317 * self.size += self.dtype.dsize * * def clear(self): # <<<<<<<<<<<<<< @@ -4107,7 +4331,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_14clear(struct __pyx_obj_5arre return __pyx_r; } -/* "arrex/list.pyx":305 +/* "arrex/list.pyx":321 * self.size = 0 * * cpdef int extend(self, other) except *: # <<<<<<<<<<<<<< @@ -4131,9 +4355,8 @@ static int __pyx_f_5arrex_4list_9typedlist_extend(struct __pyx_obj_5arrex_4list_ size_t __pyx_t_7; size_t __pyx_t_8; size_t __pyx_t_9; - int __pyx_t_10; - Py_ssize_t __pyx_t_11; - PyObject *(*__pyx_t_12)(PyObject *); + Py_ssize_t __pyx_t_10; + PyObject *(*__pyx_t_11)(PyObject *); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -4147,7 +4370,7 @@ static int __pyx_f_5arrex_4list_9typedlist_extend(struct __pyx_obj_5arrex_4list_ 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_extend); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 305, __pyx_L1_error) + __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); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_5arrex_4list_9typedlist_17extend)) { __Pyx_INCREF(__pyx_t_1); @@ -4163,10 +4386,10 @@ static int __pyx_f_5arrex_4list_9typedlist_extend(struct __pyx_obj_5arrex_4list_ } __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, 305, __pyx_L1_error) + 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, 305, __pyx_L1_error) + __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; @@ -4185,7 +4408,7 @@ static int __pyx_f_5arrex_4list_9typedlist_extend(struct __pyx_obj_5arrex_4list_ #endif } - /* "arrex/list.pyx":313 + /* "arrex/list.pyx":329 * cdef Py_ssize_t l * * if PyObject_CheckBuffer(other): # <<<<<<<<<<<<<< @@ -4195,16 +4418,16 @@ static int __pyx_f_5arrex_4list_9typedlist_extend(struct __pyx_obj_5arrex_4list_ __pyx_t_6 = (PyObject_CheckBuffer(__pyx_v_other) != 0); if (__pyx_t_6) { - /* "arrex/list.pyx":314 + /* "arrex/list.pyx":330 * * 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, 314, __pyx_L1_error) + __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":316 + /* "arrex/list.pyx":332 * PyObject_GetBuffer(other, &view, PyBUF_SIMPLE) * * if view.len % self.dtype.dsize: # <<<<<<<<<<<<<< @@ -4214,7 +4437,7 @@ static int __pyx_f_5arrex_4list_9typedlist_extend(struct __pyx_obj_5arrex_4list_ __pyx_t_6 = ((__pyx_v_view.len % __pyx_v_self->dtype->dsize) != 0); if (unlikely(__pyx_t_6)) { - /* "arrex/list.pyx":317 + /* "arrex/list.pyx":333 * * if view.len % self.dtype.dsize: * PyBuffer_Release(&view) # <<<<<<<<<<<<<< @@ -4223,20 +4446,20 @@ static int __pyx_f_5arrex_4list_9typedlist_extend(struct __pyx_obj_5arrex_4list_ */ PyBuffer_Release((&__pyx_v_view)); - /* "arrex/list.pyx":318 + /* "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_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 318, __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, 318, __pyx_L1_error) + __PYX_ERR(0, 334, __pyx_L1_error) - /* "arrex/list.pyx":316 + /* "arrex/list.pyx":332 * PyObject_GetBuffer(other, &view, PyBUF_SIMPLE) * * if view.len % self.dtype.dsize: # <<<<<<<<<<<<<< @@ -4245,7 +4468,7 @@ static int __pyx_f_5arrex_4list_9typedlist_extend(struct __pyx_obj_5arrex_4list_ */ } - /* "arrex/list.pyx":320 + /* "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: # <<<<<<<<<<<<<< @@ -4255,7 +4478,7 @@ static int __pyx_f_5arrex_4list_9typedlist_extend(struct __pyx_obj_5arrex_4list_ __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":321 + /* "arrex/list.pyx":337 * * if view.len > self.allocated - self.size: * self._reallocate(max(2*self.size, self.size + view.len)) # <<<<<<<<<<<<<< @@ -4269,9 +4492,9 @@ static int __pyx_f_5arrex_4list_9typedlist_extend(struct __pyx_obj_5arrex_4list_ } 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, 321, __pyx_L1_error) + __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":320 + /* "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: # <<<<<<<<<<<<<< @@ -4280,7 +4503,7 @@ static int __pyx_f_5arrex_4list_9typedlist_extend(struct __pyx_obj_5arrex_4list_ */ } - /* "arrex/list.pyx":322 + /* "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) # <<<<<<<<<<<<<< @@ -4289,7 +4512,7 @@ static int __pyx_f_5arrex_4list_9typedlist_extend(struct __pyx_obj_5arrex_4list_ */ (void)(memcpy((__pyx_v_self->ptr + __pyx_v_self->size), __pyx_v_view.buf, __pyx_v_view.len)); - /* "arrex/list.pyx":323 + /* "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 # <<<<<<<<<<<<<< @@ -4298,7 +4521,7 @@ static int __pyx_f_5arrex_4list_9typedlist_extend(struct __pyx_obj_5arrex_4list_ */ __pyx_v_self->size = (__pyx_v_self->size + __pyx_v_view.len); - /* "arrex/list.pyx":325 + /* "arrex/list.pyx":341 * self.size += view.len * * PyBuffer_Release(&view) # <<<<<<<<<<<<<< @@ -4307,7 +4530,7 @@ static int __pyx_f_5arrex_4list_9typedlist_extend(struct __pyx_obj_5arrex_4list_ */ PyBuffer_Release((&__pyx_v_view)); - /* "arrex/list.pyx":313 + /* "arrex/list.pyx":329 * cdef Py_ssize_t l * * if PyObject_CheckBuffer(other): # <<<<<<<<<<<<<< @@ -4317,93 +4540,85 @@ static int __pyx_f_5arrex_4list_9typedlist_extend(struct __pyx_obj_5arrex_4list_ goto __pyx_L3; } - /* "arrex/list.pyx":328 + /* "arrex/list.pyx":344 * * else: * l = PyObject_LengthHint(other, 0) # <<<<<<<<<<<<<< - * if l > 0 and l*self.dtype.dsize > self.allocated - self.size: + * 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":329 + /* "arrex/list.pyx":345 * else: * l = PyObject_LengthHint(other, 0) - * if l > 0 and l*self.dtype.dsize > self.allocated - self.size: # <<<<<<<<<<<<<< + * if l*self.dtype.dsize > self.allocated - self.size: # <<<<<<<<<<<<<< * self._reallocate(self.size + l*self.dtype.dsize) * for o in other: */ - __pyx_t_10 = ((__pyx_v_l > 0) != 0); - if (__pyx_t_10) { - } else { - __pyx_t_6 = __pyx_t_10; - goto __pyx_L7_bool_binop_done; - } - __pyx_t_10 = (((__pyx_v_l * __pyx_v_self->dtype->dsize) > (__pyx_v_self->allocated - __pyx_v_self->size)) != 0); - __pyx_t_6 = __pyx_t_10; - __pyx_L7_bool_binop_done:; + __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":330 + /* "arrex/list.pyx":346 * l = PyObject_LengthHint(other, 0) - * if l > 0 and l*self.dtype.dsize > self.allocated - self.size: + * 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, 330, __pyx_L1_error) + __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":329 + /* "arrex/list.pyx":345 * else: * l = PyObject_LengthHint(other, 0) - * if l > 0 and l*self.dtype.dsize > self.allocated - self.size: # <<<<<<<<<<<<<< + * if l*self.dtype.dsize > self.allocated - self.size: # <<<<<<<<<<<<<< * self._reallocate(self.size + l*self.dtype.dsize) * for o in other: */ } - /* "arrex/list.pyx":331 - * if l > 0 and l*self.dtype.dsize > self.allocated - self.size: + /* "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_11 = 0; - __pyx_t_12 = NULL; + __pyx_t_1 = __pyx_v_other; __Pyx_INCREF(__pyx_t_1); __pyx_t_10 = 0; + __pyx_t_11 = NULL; } else { - __pyx_t_11 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_other); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 331, __pyx_L1_error) + __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_12 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 331, __pyx_L1_error) + __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_12)) { + if (likely(!__pyx_t_11)) { if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_1)) break; + 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_11); __Pyx_INCREF(__pyx_t_2); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 331, __pyx_L1_error) + __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_11); __pyx_t_11++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 331, __pyx_L1_error) + __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_11 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + 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_11); __Pyx_INCREF(__pyx_t_2); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 331, __pyx_L1_error) + __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_11); __pyx_t_11++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 331, __pyx_L1_error) + __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_12(__pyx_t_1); + __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, 331, __pyx_L1_error) + else __PYX_ERR(0, 347, __pyx_L1_error) } break; } @@ -4412,17 +4627,17 @@ static int __pyx_f_5arrex_4list_9typedlist_extend(struct __pyx_obj_5arrex_4list_ __Pyx_XDECREF_SET(__pyx_v_o, __pyx_t_2); __pyx_t_2 = 0; - /* "arrex/list.pyx":332 + /* "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, 332, __pyx_L1_error) + __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":331 - * if l > 0 and l*self.dtype.dsize > self.allocated - self.size: + /* "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) @@ -4433,7 +4648,7 @@ static int __pyx_f_5arrex_4list_9typedlist_extend(struct __pyx_obj_5arrex_4list_ } __pyx_L3:; - /* "arrex/list.pyx":305 + /* "arrex/list.pyx":321 * self.size = 0 * * cpdef int extend(self, other) except *: # <<<<<<<<<<<<<< @@ -4481,8 +4696,8 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_16extend(struct __pyx_obj_5arr 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, 305, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 305, __pyx_L1_error) + __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; @@ -4499,7 +4714,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_16extend(struct __pyx_obj_5arr return __pyx_r; } -/* "arrex/list.pyx":334 +/* "arrex/list.pyx":350 * self.append(o) * * def __iadd__(self, other): # <<<<<<<<<<<<<< @@ -4528,16 +4743,16 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_18__iadd__(struct __pyx_obj_5a int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__iadd__", 0); - /* "arrex/list.pyx":335 + /* "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, 335, __pyx_L1_error) + ((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":336 + /* "arrex/list.pyx":352 * def __iadd__(self, other): * self.extend(other) * return self # <<<<<<<<<<<<<< @@ -4549,7 +4764,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_18__iadd__(struct __pyx_obj_5a __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0; - /* "arrex/list.pyx":334 + /* "arrex/list.pyx":350 * self.append(o) * * def __iadd__(self, other): # <<<<<<<<<<<<<< @@ -4567,7 +4782,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_18__iadd__(struct __pyx_obj_5a return __pyx_r; } -/* "arrex/list.pyx":338 +/* "arrex/list.pyx":354 * return self * * def __add__(typedlist self, other): # <<<<<<<<<<<<<< @@ -4588,7 +4803,7 @@ static PyObject *__pyx_pw_5arrex_4list_9typedlist_21__add__(PyObject *__pyx_v_se 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, 338, __pyx_L1_error) + 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)); /* function exit code */ @@ -4616,7 +4831,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_20__add__(struct __pyx_obj_5ar int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__add__", 0); - /* "arrex/list.pyx":343 + /* "arrex/list.pyx":359 * cdef Py_buffer view * * if PyObject_CheckBuffer(other): # <<<<<<<<<<<<<< @@ -4626,16 +4841,16 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_20__add__(struct __pyx_obj_5ar __pyx_t_1 = (PyObject_CheckBuffer(__pyx_v_other) != 0); if (__pyx_t_1) { - /* "arrex/list.pyx":344 + /* "arrex/list.pyx":360 * * if PyObject_CheckBuffer(other): * PyObject_GetBuffer(other, &view, PyBUF_SIMPLE) # <<<<<<<<<<<<<< * * if view.len % self.dtype.dsize: */ - __pyx_t_2 = PyObject_GetBuffer(__pyx_v_other, (&__pyx_v_view), PyBUF_SIMPLE); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 344, __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":346 + /* "arrex/list.pyx":362 * PyObject_GetBuffer(other, &view, PyBUF_SIMPLE) * * if view.len % self.dtype.dsize: # <<<<<<<<<<<<<< @@ -4645,7 +4860,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_20__add__(struct __pyx_obj_5ar __pyx_t_1 = ((__pyx_v_view.len % __pyx_v_self->dtype->dsize) != 0); if (unlikely(__pyx_t_1)) { - /* "arrex/list.pyx":347 + /* "arrex/list.pyx":363 * * if view.len % self.dtype.dsize: * PyBuffer_Release(&view) # <<<<<<<<<<<<<< @@ -4654,20 +4869,20 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_20__add__(struct __pyx_obj_5ar */ PyBuffer_Release((&__pyx_v_view)); - /* "arrex/list.pyx":348 + /* "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_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 348, __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, 348, __pyx_L1_error) + __PYX_ERR(0, 364, __pyx_L1_error) - /* "arrex/list.pyx":346 + /* "arrex/list.pyx":362 * PyObject_GetBuffer(other, &view, PyBUF_SIMPLE) * * if view.len % self.dtype.dsize: # <<<<<<<<<<<<<< @@ -4676,19 +4891,19 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_20__add__(struct __pyx_obj_5ar */ } - /* "arrex/list.pyx":350 + /* "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_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, 350, __pyx_L1_error) + __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":351 + /* "arrex/list.pyx":367 * * result = typedlist.__new__(typedlist) * result.dtype = self.dtype # <<<<<<<<<<<<<< @@ -4703,16 +4918,16 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_20__add__(struct __pyx_obj_5ar __pyx_v_result->dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_3); __pyx_t_3 = 0; - /* "arrex/list.pyx":352 + /* "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, 352, __pyx_L1_error) + __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":353 + /* "arrex/list.pyx":369 * result.dtype = self.dtype * result._reallocate(self.size + view.len) * memcpy(result.ptr, self.ptr, self.size) # <<<<<<<<<<<<<< @@ -4721,7 +4936,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_20__add__(struct __pyx_obj_5ar */ (void)(memcpy(__pyx_v_result->ptr, __pyx_v_self->ptr, __pyx_v_self->size)); - /* "arrex/list.pyx":354 + /* "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) # <<<<<<<<<<<<<< @@ -4730,7 +4945,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_20__add__(struct __pyx_obj_5ar */ (void)(memcpy((__pyx_v_result->ptr + __pyx_v_self->size), __pyx_v_view.buf, __pyx_v_view.len)); - /* "arrex/list.pyx":355 + /* "arrex/list.pyx":371 * memcpy(result.ptr, self.ptr, self.size) * memcpy(result.ptr+self.size, view.buf, view.len) * result.size = result.allocated # <<<<<<<<<<<<<< @@ -4740,7 +4955,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_20__add__(struct __pyx_obj_5ar __pyx_t_4 = __pyx_v_result->allocated; __pyx_v_result->size = __pyx_t_4; - /* "arrex/list.pyx":357 + /* "arrex/list.pyx":373 * result.size = result.allocated * * PyBuffer_Release(&view) # <<<<<<<<<<<<<< @@ -4749,7 +4964,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_20__add__(struct __pyx_obj_5ar */ PyBuffer_Release((&__pyx_v_view)); - /* "arrex/list.pyx":358 + /* "arrex/list.pyx":374 * * PyBuffer_Release(&view) * return result # <<<<<<<<<<<<<< @@ -4761,7 +4976,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_20__add__(struct __pyx_obj_5ar __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; - /* "arrex/list.pyx":343 + /* "arrex/list.pyx":359 * cdef Py_buffer view * * if PyObject_CheckBuffer(other): # <<<<<<<<<<<<<< @@ -4770,25 +4985,25 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_20__add__(struct __pyx_obj_5ar */ } - /* "arrex/list.pyx":360 + /* "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, 360, __pyx_L1_error) + __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":361 + /* "arrex/list.pyx":377 * * elif hasattr(other, '__iter__'): * result = typedlist(None, self.dtype) # <<<<<<<<<<<<<< * result.extend(self) * result.extend(other) */ - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 361, __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); @@ -4796,31 +5011,31 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_20__add__(struct __pyx_obj_5ar __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, 361, __pyx_L1_error) + __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; - /* "arrex/list.pyx":362 + /* "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, 362, __pyx_L1_error) + ((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":363 + /* "arrex/list.pyx":379 * 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, __pyx_v_other, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 363, __pyx_L1_error) + ((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":364 + /* "arrex/list.pyx":380 * result.extend(self) * result.extend(other) * return result # <<<<<<<<<<<<<< @@ -4832,7 +5047,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_20__add__(struct __pyx_obj_5ar __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; - /* "arrex/list.pyx":360 + /* "arrex/list.pyx":376 * return result * * elif hasattr(other, '__iter__'): # <<<<<<<<<<<<<< @@ -4841,7 +5056,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_20__add__(struct __pyx_obj_5ar */ } - /* "arrex/list.pyx":367 + /* "arrex/list.pyx":383 * * else: * return NotImplemented # <<<<<<<<<<<<<< @@ -4855,7 +5070,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_20__add__(struct __pyx_obj_5ar goto __pyx_L0; } - /* "arrex/list.pyx":338 + /* "arrex/list.pyx":354 * return self * * def __add__(typedlist self, other): # <<<<<<<<<<<<<< @@ -4876,7 +5091,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_20__add__(struct __pyx_obj_5ar return __pyx_r; } -/* "arrex/list.pyx":369 +/* "arrex/list.pyx":385 * return NotImplemented * * def __mul__(self, n): # <<<<<<<<<<<<<< @@ -4913,7 +5128,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_22__mul__(PyObject *__pyx_v_se int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__mul__", 0); - /* "arrex/list.pyx":372 + /* "arrex/list.pyx":388 * ''' duplicate the sequence by a certain number ''' * #if isinstance(n, int): * if PyNumber_Check(n): # <<<<<<<<<<<<<< @@ -4923,7 +5138,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_22__mul__(PyObject *__pyx_v_se __pyx_t_1 = (PyNumber_Check(__pyx_v_n) != 0); if (__pyx_t_1) { - /* "arrex/list.pyx":373 + /* "arrex/list.pyx":389 * #if isinstance(n, int): * if PyNumber_Check(n): * return typedlist(bytes(self)*n, dtype=self.dtype) # <<<<<<<<<<<<<< @@ -4931,23 +5146,23 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_22__mul__(PyObject *__pyx_v_se * return NotImplemented */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 373, __pyx_L1_error) + __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, 373, __pyx_L1_error) + __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, 373, __pyx_L1_error) + __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, 373, __pyx_L1_error) + __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, 373, __pyx_L1_error) + __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, 373, __pyx_L1_error) + 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, 373, __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; @@ -4955,7 +5170,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_22__mul__(PyObject *__pyx_v_se __pyx_t_4 = 0; goto __pyx_L0; - /* "arrex/list.pyx":372 + /* "arrex/list.pyx":388 * ''' duplicate the sequence by a certain number ''' * #if isinstance(n, int): * if PyNumber_Check(n): # <<<<<<<<<<<<<< @@ -4964,7 +5179,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_22__mul__(PyObject *__pyx_v_se */ } - /* "arrex/list.pyx":375 + /* "arrex/list.pyx":391 * return typedlist(bytes(self)*n, dtype=self.dtype) * else: * return NotImplemented # <<<<<<<<<<<<<< @@ -4978,7 +5193,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_22__mul__(PyObject *__pyx_v_se goto __pyx_L0; } - /* "arrex/list.pyx":369 + /* "arrex/list.pyx":385 * return NotImplemented * * def __mul__(self, n): # <<<<<<<<<<<<<< @@ -4999,7 +5214,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_22__mul__(PyObject *__pyx_v_se return __pyx_r; } -/* "arrex/list.pyx":377 +/* "arrex/list.pyx":393 * return NotImplemented * * def capacity(self): # <<<<<<<<<<<<<< @@ -5030,7 +5245,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_24capacity(struct __pyx_obj_5a int __pyx_clineno = 0; __Pyx_RefNannySetupContext("capacity", 0); - /* "arrex/list.pyx":382 + /* "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 # <<<<<<<<<<<<<< @@ -5038,13 +5253,13 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_24capacity(struct __pyx_obj_5a * 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, 382, __pyx_L1_error) + __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":377 + /* "arrex/list.pyx":393 * return NotImplemented * * def capacity(self): # <<<<<<<<<<<<<< @@ -5063,7 +5278,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_24capacity(struct __pyx_obj_5a return __pyx_r; } -/* "arrex/list.pyx":384 +/* "arrex/list.pyx":400 * return self.allocated // self.dtype.dsize * * def shrink(self): # <<<<<<<<<<<<<< @@ -5094,16 +5309,16 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_26shrink(struct __pyx_obj_5arr int __pyx_clineno = 0; __Pyx_RefNannySetupContext("shrink", 0); - /* "arrex/list.pyx":389 + /* "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, 389, __pyx_L1_error) + __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":384 + /* "arrex/list.pyx":400 * return self.allocated // self.dtype.dsize * * def shrink(self): # <<<<<<<<<<<<<< @@ -5123,7 +5338,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_26shrink(struct __pyx_obj_5arr return __pyx_r; } -/* "arrex/list.pyx":391 +/* "arrex/list.pyx":407 * self._reallocate(self.size) * * def __len__(self): # <<<<<<<<<<<<<< @@ -5153,7 +5368,7 @@ static Py_ssize_t __pyx_pf_5arrex_4list_9typedlist_28__len__(struct __pyx_obj_5a __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); - /* "arrex/list.pyx":393 + /* "arrex/list.pyx":409 * def __len__(self): * ''' return the current amount of elements inserted ''' * return self._len() # <<<<<<<<<<<<<< @@ -5163,7 +5378,7 @@ static Py_ssize_t __pyx_pf_5arrex_4list_9typedlist_28__len__(struct __pyx_obj_5a __pyx_r = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_len(__pyx_v_self); goto __pyx_L0; - /* "arrex/list.pyx":391 + /* "arrex/list.pyx":407 * self._reallocate(self.size) * * def __len__(self): # <<<<<<<<<<<<<< @@ -5177,7 +5392,7 @@ static Py_ssize_t __pyx_pf_5arrex_4list_9typedlist_28__len__(struct __pyx_obj_5a return __pyx_r; } -/* "arrex/list.pyx":395 +/* "arrex/list.pyx":411 * return self._len() * * def __getitem__(self, index): # <<<<<<<<<<<<<< @@ -5220,7 +5435,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_30__getitem__(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "arrex/list.pyx":408 + /* "arrex/list.pyx":424 * * #if isinstance(index, int): * if PyNumber_Check(index): # <<<<<<<<<<<<<< @@ -5230,7 +5445,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_30__getitem__(struct __pyx_obj __pyx_t_1 = (PyNumber_Check(__pyx_v_index) != 0); if (__pyx_t_1) { - /* "arrex/list.pyx":409 + /* "arrex/list.pyx":425 * #if isinstance(index, int): * if PyNumber_Check(index): * return self._getitem(self.ptr + self._index(index)*self.dtype.dsize) # <<<<<<<<<<<<<< @@ -5238,14 +5453,14 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_30__getitem__(struct __pyx_obj * 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, 409, __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, 409, __pyx_L1_error) + __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; - /* "arrex/list.pyx":408 + /* "arrex/list.pyx":424 * * #if isinstance(index, int): * if PyNumber_Check(index): # <<<<<<<<<<<<<< @@ -5254,7 +5469,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_30__getitem__(struct __pyx_obj */ } - /* "arrex/list.pyx":411 + /* "arrex/list.pyx":427 * return self._getitem(self.ptr + self._index(index)*self.dtype.dsize) * * elif isinstance(index, slice): # <<<<<<<<<<<<<< @@ -5265,31 +5480,31 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_30__getitem__(struct __pyx_obj __pyx_t_4 = (__pyx_t_1 != 0); if (likely(__pyx_t_4)) { - /* "arrex/list.pyx":412 + /* "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, 412, __pyx_L1_error) + __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)) { - /* "arrex/list.pyx":413 + /* "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__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 413, __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, 413, __pyx_L1_error) + __PYX_ERR(0, 429, __pyx_L1_error) - /* "arrex/list.pyx":412 + /* "arrex/list.pyx":428 * * elif isinstance(index, slice): * if PySlice_Unpack(index, &start, &stop, &step): # <<<<<<<<<<<<<< @@ -5298,7 +5513,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_30__getitem__(struct __pyx_obj */ } - /* "arrex/list.pyx":414 + /* "arrex/list.pyx":430 * if PySlice_Unpack(index, &start, &stop, &step): * raise IndexError('incorrect slice') * if step != 1: # <<<<<<<<<<<<<< @@ -5308,20 +5523,20 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_30__getitem__(struct __pyx_obj __pyx_t_4 = ((__pyx_v_step != 1) != 0); if (unlikely(__pyx_t_4)) { - /* "arrex/list.pyx":415 + /* "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) * */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 415, __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, 415, __pyx_L1_error) + __PYX_ERR(0, 431, __pyx_L1_error) - /* "arrex/list.pyx":414 + /* "arrex/list.pyx":430 * if PySlice_Unpack(index, &start, &stop, &step): * raise IndexError('incorrect slice') * if step != 1: # <<<<<<<<<<<<<< @@ -5330,7 +5545,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_30__getitem__(struct __pyx_obj */ } - /* "arrex/list.pyx":416 + /* "arrex/list.pyx":432 * if step != 1: * raise IndexError('slice step is not supported') * PySlice_AdjustIndices(self._len(), &start, &stop, step) # <<<<<<<<<<<<<< @@ -5339,19 +5554,19 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_30__getitem__(struct __pyx_obj */ (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":418 + /* "arrex/list.pyx":434 * PySlice_AdjustIndices(self._len(), &start, &stop, step) * * view = typedlist.__new__(typedlist) # <<<<<<<<<<<<<< * view.ptr = self.ptr + start*self.dtype.dsize * view.size = (stop-start)*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, 418, __pyx_L1_error) + __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, 434, __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":419 + /* "arrex/list.pyx":435 * * view = typedlist.__new__(typedlist) * view.ptr = self.ptr + start*self.dtype.dsize # <<<<<<<<<<<<<< @@ -5360,7 +5575,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_30__getitem__(struct __pyx_obj */ __pyx_v_view->ptr = (__pyx_v_self->ptr + (__pyx_v_start * __pyx_v_self->dtype->dsize)); - /* "arrex/list.pyx":420 + /* "arrex/list.pyx":436 * view = typedlist.__new__(typedlist) * view.ptr = self.ptr + start*self.dtype.dsize * view.size = (stop-start)*self.dtype.dsize # <<<<<<<<<<<<<< @@ -5369,7 +5584,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_30__getitem__(struct __pyx_obj */ __pyx_v_view->size = ((__pyx_v_stop - __pyx_v_start) * __pyx_v_self->dtype->dsize); - /* "arrex/list.pyx":421 + /* "arrex/list.pyx":437 * view.ptr = self.ptr + start*self.dtype.dsize * view.size = (stop-start)*self.dtype.dsize * view.allocated = view.size # <<<<<<<<<<<<<< @@ -5379,7 +5594,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_30__getitem__(struct __pyx_obj __pyx_t_6 = __pyx_v_view->size; __pyx_v_view->allocated = __pyx_t_6; - /* "arrex/list.pyx":422 + /* "arrex/list.pyx":438 * view.size = (stop-start)*self.dtype.dsize * view.allocated = view.size * view.owner = self.owner # <<<<<<<<<<<<<< @@ -5394,7 +5609,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_30__getitem__(struct __pyx_obj __pyx_v_view->owner = __pyx_t_3; __pyx_t_3 = 0; - /* "arrex/list.pyx":423 + /* "arrex/list.pyx":439 * view.allocated = view.size * view.owner = self.owner * view.dtype = self.dtype # <<<<<<<<<<<<<< @@ -5409,7 +5624,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_30__getitem__(struct __pyx_obj __pyx_v_view->dtype = ((struct __pyx_obj_5arrex_6dtypes_DDType *)__pyx_t_3); __pyx_t_3 = 0; - /* "arrex/list.pyx":424 + /* "arrex/list.pyx":440 * view.owner = self.owner * view.dtype = self.dtype * return view # <<<<<<<<<<<<<< @@ -5421,7 +5636,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_30__getitem__(struct __pyx_obj __pyx_r = ((PyObject *)__pyx_v_view); goto __pyx_L0; - /* "arrex/list.pyx":411 + /* "arrex/list.pyx":427 * return self._getitem(self.ptr + self._index(index)*self.dtype.dsize) * * elif isinstance(index, slice): # <<<<<<<<<<<<<< @@ -5430,7 +5645,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_30__getitem__(struct __pyx_obj */ } - /* "arrex/list.pyx":427 + /* "arrex/list.pyx":443 * * else: * raise IndexError('index must be int or slice') # <<<<<<<<<<<<<< @@ -5438,14 +5653,14 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_30__getitem__(struct __pyx_obj * def __setitem__(self, index, value): */ /*else*/ { - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 427, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 443, __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, 427, __pyx_L1_error) + __PYX_ERR(0, 443, __pyx_L1_error) } - /* "arrex/list.pyx":395 + /* "arrex/list.pyx":411 * return self._len() * * def __getitem__(self, index): # <<<<<<<<<<<<<< @@ -5465,7 +5680,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_30__getitem__(struct __pyx_obj return __pyx_r; } -/* "arrex/list.pyx":429 +/* "arrex/list.pyx":445 * raise IndexError('index must be int or slice') * * def __setitem__(self, index, value): # <<<<<<<<<<<<<< @@ -5508,7 +5723,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_32__setitem__(struct __pyx_obj_5arre int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setitem__", 0); - /* "arrex/list.pyx":435 + /* "arrex/list.pyx":451 * * #if isinstance(index, int): * if PyNumber_Check(index): # <<<<<<<<<<<<<< @@ -5518,17 +5733,17 @@ static int __pyx_pf_5arrex_4list_9typedlist_32__setitem__(struct __pyx_obj_5arre __pyx_t_1 = (PyNumber_Check(__pyx_v_index) != 0); if (__pyx_t_1) { - /* "arrex/list.pyx":436 + /* "arrex/list.pyx":452 * #if isinstance(index, int): * if PyNumber_Check(index): * self._setitem(self.ptr + self._index(index)*self.dtype.dsize, value) # <<<<<<<<<<<<<< * * elif isinstance(index, slice): */ - __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, 436, __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, 436, __pyx_L1_error) + __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, 452, __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, 452, __pyx_L1_error) - /* "arrex/list.pyx":435 + /* "arrex/list.pyx":451 * * #if isinstance(index, int): * if PyNumber_Check(index): # <<<<<<<<<<<<<< @@ -5538,7 +5753,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_32__setitem__(struct __pyx_obj_5arre goto __pyx_L3; } - /* "arrex/list.pyx":438 + /* "arrex/list.pyx":454 * self._setitem(self.ptr + self._index(index)*self.dtype.dsize, value) * * elif isinstance(index, slice): # <<<<<<<<<<<<<< @@ -5549,31 +5764,31 @@ static int __pyx_pf_5arrex_4list_9typedlist_32__setitem__(struct __pyx_obj_5arre __pyx_t_4 = (__pyx_t_1 != 0); if (likely(__pyx_t_4)) { - /* "arrex/list.pyx":439 + /* "arrex/list.pyx":455 * * 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, 439, __pyx_L1_error) + __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, 455, __pyx_L1_error) __pyx_t_4 = (__pyx_t_3 != 0); if (unlikely(__pyx_t_4)) { - /* "arrex/list.pyx":440 + /* "arrex/list.pyx":456 * 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_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 440, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 456, __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, 440, __pyx_L1_error) + __PYX_ERR(0, 456, __pyx_L1_error) - /* "arrex/list.pyx":439 + /* "arrex/list.pyx":455 * * elif isinstance(index, slice): * if PySlice_Unpack(index, &start, &stop, &step): # <<<<<<<<<<<<<< @@ -5582,7 +5797,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_32__setitem__(struct __pyx_obj_5arre */ } - /* "arrex/list.pyx":441 + /* "arrex/list.pyx":457 * if PySlice_Unpack(index, &start, &stop, &step): * raise IndexError('incorrect slice') * if step != 1: # <<<<<<<<<<<<<< @@ -5592,20 +5807,20 @@ static int __pyx_pf_5arrex_4list_9typedlist_32__setitem__(struct __pyx_obj_5arre __pyx_t_4 = ((__pyx_v_step != 1) != 0); if (unlikely(__pyx_t_4)) { - /* "arrex/list.pyx":442 + /* "arrex/list.pyx":458 * raise IndexError('incorrect slice') * if step != 1: * raise IndexError('slice step is not supported') # <<<<<<<<<<<<<< * PySlice_AdjustIndices(self._len(), &start, &stop, step) * */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 442, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__9, 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, 442, __pyx_L1_error) + __PYX_ERR(0, 458, __pyx_L1_error) - /* "arrex/list.pyx":441 + /* "arrex/list.pyx":457 * if PySlice_Unpack(index, &start, &stop, &step): * raise IndexError('incorrect slice') * if step != 1: # <<<<<<<<<<<<<< @@ -5614,7 +5829,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_32__setitem__(struct __pyx_obj_5arre */ } - /* "arrex/list.pyx":443 + /* "arrex/list.pyx":459 * if step != 1: * raise IndexError('slice step is not supported') * PySlice_AdjustIndices(self._len(), &start, &stop, step) # <<<<<<<<<<<<<< @@ -5623,7 +5838,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_32__setitem__(struct __pyx_obj_5arre */ (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":445 + /* "arrex/list.pyx":461 * PySlice_AdjustIndices(self._len(), &start, &stop, step) * * if PyObject_CheckBuffer(value): # <<<<<<<<<<<<<< @@ -5633,16 +5848,16 @@ static int __pyx_pf_5arrex_4list_9typedlist_32__setitem__(struct __pyx_obj_5arre __pyx_t_4 = (PyObject_CheckBuffer(__pyx_v_value) != 0); if (__pyx_t_4) { - /* "arrex/list.pyx":446 + /* "arrex/list.pyx":462 * * 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, 446, __pyx_L1_error) + __pyx_t_3 = PyObject_GetBuffer(__pyx_v_value, (&__pyx_v_view), PyBUF_SIMPLE); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 462, __pyx_L1_error) - /* "arrex/list.pyx":447 + /* "arrex/list.pyx":463 * if PyObject_CheckBuffer(value): * PyObject_GetBuffer(value, &view, PyBUF_SIMPLE) * start *= self.dtype.dsize # <<<<<<<<<<<<<< @@ -5651,7 +5866,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_32__setitem__(struct __pyx_obj_5arre */ __pyx_v_start = (__pyx_v_start * __pyx_v_self->dtype->dsize); - /* "arrex/list.pyx":448 + /* "arrex/list.pyx":464 * PyObject_GetBuffer(value, &view, PyBUF_SIMPLE) * start *= self.dtype.dsize * stop *= self.dtype.dsize # <<<<<<<<<<<<<< @@ -5660,7 +5875,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_32__setitem__(struct __pyx_obj_5arre */ __pyx_v_stop = (__pyx_v_stop * __pyx_v_self->dtype->dsize); - /* "arrex/list.pyx":450 + /* "arrex/list.pyx":466 * stop *= self.dtype.dsize * * if view.len != stop-start: # <<<<<<<<<<<<<< @@ -5670,7 +5885,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_32__setitem__(struct __pyx_obj_5arre __pyx_t_4 = ((__pyx_v_view.len != (__pyx_v_stop - __pyx_v_start)) != 0); if (__pyx_t_4) { - /* "arrex/list.pyx":451 + /* "arrex/list.pyx":467 * * if view.len != stop-start: * if view.len % self.dtype.dsize: # <<<<<<<<<<<<<< @@ -5680,7 +5895,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_32__setitem__(struct __pyx_obj_5arre __pyx_t_4 = ((__pyx_v_view.len % __pyx_v_self->dtype->dsize) != 0); if (unlikely(__pyx_t_4)) { - /* "arrex/list.pyx":452 + /* "arrex/list.pyx":468 * if view.len != stop-start: * if view.len % self.dtype.dsize: * PyBuffer_Release(&view) # <<<<<<<<<<<<<< @@ -5689,20 +5904,20 @@ static int __pyx_pf_5arrex_4list_9typedlist_32__setitem__(struct __pyx_obj_5arre */ PyBuffer_Release((&__pyx_v_view)); - /* "arrex/list.pyx":453 + /* "arrex/list.pyx":469 * 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 - (stop-start) + * newsize = self.size + view.len + start - stop */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 453, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 469, __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, 453, __pyx_L1_error) + __PYX_ERR(0, 469, __pyx_L1_error) - /* "arrex/list.pyx":451 + /* "arrex/list.pyx":467 * * if view.len != stop-start: * if view.len % self.dtype.dsize: # <<<<<<<<<<<<<< @@ -5711,18 +5926,18 @@ static int __pyx_pf_5arrex_4list_9typedlist_32__setitem__(struct __pyx_obj_5arre */ } - /* "arrex/list.pyx":455 + /* "arrex/list.pyx":471 * raise TypeError('the given buffer must have a byte size multiple of dtype size') * - * newsize = self.size + view.len - (stop-start) # <<<<<<<<<<<<<< + * 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_stop - __pyx_v_start)); + __pyx_v_newsize = (((__pyx_v_self->size + __pyx_v_view.len) + __pyx_v_start) - __pyx_v_stop); - /* "arrex/list.pyx":456 + /* "arrex/list.pyx":472 * - * newsize = self.size + view.len - (stop-start) + * newsize = self.size + view.len + start - stop * if newsize > self.allocated: # <<<<<<<<<<<<<< * self._reallocate(max(2*self.size, newsize)) * @@ -5730,8 +5945,8 @@ static int __pyx_pf_5arrex_4list_9typedlist_32__setitem__(struct __pyx_obj_5arre __pyx_t_4 = ((__pyx_v_newsize > __pyx_v_self->allocated) != 0); if (__pyx_t_4) { - /* "arrex/list.pyx":457 - * newsize = self.size + view.len - (stop-start) + /* "arrex/list.pyx":473 + * newsize = self.size + view.len + start - stop * if newsize > self.allocated: * self._reallocate(max(2*self.size, newsize)) # <<<<<<<<<<<<<< * @@ -5744,18 +5959,18 @@ static int __pyx_pf_5arrex_4list_9typedlist_32__setitem__(struct __pyx_obj_5arre } 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, 457, __pyx_L1_error) + __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, 473, __pyx_L1_error) - /* "arrex/list.pyx":456 + /* "arrex/list.pyx":472 * - * newsize = self.size + view.len - (stop-start) + * newsize = self.size + view.len + start - stop * if newsize > self.allocated: # <<<<<<<<<<<<<< * self._reallocate(max(2*self.size, newsize)) * */ } - /* "arrex/list.pyx":459 + /* "arrex/list.pyx":475 * self._reallocate(max(2*self.size, newsize)) * * memmove(self.ptr+start+view.len, self.ptr+stop, self.size-stop) # <<<<<<<<<<<<<< @@ -5764,7 +5979,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_32__setitem__(struct __pyx_obj_5arre */ (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":460 + /* "arrex/list.pyx":476 * * memmove(self.ptr+start+view.len, self.ptr+stop, self.size-stop) * self.size = newsize # <<<<<<<<<<<<<< @@ -5773,7 +5988,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_32__setitem__(struct __pyx_obj_5arre */ __pyx_v_self->size = __pyx_v_newsize; - /* "arrex/list.pyx":450 + /* "arrex/list.pyx":466 * stop *= self.dtype.dsize * * if view.len != stop-start: # <<<<<<<<<<<<<< @@ -5782,7 +5997,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_32__setitem__(struct __pyx_obj_5arre */ } - /* "arrex/list.pyx":462 + /* "arrex/list.pyx":478 * self.size = newsize * * memcpy(self.ptr+start, view.buf, view.len) # <<<<<<<<<<<<<< @@ -5791,7 +6006,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_32__setitem__(struct __pyx_obj_5arre */ (void)(memcpy((__pyx_v_self->ptr + __pyx_v_start), __pyx_v_view.buf, __pyx_v_view.len)); - /* "arrex/list.pyx":464 + /* "arrex/list.pyx":480 * memcpy(self.ptr+start, view.buf, view.len) * * PyBuffer_Release(&view) # <<<<<<<<<<<<<< @@ -5800,7 +6015,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_32__setitem__(struct __pyx_obj_5arre */ PyBuffer_Release((&__pyx_v_view)); - /* "arrex/list.pyx":445 + /* "arrex/list.pyx":461 * PySlice_AdjustIndices(self._len(), &start, &stop, step) * * if PyObject_CheckBuffer(value): # <<<<<<<<<<<<<< @@ -5810,25 +6025,25 @@ static int __pyx_pf_5arrex_4list_9typedlist_32__setitem__(struct __pyx_obj_5arre goto __pyx_L6; } - /* "arrex/list.pyx":466 + /* "arrex/list.pyx":482 * 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, 466, __pyx_L1_error) + __pyx_t_4 = __Pyx_HasAttr(__pyx_v_value, __pyx_n_u_iter); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 482, __pyx_L1_error) __pyx_t_1 = (__pyx_t_4 != 0); if (likely(__pyx_t_1)) { - /* "arrex/list.pyx":467 + /* "arrex/list.pyx":483 * * 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, 467, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 483, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_value); __Pyx_GIVEREF(__pyx_v_value); @@ -5836,13 +6051,13 @@ static int __pyx_pf_5arrex_4list_9typedlist_32__setitem__(struct __pyx_obj_5arre __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, 467, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5arrex_4list_typedlist), __pyx_t_5, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 483, __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, 467, __pyx_L1_error) + if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_v_index, __pyx_t_9) < 0)) __PYX_ERR(0, 483, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "arrex/list.pyx":466 + /* "arrex/list.pyx":482 * PyBuffer_Release(&view) * * elif hasattr(value, '__iter__'): # <<<<<<<<<<<<<< @@ -5852,7 +6067,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_32__setitem__(struct __pyx_obj_5arre goto __pyx_L6; } - /* "arrex/list.pyx":470 + /* "arrex/list.pyx":486 * * else: * raise IndexError('the assigned value must be a buffer or an iterable') # <<<<<<<<<<<<<< @@ -5860,15 +6075,15 @@ static int __pyx_pf_5arrex_4list_9typedlist_32__setitem__(struct __pyx_obj_5arre * else: */ /*else*/ { - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 486, __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, 470, __pyx_L1_error) + __PYX_ERR(0, 486, __pyx_L1_error) } __pyx_L6:; - /* "arrex/list.pyx":438 + /* "arrex/list.pyx":454 * self._setitem(self.ptr + self._index(index)*self.dtype.dsize, value) * * elif isinstance(index, slice): # <<<<<<<<<<<<<< @@ -5878,7 +6093,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_32__setitem__(struct __pyx_obj_5arre goto __pyx_L3; } - /* "arrex/list.pyx":473 + /* "arrex/list.pyx":489 * * else: * raise IndexError('index must be int') # <<<<<<<<<<<<<< @@ -5886,15 +6101,15 @@ static int __pyx_pf_5arrex_4list_9typedlist_32__setitem__(struct __pyx_obj_5arre * def __iter__(self): */ /*else*/ { - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 473, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 489, __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, 473, __pyx_L1_error) + __PYX_ERR(0, 489, __pyx_L1_error) } __pyx_L3:; - /* "arrex/list.pyx":429 + /* "arrex/list.pyx":445 * raise IndexError('index must be int or slice') * * def __setitem__(self, index, value): # <<<<<<<<<<<<<< @@ -5915,7 +6130,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_32__setitem__(struct __pyx_obj_5arre return __pyx_r; } -/* "arrex/list.pyx":475 +/* "arrex/list.pyx":491 * raise IndexError('index must be int') * * def __iter__(self): # <<<<<<<<<<<<<< @@ -5950,19 +6165,19 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_34__iter__(struct __pyx_obj_5a int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__iter__", 0); - /* "arrex/list.pyx":477 + /* "arrex/list.pyx":493 * def __iter__(self): * ''' yield successive elements in the list ''' * cdef arrayiter it = arrayiter.__new__(arrayiter) # <<<<<<<<<<<<<< * it.array = self * it.position = 0 */ - __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, 477, __pyx_L1_error) + __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, 493, __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":478 + /* "arrex/list.pyx":494 * ''' yield successive elements in the list ''' * cdef arrayiter it = arrayiter.__new__(arrayiter) * it.array = self # <<<<<<<<<<<<<< @@ -5975,7 +6190,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_34__iter__(struct __pyx_obj_5a __Pyx_DECREF(((PyObject *)__pyx_v_it->array)); __pyx_v_it->array = __pyx_v_self; - /* "arrex/list.pyx":479 + /* "arrex/list.pyx":495 * cdef arrayiter it = arrayiter.__new__(arrayiter) * it.array = self * it.position = 0 # <<<<<<<<<<<<<< @@ -5984,7 +6199,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_34__iter__(struct __pyx_obj_5a */ __pyx_v_it->position = 0; - /* "arrex/list.pyx":480 + /* "arrex/list.pyx":496 * it.array = self * it.position = 0 * return it # <<<<<<<<<<<<<< @@ -5996,7 +6211,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_34__iter__(struct __pyx_obj_5a __pyx_r = ((PyObject *)__pyx_v_it); goto __pyx_L0; - /* "arrex/list.pyx":475 + /* "arrex/list.pyx":491 * raise IndexError('index must be int') * * def __iter__(self): # <<<<<<<<<<<<<< @@ -6016,7 +6231,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_34__iter__(struct __pyx_obj_5a return __pyx_r; } -/* "arrex/list.pyx":482 +/* "arrex/list.pyx":498 * return it * * def __repr__(self): # <<<<<<<<<<<<<< @@ -6053,7 +6268,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_36__repr__(struct __pyx_obj_5a int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__repr__", 0); - /* "arrex/list.pyx":484 + /* "arrex/list.pyx":500 * def __repr__(self): * cdef size_t i * text = 'typedlist([' # <<<<<<<<<<<<<< @@ -6063,7 +6278,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_36__repr__(struct __pyx_obj_5a __Pyx_INCREF(__pyx_kp_u_typedlist); __pyx_v_text = __pyx_kp_u_typedlist; - /* "arrex/list.pyx":485 + /* "arrex/list.pyx":501 * cdef size_t i * text = 'typedlist([' * for i in range(self._len()): # <<<<<<<<<<<<<< @@ -6075,7 +6290,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_36__repr__(struct __pyx_obj_5a for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "arrex/list.pyx":486 + /* "arrex/list.pyx":502 * text = 'typedlist([' * for i in range(self._len()): * if i: text += ', ' # <<<<<<<<<<<<<< @@ -6084,44 +6299,44 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_36__repr__(struct __pyx_obj_5a */ __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, 486, __pyx_L1_error) + __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_text, __pyx_kp_u__13); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_5); __pyx_t_5 = 0; } - /* "arrex/list.pyx":487 + /* "arrex/list.pyx":503 * for i in range(self._len()): * if i: text += ', ' * text += repr(self._getitem(self.ptr + i*self.dtype.dsize)) # <<<<<<<<<<<<<< * text += '])' * return text */ - __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, 487, __pyx_L1_error) + __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, 503, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_Repr(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 487, __pyx_L1_error) + __pyx_t_6 = PyObject_Repr(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 503, __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, 487, __pyx_L1_error) + __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_text, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 503, __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":488 + /* "arrex/list.pyx":504 * if i: text += ', ' * text += repr(self._getitem(self.ptr + i*self.dtype.dsize)) * text += '])' # <<<<<<<<<<<<<< * return text * */ - __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_text, __pyx_kp_u__13); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 488, __pyx_L1_error) + __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_text, __pyx_kp_u__14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 504, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_5); __pyx_t_5 = 0; - /* "arrex/list.pyx":489 + /* "arrex/list.pyx":505 * text += repr(self._getitem(self.ptr + i*self.dtype.dsize)) * text += '])' * return text # <<<<<<<<<<<<<< @@ -6133,7 +6348,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_36__repr__(struct __pyx_obj_5a __pyx_r = __pyx_v_text; goto __pyx_L0; - /* "arrex/list.pyx":482 + /* "arrex/list.pyx":498 * return it * * def __repr__(self): # <<<<<<<<<<<<<< @@ -6154,7 +6369,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_36__repr__(struct __pyx_obj_5a return __pyx_r; } -/* "arrex/list.pyx":491 +/* "arrex/list.pyx":507 * return text * * def __eq__(self, other): # <<<<<<<<<<<<<< @@ -6191,7 +6406,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_38__eq__(struct __pyx_obj_5arr int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__eq__", 0); - /* "arrex/list.pyx":493 + /* "arrex/list.pyx":509 * 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 # <<<<<<<<<<<<<< @@ -6207,20 +6422,20 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_38__eq__(struct __pyx_obj_5arr goto __pyx_L0; } - /* "arrex/list.pyx":494 + /* "arrex/list.pyx":510 * ''' 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) */ - if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_5arrex_4list_typedlist))))) __PYX_ERR(0, 494, __pyx_L1_error) + if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_5arrex_4list_typedlist))))) __PYX_ERR(0, 510, __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":495 + /* "arrex/list.pyx":511 * if not isinstance(other, typedlist): return False * cdef typedlist o = other * if self.size != o.size: return False # <<<<<<<<<<<<<< @@ -6235,7 +6450,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_38__eq__(struct __pyx_obj_5arr goto __pyx_L0; } - /* "arrex/list.pyx":496 + /* "arrex/list.pyx":512 * cdef typedlist o = other * if self.size != o.size: return False * return 0 == memcmp(self.ptr, o.ptr, self.size) # <<<<<<<<<<<<<< @@ -6243,13 +6458,13 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_38__eq__(struct __pyx_obj_5arr * 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, 496, __pyx_L1_error) + __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, 512, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "arrex/list.pyx":491 + /* "arrex/list.pyx":507 * return text * * def __eq__(self, other): # <<<<<<<<<<<<<< @@ -6269,7 +6484,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_38__eq__(struct __pyx_obj_5arr return __pyx_r; } -/* "arrex/list.pyx":498 +/* "arrex/list.pyx":514 * return 0 == memcmp(self.ptr, o.ptr, self.size) * * def __copy__(self): # <<<<<<<<<<<<<< @@ -6300,7 +6515,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_40__copy__(struct __pyx_obj_5a int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__copy__", 0); - /* "arrex/list.pyx":500 + /* "arrex/list.pyx":516 * def __copy__(self): * ''' shallow copy will create a copy of that array referencing the same buffer ''' * return self[:] # <<<<<<<<<<<<<< @@ -6308,13 +6523,13 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_40__copy__(struct __pyx_obj_5a * def __deepcopy__(self, memo): */ __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, 500, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetSlice(((PyObject *)__pyx_v_self), 0, 0, NULL, NULL, &__pyx_slice__15, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 516, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "arrex/list.pyx":498 + /* "arrex/list.pyx":514 * return 0 == memcmp(self.ptr, o.ptr, self.size) * * def __copy__(self): # <<<<<<<<<<<<<< @@ -6333,7 +6548,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_40__copy__(struct __pyx_obj_5a return __pyx_r; } -/* "arrex/list.pyx":502 +/* "arrex/list.pyx":518 * return self[:] * * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< @@ -6365,7 +6580,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_42__deepcopy__(struct __pyx_ob int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__deepcopy__", 0); - /* "arrex/list.pyx":504 + /* "arrex/list.pyx":520 * 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) # <<<<<<<<<<<<<< @@ -6373,9 +6588,9 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_42__deepcopy__(struct __pyx_ob * def __reduce_ex__(self, protocol): */ __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, 504, __pyx_L1_error) + __pyx_t_1 = PyBytes_FromStringAndSize(((char *)__pyx_v_self->ptr), __pyx_v_self->size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 520, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 504, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 520, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); @@ -6383,14 +6598,14 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_42__deepcopy__(struct __pyx_ob __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, 504, __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, 520, __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; - /* "arrex/list.pyx":502 + /* "arrex/list.pyx":518 * return self[:] * * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< @@ -6410,7 +6625,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_42__deepcopy__(struct __pyx_ob return __pyx_r; } -/* "arrex/list.pyx":506 +/* "arrex/list.pyx":522 * return typedlist(PyBytes_FromStringAndSize(self.ptr, self.size), self.dtype) * * def __reduce_ex__(self, protocol): # <<<<<<<<<<<<<< @@ -6448,49 +6663,73 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_44__reduce_ex__(struct __pyx_o int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce_ex__", 0); - /* "arrex/list.pyx":510 + /* "arrex/list.pyx":526 * cdef Py_buffer view * - * print('reduce_ex') # <<<<<<<<<<<<<< - * - * if protocol >= 5: + * if protocol >= 5: # <<<<<<<<<<<<<< + * if not PyObject_CheckBuffer(self.owner): + * raise RuntimeError("the buffer owner doens't implement the buffer protocol") */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 510, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_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, 526, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 526, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { - /* "arrex/list.pyx":512 - * print('reduce_ex') + /* "arrex/list.pyx":527 * - * if protocol >= 5: # <<<<<<<<<<<<<< + * 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_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)) { + + /* "arrex/list.pyx":528 + * 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 = ( */ - __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, 512, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 512, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 528, __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, 528, __pyx_L1_error) - /* "arrex/list.pyx":513 + /* "arrex/list.pyx":527 * * 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":529 + * 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), */ __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, 513, __pyx_L1_error) + __pyx_t_3 = PyObject_GetBuffer(__pyx_t_1, (&__pyx_v_view), PyBUF_SIMPLE); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 529, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "arrex/list.pyx":515 + /* "arrex/list.pyx":531 * PyObject_GetBuffer(self.owner, &view, PyBUF_SIMPLE) * stuff = ( * PickleBuffer(self.owner), # <<<<<<<<<<<<<< * self.dtype, * self.ptr-view.buf, */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_PickleBuffer); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 515, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_PickleBuffer); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 531, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { @@ -6504,38 +6743,38 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_44__reduce_ex__(struct __pyx_o } __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, 515, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 531, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "arrex/list.pyx":517 + /* "arrex/list.pyx":533 * PickleBuffer(self.owner), * self.dtype, * self.ptr-view.buf, # <<<<<<<<<<<<<< * self.size, * ) */ - __pyx_t_4 = __Pyx_PyInt_From_ptrdiff_t((__pyx_v_self->ptr - __pyx_v_view.buf)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 517, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_ptrdiff_t((__pyx_v_self->ptr - __pyx_v_view.buf)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 533, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - /* "arrex/list.pyx":518 + /* "arrex/list.pyx":534 * self.dtype, * self.ptr-view.buf, * self.size, # <<<<<<<<<<<<<< * ) * PyBuffer_Release(&view) */ - __pyx_t_5 = __Pyx_PyInt_FromSize_t(__pyx_v_self->size); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 518, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_FromSize_t(__pyx_v_self->size); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 534, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - /* "arrex/list.pyx":515 + /* "arrex/list.pyx":531 * PyObject_GetBuffer(self.owner, &view, PyBUF_SIMPLE) * stuff = ( * PickleBuffer(self.owner), # <<<<<<<<<<<<<< * self.dtype, * self.ptr-view.buf, */ - __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 515, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 531, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); @@ -6552,7 +6791,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_44__reduce_ex__(struct __pyx_o __pyx_v_stuff = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0; - /* "arrex/list.pyx":520 + /* "arrex/list.pyx":536 * self.size, * ) * PyBuffer_Release(&view) # <<<<<<<<<<<<<< @@ -6561,7 +6800,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_44__reduce_ex__(struct __pyx_o */ PyBuffer_Release((&__pyx_v_view)); - /* "arrex/list.pyx":521 + /* "arrex/list.pyx":537 * ) * PyBuffer_Release(&view) * return self._rebuild, stuff, None # <<<<<<<<<<<<<< @@ -6569,9 +6808,9 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_44__reduce_ex__(struct __pyx_o * 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, 521, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_rebuild); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 537, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 521, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 537, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); @@ -6586,16 +6825,16 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_44__reduce_ex__(struct __pyx_o __pyx_t_5 = 0; goto __pyx_L0; - /* "arrex/list.pyx":512 - * print('reduce_ex') + /* "arrex/list.pyx":526 + * cdef Py_buffer view * * if protocol >= 5: # <<<<<<<<<<<<<< - * PyObject_GetBuffer(self.owner, &view, PyBUF_SIMPLE) - * stuff = ( + * if not PyObject_CheckBuffer(self.owner): + * raise RuntimeError("the buffer owner doens't implement the buffer protocol") */ } - /* "arrex/list.pyx":523 + /* "arrex/list.pyx":539 * return self._rebuild, stuff, None * else: * return self._rebuild, ( # <<<<<<<<<<<<<< @@ -6604,37 +6843,37 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_44__reduce_ex__(struct __pyx_o */ /*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, 523, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_rebuild); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 539, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - /* "arrex/list.pyx":524 + /* "arrex/list.pyx":540 * 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, 524, __pyx_L1_error) + __pyx_t_6 = PyBytes_FromStringAndSize(((char *)__pyx_v_self->ptr), __pyx_v_self->size); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 540, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - /* "arrex/list.pyx":527 + /* "arrex/list.pyx":543 * self.dtype, * 0, * self.size, # <<<<<<<<<<<<<< * ) * */ - __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_self->size); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 527, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_self->size); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 543, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - /* "arrex/list.pyx":524 + /* "arrex/list.pyx":540 * 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, 524, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 540, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6); @@ -6649,14 +6888,14 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_44__reduce_ex__(struct __pyx_o __pyx_t_6 = 0; __pyx_t_4 = 0; - /* "arrex/list.pyx":523 + /* "arrex/list.pyx":539 * 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, 523, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 539, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); @@ -6669,7 +6908,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_44__reduce_ex__(struct __pyx_o goto __pyx_L0; } - /* "arrex/list.pyx":506 + /* "arrex/list.pyx":522 * return typedlist(PyBytes_FromStringAndSize(self.ptr, self.size), self.dtype) * * def __reduce_ex__(self, protocol): # <<<<<<<<<<<<<< @@ -6692,12 +6931,12 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_44__reduce_ex__(struct __pyx_o return __pyx_r; } -/* "arrex/list.pyx":531 +/* "arrex/list.pyx":547 * * @classmethod * def _rebuild(cls, owner, dtype, size_t start, size_t size): # <<<<<<<<<<<<<< - * print('_rebuild') * new = typedlist(owner, dtype) + * assert start <= size */ /* Python wrapper */ @@ -6740,23 +6979,23 @@ static PyObject *__pyx_pw_5arrex_4list_9typedlist_47_rebuild(PyObject *__pyx_v_c 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, 531, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("_rebuild", 1, 4, 4, 1); __PYX_ERR(0, 547, __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, 531, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("_rebuild", 1, 4, 4, 2); __PYX_ERR(0, 547, __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, 531, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("_rebuild", 1, 4, 4, 3); __PYX_ERR(0, 547, __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, 531, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_rebuild") < 0)) __PYX_ERR(0, 547, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; @@ -6768,12 +7007,12 @@ static PyObject *__pyx_pw_5arrex_4list_9typedlist_47_rebuild(PyObject *__pyx_v_c } __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, 531, __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, 531, __pyx_L3_error) + __pyx_v_start = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_start == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 547, __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, 547, __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, 531, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("_rebuild", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 547, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("arrex.list.typedlist._rebuild", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -6797,25 +7036,14 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_46_rebuild(CYTHON_UNUSED PyTyp int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_rebuild", 0); - /* "arrex/list.pyx":532 + /* "arrex/list.pyx":548 * @classmethod * def _rebuild(cls, owner, dtype, size_t start, size_t size): - * print('_rebuild') # <<<<<<<<<<<<<< - * new = typedlist(owner, dtype) - * assert start <= size - */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 532, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "arrex/list.pyx":533 - * def _rebuild(cls, owner, dtype, size_t start, size_t size): - * print('_rebuild') * 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, 533, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 548, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_owner); __Pyx_GIVEREF(__pyx_v_owner); @@ -6823,14 +7051,14 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_46_rebuild(CYTHON_UNUSED PyTyp __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, 533, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5arrex_4list_typedlist), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 548, __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":534 - * print('_rebuild') + /* "arrex/list.pyx":549 + * def _rebuild(cls, owner, dtype, size_t start, size_t size): * new = typedlist(owner, dtype) * assert start <= size # <<<<<<<<<<<<<< * assert size <= new.size @@ -6840,12 +7068,12 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_46_rebuild(CYTHON_UNUSED PyTyp if (unlikely(!Py_OptimizeFlag)) { if (unlikely(!((__pyx_v_start <= __pyx_v_size) != 0))) { PyErr_SetNone(PyExc_AssertionError); - __PYX_ERR(0, 534, __pyx_L1_error) + __PYX_ERR(0, 549, __pyx_L1_error) } } #endif - /* "arrex/list.pyx":535 + /* "arrex/list.pyx":550 * new = typedlist(owner, dtype) * assert start <= size * assert size <= new.size # <<<<<<<<<<<<<< @@ -6856,12 +7084,12 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_46_rebuild(CYTHON_UNUSED PyTyp if (unlikely(!Py_OptimizeFlag)) { if (unlikely(!((__pyx_v_size <= __pyx_v_new->size) != 0))) { PyErr_SetNone(PyExc_AssertionError); - __PYX_ERR(0, 535, __pyx_L1_error) + __PYX_ERR(0, 550, __pyx_L1_error) } } #endif - /* "arrex/list.pyx":536 + /* "arrex/list.pyx":551 * assert start <= size * assert size <= new.size * new.ptr = new.ptr + start # <<<<<<<<<<<<<< @@ -6870,7 +7098,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_46_rebuild(CYTHON_UNUSED PyTyp */ __pyx_v_new->ptr = (__pyx_v_new->ptr + __pyx_v_start); - /* "arrex/list.pyx":537 + /* "arrex/list.pyx":552 * assert size <= new.size * new.ptr = new.ptr + start * new.size = size # <<<<<<<<<<<<<< @@ -6879,7 +7107,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_46_rebuild(CYTHON_UNUSED PyTyp */ __pyx_v_new->size = __pyx_v_size; - /* "arrex/list.pyx":538 + /* "arrex/list.pyx":553 * new.ptr = new.ptr + start * new.size = size * return new # <<<<<<<<<<<<<< @@ -6891,12 +7119,12 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_46_rebuild(CYTHON_UNUSED PyTyp __pyx_r = ((PyObject *)__pyx_v_new); goto __pyx_L0; - /* "arrex/list.pyx":531 + /* "arrex/list.pyx":547 * * @classmethod * def _rebuild(cls, owner, dtype, size_t start, size_t size): # <<<<<<<<<<<<<< - * print('_rebuild') * new = typedlist(owner, dtype) + * assert start <= size */ /* function exit code */ @@ -6912,7 +7140,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_46_rebuild(CYTHON_UNUSED PyTyp return __pyx_r; } -/* "arrex/list.pyx":540 +/* "arrex/list.pyx":555 * return new * * def __getbuffer__(self, Py_buffer *view, int flags): # <<<<<<<<<<<<<< @@ -6955,19 +7183,19 @@ static int __pyx_pf_5arrex_4list_9typedlist_48__getbuffer__(struct __pyx_obj_5ar __pyx_v_view->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_view->obj); - /* "arrex/list.pyx":541 + /* "arrex/list.pyx":556 * * 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, 541, __pyx_L1_error) + __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, 556, __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; - /* "arrex/list.pyx":542 + /* "arrex/list.pyx":557 * def __getbuffer__(self, Py_buffer *view, int flags): * cdef arrayexposer exp = arrayexposer.__new__(arrayexposer) * exp.owner = self.owner # <<<<<<<<<<<<<< @@ -6982,7 +7210,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_48__getbuffer__(struct __pyx_obj_5ar __pyx_v_exp->owner = __pyx_t_1; __pyx_t_1 = 0; - /* "arrex/list.pyx":543 + /* "arrex/list.pyx":558 * cdef arrayexposer exp = arrayexposer.__new__(arrayexposer) * exp.owner = self.owner * exp.shape[0] = self._len() # <<<<<<<<<<<<<< @@ -6991,7 +7219,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_48__getbuffer__(struct __pyx_obj_5ar */ (__pyx_v_exp->shape[0]) = ((struct __pyx_vtabstruct_5arrex_4list_typedlist *)__pyx_v_self->__pyx_vtab)->_len(__pyx_v_self); - /* "arrex/list.pyx":545 + /* "arrex/list.pyx":560 * exp.shape[0] = self._len() * * assign_buffer_obj(view, None) # <<<<<<<<<<<<<< @@ -7000,7 +7228,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_48__getbuffer__(struct __pyx_obj_5ar */ assign_buffer_obj(__pyx_v_view, Py_None); - /* "arrex/list.pyx":546 + /* "arrex/list.pyx":561 * * assign_buffer_obj(view, None) * view.obj = exp # <<<<<<<<<<<<<< @@ -7013,7 +7241,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_48__getbuffer__(struct __pyx_obj_5ar __Pyx_DECREF(__pyx_v_view->obj); __pyx_v_view->obj = ((PyObject *)__pyx_v_exp); - /* "arrex/list.pyx":547 + /* "arrex/list.pyx":562 * assign_buffer_obj(view, None) * view.obj = exp * view.buf = self.ptr # <<<<<<<<<<<<<< @@ -7023,7 +7251,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_48__getbuffer__(struct __pyx_obj_5ar __pyx_t_2 = __pyx_v_self->ptr; __pyx_v_view->buf = __pyx_t_2; - /* "arrex/list.pyx":548 + /* "arrex/list.pyx":563 * view.obj = exp * view.buf = self.ptr * view.len = self.size # <<<<<<<<<<<<<< @@ -7033,7 +7261,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_48__getbuffer__(struct __pyx_obj_5ar __pyx_t_3 = __pyx_v_self->size; __pyx_v_view->len = __pyx_t_3; - /* "arrex/list.pyx":549 + /* "arrex/list.pyx":564 * view.buf = self.ptr * view.len = self.size * view.ndim = 1 # <<<<<<<<<<<<<< @@ -7042,7 +7270,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_48__getbuffer__(struct __pyx_obj_5ar */ __pyx_v_view->ndim = 1; - /* "arrex/list.pyx":551 + /* "arrex/list.pyx":566 * view.ndim = 1 * * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< @@ -7052,7 +7280,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_48__getbuffer__(struct __pyx_obj_5ar __pyx_t_4 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); if (__pyx_t_4) { - /* "arrex/list.pyx":552 + /* "arrex/list.pyx":567 * * if flags & PyBUF_FORMAT: * fmt = self.dtype.layout # <<<<<<<<<<<<<< @@ -7064,7 +7292,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_48__getbuffer__(struct __pyx_obj_5ar __pyx_v_fmt = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "arrex/list.pyx":553 + /* "arrex/list.pyx":568 * if flags & PyBUF_FORMAT: * fmt = self.dtype.layout * if fmt is not None: # <<<<<<<<<<<<<< @@ -7075,7 +7303,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_48__getbuffer__(struct __pyx_obj_5ar __pyx_t_5 = (__pyx_t_4 != 0); if (__pyx_t_5) { - /* "arrex/list.pyx":554 + /* "arrex/list.pyx":569 * fmt = self.dtype.layout * if fmt is not None: * view.itemsize = self.dtype.dsize # <<<<<<<<<<<<<< @@ -7085,7 +7313,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_48__getbuffer__(struct __pyx_obj_5ar __pyx_t_3 = __pyx_v_self->dtype->dsize; __pyx_v_view->itemsize = __pyx_t_3; - /* "arrex/list.pyx":555 + /* "arrex/list.pyx":570 * if fmt is not None: * view.itemsize = self.dtype.dsize * view.format = PyBytes_AS_STRING(fmt) # <<<<<<<<<<<<<< @@ -7094,7 +7322,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_48__getbuffer__(struct __pyx_obj_5ar */ __pyx_v_view->format = PyBytes_AS_STRING(__pyx_v_fmt); - /* "arrex/list.pyx":553 + /* "arrex/list.pyx":568 * if flags & PyBUF_FORMAT: * fmt = self.dtype.layout * if fmt is not None: # <<<<<<<<<<<<<< @@ -7104,7 +7332,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_48__getbuffer__(struct __pyx_obj_5ar goto __pyx_L4; } - /* "arrex/list.pyx":557 + /* "arrex/list.pyx":572 * view.format = PyBytes_AS_STRING(fmt) * else: * view.itemsize = 1 # <<<<<<<<<<<<<< @@ -7114,7 +7342,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_48__getbuffer__(struct __pyx_obj_5ar /*else*/ { __pyx_v_view->itemsize = 1; - /* "arrex/list.pyx":558 + /* "arrex/list.pyx":573 * else: * view.itemsize = 1 * view.format = 'B' # <<<<<<<<<<<<<< @@ -7125,7 +7353,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_48__getbuffer__(struct __pyx_obj_5ar } __pyx_L4:; - /* "arrex/list.pyx":551 + /* "arrex/list.pyx":566 * view.ndim = 1 * * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< @@ -7135,7 +7363,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_48__getbuffer__(struct __pyx_obj_5ar goto __pyx_L3; } - /* "arrex/list.pyx":560 + /* "arrex/list.pyx":575 * view.format = 'B' * else: * view.itemsize = 1 # <<<<<<<<<<<<<< @@ -7145,7 +7373,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_48__getbuffer__(struct __pyx_obj_5ar /*else*/ { __pyx_v_view->itemsize = 1; - /* "arrex/list.pyx":561 + /* "arrex/list.pyx":576 * else: * view.itemsize = 1 * view.format = NULL # <<<<<<<<<<<<<< @@ -7156,7 +7384,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_48__getbuffer__(struct __pyx_obj_5ar } __pyx_L3:; - /* "arrex/list.pyx":563 + /* "arrex/list.pyx":578 * view.format = NULL * * if flags & PyBUF_ND: # <<<<<<<<<<<<<< @@ -7166,7 +7394,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_48__getbuffer__(struct __pyx_obj_5ar __pyx_t_5 = ((__pyx_v_flags & PyBUF_ND) != 0); if (__pyx_t_5) { - /* "arrex/list.pyx":564 + /* "arrex/list.pyx":579 * * if flags & PyBUF_ND: * view.suboffsets = NULL # <<<<<<<<<<<<<< @@ -7175,7 +7403,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_48__getbuffer__(struct __pyx_obj_5ar */ __pyx_v_view->suboffsets = NULL; - /* "arrex/list.pyx":565 + /* "arrex/list.pyx":580 * if flags & PyBUF_ND: * view.suboffsets = NULL * view.strides = &view.itemsize # <<<<<<<<<<<<<< @@ -7184,7 +7412,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_48__getbuffer__(struct __pyx_obj_5ar */ __pyx_v_view->strides = (&__pyx_v_view->itemsize); - /* "arrex/list.pyx":566 + /* "arrex/list.pyx":581 * view.suboffsets = NULL * view.strides = &view.itemsize * view.shape = exp.shape # <<<<<<<<<<<<<< @@ -7194,7 +7422,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_48__getbuffer__(struct __pyx_obj_5ar __pyx_t_6 = __pyx_v_exp->shape; __pyx_v_view->shape = __pyx_t_6; - /* "arrex/list.pyx":563 + /* "arrex/list.pyx":578 * view.format = NULL * * if flags & PyBUF_ND: # <<<<<<<<<<<<<< @@ -7204,7 +7432,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_48__getbuffer__(struct __pyx_obj_5ar goto __pyx_L5; } - /* "arrex/list.pyx":568 + /* "arrex/list.pyx":583 * view.shape = exp.shape * else: * view.shape = NULL # <<<<<<<<<<<<<< @@ -7216,7 +7444,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_48__getbuffer__(struct __pyx_obj_5ar } __pyx_L5:; - /* "arrex/list.pyx":540 + /* "arrex/list.pyx":555 * return new * * def __getbuffer__(self, Py_buffer *view, int flags): # <<<<<<<<<<<<<< @@ -7248,7 +7476,7 @@ static int __pyx_pf_5arrex_4list_9typedlist_48__getbuffer__(struct __pyx_obj_5ar return __pyx_r; } -/* "arrex/list.pyx":571 +/* "arrex/list.pyx":586 * * * def __releasebuffer__(self, Py_buffer *view): # <<<<<<<<<<<<<< @@ -7278,29 +7506,29 @@ static void __pyx_pf_5arrex_4list_9typedlist_50__releasebuffer__(CYTHON_UNUSED s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "arrex/list.pyx":572 + /* "arrex/list.pyx":587 * * 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, 572, __pyx_L1_error) + if (!(likely(((__pyx_v_view->obj) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_view->obj, __pyx_ptype_5arrex_4list_arrayexposer))))) __PYX_ERR(0, 587, __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":573 + /* "arrex/list.pyx":588 * 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, 573, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 588, __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, 573, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_getrefcount); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 588, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; @@ -7315,10 +7543,10 @@ static void __pyx_pf_5arrex_4list_9typedlist_50__releasebuffer__(CYTHON_UNUSED s } __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, 573, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 588, __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, 573, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 588, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_kp_u_release_buffer); __Pyx_GIVEREF(__pyx_kp_u_release_buffer); @@ -7326,12 +7554,12 @@ static void __pyx_pf_5arrex_4list_9typedlist_50__releasebuffer__(CYTHON_UNUSED s __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, 573, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 588, __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; - /* "arrex/list.pyx":574 + /* "arrex/list.pyx":589 * cdef arrayexposer exp = view.obj * print('** release buffer', sys.getrefcount(exp.owner)) * exp.owner = None # <<<<<<<<<<<<<< @@ -7344,7 +7572,7 @@ static void __pyx_pf_5arrex_4list_9typedlist_50__releasebuffer__(CYTHON_UNUSED s __Pyx_DECREF(__pyx_v_exp->owner); __pyx_v_exp->owner = Py_None; - /* "arrex/list.pyx":575 + /* "arrex/list.pyx":590 * print('** release buffer', sys.getrefcount(exp.owner)) * exp.owner = None * view.obj = None # <<<<<<<<<<<<<< @@ -7357,7 +7585,7 @@ static void __pyx_pf_5arrex_4list_9typedlist_50__releasebuffer__(CYTHON_UNUSED s __Pyx_DECREF(__pyx_v_view->obj); __pyx_v_view->obj = Py_None; - /* "arrex/list.pyx":571 + /* "arrex/list.pyx":586 * * * def __releasebuffer__(self, Py_buffer *view): # <<<<<<<<<<<<<< @@ -7377,7 +7605,7 @@ static void __pyx_pf_5arrex_4list_9typedlist_50__releasebuffer__(CYTHON_UNUSED s __Pyx_RefNannyFinishContext(); } -/* "arrex/list.pyx":577 +/* "arrex/list.pyx":592 * view.obj = None * * def reverse(self): # <<<<<<<<<<<<<< @@ -7409,7 +7637,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_52reverse(struct __pyx_obj_5ar int __pyx_t_2; __Pyx_RefNannySetupContext("reverse", 0); - /* "arrex/list.pyx":587 + /* "arrex/list.pyx":602 * cdef size_t i * * temp = PyMem_Malloc(self.dtype.dsize) # <<<<<<<<<<<<<< @@ -7418,47 +7646,47 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_52reverse(struct __pyx_obj_5ar */ __pyx_v_temp = PyMem_Malloc(__pyx_v_self->dtype->dsize); - /* "arrex/list.pyx":588 + /* "arrex/list.pyx":603 * * temp = PyMem_Malloc(self.dtype.dsize) * first = self.ptr # <<<<<<<<<<<<<< * last = self.ptr + self.size - self.dtype.dsize - * while first != last: + * while first < last: */ __pyx_t_1 = __pyx_v_self->ptr; __pyx_v_first = __pyx_t_1; - /* "arrex/list.pyx":589 + /* "arrex/list.pyx":604 * temp = PyMem_Malloc(self.dtype.dsize) * first = self.ptr * last = self.ptr + self.size - self.dtype.dsize # <<<<<<<<<<<<<< - * while first != last: + * 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":590 + /* "arrex/list.pyx":605 * first = self.ptr * last = self.ptr + self.size - self.dtype.dsize - * while first != last: # <<<<<<<<<<<<<< + * while first < last: # <<<<<<<<<<<<<< * memcpy(temp, first, self.dtype.dsize) * memcpy(first, last, self.dtype.dsize) */ while (1) { - __pyx_t_2 = ((__pyx_v_first != __pyx_v_last) != 0); + __pyx_t_2 = ((((size_t)__pyx_v_first) < ((size_t)__pyx_v_last)) != 0); if (!__pyx_t_2) break; - /* "arrex/list.pyx":591 + /* "arrex/list.pyx":606 * last = self.ptr + self.size - self.dtype.dsize - * while first != last: + * 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)); - /* "arrex/list.pyx":592 - * while first != last: + /* "arrex/list.pyx":607 + * while first < last: * memcpy(temp, first, self.dtype.dsize) * memcpy(first, last, self.dtype.dsize) # <<<<<<<<<<<<<< * memcpy(last, temp, self.dtype.dsize) @@ -7466,7 +7694,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_52reverse(struct __pyx_obj_5ar */ (void)(memcpy(__pyx_v_first, __pyx_v_last, __pyx_v_self->dtype->dsize)); - /* "arrex/list.pyx":593 + /* "arrex/list.pyx":608 * memcpy(temp, first, self.dtype.dsize) * memcpy(first, last, self.dtype.dsize) * memcpy(last, temp, self.dtype.dsize) # <<<<<<<<<<<<<< @@ -7475,7 +7703,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_52reverse(struct __pyx_obj_5ar */ (void)(memcpy(__pyx_v_last, __pyx_v_temp, __pyx_v_self->dtype->dsize)); - /* "arrex/list.pyx":594 + /* "arrex/list.pyx":609 * memcpy(first, last, self.dtype.dsize) * memcpy(last, temp, self.dtype.dsize) * first += self.dtype.dsize # <<<<<<<<<<<<<< @@ -7484,7 +7712,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_52reverse(struct __pyx_obj_5ar */ __pyx_v_first = (__pyx_v_first + __pyx_v_self->dtype->dsize); - /* "arrex/list.pyx":595 + /* "arrex/list.pyx":610 * memcpy(last, temp, self.dtype.dsize) * first += self.dtype.dsize * last -= self.dtype.dsize # <<<<<<<<<<<<<< @@ -7494,7 +7722,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_52reverse(struct __pyx_obj_5ar __pyx_v_last = (__pyx_v_last - __pyx_v_self->dtype->dsize); } - /* "arrex/list.pyx":596 + /* "arrex/list.pyx":611 * first += self.dtype.dsize * last -= self.dtype.dsize * PyMem_Free(temp) # <<<<<<<<<<<<<< @@ -7503,7 +7731,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_52reverse(struct __pyx_obj_5ar */ PyMem_Free(__pyx_v_temp); - /* "arrex/list.pyx":577 + /* "arrex/list.pyx":592 * view.obj = None * * def reverse(self): # <<<<<<<<<<<<<< @@ -7518,7 +7746,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_52reverse(struct __pyx_obj_5ar return __pyx_r; } -/* "arrex/list.pyx":598 +/* "arrex/list.pyx":613 * PyMem_Free(temp) * * def index(self, value): # <<<<<<<<<<<<<< @@ -7556,7 +7784,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_54index(struct __pyx_obj_5arre int __pyx_clineno = 0; __Pyx_RefNannySetupContext("index", 0); - /* "arrex/list.pyx":607 + /* "arrex/list.pyx":622 * cdef char *val * * data = self.ptr # <<<<<<<<<<<<<< @@ -7565,7 +7793,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_54index(struct __pyx_obj_5arre */ __pyx_v_data = ((char *)__pyx_v_self->ptr); - /* "arrex/list.pyx":608 + /* "arrex/list.pyx":623 * * data = self.ptr * val = PyMem_Malloc(self.dtype.dsize) # <<<<<<<<<<<<<< @@ -7574,16 +7802,16 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_54index(struct __pyx_obj_5arre */ __pyx_v_val = ((char *)PyMem_Malloc(__pyx_v_self->dtype->dsize)); - /* "arrex/list.pyx":609 + /* "arrex/list.pyx":624 * 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, 609, __pyx_L1_error) + __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, 624, __pyx_L1_error) - /* "arrex/list.pyx":611 + /* "arrex/list.pyx":626 * self._setitem(val, value) * * i = 0 # <<<<<<<<<<<<<< @@ -7592,7 +7820,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_54index(struct __pyx_obj_5arre */ __pyx_v_i = 0; - /* "arrex/list.pyx":612 + /* "arrex/list.pyx":627 * * i = 0 * while i < self.size: # <<<<<<<<<<<<<< @@ -7603,7 +7831,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_54index(struct __pyx_obj_5arre __pyx_t_2 = ((__pyx_v_i < __pyx_v_self->size) != 0); if (!__pyx_t_2) break; - /* "arrex/list.pyx":613 + /* "arrex/list.pyx":628 * i = 0 * while i < self.size: * j = 0 # <<<<<<<<<<<<<< @@ -7612,7 +7840,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_54index(struct __pyx_obj_5arre */ __pyx_v_j = 0; - /* "arrex/list.pyx":614 + /* "arrex/list.pyx":629 * while i < self.size: * j = 0 * while data[i+j] == val[j] and j < self.dtype.dsize: # <<<<<<<<<<<<<< @@ -7631,7 +7859,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_54index(struct __pyx_obj_5arre __pyx_L7_bool_binop_done:; if (!__pyx_t_2) break; - /* "arrex/list.pyx":615 + /* "arrex/list.pyx":630 * j = 0 * while data[i+j] == val[j] and j < self.dtype.dsize: * j += 1 # <<<<<<<<<<<<<< @@ -7641,7 +7869,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_54index(struct __pyx_obj_5arre __pyx_v_j = (__pyx_v_j + 1); } - /* "arrex/list.pyx":616 + /* "arrex/list.pyx":631 * while data[i+j] == val[j] and j < self.dtype.dsize: * j += 1 * if j == self.dtype.dsize: # <<<<<<<<<<<<<< @@ -7651,7 +7879,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_54index(struct __pyx_obj_5arre __pyx_t_2 = ((__pyx_v_j == __pyx_v_self->dtype->dsize) != 0); if (__pyx_t_2) { - /* "arrex/list.pyx":617 + /* "arrex/list.pyx":632 * j += 1 * if j == self.dtype.dsize: * PyMem_Free(val) # <<<<<<<<<<<<<< @@ -7660,7 +7888,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_54index(struct __pyx_obj_5arre */ PyMem_Free(__pyx_v_val); - /* "arrex/list.pyx":618 + /* "arrex/list.pyx":633 * if j == self.dtype.dsize: * PyMem_Free(val) * return i//self.dtype.dsize # <<<<<<<<<<<<<< @@ -7668,13 +7896,13 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_54index(struct __pyx_obj_5arre * */ __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, 618, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_FromSize_t((__pyx_v_i / __pyx_v_self->dtype->dsize)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 633, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0; - /* "arrex/list.pyx":616 + /* "arrex/list.pyx":631 * while data[i+j] == val[j] and j < self.dtype.dsize: * j += 1 * if j == self.dtype.dsize: # <<<<<<<<<<<<<< @@ -7683,7 +7911,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_54index(struct __pyx_obj_5arre */ } - /* "arrex/list.pyx":619 + /* "arrex/list.pyx":634 * PyMem_Free(val) * return i//self.dtype.dsize * i += self.dtype.dsize # <<<<<<<<<<<<<< @@ -7693,7 +7921,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_54index(struct __pyx_obj_5arre __pyx_v_i = (__pyx_v_i + __pyx_v_self->dtype->dsize); } - /* "arrex/list.pyx":621 + /* "arrex/list.pyx":636 * i += self.dtype.dsize * * PyMem_Free(val) # <<<<<<<<<<<<<< @@ -7702,20 +7930,20 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_54index(struct __pyx_obj_5arre */ PyMem_Free(__pyx_v_val); - /* "arrex/list.pyx":622 + /* "arrex/list.pyx":637 * * PyMem_Free(val) * raise IndexError('value not found') # <<<<<<<<<<<<<< * * */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 622, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 637, __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, 622, __pyx_L1_error) + __PYX_ERR(0, 637, __pyx_L1_error) - /* "arrex/list.pyx":598 + /* "arrex/list.pyx":613 * PyMem_Free(temp) * * def index(self, value): # <<<<<<<<<<<<<< @@ -7865,7 +8093,7 @@ static PyObject *__pyx_pf_5arrex_4list_9typedlist_5owner___get__(struct __pyx_ob return __pyx_r; } -/* "arrex/list.pyx":628 +/* "arrex/list.pyx":643 * cdef class arrayexposer: * ''' very simple object that just holds the data for the buffer objects ''' * cdef readonly object owner # <<<<<<<<<<<<<< @@ -8200,7 +8428,7 @@ static PyObject *__pyx_pf_5arrex_4list_12arrayexposer_2__setstate_cython__(struc return __pyx_r; } -/* "arrex/list.pyx":637 +/* "arrex/list.pyx":652 * cdef size_t position * * def __init__(self): # <<<<<<<<<<<<<< @@ -8233,20 +8461,20 @@ static int __pyx_pf_5arrex_4list_9arrayiter___init__(CYTHON_UNUSED struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "arrex/list.pyx":638 + /* "arrex/list.pyx":653 * * def __init__(self): * raise TypeError('arrayiter must not be instanciated explicitely') # <<<<<<<<<<<<<< * * def __iter__(self): */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 638, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 653, __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, 638, __pyx_L1_error) + __PYX_ERR(0, 653, __pyx_L1_error) - /* "arrex/list.pyx":637 + /* "arrex/list.pyx":652 * cdef size_t position * * def __init__(self): # <<<<<<<<<<<<<< @@ -8263,7 +8491,7 @@ static int __pyx_pf_5arrex_4list_9arrayiter___init__(CYTHON_UNUSED struct __pyx_ return __pyx_r; } -/* "arrex/list.pyx":640 +/* "arrex/list.pyx":655 * raise TypeError('arrayiter must not be instanciated explicitely') * * def __iter__(self): # <<<<<<<<<<<<<< @@ -8289,7 +8517,7 @@ static PyObject *__pyx_pf_5arrex_4list_9arrayiter_2__iter__(struct __pyx_obj_5ar __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__", 0); - /* "arrex/list.pyx":641 + /* "arrex/list.pyx":656 * * def __iter__(self): * return self # <<<<<<<<<<<<<< @@ -8301,7 +8529,7 @@ static PyObject *__pyx_pf_5arrex_4list_9arrayiter_2__iter__(struct __pyx_obj_5ar __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0; - /* "arrex/list.pyx":640 + /* "arrex/list.pyx":655 * raise TypeError('arrayiter must not be instanciated explicitely') * * def __iter__(self): # <<<<<<<<<<<<<< @@ -8316,7 +8544,7 @@ static PyObject *__pyx_pf_5arrex_4list_9arrayiter_2__iter__(struct __pyx_obj_5ar return __pyx_r; } -/* "arrex/list.pyx":643 +/* "arrex/list.pyx":658 * return self * * def __next__(self): # <<<<<<<<<<<<<< @@ -8348,7 +8576,7 @@ static PyObject *__pyx_pf_5arrex_4list_9arrayiter_4__next__(struct __pyx_obj_5ar int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__next__", 0); - /* "arrex/list.pyx":644 + /* "arrex/list.pyx":659 * * def __next__(self): * if self.position == self.array.size: # <<<<<<<<<<<<<< @@ -8358,20 +8586,20 @@ static PyObject *__pyx_pf_5arrex_4list_9arrayiter_4__next__(struct __pyx_obj_5ar __pyx_t_1 = ((__pyx_v_self->position == __pyx_v_self->array->size) != 0); if (unlikely(__pyx_t_1)) { - /* "arrex/list.pyx":645 + /* "arrex/list.pyx":660 * def __next__(self): * if self.position == self.array.size: * raise StopIteration() # <<<<<<<<<<<<<< * item = self.array._getitem(self.array.ptr + self.position) * self.position += self.array.dtype.dsize */ - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_builtin_StopIteration); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 645, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_builtin_StopIteration); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 660, __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, 645, __pyx_L1_error) + __PYX_ERR(0, 660, __pyx_L1_error) - /* "arrex/list.pyx":644 + /* "arrex/list.pyx":659 * * def __next__(self): * if self.position == self.array.size: # <<<<<<<<<<<<<< @@ -8380,19 +8608,19 @@ static PyObject *__pyx_pf_5arrex_4list_9arrayiter_4__next__(struct __pyx_obj_5ar */ } - /* "arrex/list.pyx":646 + /* "arrex/list.pyx":661 * if self.position == 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, 646, __pyx_L1_error) + __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, 661, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_item = __pyx_t_2; __pyx_t_2 = 0; - /* "arrex/list.pyx":647 + /* "arrex/list.pyx":662 * raise StopIteration() * item = self.array._getitem(self.array.ptr + self.position) * self.position += self.array.dtype.dsize # <<<<<<<<<<<<<< @@ -8401,7 +8629,7 @@ static PyObject *__pyx_pf_5arrex_4list_9arrayiter_4__next__(struct __pyx_obj_5ar */ __pyx_v_self->position = (__pyx_v_self->position + __pyx_v_self->array->dtype->dsize); - /* "arrex/list.pyx":648 + /* "arrex/list.pyx":663 * item = self.array._getitem(self.array.ptr + self.position) * self.position += self.array.dtype.dsize * return item # <<<<<<<<<<<<<< @@ -8413,7 +8641,7 @@ static PyObject *__pyx_pf_5arrex_4list_9arrayiter_4__next__(struct __pyx_obj_5ar __pyx_r = __pyx_v_item; goto __pyx_L0; - /* "arrex/list.pyx":643 + /* "arrex/list.pyx":658 * return self * * def __next__(self): # <<<<<<<<<<<<<< @@ -10402,6 +10630,9 @@ static PyTypeObject __pyx_type_5arrex_4list_typedlist = { #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif + #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000 + 0, /*tp_pypy_flags*/ + #endif }; static PyObject *__pyx_tp_new_5arrex_4list_arrayexposer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { @@ -10530,6 +10761,9 @@ static PyTypeObject __pyx_type_5arrex_4list_arrayexposer = { #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif + #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000 + 0, /*tp_pypy_flags*/ + #endif }; static PyObject *__pyx_tp_new_5arrex_4list_arrayiter(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { @@ -10652,6 +10886,9 @@ static PyTypeObject __pyx_type_5arrex_4list_arrayiter = { #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif + #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000 + 0, /*tp_pypy_flags*/ + #endif }; static PyMethodDef __pyx_methods[] = { @@ -10707,11 +10944,12 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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__14, __pyx_k__14, sizeof(__pyx_k__14), 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}, @@ -10747,6 +10985,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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}, @@ -10758,11 +10997,9 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_u_rebuild, __pyx_k_rebuild, sizeof(__pyx_k_rebuild), 0, 1, 0, 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_u_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 1, 0, 1}, - {&__pyx_n_s_reduce_ex_2, __pyx_k_reduce_ex_2, sizeof(__pyx_k_reduce_ex_2), 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}, @@ -10776,6 +11013,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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}, @@ -10791,8 +11029,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { __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, 367, __pyx_L1_error) - __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) __PYX_ERR(0, 510, __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, 528, __pyx_L1_error) + __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) __PYX_ERR(0, 588, __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; @@ -10859,124 +11098,124 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_tuple__5); __Pyx_GIVEREF(__pyx_tuple__5); - /* "arrex/list.pyx":318 + /* "arrex/list.pyx":281 + * + * if not self.size: + * raise IndexError('pop from empty list') # <<<<<<<<<<<<<< + * + * if index is None: + */ + __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_pop_from_empty_list); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 281, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__6); + __Pyx_GIVEREF(__pyx_tuple__6); + + /* "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_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_the_given_buffer_must_have_a_byt); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 318, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__6); - __Pyx_GIVEREF(__pyx_tuple__6); + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_the_given_buffer_must_have_a_byt); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 334, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__7); + __Pyx_GIVEREF(__pyx_tuple__7); - /* "arrex/list.pyx":413 + /* "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_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_incorrect_slice); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 413, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__7); - __Pyx_GIVEREF(__pyx_tuple__7); + __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_incorrect_slice); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 429, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__8); + __Pyx_GIVEREF(__pyx_tuple__8); - /* "arrex/list.pyx":415 + /* "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) * */ - __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_slice_step_is_not_supported); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 415, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_u_slice_step_is_not_supported); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 431, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__9); + __Pyx_GIVEREF(__pyx_tuple__9); - /* "arrex/list.pyx":427 + /* "arrex/list.pyx":443 * * else: * raise IndexError('index must be int or slice') # <<<<<<<<<<<<<< * * def __setitem__(self, index, value): */ - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_u_index_must_be_int_or_slice); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 427, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__9); - __Pyx_GIVEREF(__pyx_tuple__9); + __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_u_index_must_be_int_or_slice); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 443, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__10); + __Pyx_GIVEREF(__pyx_tuple__10); - /* "arrex/list.pyx":470 + /* "arrex/list.pyx":486 * * else: * raise IndexError('the assigned value must be a buffer or an iterable') # <<<<<<<<<<<<<< * * else: */ - __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_u_the_assigned_value_must_be_a_buf); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 470, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__10); - __Pyx_GIVEREF(__pyx_tuple__10); + __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_u_the_assigned_value_must_be_a_buf); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__11); + __Pyx_GIVEREF(__pyx_tuple__11); - /* "arrex/list.pyx":473 + /* "arrex/list.pyx":489 * * else: * raise IndexError('index must be int') # <<<<<<<<<<<<<< * * def __iter__(self): */ - __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_u_index_must_be_int); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 473, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__11); - __Pyx_GIVEREF(__pyx_tuple__11); + __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_u_index_must_be_int); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 489, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__12); + __Pyx_GIVEREF(__pyx_tuple__12); - /* "arrex/list.pyx":500 + /* "arrex/list.pyx":516 * def __copy__(self): * ''' shallow copy will create a copy of that array referencing the same buffer ''' * return self[:] # <<<<<<<<<<<<<< * * def __deepcopy__(self, memo): */ - __pyx_slice__14 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__14)) __PYX_ERR(0, 500, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__14); - __Pyx_GIVEREF(__pyx_slice__14); + __pyx_slice__15 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__15)) __PYX_ERR(0, 516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__15); + __Pyx_GIVEREF(__pyx_slice__15); - /* "arrex/list.pyx":510 - * cdef Py_buffer view - * - * print('reduce_ex') # <<<<<<<<<<<<<< - * + /* "arrex/list.pyx":528 * 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 = ( */ - __pyx_tuple__15 = PyTuple_Pack(1, __pyx_n_u_reduce_ex); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 510, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__15); - __Pyx_GIVEREF(__pyx_tuple__15); - - /* "arrex/list.pyx":532 - * @classmethod - * def _rebuild(cls, owner, dtype, size_t start, size_t size): - * print('_rebuild') # <<<<<<<<<<<<<< - * new = typedlist(owner, dtype) - * assert start <= size - */ - __pyx_tuple__16 = PyTuple_Pack(1, __pyx_n_u_rebuild); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 532, __pyx_L1_error) + __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_u_the_buffer_owner_doens_t_impleme); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 528, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__16); __Pyx_GIVEREF(__pyx_tuple__16); - /* "arrex/list.pyx":622 + /* "arrex/list.pyx":637 * * PyMem_Free(val) * raise IndexError('value not found') # <<<<<<<<<<<<<< * * */ - __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_u_value_not_found); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 622, __pyx_L1_error) + __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_u_value_not_found); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 637, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__17); __Pyx_GIVEREF(__pyx_tuple__17); - /* "arrex/list.pyx":638 + /* "arrex/list.pyx":653 * * def __init__(self): * raise TypeError('arrayiter must not be instanciated explicitely') # <<<<<<<<<<<<<< * * def __iter__(self): */ - __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_u_arrayiter_must_not_be_instanciat); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 638, __pyx_L1_error) + __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_u_arrayiter_must_not_be_instanciat); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 653, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__18); __Pyx_GIVEREF(__pyx_tuple__18); @@ -11153,25 +11392,25 @@ static int __Pyx_modinit_type_init_code(void) { 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, 626, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_5arrex_4list_arrayexposer) < 0) __PYX_ERR(0, 641, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_5arrex_4list_arrayexposer.tp_print = 0; #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, 626, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5arrex_4list_arrayexposer) < 0) __PYX_ERR(0, 626, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_arrayexposer, (PyObject *)&__pyx_type_5arrex_4list_arrayexposer) < 0) __PYX_ERR(0, 641, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5arrex_4list_arrayexposer) < 0) __PYX_ERR(0, 641, __pyx_L1_error) __pyx_ptype_5arrex_4list_arrayexposer = &__pyx_type_5arrex_4list_arrayexposer; - if (PyType_Ready(&__pyx_type_5arrex_4list_arrayiter) < 0) __PYX_ERR(0, 633, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_5arrex_4list_arrayiter) < 0) __PYX_ERR(0, 648, __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 (PyObject_SetAttr(__pyx_m, __pyx_n_s_arrayiter, (PyObject *)&__pyx_type_5arrex_4list_arrayiter) < 0) __PYX_ERR(0, 633, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5arrex_4list_arrayiter) < 0) __PYX_ERR(0, 633, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_arrayiter, (PyObject *)&__pyx_type_5arrex_4list_arrayiter) < 0) __PYX_ERR(0, 648, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5arrex_4list_arrayiter) < 0) __PYX_ERR(0, 648, __pyx_L1_error) __pyx_ptype_5arrex_4list_arrayiter = &__pyx_type_5arrex_4list_arrayiter; __Pyx_RefNannyFinishContext(); return 0; @@ -11554,27 +11793,27 @@ if (!__Pyx_RefNanny) { __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_5arrex_4list_typedlist); - /* "arrex/list.pyx":531 + /* "arrex/list.pyx":547 * * @classmethod * def _rebuild(cls, owner, dtype, size_t start, size_t size): # <<<<<<<<<<<<<< - * print('_rebuild') * 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, 531, __pyx_L1_error) + __Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_5arrex_4list_typedlist, __pyx_n_s_rebuild); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 547, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - /* "arrex/list.pyx":530 + /* "arrex/list.pyx":546 * ) * * @classmethod # <<<<<<<<<<<<<< * def _rebuild(cls, owner, dtype, size_t start, size_t size): - * print('_rebuild') + * new = typedlist(owner, dtype) */ - __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error) + __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 546, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __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, 531, __pyx_L1_error) + if (PyDict_SetItem((PyObject *)__pyx_ptype_5arrex_4list_typedlist->tp_dict, __pyx_n_s_rebuild, __pyx_t_1) < 0) __PYX_ERR(0, 547, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_5arrex_4list_typedlist); @@ -13105,11 +13344,11 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD; #endif #if CYTHON_USE_PYTYPE_LOOKUP - object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex_2); if (!object_reduce_ex) goto __PYX_BAD; + 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_2); if (!object_reduce_ex) goto __PYX_BAD; + 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_2); if (unlikely(!reduce_ex)) goto __PYX_BAD; + 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; @@ -13311,7 +13550,7 @@ static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int } if (!use_cline) { c_line = 0; - PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); + (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); } else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { c_line = 0; @@ -13408,30 +13647,31 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; + PyCodeObject *py_code = NULL; + PyObject *py_funcname = NULL; #if PY_MAJOR_VERSION < 3 + PyObject *py_srcfile = NULL; py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif if (!py_srcfile) goto bad; + #endif if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + funcname = PyUnicode_AsUTF8(py_funcname); + if (!funcname) goto bad; #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); + if (!py_funcname) goto bad; #endif } - if (!py_funcname) goto bad; + #if PY_MAJOR_VERSION < 3 py_code = __Pyx_PyCode_New( 0, 0, @@ -13450,11 +13690,16 @@ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); + #else + py_code = PyCode_NewEmpty(filename, funcname, py_line); + #endif + Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline return py_code; bad: - Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_srcfile); + #endif return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, @@ -14628,6 +14873,23 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_DECREF(x); return ival; } +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { + if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { + return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); +#if PY_MAJOR_VERSION < 3 + } else if (likely(PyInt_CheckExact(o))) { + return PyInt_AS_LONG(o); +#endif + } else { + Py_ssize_t ival; + PyObject *x; + x = PyNumber_Index(o); + if (!x) return -1; + ival = PyInt_AsLong(x); + Py_DECREF(x); + return ival; + } +} static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); } diff --git a/arrex/numbers.c b/arrex/numbers.c index 7cae4b9..52a46dd 100644 --- a/arrex/numbers.c +++ b/arrex/numbers.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.29.24 */ +/* Generated by Cython 0.29.26 */ /* BEGIN: Cython Metadata { @@ -22,8 +22,8 @@ END: Cython Metadata */ #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) #error Cython requires Python 2.6+ or Python 3.3+. #else -#define CYTHON_ABI "0_29_24" -#define CYTHON_HEX_VERSION 0x001D18F0 +#define CYTHON_ABI "0_29_26" +#define CYTHON_HEX_VERSION 0x001D1AF0 #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof @@ -170,7 +170,7 @@ END: Cython Metadata */ #ifndef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 1 #endif - #if PY_VERSION_HEX < 0x030300F0 + #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2 #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #elif !defined(CYTHON_USE_UNICODE_WRITER) @@ -189,7 +189,7 @@ END: Cython Metadata */ #define CYTHON_FAST_THREAD_STATE 1 #endif #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 1 + #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030B00A1) #endif #ifndef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) @@ -208,7 +208,9 @@ END: Cython Metadata */ #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif #if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" + #if PY_MAJOR_VERSION < 3 + #include "longintrepr.h" + #endif #undef SHIFT #undef BASE #undef MASK @@ -325,9 +327,68 @@ END: Cython Metadata */ #define __Pyx_DefaultClassType PyClass_Type #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" -#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2 - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) + #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, + 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; + const char *fn_cstr=NULL; + const char *name_cstr=NULL; + PyCodeObject* co=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 (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; + if (!(nlocals=PyLong_FromLong(l))) goto end; + if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end; + if (!(stacksize=PyLong_FromLong(s))) goto end; + if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end; + if (!(flags=PyLong_FromLong(f))) goto end; + if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end; + 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: + Py_XDECREF(kwds); + Py_XDECREF(argcount); + Py_XDECREF(posonlyargcount); + Py_XDECREF(kwonlyargcount); + 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; + } #else #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) @@ -565,10 +626,10 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #if PY_VERSION_HEX < 0x030200A4 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t PyInt_AsLong + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_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)) @@ -728,6 +789,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #if CYTHON_ASSUME_SAFE_MACROS #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else @@ -986,6 +1048,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #ifndef Py_MEMBER_SIZE #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) #endif +#if CYTHON_FAST_PYCALL static size_t __pyx_pyframe_localsplus_offset = 0; #include "frameobject.h" #define __Pxy_PyFrame_Initialize_Offsets()\ @@ -993,6 +1056,7 @@ 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 /* PyObjectCall.proto */ @@ -3837,7 +3901,7 @@ static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int } if (!use_cline) { c_line = 0; - PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); + (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); } else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { c_line = 0; @@ -3934,30 +3998,31 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; + PyCodeObject *py_code = NULL; + PyObject *py_funcname = NULL; #if PY_MAJOR_VERSION < 3 + PyObject *py_srcfile = NULL; py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif if (!py_srcfile) goto bad; + #endif if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + funcname = PyUnicode_AsUTF8(py_funcname); + if (!funcname) goto bad; #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); + if (!py_funcname) goto bad; #endif } - if (!py_funcname) goto bad; + #if PY_MAJOR_VERSION < 3 py_code = __Pyx_PyCode_New( 0, 0, @@ -3976,11 +4041,16 @@ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); + #else + py_code = PyCode_NewEmpty(filename, funcname, py_line); + #endif + Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline return py_code; bad: - Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_srcfile); + #endif return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, @@ -6754,6 +6824,23 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_DECREF(x); return ival; } +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { + if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { + return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); +#if PY_MAJOR_VERSION < 3 + } else if (likely(PyInt_CheckExact(o))) { + return PyInt_AS_LONG(o); +#endif + } else { + Py_ssize_t ival; + PyObject *x; + x = PyNumber_Index(o); + if (!x) return -1; + ival = PyInt_AsLong(x); + Py_DECREF(x); + return ival; + } +} static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); }