From 19df9617b140b9b930e77c07277fdd5a5163daaa Mon Sep 17 00:00:00 2001 From: Jerome Kelleher Date: Wed, 9 May 2018 10:05:59 +0100 Subject: [PATCH 1/7] First pass for fixing blosc encode error handling. --- numcodecs/blosc.c | 4667 ++++++++++++++++++--------------- numcodecs/blosc.pyx | 3 +- numcodecs/tests/test_blosc.py | 18 + 3 files changed, 2632 insertions(+), 2056 deletions(-) diff --git a/numcodecs/blosc.c b/numcodecs/blosc.c index b7857e22..c1dc8014 100644 --- a/numcodecs/blosc.c +++ b/numcodecs/blosc.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.29 */ +/* Generated by Cython 0.28.2 */ /* BEGIN: Cython Metadata { @@ -32,73 +32,73 @@ ], "include_dirs": [ "c-blosc/blosc", - "c-blosc/internal-complibs/zstd-1.3.4", - "c-blosc/internal-complibs/lz4-1.8.1.2", - "c-blosc/internal-complibs/zlib-1.2.8", "c-blosc/internal-complibs/snappy-1.1.1", - "c-blosc/internal-complibs/zstd-1.3.4/decompress", + "c-blosc/internal-complibs/zlib-1.2.8", + "c-blosc/internal-complibs/lz4-1.8.1.2", + "c-blosc/internal-complibs/zstd-1.3.4", + "c-blosc/internal-complibs/zstd-1.3.4/dll", "c-blosc/internal-complibs/zstd-1.3.4/legacy", "c-blosc/internal-complibs/zstd-1.3.4/common", "c-blosc/internal-complibs/zstd-1.3.4/deprecated", - "c-blosc/internal-complibs/zstd-1.3.4/compress", "c-blosc/internal-complibs/zstd-1.3.4/dictBuilder", - "c-blosc/internal-complibs/zstd-1.3.4/dll" + "c-blosc/internal-complibs/zstd-1.3.4/decompress", + "c-blosc/internal-complibs/zstd-1.3.4/compress" ], "name": "numcodecs.blosc", "sources": [ "numcodecs/blosc.pyx", - "c-blosc/blosc/fastcopy.c", - "c-blosc/blosc/shuffle-generic.c", "c-blosc/blosc/blosclz.c", - "c-blosc/blosc/shuffle.c", - "c-blosc/blosc/bitshuffle-generic.c", "c-blosc/blosc/blosc.c", - "c-blosc/internal-complibs/lz4-1.8.1.2/lz4.c", + "c-blosc/blosc/bitshuffle-generic.c", + "c-blosc/blosc/shuffle-generic.c", + "c-blosc/blosc/shuffle.c", + "c-blosc/blosc/fastcopy.c", "c-blosc/internal-complibs/lz4-1.8.1.2/lz4hc.c", + "c-blosc/internal-complibs/lz4-1.8.1.2/lz4.c", "c-blosc/internal-complibs/snappy-1.1.1/snappy-stubs-internal.cc", - "c-blosc/internal-complibs/snappy-1.1.1/snappy-c.cc", "c-blosc/internal-complibs/snappy-1.1.1/snappy-sinksource.cc", "c-blosc/internal-complibs/snappy-1.1.1/snappy.cc", - "c-blosc/internal-complibs/zlib-1.2.8/uncompr.c", - "c-blosc/internal-complibs/zlib-1.2.8/crc32.c", - "c-blosc/internal-complibs/zlib-1.2.8/inflate.c", + "c-blosc/internal-complibs/snappy-1.1.1/snappy-c.cc", "c-blosc/internal-complibs/zlib-1.2.8/infback.c", - "c-blosc/internal-complibs/zlib-1.2.8/gzwrite.c", - "c-blosc/internal-complibs/zlib-1.2.8/gzlib.c", "c-blosc/internal-complibs/zlib-1.2.8/adler32.c", - "c-blosc/internal-complibs/zlib-1.2.8/deflate.c", - "c-blosc/internal-complibs/zlib-1.2.8/gzread.c", "c-blosc/internal-complibs/zlib-1.2.8/inffast.c", - "c-blosc/internal-complibs/zlib-1.2.8/compress.c", + "c-blosc/internal-complibs/zlib-1.2.8/inflate.c", + "c-blosc/internal-complibs/zlib-1.2.8/crc32.c", + "c-blosc/internal-complibs/zlib-1.2.8/deflate.c", + "c-blosc/internal-complibs/zlib-1.2.8/trees.c", "c-blosc/internal-complibs/zlib-1.2.8/zutil.c", - "c-blosc/internal-complibs/zlib-1.2.8/inftrees.c", + "c-blosc/internal-complibs/zlib-1.2.8/gzwrite.c", + "c-blosc/internal-complibs/zlib-1.2.8/gzlib.c", + "c-blosc/internal-complibs/zlib-1.2.8/gzread.c", "c-blosc/internal-complibs/zlib-1.2.8/gzclose.c", - "c-blosc/internal-complibs/zlib-1.2.8/trees.c", - "c-blosc/internal-complibs/zstd-1.3.4/common/pool.c", - "c-blosc/internal-complibs/zstd-1.3.4/common/fse_decompress.c", - "c-blosc/internal-complibs/zstd-1.3.4/common/zstd_common.c", - "c-blosc/internal-complibs/zstd-1.3.4/common/threading.c", + "c-blosc/internal-complibs/zlib-1.2.8/uncompr.c", + "c-blosc/internal-complibs/zlib-1.2.8/inftrees.c", + "c-blosc/internal-complibs/zlib-1.2.8/compress.c", "c-blosc/internal-complibs/zstd-1.3.4/common/error_private.c", - "c-blosc/internal-complibs/zstd-1.3.4/common/xxhash.c", + "c-blosc/internal-complibs/zstd-1.3.4/common/zstd_common.c", "c-blosc/internal-complibs/zstd-1.3.4/common/entropy_common.c", + "c-blosc/internal-complibs/zstd-1.3.4/common/pool.c", + "c-blosc/internal-complibs/zstd-1.3.4/common/xxhash.c", + "c-blosc/internal-complibs/zstd-1.3.4/common/threading.c", + "c-blosc/internal-complibs/zstd-1.3.4/common/fse_decompress.c", "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_double_fast.c", - "c-blosc/internal-complibs/zstd-1.3.4/compress/zstdmt_compress.c", "c-blosc/internal-complibs/zstd-1.3.4/compress/fse_compress.c", "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_lazy.c", + "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_fast.c", + "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_compress.c", + "c-blosc/internal-complibs/zstd-1.3.4/compress/zstdmt_compress.c", "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_ldm.c", "c-blosc/internal-complibs/zstd-1.3.4/compress/huf_compress.c", "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_opt.c", - "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_fast.c", - "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_compress.c", "c-blosc/internal-complibs/zstd-1.3.4/decompress/huf_decompress.c", "c-blosc/internal-complibs/zstd-1.3.4/decompress/zstd_decompress.c", "c-blosc/internal-complibs/zstd-1.3.4/dictBuilder/divsufsort.c", "c-blosc/internal-complibs/zstd-1.3.4/dictBuilder/cover.c", "c-blosc/internal-complibs/zstd-1.3.4/dictBuilder/zdict.c", - "c-blosc/blosc/shuffle-sse2.c", "c-blosc/blosc/bitshuffle-sse2.c", - "c-blosc/blosc/shuffle-avx2.c", - "c-blosc/blosc/bitshuffle-avx2.c" + "c-blosc/blosc/shuffle-sse2.c", + "c-blosc/blosc/bitshuffle-avx2.c", + "c-blosc/blosc/shuffle-avx2.c" ] }, "module_name": "numcodecs.blosc" @@ -112,8 +112,7 @@ 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" -#define CYTHON_HEX_VERSION 0x001D00F0 +#define CYTHON_ABI "0_28_2" #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof @@ -184,10 +183,6 @@ END: Cython Metadata */ #define CYTHON_PEP489_MULTI_PHASE_INIT 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 - #undef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS 0 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 #elif defined(PYSTON_VERSION) #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 1 @@ -225,10 +220,6 @@ END: Cython Metadata */ #define CYTHON_PEP489_MULTI_PHASE_INIT 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 - #undef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS 0 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 0 @@ -282,17 +273,11 @@ END: Cython Metadata */ #define CYTHON_FAST_PYCALL 1 #endif #ifndef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) + #define CYTHON_PEP489_MULTI_PHASE_INIT (0 && PY_VERSION_HEX >= 0x03050000) #endif #ifndef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) #endif - #ifndef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1) - #endif - #ifndef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3) - #endif #endif #if !defined(CYTHON_FAST_PYCCALL) #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) @@ -428,9 +413,6 @@ END: Cython Metadata */ #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif -#ifndef METH_STACKLESS - #define METH_STACKLESS 0 -#endif #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) #ifndef METH_FASTCALL #define METH_FASTCALL 0x80 @@ -444,40 +426,15 @@ END: Cython Metadata */ #endif #if CYTHON_FAST_PYCCALL #define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))))) + ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS))))) #else #define __Pyx_PyFastCFunction_Check(func) 0 #endif -#if CYTHON_USE_DICT_VERSIONS -#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ - (version_var) = __PYX_GET_DICT_VERSION(dict);\ - (cache_var) = (value); -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ - static PY_UINT64_T __pyx_dict_version = 0;\ - static PyObject *__pyx_dict_cached_value = NULL;\ - if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ - (VAR) = __pyx_dict_cached_value;\ - } else {\ - (VAR) = __pyx_dict_cached_value = (LOOKUP);\ - __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ - }\ - } -#else -#define __PYX_GET_DICT_VERSION(dict) (0) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); -#endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) #define PyObject_Malloc(s) PyMem_Malloc(s) #define PyObject_Free(p) PyMem_Free(p) #define PyObject_Realloc(p) PyMem_Realloc(p) #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1 - #define PyMem_RawMalloc(n) PyMem_Malloc(n) - #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) - #define PyMem_RawFree(p) PyMem_Free(p) -#endif #if CYTHON_COMPILING_IN_PYSTON #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) @@ -585,8 +542,8 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) #endif -#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) -#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) +#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) +#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) #else @@ -601,7 +558,6 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact - #define PyObject_Unicode PyObject_Str #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) @@ -712,6 +668,7 @@ static CYTHON_INLINE float __PYX_NAN() { /* Early includes */ #include #include +#include "pythread.h" #include "blosc.h" #ifdef _OPENMP #include @@ -741,9 +698,6 @@ typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* enc (sizeof(type) == sizeof(Py_ssize_t) &&\ (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ v == (type)PY_SSIZE_T_MAX))) ) -static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { - return (size_t) i < (size_t) limit; -} #if defined (__cplusplus) && __cplusplus >= 201103L #include #define __Pyx_sst_abs(value) std::abs(value) @@ -800,9 +754,8 @@ static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) -static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); +#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); #define __Pyx_PySequence_Tuple(obj)\ (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) @@ -883,7 +836,7 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { if (!default_encoding) goto bad; default_encoding_c = PyBytes_AsString(default_encoding); if (!default_encoding_c) goto bad; - __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1); + __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); Py_DECREF(default_encoding); @@ -909,7 +862,7 @@ static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } static PyObject *__pyx_m = NULL; static PyObject *__pyx_d; static PyObject *__pyx_b; -static PyObject *__pyx_cython_runtime = NULL; +static PyObject *__pyx_cython_runtime; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static PyObject *__pyx_empty_unicode; @@ -921,7 +874,10 @@ static const char *__pyx_filename; static const char *__pyx_f[] = { "numcodecs/blosc.pyx", + "array.pxd", "type.pxd", + "bool.pxd", + "complex.pxd", "numcodecs/compat_ext.pxd", }; /* NoFastGil.proto */ @@ -938,6 +894,10 @@ static const char *__pyx_f[] = { /*--- Type declarations ---*/ +#ifndef _ARRAYARRAY_H +struct arrayobject; +typedef struct arrayobject arrayobject; +#endif struct __pyx_obj_9numcodecs_10compat_ext_Buffer; struct __pyx_defaults; typedef struct __pyx_defaults __pyx_defaults; @@ -946,9 +906,9 @@ struct __pyx_defaults { PyObject *__pyx_arg_blocksize; }; -/* "compat_ext.pxd":4 - * - * +/* "compat_ext.pxd":5 + * + * * cdef class Buffer: # <<<<<<<<<<<<<< * cdef: * char *ptr @@ -960,7 +920,9 @@ struct __pyx_obj_9numcodecs_10compat_ext_Buffer { Py_buffer buffer; size_t nbytes; size_t itemsize; - int acquired; + arrayobject *arr; + int new_buffer; + int released; }; @@ -1045,24 +1007,13 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject static PyObject *__Pyx_GetBuiltinName(PyObject *name); /* GetModuleGlobalName.proto */ -#if CYTHON_USE_DICT_VERSIONS -#define __Pyx_GetModuleGlobalName(var, name) {\ - static PY_UINT64_T __pyx_dict_version = 0;\ - static PyObject *__pyx_dict_cached_value = NULL;\ - (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ - (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ - __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} -#define __Pyx_GetModuleGlobalNameUncached(var, name) {\ - PY_UINT64_T __pyx_dict_version;\ - PyObject *__pyx_dict_cached_value;\ - (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); + +/* PyObjectCall.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); #else -#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) -#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); +#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) #endif /* PyCFunctionFastCall.proto */ @@ -1081,30 +1032,8 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #else #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) #endif -#define __Pyx_BUILD_ASSERT_EXPR(cond)\ - (sizeof(char [1 - 2*!(cond)]) - 1) -#ifndef Py_MEMBER_SIZE -#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) -#endif - static size_t __pyx_pyframe_localsplus_offset = 0; - #include "frameobject.h" - #define __Pxy_PyFrame_Initialize_Offsets()\ - ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ - (void)(__pyx_pyframe_localsplus_offset = 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 - -/* PyObjectCall.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); -#else -#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) #endif -/* PyObjectCall2Args.proto */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); - /* PyObjectCallMethO.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); @@ -1226,11 +1155,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObj #define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n) #endif -/* GetTopmostException.proto */ -#if CYTHON_USE_EXC_INFO_STACK -static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); -#endif - /* SaveResetException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) @@ -1323,17 +1247,6 @@ static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* k #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) #endif -/* TypeImport.proto */ -#ifndef __PYX_HAVE_RT_ImportType_proto -#define __PYX_HAVE_RT_ImportType_proto -enum __Pyx_ImportType_CheckSize { - __Pyx_ImportType_CheckSize_Error = 0, - __Pyx_ImportType_CheckSize_Warn = 1, - __Pyx_ImportType_CheckSize_Ignore = 2 -}; -static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size); -#endif - /* GetVTable.proto */ static void* __Pyx_GetVtable(PyObject *dict); @@ -1343,14 +1256,6 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /* ImportFrom.proto */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); -/* PyErrExceptionMatches.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) -static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); -#else -#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) -#endif - /* CalculateMetaclass.proto */ static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases); @@ -1403,7 +1308,6 @@ typedef struct { PyObject *func_annotations; } __pyx_CyFunctionObject; static PyTypeObject *__pyx_CyFunctionType = 0; -#define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType)) #define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\ __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code) static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml, @@ -1457,6 +1361,121 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); +/* ArrayAPI.proto */ +#ifndef _ARRAYARRAY_H +#define _ARRAYARRAY_H +typedef struct arraydescr { + int typecode; + int itemsize; + PyObject * (*getitem)(struct arrayobject *, Py_ssize_t); + int (*setitem)(struct arrayobject *, Py_ssize_t, PyObject *); +#if PY_MAJOR_VERSION >= 3 + char *formats; +#endif +} arraydescr; +struct arrayobject { + PyObject_HEAD + Py_ssize_t ob_size; + union { + char *ob_item; + float *as_floats; + double *as_doubles; + int *as_ints; + unsigned int *as_uints; + unsigned char *as_uchars; + signed char *as_schars; + char *as_chars; + unsigned long *as_ulongs; + long *as_longs; +#if PY_MAJOR_VERSION >= 3 + unsigned long long *as_ulonglongs; + long long *as_longlongs; +#endif + short *as_shorts; + unsigned short *as_ushorts; + Py_UNICODE *as_pyunicodes; + void *as_voidptr; + } data; + Py_ssize_t allocated; + struct arraydescr *ob_descr; + PyObject *weakreflist; +#if PY_MAJOR_VERSION >= 3 + int ob_exports; +#endif +}; +#ifndef NO_NEWARRAY_INLINE +static CYTHON_INLINE PyObject * newarrayobject(PyTypeObject *type, Py_ssize_t size, + struct arraydescr *descr) { + arrayobject *op; + size_t nbytes; + if (size < 0) { + PyErr_BadInternalCall(); + return NULL; + } + nbytes = size * descr->itemsize; + if (nbytes / descr->itemsize != (size_t)size) { + return PyErr_NoMemory(); + } + op = (arrayobject *) type->tp_alloc(type, 0); + if (op == NULL) { + return NULL; + } + op->ob_descr = descr; + op->allocated = size; + op->weakreflist = NULL; + op->ob_size = size; + if (size <= 0) { + op->data.ob_item = NULL; + } + else { + op->data.ob_item = PyMem_NEW(char, nbytes); + if (op->data.ob_item == NULL) { + Py_DECREF(op); + return PyErr_NoMemory(); + } + } + return (PyObject *) op; +} +#else +PyObject* newarrayobject(PyTypeObject *type, Py_ssize_t size, + struct arraydescr *descr); +#endif +static CYTHON_INLINE int resize(arrayobject *self, Py_ssize_t n) { + void *items = (void*) self->data.ob_item; + PyMem_Resize(items, char, (size_t)(n * self->ob_descr->itemsize)); + if (items == NULL) { + PyErr_NoMemory(); + return -1; + } + self->data.ob_item = (char*) items; + self->ob_size = n; + self->allocated = n; + return 0; +} +static CYTHON_INLINE int resize_smart(arrayobject *self, Py_ssize_t n) { + void *items = (void*) self->data.ob_item; + Py_ssize_t newsize; + if (n < self->allocated && n*4 > self->allocated) { + self->ob_size = n; + return 0; + } + newsize = n + (n / 2) + 1; + if (newsize <= n) { + PyErr_NoMemory(); + return -1; + } + PyMem_Resize(items, char, (size_t)(newsize * self->ob_descr->itemsize)); + if (items == NULL) { + PyErr_NoMemory(); + return -1; + } + self->data.ob_item = (char*) items; + self->ob_size = n; + self->allocated = newsize; + return 0; +} +#endif + /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); @@ -1482,6 +1501,21 @@ static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObj /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); +/* PyIdentifierFromString.proto */ +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif + +/* ModuleImport.proto */ +static PyObject *__Pyx_ImportModule(const char *name); + +/* TypeImport.proto */ +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); + /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); @@ -1497,12 +1531,84 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'cpython.type' */ static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; +/* Module declarations from 'cpython.version' */ + +/* Module declarations from 'cpython.ref' */ + +/* Module declarations from 'cpython.exc' */ + +/* Module declarations from 'cpython.module' */ + +/* Module declarations from 'cpython.mem' */ + +/* Module declarations from 'cpython.tuple' */ + +/* Module declarations from 'cpython.list' */ + +/* Module declarations from 'cpython.sequence' */ + +/* Module declarations from 'cpython.mapping' */ + +/* Module declarations from 'cpython.iterator' */ + +/* Module declarations from 'cpython.number' */ + +/* Module declarations from 'cpython.int' */ + +/* Module declarations from '__builtin__' */ + +/* Module declarations from 'cpython.bool' */ +static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0; + +/* Module declarations from 'cpython.long' */ + +/* Module declarations from 'cpython.float' */ + +/* Module declarations from '__builtin__' */ + +/* Module declarations from 'cpython.complex' */ +static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0; + +/* Module declarations from 'cpython.string' */ + +/* Module declarations from 'cpython.unicode' */ + +/* Module declarations from 'cpython.dict' */ + +/* Module declarations from 'cpython.instance' */ + +/* Module declarations from 'cpython.function' */ + +/* Module declarations from 'cpython.method' */ + +/* Module declarations from 'cpython.weakref' */ + +/* Module declarations from 'cpython.getargs' */ + +/* Module declarations from 'cpython.pythread' */ + +/* Module declarations from 'cpython.pystate' */ + +/* Module declarations from 'cpython.cobject' */ + +/* Module declarations from 'cpython.oldbuffer' */ + +/* Module declarations from 'cpython.set' */ + +/* Module declarations from 'cpython.pycapsule' */ + /* Module declarations from 'cpython' */ /* Module declarations from 'cpython.object' */ /* Module declarations from 'cpython.bytes' */ +/* Module declarations from 'array' */ + +/* Module declarations from 'cpython.array' */ +static PyTypeObject *__pyx_ptype_7cpython_5array_array = 0; +static CYTHON_INLINE int __pyx_f_7cpython_5array_extend_buffer(arrayobject *, char *, Py_ssize_t); /*proto*/ + /* Module declarations from 'numcodecs.compat_ext' */ static PyTypeObject *__pyx_ptype_9numcodecs_10compat_ext_Buffer = 0; @@ -1512,12 +1618,12 @@ extern int __pyx_module_is_main_numcodecs__blosc; int __pyx_module_is_main_numcodecs__blosc = 0; /* Implementation of 'numcodecs.blosc' */ -static PyObject *__pyx_builtin_OSError; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_RuntimeError; -static const char __pyx_k_[] = ","; +static PyObject *__pyx_builtin_MemoryError; static const char __pyx_k_r[] = "r"; static const char __pyx_k_s[] = "s"; +static const char __pyx_k__3[] = ","; static const char __pyx_k_os[] = "os"; static const char __pyx_k_PY2[] = "PY2"; static const char __pyx_k_abc[] = "abc"; @@ -1560,7 +1666,6 @@ static const char __pyx_k_module[] = "__module__"; static const char __pyx_k_name_2[] = "__name__"; static const char __pyx_k_nbytes[] = "nbytes"; static const char __pyx_k_source[] = "source"; -static const char __pyx_k_OSError[] = "OSError"; static const char __pyx_k_SHUFFLE[] = "SHUFFLE"; static const char __pyx_k_complib[] = "complib"; static const char __pyx_k_destroy[] = "destroy"; @@ -1592,6 +1697,7 @@ static const char __pyx_k_source_ptr[] = "source_ptr"; static const char __pyx_k_AUTOSHUFFLE[] = "AUTOSHUFFLE"; static const char __pyx_k_MAX_THREADS[] = "MAX_THREADS"; static const char __pyx_k_MainProcess[] = "MainProcess"; +static const char __pyx_k_MemoryError[] = "MemoryError"; static const char __pyx_k_cname_bytes[] = "_cname_bytes"; static const char __pyx_k_dest_buffer[] = "dest_buffer"; static const char __pyx_k_dest_nbytes[] = "dest_nbytes"; @@ -1634,7 +1740,6 @@ static const char __pyx_k_destination_buffer_too_small_exp[] = "destination buff static const char __pyx_k_error_during_blosc_compression_d[] = "error during blosc compression: %d"; static const char __pyx_k_error_during_blosc_decompression[] = "error during blosc decompression: %d"; static const char __pyx_k_invalid_shuffle_argument_expecte[] = "invalid shuffle argument; expected -1, 0, 1 or 2, found %r"; -static PyObject *__pyx_kp_s_; static PyObject *__pyx_n_s_AUTOBLOCKS; static PyObject *__pyx_n_s_AUTOSHUFFLE; static PyObject *__pyx_n_s_BITSHUFFLE; @@ -1653,14 +1758,15 @@ static PyObject *__pyx_n_s_MAX_THREADS; static PyObject *__pyx_n_s_MAX_TYPESIZE; static PyObject *__pyx_n_s_MainProcess; static PyObject *__pyx_n_s_MainThread; +static PyObject *__pyx_n_s_MemoryError; static PyObject *__pyx_n_s_NOSHUFFLE; -static PyObject *__pyx_n_s_OSError; static PyObject *__pyx_n_s_PY2; static PyObject *__pyx_n_s_RuntimeError; static PyObject *__pyx_n_s_SHUFFLE; static PyObject *__pyx_n_s_VERSION_DATE; static PyObject *__pyx_n_s_VERSION_STRING; static PyObject *__pyx_n_s_ValueError; +static PyObject *__pyx_kp_s__3; static PyObject *__pyx_n_s_abc; static PyObject *__pyx_n_s_ascii; static PyObject *__pyx_kp_s_bad_compressor_or_compressor_not; @@ -1771,50 +1877,57 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc___init__(CYTHON_UNUSED PyObje static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_2encode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_buf); /* proto */ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_4decode(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_buf, PyObject *__pyx_v_out); /* proto */ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_6__repr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info, CYTHON_UNUSED int __pyx_v_flags); /* proto */ +static void __pyx_pf_7cpython_5array_5array_2__releasebuffer__(CYTHON_UNUSED arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; static PyObject *__pyx_int_5; static PyObject *__pyx_int_neg_1; -static int __pyx_k__2; -static int __pyx_k__3; +static int __pyx_k__6; +static int __pyx_k__7; +static PyObject *__pyx_tuple_; +static PyObject *__pyx_tuple__2; static PyObject *__pyx_tuple__4; -static PyObject *__pyx_tuple__7; +static PyObject *__pyx_tuple__5; +static PyObject *__pyx_tuple__8; static PyObject *__pyx_tuple__9; static PyObject *__pyx_tuple__12; static PyObject *__pyx_tuple__14; -static PyObject *__pyx_tuple__16; -static PyObject *__pyx_tuple__18; -static PyObject *__pyx_tuple__20; -static PyObject *__pyx_tuple__22; -static PyObject *__pyx_tuple__24; -static PyObject *__pyx_tuple__26; -static PyObject *__pyx_tuple__28; -static PyObject *__pyx_tuple__30; -static PyObject *__pyx_tuple__32; -static PyObject *__pyx_tuple__34; +static PyObject *__pyx_tuple__17; +static PyObject *__pyx_tuple__19; +static PyObject *__pyx_tuple__21; +static PyObject *__pyx_tuple__23; +static PyObject *__pyx_tuple__25; +static PyObject *__pyx_tuple__27; +static PyObject *__pyx_tuple__29; +static PyObject *__pyx_tuple__31; +static PyObject *__pyx_tuple__33; static PyObject *__pyx_tuple__35; -static PyObject *__pyx_codeobj__5; -static PyObject *__pyx_codeobj__6; -static PyObject *__pyx_codeobj__8; +static PyObject *__pyx_tuple__37; +static PyObject *__pyx_tuple__39; +static PyObject *__pyx_tuple__40; static PyObject *__pyx_codeobj__10; static PyObject *__pyx_codeobj__11; static PyObject *__pyx_codeobj__13; static PyObject *__pyx_codeobj__15; -static PyObject *__pyx_codeobj__17; -static PyObject *__pyx_codeobj__19; -static PyObject *__pyx_codeobj__21; -static PyObject *__pyx_codeobj__23; -static PyObject *__pyx_codeobj__25; -static PyObject *__pyx_codeobj__27; -static PyObject *__pyx_codeobj__29; -static PyObject *__pyx_codeobj__31; -static PyObject *__pyx_codeobj__33; +static PyObject *__pyx_codeobj__16; +static PyObject *__pyx_codeobj__18; +static PyObject *__pyx_codeobj__20; +static PyObject *__pyx_codeobj__22; +static PyObject *__pyx_codeobj__24; +static PyObject *__pyx_codeobj__26; +static PyObject *__pyx_codeobj__28; +static PyObject *__pyx_codeobj__30; +static PyObject *__pyx_codeobj__32; +static PyObject *__pyx_codeobj__34; static PyObject *__pyx_codeobj__36; +static PyObject *__pyx_codeobj__38; +static PyObject *__pyx_codeobj__41; /* Late includes */ -/* "numcodecs/blosc.pyx":89 - * - * +/* "numcodecs/blosc.pyx":86 + * + * * def init(): # <<<<<<<<<<<<<< * """Initialize the Blosc library environment.""" * blosc_init() @@ -1840,18 +1953,18 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_init(CYTHON_UNUSED PyObject *__pyx_s __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("init", 0); - /* "numcodecs/blosc.pyx":91 + /* "numcodecs/blosc.pyx":88 * def init(): * """Initialize the Blosc library environment.""" * blosc_init() # <<<<<<<<<<<<<< - * - * + * + * */ blosc_init(); - /* "numcodecs/blosc.pyx":89 - * - * + /* "numcodecs/blosc.pyx":86 + * + * * def init(): # <<<<<<<<<<<<<< * """Initialize the Blosc library environment.""" * blosc_init() @@ -1864,9 +1977,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_init(CYTHON_UNUSED PyObject *__pyx_s return __pyx_r; } -/* "numcodecs/blosc.pyx":94 - * - * +/* "numcodecs/blosc.pyx":91 + * + * * def destroy(): # <<<<<<<<<<<<<< * """Destroy the Blosc library environment.""" * blosc_destroy() @@ -1892,18 +2005,18 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_2destroy(CYTHON_UNUSED PyObject *__p __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("destroy", 0); - /* "numcodecs/blosc.pyx":96 + /* "numcodecs/blosc.pyx":93 * def destroy(): * """Destroy the Blosc library environment.""" * blosc_destroy() # <<<<<<<<<<<<<< - * - * + * + * */ blosc_destroy(); - /* "numcodecs/blosc.pyx":94 - * - * + /* "numcodecs/blosc.pyx":91 + * + * * def destroy(): # <<<<<<<<<<<<<< * """Destroy the Blosc library environment.""" * blosc_destroy() @@ -1916,9 +2029,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_2destroy(CYTHON_UNUSED PyObject *__p return __pyx_r; } -/* "numcodecs/blosc.pyx":99 - * - * +/* "numcodecs/blosc.pyx":96 + * + * * def compname_to_compcode(cname): # <<<<<<<<<<<<<< * """Return the compressor code associated with the compressor name. If the compressor * name is not recognized, or there is not support for it in this build, -1 is returned @@ -1946,53 +2059,40 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_4compname_to_compcode(CYTHON_UNUSED int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - char const *__pyx_t_6; + char const *__pyx_t_5; __Pyx_RefNannySetupContext("compname_to_compcode", 0); __Pyx_INCREF(__pyx_v_cname); - /* "numcodecs/blosc.pyx":103 + /* "numcodecs/blosc.pyx":100 * name is not recognized, or there is not support for it in this build, -1 is returned * instead.""" * if isinstance(cname, text_type): # <<<<<<<<<<<<<< * cname = cname.encode('ascii') * return blosc_compname_to_compcode(cname) */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_text_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_text_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_IsInstance(__pyx_v_cname, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 103, __pyx_L1_error) + __pyx_t_2 = PyObject_IsInstance(__pyx_v_cname, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { - /* "numcodecs/blosc.pyx":104 + /* "numcodecs/blosc.pyx":101 * instead.""" * if isinstance(cname, text_type): * cname = cname.encode('ascii') # <<<<<<<<<<<<<< * return blosc_compname_to_compcode(cname) - * + * */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_cname, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 104, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_n_s_ascii) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_n_s_ascii); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cname, __pyx_n_s_encode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF_SET(__pyx_v_cname, __pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_cname, __pyx_t_4); + __pyx_t_4 = 0; - /* "numcodecs/blosc.pyx":103 + /* "numcodecs/blosc.pyx":100 * name is not recognized, or there is not support for it in this build, -1 is returned * instead.""" * if isinstance(cname, text_type): # <<<<<<<<<<<<<< @@ -2001,24 +2101,24 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_4compname_to_compcode(CYTHON_UNUSED */ } - /* "numcodecs/blosc.pyx":105 + /* "numcodecs/blosc.pyx":102 * if isinstance(cname, text_type): * cname = cname.encode('ascii') * return blosc_compname_to_compcode(cname) # <<<<<<<<<<<<<< - * - * + * + * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_cname); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 105, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyInt_From_int(blosc_compname_to_compcode(__pyx_t_6)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 105, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_cname); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 102, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_int(blosc_compname_to_compcode(__pyx_t_5)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 102, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; goto __pyx_L0; - /* "numcodecs/blosc.pyx":99 - * - * + /* "numcodecs/blosc.pyx":96 + * + * * def compname_to_compcode(cname): # <<<<<<<<<<<<<< * """Return the compressor code associated with the compressor name. If the compressor * name is not recognized, or there is not support for it in this build, -1 is returned @@ -2028,7 +2128,6 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_4compname_to_compcode(CYTHON_UNUSED __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("numcodecs.blosc.compname_to_compcode", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -2038,9 +2137,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_4compname_to_compcode(CYTHON_UNUSED return __pyx_r; } -/* "numcodecs/blosc.pyx":108 - * - * +/* "numcodecs/blosc.pyx":105 + * + * * def list_compressors(): # <<<<<<<<<<<<<< * """Get a list of compressors supported in the current build.""" * s = blosc_list_compressors() @@ -2069,63 +2168,50 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_6list_compressors(CYTHON_UNUSED PyOb int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("list_compressors", 0); - /* "numcodecs/blosc.pyx":110 + /* "numcodecs/blosc.pyx":107 * def list_compressors(): * """Get a list of compressors supported in the current build.""" * s = blosc_list_compressors() # <<<<<<<<<<<<<< * if not PY2: * s = s.decode('ascii') */ - __pyx_t_1 = __Pyx_PyBytes_FromString(blosc_list_compressors()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBytes_FromString(blosc_list_compressors()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_s = __pyx_t_1; __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":111 + /* "numcodecs/blosc.pyx":108 * """Get a list of compressors supported in the current build.""" * s = blosc_list_compressors() * if not PY2: # <<<<<<<<<<<<<< * s = s.decode('ascii') * return s.split(',') */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PY2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_PY2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 111, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = ((!__pyx_t_2) != 0); if (__pyx_t_3) { - /* "numcodecs/blosc.pyx":112 + /* "numcodecs/blosc.pyx":109 * s = blosc_list_compressors() * if not PY2: * s = s.decode('ascii') # <<<<<<<<<<<<<< * return s.split(',') - * + * */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_decode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 112, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_n_s_ascii) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_n_s_ascii); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_decode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 109, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_4); + __pyx_t_4 = 0; - /* "numcodecs/blosc.pyx":111 + /* "numcodecs/blosc.pyx":108 * """Get a list of compressors supported in the current build.""" * s = blosc_list_compressors() * if not PY2: # <<<<<<<<<<<<<< @@ -2134,38 +2220,26 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_6list_compressors(CYTHON_UNUSED PyOb */ } - /* "numcodecs/blosc.pyx":113 + /* "numcodecs/blosc.pyx":110 * if not PY2: * s = s.decode('ascii') * return s.split(',') # <<<<<<<<<<<<<< - * - * + * + * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_split); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 113, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_split); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "numcodecs/blosc.pyx":108 - * - * + /* "numcodecs/blosc.pyx":105 + * + * * def list_compressors(): # <<<<<<<<<<<<<< * """Get a list of compressors supported in the current build.""" * s = blosc_list_compressors() @@ -2175,7 +2249,6 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_6list_compressors(CYTHON_UNUSED PyOb __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("numcodecs.blosc.list_compressors", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -2185,9 +2258,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_6list_compressors(CYTHON_UNUSED PyOb return __pyx_r; } -/* "numcodecs/blosc.pyx":116 - * - * +/* "numcodecs/blosc.pyx":113 + * + * * def get_nthreads(): # <<<<<<<<<<<<<< * """Get the number of threads that Blosc uses internally for compression and * decompression.""" @@ -2214,23 +2287,23 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_8get_nthreads(CYTHON_UNUSED PyObject PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("get_nthreads", 0); - /* "numcodecs/blosc.pyx":119 + /* "numcodecs/blosc.pyx":116 * """Get the number of threads that Blosc uses internally for compression and * decompression.""" * return blosc_get_nthreads() # <<<<<<<<<<<<<< - * - * + * + * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(blosc_get_nthreads()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 119, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(blosc_get_nthreads()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "numcodecs/blosc.pyx":116 - * - * + /* "numcodecs/blosc.pyx":113 + * + * * def get_nthreads(): # <<<<<<<<<<<<<< * """Get the number of threads that Blosc uses internally for compression and * decompression.""" @@ -2247,9 +2320,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_8get_nthreads(CYTHON_UNUSED PyObject return __pyx_r; } -/* "numcodecs/blosc.pyx":122 - * - * +/* "numcodecs/blosc.pyx":119 + * + * * def set_nthreads(int nthreads): # <<<<<<<<<<<<<< * """Set the number of threads that Blosc uses internally for compression and * decompression.""" @@ -2265,7 +2338,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_11set_nthreads(PyObject *__pyx_self, __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_nthreads (wrapper)", 0); assert(__pyx_arg_nthreads); { - __pyx_v_nthreads = __Pyx_PyInt_As_int(__pyx_arg_nthreads); if (unlikely((__pyx_v_nthreads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 122, __pyx_L3_error) + __pyx_v_nthreads = __Pyx_PyInt_As_int(__pyx_arg_nthreads); if (unlikely((__pyx_v_nthreads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 119, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -2286,23 +2359,23 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_10set_nthreads(CYTHON_UNUSED PyObjec PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("set_nthreads", 0); - /* "numcodecs/blosc.pyx":125 + /* "numcodecs/blosc.pyx":122 * """Set the number of threads that Blosc uses internally for compression and * decompression.""" * return blosc_set_nthreads(nthreads) # <<<<<<<<<<<<<< - * - * + * + * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(blosc_set_nthreads(__pyx_v_nthreads)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 125, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(blosc_set_nthreads(__pyx_v_nthreads)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "numcodecs/blosc.pyx":122 - * - * + /* "numcodecs/blosc.pyx":119 + * + * * def set_nthreads(int nthreads): # <<<<<<<<<<<<<< * """Set the number of threads that Blosc uses internally for compression and * decompression.""" @@ -2319,9 +2392,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_10set_nthreads(CYTHON_UNUSED PyObjec return __pyx_r; } -/* "numcodecs/blosc.pyx":128 - * - * +/* "numcodecs/blosc.pyx":125 + * + * * def cbuffer_sizes(source): # <<<<<<<<<<<<<< * """Return information about a compressed buffer, namely the number of uncompressed * bytes (`nbytes`) and compressed (`cbytes`). It also returns the `blocksize` (which @@ -2355,16 +2428,16 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_12cbuffer_sizes(CYTHON_UNUSED PyObje PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("cbuffer_sizes", 0); - /* "numcodecs/blosc.pyx":145 - * + /* "numcodecs/blosc.pyx":142 + * * # obtain buffer * buffer = Buffer(source, PyBUF_ANY_CONTIGUOUS) # <<<<<<<<<<<<<< - * + * * # determine buffer size */ - __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_source); __Pyx_GIVEREF(__pyx_v_source); @@ -2372,47 +2445,47 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_12cbuffer_sizes(CYTHON_UNUSED PyObje __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_buffer = ((struct __pyx_obj_9numcodecs_10compat_ext_Buffer *)__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":148 - * + /* "numcodecs/blosc.pyx":145 + * * # determine buffer size * blosc_cbuffer_sizes(buffer.ptr, &nbytes, &cbytes, &blocksize) # <<<<<<<<<<<<<< - * + * * # release buffers */ blosc_cbuffer_sizes(__pyx_v_buffer->ptr, (&__pyx_v_nbytes), (&__pyx_v_cbytes), (&__pyx_v_blocksize)); - /* "numcodecs/blosc.pyx":151 - * + /* "numcodecs/blosc.pyx":148 + * * # release buffers * buffer.release() # <<<<<<<<<<<<<< - * + * * return nbytes, cbytes, blocksize */ - __pyx_t_1 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_buffer->__pyx_vtab)->release(__pyx_v_buffer, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_buffer->__pyx_vtab)->release(__pyx_v_buffer, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":153 + /* "numcodecs/blosc.pyx":150 * buffer.release() - * + * * return nbytes, cbytes, blocksize # <<<<<<<<<<<<<< - * - * + * + * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_nbytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_nbytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_cbytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_cbytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_blocksize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 153, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_blocksize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 150, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 153, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 150, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); @@ -2427,9 +2500,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_12cbuffer_sizes(CYTHON_UNUSED PyObje __pyx_t_4 = 0; goto __pyx_L0; - /* "numcodecs/blosc.pyx":128 - * - * + /* "numcodecs/blosc.pyx":125 + * + * * def cbuffer_sizes(source): # <<<<<<<<<<<<<< * """Return information about a compressed buffer, namely the number of uncompressed * bytes (`nbytes`) and compressed (`cbytes`). It also returns the `blocksize` (which @@ -2450,9 +2523,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_12cbuffer_sizes(CYTHON_UNUSED PyObje return __pyx_r; } -/* "numcodecs/blosc.pyx":156 - * - * +/* "numcodecs/blosc.pyx":153 + * + * * def cbuffer_complib(source): # <<<<<<<<<<<<<< * """Return the name of the compression library used to compress `source`.""" * cdef: @@ -2482,19 +2555,18 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_14cbuffer_complib(CYTHON_UNUSED PyOb PyObject *__pyx_t_2 = NULL; int __pyx_t_3; int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("cbuffer_complib", 0); - /* "numcodecs/blosc.pyx":162 - * + /* "numcodecs/blosc.pyx":159 + * * # obtain buffer * buffer = Buffer(source, PyBUF_ANY_CONTIGUOUS) # <<<<<<<<<<<<<< - * + * * # determine buffer size */ - __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_source); __Pyx_GIVEREF(__pyx_v_source); @@ -2502,100 +2574,88 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_14cbuffer_complib(CYTHON_UNUSED PyOb __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_buffer = ((struct __pyx_obj_9numcodecs_10compat_ext_Buffer *)__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":165 - * + /* "numcodecs/blosc.pyx":162 + * * # determine buffer size * complib = blosc_cbuffer_complib(buffer.ptr) # <<<<<<<<<<<<<< - * + * * # release buffers */ - __pyx_t_1 = __Pyx_PyBytes_FromString(blosc_cbuffer_complib(__pyx_v_buffer->ptr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBytes_FromString(blosc_cbuffer_complib(__pyx_v_buffer->ptr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_complib = __pyx_t_1; __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":168 - * + /* "numcodecs/blosc.pyx":165 + * * # release buffers * buffer.release() # <<<<<<<<<<<<<< - * + * * if not PY2: */ - __pyx_t_1 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_buffer->__pyx_vtab)->release(__pyx_v_buffer, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 168, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_buffer->__pyx_vtab)->release(__pyx_v_buffer, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":170 + /* "numcodecs/blosc.pyx":167 * buffer.release() - * + * * if not PY2: # <<<<<<<<<<<<<< * complib = complib.decode('ascii') - * + * */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PY2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_PY2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 167, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 170, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 167, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_4 = ((!__pyx_t_3) != 0); if (__pyx_t_4) { - /* "numcodecs/blosc.pyx":171 - * + /* "numcodecs/blosc.pyx":168 + * * if not PY2: * complib = complib.decode('ascii') # <<<<<<<<<<<<<< - * + * * return complib */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_complib, __pyx_n_s_decode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_n_s_ascii) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_s_ascii); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_complib, __pyx_n_s_decode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF_SET(__pyx_v_complib, __pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 168, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_complib, __pyx_t_2); + __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":170 + /* "numcodecs/blosc.pyx":167 * buffer.release() - * + * * if not PY2: # <<<<<<<<<<<<<< * complib = complib.decode('ascii') - * + * */ } - /* "numcodecs/blosc.pyx":173 + /* "numcodecs/blosc.pyx":170 * complib = complib.decode('ascii') - * + * * return complib # <<<<<<<<<<<<<< - * - * + * + * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_complib); __pyx_r = __pyx_v_complib; goto __pyx_L0; - /* "numcodecs/blosc.pyx":156 - * - * + /* "numcodecs/blosc.pyx":153 + * + * * def cbuffer_complib(source): # <<<<<<<<<<<<<< * """Return the name of the compression library used to compress `source`.""" * cdef: @@ -2605,7 +2665,6 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_14cbuffer_complib(CYTHON_UNUSED PyOb __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("numcodecs.blosc.cbuffer_complib", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -2616,9 +2675,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_14cbuffer_complib(CYTHON_UNUSED PyOb return __pyx_r; } -/* "numcodecs/blosc.pyx":176 - * - * +/* "numcodecs/blosc.pyx":173 + * + * * def cbuffer_metainfo(source): # <<<<<<<<<<<<<< * """Return some meta-information about the compressed buffer in `source`, including * the typesize, whether the shuffle or bit-shuffle filters were used, and the @@ -2653,16 +2712,16 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_16cbuffer_metainfo(CYTHON_UNUSED PyO PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("cbuffer_metainfo", 0); - /* "numcodecs/blosc.pyx":194 - * + /* "numcodecs/blosc.pyx":191 + * * # obtain buffer * buffer = Buffer(source, PyBUF_ANY_CONTIGUOUS) # <<<<<<<<<<<<<< - * + * * # determine buffer size */ - __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 191, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_source); __Pyx_GIVEREF(__pyx_v_source); @@ -2670,34 +2729,34 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_16cbuffer_metainfo(CYTHON_UNUSED PyO __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_buffer = ((struct __pyx_obj_9numcodecs_10compat_ext_Buffer *)__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":197 - * + /* "numcodecs/blosc.pyx":194 + * * # determine buffer size * blosc_cbuffer_metainfo(buffer.ptr, &typesize, &flags) # <<<<<<<<<<<<<< - * + * * # release buffers */ blosc_cbuffer_metainfo(__pyx_v_buffer->ptr, (&__pyx_v_typesize), (&__pyx_v_flags)); - /* "numcodecs/blosc.pyx":200 - * + /* "numcodecs/blosc.pyx":197 + * * # release buffers * buffer.release() # <<<<<<<<<<<<<< - * + * * # decompose flags */ - __pyx_t_1 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_buffer->__pyx_vtab)->release(__pyx_v_buffer, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 200, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_buffer->__pyx_vtab)->release(__pyx_v_buffer, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":203 - * + /* "numcodecs/blosc.pyx":200 + * * # decompose flags * if flags & BLOSC_DOSHUFFLE: # <<<<<<<<<<<<<< * shuffle = SHUFFLE @@ -2706,20 +2765,20 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_16cbuffer_metainfo(CYTHON_UNUSED PyO __pyx_t_3 = ((__pyx_v_flags & BLOSC_DOSHUFFLE) != 0); if (__pyx_t_3) { - /* "numcodecs/blosc.pyx":204 + /* "numcodecs/blosc.pyx":201 * # decompose flags * if flags & BLOSC_DOSHUFFLE: * shuffle = SHUFFLE # <<<<<<<<<<<<<< * elif flags & BLOSC_DOBITSHUFFLE: * shuffle = BITSHUFFLE */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_SHUFFLE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_SHUFFLE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_shuffle = __pyx_t_1; __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":203 - * + /* "numcodecs/blosc.pyx":200 + * * # decompose flags * if flags & BLOSC_DOSHUFFLE: # <<<<<<<<<<<<<< * shuffle = SHUFFLE @@ -2728,7 +2787,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_16cbuffer_metainfo(CYTHON_UNUSED PyO goto __pyx_L3; } - /* "numcodecs/blosc.pyx":205 + /* "numcodecs/blosc.pyx":202 * if flags & BLOSC_DOSHUFFLE: * shuffle = SHUFFLE * elif flags & BLOSC_DOBITSHUFFLE: # <<<<<<<<<<<<<< @@ -2738,19 +2797,19 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_16cbuffer_metainfo(CYTHON_UNUSED PyO __pyx_t_3 = ((__pyx_v_flags & BLOSC_DOBITSHUFFLE) != 0); if (__pyx_t_3) { - /* "numcodecs/blosc.pyx":206 + /* "numcodecs/blosc.pyx":203 * shuffle = SHUFFLE * elif flags & BLOSC_DOBITSHUFFLE: * shuffle = BITSHUFFLE # <<<<<<<<<<<<<< * else: * shuffle = NOSHUFFLE */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BITSHUFFLE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 206, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_BITSHUFFLE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_shuffle = __pyx_t_1; __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":205 + /* "numcodecs/blosc.pyx":202 * if flags & BLOSC_DOSHUFFLE: * shuffle = SHUFFLE * elif flags & BLOSC_DOBITSHUFFLE: # <<<<<<<<<<<<<< @@ -2760,43 +2819,43 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_16cbuffer_metainfo(CYTHON_UNUSED PyO goto __pyx_L3; } - /* "numcodecs/blosc.pyx":208 + /* "numcodecs/blosc.pyx":205 * shuffle = BITSHUFFLE * else: * shuffle = NOSHUFFLE # <<<<<<<<<<<<<< * memcpyed = flags & BLOSC_MEMCPYED - * + * */ /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_NOSHUFFLE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_NOSHUFFLE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_shuffle = __pyx_t_1; __pyx_t_1 = 0; } __pyx_L3:; - /* "numcodecs/blosc.pyx":209 + /* "numcodecs/blosc.pyx":206 * else: * shuffle = NOSHUFFLE * memcpyed = flags & BLOSC_MEMCPYED # <<<<<<<<<<<<<< - * + * * return typesize, shuffle, memcpyed */ __pyx_v_memcpyed = (__pyx_v_flags & BLOSC_MEMCPYED); - /* "numcodecs/blosc.pyx":211 + /* "numcodecs/blosc.pyx":208 * memcpyed = flags & BLOSC_MEMCPYED - * + * * return typesize, shuffle, memcpyed # <<<<<<<<<<<<<< - * - * + * + * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_typesize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_typesize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_memcpyed); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 211, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_memcpyed); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 211, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); @@ -2811,9 +2870,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_16cbuffer_metainfo(CYTHON_UNUSED PyO __pyx_t_4 = 0; goto __pyx_L0; - /* "numcodecs/blosc.pyx":176 - * - * + /* "numcodecs/blosc.pyx":173 + * + * * def cbuffer_metainfo(source): # <<<<<<<<<<<<<< * """Return some meta-information about the compressed buffer in `source`, including * the typesize, whether the shuffle or bit-shuffle filters were used, and the @@ -2834,9 +2893,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_16cbuffer_metainfo(CYTHON_UNUSED PyO return __pyx_r; } -/* "numcodecs/blosc.pyx":214 - * - * +/* "numcodecs/blosc.pyx":211 + * + * * def err_bad_cname(cname): # <<<<<<<<<<<<<< * raise ValueError('bad compressor or compressor not supported: %r; expected one of ' * '%s' % (cname, list_compressors())) @@ -2865,14 +2924,14 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_18err_bad_cname(CYTHON_UNUSED PyObje PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("err_bad_cname", 0); - /* "numcodecs/blosc.pyx":216 + /* "numcodecs/blosc.pyx":213 * def err_bad_cname(cname): * raise ValueError('bad compressor or compressor not supported: %r; expected one of ' * '%s' % (cname, list_compressors())) # <<<<<<<<<<<<<< - * - * + * + * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_list_compressors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_list_compressors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { @@ -2884,12 +2943,15 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_18err_bad_cname(CYTHON_UNUSED PyObje __Pyx_DECREF_SET(__pyx_t_2, function); } } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error) + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error) + } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_cname); __Pyx_GIVEREF(__pyx_v_cname); @@ -2897,27 +2959,27 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_18err_bad_cname(CYTHON_UNUSED PyObje __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_bad_compressor_or_compressor_not, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_bad_compressor_or_compressor_not, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":215 - * + /* "numcodecs/blosc.pyx":212 + * * def err_bad_cname(cname): * raise ValueError('bad compressor or compressor not supported: %r; expected one of ' # <<<<<<<<<<<<<< * '%s' % (cname, list_compressors())) - * + * */ - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 215, __pyx_L1_error) + __PYX_ERR(0, 212, __pyx_L1_error) - /* "numcodecs/blosc.pyx":214 - * - * + /* "numcodecs/blosc.pyx":211 + * + * * def err_bad_cname(cname): # <<<<<<<<<<<<<< * raise ValueError('bad compressor or compressor not supported: %r; expected one of ' * '%s' % (cname, list_compressors())) @@ -2935,9 +2997,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_18err_bad_cname(CYTHON_UNUSED PyObje return __pyx_r; } -/* "numcodecs/blosc.pyx":219 - * - * +/* "numcodecs/blosc.pyx":216 + * + * * def compress(source, char* cname, int clevel, int shuffle=SHUFFLE, # <<<<<<<<<<<<<< * int blocksize=AUTOBLOCKS): * """Compress data. @@ -2946,7 +3008,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_18err_bad_cname(CYTHON_UNUSED PyObje /* Python wrapper */ static PyObject *__pyx_pw_9numcodecs_5blosc_21compress(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_9numcodecs_5blosc_20compress[] = "compress(source, char *cname, int clevel, int shuffle=SHUFFLE, int blocksize=AUTOBLOCKS)\nCompress data.\n\n Parameters\n ----------\n source : bytes-like\n Data to be compressed. Can be any object supporting the buffer\n protocol.\n cname : bytes\n Name of compression library to use.\n clevel : int\n Compression level.\n shuffle : int\n Either NOSHUFFLE (0), SHUFFLE (1), BITSHUFFLE (2) or AUTOSHUFFLE (-1). If -1\n (default), bit-shuffle will be used for buffers with itemsize 1,\n and byte-shuffle will be used otherwise.\n blocksize : int\n The requested size of the compressed blocks. If 0, an automatic blocksize will\n be used.\n\n Returns\n -------\n dest : bytes\n Compressed data.\n\n "; -static PyMethodDef __pyx_mdef_9numcodecs_5blosc_21compress = {"compress", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9numcodecs_5blosc_21compress, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9numcodecs_5blosc_20compress}; +static PyMethodDef __pyx_mdef_9numcodecs_5blosc_21compress = {"compress", (PyCFunction)__pyx_pw_9numcodecs_5blosc_21compress, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9numcodecs_5blosc_20compress}; static PyObject *__pyx_pw_9numcodecs_5blosc_21compress(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_source = 0; char *__pyx_v_cname; @@ -2985,13 +3047,13 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_21compress(PyObject *__pyx_self, PyO case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cname)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("compress", 0, 3, 5, 1); __PYX_ERR(0, 219, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("compress", 0, 3, 5, 1); __PYX_ERR(0, 216, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clevel)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("compress", 0, 3, 5, 2); __PYX_ERR(0, 219, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("compress", 0, 3, 5, 2); __PYX_ERR(0, 216, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: @@ -3007,7 +3069,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_21compress(PyObject *__pyx_self, PyO } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "compress") < 0)) __PYX_ERR(0, 219, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "compress") < 0)) __PYX_ERR(0, 216, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3023,22 +3085,22 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_21compress(PyObject *__pyx_self, PyO } } __pyx_v_source = values[0]; - __pyx_v_cname = __Pyx_PyObject_AsWritableString(values[1]); if (unlikely((!__pyx_v_cname) && PyErr_Occurred())) __PYX_ERR(0, 219, __pyx_L3_error) - __pyx_v_clevel = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_clevel == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 219, __pyx_L3_error) + __pyx_v_cname = __Pyx_PyObject_AsWritableString(values[1]); if (unlikely((!__pyx_v_cname) && PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L3_error) + __pyx_v_clevel = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_clevel == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L3_error) if (values[3]) { - __pyx_v_shuffle = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_shuffle == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 219, __pyx_L3_error) + __pyx_v_shuffle = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_shuffle == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L3_error) } else { - __pyx_v_shuffle = __pyx_k__2; + __pyx_v_shuffle = __pyx_k__6; } if (values[4]) { - __pyx_v_blocksize = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_blocksize == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L3_error) + __pyx_v_blocksize = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_blocksize == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 217, __pyx_L3_error) } else { - __pyx_v_blocksize = __pyx_k__3; + __pyx_v_blocksize = __pyx_k__7; } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("compress", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 219, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("compress", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 216, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.blosc.compress", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3056,8 +3118,8 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ char *__pyx_v_dest_ptr; struct __pyx_obj_9numcodecs_10compat_ext_Buffer *__pyx_v_source_buffer = 0; size_t __pyx_v_nbytes; - size_t __pyx_v_cbytes; size_t __pyx_v_itemsize; + int __pyx_v_cbytes; PyObject *__pyx_v_dest = 0; PyObject *__pyx_v_cname_str = NULL; int __pyx_v_compressor_set; @@ -3068,10 +3130,10 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; - char *__pyx_t_6; - size_t __pyx_t_7; - int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_6 = NULL; + char *__pyx_t_7; + size_t __pyx_t_8; + int __pyx_t_9; PyObject *__pyx_t_10 = NULL; PyObject *__pyx_t_11 = NULL; PyObject *__pyx_t_12 = NULL; @@ -3082,33 +3144,33 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ PyObject *__pyx_t_17 = NULL; __Pyx_RefNannySetupContext("compress", 0); - /* "numcodecs/blosc.pyx":255 - * + /* "numcodecs/blosc.pyx":253 + * * # check valid cname early * if PY2: # <<<<<<<<<<<<<< * cname_str = cname * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PY2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 255, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_PY2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 255, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 253, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "numcodecs/blosc.pyx":256 + /* "numcodecs/blosc.pyx":254 * # check valid cname early * if PY2: * cname_str = cname # <<<<<<<<<<<<<< * else: * cname_str = cname.decode('ascii') */ - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_cname); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_cname); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_cname_str = __pyx_t_1; __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":255 - * + /* "numcodecs/blosc.pyx":253 + * * # check valid cname early * if PY2: # <<<<<<<<<<<<<< * cname_str = cname @@ -3117,7 +3179,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ goto __pyx_L3; } - /* "numcodecs/blosc.pyx":258 + /* "numcodecs/blosc.pyx":256 * cname_str = cname * else: * cname_str = cname.decode('ascii') # <<<<<<<<<<<<<< @@ -3125,21 +3187,21 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ * err_bad_cname(cname_str) */ /*else*/ { - __pyx_t_1 = __Pyx_decode_c_string(__pyx_v_cname, 0, strlen(__pyx_v_cname), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error) + __pyx_t_1 = __Pyx_decode_c_string(__pyx_v_cname, 0, strlen(__pyx_v_cname), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_cname_str = __pyx_t_1; __pyx_t_1 = 0; } __pyx_L3:; - /* "numcodecs/blosc.pyx":259 + /* "numcodecs/blosc.pyx":257 * else: * cname_str = cname.decode('ascii') * if cname_str not in list_compressors(): # <<<<<<<<<<<<<< * err_bad_cname(cname_str) - * + * */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_list_compressors); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 259, __pyx_L1_error) + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_list_compressors); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { @@ -3151,24 +3213,27 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L1_error) + if (__pyx_t_4) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error) + } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_cname_str, __pyx_t_1, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 259, __pyx_L1_error) + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_cname_str, __pyx_t_1, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 257, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = (__pyx_t_2 != 0); if (__pyx_t_5) { - /* "numcodecs/blosc.pyx":260 + /* "numcodecs/blosc.pyx":258 * cname_str = cname.decode('ascii') * if cname_str not in list_compressors(): * err_bad_cname(cname_str) # <<<<<<<<<<<<<< - * + * * # setup source buffer */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_err_bad_cname); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 260, __pyx_L1_error) + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_err_bad_cname); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { @@ -3180,32 +3245,60 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_cname_str) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_cname_str); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + if (!__pyx_t_4) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_cname_str); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_cname_str}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_cname_str}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + { + __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 258, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; + __Pyx_INCREF(__pyx_v_cname_str); + __Pyx_GIVEREF(__pyx_v_cname_str); + PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_cname_str); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":259 + /* "numcodecs/blosc.pyx":257 * else: * cname_str = cname.decode('ascii') * if cname_str not in list_compressors(): # <<<<<<<<<<<<<< * err_bad_cname(cname_str) - * + * */ } - /* "numcodecs/blosc.pyx":263 - * + /* "numcodecs/blosc.pyx":261 + * * # setup source buffer * source_buffer = Buffer(source, PyBUF_ANY_CONTIGUOUS) # <<<<<<<<<<<<<< * source_ptr = source_buffer.ptr * nbytes = source_buffer.nbytes */ - __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 263, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 261, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 263, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 261, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_source); __Pyx_GIVEREF(__pyx_v_source); @@ -3213,61 +3306,61 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __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(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 263, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 261, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_source_buffer = ((struct __pyx_obj_9numcodecs_10compat_ext_Buffer *)__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":264 + /* "numcodecs/blosc.pyx":262 * # setup source buffer * source_buffer = Buffer(source, PyBUF_ANY_CONTIGUOUS) * source_ptr = source_buffer.ptr # <<<<<<<<<<<<<< * nbytes = source_buffer.nbytes * itemsize = source_buffer.itemsize */ - __pyx_t_6 = __pyx_v_source_buffer->ptr; - __pyx_v_source_ptr = __pyx_t_6; + __pyx_t_7 = __pyx_v_source_buffer->ptr; + __pyx_v_source_ptr = __pyx_t_7; - /* "numcodecs/blosc.pyx":265 + /* "numcodecs/blosc.pyx":263 * source_buffer = Buffer(source, PyBUF_ANY_CONTIGUOUS) * source_ptr = source_buffer.ptr * nbytes = source_buffer.nbytes # <<<<<<<<<<<<<< * itemsize = source_buffer.itemsize - * + * */ - __pyx_t_7 = __pyx_v_source_buffer->nbytes; - __pyx_v_nbytes = __pyx_t_7; + __pyx_t_8 = __pyx_v_source_buffer->nbytes; + __pyx_v_nbytes = __pyx_t_8; - /* "numcodecs/blosc.pyx":266 + /* "numcodecs/blosc.pyx":264 * source_ptr = source_buffer.ptr * nbytes = source_buffer.nbytes * itemsize = source_buffer.itemsize # <<<<<<<<<<<<<< - * + * * # determine shuffle */ - __pyx_t_7 = __pyx_v_source_buffer->itemsize; - __pyx_v_itemsize = __pyx_t_7; + __pyx_t_8 = __pyx_v_source_buffer->itemsize; + __pyx_v_itemsize = __pyx_t_8; - /* "numcodecs/blosc.pyx":269 - * + /* "numcodecs/blosc.pyx":267 + * * # determine shuffle * if shuffle == AUTOSHUFFLE: # <<<<<<<<<<<<<< * if itemsize == 1: * shuffle = BITSHUFFLE */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_shuffle); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_shuffle); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_AUTOSHUFFLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 269, __pyx_L1_error) + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_AUTOSHUFFLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 267, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 269, __pyx_L1_error) + __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 267, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 269, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 267, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_5) { - /* "numcodecs/blosc.pyx":270 + /* "numcodecs/blosc.pyx":268 * # determine shuffle * if shuffle == AUTOSHUFFLE: * if itemsize == 1: # <<<<<<<<<<<<<< @@ -3277,20 +3370,20 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __pyx_t_5 = ((__pyx_v_itemsize == 1) != 0); if (__pyx_t_5) { - /* "numcodecs/blosc.pyx":271 + /* "numcodecs/blosc.pyx":269 * if shuffle == AUTOSHUFFLE: * if itemsize == 1: * shuffle = BITSHUFFLE # <<<<<<<<<<<<<< * else: * shuffle = SHUFFLE */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_BITSHUFFLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 271, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 271, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_shuffle = __pyx_t_8; + __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_BITSHUFFLE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 269, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 269, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_shuffle = __pyx_t_9; - /* "numcodecs/blosc.pyx":270 + /* "numcodecs/blosc.pyx":268 * # determine shuffle * if shuffle == AUTOSHUFFLE: * if itemsize == 1: # <<<<<<<<<<<<<< @@ -3300,7 +3393,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ goto __pyx_L6; } - /* "numcodecs/blosc.pyx":273 + /* "numcodecs/blosc.pyx":271 * shuffle = BITSHUFFLE * else: * shuffle = SHUFFLE # <<<<<<<<<<<<<< @@ -3308,16 +3401,16 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ * raise ValueError('invalid shuffle argument; expected -1, 0, 1 or 2, found %r' % */ /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_SHUFFLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 273, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 273, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_shuffle = __pyx_t_8; + __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_SHUFFLE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 271, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_shuffle = __pyx_t_9; } __pyx_L6:; - /* "numcodecs/blosc.pyx":269 - * + /* "numcodecs/blosc.pyx":267 + * * # determine shuffle * if shuffle == AUTOSHUFFLE: # <<<<<<<<<<<<<< * if itemsize == 1: @@ -3326,84 +3419,84 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ goto __pyx_L5; } - /* "numcodecs/blosc.pyx":274 + /* "numcodecs/blosc.pyx":272 * else: * shuffle = SHUFFLE * elif shuffle not in [NOSHUFFLE, SHUFFLE, BITSHUFFLE]: # <<<<<<<<<<<<<< * raise ValueError('invalid shuffle argument; expected -1, 0, 1 or 2, found %r' % * shuffle) */ - __pyx_t_8 = __pyx_v_shuffle; - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 274, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_NOSHUFFLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 274, __pyx_L1_error) + __pyx_t_9 = __pyx_v_shuffle; + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 272, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_NOSHUFFLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 272, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_t_6, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 272, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 274, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 272, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { } else { __pyx_t_5 = __pyx_t_2; goto __pyx_L7_bool_binop_done; } - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 272, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_SHUFFLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 274, __pyx_L1_error) + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_SHUFFLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 272, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 274, __pyx_L1_error) + __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 272, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 274, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 272, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_2) { } else { __pyx_t_5 = __pyx_t_2; goto __pyx_L7_bool_binop_done; } - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 274, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_BITSHUFFLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 274, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 272, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_BITSHUFFLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 272, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_t_6, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 272, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 274, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 272, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = __pyx_t_2; __pyx_L7_bool_binop_done:; __pyx_t_2 = (__pyx_t_5 != 0); if (unlikely(__pyx_t_2)) { - /* "numcodecs/blosc.pyx":276 + /* "numcodecs/blosc.pyx":274 * elif shuffle not in [NOSHUFFLE, SHUFFLE, BITSHUFFLE]: * raise ValueError('invalid shuffle argument; expected -1, 0, 1 or 2, found %r' % * shuffle) # <<<<<<<<<<<<<< - * + * * try: */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_shuffle); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 276, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_shuffle); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - /* "numcodecs/blosc.pyx":275 + /* "numcodecs/blosc.pyx":273 * shuffle = SHUFFLE * elif shuffle not in [NOSHUFFLE, SHUFFLE, BITSHUFFLE]: * raise ValueError('invalid shuffle argument; expected -1, 0, 1 or 2, found %r' % # <<<<<<<<<<<<<< * shuffle) - * + * */ - __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_invalid_shuffle_argument_expecte, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 275, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_invalid_shuffle_argument_expecte, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 273, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 275, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 273, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 275, __pyx_L1_error) + __PYX_ERR(0, 273, __pyx_L1_error) - /* "numcodecs/blosc.pyx":274 + /* "numcodecs/blosc.pyx":272 * else: * shuffle = SHUFFLE * elif shuffle not in [NOSHUFFLE, SHUFFLE, BITSHUFFLE]: # <<<<<<<<<<<<<< @@ -3413,93 +3506,99 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ } __pyx_L5:; - /* "numcodecs/blosc.pyx":278 + /* "numcodecs/blosc.pyx":276 * shuffle) - * + * * try: # <<<<<<<<<<<<<< - * + * * # setup destination */ /*try:*/ { - /* "numcodecs/blosc.pyx":281 - * + /* "numcodecs/blosc.pyx":279 + * * # setup destination * dest = PyBytes_FromStringAndSize(NULL, nbytes + BLOSC_MAX_OVERHEAD) # <<<<<<<<<<<<<< * dest_ptr = PyBytes_AS_STRING(dest) - * + * */ - __pyx_t_1 = PyBytes_FromStringAndSize(NULL, (__pyx_v_nbytes + BLOSC_MAX_OVERHEAD)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 281, __pyx_L11_error) + __pyx_t_1 = PyBytes_FromStringAndSize(NULL, (__pyx_v_nbytes + BLOSC_MAX_OVERHEAD)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 279, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_dest = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":282 + /* "numcodecs/blosc.pyx":280 * # setup destination * dest = PyBytes_FromStringAndSize(NULL, nbytes + BLOSC_MAX_OVERHEAD) * dest_ptr = PyBytes_AS_STRING(dest) # <<<<<<<<<<<<<< - * + * * # perform compression */ __pyx_v_dest_ptr = PyBytes_AS_STRING(__pyx_v_dest); - /* "numcodecs/blosc.pyx":285 - * + /* "numcodecs/blosc.pyx":283 + * * # perform compression * if _get_use_threads(): # <<<<<<<<<<<<<< * # allow blosc to use threads internally - * + * */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_get_use_threads); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 285, __pyx_L11_error) + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_use_threads); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 283, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; + __pyx_t_6 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 285, __pyx_L11_error) + if (__pyx_t_6) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 283, __pyx_L11_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 283, __pyx_L11_error) + } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 285, __pyx_L11_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 283, __pyx_L11_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "numcodecs/blosc.pyx":291 + /* "numcodecs/blosc.pyx":289 * # to ensure no-one else can modify the global context while we're setting it * # up and using it. * with mutex: # <<<<<<<<<<<<<< - * + * * # set compressor */ /*with:*/ { - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_mutex); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 291, __pyx_L11_error) + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_mutex); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 289, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 291, __pyx_L11_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 291, __pyx_L14_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_10); + __pyx_t_10 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 289, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 289, __pyx_L14_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); + __Pyx_DECREF_SET(__pyx_t_6, function); } } - __pyx_t_3 = (__pyx_t_10) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_10) : __Pyx_PyObject_CallNoArg(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 291, __pyx_L14_error) + if (__pyx_t_4) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 289, __pyx_L14_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 289, __pyx_L14_error) + } __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*try:*/ { @@ -3512,8 +3611,8 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __Pyx_XGOTREF(__pyx_t_13); /*try:*/ { - /* "numcodecs/blosc.pyx":294 - * + /* "numcodecs/blosc.pyx":292 + * * # set compressor * compressor_set = blosc_set_compressor(cname) # <<<<<<<<<<<<<< * if compressor_set < 0: @@ -3521,7 +3620,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ */ __pyx_v_compressor_set = blosc_set_compressor(__pyx_v_cname); - /* "numcodecs/blosc.pyx":295 + /* "numcodecs/blosc.pyx":293 * # set compressor * compressor_set = blosc_set_compressor(cname) * if compressor_set < 0: # <<<<<<<<<<<<<< @@ -3531,33 +3630,61 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __pyx_t_2 = ((__pyx_v_compressor_set < 0) != 0); if (__pyx_t_2) { - /* "numcodecs/blosc.pyx":298 + /* "numcodecs/blosc.pyx":296 * # shouldn't happen if we checked against list of compressors * # already, but just in case * err_bad_cname(cname_str) # <<<<<<<<<<<<<< - * + * * # set blocksize */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_err_bad_cname); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 298, __pyx_L18_error) + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_err_bad_cname); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 296, __pyx_L18_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; + __pyx_t_6 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_cname_str) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_cname_str); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 298, __pyx_L18_error) - __Pyx_GOTREF(__pyx_t_1); + if (!__pyx_t_6) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_cname_str); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 296, __pyx_L18_error) + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_cname_str}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 296, __pyx_L18_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_cname_str}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 296, __pyx_L18_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + { + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 296, __pyx_L18_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL; + __Pyx_INCREF(__pyx_v_cname_str); + __Pyx_GIVEREF(__pyx_v_cname_str); + PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_cname_str); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 296, __pyx_L18_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":295 + /* "numcodecs/blosc.pyx":293 * # set compressor * compressor_set = blosc_set_compressor(cname) * if compressor_set < 0: # <<<<<<<<<<<<<< @@ -3566,17 +3693,17 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ */ } - /* "numcodecs/blosc.pyx":301 - * + /* "numcodecs/blosc.pyx":299 + * * # set blocksize * blosc_set_blocksize(blocksize) # <<<<<<<<<<<<<< - * + * * # perform compression */ blosc_set_blocksize(__pyx_v_blocksize); - /* "numcodecs/blosc.pyx":304 - * + /* "numcodecs/blosc.pyx":302 + * * # perform compression * with nogil: # <<<<<<<<<<<<<< * cbytes = blosc_compress(clevel, shuffle, itemsize, nbytes, source_ptr, @@ -3590,18 +3717,18 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ #endif /*try:*/ { - /* "numcodecs/blosc.pyx":305 + /* "numcodecs/blosc.pyx":303 * # perform compression * with nogil: * cbytes = blosc_compress(clevel, shuffle, itemsize, nbytes, source_ptr, # <<<<<<<<<<<<<< * dest_ptr, nbytes + BLOSC_MAX_OVERHEAD) - * + * */ __pyx_v_cbytes = blosc_compress(__pyx_v_clevel, __pyx_v_shuffle, __pyx_v_itemsize, __pyx_v_nbytes, __pyx_v_source_ptr, __pyx_v_dest_ptr, (__pyx_v_nbytes + BLOSC_MAX_OVERHEAD)); } - /* "numcodecs/blosc.pyx":304 - * + /* "numcodecs/blosc.pyx":302 + * * # perform compression * with nogil: # <<<<<<<<<<<<<< * cbytes = blosc_compress(clevel, shuffle, itemsize, nbytes, source_ptr, @@ -3619,11 +3746,11 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ } } - /* "numcodecs/blosc.pyx":291 + /* "numcodecs/blosc.pyx":289 * # to ensure no-one else can modify the global context while we're setting it * # up and using it. * with mutex: # <<<<<<<<<<<<<< - * + * * # set compressor */ } @@ -3632,38 +3759,38 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; goto __pyx_L23_try_end; __pyx_L18_error:; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; /*except:*/ { __Pyx_AddTraceback("numcodecs.blosc.compress", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 291, __pyx_L20_except_error) + if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 289, __pyx_L20_except_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 291, __pyx_L20_except_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_10, NULL); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_6 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 289, __pyx_L20_except_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_6, NULL); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 291, __pyx_L20_except_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 289, __pyx_L20_except_error) __Pyx_GOTREF(__pyx_t_14); __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_14); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (__pyx_t_2 < 0) __PYX_ERR(0, 291, __pyx_L20_except_error) + if (__pyx_t_2 < 0) __PYX_ERR(0, 289, __pyx_L20_except_error) __pyx_t_5 = ((!(__pyx_t_2 != 0)) != 0); if (__pyx_t_5) { __Pyx_GIVEREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_3); __Pyx_XGIVEREF(__pyx_t_4); __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_3, __pyx_t_4); - __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; - __PYX_ERR(0, 291, __pyx_L20_except_error) + __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; + __PYX_ERR(0, 289, __pyx_L20_except_error) } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L19_exception_handled; } __pyx_L20_except_error:; @@ -3682,10 +3809,10 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ } /*finally:*/ { /*normal exit:*/{ - if (__pyx_t_9) { - __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_tuple__4, NULL); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 291, __pyx_L11_error) + if (__pyx_t_10) { + __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__8, NULL); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 289, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; } @@ -3695,23 +3822,23 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ } goto __pyx_L31; __pyx_L14_error:; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; goto __pyx_L11_error; __pyx_L31:; } - /* "numcodecs/blosc.pyx":285 - * + /* "numcodecs/blosc.pyx":283 + * * # perform compression * if _get_use_threads(): # <<<<<<<<<<<<<< * # allow blosc to use threads internally - * + * */ goto __pyx_L13; } - /* "numcodecs/blosc.pyx":309 - * + /* "numcodecs/blosc.pyx":307 + * * else: * with nogil: # <<<<<<<<<<<<<< * cbytes = blosc_compress_ctx(clevel, shuffle, itemsize, nbytes, source_ptr, @@ -3726,7 +3853,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ #endif /*try:*/ { - /* "numcodecs/blosc.pyx":310 + /* "numcodecs/blosc.pyx":308 * else: * with nogil: * cbytes = blosc_compress_ctx(clevel, shuffle, itemsize, nbytes, source_ptr, # <<<<<<<<<<<<<< @@ -3736,8 +3863,8 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __pyx_v_cbytes = blosc_compress_ctx(__pyx_v_clevel, __pyx_v_shuffle, __pyx_v_itemsize, __pyx_v_nbytes, __pyx_v_source_ptr, __pyx_v_dest_ptr, (__pyx_v_nbytes + BLOSC_MAX_OVERHEAD), __pyx_v_cname, __pyx_v_blocksize, 1); } - /* "numcodecs/blosc.pyx":309 - * + /* "numcodecs/blosc.pyx":307 + * * else: * with nogil: # <<<<<<<<<<<<<< * cbytes = blosc_compress_ctx(clevel, shuffle, itemsize, nbytes, source_ptr, @@ -3758,16 +3885,16 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __pyx_L13:; } - /* "numcodecs/blosc.pyx":317 - * + /* "numcodecs/blosc.pyx":315 + * * # release buffers * source_buffer.release() # <<<<<<<<<<<<<< - * + * * # check compression was successful */ /*finally:*/ { /*normal exit:*/{ - __pyx_t_4 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 317, __pyx_L1_error) + __pyx_t_4 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 315, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L12; @@ -3776,22 +3903,22 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign - __pyx_t_9 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_14 = 0; __pyx_t_17 = 0; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_14 = 0; __pyx_t_17 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_14, &__pyx_t_17); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_13, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_13, &__pyx_t_12); - __Pyx_XGOTREF(__pyx_t_9); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_13, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_13, &__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_10); __Pyx_XGOTREF(__pyx_t_13); __Pyx_XGOTREF(__pyx_t_12); __Pyx_XGOTREF(__pyx_t_11); __Pyx_XGOTREF(__pyx_t_14); __Pyx_XGOTREF(__pyx_t_17); - __pyx_t_8 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_16 = __pyx_filename; + __pyx_t_9 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_16 = __pyx_filename; { - __pyx_t_4 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 317, __pyx_L36_error) + __pyx_t_4 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 315, __pyx_L36_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } @@ -3801,12 +3928,12 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __Pyx_XGIVEREF(__pyx_t_17); __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_14, __pyx_t_17); } - __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_10); __Pyx_XGIVEREF(__pyx_t_13); __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_ErrRestore(__pyx_t_9, __pyx_t_13, __pyx_t_12); - __pyx_t_9 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_14 = 0; __pyx_t_17 = 0; - __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_16; + __Pyx_ErrRestore(__pyx_t_10, __pyx_t_13, __pyx_t_12); + __pyx_t_10 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_14 = 0; __pyx_t_17 = 0; + __pyx_lineno = __pyx_t_9; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_16; goto __pyx_L1_error; __pyx_L36_error:; if (PY_MAJOR_VERSION >= 3) { @@ -3815,7 +3942,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __Pyx_XGIVEREF(__pyx_t_17); __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_14, __pyx_t_17); } - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_14 = 0; __pyx_t_17 = 0; @@ -3824,75 +3951,75 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __pyx_L12:; } - /* "numcodecs/blosc.pyx":320 - * + /* "numcodecs/blosc.pyx":318 + * * # check compression was successful * if cbytes <= 0: # <<<<<<<<<<<<<< * raise RuntimeError('error during blosc compression: %d' % cbytes) - * + * */ __pyx_t_5 = ((__pyx_v_cbytes <= 0) != 0); if (unlikely(__pyx_t_5)) { - /* "numcodecs/blosc.pyx":321 + /* "numcodecs/blosc.pyx":319 * # check compression was successful * if cbytes <= 0: * raise RuntimeError('error during blosc compression: %d' % cbytes) # <<<<<<<<<<<<<< - * + * * # resize after compression */ - __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_cbytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 321, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_cbytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 319, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_error_during_blosc_compression_d, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 321, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_error_during_blosc_compression_d, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 319, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 321, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 319, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 321, __pyx_L1_error) + __PYX_ERR(0, 319, __pyx_L1_error) - /* "numcodecs/blosc.pyx":320 - * + /* "numcodecs/blosc.pyx":318 + * * # check compression was successful * if cbytes <= 0: # <<<<<<<<<<<<<< * raise RuntimeError('error during blosc compression: %d' % cbytes) - * + * */ } - /* "numcodecs/blosc.pyx":324 - * + /* "numcodecs/blosc.pyx":322 + * * # resize after compression * dest = dest[:cbytes] # <<<<<<<<<<<<<< - * + * * return dest */ if (unlikely(__pyx_v_dest == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 324, __pyx_L1_error) + __PYX_ERR(0, 322, __pyx_L1_error) } - __pyx_t_4 = PySequence_GetSlice(__pyx_v_dest, 0, __pyx_v_cbytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 324, __pyx_L1_error) + __pyx_t_4 = PySequence_GetSlice(__pyx_v_dest, 0, __pyx_v_cbytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 322, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF_SET(__pyx_v_dest, ((PyObject*)__pyx_t_4)); __pyx_t_4 = 0; - /* "numcodecs/blosc.pyx":326 + /* "numcodecs/blosc.pyx":324 * dest = dest[:cbytes] - * + * * return dest # <<<<<<<<<<<<<< - * - * + * + * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_dest); __pyx_r = __pyx_v_dest; goto __pyx_L0; - /* "numcodecs/blosc.pyx":219 - * - * + /* "numcodecs/blosc.pyx":216 + * + * * def compress(source, char* cname, int clevel, int shuffle=SHUFFLE, # <<<<<<<<<<<<<< * int blocksize=AUTOBLOCKS): * """Compress data. @@ -3903,7 +4030,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("numcodecs.blosc.compress", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -3915,18 +4042,18 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ return __pyx_r; } -/* "numcodecs/blosc.pyx":329 - * - * +/* "numcodecs/blosc.pyx":327 + * + * * def decompress(source, dest=None): # <<<<<<<<<<<<<< * """Decompress data. - * + * */ /* Python wrapper */ static PyObject *__pyx_pw_9numcodecs_5blosc_23decompress(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_9numcodecs_5blosc_22decompress[] = "decompress(source, dest=None)\nDecompress data.\n\n Parameters\n ----------\n source : bytes-like\n Compressed data, including blosc header. Can be any object supporting the buffer\n protocol.\n dest : array-like, optional\n Object to decompress into.\n\n Returns\n -------\n dest : bytes\n Object containing decompressed data.\n\n "; -static PyMethodDef __pyx_mdef_9numcodecs_5blosc_23decompress = {"decompress", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9numcodecs_5blosc_23decompress, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9numcodecs_5blosc_22decompress}; +static PyMethodDef __pyx_mdef_9numcodecs_5blosc_23decompress = {"decompress", (PyCFunction)__pyx_pw_9numcodecs_5blosc_23decompress, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9numcodecs_5blosc_22decompress}; static PyObject *__pyx_pw_9numcodecs_5blosc_23decompress(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_source = 0; PyObject *__pyx_v_dest = 0; @@ -3961,7 +4088,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_23decompress(PyObject *__pyx_self, P } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decompress") < 0)) __PYX_ERR(0, 329, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decompress") < 0)) __PYX_ERR(0, 327, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3977,7 +4104,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_23decompress(PyObject *__pyx_self, P } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("decompress", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 329, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decompress", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 327, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.blosc.decompress", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -4021,26 +4148,26 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __Pyx_RefNannySetupContext("decompress", 0); __Pyx_INCREF(__pyx_v_dest); - /* "numcodecs/blosc.pyx":351 + /* "numcodecs/blosc.pyx":349 * char *dest_ptr * Buffer source_buffer * Buffer dest_buffer = None # <<<<<<<<<<<<<< * size_t nbytes, cbytes, blocksize - * + * */ __Pyx_INCREF(Py_None); __pyx_v_dest_buffer = ((struct __pyx_obj_9numcodecs_10compat_ext_Buffer *)Py_None); - /* "numcodecs/blosc.pyx":355 - * + /* "numcodecs/blosc.pyx":353 + * * # setup source buffer * source_buffer = Buffer(source, PyBUF_ANY_CONTIGUOUS) # <<<<<<<<<<<<<< * source_ptr = source_buffer.ptr - * + * */ - __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 355, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 353, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_source); __Pyx_GIVEREF(__pyx_v_source); @@ -4048,33 +4175,33 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_source_buffer = ((struct __pyx_obj_9numcodecs_10compat_ext_Buffer *)__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":356 + /* "numcodecs/blosc.pyx":354 * # setup source buffer * source_buffer = Buffer(source, PyBUF_ANY_CONTIGUOUS) * source_ptr = source_buffer.ptr # <<<<<<<<<<<<<< - * + * * # determine buffer size */ __pyx_t_3 = __pyx_v_source_buffer->ptr; __pyx_v_source_ptr = __pyx_t_3; - /* "numcodecs/blosc.pyx":359 - * + /* "numcodecs/blosc.pyx":357 + * * # determine buffer size * blosc_cbuffer_sizes(source_ptr, &nbytes, &cbytes, &blocksize) # <<<<<<<<<<<<<< - * + * * # setup destination buffer */ blosc_cbuffer_sizes(__pyx_v_source_ptr, (&__pyx_v_nbytes), (&__pyx_v_cbytes), (&__pyx_v_blocksize)); - /* "numcodecs/blosc.pyx":362 - * + /* "numcodecs/blosc.pyx":360 + * * # setup destination buffer * if dest is None: # <<<<<<<<<<<<<< * # allocate memory @@ -4084,19 +4211,19 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_t_5 = (__pyx_t_4 != 0); if (__pyx_t_5) { - /* "numcodecs/blosc.pyx":364 + /* "numcodecs/blosc.pyx":362 * if dest is None: * # allocate memory * dest = PyBytes_FromStringAndSize(NULL, nbytes) # <<<<<<<<<<<<<< * dest_ptr = PyBytes_AS_STRING(dest) * dest_nbytes = nbytes */ - __pyx_t_1 = PyBytes_FromStringAndSize(NULL, __pyx_v_nbytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error) + __pyx_t_1 = PyBytes_FromStringAndSize(NULL, __pyx_v_nbytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 362, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF_SET(__pyx_v_dest, __pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":365 + /* "numcodecs/blosc.pyx":363 * # allocate memory * dest = PyBytes_FromStringAndSize(NULL, nbytes) * dest_ptr = PyBytes_AS_STRING(dest) # <<<<<<<<<<<<<< @@ -4105,7 +4232,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject */ __pyx_v_dest_ptr = PyBytes_AS_STRING(__pyx_v_dest); - /* "numcodecs/blosc.pyx":366 + /* "numcodecs/blosc.pyx":364 * dest = PyBytes_FromStringAndSize(NULL, nbytes) * dest_ptr = PyBytes_AS_STRING(dest) * dest_nbytes = nbytes # <<<<<<<<<<<<<< @@ -4114,8 +4241,8 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject */ __pyx_v_dest_nbytes = __pyx_v_nbytes; - /* "numcodecs/blosc.pyx":362 - * + /* "numcodecs/blosc.pyx":360 + * * # setup destination buffer * if dest is None: # <<<<<<<<<<<<<< * # allocate memory @@ -4124,7 +4251,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject goto __pyx_L3; } - /* "numcodecs/blosc.pyx":368 + /* "numcodecs/blosc.pyx":366 * dest_nbytes = nbytes * else: * dest_buffer = Buffer(dest, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) # <<<<<<<<<<<<<< @@ -4132,9 +4259,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject * dest_nbytes = dest_buffer.nbytes */ /*else*/ { - __pyx_t_1 = __Pyx_PyInt_From_int((PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int((PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 368, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_dest); __Pyx_GIVEREF(__pyx_v_dest); @@ -4142,27 +4269,27 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF_SET(__pyx_v_dest_buffer, ((struct __pyx_obj_9numcodecs_10compat_ext_Buffer *)__pyx_t_1)); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":369 + /* "numcodecs/blosc.pyx":367 * else: * dest_buffer = Buffer(dest, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) * dest_ptr = dest_buffer.ptr # <<<<<<<<<<<<<< * dest_nbytes = dest_buffer.nbytes - * + * */ __pyx_t_3 = __pyx_v_dest_buffer->ptr; __pyx_v_dest_ptr = __pyx_t_3; - /* "numcodecs/blosc.pyx":370 + /* "numcodecs/blosc.pyx":368 * dest_buffer = Buffer(dest, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) * dest_ptr = dest_buffer.ptr * dest_nbytes = dest_buffer.nbytes # <<<<<<<<<<<<<< - * + * * try: */ __pyx_t_6 = __pyx_v_dest_buffer->nbytes; @@ -4170,17 +4297,17 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject } __pyx_L3:; - /* "numcodecs/blosc.pyx":372 + /* "numcodecs/blosc.pyx":370 * dest_nbytes = dest_buffer.nbytes - * + * * try: # <<<<<<<<<<<<<< - * + * * # guard condition */ /*try:*/ { - /* "numcodecs/blosc.pyx":375 - * + /* "numcodecs/blosc.pyx":373 + * * # guard condition * if dest_nbytes < nbytes: # <<<<<<<<<<<<<< * raise ValueError('destination buffer too small; expected at least %s, ' @@ -4189,18 +4316,18 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_t_5 = ((__pyx_v_dest_nbytes < __pyx_v_nbytes) != 0); if (unlikely(__pyx_t_5)) { - /* "numcodecs/blosc.pyx":377 + /* "numcodecs/blosc.pyx":375 * if dest_nbytes < nbytes: * raise ValueError('destination buffer too small; expected at least %s, ' * 'got %s' % (nbytes, dest_nbytes)) # <<<<<<<<<<<<<< - * + * * # perform decompression */ - __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_nbytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 377, __pyx_L5_error) + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_nbytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 375, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_dest_nbytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 377, __pyx_L5_error) + __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_dest_nbytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 375, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 377, __pyx_L5_error) + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 375, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); @@ -4208,26 +4335,26 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_destination_buffer_too_small_exp, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 377, __pyx_L5_error) + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_destination_buffer_too_small_exp, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 375, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/blosc.pyx":376 + /* "numcodecs/blosc.pyx":374 * # guard condition * if dest_nbytes < nbytes: * raise ValueError('destination buffer too small; expected at least %s, ' # <<<<<<<<<<<<<< * 'got %s' % (nbytes, dest_nbytes)) - * + * */ - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 376, __pyx_L5_error) + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 374, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_7, 0, 0, 0); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(0, 376, __pyx_L5_error) + __PYX_ERR(0, 374, __pyx_L5_error) - /* "numcodecs/blosc.pyx":375 - * + /* "numcodecs/blosc.pyx":373 + * * # guard condition * if dest_nbytes < nbytes: # <<<<<<<<<<<<<< * raise ValueError('destination buffer too small; expected at least %s, ' @@ -4235,14 +4362,14 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject */ } - /* "numcodecs/blosc.pyx":380 - * + /* "numcodecs/blosc.pyx":378 + * * # perform decompression * if _get_use_threads(): # <<<<<<<<<<<<<< * # allow blosc to use threads internally * with nogil: */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_use_threads); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 380, __pyx_L5_error) + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_use_threads); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 378, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { @@ -4254,16 +4381,19 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __Pyx_DECREF_SET(__pyx_t_2, function); } } - __pyx_t_7 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 380, __pyx_L5_error) + if (__pyx_t_1) { + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 378, __pyx_L5_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 378, __pyx_L5_error) + } __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 380, __pyx_L5_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 378, __pyx_L5_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_5) { - /* "numcodecs/blosc.pyx":382 + /* "numcodecs/blosc.pyx":380 * if _get_use_threads(): * # allow blosc to use threads internally * with nogil: # <<<<<<<<<<<<<< @@ -4278,7 +4408,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject #endif /*try:*/ { - /* "numcodecs/blosc.pyx":383 + /* "numcodecs/blosc.pyx":381 * # allow blosc to use threads internally * with nogil: * ret = blosc_decompress(source_ptr, dest_ptr, nbytes) # <<<<<<<<<<<<<< @@ -4288,7 +4418,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_v_ret = blosc_decompress(__pyx_v_source_ptr, __pyx_v_dest_ptr, __pyx_v_nbytes); } - /* "numcodecs/blosc.pyx":382 + /* "numcodecs/blosc.pyx":380 * if _get_use_threads(): * # allow blosc to use threads internally * with nogil: # <<<<<<<<<<<<<< @@ -4307,8 +4437,8 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject } } - /* "numcodecs/blosc.pyx":380 - * + /* "numcodecs/blosc.pyx":378 + * * # perform decompression * if _get_use_threads(): # <<<<<<<<<<<<<< * # allow blosc to use threads internally @@ -4317,12 +4447,12 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject goto __pyx_L8; } - /* "numcodecs/blosc.pyx":385 + /* "numcodecs/blosc.pyx":383 * ret = blosc_decompress(source_ptr, dest_ptr, nbytes) * else: * with nogil: # <<<<<<<<<<<<<< * ret = blosc_decompress_ctx(source_ptr, dest_ptr, nbytes, 1) - * + * */ /*else*/ { { @@ -4333,22 +4463,22 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject #endif /*try:*/ { - /* "numcodecs/blosc.pyx":386 + /* "numcodecs/blosc.pyx":384 * else: * with nogil: * ret = blosc_decompress_ctx(source_ptr, dest_ptr, nbytes, 1) # <<<<<<<<<<<<<< - * + * * finally: */ __pyx_v_ret = blosc_decompress_ctx(__pyx_v_source_ptr, __pyx_v_dest_ptr, __pyx_v_nbytes, 1); } - /* "numcodecs/blosc.pyx":385 + /* "numcodecs/blosc.pyx":383 * ret = blosc_decompress(source_ptr, dest_ptr, nbytes) * else: * with nogil: # <<<<<<<<<<<<<< * ret = blosc_decompress_ctx(source_ptr, dest_ptr, nbytes, 1) - * + * */ /*finally:*/ { /*normal exit:*/{ @@ -4365,8 +4495,8 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_L8:; } - /* "numcodecs/blosc.pyx":391 - * + /* "numcodecs/blosc.pyx":389 + * * # release buffers * source_buffer.release() # <<<<<<<<<<<<<< * if dest_buffer is not None: @@ -4374,38 +4504,38 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject */ /*finally:*/ { /*normal exit:*/{ - __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 391, __pyx_L1_error) + __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 389, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/blosc.pyx":392 + /* "numcodecs/blosc.pyx":390 * # release buffers * source_buffer.release() * if dest_buffer is not None: # <<<<<<<<<<<<<< * dest_buffer.release() - * + * */ __pyx_t_5 = (((PyObject *)__pyx_v_dest_buffer) != Py_None); __pyx_t_4 = (__pyx_t_5 != 0); if (__pyx_t_4) { - /* "numcodecs/blosc.pyx":393 + /* "numcodecs/blosc.pyx":391 * source_buffer.release() * if dest_buffer is not None: * dest_buffer.release() # <<<<<<<<<<<<<< - * + * * # handle errors */ - __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_dest_buffer->__pyx_vtab)->release(__pyx_v_dest_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 393, __pyx_L1_error) + __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_dest_buffer->__pyx_vtab)->release(__pyx_v_dest_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 391, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/blosc.pyx":392 + /* "numcodecs/blosc.pyx":390 * # release buffers * source_buffer.release() * if dest_buffer is not None: # <<<<<<<<<<<<<< * dest_buffer.release() - * + * */ } goto __pyx_L6; @@ -4429,45 +4559,45 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_t_8 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename; { - /* "numcodecs/blosc.pyx":391 - * + /* "numcodecs/blosc.pyx":389 + * * # release buffers * source_buffer.release() # <<<<<<<<<<<<<< * if dest_buffer is not None: * dest_buffer.release() */ - __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 391, __pyx_L17_error) + __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 389, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/blosc.pyx":392 + /* "numcodecs/blosc.pyx":390 * # release buffers * source_buffer.release() * if dest_buffer is not None: # <<<<<<<<<<<<<< * dest_buffer.release() - * + * */ __pyx_t_4 = (((PyObject *)__pyx_v_dest_buffer) != Py_None); __pyx_t_5 = (__pyx_t_4 != 0); if (__pyx_t_5) { - /* "numcodecs/blosc.pyx":393 + /* "numcodecs/blosc.pyx":391 * source_buffer.release() * if dest_buffer is not None: * dest_buffer.release() # <<<<<<<<<<<<<< - * + * * # handle errors */ - __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_dest_buffer->__pyx_vtab)->release(__pyx_v_dest_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 393, __pyx_L17_error) + __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_dest_buffer->__pyx_vtab)->release(__pyx_v_dest_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 391, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/blosc.pyx":392 + /* "numcodecs/blosc.pyx":390 * # release buffers * source_buffer.release() * if dest_buffer is not None: # <<<<<<<<<<<<<< * dest_buffer.release() - * + * */ } } @@ -4500,62 +4630,62 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_L6:; } - /* "numcodecs/blosc.pyx":396 - * + /* "numcodecs/blosc.pyx":394 + * * # handle errors * if ret <= 0: # <<<<<<<<<<<<<< * raise RuntimeError('error during blosc decompression: %d' % ret) - * + * */ __pyx_t_5 = ((__pyx_v_ret <= 0) != 0); if (unlikely(__pyx_t_5)) { - /* "numcodecs/blosc.pyx":397 + /* "numcodecs/blosc.pyx":395 * # handle errors * if ret <= 0: * raise RuntimeError('error during blosc decompression: %d' % ret) # <<<<<<<<<<<<<< - * + * * return dest */ - __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_ret); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 397, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_ret); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 395, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_error_during_blosc_decompression, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 397, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_error_during_blosc_decompression, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 395, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 397, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 395, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_7, 0, 0, 0); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(0, 397, __pyx_L1_error) + __PYX_ERR(0, 395, __pyx_L1_error) - /* "numcodecs/blosc.pyx":396 - * + /* "numcodecs/blosc.pyx":394 + * * # handle errors * if ret <= 0: # <<<<<<<<<<<<<< * raise RuntimeError('error during blosc decompression: %d' % ret) - * + * */ } - /* "numcodecs/blosc.pyx":399 + /* "numcodecs/blosc.pyx":397 * raise RuntimeError('error during blosc decompression: %d' % ret) - * + * * return dest # <<<<<<<<<<<<<< - * - * + * + * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_dest); __pyx_r = __pyx_v_dest; goto __pyx_L0; - /* "numcodecs/blosc.pyx":329 - * - * + /* "numcodecs/blosc.pyx":327 + * + * * def decompress(source, dest=None): # <<<<<<<<<<<<<< * """Decompress data. - * + * */ /* function exit code */ @@ -4574,9 +4704,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject return __pyx_r; } -/* "numcodecs/blosc.pyx":407 - * - * +/* "numcodecs/blosc.pyx":405 + * + * * def _get_use_threads(): # <<<<<<<<<<<<<< * global use_threads * proc = multiprocessing.current_process() @@ -4610,16 +4740,16 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("_get_use_threads", 0); - /* "numcodecs/blosc.pyx":409 + /* "numcodecs/blosc.pyx":407 * def _get_use_threads(): * global use_threads * proc = multiprocessing.current_process() # <<<<<<<<<<<<<< - * - * # check if locks are available, and if not no threads + * + * # check for fork */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_multiprocessing); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 409, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_multiprocessing); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 407, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_current_process); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 409, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_current_process); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 407, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; @@ -4632,72 +4762,40 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 409, __pyx_L1_error) + if (__pyx_t_2) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 407, __pyx_L1_error) + } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_proc = __pyx_t_1; __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":412 - * - * # check if locks are available, and if not no threads - * if not mutex: # <<<<<<<<<<<<<< - * return False - * - */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_mutex); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 412, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 412, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = ((!__pyx_t_4) != 0); - if (__pyx_t_5) { - - /* "numcodecs/blosc.pyx":413 - * # check if locks are available, and if not no threads - * if not mutex: - * return False # <<<<<<<<<<<<<< - * - * # check for fork - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_False); - __pyx_r = Py_False; - goto __pyx_L0; - - /* "numcodecs/blosc.pyx":412 - * - * # check if locks are available, and if not no threads - * if not mutex: # <<<<<<<<<<<<<< - * return False - * - */ - } - - /* "numcodecs/blosc.pyx":416 - * + /* "numcodecs/blosc.pyx":410 + * * # check for fork * if proc.pid != _importer_pid: # <<<<<<<<<<<<<< * # If this module has been imported in the parent process, and the current process * # is a fork, attempting to use blosc in multi-threaded mode will cause a */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_proc, __pyx_n_s_pid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 416, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_proc, __pyx_n_s_pid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_importer_pid); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 416, __pyx_L1_error) + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_importer_pid); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 416, __pyx_L1_error) + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 416, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_5) { + if (__pyx_t_4) { - /* "numcodecs/blosc.pyx":420 + /* "numcodecs/blosc.pyx":414 * # is a fork, attempting to use blosc in multi-threaded mode will cause a * # program hang, so we force use of blosc ctx functions, i.e., no threads. * return False # <<<<<<<<<<<<<< - * + * * if use_threads in [True, False]: */ __Pyx_XDECREF(__pyx_r); @@ -4705,8 +4803,8 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO __pyx_r = Py_False; goto __pyx_L0; - /* "numcodecs/blosc.pyx":416 - * + /* "numcodecs/blosc.pyx":410 + * * # check for fork * if proc.pid != _importer_pid: # <<<<<<<<<<<<<< * # If this module has been imported in the parent process, and the current process @@ -4714,70 +4812,70 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO */ } - /* "numcodecs/blosc.pyx":422 + /* "numcodecs/blosc.pyx":416 * return False - * + * * if use_threads in [True, False]: # <<<<<<<<<<<<<< * # user has manually overridden the default behaviour * _use_threads = use_threads */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_use_threads); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 422, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_use_threads); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 416, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, Py_True, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 422, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 422, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, Py_True, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 416, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 416, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_4) { + if (!__pyx_t_5) { } else { - __pyx_t_5 = __pyx_t_4; - goto __pyx_L6_bool_binop_done; + __pyx_t_4 = __pyx_t_5; + goto __pyx_L5_bool_binop_done; } - __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, Py_False, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 422, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 422, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, Py_False, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 416, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 416, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __pyx_t_4; - __pyx_L6_bool_binop_done:; + __pyx_t_4 = __pyx_t_5; + __pyx_L5_bool_binop_done:; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = (__pyx_t_5 != 0); - if (__pyx_t_4) { + __pyx_t_5 = (__pyx_t_4 != 0); + if (__pyx_t_5) { - /* "numcodecs/blosc.pyx":424 + /* "numcodecs/blosc.pyx":418 * if use_threads in [True, False]: * # user has manually overridden the default behaviour * _use_threads = use_threads # <<<<<<<<<<<<<< - * + * * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_use_threads); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 424, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_use_threads); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 418, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v__use_threads = __pyx_t_2; __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":422 + /* "numcodecs/blosc.pyx":416 * return False - * + * * if use_threads in [True, False]: # <<<<<<<<<<<<<< * # user has manually overridden the default behaviour * _use_threads = use_threads */ - goto __pyx_L5; + goto __pyx_L4; } - /* "numcodecs/blosc.pyx":433 + /* "numcodecs/blosc.pyx":427 * # program or multi-process program - * + * * if proc.name != 'MainProcess': # <<<<<<<<<<<<<< * _use_threads = False * elif hasattr(threading, 'main_thread'): */ /*else*/ { - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_proc, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 433, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_proc, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 427, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_MainProcess, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 433, __pyx_L1_error) + __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_MainProcess, Py_NE)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 427, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_4) { + if (__pyx_t_5) { - /* "numcodecs/blosc.pyx":434 - * + /* "numcodecs/blosc.pyx":428 + * * if proc.name != 'MainProcess': * _use_threads = False # <<<<<<<<<<<<<< * elif hasattr(threading, 'main_thread'): @@ -4786,40 +4884,40 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO __Pyx_INCREF(Py_False); __pyx_v__use_threads = Py_False; - /* "numcodecs/blosc.pyx":433 + /* "numcodecs/blosc.pyx":427 * # program or multi-process program - * + * * if proc.name != 'MainProcess': # <<<<<<<<<<<<<< * _use_threads = False * elif hasattr(threading, 'main_thread'): */ - goto __pyx_L8; + goto __pyx_L7; } - /* "numcodecs/blosc.pyx":435 + /* "numcodecs/blosc.pyx":429 * if proc.name != 'MainProcess': * _use_threads = False * elif hasattr(threading, 'main_thread'): # <<<<<<<<<<<<<< * _use_threads = (threading.main_thread() == threading.current_thread()) * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_threading); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 435, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_threading); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 429, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_HasAttr(__pyx_t_2, __pyx_n_s_main_thread); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 435, __pyx_L1_error) + __pyx_t_5 = __Pyx_HasAttr(__pyx_t_2, __pyx_n_s_main_thread); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 429, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = (__pyx_t_4 != 0); - if (__pyx_t_5) { + __pyx_t_4 = (__pyx_t_5 != 0); + if (__pyx_t_4) { - /* "numcodecs/blosc.pyx":436 + /* "numcodecs/blosc.pyx":430 * _use_threads = False * elif hasattr(threading, 'main_thread'): * _use_threads = (threading.main_thread() == threading.current_thread()) # <<<<<<<<<<<<<< * else: * _use_threads = threading.current_thread().name == 'MainThread' */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_threading); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 436, __pyx_L1_error) + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_threading); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 430, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_main_thread); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 436, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_main_thread); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 430, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; @@ -4832,14 +4930,17 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO __Pyx_DECREF_SET(__pyx_t_1, function); } } - __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 436, __pyx_L1_error) + if (__pyx_t_3) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 430, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 430, __pyx_L1_error) + } __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_threading); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 436, __pyx_L1_error) + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_threading); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 430, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_current_thread); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 436, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_current_thread); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 430, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; @@ -4852,38 +4953,41 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO __Pyx_DECREF_SET(__pyx_t_6, function); } } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 436, __pyx_L1_error) + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 430, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 430, __pyx_L1_error) + } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 436, __pyx_L1_error) + __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 430, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v__use_threads = __pyx_t_6; __pyx_t_6 = 0; - /* "numcodecs/blosc.pyx":435 + /* "numcodecs/blosc.pyx":429 * if proc.name != 'MainProcess': * _use_threads = False * elif hasattr(threading, 'main_thread'): # <<<<<<<<<<<<<< * _use_threads = (threading.main_thread() == threading.current_thread()) * else: */ - goto __pyx_L8; + goto __pyx_L7; } - /* "numcodecs/blosc.pyx":438 + /* "numcodecs/blosc.pyx":432 * _use_threads = (threading.main_thread() == threading.current_thread()) * else: * _use_threads = threading.current_thread().name == 'MainThread' # <<<<<<<<<<<<<< - * + * * return _use_threads */ /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_threading); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 438, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_threading); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 432, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_current_thread); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 438, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_current_thread); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 432, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; @@ -4896,38 +5000,41 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO __Pyx_DECREF_SET(__pyx_t_2, function); } } - __pyx_t_6 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 438, __pyx_L1_error) + if (__pyx_t_1) { + __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 432, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 432, __pyx_L1_error) + } __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 438, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 432, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_n_s_MainThread, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 438, __pyx_L1_error) + __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_n_s_MainThread, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 432, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v__use_threads = __pyx_t_6; __pyx_t_6 = 0; } - __pyx_L8:; + __pyx_L7:; } - __pyx_L5:; + __pyx_L4:; - /* "numcodecs/blosc.pyx":440 + /* "numcodecs/blosc.pyx":434 * _use_threads = threading.current_thread().name == 'MainThread' - * + * * return _use_threads # <<<<<<<<<<<<<< - * - * + * + * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v__use_threads); __pyx_r = __pyx_v__use_threads; goto __pyx_L0; - /* "numcodecs/blosc.pyx":407 - * - * + /* "numcodecs/blosc.pyx":405 + * + * * def _get_use_threads(): # <<<<<<<<<<<<<< * global use_threads * proc = multiprocessing.current_process() @@ -4949,9 +5056,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO return __pyx_r; } -/* "numcodecs/blosc.pyx":476 +/* "numcodecs/blosc.pyx":470 * AUTOSHUFFLE = AUTOSHUFFLE - * + * * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): # <<<<<<<<<<<<<< * self.cname = cname * if isinstance(cname, text_type): @@ -4964,7 +5071,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_26__defaults__(CYTHON_UNUSED PyObjec PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("__defaults__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 476, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 470, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject*)__pyx_n_s_lz4)); __Pyx_GIVEREF(((PyObject*)__pyx_n_s_lz4)); @@ -4978,7 +5085,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_26__defaults__(CYTHON_UNUSED PyObjec __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_blocksize); __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_blocksize); PyTuple_SET_ITEM(__pyx_t_1, 3, __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_blocksize); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 476, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 470, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); @@ -5005,7 +5112,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_26__defaults__(CYTHON_UNUSED PyObjec /* Python wrapper */ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_9numcodecs_5blosc_5Blosc___init__[] = "Blosc.__init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS)"; -static PyMethodDef __pyx_mdef_9numcodecs_5blosc_5Blosc_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9numcodecs_5blosc_5Blosc_1__init__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9numcodecs_5blosc_5Blosc___init__}; +static PyMethodDef __pyx_mdef_9numcodecs_5blosc_5Blosc_1__init__ = {"__init__", (PyCFunction)__pyx_pw_9numcodecs_5blosc_5Blosc_1__init__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9numcodecs_5blosc_5Blosc___init__}; static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; PyObject *__pyx_v_cname = 0; @@ -5071,7 +5178,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_1__init__(PyObject *__pyx_sel } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 476, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 470, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -5096,7 +5203,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_1__init__(PyObject *__pyx_sel } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 476, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 470, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.blosc.Blosc.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -5116,60 +5223,47 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc___init__(CYTHON_UNUSED PyObje int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("__init__", 0); - /* "numcodecs/blosc.pyx":477 - * + /* "numcodecs/blosc.pyx":471 + * * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): * self.cname = cname # <<<<<<<<<<<<<< * if isinstance(cname, text_type): * self._cname_bytes = cname.encode('ascii') */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cname, __pyx_v_cname) < 0) __PYX_ERR(0, 477, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cname, __pyx_v_cname) < 0) __PYX_ERR(0, 471, __pyx_L1_error) - /* "numcodecs/blosc.pyx":478 + /* "numcodecs/blosc.pyx":472 * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): * self.cname = cname * if isinstance(cname, text_type): # <<<<<<<<<<<<<< * self._cname_bytes = cname.encode('ascii') * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_text_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 478, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_text_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 472, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_IsInstance(__pyx_v_cname, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 478, __pyx_L1_error) + __pyx_t_2 = PyObject_IsInstance(__pyx_v_cname, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 472, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { - /* "numcodecs/blosc.pyx":479 + /* "numcodecs/blosc.pyx":473 * self.cname = cname * if isinstance(cname, text_type): * self._cname_bytes = cname.encode('ascii') # <<<<<<<<<<<<<< * else: * self._cname_bytes = cname */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_cname, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 479, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_n_s_ascii) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_n_s_ascii); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 479, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cname, __pyx_n_s_encode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 473, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cname_bytes, __pyx_t_1) < 0) __PYX_ERR(0, 479, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 473, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cname_bytes, __pyx_t_4) < 0) __PYX_ERR(0, 473, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "numcodecs/blosc.pyx":478 + /* "numcodecs/blosc.pyx":472 * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): * self.cname = cname * if isinstance(cname, text_type): # <<<<<<<<<<<<<< @@ -5179,7 +5273,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc___init__(CYTHON_UNUSED PyObje goto __pyx_L3; } - /* "numcodecs/blosc.pyx":481 + /* "numcodecs/blosc.pyx":475 * self._cname_bytes = cname.encode('ascii') * else: * self._cname_bytes = cname # <<<<<<<<<<<<<< @@ -5187,40 +5281,40 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc___init__(CYTHON_UNUSED PyObje * self.shuffle = shuffle */ /*else*/ { - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cname_bytes, __pyx_v_cname) < 0) __PYX_ERR(0, 481, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cname_bytes, __pyx_v_cname) < 0) __PYX_ERR(0, 475, __pyx_L1_error) } __pyx_L3:; - /* "numcodecs/blosc.pyx":482 + /* "numcodecs/blosc.pyx":476 * else: * self._cname_bytes = cname * self.clevel = clevel # <<<<<<<<<<<<<< * self.shuffle = shuffle * self.blocksize = blocksize */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_clevel, __pyx_v_clevel) < 0) __PYX_ERR(0, 482, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_clevel, __pyx_v_clevel) < 0) __PYX_ERR(0, 476, __pyx_L1_error) - /* "numcodecs/blosc.pyx":483 + /* "numcodecs/blosc.pyx":477 * self._cname_bytes = cname * self.clevel = clevel * self.shuffle = shuffle # <<<<<<<<<<<<<< * self.blocksize = blocksize - * + * */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_shuffle, __pyx_v_shuffle) < 0) __PYX_ERR(0, 483, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_shuffle, __pyx_v_shuffle) < 0) __PYX_ERR(0, 477, __pyx_L1_error) - /* "numcodecs/blosc.pyx":484 + /* "numcodecs/blosc.pyx":478 * self.clevel = clevel * self.shuffle = shuffle * self.blocksize = blocksize # <<<<<<<<<<<<<< - * + * * def encode(self, buf): */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_blocksize, __pyx_v_blocksize) < 0) __PYX_ERR(0, 484, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_blocksize, __pyx_v_blocksize) < 0) __PYX_ERR(0, 478, __pyx_L1_error) - /* "numcodecs/blosc.pyx":476 + /* "numcodecs/blosc.pyx":470 * AUTOSHUFFLE = AUTOSHUFFLE - * + * * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): # <<<<<<<<<<<<<< * self.cname = cname * if isinstance(cname, text_type): @@ -5232,7 +5326,6 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc___init__(CYTHON_UNUSED PyObje __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("numcodecs.blosc.Blosc.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -5241,18 +5334,18 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc___init__(CYTHON_UNUSED PyObje return __pyx_r; } -/* "numcodecs/blosc.pyx":486 +/* "numcodecs/blosc.pyx":480 * self.blocksize = blocksize - * + * * def encode(self, buf): # <<<<<<<<<<<<<< * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) - * + * */ /* Python wrapper */ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_3encode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_9numcodecs_5blosc_5Blosc_2encode[] = "Blosc.encode(self, buf)"; -static PyMethodDef __pyx_mdef_9numcodecs_5blosc_5Blosc_3encode = {"encode", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9numcodecs_5blosc_5Blosc_3encode, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9numcodecs_5blosc_5Blosc_2encode}; +static PyMethodDef __pyx_mdef_9numcodecs_5blosc_5Blosc_3encode = {"encode", (PyCFunction)__pyx_pw_9numcodecs_5blosc_5Blosc_3encode, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9numcodecs_5blosc_5Blosc_2encode}; static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_3encode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; PyObject *__pyx_v_buf = 0; @@ -5282,11 +5375,11 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_3encode(PyObject *__pyx_self, case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buf)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, 1); __PYX_ERR(0, 486, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, 1); __PYX_ERR(0, 480, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode") < 0)) __PYX_ERR(0, 486, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode") < 0)) __PYX_ERR(0, 480, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -5299,7 +5392,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_3encode(PyObject *__pyx_self, } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 486, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 480, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.blosc.Blosc.encode", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -5326,23 +5419,23 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_2encode(CYTHON_UNUSED PyObjec PyObject *__pyx_t_9 = NULL; __Pyx_RefNannySetupContext("encode", 0); - /* "numcodecs/blosc.pyx":487 - * + /* "numcodecs/blosc.pyx":481 + * * def encode(self, buf): * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) # <<<<<<<<<<<<<< - * + * * def decode(self, buf, out=None): */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_compress); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 487, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_compress); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 481, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cname_bytes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 487, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cname_bytes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 481, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_clevel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 487, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_clevel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 481, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_shuffle); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 487, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_shuffle); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 481, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_blocksize); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 487, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_blocksize); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 481, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; __pyx_t_8 = 0; @@ -5359,7 +5452,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_2encode(CYTHON_UNUSED PyObjec #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[6] = {__pyx_t_7, __pyx_v_buf, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 487, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 481, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -5371,7 +5464,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_2encode(CYTHON_UNUSED PyObjec #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[6] = {__pyx_t_7, __pyx_v_buf, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 487, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 481, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -5381,7 +5474,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_2encode(CYTHON_UNUSED PyObjec } else #endif { - __pyx_t_9 = PyTuple_New(5+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 487, __pyx_L1_error) + __pyx_t_9 = PyTuple_New(5+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 481, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); if (__pyx_t_7) { __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; @@ -5401,7 +5494,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_2encode(CYTHON_UNUSED PyObjec __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 487, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 481, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } @@ -5410,12 +5503,12 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_2encode(CYTHON_UNUSED PyObjec __pyx_t_1 = 0; goto __pyx_L0; - /* "numcodecs/blosc.pyx":486 + /* "numcodecs/blosc.pyx":480 * self.blocksize = blocksize - * + * * def encode(self, buf): # <<<<<<<<<<<<<< * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) - * + * */ /* function exit code */ @@ -5436,18 +5529,18 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_2encode(CYTHON_UNUSED PyObjec return __pyx_r; } -/* "numcodecs/blosc.pyx":489 +/* "numcodecs/blosc.pyx":483 * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) - * + * * def decode(self, buf, out=None): # <<<<<<<<<<<<<< * return decompress(buf, out) - * + * */ /* Python wrapper */ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_5decode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_9numcodecs_5blosc_5Blosc_4decode[] = "Blosc.decode(self, buf, out=None)"; -static PyMethodDef __pyx_mdef_9numcodecs_5blosc_5Blosc_5decode = {"decode", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9numcodecs_5blosc_5Blosc_5decode, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9numcodecs_5blosc_5Blosc_4decode}; +static PyMethodDef __pyx_mdef_9numcodecs_5blosc_5Blosc_5decode = {"decode", (PyCFunction)__pyx_pw_9numcodecs_5blosc_5Blosc_5decode, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9numcodecs_5blosc_5Blosc_4decode}; static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_5decode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { CYTHON_UNUSED PyObject *__pyx_v_self = 0; PyObject *__pyx_v_buf = 0; @@ -5481,7 +5574,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_5decode(PyObject *__pyx_self, case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buf)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, 1); __PYX_ERR(0, 489, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, 1); __PYX_ERR(0, 483, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -5491,7 +5584,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_5decode(PyObject *__pyx_self, } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode") < 0)) __PYX_ERR(0, 489, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode") < 0)) __PYX_ERR(0, 483, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -5509,7 +5602,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_5decode(PyObject *__pyx_self, } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 489, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 483, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.blosc.Blosc.decode", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -5532,15 +5625,15 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_4decode(CYTHON_UNUSED PyObjec PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("decode", 0); - /* "numcodecs/blosc.pyx":490 - * + /* "numcodecs/blosc.pyx":484 + * * def decode(self, buf, out=None): * return decompress(buf, out) # <<<<<<<<<<<<<< - * + * * def __repr__(self): */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_decompress); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 490, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_decompress); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 484, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; __pyx_t_4 = 0; @@ -5557,7 +5650,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_4decode(CYTHON_UNUSED PyObjec #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_buf, __pyx_v_out}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 484, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else @@ -5565,13 +5658,13 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_4decode(CYTHON_UNUSED PyObjec #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_buf, __pyx_v_out}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 484, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif { - __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 490, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 484, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (__pyx_t_3) { __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; @@ -5582,7 +5675,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_4decode(CYTHON_UNUSED PyObjec __Pyx_INCREF(__pyx_v_out); __Pyx_GIVEREF(__pyx_v_out); PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_out); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 484, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } @@ -5591,12 +5684,12 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_4decode(CYTHON_UNUSED PyObjec __pyx_t_1 = 0; goto __pyx_L0; - /* "numcodecs/blosc.pyx":489 + /* "numcodecs/blosc.pyx":483 * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) - * + * * def decode(self, buf, out=None): # <<<<<<<<<<<<<< * return decompress(buf, out) - * + * */ /* function exit code */ @@ -5613,9 +5706,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_4decode(CYTHON_UNUSED PyObjec return __pyx_r; } -/* "numcodecs/blosc.pyx":492 +/* "numcodecs/blosc.pyx":486 * return decompress(buf, out) - * + * * def __repr__(self): # <<<<<<<<<<<<<< * r = '%s(cname=%r, clevel=%r, shuffle=%s, blocksize=%s)' % \ * (type(self).__name__, @@ -5648,72 +5741,72 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_6__repr__(CYTHON_UNUSED PyObj PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("__repr__", 0); - /* "numcodecs/blosc.pyx":494 + /* "numcodecs/blosc.pyx":488 * def __repr__(self): * r = '%s(cname=%r, clevel=%r, shuffle=%s, blocksize=%s)' % \ * (type(self).__name__, # <<<<<<<<<<<<<< * self.cname, * self.clevel, */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_self)), __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 494, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_self)), __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 488, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - /* "numcodecs/blosc.pyx":495 + /* "numcodecs/blosc.pyx":489 * r = '%s(cname=%r, clevel=%r, shuffle=%s, blocksize=%s)' % \ * (type(self).__name__, * self.cname, # <<<<<<<<<<<<<< * self.clevel, * _shuffle_repr[self.shuffle + 1], */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cname); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 495, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cname); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 489, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - /* "numcodecs/blosc.pyx":496 + /* "numcodecs/blosc.pyx":490 * (type(self).__name__, * self.cname, * self.clevel, # <<<<<<<<<<<<<< * _shuffle_repr[self.shuffle + 1], * self.blocksize) */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_clevel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 496, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_clevel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 490, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - /* "numcodecs/blosc.pyx":497 + /* "numcodecs/blosc.pyx":491 * self.cname, * self.clevel, * _shuffle_repr[self.shuffle + 1], # <<<<<<<<<<<<<< * self.blocksize) * return r */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_shuffle_repr); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 497, __pyx_L1_error) + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_shuffle_repr); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 491, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_shuffle); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 497, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_shuffle); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 491, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_5, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 497, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_5, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 491, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 497, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 491, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "numcodecs/blosc.pyx":498 + /* "numcodecs/blosc.pyx":492 * self.clevel, * _shuffle_repr[self.shuffle + 1], * self.blocksize) # <<<<<<<<<<<<<< * return r */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_blocksize); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 498, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_blocksize); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 492, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - /* "numcodecs/blosc.pyx":494 + /* "numcodecs/blosc.pyx":488 * def __repr__(self): * r = '%s(cname=%r, clevel=%r, shuffle=%s, blocksize=%s)' % \ * (type(self).__name__, # <<<<<<<<<<<<<< * self.cname, * self.clevel, */ - __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 494, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 488, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); @@ -5731,20 +5824,20 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_6__repr__(CYTHON_UNUSED PyObj __pyx_t_5 = 0; __pyx_t_6 = 0; - /* "numcodecs/blosc.pyx":493 - * + /* "numcodecs/blosc.pyx":487 + * * def __repr__(self): * r = '%s(cname=%r, clevel=%r, shuffle=%s, blocksize=%s)' % \ # <<<<<<<<<<<<<< * (type(self).__name__, * self.cname, */ - __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_s_cname_r_clevel_r_shuffle_s_bl, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 493, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_s_cname_r_clevel_r_shuffle_s_bl, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 487, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_r = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0; - /* "numcodecs/blosc.pyx":499 + /* "numcodecs/blosc.pyx":493 * _shuffle_repr[self.shuffle + 1], * self.blocksize) * return r # <<<<<<<<<<<<<< @@ -5754,9 +5847,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_6__repr__(CYTHON_UNUSED PyObj __pyx_r = __pyx_v_r; goto __pyx_L0; - /* "numcodecs/blosc.pyx":492 + /* "numcodecs/blosc.pyx":486 * return decompress(buf, out) - * + * * def __repr__(self): # <<<<<<<<<<<<<< * r = '%s(cname=%r, clevel=%r, shuffle=%s, blocksize=%s)' % \ * (type(self).__name__, @@ -5779,79 +5872,706 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_6__repr__(CYTHON_UNUSED PyObj return __pyx_r; } -static PyMethodDef __pyx_methods[] = { - {0, 0, 0, 0} -}; +/* "array.pxd":93 + * __data_union data + * + * def __getbuffer__(self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< + * # This implementation of getbuffer is geared towards Cython + * # requirements, and does not yet fulfill the PEP. + */ -#if PY_MAJOR_VERSION >= 3 -#if CYTHON_PEP489_MULTI_PHASE_INIT -static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ -static int __pyx_pymod_exec_blosc(PyObject* module); /*proto*/ -static PyModuleDef_Slot __pyx_moduledef_slots[] = { - {Py_mod_create, (void*)__pyx_pymod_create}, - {Py_mod_exec, (void*)__pyx_pymod_exec_blosc}, - {0, NULL} -}; -#endif +/* Python wrapper */ +static CYTHON_UNUSED int __pyx_pw_7cpython_5array_5array_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static CYTHON_UNUSED int __pyx_pw_7cpython_5array_5array_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_r = __pyx_pf_7cpython_5array_5array___getbuffer__(((arrayobject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); -static struct PyModuleDef __pyx_moduledef = { - PyModuleDef_HEAD_INIT, - "blosc", - 0, /* m_doc */ - #if CYTHON_PEP489_MULTI_PHASE_INIT - 0, /* m_size */ - #else - -1, /* m_size */ - #endif - __pyx_methods /* m_methods */, - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_moduledef_slots, /* m_slots */ - #else - NULL, /* m_reload */ - #endif - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif -#ifndef CYTHON_SMALL_CODE -#if defined(__clang__) - #define CYTHON_SMALL_CODE -#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) - #define CYTHON_SMALL_CODE __attribute__((cold)) -#else - #define CYTHON_SMALL_CODE -#endif -#endif + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0}, - {&__pyx_n_s_AUTOBLOCKS, __pyx_k_AUTOBLOCKS, sizeof(__pyx_k_AUTOBLOCKS), 0, 0, 1, 1}, - {&__pyx_n_s_AUTOSHUFFLE, __pyx_k_AUTOSHUFFLE, sizeof(__pyx_k_AUTOSHUFFLE), 0, 0, 1, 1}, - {&__pyx_n_s_BITSHUFFLE, __pyx_k_BITSHUFFLE, sizeof(__pyx_k_BITSHUFFLE), 0, 0, 1, 1}, - {&__pyx_n_s_Blosc, __pyx_k_Blosc, sizeof(__pyx_k_Blosc), 0, 0, 1, 1}, - {&__pyx_n_s_Blosc___init, __pyx_k_Blosc___init, sizeof(__pyx_k_Blosc___init), 0, 0, 1, 1}, - {&__pyx_n_s_Blosc___repr, __pyx_k_Blosc___repr, sizeof(__pyx_k_Blosc___repr), 0, 0, 1, 1}, - {&__pyx_n_s_Blosc_decode, __pyx_k_Blosc_decode, sizeof(__pyx_k_Blosc_decode), 0, 0, 1, 1}, - {&__pyx_n_s_Blosc_encode, __pyx_k_Blosc_encode, sizeof(__pyx_k_Blosc_encode), 0, 0, 1, 1}, - {&__pyx_n_s_Buffer, __pyx_k_Buffer, sizeof(__pyx_k_Buffer), 0, 0, 1, 1}, - {&__pyx_n_s_Codec, __pyx_k_Codec, sizeof(__pyx_k_Codec), 0, 0, 1, 1}, - {&__pyx_kp_s_Codec_providing_compression_usin, __pyx_k_Codec_providing_compression_usin, sizeof(__pyx_k_Codec_providing_compression_usin), 0, 0, 1, 0}, - {&__pyx_n_s_Lock, __pyx_k_Lock, sizeof(__pyx_k_Lock), 0, 0, 1, 1}, - {&__pyx_n_s_MAX_BUFFERSIZE, __pyx_k_MAX_BUFFERSIZE, sizeof(__pyx_k_MAX_BUFFERSIZE), 0, 0, 1, 1}, - {&__pyx_n_s_MAX_OVERHEAD, __pyx_k_MAX_OVERHEAD, sizeof(__pyx_k_MAX_OVERHEAD), 0, 0, 1, 1}, - {&__pyx_n_s_MAX_THREADS, __pyx_k_MAX_THREADS, sizeof(__pyx_k_MAX_THREADS), 0, 0, 1, 1}, - {&__pyx_n_s_MAX_TYPESIZE, __pyx_k_MAX_TYPESIZE, sizeof(__pyx_k_MAX_TYPESIZE), 0, 0, 1, 1}, - {&__pyx_n_s_MainProcess, __pyx_k_MainProcess, sizeof(__pyx_k_MainProcess), 0, 0, 1, 1}, - {&__pyx_n_s_MainThread, __pyx_k_MainThread, sizeof(__pyx_k_MainThread), 0, 0, 1, 1}, - {&__pyx_n_s_NOSHUFFLE, __pyx_k_NOSHUFFLE, sizeof(__pyx_k_NOSHUFFLE), 0, 0, 1, 1}, - {&__pyx_n_s_OSError, __pyx_k_OSError, sizeof(__pyx_k_OSError), 0, 0, 1, 1}, - {&__pyx_n_s_PY2, __pyx_k_PY2, sizeof(__pyx_k_PY2), 0, 0, 1, 1}, +static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info, CYTHON_UNUSED int __pyx_v_flags) { + PyObject *__pyx_v_item_count = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + char *__pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + if (__pyx_v_info == NULL) { + PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); + return -1; + } + __Pyx_RefNannySetupContext("__getbuffer__", 0); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + + /* "array.pxd":98 + * # In particular strided access is always provided regardless + * # of flags + * item_count = Py_SIZE(self) # <<<<<<<<<<<<<< + * + * info.suboffsets = NULL + */ + __pyx_t_1 = PyInt_FromSsize_t(Py_SIZE(((PyObject *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 98, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_item_count = __pyx_t_1; + __pyx_t_1 = 0; + + /* "array.pxd":100 + * item_count = Py_SIZE(self) + * + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.buf = self.data.as_chars + * info.readonly = 0 + */ + __pyx_v_info->suboffsets = NULL; + + /* "array.pxd":101 + * + * info.suboffsets = NULL + * info.buf = self.data.as_chars # <<<<<<<<<<<<<< + * info.readonly = 0 + * info.ndim = 1 + */ + __pyx_t_2 = __pyx_v_self->data.as_chars; + __pyx_v_info->buf = __pyx_t_2; + + /* "array.pxd":102 + * info.suboffsets = NULL + * info.buf = self.data.as_chars + * info.readonly = 0 # <<<<<<<<<<<<<< + * info.ndim = 1 + * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float) + */ + __pyx_v_info->readonly = 0; + + /* "array.pxd":103 + * info.buf = self.data.as_chars + * info.readonly = 0 + * info.ndim = 1 # <<<<<<<<<<<<<< + * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float) + * info.len = info.itemsize * item_count + */ + __pyx_v_info->ndim = 1; + + /* "array.pxd":104 + * info.readonly = 0 + * info.ndim = 1 + * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float) # <<<<<<<<<<<<<< + * info.len = info.itemsize * item_count + * + */ + __pyx_t_3 = __pyx_v_self->ob_descr->itemsize; + __pyx_v_info->itemsize = __pyx_t_3; + + /* "array.pxd":105 + * info.ndim = 1 + * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float) + * info.len = info.itemsize * item_count # <<<<<<<<<<<<<< + * + * info.shape = PyObject_Malloc(sizeof(Py_ssize_t) + 2) + */ + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_info->itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 105, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_v_item_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 105, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 105, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_info->len = __pyx_t_5; + + /* "array.pxd":107 + * info.len = info.itemsize * item_count + * + * info.shape = PyObject_Malloc(sizeof(Py_ssize_t) + 2) # <<<<<<<<<<<<<< + * if not info.shape: + * raise MemoryError() + */ + __pyx_v_info->shape = ((Py_ssize_t *)PyObject_Malloc(((sizeof(Py_ssize_t)) + 2))); + + /* "array.pxd":108 + * + * info.shape = PyObject_Malloc(sizeof(Py_ssize_t) + 2) + * if not info.shape: # <<<<<<<<<<<<<< + * raise MemoryError() + * info.shape[0] = item_count # constant regardless of resizing + */ + __pyx_t_6 = ((!(__pyx_v_info->shape != 0)) != 0); + if (unlikely(__pyx_t_6)) { + + /* "array.pxd":109 + * info.shape = PyObject_Malloc(sizeof(Py_ssize_t) + 2) + * if not info.shape: + * raise MemoryError() # <<<<<<<<<<<<<< + * info.shape[0] = item_count # constant regardless of resizing + * info.strides = &info.itemsize + */ + PyErr_NoMemory(); __PYX_ERR(1, 109, __pyx_L1_error) + + /* "array.pxd":108 + * + * info.shape = PyObject_Malloc(sizeof(Py_ssize_t) + 2) + * if not info.shape: # <<<<<<<<<<<<<< + * raise MemoryError() + * info.shape[0] = item_count # constant regardless of resizing + */ + } + + /* "array.pxd":110 + * if not info.shape: + * raise MemoryError() + * info.shape[0] = item_count # constant regardless of resizing # <<<<<<<<<<<<<< + * info.strides = &info.itemsize + * + */ + __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_item_count); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 110, __pyx_L1_error) + (__pyx_v_info->shape[0]) = __pyx_t_5; + + /* "array.pxd":111 + * raise MemoryError() + * info.shape[0] = item_count # constant regardless of resizing + * info.strides = &info.itemsize # <<<<<<<<<<<<<< + * + * info.format = (info.shape + 1) + */ + __pyx_v_info->strides = (&__pyx_v_info->itemsize); + + /* "array.pxd":113 + * info.strides = &info.itemsize + * + * info.format = (info.shape + 1) # <<<<<<<<<<<<<< + * info.format[0] = self.ob_descr.typecode + * info.format[1] = 0 + */ + __pyx_v_info->format = ((char *)(__pyx_v_info->shape + 1)); + + /* "array.pxd":114 + * + * info.format = (info.shape + 1) + * info.format[0] = self.ob_descr.typecode # <<<<<<<<<<<<<< + * info.format[1] = 0 + * info.obj = self + */ + __pyx_t_3 = __pyx_v_self->ob_descr->typecode; + (__pyx_v_info->format[0]) = __pyx_t_3; + + /* "array.pxd":115 + * info.format = (info.shape + 1) + * info.format[0] = self.ob_descr.typecode + * info.format[1] = 0 # <<<<<<<<<<<<<< + * info.obj = self + * + */ + (__pyx_v_info->format[1]) = 0; + + /* "array.pxd":116 + * info.format[0] = self.ob_descr.typecode + * info.format[1] = 0 + * info.obj = self # <<<<<<<<<<<<<< + * + * def __releasebuffer__(self, Py_buffer* info): + */ + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + + /* "array.pxd":93 + * __data_union data + * + * def __getbuffer__(self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< + * # This implementation of getbuffer is geared towards Cython + * # requirements, and does not yet fulfill the PEP. + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("cpython.array.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + __pyx_L2:; + __Pyx_XDECREF(__pyx_v_item_count); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "array.pxd":118 + * info.obj = self + * + * def __releasebuffer__(self, Py_buffer* info): # <<<<<<<<<<<<<< + * PyObject_Free(info.shape) + * + */ + +/* Python wrapper */ +static CYTHON_UNUSED void __pyx_pw_7cpython_5array_5array_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static CYTHON_UNUSED void __pyx_pw_7cpython_5array_5array_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); + __pyx_pf_7cpython_5array_5array_2__releasebuffer__(((arrayobject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_pf_7cpython_5array_5array_2__releasebuffer__(CYTHON_UNUSED arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__releasebuffer__", 0); + + /* "array.pxd":119 + * + * def __releasebuffer__(self, Py_buffer* info): + * PyObject_Free(info.shape) # <<<<<<<<<<<<<< + * + * array newarrayobject(PyTypeObject* type, Py_ssize_t size, arraydescr *descr) + */ + PyObject_Free(__pyx_v_info->shape); + + /* "array.pxd":118 + * info.obj = self + * + * def __releasebuffer__(self, Py_buffer* info): # <<<<<<<<<<<<<< + * PyObject_Free(info.shape) + * + */ + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* "array.pxd":130 + * + * + * cdef inline array clone(array template, Py_ssize_t length, bint zero): # <<<<<<<<<<<<<< + * """ fast creation of a new array, given a template array. + * type will be same as template. + */ + +static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_clone(arrayobject *__pyx_v_template, Py_ssize_t __pyx_v_length, int __pyx_v_zero) { + arrayobject *__pyx_v_op = NULL; + arrayobject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + __Pyx_RefNannySetupContext("clone", 0); + + /* "array.pxd":134 + * type will be same as template. + * if zero is true, new array will be initialized with zeroes.""" + * op = newarrayobject(Py_TYPE(template), length, template.ob_descr) # <<<<<<<<<<<<<< + * if zero and op is not None: + * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize) + */ + __pyx_t_1 = ((PyObject *)newarrayobject(Py_TYPE(((PyObject *)__pyx_v_template)), __pyx_v_length, __pyx_v_template->ob_descr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 134, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_op = ((arrayobject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "array.pxd":135 + * if zero is true, new array will be initialized with zeroes.""" + * op = newarrayobject(Py_TYPE(template), length, template.ob_descr) + * if zero and op is not None: # <<<<<<<<<<<<<< + * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize) + * return op + */ + __pyx_t_3 = (__pyx_v_zero != 0); + if (__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = (((PyObject *)__pyx_v_op) != Py_None); + __pyx_t_4 = (__pyx_t_3 != 0); + __pyx_t_2 = __pyx_t_4; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { + + /* "array.pxd":136 + * op = newarrayobject(Py_TYPE(template), length, template.ob_descr) + * if zero and op is not None: + * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize) # <<<<<<<<<<<<<< + * return op + * + */ + (void)(memset(__pyx_v_op->data.as_chars, 0, (__pyx_v_length * __pyx_v_op->ob_descr->itemsize))); + + /* "array.pxd":135 + * if zero is true, new array will be initialized with zeroes.""" + * op = newarrayobject(Py_TYPE(template), length, template.ob_descr) + * if zero and op is not None: # <<<<<<<<<<<<<< + * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize) + * return op + */ + } + + /* "array.pxd":137 + * if zero and op is not None: + * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize) + * return op # <<<<<<<<<<<<<< + * + * cdef inline array copy(array self): + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_op)); + __pyx_r = __pyx_v_op; + goto __pyx_L0; + + /* "array.pxd":130 + * + * + * cdef inline array clone(array template, Py_ssize_t length, bint zero): # <<<<<<<<<<<<<< + * """ fast creation of a new array, given a template array. + * type will be same as template. + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cpython.array.clone", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_op); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "array.pxd":139 + * return op + * + * cdef inline array copy(array self): # <<<<<<<<<<<<<< + * """ make a copy of an array. """ + * op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr) + */ + +static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_copy(arrayobject *__pyx_v_self) { + arrayobject *__pyx_v_op = NULL; + arrayobject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("copy", 0); + + /* "array.pxd":141 + * cdef inline array copy(array self): + * """ make a copy of an array. """ + * op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr) # <<<<<<<<<<<<<< + * memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize) + * return op + */ + __pyx_t_1 = ((PyObject *)newarrayobject(Py_TYPE(((PyObject *)__pyx_v_self)), Py_SIZE(((PyObject *)__pyx_v_self)), __pyx_v_self->ob_descr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 141, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_op = ((arrayobject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "array.pxd":142 + * """ make a copy of an array. """ + * op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr) + * memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize) # <<<<<<<<<<<<<< + * return op + * + */ + (void)(memcpy(__pyx_v_op->data.as_chars, __pyx_v_self->data.as_chars, (Py_SIZE(((PyObject *)__pyx_v_op)) * __pyx_v_op->ob_descr->itemsize))); + + /* "array.pxd":143 + * op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr) + * memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize) + * return op # <<<<<<<<<<<<<< + * + * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1: + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_op)); + __pyx_r = __pyx_v_op; + goto __pyx_L0; + + /* "array.pxd":139 + * return op + * + * cdef inline array copy(array self): # <<<<<<<<<<<<<< + * """ make a copy of an array. """ + * op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cpython.array.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_op); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "array.pxd":145 + * return op + * + * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1: # <<<<<<<<<<<<<< + * """ efficient appending of new stuff of same type + * (e.g. of same array type) + */ + +static CYTHON_INLINE int __pyx_f_7cpython_5array_extend_buffer(arrayobject *__pyx_v_self, char *__pyx_v_stuff, Py_ssize_t __pyx_v_n) { + Py_ssize_t __pyx_v_itemsize; + Py_ssize_t __pyx_v_origsize; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("extend_buffer", 0); + + /* "array.pxd":149 + * (e.g. of same array type) + * n: number of elements (not number of bytes!) """ + * cdef Py_ssize_t itemsize = self.ob_descr.itemsize # <<<<<<<<<<<<<< + * cdef Py_ssize_t origsize = Py_SIZE(self) + * resize_smart(self, origsize + n) + */ + __pyx_t_1 = __pyx_v_self->ob_descr->itemsize; + __pyx_v_itemsize = __pyx_t_1; + + /* "array.pxd":150 + * n: number of elements (not number of bytes!) """ + * cdef Py_ssize_t itemsize = self.ob_descr.itemsize + * cdef Py_ssize_t origsize = Py_SIZE(self) # <<<<<<<<<<<<<< + * resize_smart(self, origsize + n) + * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize) + */ + __pyx_v_origsize = Py_SIZE(((PyObject *)__pyx_v_self)); + + /* "array.pxd":151 + * cdef Py_ssize_t itemsize = self.ob_descr.itemsize + * cdef Py_ssize_t origsize = Py_SIZE(self) + * resize_smart(self, origsize + n) # <<<<<<<<<<<<<< + * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize) + * return 0 + */ + __pyx_t_1 = resize_smart(__pyx_v_self, (__pyx_v_origsize + __pyx_v_n)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 151, __pyx_L1_error) + + /* "array.pxd":152 + * cdef Py_ssize_t origsize = Py_SIZE(self) + * resize_smart(self, origsize + n) + * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize) # <<<<<<<<<<<<<< + * return 0 + * + */ + (void)(memcpy((__pyx_v_self->data.as_chars + (__pyx_v_origsize * __pyx_v_itemsize)), __pyx_v_stuff, (__pyx_v_n * __pyx_v_itemsize))); + + /* "array.pxd":153 + * resize_smart(self, origsize + n) + * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize) + * return 0 # <<<<<<<<<<<<<< + * + * cdef inline int extend(array self, array other) except -1: + */ + __pyx_r = 0; + goto __pyx_L0; + + /* "array.pxd":145 + * return op + * + * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1: # <<<<<<<<<<<<<< + * """ efficient appending of new stuff of same type + * (e.g. of same array type) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("cpython.array.extend_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "array.pxd":155 + * return 0 + * + * cdef inline int extend(array self, array other) except -1: # <<<<<<<<<<<<<< + * """ extend array with data from another array; types must match. """ + * if self.ob_descr.typecode != other.ob_descr.typecode: + */ + +static CYTHON_INLINE int __pyx_f_7cpython_5array_extend(arrayobject *__pyx_v_self, arrayobject *__pyx_v_other) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + __Pyx_RefNannySetupContext("extend", 0); + + /* "array.pxd":157 + * cdef inline int extend(array self, array other) except -1: + * """ extend array with data from another array; types must match. """ + * if self.ob_descr.typecode != other.ob_descr.typecode: # <<<<<<<<<<<<<< + * PyErr_BadArgument() + * return extend_buffer(self, other.data.as_chars, Py_SIZE(other)) + */ + __pyx_t_1 = ((__pyx_v_self->ob_descr->typecode != __pyx_v_other->ob_descr->typecode) != 0); + if (__pyx_t_1) { + + /* "array.pxd":158 + * """ extend array with data from another array; types must match. """ + * if self.ob_descr.typecode != other.ob_descr.typecode: + * PyErr_BadArgument() # <<<<<<<<<<<<<< + * return extend_buffer(self, other.data.as_chars, Py_SIZE(other)) + * + */ + __pyx_t_2 = PyErr_BadArgument(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 158, __pyx_L1_error) + + /* "array.pxd":157 + * cdef inline int extend(array self, array other) except -1: + * """ extend array with data from another array; types must match. """ + * if self.ob_descr.typecode != other.ob_descr.typecode: # <<<<<<<<<<<<<< + * PyErr_BadArgument() + * return extend_buffer(self, other.data.as_chars, Py_SIZE(other)) + */ + } + + /* "array.pxd":159 + * if self.ob_descr.typecode != other.ob_descr.typecode: + * PyErr_BadArgument() + * return extend_buffer(self, other.data.as_chars, Py_SIZE(other)) # <<<<<<<<<<<<<< + * + * cdef inline void zero(array self): + */ + __pyx_t_2 = __pyx_f_7cpython_5array_extend_buffer(__pyx_v_self, __pyx_v_other->data.as_chars, Py_SIZE(((PyObject *)__pyx_v_other))); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 159, __pyx_L1_error) + __pyx_r = __pyx_t_2; + goto __pyx_L0; + + /* "array.pxd":155 + * return 0 + * + * cdef inline int extend(array self, array other) except -1: # <<<<<<<<<<<<<< + * """ extend array with data from another array; types must match. """ + * if self.ob_descr.typecode != other.ob_descr.typecode: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("cpython.array.extend", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "array.pxd":161 + * return extend_buffer(self, other.data.as_chars, Py_SIZE(other)) + * + * cdef inline void zero(array self): # <<<<<<<<<<<<<< + * """ set all elements of array to zero. """ + * memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize) + */ + +static CYTHON_INLINE void __pyx_f_7cpython_5array_zero(arrayobject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("zero", 0); + + /* "array.pxd":163 + * cdef inline void zero(array self): + * """ set all elements of array to zero. """ + * memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize) # <<<<<<<<<<<<<< + */ + (void)(memset(__pyx_v_self->data.as_chars, 0, (Py_SIZE(((PyObject *)__pyx_v_self)) * __pyx_v_self->ob_descr->itemsize))); + + /* "array.pxd":161 + * return extend_buffer(self, other.data.as_chars, Py_SIZE(other)) + * + * cdef inline void zero(array self): # <<<<<<<<<<<<<< + * """ set all elements of array to zero. """ + * memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize) + */ + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec_blosc(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_blosc}, + {0, NULL} +}; +#endif + +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + "blosc", + 0, /* m_doc */ + #if CYTHON_PEP489_MULTI_PHASE_INIT + 0, /* m_size */ + #else + -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_n_s_AUTOBLOCKS, __pyx_k_AUTOBLOCKS, sizeof(__pyx_k_AUTOBLOCKS), 0, 0, 1, 1}, + {&__pyx_n_s_AUTOSHUFFLE, __pyx_k_AUTOSHUFFLE, sizeof(__pyx_k_AUTOSHUFFLE), 0, 0, 1, 1}, + {&__pyx_n_s_BITSHUFFLE, __pyx_k_BITSHUFFLE, sizeof(__pyx_k_BITSHUFFLE), 0, 0, 1, 1}, + {&__pyx_n_s_Blosc, __pyx_k_Blosc, sizeof(__pyx_k_Blosc), 0, 0, 1, 1}, + {&__pyx_n_s_Blosc___init, __pyx_k_Blosc___init, sizeof(__pyx_k_Blosc___init), 0, 0, 1, 1}, + {&__pyx_n_s_Blosc___repr, __pyx_k_Blosc___repr, sizeof(__pyx_k_Blosc___repr), 0, 0, 1, 1}, + {&__pyx_n_s_Blosc_decode, __pyx_k_Blosc_decode, sizeof(__pyx_k_Blosc_decode), 0, 0, 1, 1}, + {&__pyx_n_s_Blosc_encode, __pyx_k_Blosc_encode, sizeof(__pyx_k_Blosc_encode), 0, 0, 1, 1}, + {&__pyx_n_s_Buffer, __pyx_k_Buffer, sizeof(__pyx_k_Buffer), 0, 0, 1, 1}, + {&__pyx_n_s_Codec, __pyx_k_Codec, sizeof(__pyx_k_Codec), 0, 0, 1, 1}, + {&__pyx_kp_s_Codec_providing_compression_usin, __pyx_k_Codec_providing_compression_usin, sizeof(__pyx_k_Codec_providing_compression_usin), 0, 0, 1, 0}, + {&__pyx_n_s_Lock, __pyx_k_Lock, sizeof(__pyx_k_Lock), 0, 0, 1, 1}, + {&__pyx_n_s_MAX_BUFFERSIZE, __pyx_k_MAX_BUFFERSIZE, sizeof(__pyx_k_MAX_BUFFERSIZE), 0, 0, 1, 1}, + {&__pyx_n_s_MAX_OVERHEAD, __pyx_k_MAX_OVERHEAD, sizeof(__pyx_k_MAX_OVERHEAD), 0, 0, 1, 1}, + {&__pyx_n_s_MAX_THREADS, __pyx_k_MAX_THREADS, sizeof(__pyx_k_MAX_THREADS), 0, 0, 1, 1}, + {&__pyx_n_s_MAX_TYPESIZE, __pyx_k_MAX_TYPESIZE, sizeof(__pyx_k_MAX_TYPESIZE), 0, 0, 1, 1}, + {&__pyx_n_s_MainProcess, __pyx_k_MainProcess, sizeof(__pyx_k_MainProcess), 0, 0, 1, 1}, + {&__pyx_n_s_MainThread, __pyx_k_MainThread, sizeof(__pyx_k_MainThread), 0, 0, 1, 1}, + {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, + {&__pyx_n_s_NOSHUFFLE, __pyx_k_NOSHUFFLE, sizeof(__pyx_k_NOSHUFFLE), 0, 0, 1, 1}, + {&__pyx_n_s_PY2, __pyx_k_PY2, sizeof(__pyx_k_PY2), 0, 0, 1, 1}, {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1}, {&__pyx_n_s_SHUFFLE, __pyx_k_SHUFFLE, sizeof(__pyx_k_SHUFFLE), 0, 0, 1, 1}, {&__pyx_n_s_VERSION_DATE, __pyx_k_VERSION_DATE, sizeof(__pyx_k_VERSION_DATE), 0, 0, 1, 1}, {&__pyx_n_s_VERSION_STRING, __pyx_k_VERSION_STRING, sizeof(__pyx_k_VERSION_STRING), 0, 0, 1, 1}, {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, + {&__pyx_kp_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 0}, {&__pyx_n_s_abc, __pyx_k_abc, sizeof(__pyx_k_abc), 0, 0, 1, 1}, {&__pyx_n_s_ascii, __pyx_k_ascii, sizeof(__pyx_k_ascii), 0, 0, 1, 1}, {&__pyx_kp_s_bad_compressor_or_compressor_not, __pyx_k_bad_compressor_or_compressor_not, sizeof(__pyx_k_bad_compressor_or_compressor_not), 0, 0, 1, 0}, @@ -5946,227 +6666,282 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; -static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_OSError = __Pyx_GetBuiltinName(__pyx_n_s_OSError); if (!__pyx_builtin_OSError) __PYX_ERR(0, 82, __pyx_L1_error) - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 215, __pyx_L1_error) - __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 321, __pyx_L1_error) +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 212, __pyx_L1_error) + __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 319, __pyx_L1_error) + __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 109, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; } -static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { +static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "numcodecs/blosc.pyx":291 + /* "numcodecs/blosc.pyx":101 + * instead.""" + * if isinstance(cname, text_type): + * cname = cname.encode('ascii') # <<<<<<<<<<<<<< + * return blosc_compname_to_compcode(cname) + * + */ + __pyx_tuple_ = PyTuple_Pack(1, __pyx_n_s_ascii); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple_); + __Pyx_GIVEREF(__pyx_tuple_); + + /* "numcodecs/blosc.pyx":109 + * s = blosc_list_compressors() + * if not PY2: + * s = s.decode('ascii') # <<<<<<<<<<<<<< + * return s.split(',') + * + */ + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_n_s_ascii); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 109, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__2); + __Pyx_GIVEREF(__pyx_tuple__2); + + /* "numcodecs/blosc.pyx":110 + * if not PY2: + * s = s.decode('ascii') + * return s.split(',') # <<<<<<<<<<<<<< + * + * + */ + __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s__3); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__4); + __Pyx_GIVEREF(__pyx_tuple__4); + + /* "numcodecs/blosc.pyx":168 + * + * if not PY2: + * complib = complib.decode('ascii') # <<<<<<<<<<<<<< + * + * return complib + */ + __pyx_tuple__5 = PyTuple_Pack(1, __pyx_n_s_ascii); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 168, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__5); + __Pyx_GIVEREF(__pyx_tuple__5); + + /* "numcodecs/blosc.pyx":289 * # to ensure no-one else can modify the global context while we're setting it * # up and using it. * with mutex: # <<<<<<<<<<<<<< - * + * * # set compressor */ - __pyx_tuple__4 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 291, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__4); - __Pyx_GIVEREF(__pyx_tuple__4); + __pyx_tuple__8 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 289, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__8); + __Pyx_GIVEREF(__pyx_tuple__8); - /* "numcodecs/blosc.pyx":89 - * - * + /* "numcodecs/blosc.pyx":473 + * self.cname = cname + * if isinstance(cname, text_type): + * self._cname_bytes = cname.encode('ascii') # <<<<<<<<<<<<<< + * else: + * self._cname_bytes = cname + */ + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_n_s_ascii); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 473, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__9); + __Pyx_GIVEREF(__pyx_tuple__9); + + /* "numcodecs/blosc.pyx":86 + * + * * def init(): # <<<<<<<<<<<<<< * """Initialize the Blosc library environment.""" * blosc_init() */ - __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_init, 89, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 89, __pyx_L1_error) + __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_init, 86, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 86, __pyx_L1_error) - /* "numcodecs/blosc.pyx":94 - * - * + /* "numcodecs/blosc.pyx":91 + * + * * def destroy(): # <<<<<<<<<<<<<< * """Destroy the Blosc library environment.""" * blosc_destroy() */ - __pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_destroy, 94, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(0, 94, __pyx_L1_error) + __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_destroy, 91, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 91, __pyx_L1_error) - /* "numcodecs/blosc.pyx":99 - * - * + /* "numcodecs/blosc.pyx":96 + * + * * def compname_to_compcode(cname): # <<<<<<<<<<<<<< * """Return the compressor code associated with the compressor name. If the compressor * name is not recognized, or there is not support for it in this build, -1 is returned */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_n_s_cname); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__7); - __Pyx_GIVEREF(__pyx_tuple__7); - __pyx_codeobj__8 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__7, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_compname_to_compcode, 99, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__8)) __PYX_ERR(0, 99, __pyx_L1_error) + __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_cname); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 96, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__12); + __Pyx_GIVEREF(__pyx_tuple__12); + __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_compname_to_compcode, 96, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 96, __pyx_L1_error) - /* "numcodecs/blosc.pyx":108 - * - * + /* "numcodecs/blosc.pyx":105 + * + * * def list_compressors(): # <<<<<<<<<<<<<< * """Get a list of compressors supported in the current build.""" * s = blosc_list_compressors() */ - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_n_s_s); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 108, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__9); - __Pyx_GIVEREF(__pyx_tuple__9); - __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_list_compressors, 108, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 108, __pyx_L1_error) + __pyx_tuple__14 = PyTuple_Pack(1, __pyx_n_s_s); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 105, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__14); + __Pyx_GIVEREF(__pyx_tuple__14); + __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_list_compressors, 105, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 105, __pyx_L1_error) - /* "numcodecs/blosc.pyx":116 - * - * + /* "numcodecs/blosc.pyx":113 + * + * * def get_nthreads(): # <<<<<<<<<<<<<< * """Get the number of threads that Blosc uses internally for compression and * decompression.""" */ - __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_get_nthreads, 116, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 116, __pyx_L1_error) + __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_get_nthreads, 113, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 113, __pyx_L1_error) - /* "numcodecs/blosc.pyx":122 - * - * + /* "numcodecs/blosc.pyx":119 + * + * * def set_nthreads(int nthreads): # <<<<<<<<<<<<<< * """Set the number of threads that Blosc uses internally for compression and * decompression.""" */ - __pyx_tuple__12 = PyTuple_Pack(2, __pyx_n_s_nthreads, __pyx_n_s_nthreads); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__12); - __Pyx_GIVEREF(__pyx_tuple__12); - __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_set_nthreads, 122, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 122, __pyx_L1_error) + __pyx_tuple__17 = PyTuple_Pack(2, __pyx_n_s_nthreads, __pyx_n_s_nthreads); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__17); + __Pyx_GIVEREF(__pyx_tuple__17); + __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_set_nthreads, 119, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 119, __pyx_L1_error) - /* "numcodecs/blosc.pyx":128 - * - * + /* "numcodecs/blosc.pyx":125 + * + * * def cbuffer_sizes(source): # <<<<<<<<<<<<<< * """Return information about a compressed buffer, namely the number of uncompressed * bytes (`nbytes`) and compressed (`cbytes`). It also returns the `blocksize` (which */ - __pyx_tuple__14 = PyTuple_Pack(5, __pyx_n_s_source, __pyx_n_s_buffer, __pyx_n_s_nbytes, __pyx_n_s_cbytes, __pyx_n_s_blocksize); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__14); - __Pyx_GIVEREF(__pyx_tuple__14); - __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_cbuffer_sizes, 128, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 128, __pyx_L1_error) + __pyx_tuple__19 = PyTuple_Pack(5, __pyx_n_s_source, __pyx_n_s_buffer, __pyx_n_s_nbytes, __pyx_n_s_cbytes, __pyx_n_s_blocksize); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__19); + __Pyx_GIVEREF(__pyx_tuple__19); + __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_cbuffer_sizes, 125, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 125, __pyx_L1_error) - /* "numcodecs/blosc.pyx":156 - * - * + /* "numcodecs/blosc.pyx":153 + * + * * def cbuffer_complib(source): # <<<<<<<<<<<<<< * """Return the name of the compression library used to compress `source`.""" * cdef: */ - __pyx_tuple__16 = PyTuple_Pack(3, __pyx_n_s_source, __pyx_n_s_buffer, __pyx_n_s_complib); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__16); - __Pyx_GIVEREF(__pyx_tuple__16); - __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_cbuffer_complib, 156, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 156, __pyx_L1_error) + __pyx_tuple__21 = PyTuple_Pack(3, __pyx_n_s_source, __pyx_n_s_buffer, __pyx_n_s_complib); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 153, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__21); + __Pyx_GIVEREF(__pyx_tuple__21); + __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_cbuffer_complib, 153, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 153, __pyx_L1_error) - /* "numcodecs/blosc.pyx":176 - * - * + /* "numcodecs/blosc.pyx":173 + * + * * def cbuffer_metainfo(source): # <<<<<<<<<<<<<< * """Return some meta-information about the compressed buffer in `source`, including * the typesize, whether the shuffle or bit-shuffle filters were used, and the */ - __pyx_tuple__18 = PyTuple_Pack(6, __pyx_n_s_source, __pyx_n_s_buffer, __pyx_n_s_typesize, __pyx_n_s_flags, __pyx_n_s_shuffle, __pyx_n_s_memcpyed); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 176, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__18); - __Pyx_GIVEREF(__pyx_tuple__18); - __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_cbuffer_metainfo, 176, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 176, __pyx_L1_error) + __pyx_tuple__23 = PyTuple_Pack(6, __pyx_n_s_source, __pyx_n_s_buffer, __pyx_n_s_typesize, __pyx_n_s_flags, __pyx_n_s_shuffle, __pyx_n_s_memcpyed); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__23); + __Pyx_GIVEREF(__pyx_tuple__23); + __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_cbuffer_metainfo, 173, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 173, __pyx_L1_error) - /* "numcodecs/blosc.pyx":214 - * - * + /* "numcodecs/blosc.pyx":211 + * + * * def err_bad_cname(cname): # <<<<<<<<<<<<<< * raise ValueError('bad compressor or compressor not supported: %r; expected one of ' * '%s' % (cname, list_compressors())) */ - __pyx_tuple__20 = PyTuple_Pack(1, __pyx_n_s_cname); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__20); - __Pyx_GIVEREF(__pyx_tuple__20); - __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_err_bad_cname, 214, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 214, __pyx_L1_error) + __pyx_tuple__25 = PyTuple_Pack(1, __pyx_n_s_cname); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 211, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__25); + __Pyx_GIVEREF(__pyx_tuple__25); + __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_err_bad_cname, 211, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 211, __pyx_L1_error) - /* "numcodecs/blosc.pyx":219 - * - * + /* "numcodecs/blosc.pyx":216 + * + * * def compress(source, char* cname, int clevel, int shuffle=SHUFFLE, # <<<<<<<<<<<<<< * int blocksize=AUTOBLOCKS): * """Compress data. */ - __pyx_tuple__22 = PyTuple_Pack(14, __pyx_n_s_source, __pyx_n_s_cname, __pyx_n_s_clevel, __pyx_n_s_shuffle, __pyx_n_s_blocksize, __pyx_n_s_source_ptr, __pyx_n_s_dest_ptr, __pyx_n_s_source_buffer, __pyx_n_s_nbytes, __pyx_n_s_cbytes, __pyx_n_s_itemsize, __pyx_n_s_dest, __pyx_n_s_cname_str, __pyx_n_s_compressor_set); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 219, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__22); - __Pyx_GIVEREF(__pyx_tuple__22); - __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(5, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_compress, 219, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 219, __pyx_L1_error) + __pyx_tuple__27 = PyTuple_Pack(14, __pyx_n_s_source, __pyx_n_s_cname, __pyx_n_s_clevel, __pyx_n_s_shuffle, __pyx_n_s_blocksize, __pyx_n_s_source_ptr, __pyx_n_s_dest_ptr, __pyx_n_s_source_buffer, __pyx_n_s_nbytes, __pyx_n_s_itemsize, __pyx_n_s_cbytes, __pyx_n_s_dest, __pyx_n_s_cname_str, __pyx_n_s_compressor_set); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 216, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__27); + __Pyx_GIVEREF(__pyx_tuple__27); + __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(5, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_compress, 216, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 216, __pyx_L1_error) - /* "numcodecs/blosc.pyx":329 - * - * + /* "numcodecs/blosc.pyx":327 + * + * * def decompress(source, dest=None): # <<<<<<<<<<<<<< * """Decompress data. - * + * */ - __pyx_tuple__24 = PyTuple_Pack(11, __pyx_n_s_source, __pyx_n_s_dest, __pyx_n_s_ret, __pyx_n_s_source_ptr, __pyx_n_s_dest_ptr, __pyx_n_s_source_buffer, __pyx_n_s_dest_buffer, __pyx_n_s_nbytes, __pyx_n_s_cbytes, __pyx_n_s_blocksize, __pyx_n_s_dest_nbytes); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 329, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__24); - __Pyx_GIVEREF(__pyx_tuple__24); - __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(2, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_decompress, 329, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 329, __pyx_L1_error) + __pyx_tuple__29 = PyTuple_Pack(11, __pyx_n_s_source, __pyx_n_s_dest, __pyx_n_s_ret, __pyx_n_s_source_ptr, __pyx_n_s_dest_ptr, __pyx_n_s_source_buffer, __pyx_n_s_dest_buffer, __pyx_n_s_nbytes, __pyx_n_s_cbytes, __pyx_n_s_blocksize, __pyx_n_s_dest_nbytes); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 327, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__29); + __Pyx_GIVEREF(__pyx_tuple__29); + __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(2, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_decompress, 327, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 327, __pyx_L1_error) - /* "numcodecs/blosc.pyx":407 - * - * + /* "numcodecs/blosc.pyx":405 + * + * * def _get_use_threads(): # <<<<<<<<<<<<<< * global use_threads * proc = multiprocessing.current_process() */ - __pyx_tuple__26 = PyTuple_Pack(2, __pyx_n_s_proc, __pyx_n_s_use_threads_2); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 407, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__26); - __Pyx_GIVEREF(__pyx_tuple__26); - __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_get_use_threads, 407, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 407, __pyx_L1_error) + __pyx_tuple__31 = PyTuple_Pack(2, __pyx_n_s_proc, __pyx_n_s_use_threads_2); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 405, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__31); + __Pyx_GIVEREF(__pyx_tuple__31); + __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_get_use_threads, 405, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 405, __pyx_L1_error) - /* "numcodecs/blosc.pyx":476 + /* "numcodecs/blosc.pyx":470 * AUTOSHUFFLE = AUTOSHUFFLE - * + * * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): # <<<<<<<<<<<<<< * self.cname = cname * if isinstance(cname, text_type): */ - __pyx_tuple__28 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_cname, __pyx_n_s_clevel, __pyx_n_s_shuffle, __pyx_n_s_blocksize); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 476, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__28); - __Pyx_GIVEREF(__pyx_tuple__28); - __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_init_2, 476, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 476, __pyx_L1_error) + __pyx_tuple__33 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_cname, __pyx_n_s_clevel, __pyx_n_s_shuffle, __pyx_n_s_blocksize); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 470, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__33); + __Pyx_GIVEREF(__pyx_tuple__33); + __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_init_2, 470, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 470, __pyx_L1_error) - /* "numcodecs/blosc.pyx":486 + /* "numcodecs/blosc.pyx":480 * self.blocksize = blocksize - * + * * def encode(self, buf): # <<<<<<<<<<<<<< * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) - * + * */ - __pyx_tuple__30 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_buf); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 486, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__30); - __Pyx_GIVEREF(__pyx_tuple__30); - __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_encode, 486, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 486, __pyx_L1_error) + __pyx_tuple__35 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_buf); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 480, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__35); + __Pyx_GIVEREF(__pyx_tuple__35); + __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_encode, 480, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 480, __pyx_L1_error) - /* "numcodecs/blosc.pyx":489 + /* "numcodecs/blosc.pyx":483 * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) - * + * * def decode(self, buf, out=None): # <<<<<<<<<<<<<< * return decompress(buf, out) - * + * */ - __pyx_tuple__32 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_buf, __pyx_n_s_out); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 489, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__32); - __Pyx_GIVEREF(__pyx_tuple__32); - __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_decode, 489, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 489, __pyx_L1_error) - __pyx_tuple__34 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 489, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__34); - __Pyx_GIVEREF(__pyx_tuple__34); + __pyx_tuple__37 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_buf, __pyx_n_s_out); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 483, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__37); + __Pyx_GIVEREF(__pyx_tuple__37); + __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_decode, 483, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 483, __pyx_L1_error) + __pyx_tuple__39 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 483, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__39); + __Pyx_GIVEREF(__pyx_tuple__39); - /* "numcodecs/blosc.pyx":492 + /* "numcodecs/blosc.pyx":486 * return decompress(buf, out) - * + * * def __repr__(self): # <<<<<<<<<<<<<< * r = '%s(cname=%r, clevel=%r, shuffle=%s, blocksize=%s)' % \ * (type(self).__name__, */ - __pyx_tuple__35 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_r); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__35); - __Pyx_GIVEREF(__pyx_tuple__35); - __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_repr, 492, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 492, __pyx_L1_error) + __pyx_tuple__40 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_r); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__40); + __Pyx_GIVEREF(__pyx_tuple__40); + __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_repr, 486, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 486, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -6174,7 +6949,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { return -1; } -static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { +static int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) @@ -6185,13 +6960,13 @@ static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { return -1; } -static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ +static int __Pyx_modinit_global_init_code(void); /*proto*/ +static int __Pyx_modinit_variable_export_code(void); /*proto*/ +static int __Pyx_modinit_function_export_code(void); /*proto*/ +static int __Pyx_modinit_type_init_code(void); /*proto*/ +static int __Pyx_modinit_type_import_code(void); /*proto*/ +static int __Pyx_modinit_variable_import_code(void); /*proto*/ +static int __Pyx_modinit_function_import_code(void); /*proto*/ static int __Pyx_modinit_global_init_code(void) { __Pyx_RefNannyDeclarations @@ -6227,30 +7002,23 @@ static int __Pyx_modinit_type_init_code(void) { static int __Pyx_modinit_type_import_code(void) { __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); /*--- Type import code ---*/ - __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 sizeof(PyTypeObject), #else sizeof(PyHeapTypeObject), #endif - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(1, 9, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyImport_ImportModule("numcodecs.compat_ext"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_9numcodecs_10compat_ext_Buffer = __Pyx_ImportType(__pyx_t_1, "numcodecs.compat_ext", "Buffer", sizeof(struct __pyx_obj_9numcodecs_10compat_ext_Buffer), __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_9numcodecs_10compat_ext_Buffer) __PYX_ERR(2, 4, __pyx_L1_error) - __pyx_vtabptr_9numcodecs_10compat_ext_Buffer = (struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer*)__Pyx_GetVtable(__pyx_ptype_9numcodecs_10compat_ext_Buffer->tp_dict); if (unlikely(!__pyx_vtabptr_9numcodecs_10compat_ext_Buffer)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) __PYX_ERR(2, 9, __pyx_L1_error) + __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) __PYX_ERR(3, 8, __pyx_L1_error) + __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) __PYX_ERR(4, 15, __pyx_L1_error) + __pyx_ptype_7cpython_5array_array = __Pyx_ImportType("array", "array", sizeof(arrayobject), 0); if (unlikely(!__pyx_ptype_7cpython_5array_array)) __PYX_ERR(1, 58, __pyx_L1_error) + __pyx_ptype_9numcodecs_10compat_ext_Buffer = __Pyx_ImportType("numcodecs.compat_ext", "Buffer", sizeof(struct __pyx_obj_9numcodecs_10compat_ext_Buffer), 1); if (unlikely(!__pyx_ptype_9numcodecs_10compat_ext_Buffer)) __PYX_ERR(5, 5, __pyx_L1_error) + __pyx_vtabptr_9numcodecs_10compat_ext_Buffer = (struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer*)__Pyx_GetVtable(__pyx_ptype_9numcodecs_10compat_ext_Buffer->tp_dict); if (unlikely(!__pyx_vtabptr_9numcodecs_10compat_ext_Buffer)) __PYX_ERR(5, 5, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_RefNannyFinishContext(); return -1; } @@ -6285,6 +7053,15 @@ static int __Pyx_modinit_function_import_code(void) { #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC #endif #endif +#ifndef CYTHON_SMALL_CODE +#if defined(__clang__) + #define CYTHON_SMALL_CODE +#elif defined(__GNUC__) + #define CYTHON_SMALL_CODE __attribute__((optimize("Os"))) +#else + #define CYTHON_SMALL_CODE +#endif +#endif #if PY_MAJOR_VERSION < 3 @@ -6297,30 +7074,7 @@ __Pyx_PyMODINIT_FUNC PyInit_blosc(void) { return PyModuleDef_Init(&__pyx_moduledef); } -static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { - #if PY_VERSION_HEX >= 0x030700A1 - static PY_INT64_T main_interpreter_id = -1; - PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); - if (main_interpreter_id == -1) { - main_interpreter_id = current_id; - return (unlikely(current_id == -1)) ? -1 : 0; - } else if (unlikely(main_interpreter_id != current_id)) - #else - static PyInterpreterState *main_interpreter = NULL; - PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; - if (!main_interpreter) { - main_interpreter = current_interpreter; - } else if (unlikely(main_interpreter != current_interpreter)) - #endif - { - PyErr_SetString( - PyExc_ImportError, - "Interpreter change detected - this module can only be loaded into one interpreter per process."); - return -1; - } - return 0; -} -static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name) { +static int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name) { PyObject *value = PyObject_GetAttrString(spec, from_name); int result = 0; if (likely(value)) { @@ -6333,10 +7087,8 @@ static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject } return result; } -static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { +static PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { PyObject *module = NULL, *moddict, *modname; - if (__Pyx_check_single_interpreter()) - return NULL; if (__pyx_m) return __Pyx_NewRef(__pyx_m); modname = PyObject_GetAttrString(spec, "name"); @@ -6357,7 +7109,7 @@ static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNU } -static CYTHON_SMALL_CODE int __pyx_pymod_exec_blosc(PyObject *__pyx_pyinit_module) +static int __pyx_pymod_exec_blosc(PyObject *__pyx_pyinit_module) #endif #endif { @@ -6365,20 +7117,13 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec_blosc(PyObject *__pyx_pyinit_modul PyObject *__pyx_t_2 = NULL; int __pyx_t_3; int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; + int __pyx_t_5; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_8 = NULL; __Pyx_RefNannyDeclarations #if CYTHON_PEP489_MULTI_PHASE_INIT - if (__pyx_m) { - if (__pyx_m == __pyx_pyinit_module) return 0; - PyErr_SetString(PyExc_RuntimeError, "Module 'blosc' has already been imported. Re-initialisation is not supported."); - return -1; - } + if (__pyx_m && __pyx_m == __pyx_pyinit_module) return 0; #elif PY_MAJOR_VERSION >= 3 if (__pyx_m) return __Pyx_NewRef(__pyx_m); #endif @@ -6393,9 +7138,6 @@ if (!__Pyx_RefNanny) { #endif __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_blosc(void)", 0); if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pxy_PyFrame_Initialize_Offsets - __Pxy_PyFrame_Initialize_Offsets(); - #endif __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) @@ -6450,7 +7192,7 @@ if (!__Pyx_RefNanny) { if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif if (__pyx_module_is_main_numcodecs__blosc) { - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) } #if PY_MAJOR_VERSION >= 3 { @@ -6477,67 +7219,67 @@ if (!__Pyx_RefNanny) { if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif - /* "numcodecs/blosc.pyx":8 - * # cython: language_level=2 + /* "numcodecs/blosc.pyx":7 + * # cython: binding=False * from __future__ import absolute_import, print_function, division * import threading # <<<<<<<<<<<<<< * import multiprocessing * import os */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_threading, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error) + __pyx_t_1 = __Pyx_Import(__pyx_n_s_threading, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_threading, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_threading, __pyx_t_1) < 0) __PYX_ERR(0, 7, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":9 + /* "numcodecs/blosc.pyx":8 * from __future__ import absolute_import, print_function, division * import threading * import multiprocessing # <<<<<<<<<<<<<< * import os - * + * */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_multiprocessing, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error) + __pyx_t_1 = __Pyx_Import(__pyx_n_s_multiprocessing, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_multiprocessing, __pyx_t_1) < 0) __PYX_ERR(0, 9, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_multiprocessing, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":10 + /* "numcodecs/blosc.pyx":9 * import threading * import multiprocessing * import os # <<<<<<<<<<<<<< - * - * + * + * */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_os, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error) + __pyx_t_1 = __Pyx_Import(__pyx_n_s_os, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_1) < 0) __PYX_ERR(0, 10, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_1) < 0) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":18 - * + /* "numcodecs/blosc.pyx":17 + * * from .compat_ext cimport Buffer * from .compat_ext import Buffer # <<<<<<<<<<<<<< * from .compat import PY2, text_type * from .abc import Codec */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_Buffer); __Pyx_GIVEREF(__pyx_n_s_Buffer); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Buffer); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_compat_ext, __pyx_t_1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error) + __pyx_t_2 = __Pyx_Import(__pyx_n_s_compat_ext, __pyx_t_1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":19 + /* "numcodecs/blosc.pyx":18 * from .compat_ext cimport Buffer * from .compat_ext import Buffer * from .compat import PY2, text_type # <<<<<<<<<<<<<< * from .abc import Codec - * + * */ - __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) + __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_PY2); __Pyx_GIVEREF(__pyx_n_s_PY2); @@ -6545,163 +7287,163 @@ if (!__Pyx_RefNanny) { __Pyx_INCREF(__pyx_n_s_text_type); __Pyx_GIVEREF(__pyx_n_s_text_type); PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_text_type); - __pyx_t_1 = __Pyx_Import(__pyx_n_s_compat, __pyx_t_2, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error) + __pyx_t_1 = __Pyx_Import(__pyx_n_s_compat, __pyx_t_2, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_PY2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_PY2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_PY2, __pyx_t_2) < 0) __PYX_ERR(0, 19, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_PY2, __pyx_t_2) < 0) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_text_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_text_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_text_type, __pyx_t_2) < 0) __PYX_ERR(0, 19, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_text_type, __pyx_t_2) < 0) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":20 + /* "numcodecs/blosc.pyx":19 * from .compat_ext import Buffer * from .compat import PY2, text_type * from .abc import Codec # <<<<<<<<<<<<<< - * - * + * + * */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_Codec); __Pyx_GIVEREF(__pyx_n_s_Codec); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Codec); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_abc, __pyx_t_1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) + __pyx_t_2 = __Pyx_Import(__pyx_n_s_abc, __pyx_t_1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Codec); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Codec); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_Codec, __pyx_t_1) < 0) __PYX_ERR(0, 20, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Codec, __pyx_t_1) < 0) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":61 - * - * + /* "numcodecs/blosc.pyx":60 + * + * * MAX_OVERHEAD = BLOSC_MAX_OVERHEAD # <<<<<<<<<<<<<< * MAX_BUFFERSIZE = BLOSC_MAX_BUFFERSIZE * MAX_THREADS = BLOSC_MAX_THREADS */ - __pyx_t_2 = __Pyx_PyInt_From_int(BLOSC_MAX_OVERHEAD); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(BLOSC_MAX_OVERHEAD); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_OVERHEAD, __pyx_t_2) < 0) __PYX_ERR(0, 61, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_OVERHEAD, __pyx_t_2) < 0) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":62 - * + /* "numcodecs/blosc.pyx":61 + * * MAX_OVERHEAD = BLOSC_MAX_OVERHEAD * MAX_BUFFERSIZE = BLOSC_MAX_BUFFERSIZE # <<<<<<<<<<<<<< * MAX_THREADS = BLOSC_MAX_THREADS * MAX_TYPESIZE = BLOSC_MAX_TYPESIZE */ - __pyx_t_2 = __Pyx_PyInt_From_int(BLOSC_MAX_BUFFERSIZE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(BLOSC_MAX_BUFFERSIZE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_BUFFERSIZE, __pyx_t_2) < 0) __PYX_ERR(0, 62, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_BUFFERSIZE, __pyx_t_2) < 0) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":63 + /* "numcodecs/blosc.pyx":62 * MAX_OVERHEAD = BLOSC_MAX_OVERHEAD * MAX_BUFFERSIZE = BLOSC_MAX_BUFFERSIZE * MAX_THREADS = BLOSC_MAX_THREADS # <<<<<<<<<<<<<< * MAX_TYPESIZE = BLOSC_MAX_TYPESIZE * VERSION_STRING = BLOSC_VERSION_STRING */ - __pyx_t_2 = __Pyx_PyInt_From_int(BLOSC_MAX_THREADS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 63, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(BLOSC_MAX_THREADS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_THREADS, __pyx_t_2) < 0) __PYX_ERR(0, 63, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_THREADS, __pyx_t_2) < 0) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":64 + /* "numcodecs/blosc.pyx":63 * MAX_BUFFERSIZE = BLOSC_MAX_BUFFERSIZE * MAX_THREADS = BLOSC_MAX_THREADS * MAX_TYPESIZE = BLOSC_MAX_TYPESIZE # <<<<<<<<<<<<<< * VERSION_STRING = BLOSC_VERSION_STRING * VERSION_DATE = BLOSC_VERSION_DATE */ - __pyx_t_2 = __Pyx_PyInt_From_int(BLOSC_MAX_TYPESIZE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(BLOSC_MAX_TYPESIZE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_TYPESIZE, __pyx_t_2) < 0) __PYX_ERR(0, 64, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_TYPESIZE, __pyx_t_2) < 0) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":65 + /* "numcodecs/blosc.pyx":64 * MAX_THREADS = BLOSC_MAX_THREADS * MAX_TYPESIZE = BLOSC_MAX_TYPESIZE * VERSION_STRING = BLOSC_VERSION_STRING # <<<<<<<<<<<<<< * VERSION_DATE = BLOSC_VERSION_DATE * if not PY2: */ - __pyx_t_2 = __Pyx_PyBytes_FromString(((char *)BLOSC_VERSION_STRING)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_FromString(((char *)BLOSC_VERSION_STRING)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_VERSION_STRING, __pyx_t_2) < 0) __PYX_ERR(0, 65, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_VERSION_STRING, __pyx_t_2) < 0) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":66 + /* "numcodecs/blosc.pyx":65 * MAX_TYPESIZE = BLOSC_MAX_TYPESIZE * VERSION_STRING = BLOSC_VERSION_STRING * VERSION_DATE = BLOSC_VERSION_DATE # <<<<<<<<<<<<<< * if not PY2: * VERSION_STRING = VERSION_STRING.decode() */ - __pyx_t_2 = __Pyx_PyBytes_FromString(((char *)BLOSC_VERSION_DATE)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_FromString(((char *)BLOSC_VERSION_DATE)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_VERSION_DATE, __pyx_t_2) < 0) __PYX_ERR(0, 66, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_VERSION_DATE, __pyx_t_2) < 0) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":67 + /* "numcodecs/blosc.pyx":66 * VERSION_STRING = BLOSC_VERSION_STRING * VERSION_DATE = BLOSC_VERSION_DATE * if not PY2: # <<<<<<<<<<<<<< * VERSION_STRING = VERSION_STRING.decode() * VERSION_DATE = VERSION_DATE.decode() */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PY2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 67, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_PY2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 67, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = ((!__pyx_t_3) != 0); if (__pyx_t_4) { - /* "numcodecs/blosc.pyx":68 + /* "numcodecs/blosc.pyx":67 * VERSION_DATE = BLOSC_VERSION_DATE * if not PY2: * VERSION_STRING = VERSION_STRING.decode() # <<<<<<<<<<<<<< * VERSION_DATE = VERSION_DATE.decode() * __version__ = VERSION_STRING */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_VERSION_STRING); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_VERSION_STRING); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_decode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_decode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_VERSION_STRING, __pyx_t_2) < 0) __PYX_ERR(0, 68, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_VERSION_STRING, __pyx_t_2) < 0) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":69 + /* "numcodecs/blosc.pyx":68 * if not PY2: * VERSION_STRING = VERSION_STRING.decode() * VERSION_DATE = VERSION_DATE.decode() # <<<<<<<<<<<<<< * __version__ = VERSION_STRING * NOSHUFFLE = BLOSC_NOSHUFFLE */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_VERSION_DATE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_VERSION_DATE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_decode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_decode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_VERSION_DATE, __pyx_t_2) < 0) __PYX_ERR(0, 69, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_VERSION_DATE, __pyx_t_2) < 0) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":67 + /* "numcodecs/blosc.pyx":66 * VERSION_STRING = BLOSC_VERSION_STRING * VERSION_DATE = BLOSC_VERSION_DATE * if not PY2: # <<<<<<<<<<<<<< @@ -6710,565 +7452,482 @@ if (!__Pyx_RefNanny) { */ } - /* "numcodecs/blosc.pyx":70 + /* "numcodecs/blosc.pyx":69 * VERSION_STRING = VERSION_STRING.decode() * VERSION_DATE = VERSION_DATE.decode() * __version__ = VERSION_STRING # <<<<<<<<<<<<<< * NOSHUFFLE = BLOSC_NOSHUFFLE * SHUFFLE = BLOSC_SHUFFLE */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_VERSION_STRING); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_VERSION_STRING); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_version, __pyx_t_2) < 0) __PYX_ERR(0, 70, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_version, __pyx_t_2) < 0) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":71 + /* "numcodecs/blosc.pyx":70 * VERSION_DATE = VERSION_DATE.decode() * __version__ = VERSION_STRING * NOSHUFFLE = BLOSC_NOSHUFFLE # <<<<<<<<<<<<<< * SHUFFLE = BLOSC_SHUFFLE * BITSHUFFLE = BLOSC_BITSHUFFLE */ - __pyx_t_2 = __Pyx_PyInt_From_int(BLOSC_NOSHUFFLE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 71, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(BLOSC_NOSHUFFLE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_NOSHUFFLE, __pyx_t_2) < 0) __PYX_ERR(0, 71, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_NOSHUFFLE, __pyx_t_2) < 0) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":72 + /* "numcodecs/blosc.pyx":71 * __version__ = VERSION_STRING * NOSHUFFLE = BLOSC_NOSHUFFLE * SHUFFLE = BLOSC_SHUFFLE # <<<<<<<<<<<<<< * BITSHUFFLE = BLOSC_BITSHUFFLE * # automatic shuffle */ - __pyx_t_2 = __Pyx_PyInt_From_int(BLOSC_SHUFFLE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(BLOSC_SHUFFLE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_SHUFFLE, __pyx_t_2) < 0) __PYX_ERR(0, 72, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_SHUFFLE, __pyx_t_2) < 0) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":73 + /* "numcodecs/blosc.pyx":72 * NOSHUFFLE = BLOSC_NOSHUFFLE * SHUFFLE = BLOSC_SHUFFLE * BITSHUFFLE = BLOSC_BITSHUFFLE # <<<<<<<<<<<<<< * # automatic shuffle * AUTOSHUFFLE = -1 */ - __pyx_t_2 = __Pyx_PyInt_From_int(BLOSC_BITSHUFFLE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(BLOSC_BITSHUFFLE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_BITSHUFFLE, __pyx_t_2) < 0) __PYX_ERR(0, 73, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_BITSHUFFLE, __pyx_t_2) < 0) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":75 + /* "numcodecs/blosc.pyx":74 * BITSHUFFLE = BLOSC_BITSHUFFLE * # automatic shuffle * AUTOSHUFFLE = -1 # <<<<<<<<<<<<<< * # automatic block size - let blosc decide * AUTOBLOCKS = 0 */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_AUTOSHUFFLE, __pyx_int_neg_1) < 0) __PYX_ERR(0, 75, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_AUTOSHUFFLE, __pyx_int_neg_1) < 0) __PYX_ERR(0, 74, __pyx_L1_error) - /* "numcodecs/blosc.pyx":77 + /* "numcodecs/blosc.pyx":76 * AUTOSHUFFLE = -1 * # automatic block size - let blosc decide * AUTOBLOCKS = 0 # <<<<<<<<<<<<<< - * + * * # synchronization */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_AUTOBLOCKS, __pyx_int_0) < 0) __PYX_ERR(0, 77, __pyx_L1_error) - - /* "numcodecs/blosc.pyx":80 - * - * # synchronization - * try: # <<<<<<<<<<<<<< - * mutex = multiprocessing.Lock() - * except OSError: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_5); - __Pyx_XGOTREF(__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_7); - /*try:*/ { - - /* "numcodecs/blosc.pyx":81 - * # synchronization - * try: - * mutex = multiprocessing.Lock() # <<<<<<<<<<<<<< - * except OSError: - * mutex = None - */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_multiprocessing); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Lock); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_mutex, __pyx_t_2) < 0) __PYX_ERR(0, 81, __pyx_L3_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_AUTOBLOCKS, __pyx_int_0) < 0) __PYX_ERR(0, 76, __pyx_L1_error) - /* "numcodecs/blosc.pyx":80 - * + /* "numcodecs/blosc.pyx":79 + * * # synchronization - * try: # <<<<<<<<<<<<<< - * mutex = multiprocessing.Lock() - * except OSError: + * mutex = multiprocessing.Lock() # <<<<<<<<<<<<<< + * + * */ - } - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L8_try_end; - __pyx_L3_error:; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "numcodecs/blosc.pyx":82 - * try: - * mutex = multiprocessing.Lock() - * except OSError: # <<<<<<<<<<<<<< - * mutex = None - * - */ - __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_OSError); - if (__pyx_t_8) { - __Pyx_AddTraceback("numcodecs.blosc", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_9) < 0) __PYX_ERR(0, 82, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_9); - - /* "numcodecs/blosc.pyx":83 - * mutex = multiprocessing.Lock() - * except OSError: - * mutex = None # <<<<<<<<<<<<<< - * - * # store ID of process that first loads the module, so we can detect a fork later - */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_mutex, Py_None) < 0) __PYX_ERR(0, 83, __pyx_L5_except_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L4_exception_handled; - } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; - - /* "numcodecs/blosc.pyx":80 - * - * # synchronization - * try: # <<<<<<<<<<<<<< - * mutex = multiprocessing.Lock() - * except OSError: - */ - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); - goto __pyx_L1_error; - __pyx_L4_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); - __pyx_L8_try_end:; - } + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_multiprocessing); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Lock); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_mutex, __pyx_t_2) < 0) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":86 - * + /* "numcodecs/blosc.pyx":83 + * * # store ID of process that first loads the module, so we can detect a fork later * _importer_pid = os.getpid() # <<<<<<<<<<<<<< - * - * + * + * */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_os); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_getpid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_getpid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_importer_pid, __pyx_t_9) < 0) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_importer_pid, __pyx_t_2) < 0) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":89 - * - * + /* "numcodecs/blosc.pyx":86 + * + * * def init(): # <<<<<<<<<<<<<< * """Initialize the Blosc library environment.""" * blosc_init() */ - __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_1init, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_init, __pyx_t_9) < 0) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_1init, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":94 - * - * + /* "numcodecs/blosc.pyx":91 + * + * * def destroy(): # <<<<<<<<<<<<<< * """Destroy the Blosc library environment.""" * blosc_destroy() */ - __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_3destroy, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 94, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_destroy, __pyx_t_9) < 0) __PYX_ERR(0, 94, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_3destroy, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_destroy, __pyx_t_2) < 0) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":99 - * - * + /* "numcodecs/blosc.pyx":96 + * + * * def compname_to_compcode(cname): # <<<<<<<<<<<<<< * """Return the compressor code associated with the compressor name. If the compressor * name is not recognized, or there is not support for it in this build, -1 is returned */ - __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5compname_to_compcode, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_compname_to_compcode, __pyx_t_9) < 0) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5compname_to_compcode, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_compname_to_compcode, __pyx_t_2) < 0) __PYX_ERR(0, 96, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":108 - * - * + /* "numcodecs/blosc.pyx":105 + * + * * def list_compressors(): # <<<<<<<<<<<<<< * """Get a list of compressors supported in the current build.""" * s = blosc_list_compressors() */ - __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_7list_compressors, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 108, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_list_compressors, __pyx_t_9) < 0) __PYX_ERR(0, 108, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_7list_compressors, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 105, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_list_compressors, __pyx_t_2) < 0) __PYX_ERR(0, 105, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":116 - * - * + /* "numcodecs/blosc.pyx":113 + * + * * def get_nthreads(): # <<<<<<<<<<<<<< * """Get the number of threads that Blosc uses internally for compression and * decompression.""" */ - __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_9get_nthreads, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_nthreads, __pyx_t_9) < 0) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_9get_nthreads, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_nthreads, __pyx_t_2) < 0) __PYX_ERR(0, 113, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":122 - * - * + /* "numcodecs/blosc.pyx":119 + * + * * def set_nthreads(int nthreads): # <<<<<<<<<<<<<< * """Set the number of threads that Blosc uses internally for compression and * decompression.""" */ - __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_11set_nthreads, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_nthreads, __pyx_t_9) < 0) __PYX_ERR(0, 122, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_11set_nthreads, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_nthreads, __pyx_t_2) < 0) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":128 - * - * + /* "numcodecs/blosc.pyx":125 + * + * * def cbuffer_sizes(source): # <<<<<<<<<<<<<< * """Return information about a compressed buffer, namely the number of uncompressed * bytes (`nbytes`) and compressed (`cbytes`). It also returns the `blocksize` (which */ - __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_13cbuffer_sizes, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_cbuffer_sizes, __pyx_t_9) < 0) __PYX_ERR(0, 128, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_13cbuffer_sizes, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_cbuffer_sizes, __pyx_t_2) < 0) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":156 - * - * + /* "numcodecs/blosc.pyx":153 + * + * * def cbuffer_complib(source): # <<<<<<<<<<<<<< * """Return the name of the compression library used to compress `source`.""" * cdef: */ - __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_15cbuffer_complib, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_cbuffer_complib, __pyx_t_9) < 0) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_15cbuffer_complib, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_cbuffer_complib, __pyx_t_2) < 0) __PYX_ERR(0, 153, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":176 - * - * + /* "numcodecs/blosc.pyx":173 + * + * * def cbuffer_metainfo(source): # <<<<<<<<<<<<<< * """Return some meta-information about the compressed buffer in `source`, including * the typesize, whether the shuffle or bit-shuffle filters were used, and the */ - __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_17cbuffer_metainfo, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 176, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_cbuffer_metainfo, __pyx_t_9) < 0) __PYX_ERR(0, 176, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_17cbuffer_metainfo, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_cbuffer_metainfo, __pyx_t_2) < 0) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":214 - * - * + /* "numcodecs/blosc.pyx":211 + * + * * def err_bad_cname(cname): # <<<<<<<<<<<<<< * raise ValueError('bad compressor or compressor not supported: %r; expected one of ' * '%s' % (cname, list_compressors())) */ - __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_19err_bad_cname, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_err_bad_cname, __pyx_t_9) < 0) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_19err_bad_cname, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 211, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_err_bad_cname, __pyx_t_2) < 0) __PYX_ERR(0, 211, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":219 - * - * + /* "numcodecs/blosc.pyx":216 + * + * * def compress(source, char* cname, int clevel, int shuffle=SHUFFLE, # <<<<<<<<<<<<<< * int blocksize=AUTOBLOCKS): * """Compress data. */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_SHUFFLE); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 219, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_9); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 219, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_k__2 = __pyx_t_8; + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_SHUFFLE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_k__6 = __pyx_t_5; - /* "numcodecs/blosc.pyx":220 - * + /* "numcodecs/blosc.pyx":217 + * * def compress(source, char* cname, int clevel, int shuffle=SHUFFLE, * int blocksize=AUTOBLOCKS): # <<<<<<<<<<<<<< * """Compress data. - * + * */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_AUTOBLOCKS); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_9); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_k__3 = __pyx_t_8; + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_AUTOBLOCKS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 217, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 217, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_k__7 = __pyx_t_5; - /* "numcodecs/blosc.pyx":219 - * - * + /* "numcodecs/blosc.pyx":216 + * + * * def compress(source, char* cname, int clevel, int shuffle=SHUFFLE, # <<<<<<<<<<<<<< * int blocksize=AUTOBLOCKS): * """Compress data. */ - __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_21compress, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 219, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_compress, __pyx_t_9) < 0) __PYX_ERR(0, 219, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_21compress, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_compress, __pyx_t_2) < 0) __PYX_ERR(0, 216, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":329 - * - * + /* "numcodecs/blosc.pyx":327 + * + * * def decompress(source, dest=None): # <<<<<<<<<<<<<< * """Decompress data. - * + * */ - __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_23decompress, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 329, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_decompress, __pyx_t_9) < 0) __PYX_ERR(0, 329, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_23decompress, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 327, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_decompress, __pyx_t_2) < 0) __PYX_ERR(0, 327, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":404 + /* "numcodecs/blosc.pyx":402 * # set the value of this variable to True or False to override the * # default adaptive behaviour * use_threads = None # <<<<<<<<<<<<<< - * - * + * + * */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_use_threads, Py_None) < 0) __PYX_ERR(0, 404, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_use_threads, Py_None) < 0) __PYX_ERR(0, 402, __pyx_L1_error) - /* "numcodecs/blosc.pyx":407 - * - * + /* "numcodecs/blosc.pyx":405 + * + * * def _get_use_threads(): # <<<<<<<<<<<<<< * global use_threads * proc = multiprocessing.current_process() */ - __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_25_get_use_threads, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 407, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_use_threads, __pyx_t_9) < 0) __PYX_ERR(0, 407, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_25_get_use_threads, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 405, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_use_threads, __pyx_t_2) < 0) __PYX_ERR(0, 405, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":443 - * - * + /* "numcodecs/blosc.pyx":437 + * + * * _shuffle_repr = ['AUTOSHUFFLE', 'NOSHUFFLE', 'SHUFFLE', 'BITSHUFFLE'] # <<<<<<<<<<<<<< - * - * + * + * */ - __pyx_t_9 = PyList_New(4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 443, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); + __pyx_t_2 = PyList_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 437, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_AUTOSHUFFLE); __Pyx_GIVEREF(__pyx_n_s_AUTOSHUFFLE); - PyList_SET_ITEM(__pyx_t_9, 0, __pyx_n_s_AUTOSHUFFLE); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_AUTOSHUFFLE); __Pyx_INCREF(__pyx_n_s_NOSHUFFLE); __Pyx_GIVEREF(__pyx_n_s_NOSHUFFLE); - PyList_SET_ITEM(__pyx_t_9, 1, __pyx_n_s_NOSHUFFLE); + PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_NOSHUFFLE); __Pyx_INCREF(__pyx_n_s_SHUFFLE); __Pyx_GIVEREF(__pyx_n_s_SHUFFLE); - PyList_SET_ITEM(__pyx_t_9, 2, __pyx_n_s_SHUFFLE); + PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_SHUFFLE); __Pyx_INCREF(__pyx_n_s_BITSHUFFLE); __Pyx_GIVEREF(__pyx_n_s_BITSHUFFLE); - PyList_SET_ITEM(__pyx_t_9, 3, __pyx_n_s_BITSHUFFLE); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_shuffle_repr, __pyx_t_9) < 0) __PYX_ERR(0, 443, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_s_BITSHUFFLE); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_shuffle_repr, __pyx_t_2) < 0) __PYX_ERR(0, 437, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":446 - * - * + /* "numcodecs/blosc.pyx":440 + * + * * class Blosc(Codec): # <<<<<<<<<<<<<< * """Codec providing compression using the Blosc meta-compressor. - * + * */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_Codec); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 446, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 446, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Codec); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 440, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 440, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 446, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_9, __pyx_t_1, __pyx_n_s_Blosc, __pyx_n_s_Blosc, (PyObject *) NULL, __pyx_n_s_numcodecs_blosc, __pyx_kp_s_Codec_providing_compression_usin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 446, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 440, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_Blosc, __pyx_n_s_Blosc, (PyObject *) NULL, __pyx_n_s_numcodecs_blosc, __pyx_kp_s_Codec_providing_compression_usin); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 440, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); - /* "numcodecs/blosc.pyx":470 + /* "numcodecs/blosc.pyx":464 * """ - * + * * codec_id = 'blosc' # <<<<<<<<<<<<<< * NOSHUFFLE = NOSHUFFLE * SHUFFLE = SHUFFLE */ - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_codec_id, __pyx_n_s_blosc) < 0) __PYX_ERR(0, 470, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_codec_id, __pyx_n_s_blosc) < 0) __PYX_ERR(0, 464, __pyx_L1_error) - /* "numcodecs/blosc.pyx":471 - * + /* "numcodecs/blosc.pyx":465 + * * codec_id = 'blosc' * NOSHUFFLE = NOSHUFFLE # <<<<<<<<<<<<<< * SHUFFLE = SHUFFLE * BITSHUFFLE = BITSHUFFLE */ - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_NOSHUFFLE); - if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 471, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_NOSHUFFLE, __pyx_t_10) < 0) __PYX_ERR(0, 471, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_NOSHUFFLE); + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 465, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_NOSHUFFLE, __pyx_t_7) < 0) __PYX_ERR(0, 465, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/blosc.pyx":472 + /* "numcodecs/blosc.pyx":466 * codec_id = 'blosc' * NOSHUFFLE = NOSHUFFLE * SHUFFLE = SHUFFLE # <<<<<<<<<<<<<< * BITSHUFFLE = BITSHUFFLE * AUTOSHUFFLE = AUTOSHUFFLE */ - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_SHUFFLE); - if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 472, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_SHUFFLE, __pyx_t_10) < 0) __PYX_ERR(0, 472, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_SHUFFLE); + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 466, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_SHUFFLE, __pyx_t_7) < 0) __PYX_ERR(0, 466, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/blosc.pyx":473 + /* "numcodecs/blosc.pyx":467 * NOSHUFFLE = NOSHUFFLE * SHUFFLE = SHUFFLE * BITSHUFFLE = BITSHUFFLE # <<<<<<<<<<<<<< * AUTOSHUFFLE = AUTOSHUFFLE - * + * */ - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_BITSHUFFLE); - if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 473, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_BITSHUFFLE, __pyx_t_10) < 0) __PYX_ERR(0, 473, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_BITSHUFFLE); + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 467, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_BITSHUFFLE, __pyx_t_7) < 0) __PYX_ERR(0, 467, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/blosc.pyx":474 + /* "numcodecs/blosc.pyx":468 * SHUFFLE = SHUFFLE * BITSHUFFLE = BITSHUFFLE * AUTOSHUFFLE = AUTOSHUFFLE # <<<<<<<<<<<<<< - * + * * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): */ - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_AUTOSHUFFLE); - if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 474, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_AUTOSHUFFLE, __pyx_t_10) < 0) __PYX_ERR(0, 474, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_AUTOSHUFFLE); + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 468, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_AUTOSHUFFLE, __pyx_t_7) < 0) __PYX_ERR(0, 468, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/blosc.pyx":476 + /* "numcodecs/blosc.pyx":470 * AUTOSHUFFLE = AUTOSHUFFLE - * + * * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): # <<<<<<<<<<<<<< * self.cname = cname * if isinstance(cname, text_type): */ - __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5Blosc_1__init__, 0, __pyx_n_s_Blosc___init, NULL, __pyx_n_s_numcodecs_blosc, __pyx_d, ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 476, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (!__Pyx_CyFunction_InitDefaults(__pyx_t_10, sizeof(__pyx_defaults), 2)) __PYX_ERR(0, 476, __pyx_L1_error) - __pyx_t_11 = PyObject_GetItem(__pyx_t_2, __pyx_n_s_SHUFFLE); - if (unlikely(!__pyx_t_11)) { + __pyx_t_7 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5Blosc_1__init__, 0, __pyx_n_s_Blosc___init, NULL, __pyx_n_s_numcodecs_blosc, __pyx_d, ((PyObject *)__pyx_codeobj__34)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 470, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (!__Pyx_CyFunction_InitDefaults(__pyx_t_7, sizeof(__pyx_defaults), 2)) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_t_8 = PyObject_GetItem(__pyx_t_6, __pyx_n_s_SHUFFLE); + if (unlikely(!__pyx_t_8)) { PyErr_Clear(); - __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_SHUFFLE); + __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_SHUFFLE); } - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 476, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_10)->__pyx_arg_shuffle = __pyx_t_11; - __Pyx_GIVEREF(__pyx_t_11); - __pyx_t_11 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_AUTOBLOCKS); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 476, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_10)->__pyx_arg_blocksize = __pyx_t_11; - __Pyx_GIVEREF(__pyx_t_11); - __pyx_t_11 = 0; - __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_10, __pyx_pf_9numcodecs_5blosc_26__defaults__); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init_2, __pyx_t_10) < 0) __PYX_ERR(0, 476, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 470, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_7)->__pyx_arg_shuffle = __pyx_t_8; + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_AUTOBLOCKS); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 470, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_7)->__pyx_arg_blocksize = __pyx_t_8; + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_8 = 0; + __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_7, __pyx_pf_9numcodecs_5blosc_26__defaults__); + if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_init_2, __pyx_t_7) < 0) __PYX_ERR(0, 470, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/blosc.pyx":486 + /* "numcodecs/blosc.pyx":480 * self.blocksize = blocksize - * + * * def encode(self, buf): # <<<<<<<<<<<<<< * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) - * + * */ - __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5Blosc_3encode, 0, __pyx_n_s_Blosc_encode, NULL, __pyx_n_s_numcodecs_blosc, __pyx_d, ((PyObject *)__pyx_codeobj__31)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 486, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_encode, __pyx_t_10) < 0) __PYX_ERR(0, 486, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_7 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5Blosc_3encode, 0, __pyx_n_s_Blosc_encode, NULL, __pyx_n_s_numcodecs_blosc, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 480, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_encode, __pyx_t_7) < 0) __PYX_ERR(0, 480, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/blosc.pyx":489 + /* "numcodecs/blosc.pyx":483 * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) - * + * * def decode(self, buf, out=None): # <<<<<<<<<<<<<< * return decompress(buf, out) - * + * */ - __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5Blosc_5decode, 0, __pyx_n_s_Blosc_decode, NULL, __pyx_n_s_numcodecs_blosc, __pyx_d, ((PyObject *)__pyx_codeobj__33)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 489, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_10, __pyx_tuple__34); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_decode, __pyx_t_10) < 0) __PYX_ERR(0, 489, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_7 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5Blosc_5decode, 0, __pyx_n_s_Blosc_decode, NULL, __pyx_n_s_numcodecs_blosc, __pyx_d, ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 483, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__39); + if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_decode, __pyx_t_7) < 0) __PYX_ERR(0, 483, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/blosc.pyx":492 + /* "numcodecs/blosc.pyx":486 * return decompress(buf, out) - * + * * def __repr__(self): # <<<<<<<<<<<<<< * r = '%s(cname=%r, clevel=%r, shuffle=%s, blocksize=%s)' % \ * (type(self).__name__, */ - __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5Blosc_7__repr__, 0, __pyx_n_s_Blosc___repr, NULL, __pyx_n_s_numcodecs_blosc, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_repr, __pyx_t_10) < 0) __PYX_ERR(0, 492, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_7 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5Blosc_7__repr__, 0, __pyx_n_s_Blosc___repr, NULL, __pyx_n_s_numcodecs_blosc, __pyx_d, ((PyObject *)__pyx_codeobj__41)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_repr, __pyx_t_7) < 0) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/blosc.pyx":446 - * - * + /* "numcodecs/blosc.pyx":440 + * + * * class Blosc(Codec): # <<<<<<<<<<<<<< * """Codec providing compression using the Blosc meta-compressor. - * + * */ - __pyx_t_10 = __Pyx_Py3ClassCreate(__pyx_t_9, __pyx_n_s_Blosc, __pyx_t_1, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 446, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_Blosc, __pyx_t_10) < 0) __PYX_ERR(0, 446, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_7 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_Blosc, __pyx_t_1, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 440, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Blosc, __pyx_t_7) < 0) __PYX_ERR(0, 440, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "numcodecs/blosc.pyx":1 @@ -7281,20 +7940,28 @@ if (!__Pyx_RefNanny) { if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /* "array.pxd":161 + * return extend_buffer(self, other.data.as_chars, Py_SIZE(other)) + * + * cdef inline void zero(array self): # <<<<<<<<<<<<<< + * """ set all elements of array to zero. """ + * memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize) + */ + /*--- Wrapped vars code ---*/ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); if (__pyx_m) { if (__pyx_d) { - __Pyx_AddTraceback("init numcodecs.blosc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("init numcodecs.blosc", 0, __pyx_lineno, __pyx_filename); } - Py_CLEAR(__pyx_m); + Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init numcodecs.blosc"); } @@ -7315,9 +7982,9 @@ if (!__Pyx_RefNanny) { static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; - m = PyImport_ImportModule(modname); + m = PyImport_ImportModule((char *)modname); if (!m) goto end; - p = PyObject_GetAttrString(m, "RefNannyAPI"); + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: @@ -7356,49 +8023,61 @@ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { } /* GetModuleGlobalName */ -#if CYTHON_USE_DICT_VERSIONS -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) -#else -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) -#endif -{ +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { PyObject *result; #if !CYTHON_AVOID_BORROWED_REFS #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) if (likely(result)) { - return __Pyx_NewRef(result); + Py_INCREF(result); } else if (unlikely(PyErr_Occurred())) { - return NULL; - } + result = NULL; + } else { #else result = PyDict_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) if (likely(result)) { - return __Pyx_NewRef(result); - } + Py_INCREF(result); + } else { #endif #else result = PyObject_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } - PyErr_Clear(); + if (!result) { + PyErr_Clear(); #endif - return __Pyx_GetBuiltinName(name); + result = __Pyx_GetBuiltinName(name); + } + return result; +} + +/* PyObjectCall */ + #if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *result; + ternaryfunc call = func->ob_type->tp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = (*call)(func, arg, kw); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; } +#endif /* PyCFunctionFastCall */ -#if CYTHON_FAST_PYCCALL + #if CYTHON_FAST_PYCCALL static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { PyCFunctionObject *func = (PyCFunctionObject*)func_obj; PyCFunction meth = PyCFunction_GET_FUNCTION(func); PyObject *self = PyCFunction_GET_SELF(func); int flags = PyCFunction_GET_FLAGS(func); assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); + assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS))); assert(nargs >= 0); assert(nargs == 0 || args != NULL); /* _PyCFunction_FastCallDict() must not be called with an exception set, @@ -7406,15 +8085,16 @@ static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, P caller loses its exception */ assert(!PyErr_Occurred()); if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { - return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); + return (*((__Pyx_PyCFunctionFastWithKeywords)meth)) (self, args, nargs, NULL); } else { - return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); + return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs); } } #endif /* PyFunctionFastCall */ -#if CYTHON_FAST_PYCALL + #if CYTHON_FAST_PYCALL +#include "frameobject.h" static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, PyObject *globals) { PyFrameObject *f; @@ -7432,7 +8112,7 @@ static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args if (f == NULL) { return NULL; } - fastlocals = __Pyx_PyFrame_GetLocalsplus(f); + fastlocals = f->f_localsplus; for (i = 0; i < na; i++) { Py_INCREF(*args); fastlocals[i] = *args++; @@ -7532,57 +8212,8 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #endif #endif -/* PyObjectCall */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = func->ob_type->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCall2Args */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { - PyObject *args, *result = NULL; - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyFunction_FastCall(function, args, 2); - } - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyCFunction_FastCall(function, args, 2); - } - #endif - args = PyTuple_New(2); - if (unlikely(!args)) goto done; - Py_INCREF(arg1); - PyTuple_SET_ITEM(args, 0, arg1); - Py_INCREF(arg2); - PyTuple_SET_ITEM(args, 1, arg2); - Py_INCREF(function); - result = __Pyx_PyObject_Call(function, args, NULL); - Py_DECREF(args); - Py_DECREF(function); -done: - return result; -} - /* PyObjectCallMethO */ -#if CYTHON_COMPILING_IN_CPYTHON + #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { PyObject *self, *result; PyCFunction cfunc; @@ -7602,7 +8233,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject #endif /* PyObjectCallOneArg */ -#if CYTHON_COMPILING_IN_CPYTHON + #if CYTHON_COMPILING_IN_CPYTHON static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { PyObject *result; PyObject *args = PyTuple_New(1); @@ -7642,7 +8273,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObjec #endif /* PyObjectCallNoArg */ -#if CYTHON_COMPILING_IN_CPYTHON + #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { #if CYTHON_FAST_PYCALL if (PyFunction_Check(func)) { @@ -7650,11 +8281,10 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { } #endif #ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func))) + if (likely(PyCFunction_Check(func) || __Pyx_TypeCheck(func, __pyx_CyFunctionType))) { #else - if (likely(PyCFunction_Check(func))) + if (likely(PyCFunction_Check(func))) { #endif - { if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { return __Pyx_PyObject_CallMethO(func, NULL); } @@ -7664,7 +8294,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { #endif /* PyErrFetchRestore */ -#if CYTHON_FAST_THREAD_STATE + #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; tmp_type = tstate->curexc_type; @@ -7688,7 +8318,7 @@ static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject #endif /* RaiseException */ -#if PY_MAJOR_VERSION < 3 + #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { __Pyx_PyThreadState_declare @@ -7847,7 +8477,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject #endif /* RaiseArgTupleInvalid */ -static void __Pyx_RaiseArgtupleInvalid( + static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, @@ -7873,7 +8503,7 @@ static void __Pyx_RaiseArgtupleInvalid( } /* RaiseDoubleKeywords */ -static void __Pyx_RaiseDoubleKeywordsError( + static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { @@ -7887,7 +8517,7 @@ static void __Pyx_RaiseDoubleKeywordsError( } /* ParseKeywords */ -static int __Pyx_ParseOptionalKeywords( + static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, @@ -7989,7 +8619,7 @@ static int __Pyx_ParseOptionalKeywords( } /* decode_c_string */ -static CYTHON_INLINE PyObject* __Pyx_decode_c_string( + static CYTHON_INLINE PyObject* __Pyx_decode_c_string( const char* cstring, Py_ssize_t start, Py_ssize_t stop, const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { @@ -8021,29 +8651,13 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_string( } } -/* GetTopmostException */ -#if CYTHON_USE_EXC_INFO_STACK -static _PyErr_StackItem * -__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) -{ - _PyErr_StackItem *exc_info = tstate->exc_info; - while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) && - exc_info->previous_item != NULL) - { - exc_info = exc_info->previous_item; - } - return exc_info; -} -#endif - /* SaveResetException */ -#if CYTHON_FAST_THREAD_STATE + #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - #if CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); - *type = exc_info->exc_type; - *value = exc_info->exc_value; - *tb = exc_info->exc_traceback; + #if PY_VERSION_HEX >= 0x030700A2 + *type = tstate->exc_state.exc_type; + *value = tstate->exc_state.exc_value; + *tb = tstate->exc_state.exc_traceback; #else *type = tstate->exc_type; *value = tstate->exc_value; @@ -8055,14 +8669,13 @@ static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject * } static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; - #if CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = type; - exc_info->exc_value = value; - exc_info->exc_traceback = tb; + #if PY_VERSION_HEX >= 0x030700A2 + tmp_type = tstate->exc_state.exc_type; + tmp_value = tstate->exc_state.exc_value; + tmp_tb = tstate->exc_state.exc_traceback; + tstate->exc_state.exc_type = type; + tstate->exc_state.exc_value = value; + tstate->exc_state.exc_traceback = tb; #else tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; @@ -8078,12 +8691,11 @@ static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject #endif /* GetException */ -#if CYTHON_FAST_THREAD_STATE -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) + #if CYTHON_FAST_THREAD_STATE +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { #else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { #endif -{ PyObject *local_type, *local_value, *local_tb; #if CYTHON_FAST_THREAD_STATE PyObject *tmp_type, *tmp_value, *tmp_tb; @@ -8116,16 +8728,13 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) *value = local_value; *tb = local_tb; #if CYTHON_FAST_THREAD_STATE - #if CYTHON_USE_EXC_INFO_STACK - { - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = local_type; - exc_info->exc_value = local_value; - exc_info->exc_traceback = local_tb; - } + #if PY_VERSION_HEX >= 0x030700A2 + tmp_type = tstate->exc_state.exc_type; + tmp_value = tstate->exc_state.exc_value; + tmp_tb = tstate->exc_state.exc_traceback; + tstate->exc_state.exc_type = local_type; + tstate->exc_state.exc_value = local_value; + tstate->exc_state.exc_traceback = local_tb; #else tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; @@ -8152,17 +8761,16 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) } /* SwapException */ -#if CYTHON_FAST_THREAD_STATE + #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; - #if CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = *type; - exc_info->exc_value = *value; - exc_info->exc_traceback = *tb; + #if PY_VERSION_HEX >= 0x030700A2 + tmp_type = tstate->exc_state.exc_type; + tmp_value = tstate->exc_state.exc_value; + tmp_tb = tstate->exc_state.exc_traceback; + tstate->exc_state.exc_type = *type; + tstate->exc_state.exc_value = *value; + tstate->exc_state.exc_traceback = *tb; #else tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; @@ -8187,7 +8795,7 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, #endif /* BytesEquals */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { + static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { #if CYTHON_COMPILING_IN_PYPY return PyObject_RichCompareBool(s1, s2, equals); #else @@ -8234,7 +8842,7 @@ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int eq } /* UnicodeEquals */ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { + static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { #if CYTHON_COMPILING_IN_PYPY return PyObject_RichCompareBool(s1, s2, equals); #else @@ -8313,9 +8921,6 @@ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int } else { int result; PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif if (!py_result) return -1; result = __Pyx_PyObject_IsTrue(py_result); @@ -8336,7 +8941,7 @@ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int } /* GetAttr */ -static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { + static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { #if CYTHON_USE_TYPE_SLOTS #if PY_MAJOR_VERSION >= 3 if (likely(PyUnicode_Check(n))) @@ -8349,7 +8954,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { } /* HasAttr */ -static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { + static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { PyObject *r; if (unlikely(!__Pyx_PyBaseString_Check(n))) { PyErr_SetString(PyExc_TypeError, @@ -8367,7 +8972,7 @@ static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { } /* PyObjectSetAttrStr */ -#if CYTHON_USE_TYPE_SLOTS + #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { PyTypeObject* tp = Py_TYPE(obj); if (likely(tp->tp_setattro)) @@ -8381,7 +8986,7 @@ static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr #endif /* PyIntBinop */ -#if !CYTHON_COMPILING_IN_PYPY + #if !CYTHON_COMPILING_IN_PYPY static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) { #if PY_MAJOR_VERSION < 3 if (likely(PyInt_CheckExact(op1))) { @@ -8485,8 +9090,8 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED llx = lla + llb; return PyLong_FromLongLong(llx); #endif - - + + } #endif if (PyFloat_CheckExact(op1)) { @@ -8503,7 +9108,7 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED #endif /* GetItemInt */ -static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; r = PyObject_GetItem(o, j); @@ -8518,7 +9123,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_ if (wraparound & unlikely(i < 0)) { wrapped_i += PyList_GET_SIZE(o); } - if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { + if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyList_GET_SIZE(o)))) { PyObject *r = PyList_GET_ITEM(o, wrapped_i); Py_INCREF(r); return r; @@ -8536,7 +9141,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize if (wraparound & unlikely(i < 0)) { wrapped_i += PyTuple_GET_SIZE(o); } - if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { + if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); Py_INCREF(r); return r; @@ -8552,7 +9157,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS if (is_list || PyList_CheckExact(o)) { Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); - if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { + if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) { PyObject *r = PyList_GET_ITEM(o, n); Py_INCREF(r); return r; @@ -8560,7 +9165,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, } else if (PyTuple_CheckExact(o)) { Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { + if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, n); Py_INCREF(r); return r; @@ -8590,7 +9195,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, } /* ObjectGetItem */ -#if CYTHON_USE_TYPE_SLOTS + #if CYTHON_USE_TYPE_SLOTS static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) { PyObject *runerr; Py_ssize_t key_value; @@ -8618,69 +9223,8 @@ static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { } #endif -/* TypeImport */ -#ifndef __PYX_HAVE_RT_ImportType -#define __PYX_HAVE_RT_ImportType -static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name, - size_t size, enum __Pyx_ImportType_CheckSize check_size) -{ - PyObject *result = 0; - char warning[200]; - Py_ssize_t basicsize; -#ifdef Py_LIMITED_API - PyObject *py_basicsize; -#endif - result = PyObject_GetAttrString(module, class_name); - if (!result) - goto bad; - if (!PyType_Check(result)) { - PyErr_Format(PyExc_TypeError, - "%.200s.%.200s is not a type object", - module_name, class_name); - goto bad; - } -#ifndef Py_LIMITED_API - basicsize = ((PyTypeObject *)result)->tp_basicsize; -#else - py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); - if (!py_basicsize) - goto bad; - basicsize = PyLong_AsSsize_t(py_basicsize); - Py_DECREF(py_basicsize); - py_basicsize = 0; - if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) - goto bad; -#endif - if ((size_t)basicsize < size) { - PyErr_Format(PyExc_ValueError, - "%.200s.%.200s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); - goto bad; - } - if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) { - PyErr_Format(PyExc_ValueError, - "%.200s.%.200s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); - goto bad; - } - else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), - "%s.%s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); - if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; - } - return (PyTypeObject *)result; -bad: - Py_XDECREF(result); - return NULL; -} -#endif - /* GetVTable */ -static void* __Pyx_GetVtable(PyObject *dict) { + static void* __Pyx_GetVtable(PyObject *dict) { void* ptr; PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable); if (!ob) @@ -8700,7 +9244,7 @@ static void* __Pyx_GetVtable(PyObject *dict) { } /* Import */ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; @@ -8747,7 +9291,7 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, (PyObject *)NULL); + name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( @@ -8765,7 +9309,7 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { } /* ImportFrom */ -static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { + static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_Format(PyExc_ImportError, @@ -8778,33 +9322,8 @@ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { return value; } -/* PyErrExceptionMatches */ -#if CYTHON_FAST_THREAD_STATE -static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; icurexc_type; - if (exc_type == err) return 1; - if (unlikely(!exc_type)) return 0; - if (unlikely(PyTuple_Check(err))) - return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); - return __Pyx_PyErr_GivenExceptionMatches(exc_type, err); -} -#endif - /* CalculateMetaclass */ -static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { + static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases); for (i=0; i < nbases; i++) { PyTypeObject *tmptype; @@ -8843,7 +9362,7 @@ static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bas } /* FetchCommonType */ -static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { + static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { PyObject* fake_module; PyTypeObject* cached_type = NULL; fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI); @@ -8882,7 +9401,7 @@ static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { } /* CythonFunction */ -#include + #include static PyObject * __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) { @@ -8904,7 +9423,7 @@ __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure return op->func_doc; } static int -__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value) { PyObject *tmp = op->func_doc; if (value == NULL) { @@ -8916,7 +9435,7 @@ __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNU return 0; } static PyObject * -__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op) { if (unlikely(op->func_name == NULL)) { #if PY_MAJOR_VERSION >= 3 @@ -8931,15 +9450,14 @@ __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *contex return op->func_name; } static int -__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value) { PyObject *tmp; #if PY_MAJOR_VERSION >= 3 - if (unlikely(value == NULL || !PyUnicode_Check(value))) + if (unlikely(value == NULL || !PyUnicode_Check(value))) { #else - if (unlikely(value == NULL || !PyString_Check(value))) + if (unlikely(value == NULL || !PyString_Check(value))) { #endif - { PyErr_SetString(PyExc_TypeError, "__name__ must be set to a string object"); return -1; @@ -8951,21 +9469,20 @@ __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UN return 0; } static PyObject * -__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op) { Py_INCREF(op->func_qualname); return op->func_qualname; } static int -__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value) { PyObject *tmp; #if PY_MAJOR_VERSION >= 3 - if (unlikely(value == NULL || !PyUnicode_Check(value))) + if (unlikely(value == NULL || !PyUnicode_Check(value))) { #else - if (unlikely(value == NULL || !PyString_Check(value))) + if (unlikely(value == NULL || !PyString_Check(value))) { #endif - { PyErr_SetString(PyExc_TypeError, "__qualname__ must be set to a string object"); return -1; @@ -8987,7 +9504,7 @@ __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure return self; } static PyObject * -__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op) { if (unlikely(op->func_dict == NULL)) { op->func_dict = PyDict_New(); @@ -8998,7 +9515,7 @@ __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *contex return op->func_dict; } static int -__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value) { PyObject *tmp; if (unlikely(value == NULL)) { @@ -9018,19 +9535,19 @@ __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UN return 0; } static PyObject * -__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op) { Py_INCREF(op->func_globals); return op->func_globals; } static PyObject * -__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op) { Py_INCREF(Py_None); return Py_None; } static PyObject * -__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op) { PyObject* result = (op->func_code) ? op->func_code : Py_None; Py_INCREF(result); @@ -9059,7 +9576,7 @@ __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { return result; } static int -__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { +__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) { PyObject* tmp; if (!value) { value = Py_None; @@ -9075,7 +9592,7 @@ __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHO return 0; } static PyObject * -__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) { PyObject* result = op->defaults_tuple; if (unlikely(!result)) { if (op->defaults_getter) { @@ -9089,7 +9606,7 @@ __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *co return result; } static int -__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { +__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) { PyObject* tmp; if (!value) { value = Py_None; @@ -9105,7 +9622,7 @@ __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYT return 0; } static PyObject * -__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) { PyObject* result = op->defaults_kwdict; if (unlikely(!result)) { if (op->defaults_getter) { @@ -9119,7 +9636,7 @@ __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void * return result; } static int -__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { +__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) { PyObject* tmp; if (!value || value == Py_None) { value = NULL; @@ -9135,7 +9652,7 @@ __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CY return 0; } static PyObject * -__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) { PyObject* result = op->func_annotations; if (unlikely(!result)) { result = PyDict_New(); @@ -9315,7 +9832,7 @@ static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, Py return (*meth)(self, arg); break; case METH_VARARGS | METH_KEYWORDS: - return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw); + return (*(PyCFunctionWithKeywords)meth)(self, arg, kw); case METH_NOARGS: if (likely(kw == NULL || PyDict_Size(kw) == 0)) { size = PyTuple_GET_SIZE(arg); @@ -9478,7 +9995,7 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, Py } /* Py3ClassCreate */ -static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, + static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) { PyObject *ns; if (metaclass) { @@ -9545,23 +10062,18 @@ static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObj } /* CLineInTraceback */ -#ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { + #ifndef CYTHON_CLINE_IN_TRACEBACK +static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) { PyObject *use_cline; PyObject *ptype, *pvalue, *ptraceback; #if CYTHON_COMPILING_IN_CPYTHON PyObject **cython_runtime_dict; #endif - if (unlikely(!__pyx_cython_runtime)) { - return c_line; - } __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); #if CYTHON_COMPILING_IN_CPYTHON cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); if (likely(cython_runtime_dict)) { - __PYX_PY_DICT_LOOKUP_IF_MODIFIED( - use_cline, *cython_runtime_dict, - __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback)) + use_cline = __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback); } else #endif { @@ -9578,7 +10090,7 @@ static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { c_line = 0; 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)) { + else if (PyObject_Not(use_cline) != 0) { c_line = 0; } __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); @@ -9587,7 +10099,7 @@ static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { #endif /* CodeObjectCache */ -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; @@ -9667,7 +10179,7 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { } /* AddTraceback */ -#include "compile.h" + #include "compile.h" #include "frameobject.h" #include "traceback.h" static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( @@ -9752,8 +10264,8 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { - const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0; + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { + const int neg_one = (int) -1, const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(int) < sizeof(long)) { @@ -9783,7 +10295,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { } /* CIntFromPyVerify */ -#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ + #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) @@ -9805,8 +10317,8 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { } /* CIntFromPy */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { - const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0; + static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { + const int neg_one = (int) -1, const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -9994,8 +10506,8 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { } /* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { - const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { + const long neg_one = (long) -1, const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(long) < sizeof(long)) { @@ -10025,8 +10537,8 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { } /* CIntFromPy */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { - const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; + static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { + const long neg_one = (long) -1, const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -10214,7 +10726,7 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { } /* FastTypeChecks */ -#if CYTHON_COMPILING_IN_CPYTHON + #if CYTHON_COMPILING_IN_CPYTHON static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { while (a) { a = a->tp_base; @@ -10269,42 +10781,14 @@ static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, return res; } #endif -static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - assert(PyExceptionClass_Check(exc_type)); - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; itp_basicsize; +#else + py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); + if (!py_basicsize) + goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; +#endif + if (!strict && (size_t)basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd", + module_name, class_name, basicsize, size); + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + } + else if ((size_t)basicsize != size) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd", + module_name, class_name, basicsize, size); + goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(py_module); + Py_XDECREF(result); + return NULL; +} +#endif + /* InitStrings */ -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { @@ -10439,13 +11006,6 @@ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } -static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { - int retval; - if (unlikely(!x)) return -1; - retval = __Pyx_PyObject_IsTrue(x); - Py_DECREF(x); - return retval; -} static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { #if PY_MAJOR_VERSION >= 3 if (PyLong_Check(result)) { @@ -10523,7 +11083,7 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { if (sizeof(Py_ssize_t) >= sizeof(long)) return PyInt_AS_LONG(b); else - return PyInt_AsSsize_t(b); + return PyInt_AsSsize_t(x); } #endif if (likely(PyLong_CheckExact(b))) { @@ -10577,9 +11137,6 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_DECREF(x); return ival; } -static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { - return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); -} static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { return PyInt_FromSize_t(ival); } diff --git a/numcodecs/blosc.pyx b/numcodecs/blosc.pyx index 12f97654..28d2301c 100644 --- a/numcodecs/blosc.pyx +++ b/numcodecs/blosc.pyx @@ -248,7 +248,8 @@ def compress(source, char* cname, int clevel, int shuffle=SHUFFLE, char *source_ptr char *dest_ptr Buffer source_buffer - size_t nbytes, cbytes, itemsize + size_t nbytes, itemsize + int cbytes bytes dest # check valid cname early diff --git a/numcodecs/tests/test_blosc.py b/numcodecs/tests/test_blosc.py index 9795651e..007b3aba 100644 --- a/numcodecs/tests/test_blosc.py +++ b/numcodecs/tests/test_blosc.py @@ -230,3 +230,21 @@ def test_err_decode_object_buffer(): def test_err_encode_object_buffer(): check_err_encode_object_buffer(Blosc()) + + +def test_decompression_error_handling(): + for codec in codecs: + with pytest.raises(RuntimeError): + codec.decode(bytearray()) + with pytest.raises(RuntimeError): + codec.decode(bytearray(0)) + + +def test_compression_error_handling(): + a = np.zeros(2**31 - 1, dtype=np.int8) + # If we turn on thread support, we block on a mutex on the second codec that + # we try. + blosc.use_threads = False + for codec in codecs: + with pytest.raises(RuntimeError): + codec.encode(a) From 48582a522078b371dd77ecc5fecfeafd08964bfc Mon Sep 17 00:00:00 2001 From: Jerome Kelleher Date: Fri, 23 Nov 2018 14:47:08 +0000 Subject: [PATCH 2/7] Add a max_buffer_size attribute to codecs. --- numcodecs/abc.py | 14 + numcodecs/blosc.c | 3729 ++++++++++++++++++--------------- numcodecs/blosc.pyx | 2 + numcodecs/tests/test_blosc.py | 31 +- 4 files changed, 2084 insertions(+), 1692 deletions(-) diff --git a/numcodecs/abc.py b/numcodecs/abc.py index 3ab898f4..9b81c1c0 100644 --- a/numcodecs/abc.py +++ b/numcodecs/abc.py @@ -30,6 +30,7 @@ """ from __future__ import absolute_import, print_function, division +from numcodecs.compat import handle_datetime class Codec(object): @@ -39,6 +40,19 @@ class Codec(object): codec_id = None """Codec identifier.""" + # 2GiB limit by default. Codecs can override this in subclasses if larger + # buffers are supported. + max_buffer_size = 2**31 - 1 + """Maximum size of a buffer that can be encoded or decoded.""" + + def _check_buffer_size(self, buf): + buf = handle_datetime(buf) + bufsize = memoryview(buf).nbytes + if bufsize > self.max_buffer_size: + msg = "{} codec does not support buffers of > {} bytes".format( + self.codec_id, self.max_buffer_size) + raise ValueError(msg) + def encode(self, buf): # pragma: no cover """Encode data in `buf`. diff --git a/numcodecs/blosc.c b/numcodecs/blosc.c index c1dc8014..b6935b0e 100644 --- a/numcodecs/blosc.c +++ b/numcodecs/blosc.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.28.2 */ +/* Generated by Cython 0.29 */ /* BEGIN: Cython Metadata { @@ -36,69 +36,69 @@ "c-blosc/internal-complibs/zlib-1.2.8", "c-blosc/internal-complibs/lz4-1.8.1.2", "c-blosc/internal-complibs/zstd-1.3.4", - "c-blosc/internal-complibs/zstd-1.3.4/dll", - "c-blosc/internal-complibs/zstd-1.3.4/legacy", - "c-blosc/internal-complibs/zstd-1.3.4/common", "c-blosc/internal-complibs/zstd-1.3.4/deprecated", + "c-blosc/internal-complibs/zstd-1.3.4/dll", "c-blosc/internal-complibs/zstd-1.3.4/dictBuilder", "c-blosc/internal-complibs/zstd-1.3.4/decompress", - "c-blosc/internal-complibs/zstd-1.3.4/compress" + "c-blosc/internal-complibs/zstd-1.3.4/legacy", + "c-blosc/internal-complibs/zstd-1.3.4/compress", + "c-blosc/internal-complibs/zstd-1.3.4/common" ], "name": "numcodecs.blosc", "sources": [ "numcodecs/blosc.pyx", - "c-blosc/blosc/blosclz.c", "c-blosc/blosc/blosc.c", - "c-blosc/blosc/bitshuffle-generic.c", - "c-blosc/blosc/shuffle-generic.c", "c-blosc/blosc/shuffle.c", + "c-blosc/blosc/shuffle-generic.c", + "c-blosc/blosc/bitshuffle-generic.c", + "c-blosc/blosc/blosclz.c", "c-blosc/blosc/fastcopy.c", "c-blosc/internal-complibs/lz4-1.8.1.2/lz4hc.c", "c-blosc/internal-complibs/lz4-1.8.1.2/lz4.c", - "c-blosc/internal-complibs/snappy-1.1.1/snappy-stubs-internal.cc", + "c-blosc/internal-complibs/snappy-1.1.1/snappy-c.cc", "c-blosc/internal-complibs/snappy-1.1.1/snappy-sinksource.cc", "c-blosc/internal-complibs/snappy-1.1.1/snappy.cc", - "c-blosc/internal-complibs/snappy-1.1.1/snappy-c.cc", + "c-blosc/internal-complibs/snappy-1.1.1/snappy-stubs-internal.cc", "c-blosc/internal-complibs/zlib-1.2.8/infback.c", + "c-blosc/internal-complibs/zlib-1.2.8/uncompr.c", "c-blosc/internal-complibs/zlib-1.2.8/adler32.c", - "c-blosc/internal-complibs/zlib-1.2.8/inffast.c", + "c-blosc/internal-complibs/zlib-1.2.8/gzlib.c", + "c-blosc/internal-complibs/zlib-1.2.8/inftrees.c", + "c-blosc/internal-complibs/zlib-1.2.8/gzclose.c", + "c-blosc/internal-complibs/zlib-1.2.8/zutil.c", "c-blosc/internal-complibs/zlib-1.2.8/inflate.c", + "c-blosc/internal-complibs/zlib-1.2.8/inffast.c", + "c-blosc/internal-complibs/zlib-1.2.8/gzread.c", + "c-blosc/internal-complibs/zlib-1.2.8/compress.c", + "c-blosc/internal-complibs/zlib-1.2.8/trees.c", "c-blosc/internal-complibs/zlib-1.2.8/crc32.c", "c-blosc/internal-complibs/zlib-1.2.8/deflate.c", - "c-blosc/internal-complibs/zlib-1.2.8/trees.c", - "c-blosc/internal-complibs/zlib-1.2.8/zutil.c", "c-blosc/internal-complibs/zlib-1.2.8/gzwrite.c", - "c-blosc/internal-complibs/zlib-1.2.8/gzlib.c", - "c-blosc/internal-complibs/zlib-1.2.8/gzread.c", - "c-blosc/internal-complibs/zlib-1.2.8/gzclose.c", - "c-blosc/internal-complibs/zlib-1.2.8/uncompr.c", - "c-blosc/internal-complibs/zlib-1.2.8/inftrees.c", - "c-blosc/internal-complibs/zlib-1.2.8/compress.c", + "c-blosc/internal-complibs/zstd-1.3.4/common/xxhash.c", "c-blosc/internal-complibs/zstd-1.3.4/common/error_private.c", "c-blosc/internal-complibs/zstd-1.3.4/common/zstd_common.c", - "c-blosc/internal-complibs/zstd-1.3.4/common/entropy_common.c", "c-blosc/internal-complibs/zstd-1.3.4/common/pool.c", - "c-blosc/internal-complibs/zstd-1.3.4/common/xxhash.c", + "c-blosc/internal-complibs/zstd-1.3.4/common/entropy_common.c", "c-blosc/internal-complibs/zstd-1.3.4/common/threading.c", "c-blosc/internal-complibs/zstd-1.3.4/common/fse_decompress.c", - "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_double_fast.c", - "c-blosc/internal-complibs/zstd-1.3.4/compress/fse_compress.c", - "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_lazy.c", - "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_fast.c", - "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_compress.c", + "c-blosc/internal-complibs/zstd-1.3.4/compress/huf_compress.c", "c-blosc/internal-complibs/zstd-1.3.4/compress/zstdmt_compress.c", + "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_compress.c", + "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_fast.c", + "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_double_fast.c", "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_ldm.c", - "c-blosc/internal-complibs/zstd-1.3.4/compress/huf_compress.c", + "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_lazy.c", "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_opt.c", - "c-blosc/internal-complibs/zstd-1.3.4/decompress/huf_decompress.c", + "c-blosc/internal-complibs/zstd-1.3.4/compress/fse_compress.c", "c-blosc/internal-complibs/zstd-1.3.4/decompress/zstd_decompress.c", - "c-blosc/internal-complibs/zstd-1.3.4/dictBuilder/divsufsort.c", + "c-blosc/internal-complibs/zstd-1.3.4/decompress/huf_decompress.c", "c-blosc/internal-complibs/zstd-1.3.4/dictBuilder/cover.c", + "c-blosc/internal-complibs/zstd-1.3.4/dictBuilder/divsufsort.c", "c-blosc/internal-complibs/zstd-1.3.4/dictBuilder/zdict.c", "c-blosc/blosc/bitshuffle-sse2.c", "c-blosc/blosc/shuffle-sse2.c", - "c-blosc/blosc/bitshuffle-avx2.c", - "c-blosc/blosc/shuffle-avx2.c" + "c-blosc/blosc/shuffle-avx2.c", + "c-blosc/blosc/bitshuffle-avx2.c" ] }, "module_name": "numcodecs.blosc" @@ -112,7 +112,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_28_2" +#define CYTHON_ABI "0_29" +#define CYTHON_HEX_VERSION 0x001D00F0 #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof @@ -183,6 +184,10 @@ END: Cython Metadata */ #define CYTHON_PEP489_MULTI_PHASE_INIT 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 #elif defined(PYSTON_VERSION) #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 1 @@ -220,6 +225,10 @@ END: Cython Metadata */ #define CYTHON_PEP489_MULTI_PHASE_INIT 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 0 @@ -273,11 +282,17 @@ END: Cython Metadata */ #define CYTHON_FAST_PYCALL 1 #endif #ifndef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT (0 && PY_VERSION_HEX >= 0x03050000) + #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) #endif #ifndef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) #endif + #ifndef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1) + #endif + #ifndef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3) + #endif #endif #if !defined(CYTHON_FAST_PYCCALL) #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) @@ -413,6 +428,9 @@ END: Cython Metadata */ #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif +#ifndef METH_STACKLESS + #define METH_STACKLESS 0 +#endif #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) #ifndef METH_FASTCALL #define METH_FASTCALL 0x80 @@ -426,15 +444,40 @@ END: Cython Metadata */ #endif #if CYTHON_FAST_PYCCALL #define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS))))) + ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))))) #else #define __Pyx_PyFastCFunction_Check(func) 0 #endif +#if CYTHON_USE_DICT_VERSIONS +#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ + (version_var) = __PYX_GET_DICT_VERSION(dict);\ + (cache_var) = (value); +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ + (VAR) = __pyx_dict_cached_value;\ + } else {\ + (VAR) = __pyx_dict_cached_value = (LOOKUP);\ + __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ + }\ + } +#else +#define __PYX_GET_DICT_VERSION(dict) (0) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); +#endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) #define PyObject_Malloc(s) PyMem_Malloc(s) #define PyObject_Free(p) PyMem_Free(p) #define PyObject_Realloc(p) PyMem_Realloc(p) #endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1 + #define PyMem_RawMalloc(n) PyMem_Malloc(n) + #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) + #define PyMem_RawFree(p) PyMem_Free(p) +#endif #if CYTHON_COMPILING_IN_PYSTON #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) @@ -542,8 +585,8 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) #endif -#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) -#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) +#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) +#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) #else @@ -558,6 +601,7 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact + #define PyObject_Unicode PyObject_Str #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) @@ -698,6 +742,9 @@ typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* enc (sizeof(type) == sizeof(Py_ssize_t) &&\ (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ v == (type)PY_SSIZE_T_MAX))) ) +static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { + return (size_t) i < (size_t) limit; +} #if defined (__cplusplus) && __cplusplus >= 201103L #include #define __Pyx_sst_abs(value) std::abs(value) @@ -754,8 +801,9 @@ static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) -#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False)) +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); #define __Pyx_PySequence_Tuple(obj)\ (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) @@ -836,7 +884,7 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { if (!default_encoding) goto bad; default_encoding_c = PyBytes_AsString(default_encoding); if (!default_encoding_c) goto bad; - __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); + __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1); if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); Py_DECREF(default_encoding); @@ -862,7 +910,7 @@ static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } static PyObject *__pyx_m = NULL; static PyObject *__pyx_d; static PyObject *__pyx_b; -static PyObject *__pyx_cython_runtime; +static PyObject *__pyx_cython_runtime = NULL; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static PyObject *__pyx_empty_unicode; @@ -907,8 +955,8 @@ struct __pyx_defaults { }; /* "compat_ext.pxd":5 - * - * + * + * * cdef class Buffer: # <<<<<<<<<<<<<< * cdef: * char *ptr @@ -1007,13 +1055,24 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject static PyObject *__Pyx_GetBuiltinName(PyObject *name); /* GetModuleGlobalName.proto */ -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); - -/* PyObjectCall.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +#if CYTHON_USE_DICT_VERSIONS +#define __Pyx_GetModuleGlobalName(var, name) {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ + (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ + __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} +#define __Pyx_GetModuleGlobalNameUncached(var, name) {\ + PY_UINT64_T __pyx_dict_version;\ + PyObject *__pyx_dict_cached_value;\ + (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); #else -#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) +#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) +#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); #endif /* PyCFunctionFastCall.proto */ @@ -1032,8 +1091,30 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #else #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) #endif +#define __Pyx_BUILD_ASSERT_EXPR(cond)\ + (sizeof(char [1 - 2*!(cond)]) - 1) +#ifndef Py_MEMBER_SIZE +#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) +#endif + static size_t __pyx_pyframe_localsplus_offset = 0; + #include "frameobject.h" + #define __Pxy_PyFrame_Initialize_Offsets()\ + ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ + (void)(__pyx_pyframe_localsplus_offset = 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 + +/* PyObjectCall.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +#else +#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) #endif +/* PyObjectCall2Args.proto */ +static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); + /* PyObjectCallMethO.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); @@ -1155,6 +1236,11 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObj #define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n) #endif +/* GetTopmostException.proto */ +#if CYTHON_USE_EXC_INFO_STACK +static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); +#endif + /* SaveResetException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) @@ -1247,6 +1333,17 @@ static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* k #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) #endif +/* TypeImport.proto */ +#ifndef __PYX_HAVE_RT_ImportType_proto +#define __PYX_HAVE_RT_ImportType_proto +enum __Pyx_ImportType_CheckSize { + __Pyx_ImportType_CheckSize_Error = 0, + __Pyx_ImportType_CheckSize_Warn = 1, + __Pyx_ImportType_CheckSize_Ignore = 2 +}; +static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size); +#endif + /* GetVTable.proto */ static void* __Pyx_GetVtable(PyObject *dict); @@ -1256,6 +1353,14 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /* ImportFrom.proto */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); +/* PyErrExceptionMatches.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); +#else +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) +#endif + /* CalculateMetaclass.proto */ static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases); @@ -1308,6 +1413,7 @@ typedef struct { PyObject *func_annotations; } __pyx_CyFunctionObject; static PyTypeObject *__pyx_CyFunctionType = 0; +#define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType)) #define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\ __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code) static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml, @@ -1501,21 +1607,6 @@ static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObj /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); -/* PyIdentifierFromString.proto */ -#if !defined(__Pyx_PyIdentifier_FromString) -#if PY_MAJOR_VERSION < 3 - #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) -#else - #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) -#endif -#endif - -/* ModuleImport.proto */ -static PyObject *__Pyx_ImportModule(const char *name); - -/* TypeImport.proto */ -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); - /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); @@ -1618,12 +1709,13 @@ extern int __pyx_module_is_main_numcodecs__blosc; int __pyx_module_is_main_numcodecs__blosc = 0; /* Implementation of 'numcodecs.blosc' */ +static PyObject *__pyx_builtin_OSError; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_RuntimeError; static PyObject *__pyx_builtin_MemoryError; +static const char __pyx_k_[] = ","; static const char __pyx_k_r[] = "r"; static const char __pyx_k_s[] = "s"; -static const char __pyx_k__3[] = ","; static const char __pyx_k_os[] = "os"; static const char __pyx_k_PY2[] = "PY2"; static const char __pyx_k_abc[] = "abc"; @@ -1666,6 +1758,7 @@ static const char __pyx_k_module[] = "__module__"; static const char __pyx_k_name_2[] = "__name__"; static const char __pyx_k_nbytes[] = "nbytes"; static const char __pyx_k_source[] = "source"; +static const char __pyx_k_OSError[] = "OSError"; static const char __pyx_k_SHUFFLE[] = "SHUFFLE"; static const char __pyx_k_complib[] = "complib"; static const char __pyx_k_destroy[] = "destroy"; @@ -1730,6 +1823,7 @@ static const char __pyx_k_multiprocessing[] = "multiprocessing"; static const char __pyx_k_numcodecs_blosc[] = "numcodecs.blosc"; static const char __pyx_k_cbuffer_metainfo[] = "cbuffer_metainfo"; static const char __pyx_k_list_compressors[] = "list_compressors"; +static const char __pyx_k_check_buffer_size[] = "_check_buffer_size"; static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; static const char __pyx_k_numcodecs_blosc_pyx[] = "numcodecs/blosc.pyx"; static const char __pyx_k_compname_to_compcode[] = "compname_to_compcode"; @@ -1740,6 +1834,7 @@ static const char __pyx_k_destination_buffer_too_small_exp[] = "destination buff static const char __pyx_k_error_during_blosc_compression_d[] = "error during blosc compression: %d"; static const char __pyx_k_error_during_blosc_decompression[] = "error during blosc decompression: %d"; static const char __pyx_k_invalid_shuffle_argument_expecte[] = "invalid shuffle argument; expected -1, 0, 1 or 2, found %r"; +static PyObject *__pyx_kp_s_; static PyObject *__pyx_n_s_AUTOBLOCKS; static PyObject *__pyx_n_s_AUTOSHUFFLE; static PyObject *__pyx_n_s_BITSHUFFLE; @@ -1760,13 +1855,13 @@ static PyObject *__pyx_n_s_MainProcess; static PyObject *__pyx_n_s_MainThread; static PyObject *__pyx_n_s_MemoryError; static PyObject *__pyx_n_s_NOSHUFFLE; +static PyObject *__pyx_n_s_OSError; static PyObject *__pyx_n_s_PY2; static PyObject *__pyx_n_s_RuntimeError; static PyObject *__pyx_n_s_SHUFFLE; static PyObject *__pyx_n_s_VERSION_DATE; static PyObject *__pyx_n_s_VERSION_STRING; static PyObject *__pyx_n_s_ValueError; -static PyObject *__pyx_kp_s__3; static PyObject *__pyx_n_s_abc; static PyObject *__pyx_n_s_ascii; static PyObject *__pyx_kp_s_bad_compressor_or_compressor_not; @@ -1778,6 +1873,7 @@ static PyObject *__pyx_n_s_cbuffer_complib; static PyObject *__pyx_n_s_cbuffer_metainfo; static PyObject *__pyx_n_s_cbuffer_sizes; static PyObject *__pyx_n_s_cbytes; +static PyObject *__pyx_n_s_check_buffer_size; static PyObject *__pyx_n_s_clevel; static PyObject *__pyx_n_s_cline_in_traceback; static PyObject *__pyx_n_s_cname; @@ -1875,7 +1971,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO static PyObject *__pyx_pf_9numcodecs_5blosc_26__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_cname, PyObject *__pyx_v_clevel, PyObject *__pyx_v_shuffle, PyObject *__pyx_v_blocksize); /* proto */ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_2encode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_buf); /* proto */ -static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_4decode(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_buf, PyObject *__pyx_v_out); /* proto */ +static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_4decode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_buf, PyObject *__pyx_v_out); /* proto */ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_6__repr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info, CYTHON_UNUSED int __pyx_v_flags); /* proto */ static void __pyx_pf_7cpython_5array_5array_2__releasebuffer__(CYTHON_UNUSED arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ @@ -1883,51 +1979,46 @@ static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; static PyObject *__pyx_int_5; static PyObject *__pyx_int_neg_1; -static int __pyx_k__6; -static int __pyx_k__7; -static PyObject *__pyx_tuple_; -static PyObject *__pyx_tuple__2; +static int __pyx_k__2; +static int __pyx_k__3; static PyObject *__pyx_tuple__4; -static PyObject *__pyx_tuple__5; -static PyObject *__pyx_tuple__8; +static PyObject *__pyx_tuple__7; static PyObject *__pyx_tuple__9; static PyObject *__pyx_tuple__12; static PyObject *__pyx_tuple__14; -static PyObject *__pyx_tuple__17; -static PyObject *__pyx_tuple__19; -static PyObject *__pyx_tuple__21; -static PyObject *__pyx_tuple__23; -static PyObject *__pyx_tuple__25; -static PyObject *__pyx_tuple__27; -static PyObject *__pyx_tuple__29; -static PyObject *__pyx_tuple__31; -static PyObject *__pyx_tuple__33; +static PyObject *__pyx_tuple__16; +static PyObject *__pyx_tuple__18; +static PyObject *__pyx_tuple__20; +static PyObject *__pyx_tuple__22; +static PyObject *__pyx_tuple__24; +static PyObject *__pyx_tuple__26; +static PyObject *__pyx_tuple__28; +static PyObject *__pyx_tuple__30; +static PyObject *__pyx_tuple__32; +static PyObject *__pyx_tuple__34; static PyObject *__pyx_tuple__35; -static PyObject *__pyx_tuple__37; -static PyObject *__pyx_tuple__39; -static PyObject *__pyx_tuple__40; +static PyObject *__pyx_codeobj__5; +static PyObject *__pyx_codeobj__6; +static PyObject *__pyx_codeobj__8; static PyObject *__pyx_codeobj__10; static PyObject *__pyx_codeobj__11; static PyObject *__pyx_codeobj__13; static PyObject *__pyx_codeobj__15; -static PyObject *__pyx_codeobj__16; -static PyObject *__pyx_codeobj__18; -static PyObject *__pyx_codeobj__20; -static PyObject *__pyx_codeobj__22; -static PyObject *__pyx_codeobj__24; -static PyObject *__pyx_codeobj__26; -static PyObject *__pyx_codeobj__28; -static PyObject *__pyx_codeobj__30; -static PyObject *__pyx_codeobj__32; -static PyObject *__pyx_codeobj__34; +static PyObject *__pyx_codeobj__17; +static PyObject *__pyx_codeobj__19; +static PyObject *__pyx_codeobj__21; +static PyObject *__pyx_codeobj__23; +static PyObject *__pyx_codeobj__25; +static PyObject *__pyx_codeobj__27; +static PyObject *__pyx_codeobj__29; +static PyObject *__pyx_codeobj__31; +static PyObject *__pyx_codeobj__33; static PyObject *__pyx_codeobj__36; -static PyObject *__pyx_codeobj__38; -static PyObject *__pyx_codeobj__41; /* Late includes */ -/* "numcodecs/blosc.pyx":86 - * - * +/* "numcodecs/blosc.pyx":88 + * + * * def init(): # <<<<<<<<<<<<<< * """Initialize the Blosc library environment.""" * blosc_init() @@ -1953,18 +2044,18 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_init(CYTHON_UNUSED PyObject *__pyx_s __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("init", 0); - /* "numcodecs/blosc.pyx":88 + /* "numcodecs/blosc.pyx":90 * def init(): * """Initialize the Blosc library environment.""" * blosc_init() # <<<<<<<<<<<<<< - * - * + * + * */ blosc_init(); - /* "numcodecs/blosc.pyx":86 - * - * + /* "numcodecs/blosc.pyx":88 + * + * * def init(): # <<<<<<<<<<<<<< * """Initialize the Blosc library environment.""" * blosc_init() @@ -1977,9 +2068,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_init(CYTHON_UNUSED PyObject *__pyx_s return __pyx_r; } -/* "numcodecs/blosc.pyx":91 - * - * +/* "numcodecs/blosc.pyx":93 + * + * * def destroy(): # <<<<<<<<<<<<<< * """Destroy the Blosc library environment.""" * blosc_destroy() @@ -2005,18 +2096,18 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_2destroy(CYTHON_UNUSED PyObject *__p __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("destroy", 0); - /* "numcodecs/blosc.pyx":93 + /* "numcodecs/blosc.pyx":95 * def destroy(): * """Destroy the Blosc library environment.""" * blosc_destroy() # <<<<<<<<<<<<<< - * - * + * + * */ blosc_destroy(); - /* "numcodecs/blosc.pyx":91 - * - * + /* "numcodecs/blosc.pyx":93 + * + * * def destroy(): # <<<<<<<<<<<<<< * """Destroy the Blosc library environment.""" * blosc_destroy() @@ -2029,9 +2120,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_2destroy(CYTHON_UNUSED PyObject *__p return __pyx_r; } -/* "numcodecs/blosc.pyx":96 - * - * +/* "numcodecs/blosc.pyx":98 + * + * * def compname_to_compcode(cname): # <<<<<<<<<<<<<< * """Return the compressor code associated with the compressor name. If the compressor * name is not recognized, or there is not support for it in this build, -1 is returned @@ -2059,40 +2150,53 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_4compname_to_compcode(CYTHON_UNUSED int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; - char const *__pyx_t_5; + PyObject *__pyx_t_5 = NULL; + char const *__pyx_t_6; __Pyx_RefNannySetupContext("compname_to_compcode", 0); __Pyx_INCREF(__pyx_v_cname); - /* "numcodecs/blosc.pyx":100 + /* "numcodecs/blosc.pyx":102 * name is not recognized, or there is not support for it in this build, -1 is returned * instead.""" * if isinstance(cname, text_type): # <<<<<<<<<<<<<< * cname = cname.encode('ascii') * return blosc_compname_to_compcode(cname) */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_text_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_text_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_IsInstance(__pyx_v_cname, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 100, __pyx_L1_error) + __pyx_t_2 = PyObject_IsInstance(__pyx_v_cname, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { - /* "numcodecs/blosc.pyx":101 + /* "numcodecs/blosc.pyx":103 * instead.""" * if isinstance(cname, text_type): * cname = cname.encode('ascii') # <<<<<<<<<<<<<< * return blosc_compname_to_compcode(cname) - * + * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cname, __pyx_n_s_encode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 101, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_cname, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_cname, __pyx_t_4); - __pyx_t_4 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_n_s_ascii) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_n_s_ascii); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF_SET(__pyx_v_cname, __pyx_t_1); + __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":100 + /* "numcodecs/blosc.pyx":102 * name is not recognized, or there is not support for it in this build, -1 is returned * instead.""" * if isinstance(cname, text_type): # <<<<<<<<<<<<<< @@ -2101,24 +2205,24 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_4compname_to_compcode(CYTHON_UNUSED */ } - /* "numcodecs/blosc.pyx":102 + /* "numcodecs/blosc.pyx":104 * if isinstance(cname, text_type): * cname = cname.encode('ascii') * return blosc_compname_to_compcode(cname) # <<<<<<<<<<<<<< - * - * + * + * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_cname); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 102, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyInt_From_int(blosc_compname_to_compcode(__pyx_t_5)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 102, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_cname); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(blosc_compname_to_compcode(__pyx_t_6)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; - /* "numcodecs/blosc.pyx":96 - * - * + /* "numcodecs/blosc.pyx":98 + * + * * def compname_to_compcode(cname): # <<<<<<<<<<<<<< * """Return the compressor code associated with the compressor name. If the compressor * name is not recognized, or there is not support for it in this build, -1 is returned @@ -2128,6 +2232,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_4compname_to_compcode(CYTHON_UNUSED __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("numcodecs.blosc.compname_to_compcode", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -2137,9 +2242,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_4compname_to_compcode(CYTHON_UNUSED return __pyx_r; } -/* "numcodecs/blosc.pyx":105 - * - * +/* "numcodecs/blosc.pyx":107 + * + * * def list_compressors(): # <<<<<<<<<<<<<< * """Get a list of compressors supported in the current build.""" * s = blosc_list_compressors() @@ -2168,50 +2273,63 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_6list_compressors(CYTHON_UNUSED PyOb int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("list_compressors", 0); - /* "numcodecs/blosc.pyx":107 + /* "numcodecs/blosc.pyx":109 * def list_compressors(): * """Get a list of compressors supported in the current build.""" * s = blosc_list_compressors() # <<<<<<<<<<<<<< * if not PY2: * s = s.decode('ascii') */ - __pyx_t_1 = __Pyx_PyBytes_FromString(blosc_list_compressors()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBytes_FromString(blosc_list_compressors()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_s = __pyx_t_1; __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":108 + /* "numcodecs/blosc.pyx":110 * """Get a list of compressors supported in the current build.""" * s = blosc_list_compressors() * if not PY2: # <<<<<<<<<<<<<< * s = s.decode('ascii') * return s.split(',') */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_PY2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PY2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 108, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = ((!__pyx_t_2) != 0); if (__pyx_t_3) { - /* "numcodecs/blosc.pyx":109 + /* "numcodecs/blosc.pyx":111 * s = blosc_list_compressors() * if not PY2: * s = s.decode('ascii') # <<<<<<<<<<<<<< * return s.split(',') - * + * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_decode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 109, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_decode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_4); - __pyx_t_4 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_n_s_ascii) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_n_s_ascii); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1); + __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":108 + /* "numcodecs/blosc.pyx":110 * """Get a list of compressors supported in the current build.""" * s = blosc_list_compressors() * if not PY2: # <<<<<<<<<<<<<< @@ -2220,26 +2338,38 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_6list_compressors(CYTHON_UNUSED PyOb */ } - /* "numcodecs/blosc.pyx":110 + /* "numcodecs/blosc.pyx":112 * if not PY2: * s = s.decode('ascii') * return s.split(',') # <<<<<<<<<<<<<< - * - * + * + * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_split); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_split); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "numcodecs/blosc.pyx":105 - * - * + /* "numcodecs/blosc.pyx":107 + * + * * def list_compressors(): # <<<<<<<<<<<<<< * """Get a list of compressors supported in the current build.""" * s = blosc_list_compressors() @@ -2249,6 +2379,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_6list_compressors(CYTHON_UNUSED PyOb __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("numcodecs.blosc.list_compressors", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -2258,9 +2389,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_6list_compressors(CYTHON_UNUSED PyOb return __pyx_r; } -/* "numcodecs/blosc.pyx":113 - * - * +/* "numcodecs/blosc.pyx":115 + * + * * def get_nthreads(): # <<<<<<<<<<<<<< * """Get the number of threads that Blosc uses internally for compression and * decompression.""" @@ -2287,23 +2418,23 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_8get_nthreads(CYTHON_UNUSED PyObject PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("get_nthreads", 0); - /* "numcodecs/blosc.pyx":116 + /* "numcodecs/blosc.pyx":118 * """Get the number of threads that Blosc uses internally for compression and * decompression.""" * return blosc_get_nthreads() # <<<<<<<<<<<<<< - * - * + * + * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(blosc_get_nthreads()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(blosc_get_nthreads()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "numcodecs/blosc.pyx":113 - * - * + /* "numcodecs/blosc.pyx":115 + * + * * def get_nthreads(): # <<<<<<<<<<<<<< * """Get the number of threads that Blosc uses internally for compression and * decompression.""" @@ -2320,9 +2451,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_8get_nthreads(CYTHON_UNUSED PyObject return __pyx_r; } -/* "numcodecs/blosc.pyx":119 - * - * +/* "numcodecs/blosc.pyx":121 + * + * * def set_nthreads(int nthreads): # <<<<<<<<<<<<<< * """Set the number of threads that Blosc uses internally for compression and * decompression.""" @@ -2338,7 +2469,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_11set_nthreads(PyObject *__pyx_self, __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_nthreads (wrapper)", 0); assert(__pyx_arg_nthreads); { - __pyx_v_nthreads = __Pyx_PyInt_As_int(__pyx_arg_nthreads); if (unlikely((__pyx_v_nthreads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 119, __pyx_L3_error) + __pyx_v_nthreads = __Pyx_PyInt_As_int(__pyx_arg_nthreads); if (unlikely((__pyx_v_nthreads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 121, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -2359,23 +2490,23 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_10set_nthreads(CYTHON_UNUSED PyObjec PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("set_nthreads", 0); - /* "numcodecs/blosc.pyx":122 + /* "numcodecs/blosc.pyx":124 * """Set the number of threads that Blosc uses internally for compression and * decompression.""" * return blosc_set_nthreads(nthreads) # <<<<<<<<<<<<<< - * - * + * + * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(blosc_set_nthreads(__pyx_v_nthreads)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(blosc_set_nthreads(__pyx_v_nthreads)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "numcodecs/blosc.pyx":119 - * - * + /* "numcodecs/blosc.pyx":121 + * + * * def set_nthreads(int nthreads): # <<<<<<<<<<<<<< * """Set the number of threads that Blosc uses internally for compression and * decompression.""" @@ -2392,9 +2523,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_10set_nthreads(CYTHON_UNUSED PyObjec return __pyx_r; } -/* "numcodecs/blosc.pyx":125 - * - * +/* "numcodecs/blosc.pyx":127 + * + * * def cbuffer_sizes(source): # <<<<<<<<<<<<<< * """Return information about a compressed buffer, namely the number of uncompressed * bytes (`nbytes`) and compressed (`cbytes`). It also returns the `blocksize` (which @@ -2428,16 +2559,16 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_12cbuffer_sizes(CYTHON_UNUSED PyObje PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("cbuffer_sizes", 0); - /* "numcodecs/blosc.pyx":142 - * + /* "numcodecs/blosc.pyx":144 + * * # obtain buffer * buffer = Buffer(source, PyBUF_ANY_CONTIGUOUS) # <<<<<<<<<<<<<< - * + * * # determine buffer size */ - __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 144, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_source); __Pyx_GIVEREF(__pyx_v_source); @@ -2445,47 +2576,47 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_12cbuffer_sizes(CYTHON_UNUSED PyObje __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_buffer = ((struct __pyx_obj_9numcodecs_10compat_ext_Buffer *)__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":145 - * + /* "numcodecs/blosc.pyx":147 + * * # determine buffer size * blosc_cbuffer_sizes(buffer.ptr, &nbytes, &cbytes, &blocksize) # <<<<<<<<<<<<<< - * + * * # release buffers */ blosc_cbuffer_sizes(__pyx_v_buffer->ptr, (&__pyx_v_nbytes), (&__pyx_v_cbytes), (&__pyx_v_blocksize)); - /* "numcodecs/blosc.pyx":148 - * + /* "numcodecs/blosc.pyx":150 + * * # release buffers * buffer.release() # <<<<<<<<<<<<<< - * + * * return nbytes, cbytes, blocksize */ - __pyx_t_1 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_buffer->__pyx_vtab)->release(__pyx_v_buffer, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_buffer->__pyx_vtab)->release(__pyx_v_buffer, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":150 + /* "numcodecs/blosc.pyx":152 * buffer.release() - * + * * return nbytes, cbytes, blocksize # <<<<<<<<<<<<<< - * - * + * + * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_nbytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_nbytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 152, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_cbytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_cbytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 152, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_blocksize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 150, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_blocksize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 152, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 150, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 152, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); @@ -2500,9 +2631,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_12cbuffer_sizes(CYTHON_UNUSED PyObje __pyx_t_4 = 0; goto __pyx_L0; - /* "numcodecs/blosc.pyx":125 - * - * + /* "numcodecs/blosc.pyx":127 + * + * * def cbuffer_sizes(source): # <<<<<<<<<<<<<< * """Return information about a compressed buffer, namely the number of uncompressed * bytes (`nbytes`) and compressed (`cbytes`). It also returns the `blocksize` (which @@ -2523,9 +2654,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_12cbuffer_sizes(CYTHON_UNUSED PyObje return __pyx_r; } -/* "numcodecs/blosc.pyx":153 - * - * +/* "numcodecs/blosc.pyx":155 + * + * * def cbuffer_complib(source): # <<<<<<<<<<<<<< * """Return the name of the compression library used to compress `source`.""" * cdef: @@ -2555,18 +2686,19 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_14cbuffer_complib(CYTHON_UNUSED PyOb PyObject *__pyx_t_2 = NULL; int __pyx_t_3; int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("cbuffer_complib", 0); - /* "numcodecs/blosc.pyx":159 - * + /* "numcodecs/blosc.pyx":161 + * * # obtain buffer * buffer = Buffer(source, PyBUF_ANY_CONTIGUOUS) # <<<<<<<<<<<<<< - * + * * # determine buffer size */ - __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_source); __Pyx_GIVEREF(__pyx_v_source); @@ -2574,88 +2706,100 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_14cbuffer_complib(CYTHON_UNUSED PyOb __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_buffer = ((struct __pyx_obj_9numcodecs_10compat_ext_Buffer *)__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":162 - * + /* "numcodecs/blosc.pyx":164 + * * # determine buffer size * complib = blosc_cbuffer_complib(buffer.ptr) # <<<<<<<<<<<<<< - * + * * # release buffers */ - __pyx_t_1 = __Pyx_PyBytes_FromString(blosc_cbuffer_complib(__pyx_v_buffer->ptr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBytes_FromString(blosc_cbuffer_complib(__pyx_v_buffer->ptr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_complib = __pyx_t_1; __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":165 - * + /* "numcodecs/blosc.pyx":167 + * * # release buffers * buffer.release() # <<<<<<<<<<<<<< - * + * * if not PY2: */ - __pyx_t_1 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_buffer->__pyx_vtab)->release(__pyx_v_buffer, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_buffer->__pyx_vtab)->release(__pyx_v_buffer, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 167, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":167 + /* "numcodecs/blosc.pyx":169 * buffer.release() - * + * * if not PY2: # <<<<<<<<<<<<<< * complib = complib.decode('ascii') - * + * */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_PY2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 167, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PY2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 167, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_4 = ((!__pyx_t_3) != 0); if (__pyx_t_4) { - /* "numcodecs/blosc.pyx":168 - * + /* "numcodecs/blosc.pyx":170 + * * if not PY2: * complib = complib.decode('ascii') # <<<<<<<<<<<<<< - * + * * return complib */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_complib, __pyx_n_s_decode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 168, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 168, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_complib, __pyx_n_s_decode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_complib, __pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_n_s_ascii) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_s_ascii); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_complib, __pyx_t_1); + __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":167 + /* "numcodecs/blosc.pyx":169 * buffer.release() - * + * * if not PY2: # <<<<<<<<<<<<<< * complib = complib.decode('ascii') - * + * */ } - /* "numcodecs/blosc.pyx":170 + /* "numcodecs/blosc.pyx":172 * complib = complib.decode('ascii') - * + * * return complib # <<<<<<<<<<<<<< - * - * + * + * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_complib); __pyx_r = __pyx_v_complib; goto __pyx_L0; - /* "numcodecs/blosc.pyx":153 - * - * + /* "numcodecs/blosc.pyx":155 + * + * * def cbuffer_complib(source): # <<<<<<<<<<<<<< * """Return the name of the compression library used to compress `source`.""" * cdef: @@ -2665,6 +2809,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_14cbuffer_complib(CYTHON_UNUSED PyOb __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("numcodecs.blosc.cbuffer_complib", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -2675,9 +2820,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_14cbuffer_complib(CYTHON_UNUSED PyOb return __pyx_r; } -/* "numcodecs/blosc.pyx":173 - * - * +/* "numcodecs/blosc.pyx":175 + * + * * def cbuffer_metainfo(source): # <<<<<<<<<<<<<< * """Return some meta-information about the compressed buffer in `source`, including * the typesize, whether the shuffle or bit-shuffle filters were used, and the @@ -2712,16 +2857,16 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_16cbuffer_metainfo(CYTHON_UNUSED PyO PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("cbuffer_metainfo", 0); - /* "numcodecs/blosc.pyx":191 - * + /* "numcodecs/blosc.pyx":193 + * * # obtain buffer * buffer = Buffer(source, PyBUF_ANY_CONTIGUOUS) # <<<<<<<<<<<<<< - * + * * # determine buffer size */ - __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 191, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_source); __Pyx_GIVEREF(__pyx_v_source); @@ -2729,34 +2874,34 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_16cbuffer_metainfo(CYTHON_UNUSED PyO __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_buffer = ((struct __pyx_obj_9numcodecs_10compat_ext_Buffer *)__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":194 - * + /* "numcodecs/blosc.pyx":196 + * * # determine buffer size * blosc_cbuffer_metainfo(buffer.ptr, &typesize, &flags) # <<<<<<<<<<<<<< - * + * * # release buffers */ blosc_cbuffer_metainfo(__pyx_v_buffer->ptr, (&__pyx_v_typesize), (&__pyx_v_flags)); - /* "numcodecs/blosc.pyx":197 - * + /* "numcodecs/blosc.pyx":199 + * * # release buffers * buffer.release() # <<<<<<<<<<<<<< - * + * * # decompose flags */ - __pyx_t_1 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_buffer->__pyx_vtab)->release(__pyx_v_buffer, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_buffer->__pyx_vtab)->release(__pyx_v_buffer, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":200 - * + /* "numcodecs/blosc.pyx":202 + * * # decompose flags * if flags & BLOSC_DOSHUFFLE: # <<<<<<<<<<<<<< * shuffle = SHUFFLE @@ -2765,20 +2910,20 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_16cbuffer_metainfo(CYTHON_UNUSED PyO __pyx_t_3 = ((__pyx_v_flags & BLOSC_DOSHUFFLE) != 0); if (__pyx_t_3) { - /* "numcodecs/blosc.pyx":201 + /* "numcodecs/blosc.pyx":203 * # decompose flags * if flags & BLOSC_DOSHUFFLE: * shuffle = SHUFFLE # <<<<<<<<<<<<<< * elif flags & BLOSC_DOBITSHUFFLE: * shuffle = BITSHUFFLE */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_SHUFFLE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_SHUFFLE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_shuffle = __pyx_t_1; __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":200 - * + /* "numcodecs/blosc.pyx":202 + * * # decompose flags * if flags & BLOSC_DOSHUFFLE: # <<<<<<<<<<<<<< * shuffle = SHUFFLE @@ -2787,7 +2932,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_16cbuffer_metainfo(CYTHON_UNUSED PyO goto __pyx_L3; } - /* "numcodecs/blosc.pyx":202 + /* "numcodecs/blosc.pyx":204 * if flags & BLOSC_DOSHUFFLE: * shuffle = SHUFFLE * elif flags & BLOSC_DOBITSHUFFLE: # <<<<<<<<<<<<<< @@ -2797,19 +2942,19 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_16cbuffer_metainfo(CYTHON_UNUSED PyO __pyx_t_3 = ((__pyx_v_flags & BLOSC_DOBITSHUFFLE) != 0); if (__pyx_t_3) { - /* "numcodecs/blosc.pyx":203 + /* "numcodecs/blosc.pyx":205 * shuffle = SHUFFLE * elif flags & BLOSC_DOBITSHUFFLE: * shuffle = BITSHUFFLE # <<<<<<<<<<<<<< * else: * shuffle = NOSHUFFLE */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_BITSHUFFLE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BITSHUFFLE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_shuffle = __pyx_t_1; __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":202 + /* "numcodecs/blosc.pyx":204 * if flags & BLOSC_DOSHUFFLE: * shuffle = SHUFFLE * elif flags & BLOSC_DOBITSHUFFLE: # <<<<<<<<<<<<<< @@ -2819,43 +2964,43 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_16cbuffer_metainfo(CYTHON_UNUSED PyO goto __pyx_L3; } - /* "numcodecs/blosc.pyx":205 + /* "numcodecs/blosc.pyx":207 * shuffle = BITSHUFFLE * else: * shuffle = NOSHUFFLE # <<<<<<<<<<<<<< * memcpyed = flags & BLOSC_MEMCPYED - * + * */ /*else*/ { - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_NOSHUFFLE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_NOSHUFFLE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_shuffle = __pyx_t_1; __pyx_t_1 = 0; } __pyx_L3:; - /* "numcodecs/blosc.pyx":206 + /* "numcodecs/blosc.pyx":208 * else: * shuffle = NOSHUFFLE * memcpyed = flags & BLOSC_MEMCPYED # <<<<<<<<<<<<<< - * + * * return typesize, shuffle, memcpyed */ __pyx_v_memcpyed = (__pyx_v_flags & BLOSC_MEMCPYED); - /* "numcodecs/blosc.pyx":208 + /* "numcodecs/blosc.pyx":210 * memcpyed = flags & BLOSC_MEMCPYED - * + * * return typesize, shuffle, memcpyed # <<<<<<<<<<<<<< - * - * + * + * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_typesize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_typesize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_memcpyed); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_memcpyed); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); @@ -2870,9 +3015,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_16cbuffer_metainfo(CYTHON_UNUSED PyO __pyx_t_4 = 0; goto __pyx_L0; - /* "numcodecs/blosc.pyx":173 - * - * + /* "numcodecs/blosc.pyx":175 + * + * * def cbuffer_metainfo(source): # <<<<<<<<<<<<<< * """Return some meta-information about the compressed buffer in `source`, including * the typesize, whether the shuffle or bit-shuffle filters were used, and the @@ -2893,9 +3038,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_16cbuffer_metainfo(CYTHON_UNUSED PyO return __pyx_r; } -/* "numcodecs/blosc.pyx":211 - * - * +/* "numcodecs/blosc.pyx":213 + * + * * def err_bad_cname(cname): # <<<<<<<<<<<<<< * raise ValueError('bad compressor or compressor not supported: %r; expected one of ' * '%s' % (cname, list_compressors())) @@ -2924,14 +3069,14 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_18err_bad_cname(CYTHON_UNUSED PyObje PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("err_bad_cname", 0); - /* "numcodecs/blosc.pyx":213 + /* "numcodecs/blosc.pyx":215 * def err_bad_cname(cname): * raise ValueError('bad compressor or compressor not supported: %r; expected one of ' * '%s' % (cname, list_compressors())) # <<<<<<<<<<<<<< - * - * + * + * */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_list_compressors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 213, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_list_compressors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { @@ -2943,15 +3088,12 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_18err_bad_cname(CYTHON_UNUSED PyObje __Pyx_DECREF_SET(__pyx_t_2, function); } } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error) - } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 215, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 213, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_cname); __Pyx_GIVEREF(__pyx_v_cname); @@ -2959,27 +3101,27 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_18err_bad_cname(CYTHON_UNUSED PyObje __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_bad_compressor_or_compressor_not, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_bad_compressor_or_compressor_not, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 215, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":212 - * + /* "numcodecs/blosc.pyx":214 + * * def err_bad_cname(cname): * raise ValueError('bad compressor or compressor not supported: %r; expected one of ' # <<<<<<<<<<<<<< * '%s' % (cname, list_compressors())) - * + * */ - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 214, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 212, __pyx_L1_error) + __PYX_ERR(0, 214, __pyx_L1_error) - /* "numcodecs/blosc.pyx":211 - * - * + /* "numcodecs/blosc.pyx":213 + * + * * def err_bad_cname(cname): # <<<<<<<<<<<<<< * raise ValueError('bad compressor or compressor not supported: %r; expected one of ' * '%s' % (cname, list_compressors())) @@ -2997,9 +3139,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_18err_bad_cname(CYTHON_UNUSED PyObje return __pyx_r; } -/* "numcodecs/blosc.pyx":216 - * - * +/* "numcodecs/blosc.pyx":218 + * + * * def compress(source, char* cname, int clevel, int shuffle=SHUFFLE, # <<<<<<<<<<<<<< * int blocksize=AUTOBLOCKS): * """Compress data. @@ -3008,7 +3150,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_18err_bad_cname(CYTHON_UNUSED PyObje /* Python wrapper */ static PyObject *__pyx_pw_9numcodecs_5blosc_21compress(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_9numcodecs_5blosc_20compress[] = "compress(source, char *cname, int clevel, int shuffle=SHUFFLE, int blocksize=AUTOBLOCKS)\nCompress data.\n\n Parameters\n ----------\n source : bytes-like\n Data to be compressed. Can be any object supporting the buffer\n protocol.\n cname : bytes\n Name of compression library to use.\n clevel : int\n Compression level.\n shuffle : int\n Either NOSHUFFLE (0), SHUFFLE (1), BITSHUFFLE (2) or AUTOSHUFFLE (-1). If -1\n (default), bit-shuffle will be used for buffers with itemsize 1,\n and byte-shuffle will be used otherwise.\n blocksize : int\n The requested size of the compressed blocks. If 0, an automatic blocksize will\n be used.\n\n Returns\n -------\n dest : bytes\n Compressed data.\n\n "; -static PyMethodDef __pyx_mdef_9numcodecs_5blosc_21compress = {"compress", (PyCFunction)__pyx_pw_9numcodecs_5blosc_21compress, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9numcodecs_5blosc_20compress}; +static PyMethodDef __pyx_mdef_9numcodecs_5blosc_21compress = {"compress", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9numcodecs_5blosc_21compress, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9numcodecs_5blosc_20compress}; static PyObject *__pyx_pw_9numcodecs_5blosc_21compress(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_source = 0; char *__pyx_v_cname; @@ -3047,13 +3189,13 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_21compress(PyObject *__pyx_self, PyO case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cname)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("compress", 0, 3, 5, 1); __PYX_ERR(0, 216, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("compress", 0, 3, 5, 1); __PYX_ERR(0, 218, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clevel)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("compress", 0, 3, 5, 2); __PYX_ERR(0, 216, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("compress", 0, 3, 5, 2); __PYX_ERR(0, 218, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: @@ -3069,7 +3211,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_21compress(PyObject *__pyx_self, PyO } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "compress") < 0)) __PYX_ERR(0, 216, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "compress") < 0)) __PYX_ERR(0, 218, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3085,22 +3227,22 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_21compress(PyObject *__pyx_self, PyO } } __pyx_v_source = values[0]; - __pyx_v_cname = __Pyx_PyObject_AsWritableString(values[1]); if (unlikely((!__pyx_v_cname) && PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L3_error) - __pyx_v_clevel = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_clevel == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L3_error) + __pyx_v_cname = __Pyx_PyObject_AsWritableString(values[1]); if (unlikely((!__pyx_v_cname) && PyErr_Occurred())) __PYX_ERR(0, 218, __pyx_L3_error) + __pyx_v_clevel = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_clevel == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 218, __pyx_L3_error) if (values[3]) { - __pyx_v_shuffle = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_shuffle == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L3_error) + __pyx_v_shuffle = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_shuffle == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 218, __pyx_L3_error) } else { - __pyx_v_shuffle = __pyx_k__6; + __pyx_v_shuffle = __pyx_k__2; } if (values[4]) { - __pyx_v_blocksize = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_blocksize == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 217, __pyx_L3_error) + __pyx_v_blocksize = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_blocksize == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 219, __pyx_L3_error) } else { - __pyx_v_blocksize = __pyx_k__7; + __pyx_v_blocksize = __pyx_k__3; } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("compress", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 216, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("compress", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 218, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.blosc.compress", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3130,10 +3272,10 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - char *__pyx_t_7; - size_t __pyx_t_8; - int __pyx_t_9; + char *__pyx_t_6; + size_t __pyx_t_7; + int __pyx_t_8; + PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; PyObject *__pyx_t_11 = NULL; PyObject *__pyx_t_12 = NULL; @@ -3144,33 +3286,33 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ PyObject *__pyx_t_17 = NULL; __Pyx_RefNannySetupContext("compress", 0); - /* "numcodecs/blosc.pyx":253 - * + /* "numcodecs/blosc.pyx":255 + * * # check valid cname early * if PY2: # <<<<<<<<<<<<<< * cname_str = cname * else: */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_PY2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PY2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 253, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "numcodecs/blosc.pyx":254 + /* "numcodecs/blosc.pyx":256 * # check valid cname early * if PY2: * cname_str = cname # <<<<<<<<<<<<<< * else: * cname_str = cname.decode('ascii') */ - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_cname); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_cname); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_cname_str = __pyx_t_1; __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":253 - * + /* "numcodecs/blosc.pyx":255 + * * # check valid cname early * if PY2: # <<<<<<<<<<<<<< * cname_str = cname @@ -3179,7 +3321,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ goto __pyx_L3; } - /* "numcodecs/blosc.pyx":256 + /* "numcodecs/blosc.pyx":258 * cname_str = cname * else: * cname_str = cname.decode('ascii') # <<<<<<<<<<<<<< @@ -3187,21 +3329,21 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ * err_bad_cname(cname_str) */ /*else*/ { - __pyx_t_1 = __Pyx_decode_c_string(__pyx_v_cname, 0, strlen(__pyx_v_cname), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __pyx_L1_error) + __pyx_t_1 = __Pyx_decode_c_string(__pyx_v_cname, 0, strlen(__pyx_v_cname), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_cname_str = __pyx_t_1; __pyx_t_1 = 0; } __pyx_L3:; - /* "numcodecs/blosc.pyx":257 + /* "numcodecs/blosc.pyx":259 * else: * cname_str = cname.decode('ascii') * if cname_str not in list_compressors(): # <<<<<<<<<<<<<< * err_bad_cname(cname_str) - * + * */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_list_compressors); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 257, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_list_compressors); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { @@ -3213,27 +3355,24 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __Pyx_DECREF_SET(__pyx_t_3, function); } } - if (__pyx_t_4) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error) - } + __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_cname_str, __pyx_t_1, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 257, __pyx_L1_error) + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_cname_str, __pyx_t_1, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 259, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = (__pyx_t_2 != 0); if (__pyx_t_5) { - /* "numcodecs/blosc.pyx":258 + /* "numcodecs/blosc.pyx":260 * cname_str = cname.decode('ascii') * if cname_str not in list_compressors(): * err_bad_cname(cname_str) # <<<<<<<<<<<<<< - * + * * # setup source buffer */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_err_bad_cname); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 258, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_err_bad_cname); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 260, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { @@ -3245,60 +3384,32 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __Pyx_DECREF_SET(__pyx_t_3, function); } } - if (!__pyx_t_4) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_cname_str); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_cname_str}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_cname_str}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 258, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_INCREF(__pyx_v_cname_str); - __Pyx_GIVEREF(__pyx_v_cname_str); - PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_cname_str); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - } + __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_cname_str) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_cname_str); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 260, __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; - /* "numcodecs/blosc.pyx":257 + /* "numcodecs/blosc.pyx":259 * else: * cname_str = cname.decode('ascii') * if cname_str not in list_compressors(): # <<<<<<<<<<<<<< * err_bad_cname(cname_str) - * + * */ } - /* "numcodecs/blosc.pyx":261 - * + /* "numcodecs/blosc.pyx":263 + * * # setup source buffer * source_buffer = Buffer(source, PyBUF_ANY_CONTIGUOUS) # <<<<<<<<<<<<<< * source_ptr = source_buffer.ptr * nbytes = source_buffer.nbytes */ - __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 261, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 263, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 261, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 263, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_source); __Pyx_GIVEREF(__pyx_v_source); @@ -3306,61 +3417,61 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __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(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 261, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 263, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_source_buffer = ((struct __pyx_obj_9numcodecs_10compat_ext_Buffer *)__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":262 + /* "numcodecs/blosc.pyx":264 * # setup source buffer * source_buffer = Buffer(source, PyBUF_ANY_CONTIGUOUS) * source_ptr = source_buffer.ptr # <<<<<<<<<<<<<< * nbytes = source_buffer.nbytes * itemsize = source_buffer.itemsize */ - __pyx_t_7 = __pyx_v_source_buffer->ptr; - __pyx_v_source_ptr = __pyx_t_7; + __pyx_t_6 = __pyx_v_source_buffer->ptr; + __pyx_v_source_ptr = __pyx_t_6; - /* "numcodecs/blosc.pyx":263 + /* "numcodecs/blosc.pyx":265 * source_buffer = Buffer(source, PyBUF_ANY_CONTIGUOUS) * source_ptr = source_buffer.ptr * nbytes = source_buffer.nbytes # <<<<<<<<<<<<<< * itemsize = source_buffer.itemsize - * + * */ - __pyx_t_8 = __pyx_v_source_buffer->nbytes; - __pyx_v_nbytes = __pyx_t_8; + __pyx_t_7 = __pyx_v_source_buffer->nbytes; + __pyx_v_nbytes = __pyx_t_7; - /* "numcodecs/blosc.pyx":264 + /* "numcodecs/blosc.pyx":266 * source_ptr = source_buffer.ptr * nbytes = source_buffer.nbytes * itemsize = source_buffer.itemsize # <<<<<<<<<<<<<< - * + * * # determine shuffle */ - __pyx_t_8 = __pyx_v_source_buffer->itemsize; - __pyx_v_itemsize = __pyx_t_8; + __pyx_t_7 = __pyx_v_source_buffer->itemsize; + __pyx_v_itemsize = __pyx_t_7; - /* "numcodecs/blosc.pyx":267 - * + /* "numcodecs/blosc.pyx":269 + * * # determine shuffle * if shuffle == AUTOSHUFFLE: # <<<<<<<<<<<<<< * if itemsize == 1: * shuffle = BITSHUFFLE */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_shuffle); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_shuffle); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_AUTOSHUFFLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 267, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_AUTOSHUFFLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 269, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 267, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 269, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 267, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 269, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_5) { - /* "numcodecs/blosc.pyx":268 + /* "numcodecs/blosc.pyx":270 * # determine shuffle * if shuffle == AUTOSHUFFLE: * if itemsize == 1: # <<<<<<<<<<<<<< @@ -3370,20 +3481,20 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __pyx_t_5 = ((__pyx_v_itemsize == 1) != 0); if (__pyx_t_5) { - /* "numcodecs/blosc.pyx":269 + /* "numcodecs/blosc.pyx":271 * if shuffle == AUTOSHUFFLE: * if itemsize == 1: * shuffle = BITSHUFFLE # <<<<<<<<<<<<<< * else: * shuffle = SHUFFLE */ - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_BITSHUFFLE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 269, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 269, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_shuffle = __pyx_t_9; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_BITSHUFFLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 271, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_shuffle = __pyx_t_8; - /* "numcodecs/blosc.pyx":268 + /* "numcodecs/blosc.pyx":270 * # determine shuffle * if shuffle == AUTOSHUFFLE: * if itemsize == 1: # <<<<<<<<<<<<<< @@ -3393,7 +3504,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ goto __pyx_L6; } - /* "numcodecs/blosc.pyx":271 + /* "numcodecs/blosc.pyx":273 * shuffle = BITSHUFFLE * else: * shuffle = SHUFFLE # <<<<<<<<<<<<<< @@ -3401,16 +3512,16 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ * raise ValueError('invalid shuffle argument; expected -1, 0, 1 or 2, found %r' % */ /*else*/ { - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_SHUFFLE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 271, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 271, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_shuffle = __pyx_t_9; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_SHUFFLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 273, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_shuffle = __pyx_t_8; } __pyx_L6:; - /* "numcodecs/blosc.pyx":267 - * + /* "numcodecs/blosc.pyx":269 + * * # determine shuffle * if shuffle == AUTOSHUFFLE: # <<<<<<<<<<<<<< * if itemsize == 1: @@ -3419,84 +3530,84 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ goto __pyx_L5; } - /* "numcodecs/blosc.pyx":272 + /* "numcodecs/blosc.pyx":274 * else: * shuffle = SHUFFLE * elif shuffle not in [NOSHUFFLE, SHUFFLE, BITSHUFFLE]: # <<<<<<<<<<<<<< * raise ValueError('invalid shuffle argument; expected -1, 0, 1 or 2, found %r' % * shuffle) */ - __pyx_t_9 = __pyx_v_shuffle; - __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 272, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_NOSHUFFLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 272, __pyx_L1_error) + __pyx_t_8 = __pyx_v_shuffle; + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 274, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_NOSHUFFLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 274, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_RichCompare(__pyx_t_6, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 272, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 272, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 274, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { } else { __pyx_t_5 = __pyx_t_2; goto __pyx_L7_bool_binop_done; } - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 272, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_SHUFFLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 272, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_SHUFFLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 274, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 272, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 274, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 272, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 274, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_2) { } else { __pyx_t_5 = __pyx_t_2; goto __pyx_L7_bool_binop_done; } - __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 272, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_BITSHUFFLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 272, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 274, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_BITSHUFFLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 274, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_RichCompare(__pyx_t_6, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 272, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 272, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 274, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = __pyx_t_2; __pyx_L7_bool_binop_done:; __pyx_t_2 = (__pyx_t_5 != 0); if (unlikely(__pyx_t_2)) { - /* "numcodecs/blosc.pyx":274 + /* "numcodecs/blosc.pyx":276 * elif shuffle not in [NOSHUFFLE, SHUFFLE, BITSHUFFLE]: * raise ValueError('invalid shuffle argument; expected -1, 0, 1 or 2, found %r' % * shuffle) # <<<<<<<<<<<<<< - * + * * try: */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_shuffle); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_shuffle); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 276, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - /* "numcodecs/blosc.pyx":273 + /* "numcodecs/blosc.pyx":275 * shuffle = SHUFFLE * elif shuffle not in [NOSHUFFLE, SHUFFLE, BITSHUFFLE]: * raise ValueError('invalid shuffle argument; expected -1, 0, 1 or 2, found %r' % # <<<<<<<<<<<<<< * shuffle) - * + * */ - __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_invalid_shuffle_argument_expecte, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 273, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_invalid_shuffle_argument_expecte, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 275, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 273, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 275, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 273, __pyx_L1_error) + __PYX_ERR(0, 275, __pyx_L1_error) - /* "numcodecs/blosc.pyx":272 + /* "numcodecs/blosc.pyx":274 * else: * shuffle = SHUFFLE * elif shuffle not in [NOSHUFFLE, SHUFFLE, BITSHUFFLE]: # <<<<<<<<<<<<<< @@ -3506,99 +3617,93 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ } __pyx_L5:; - /* "numcodecs/blosc.pyx":276 + /* "numcodecs/blosc.pyx":278 * shuffle) - * + * * try: # <<<<<<<<<<<<<< - * + * * # setup destination */ /*try:*/ { - /* "numcodecs/blosc.pyx":279 - * + /* "numcodecs/blosc.pyx":281 + * * # setup destination * dest = PyBytes_FromStringAndSize(NULL, nbytes + BLOSC_MAX_OVERHEAD) # <<<<<<<<<<<<<< * dest_ptr = PyBytes_AS_STRING(dest) - * + * */ - __pyx_t_1 = PyBytes_FromStringAndSize(NULL, (__pyx_v_nbytes + BLOSC_MAX_OVERHEAD)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 279, __pyx_L11_error) + __pyx_t_1 = PyBytes_FromStringAndSize(NULL, (__pyx_v_nbytes + BLOSC_MAX_OVERHEAD)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 281, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_dest = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":280 + /* "numcodecs/blosc.pyx":282 * # setup destination * dest = PyBytes_FromStringAndSize(NULL, nbytes + BLOSC_MAX_OVERHEAD) * dest_ptr = PyBytes_AS_STRING(dest) # <<<<<<<<<<<<<< - * + * * # perform compression */ __pyx_v_dest_ptr = PyBytes_AS_STRING(__pyx_v_dest); - /* "numcodecs/blosc.pyx":283 - * + /* "numcodecs/blosc.pyx":285 + * * # perform compression * if _get_use_threads(): # <<<<<<<<<<<<<< * # allow blosc to use threads internally - * + * */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_use_threads); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 283, __pyx_L11_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_get_use_threads); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 285, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = NULL; + __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_6)) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } - if (__pyx_t_6) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 283, __pyx_L11_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 283, __pyx_L11_error) - } + __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 285, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 283, __pyx_L11_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 285, __pyx_L11_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "numcodecs/blosc.pyx":289 + /* "numcodecs/blosc.pyx":291 * # to ensure no-one else can modify the global context while we're setting it * # up and using it. * with mutex: # <<<<<<<<<<<<<< - * + * * # set compressor */ /*with:*/ { - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_mutex); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 289, __pyx_L11_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_mutex); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 291, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 289, __pyx_L11_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 289, __pyx_L14_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_4); + __pyx_t_9 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 291, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 291, __pyx_L14_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_10 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_10)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_10); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + __Pyx_DECREF_SET(__pyx_t_4, function); } } - if (__pyx_t_4) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 289, __pyx_L14_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else { - __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 289, __pyx_L14_error) - } + __pyx_t_3 = (__pyx_t_10) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_10) : __Pyx_PyObject_CallNoArg(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 291, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*try:*/ { @@ -3611,8 +3716,8 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __Pyx_XGOTREF(__pyx_t_13); /*try:*/ { - /* "numcodecs/blosc.pyx":292 - * + /* "numcodecs/blosc.pyx":294 + * * # set compressor * compressor_set = blosc_set_compressor(cname) # <<<<<<<<<<<<<< * if compressor_set < 0: @@ -3620,7 +3725,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ */ __pyx_v_compressor_set = blosc_set_compressor(__pyx_v_cname); - /* "numcodecs/blosc.pyx":293 + /* "numcodecs/blosc.pyx":295 * # set compressor * compressor_set = blosc_set_compressor(cname) * if compressor_set < 0: # <<<<<<<<<<<<<< @@ -3630,61 +3735,33 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __pyx_t_2 = ((__pyx_v_compressor_set < 0) != 0); if (__pyx_t_2) { - /* "numcodecs/blosc.pyx":296 + /* "numcodecs/blosc.pyx":298 * # shouldn't happen if we checked against list of compressors * # already, but just in case * err_bad_cname(cname_str) # <<<<<<<<<<<<<< - * + * * # set blocksize */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_err_bad_cname); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 296, __pyx_L18_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_err_bad_cname); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 298, __pyx_L18_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = NULL; + __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_6)) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } - if (!__pyx_t_6) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_cname_str); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 296, __pyx_L18_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_cname_str}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 296, __pyx_L18_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_cname_str}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 296, __pyx_L18_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 296, __pyx_L18_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL; - __Pyx_INCREF(__pyx_v_cname_str); - __Pyx_GIVEREF(__pyx_v_cname_str); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_cname_str); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 296, __pyx_L18_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } + __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_cname_str) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_cname_str); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 298, __pyx_L18_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":293 + /* "numcodecs/blosc.pyx":295 * # set compressor * compressor_set = blosc_set_compressor(cname) * if compressor_set < 0: # <<<<<<<<<<<<<< @@ -3693,17 +3770,17 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ */ } - /* "numcodecs/blosc.pyx":299 - * + /* "numcodecs/blosc.pyx":301 + * * # set blocksize * blosc_set_blocksize(blocksize) # <<<<<<<<<<<<<< - * + * * # perform compression */ blosc_set_blocksize(__pyx_v_blocksize); - /* "numcodecs/blosc.pyx":302 - * + /* "numcodecs/blosc.pyx":304 + * * # perform compression * with nogil: # <<<<<<<<<<<<<< * cbytes = blosc_compress(clevel, shuffle, itemsize, nbytes, source_ptr, @@ -3717,18 +3794,18 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ #endif /*try:*/ { - /* "numcodecs/blosc.pyx":303 + /* "numcodecs/blosc.pyx":305 * # perform compression * with nogil: * cbytes = blosc_compress(clevel, shuffle, itemsize, nbytes, source_ptr, # <<<<<<<<<<<<<< * dest_ptr, nbytes + BLOSC_MAX_OVERHEAD) - * + * */ __pyx_v_cbytes = blosc_compress(__pyx_v_clevel, __pyx_v_shuffle, __pyx_v_itemsize, __pyx_v_nbytes, __pyx_v_source_ptr, __pyx_v_dest_ptr, (__pyx_v_nbytes + BLOSC_MAX_OVERHEAD)); } - /* "numcodecs/blosc.pyx":302 - * + /* "numcodecs/blosc.pyx":304 + * * # perform compression * with nogil: # <<<<<<<<<<<<<< * cbytes = blosc_compress(clevel, shuffle, itemsize, nbytes, source_ptr, @@ -3746,11 +3823,11 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ } } - /* "numcodecs/blosc.pyx":289 + /* "numcodecs/blosc.pyx":291 * # to ensure no-one else can modify the global context while we're setting it * # up and using it. * with mutex: # <<<<<<<<<<<<<< - * + * * # set compressor */ } @@ -3759,38 +3836,38 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; goto __pyx_L23_try_end; __pyx_L18_error:; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; /*except:*/ { __Pyx_AddTraceback("numcodecs.blosc.compress", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 289, __pyx_L20_except_error) + if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 291, __pyx_L20_except_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 289, __pyx_L20_except_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_6, NULL); + __pyx_t_10 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 291, __pyx_L20_except_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_10, NULL); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 289, __pyx_L20_except_error) + if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 291, __pyx_L20_except_error) __Pyx_GOTREF(__pyx_t_14); __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_14); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (__pyx_t_2 < 0) __PYX_ERR(0, 289, __pyx_L20_except_error) + if (__pyx_t_2 < 0) __PYX_ERR(0, 291, __pyx_L20_except_error) __pyx_t_5 = ((!(__pyx_t_2 != 0)) != 0); if (__pyx_t_5) { __Pyx_GIVEREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_3); __Pyx_XGIVEREF(__pyx_t_4); __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_3, __pyx_t_4); - __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; - __PYX_ERR(0, 289, __pyx_L20_except_error) + __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; + __PYX_ERR(0, 291, __pyx_L20_except_error) } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L19_exception_handled; } __pyx_L20_except_error:; @@ -3809,10 +3886,10 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ } /*finally:*/ { /*normal exit:*/{ - if (__pyx_t_10) { - __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__8, NULL); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 289, __pyx_L11_error) + if (__pyx_t_9) { + __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_tuple__4, NULL); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 291, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; } @@ -3822,23 +3899,23 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ } goto __pyx_L31; __pyx_L14_error:; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L11_error; __pyx_L31:; } - /* "numcodecs/blosc.pyx":283 - * + /* "numcodecs/blosc.pyx":285 + * * # perform compression * if _get_use_threads(): # <<<<<<<<<<<<<< * # allow blosc to use threads internally - * + * */ goto __pyx_L13; } - /* "numcodecs/blosc.pyx":307 - * + /* "numcodecs/blosc.pyx":309 + * * else: * with nogil: # <<<<<<<<<<<<<< * cbytes = blosc_compress_ctx(clevel, shuffle, itemsize, nbytes, source_ptr, @@ -3853,7 +3930,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ #endif /*try:*/ { - /* "numcodecs/blosc.pyx":308 + /* "numcodecs/blosc.pyx":310 * else: * with nogil: * cbytes = blosc_compress_ctx(clevel, shuffle, itemsize, nbytes, source_ptr, # <<<<<<<<<<<<<< @@ -3863,8 +3940,8 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __pyx_v_cbytes = blosc_compress_ctx(__pyx_v_clevel, __pyx_v_shuffle, __pyx_v_itemsize, __pyx_v_nbytes, __pyx_v_source_ptr, __pyx_v_dest_ptr, (__pyx_v_nbytes + BLOSC_MAX_OVERHEAD), __pyx_v_cname, __pyx_v_blocksize, 1); } - /* "numcodecs/blosc.pyx":307 - * + /* "numcodecs/blosc.pyx":309 + * * else: * with nogil: # <<<<<<<<<<<<<< * cbytes = blosc_compress_ctx(clevel, shuffle, itemsize, nbytes, source_ptr, @@ -3885,16 +3962,16 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __pyx_L13:; } - /* "numcodecs/blosc.pyx":315 - * + /* "numcodecs/blosc.pyx":317 + * * # release buffers * source_buffer.release() # <<<<<<<<<<<<<< - * + * * # check compression was successful */ /*finally:*/ { /*normal exit:*/{ - __pyx_t_4 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 315, __pyx_L1_error) + __pyx_t_4 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 317, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L12; @@ -3903,22 +3980,22 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign - __pyx_t_10 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_14 = 0; __pyx_t_17 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_9 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_14 = 0; __pyx_t_17 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_14, &__pyx_t_17); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_13, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_13, &__pyx_t_12); - __Pyx_XGOTREF(__pyx_t_10); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_13, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_13, &__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_9); __Pyx_XGOTREF(__pyx_t_13); __Pyx_XGOTREF(__pyx_t_12); __Pyx_XGOTREF(__pyx_t_11); __Pyx_XGOTREF(__pyx_t_14); __Pyx_XGOTREF(__pyx_t_17); - __pyx_t_9 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_16 = __pyx_filename; + __pyx_t_8 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_16 = __pyx_filename; { - __pyx_t_4 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 315, __pyx_L36_error) + __pyx_t_4 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 317, __pyx_L36_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } @@ -3928,12 +4005,12 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __Pyx_XGIVEREF(__pyx_t_17); __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_14, __pyx_t_17); } - __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_9); __Pyx_XGIVEREF(__pyx_t_13); __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_ErrRestore(__pyx_t_10, __pyx_t_13, __pyx_t_12); - __pyx_t_10 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_14 = 0; __pyx_t_17 = 0; - __pyx_lineno = __pyx_t_9; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_16; + __Pyx_ErrRestore(__pyx_t_9, __pyx_t_13, __pyx_t_12); + __pyx_t_9 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_14 = 0; __pyx_t_17 = 0; + __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_16; goto __pyx_L1_error; __pyx_L36_error:; if (PY_MAJOR_VERSION >= 3) { @@ -3942,7 +4019,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __Pyx_XGIVEREF(__pyx_t_17); __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_14, __pyx_t_17); } - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_14 = 0; __pyx_t_17 = 0; @@ -3951,75 +4028,75 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __pyx_L12:; } - /* "numcodecs/blosc.pyx":318 - * + /* "numcodecs/blosc.pyx":320 + * * # check compression was successful * if cbytes <= 0: # <<<<<<<<<<<<<< * raise RuntimeError('error during blosc compression: %d' % cbytes) - * + * */ __pyx_t_5 = ((__pyx_v_cbytes <= 0) != 0); if (unlikely(__pyx_t_5)) { - /* "numcodecs/blosc.pyx":319 + /* "numcodecs/blosc.pyx":321 * # check compression was successful * if cbytes <= 0: * raise RuntimeError('error during blosc compression: %d' % cbytes) # <<<<<<<<<<<<<< - * + * * # resize after compression */ - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_cbytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 319, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_cbytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 321, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_error_during_blosc_compression_d, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 319, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_error_during_blosc_compression_d, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 321, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 319, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 321, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 319, __pyx_L1_error) + __PYX_ERR(0, 321, __pyx_L1_error) - /* "numcodecs/blosc.pyx":318 - * + /* "numcodecs/blosc.pyx":320 + * * # check compression was successful * if cbytes <= 0: # <<<<<<<<<<<<<< * raise RuntimeError('error during blosc compression: %d' % cbytes) - * + * */ } - /* "numcodecs/blosc.pyx":322 - * + /* "numcodecs/blosc.pyx":324 + * * # resize after compression * dest = dest[:cbytes] # <<<<<<<<<<<<<< - * + * * return dest */ if (unlikely(__pyx_v_dest == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 322, __pyx_L1_error) + __PYX_ERR(0, 324, __pyx_L1_error) } - __pyx_t_4 = PySequence_GetSlice(__pyx_v_dest, 0, __pyx_v_cbytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 322, __pyx_L1_error) + __pyx_t_4 = PySequence_GetSlice(__pyx_v_dest, 0, __pyx_v_cbytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 324, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF_SET(__pyx_v_dest, ((PyObject*)__pyx_t_4)); __pyx_t_4 = 0; - /* "numcodecs/blosc.pyx":324 + /* "numcodecs/blosc.pyx":326 * dest = dest[:cbytes] - * + * * return dest # <<<<<<<<<<<<<< - * - * + * + * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_dest); __pyx_r = __pyx_v_dest; goto __pyx_L0; - /* "numcodecs/blosc.pyx":216 - * - * + /* "numcodecs/blosc.pyx":218 + * + * * def compress(source, char* cname, int clevel, int shuffle=SHUFFLE, # <<<<<<<<<<<<<< * int blocksize=AUTOBLOCKS): * """Compress data. @@ -4030,7 +4107,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_10); __Pyx_AddTraceback("numcodecs.blosc.compress", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -4042,18 +4119,18 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ return __pyx_r; } -/* "numcodecs/blosc.pyx":327 - * - * +/* "numcodecs/blosc.pyx":329 + * + * * def decompress(source, dest=None): # <<<<<<<<<<<<<< * """Decompress data. - * + * */ /* Python wrapper */ static PyObject *__pyx_pw_9numcodecs_5blosc_23decompress(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_9numcodecs_5blosc_22decompress[] = "decompress(source, dest=None)\nDecompress data.\n\n Parameters\n ----------\n source : bytes-like\n Compressed data, including blosc header. Can be any object supporting the buffer\n protocol.\n dest : array-like, optional\n Object to decompress into.\n\n Returns\n -------\n dest : bytes\n Object containing decompressed data.\n\n "; -static PyMethodDef __pyx_mdef_9numcodecs_5blosc_23decompress = {"decompress", (PyCFunction)__pyx_pw_9numcodecs_5blosc_23decompress, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9numcodecs_5blosc_22decompress}; +static PyMethodDef __pyx_mdef_9numcodecs_5blosc_23decompress = {"decompress", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9numcodecs_5blosc_23decompress, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9numcodecs_5blosc_22decompress}; static PyObject *__pyx_pw_9numcodecs_5blosc_23decompress(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_source = 0; PyObject *__pyx_v_dest = 0; @@ -4088,7 +4165,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_23decompress(PyObject *__pyx_self, P } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decompress") < 0)) __PYX_ERR(0, 327, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decompress") < 0)) __PYX_ERR(0, 329, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -4104,7 +4181,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_23decompress(PyObject *__pyx_self, P } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("decompress", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 327, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decompress", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 329, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.blosc.decompress", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -4148,26 +4225,26 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __Pyx_RefNannySetupContext("decompress", 0); __Pyx_INCREF(__pyx_v_dest); - /* "numcodecs/blosc.pyx":349 + /* "numcodecs/blosc.pyx":351 * char *dest_ptr * Buffer source_buffer * Buffer dest_buffer = None # <<<<<<<<<<<<<< * size_t nbytes, cbytes, blocksize - * + * */ __Pyx_INCREF(Py_None); __pyx_v_dest_buffer = ((struct __pyx_obj_9numcodecs_10compat_ext_Buffer *)Py_None); - /* "numcodecs/blosc.pyx":353 - * + /* "numcodecs/blosc.pyx":355 + * * # setup source buffer * source_buffer = Buffer(source, PyBUF_ANY_CONTIGUOUS) # <<<<<<<<<<<<<< * source_ptr = source_buffer.ptr - * + * */ - __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 353, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 355, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_source); __Pyx_GIVEREF(__pyx_v_source); @@ -4175,33 +4252,33 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_source_buffer = ((struct __pyx_obj_9numcodecs_10compat_ext_Buffer *)__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":354 + /* "numcodecs/blosc.pyx":356 * # setup source buffer * source_buffer = Buffer(source, PyBUF_ANY_CONTIGUOUS) * source_ptr = source_buffer.ptr # <<<<<<<<<<<<<< - * + * * # determine buffer size */ __pyx_t_3 = __pyx_v_source_buffer->ptr; __pyx_v_source_ptr = __pyx_t_3; - /* "numcodecs/blosc.pyx":357 - * + /* "numcodecs/blosc.pyx":359 + * * # determine buffer size * blosc_cbuffer_sizes(source_ptr, &nbytes, &cbytes, &blocksize) # <<<<<<<<<<<<<< - * + * * # setup destination buffer */ blosc_cbuffer_sizes(__pyx_v_source_ptr, (&__pyx_v_nbytes), (&__pyx_v_cbytes), (&__pyx_v_blocksize)); - /* "numcodecs/blosc.pyx":360 - * + /* "numcodecs/blosc.pyx":362 + * * # setup destination buffer * if dest is None: # <<<<<<<<<<<<<< * # allocate memory @@ -4211,19 +4288,19 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_t_5 = (__pyx_t_4 != 0); if (__pyx_t_5) { - /* "numcodecs/blosc.pyx":362 + /* "numcodecs/blosc.pyx":364 * if dest is None: * # allocate memory * dest = PyBytes_FromStringAndSize(NULL, nbytes) # <<<<<<<<<<<<<< * dest_ptr = PyBytes_AS_STRING(dest) * dest_nbytes = nbytes */ - __pyx_t_1 = PyBytes_FromStringAndSize(NULL, __pyx_v_nbytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 362, __pyx_L1_error) + __pyx_t_1 = PyBytes_FromStringAndSize(NULL, __pyx_v_nbytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF_SET(__pyx_v_dest, __pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":363 + /* "numcodecs/blosc.pyx":365 * # allocate memory * dest = PyBytes_FromStringAndSize(NULL, nbytes) * dest_ptr = PyBytes_AS_STRING(dest) # <<<<<<<<<<<<<< @@ -4232,7 +4309,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject */ __pyx_v_dest_ptr = PyBytes_AS_STRING(__pyx_v_dest); - /* "numcodecs/blosc.pyx":364 + /* "numcodecs/blosc.pyx":366 * dest = PyBytes_FromStringAndSize(NULL, nbytes) * dest_ptr = PyBytes_AS_STRING(dest) * dest_nbytes = nbytes # <<<<<<<<<<<<<< @@ -4241,8 +4318,8 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject */ __pyx_v_dest_nbytes = __pyx_v_nbytes; - /* "numcodecs/blosc.pyx":360 - * + /* "numcodecs/blosc.pyx":362 + * * # setup destination buffer * if dest is None: # <<<<<<<<<<<<<< * # allocate memory @@ -4251,7 +4328,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject goto __pyx_L3; } - /* "numcodecs/blosc.pyx":366 + /* "numcodecs/blosc.pyx":368 * dest_nbytes = nbytes * else: * dest_buffer = Buffer(dest, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) # <<<<<<<<<<<<<< @@ -4259,9 +4336,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject * dest_nbytes = dest_buffer.nbytes */ /*else*/ { - __pyx_t_1 = __Pyx_PyInt_From_int((PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int((PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 366, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 368, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_dest); __Pyx_GIVEREF(__pyx_v_dest); @@ -4269,27 +4346,27 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF_SET(__pyx_v_dest_buffer, ((struct __pyx_obj_9numcodecs_10compat_ext_Buffer *)__pyx_t_1)); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":367 + /* "numcodecs/blosc.pyx":369 * else: * dest_buffer = Buffer(dest, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) * dest_ptr = dest_buffer.ptr # <<<<<<<<<<<<<< * dest_nbytes = dest_buffer.nbytes - * + * */ __pyx_t_3 = __pyx_v_dest_buffer->ptr; __pyx_v_dest_ptr = __pyx_t_3; - /* "numcodecs/blosc.pyx":368 + /* "numcodecs/blosc.pyx":370 * dest_buffer = Buffer(dest, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) * dest_ptr = dest_buffer.ptr * dest_nbytes = dest_buffer.nbytes # <<<<<<<<<<<<<< - * + * * try: */ __pyx_t_6 = __pyx_v_dest_buffer->nbytes; @@ -4297,17 +4374,17 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject } __pyx_L3:; - /* "numcodecs/blosc.pyx":370 + /* "numcodecs/blosc.pyx":372 * dest_nbytes = dest_buffer.nbytes - * + * * try: # <<<<<<<<<<<<<< - * + * * # guard condition */ /*try:*/ { - /* "numcodecs/blosc.pyx":373 - * + /* "numcodecs/blosc.pyx":375 + * * # guard condition * if dest_nbytes < nbytes: # <<<<<<<<<<<<<< * raise ValueError('destination buffer too small; expected at least %s, ' @@ -4316,18 +4393,18 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_t_5 = ((__pyx_v_dest_nbytes < __pyx_v_nbytes) != 0); if (unlikely(__pyx_t_5)) { - /* "numcodecs/blosc.pyx":375 + /* "numcodecs/blosc.pyx":377 * if dest_nbytes < nbytes: * raise ValueError('destination buffer too small; expected at least %s, ' * 'got %s' % (nbytes, dest_nbytes)) # <<<<<<<<<<<<<< - * + * * # perform decompression */ - __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_nbytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 375, __pyx_L5_error) + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_nbytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 377, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_dest_nbytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 375, __pyx_L5_error) + __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_dest_nbytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 377, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 375, __pyx_L5_error) + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 377, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); @@ -4335,26 +4412,26 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_destination_buffer_too_small_exp, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 375, __pyx_L5_error) + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_destination_buffer_too_small_exp, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 377, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/blosc.pyx":374 + /* "numcodecs/blosc.pyx":376 * # guard condition * if dest_nbytes < nbytes: * raise ValueError('destination buffer too small; expected at least %s, ' # <<<<<<<<<<<<<< * 'got %s' % (nbytes, dest_nbytes)) - * + * */ - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 374, __pyx_L5_error) + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 376, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_7, 0, 0, 0); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(0, 374, __pyx_L5_error) + __PYX_ERR(0, 376, __pyx_L5_error) - /* "numcodecs/blosc.pyx":373 - * + /* "numcodecs/blosc.pyx":375 + * * # guard condition * if dest_nbytes < nbytes: # <<<<<<<<<<<<<< * raise ValueError('destination buffer too small; expected at least %s, ' @@ -4362,14 +4439,14 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject */ } - /* "numcodecs/blosc.pyx":378 - * + /* "numcodecs/blosc.pyx":380 + * * # perform decompression * if _get_use_threads(): # <<<<<<<<<<<<<< * # allow blosc to use threads internally * with nogil: */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_use_threads); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 378, __pyx_L5_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_use_threads); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 380, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { @@ -4381,19 +4458,16 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __Pyx_DECREF_SET(__pyx_t_2, function); } } - if (__pyx_t_1) { - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 378, __pyx_L5_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 378, __pyx_L5_error) - } + __pyx_t_7 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 380, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 378, __pyx_L5_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 380, __pyx_L5_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_5) { - /* "numcodecs/blosc.pyx":380 + /* "numcodecs/blosc.pyx":382 * if _get_use_threads(): * # allow blosc to use threads internally * with nogil: # <<<<<<<<<<<<<< @@ -4408,7 +4482,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject #endif /*try:*/ { - /* "numcodecs/blosc.pyx":381 + /* "numcodecs/blosc.pyx":383 * # allow blosc to use threads internally * with nogil: * ret = blosc_decompress(source_ptr, dest_ptr, nbytes) # <<<<<<<<<<<<<< @@ -4418,7 +4492,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_v_ret = blosc_decompress(__pyx_v_source_ptr, __pyx_v_dest_ptr, __pyx_v_nbytes); } - /* "numcodecs/blosc.pyx":380 + /* "numcodecs/blosc.pyx":382 * if _get_use_threads(): * # allow blosc to use threads internally * with nogil: # <<<<<<<<<<<<<< @@ -4437,8 +4511,8 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject } } - /* "numcodecs/blosc.pyx":378 - * + /* "numcodecs/blosc.pyx":380 + * * # perform decompression * if _get_use_threads(): # <<<<<<<<<<<<<< * # allow blosc to use threads internally @@ -4447,12 +4521,12 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject goto __pyx_L8; } - /* "numcodecs/blosc.pyx":383 + /* "numcodecs/blosc.pyx":385 * ret = blosc_decompress(source_ptr, dest_ptr, nbytes) * else: * with nogil: # <<<<<<<<<<<<<< * ret = blosc_decompress_ctx(source_ptr, dest_ptr, nbytes, 1) - * + * */ /*else*/ { { @@ -4463,22 +4537,22 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject #endif /*try:*/ { - /* "numcodecs/blosc.pyx":384 + /* "numcodecs/blosc.pyx":386 * else: * with nogil: * ret = blosc_decompress_ctx(source_ptr, dest_ptr, nbytes, 1) # <<<<<<<<<<<<<< - * + * * finally: */ __pyx_v_ret = blosc_decompress_ctx(__pyx_v_source_ptr, __pyx_v_dest_ptr, __pyx_v_nbytes, 1); } - /* "numcodecs/blosc.pyx":383 + /* "numcodecs/blosc.pyx":385 * ret = blosc_decompress(source_ptr, dest_ptr, nbytes) * else: * with nogil: # <<<<<<<<<<<<<< * ret = blosc_decompress_ctx(source_ptr, dest_ptr, nbytes, 1) - * + * */ /*finally:*/ { /*normal exit:*/{ @@ -4495,8 +4569,8 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_L8:; } - /* "numcodecs/blosc.pyx":389 - * + /* "numcodecs/blosc.pyx":391 + * * # release buffers * source_buffer.release() # <<<<<<<<<<<<<< * if dest_buffer is not None: @@ -4504,38 +4578,38 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject */ /*finally:*/ { /*normal exit:*/{ - __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 389, __pyx_L1_error) + __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 391, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/blosc.pyx":390 + /* "numcodecs/blosc.pyx":392 * # release buffers * source_buffer.release() * if dest_buffer is not None: # <<<<<<<<<<<<<< * dest_buffer.release() - * + * */ __pyx_t_5 = (((PyObject *)__pyx_v_dest_buffer) != Py_None); __pyx_t_4 = (__pyx_t_5 != 0); if (__pyx_t_4) { - /* "numcodecs/blosc.pyx":391 + /* "numcodecs/blosc.pyx":393 * source_buffer.release() * if dest_buffer is not None: * dest_buffer.release() # <<<<<<<<<<<<<< - * + * * # handle errors */ - __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_dest_buffer->__pyx_vtab)->release(__pyx_v_dest_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 391, __pyx_L1_error) + __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_dest_buffer->__pyx_vtab)->release(__pyx_v_dest_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 393, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/blosc.pyx":390 + /* "numcodecs/blosc.pyx":392 * # release buffers * source_buffer.release() * if dest_buffer is not None: # <<<<<<<<<<<<<< * dest_buffer.release() - * + * */ } goto __pyx_L6; @@ -4559,45 +4633,45 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_t_8 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename; { - /* "numcodecs/blosc.pyx":389 - * + /* "numcodecs/blosc.pyx":391 + * * # release buffers * source_buffer.release() # <<<<<<<<<<<<<< * if dest_buffer is not None: * dest_buffer.release() */ - __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 389, __pyx_L17_error) + __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 391, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/blosc.pyx":390 + /* "numcodecs/blosc.pyx":392 * # release buffers * source_buffer.release() * if dest_buffer is not None: # <<<<<<<<<<<<<< * dest_buffer.release() - * + * */ __pyx_t_4 = (((PyObject *)__pyx_v_dest_buffer) != Py_None); __pyx_t_5 = (__pyx_t_4 != 0); if (__pyx_t_5) { - /* "numcodecs/blosc.pyx":391 + /* "numcodecs/blosc.pyx":393 * source_buffer.release() * if dest_buffer is not None: * dest_buffer.release() # <<<<<<<<<<<<<< - * + * * # handle errors */ - __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_dest_buffer->__pyx_vtab)->release(__pyx_v_dest_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 391, __pyx_L17_error) + __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_dest_buffer->__pyx_vtab)->release(__pyx_v_dest_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 393, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/blosc.pyx":390 + /* "numcodecs/blosc.pyx":392 * # release buffers * source_buffer.release() * if dest_buffer is not None: # <<<<<<<<<<<<<< * dest_buffer.release() - * + * */ } } @@ -4630,62 +4704,62 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_L6:; } - /* "numcodecs/blosc.pyx":394 - * + /* "numcodecs/blosc.pyx":396 + * * # handle errors * if ret <= 0: # <<<<<<<<<<<<<< * raise RuntimeError('error during blosc decompression: %d' % ret) - * + * */ __pyx_t_5 = ((__pyx_v_ret <= 0) != 0); if (unlikely(__pyx_t_5)) { - /* "numcodecs/blosc.pyx":395 + /* "numcodecs/blosc.pyx":397 * # handle errors * if ret <= 0: * raise RuntimeError('error during blosc decompression: %d' % ret) # <<<<<<<<<<<<<< - * + * * return dest */ - __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_ret); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 395, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_ret); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 397, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_error_during_blosc_decompression, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 395, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_error_during_blosc_decompression, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 397, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 395, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 397, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_7, 0, 0, 0); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(0, 395, __pyx_L1_error) + __PYX_ERR(0, 397, __pyx_L1_error) - /* "numcodecs/blosc.pyx":394 - * + /* "numcodecs/blosc.pyx":396 + * * # handle errors * if ret <= 0: # <<<<<<<<<<<<<< * raise RuntimeError('error during blosc decompression: %d' % ret) - * + * */ } - /* "numcodecs/blosc.pyx":397 + /* "numcodecs/blosc.pyx":399 * raise RuntimeError('error during blosc decompression: %d' % ret) - * + * * return dest # <<<<<<<<<<<<<< - * - * + * + * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_dest); __pyx_r = __pyx_v_dest; goto __pyx_L0; - /* "numcodecs/blosc.pyx":327 - * - * + /* "numcodecs/blosc.pyx":329 + * + * * def decompress(source, dest=None): # <<<<<<<<<<<<<< * """Decompress data. - * + * */ /* function exit code */ @@ -4704,9 +4778,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject return __pyx_r; } -/* "numcodecs/blosc.pyx":405 - * - * +/* "numcodecs/blosc.pyx":407 + * + * * def _get_use_threads(): # <<<<<<<<<<<<<< * global use_threads * proc = multiprocessing.current_process() @@ -4740,16 +4814,16 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("_get_use_threads", 0); - /* "numcodecs/blosc.pyx":407 + /* "numcodecs/blosc.pyx":409 * def _get_use_threads(): * global use_threads * proc = multiprocessing.current_process() # <<<<<<<<<<<<<< - * - * # check for fork + * + * # check if locks are available, and if not no threads */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_multiprocessing); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_multiprocessing); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 409, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_current_process); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 407, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_current_process); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 409, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; @@ -4762,40 +4836,72 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO __Pyx_DECREF_SET(__pyx_t_3, function); } } - if (__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 407, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 407, __pyx_L1_error) - } + __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 409, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_proc = __pyx_t_1; __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":410 - * - * # check for fork - * if proc.pid != _importer_pid: # <<<<<<<<<<<<<< - * # If this module has been imported in the parent process, and the current process - * # is a fork, attempting to use blosc in multi-threaded mode will cause a + /* "numcodecs/blosc.pyx":412 + * + * # check if locks are available, and if not no threads + * if not mutex: # <<<<<<<<<<<<<< + * return False + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_mutex); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 412, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 412, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = ((!__pyx_t_4) != 0); + if (__pyx_t_5) { + + /* "numcodecs/blosc.pyx":413 + * # check if locks are available, and if not no threads + * if not mutex: + * return False # <<<<<<<<<<<<<< + * + * # check for fork + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_False); + __pyx_r = Py_False; + goto __pyx_L0; + + /* "numcodecs/blosc.pyx":412 + * + * # check if locks are available, and if not no threads + * if not mutex: # <<<<<<<<<<<<<< + * return False + * + */ + } + + /* "numcodecs/blosc.pyx":416 + * + * # check for fork + * if proc.pid != _importer_pid: # <<<<<<<<<<<<<< + * # If this module has been imported in the parent process, and the current process + * # is a fork, attempting to use blosc in multi-threaded mode will cause a */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_proc, __pyx_n_s_pid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 410, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_proc, __pyx_n_s_pid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 416, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_importer_pid); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 410, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_importer_pid); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 416, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 410, __pyx_L1_error) + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 416, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 410, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 416, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_4) { + if (__pyx_t_5) { - /* "numcodecs/blosc.pyx":414 + /* "numcodecs/blosc.pyx":420 * # is a fork, attempting to use blosc in multi-threaded mode will cause a * # program hang, so we force use of blosc ctx functions, i.e., no threads. * return False # <<<<<<<<<<<<<< - * + * * if use_threads in [True, False]: */ __Pyx_XDECREF(__pyx_r); @@ -4803,8 +4909,8 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO __pyx_r = Py_False; goto __pyx_L0; - /* "numcodecs/blosc.pyx":410 - * + /* "numcodecs/blosc.pyx":416 + * * # check for fork * if proc.pid != _importer_pid: # <<<<<<<<<<<<<< * # If this module has been imported in the parent process, and the current process @@ -4812,70 +4918,70 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO */ } - /* "numcodecs/blosc.pyx":416 + /* "numcodecs/blosc.pyx":422 * return False - * + * * if use_threads in [True, False]: # <<<<<<<<<<<<<< * # user has manually overridden the default behaviour * _use_threads = use_threads */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_use_threads); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 416, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_use_threads); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 422, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, Py_True, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 416, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 416, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, Py_True, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 422, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 422, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_5) { + if (!__pyx_t_4) { } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L5_bool_binop_done; + __pyx_t_5 = __pyx_t_4; + goto __pyx_L6_bool_binop_done; } - __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, Py_False, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 416, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 416, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, Py_False, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 422, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 422, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __pyx_t_5; - __pyx_L5_bool_binop_done:; + __pyx_t_5 = __pyx_t_4; + __pyx_L6_bool_binop_done:; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = (__pyx_t_4 != 0); - if (__pyx_t_5) { + __pyx_t_4 = (__pyx_t_5 != 0); + if (__pyx_t_4) { - /* "numcodecs/blosc.pyx":418 + /* "numcodecs/blosc.pyx":424 * if use_threads in [True, False]: * # user has manually overridden the default behaviour * _use_threads = use_threads # <<<<<<<<<<<<<< - * + * * else: */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_use_threads); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 418, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_use_threads); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 424, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v__use_threads = __pyx_t_2; __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":416 + /* "numcodecs/blosc.pyx":422 * return False - * + * * if use_threads in [True, False]: # <<<<<<<<<<<<<< * # user has manually overridden the default behaviour * _use_threads = use_threads */ - goto __pyx_L4; + goto __pyx_L5; } - /* "numcodecs/blosc.pyx":427 + /* "numcodecs/blosc.pyx":433 * # program or multi-process program - * + * * if proc.name != 'MainProcess': # <<<<<<<<<<<<<< * _use_threads = False * elif hasattr(threading, 'main_thread'): */ /*else*/ { - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_proc, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 427, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_proc, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 433, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_MainProcess, Py_NE)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 427, __pyx_L1_error) + __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_MainProcess, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 433, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_5) { + if (__pyx_t_4) { - /* "numcodecs/blosc.pyx":428 - * + /* "numcodecs/blosc.pyx":434 + * * if proc.name != 'MainProcess': * _use_threads = False # <<<<<<<<<<<<<< * elif hasattr(threading, 'main_thread'): @@ -4884,40 +4990,40 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO __Pyx_INCREF(Py_False); __pyx_v__use_threads = Py_False; - /* "numcodecs/blosc.pyx":427 + /* "numcodecs/blosc.pyx":433 * # program or multi-process program - * + * * if proc.name != 'MainProcess': # <<<<<<<<<<<<<< * _use_threads = False * elif hasattr(threading, 'main_thread'): */ - goto __pyx_L7; + goto __pyx_L8; } - /* "numcodecs/blosc.pyx":429 + /* "numcodecs/blosc.pyx":435 * if proc.name != 'MainProcess': * _use_threads = False * elif hasattr(threading, 'main_thread'): # <<<<<<<<<<<<<< * _use_threads = (threading.main_thread() == threading.current_thread()) * else: */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_threading); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 429, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_threading); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 435, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_HasAttr(__pyx_t_2, __pyx_n_s_main_thread); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 429, __pyx_L1_error) + __pyx_t_4 = __Pyx_HasAttr(__pyx_t_2, __pyx_n_s_main_thread); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 435, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = (__pyx_t_5 != 0); - if (__pyx_t_4) { + __pyx_t_5 = (__pyx_t_4 != 0); + if (__pyx_t_5) { - /* "numcodecs/blosc.pyx":430 + /* "numcodecs/blosc.pyx":436 * _use_threads = False * elif hasattr(threading, 'main_thread'): * _use_threads = (threading.main_thread() == threading.current_thread()) # <<<<<<<<<<<<<< * else: * _use_threads = threading.current_thread().name == 'MainThread' */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_threading); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 430, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_threading); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 436, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_main_thread); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 430, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_main_thread); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 436, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; @@ -4930,17 +5036,14 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO __Pyx_DECREF_SET(__pyx_t_1, function); } } - if (__pyx_t_3) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 430, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 430, __pyx_L1_error) - } + __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 436, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_threading); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 430, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_threading); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 436, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_current_thread); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 430, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_current_thread); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 436, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; @@ -4953,41 +5056,38 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO __Pyx_DECREF_SET(__pyx_t_6, function); } } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 430, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 430, __pyx_L1_error) - } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 436, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 430, __pyx_L1_error) + __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 436, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v__use_threads = __pyx_t_6; __pyx_t_6 = 0; - /* "numcodecs/blosc.pyx":429 + /* "numcodecs/blosc.pyx":435 * if proc.name != 'MainProcess': * _use_threads = False * elif hasattr(threading, 'main_thread'): # <<<<<<<<<<<<<< * _use_threads = (threading.main_thread() == threading.current_thread()) * else: */ - goto __pyx_L7; + goto __pyx_L8; } - /* "numcodecs/blosc.pyx":432 + /* "numcodecs/blosc.pyx":438 * _use_threads = (threading.main_thread() == threading.current_thread()) * else: * _use_threads = threading.current_thread().name == 'MainThread' # <<<<<<<<<<<<<< - * + * * return _use_threads */ /*else*/ { - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_threading); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 432, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_threading); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 438, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_current_thread); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 432, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_current_thread); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 438, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; @@ -5000,41 +5100,38 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO __Pyx_DECREF_SET(__pyx_t_2, function); } } - if (__pyx_t_1) { - __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 432, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 432, __pyx_L1_error) - } + __pyx_t_6 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 438, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 432, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 438, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_n_s_MainThread, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 432, __pyx_L1_error) + __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_n_s_MainThread, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 438, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v__use_threads = __pyx_t_6; __pyx_t_6 = 0; } - __pyx_L7:; + __pyx_L8:; } - __pyx_L4:; + __pyx_L5:; - /* "numcodecs/blosc.pyx":434 + /* "numcodecs/blosc.pyx":440 * _use_threads = threading.current_thread().name == 'MainThread' - * + * * return _use_threads # <<<<<<<<<<<<<< - * - * + * + * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v__use_threads); __pyx_r = __pyx_v__use_threads; goto __pyx_L0; - /* "numcodecs/blosc.pyx":405 - * - * + /* "numcodecs/blosc.pyx":407 + * + * * def _get_use_threads(): # <<<<<<<<<<<<<< * global use_threads * proc = multiprocessing.current_process() @@ -5056,9 +5153,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO return __pyx_r; } -/* "numcodecs/blosc.pyx":470 +/* "numcodecs/blosc.pyx":476 * AUTOSHUFFLE = AUTOSHUFFLE - * + * * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): # <<<<<<<<<<<<<< * self.cname = cname * if isinstance(cname, text_type): @@ -5071,7 +5168,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_26__defaults__(CYTHON_UNUSED PyObjec PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("__defaults__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 476, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject*)__pyx_n_s_lz4)); __Pyx_GIVEREF(((PyObject*)__pyx_n_s_lz4)); @@ -5085,7 +5182,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_26__defaults__(CYTHON_UNUSED PyObjec __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_blocksize); __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_blocksize); PyTuple_SET_ITEM(__pyx_t_1, 3, __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_blocksize); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 476, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); @@ -5112,7 +5209,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_26__defaults__(CYTHON_UNUSED PyObjec /* Python wrapper */ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_9numcodecs_5blosc_5Blosc___init__[] = "Blosc.__init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS)"; -static PyMethodDef __pyx_mdef_9numcodecs_5blosc_5Blosc_1__init__ = {"__init__", (PyCFunction)__pyx_pw_9numcodecs_5blosc_5Blosc_1__init__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9numcodecs_5blosc_5Blosc___init__}; +static PyMethodDef __pyx_mdef_9numcodecs_5blosc_5Blosc_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9numcodecs_5blosc_5Blosc_1__init__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9numcodecs_5blosc_5Blosc___init__}; static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; PyObject *__pyx_v_cname = 0; @@ -5178,7 +5275,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_1__init__(PyObject *__pyx_sel } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 470, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 476, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -5203,7 +5300,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_1__init__(PyObject *__pyx_sel } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 470, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 476, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.blosc.Blosc.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -5223,47 +5320,60 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc___init__(CYTHON_UNUSED PyObje int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("__init__", 0); - /* "numcodecs/blosc.pyx":471 - * + /* "numcodecs/blosc.pyx":477 + * * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): * self.cname = cname # <<<<<<<<<<<<<< * if isinstance(cname, text_type): * self._cname_bytes = cname.encode('ascii') */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cname, __pyx_v_cname) < 0) __PYX_ERR(0, 471, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cname, __pyx_v_cname) < 0) __PYX_ERR(0, 477, __pyx_L1_error) - /* "numcodecs/blosc.pyx":472 + /* "numcodecs/blosc.pyx":478 * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): * self.cname = cname * if isinstance(cname, text_type): # <<<<<<<<<<<<<< * self._cname_bytes = cname.encode('ascii') * else: */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_text_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 472, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_text_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 478, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_IsInstance(__pyx_v_cname, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 472, __pyx_L1_error) + __pyx_t_2 = PyObject_IsInstance(__pyx_v_cname, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 478, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { - /* "numcodecs/blosc.pyx":473 + /* "numcodecs/blosc.pyx":479 * self.cname = cname * if isinstance(cname, text_type): * self._cname_bytes = cname.encode('ascii') # <<<<<<<<<<<<<< * else: * self._cname_bytes = cname */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cname, __pyx_n_s_encode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 473, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 473, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_cname, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 479, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cname_bytes, __pyx_t_4) < 0) __PYX_ERR(0, 473, __pyx_L1_error) + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_n_s_ascii) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_n_s_ascii); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 479, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cname_bytes, __pyx_t_1) < 0) __PYX_ERR(0, 479, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":472 + /* "numcodecs/blosc.pyx":478 * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): * self.cname = cname * if isinstance(cname, text_type): # <<<<<<<<<<<<<< @@ -5273,7 +5383,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc___init__(CYTHON_UNUSED PyObje goto __pyx_L3; } - /* "numcodecs/blosc.pyx":475 + /* "numcodecs/blosc.pyx":481 * self._cname_bytes = cname.encode('ascii') * else: * self._cname_bytes = cname # <<<<<<<<<<<<<< @@ -5281,40 +5391,40 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc___init__(CYTHON_UNUSED PyObje * self.shuffle = shuffle */ /*else*/ { - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cname_bytes, __pyx_v_cname) < 0) __PYX_ERR(0, 475, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cname_bytes, __pyx_v_cname) < 0) __PYX_ERR(0, 481, __pyx_L1_error) } __pyx_L3:; - /* "numcodecs/blosc.pyx":476 + /* "numcodecs/blosc.pyx":482 * else: * self._cname_bytes = cname * self.clevel = clevel # <<<<<<<<<<<<<< * self.shuffle = shuffle * self.blocksize = blocksize */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_clevel, __pyx_v_clevel) < 0) __PYX_ERR(0, 476, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_clevel, __pyx_v_clevel) < 0) __PYX_ERR(0, 482, __pyx_L1_error) - /* "numcodecs/blosc.pyx":477 + /* "numcodecs/blosc.pyx":483 * self._cname_bytes = cname * self.clevel = clevel * self.shuffle = shuffle # <<<<<<<<<<<<<< * self.blocksize = blocksize - * + * */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_shuffle, __pyx_v_shuffle) < 0) __PYX_ERR(0, 477, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_shuffle, __pyx_v_shuffle) < 0) __PYX_ERR(0, 483, __pyx_L1_error) - /* "numcodecs/blosc.pyx":478 + /* "numcodecs/blosc.pyx":484 * self.clevel = clevel * self.shuffle = shuffle * self.blocksize = blocksize # <<<<<<<<<<<<<< - * + * * def encode(self, buf): */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_blocksize, __pyx_v_blocksize) < 0) __PYX_ERR(0, 478, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_blocksize, __pyx_v_blocksize) < 0) __PYX_ERR(0, 484, __pyx_L1_error) - /* "numcodecs/blosc.pyx":470 + /* "numcodecs/blosc.pyx":476 * AUTOSHUFFLE = AUTOSHUFFLE - * + * * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): # <<<<<<<<<<<<<< * self.cname = cname * if isinstance(cname, text_type): @@ -5326,6 +5436,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc___init__(CYTHON_UNUSED PyObje __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("numcodecs.blosc.Blosc.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -5334,18 +5445,18 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc___init__(CYTHON_UNUSED PyObje return __pyx_r; } -/* "numcodecs/blosc.pyx":480 +/* "numcodecs/blosc.pyx":486 * self.blocksize = blocksize - * + * * def encode(self, buf): # <<<<<<<<<<<<<< + * self._check_buffer_size(buf) * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) - * */ /* Python wrapper */ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_3encode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_9numcodecs_5blosc_5Blosc_2encode[] = "Blosc.encode(self, buf)"; -static PyMethodDef __pyx_mdef_9numcodecs_5blosc_5Blosc_3encode = {"encode", (PyCFunction)__pyx_pw_9numcodecs_5blosc_5Blosc_3encode, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9numcodecs_5blosc_5Blosc_2encode}; +static PyMethodDef __pyx_mdef_9numcodecs_5blosc_5Blosc_3encode = {"encode", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9numcodecs_5blosc_5Blosc_3encode, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9numcodecs_5blosc_5Blosc_2encode}; static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_3encode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; PyObject *__pyx_v_buf = 0; @@ -5375,11 +5486,11 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_3encode(PyObject *__pyx_self, case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buf)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, 1); __PYX_ERR(0, 480, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, 1); __PYX_ERR(0, 486, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode") < 0)) __PYX_ERR(0, 480, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode") < 0)) __PYX_ERR(0, 486, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -5392,7 +5503,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_3encode(PyObject *__pyx_self, } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 480, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 486, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.blosc.Blosc.encode", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -5419,23 +5530,49 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_2encode(CYTHON_UNUSED PyObjec PyObject *__pyx_t_9 = NULL; __Pyx_RefNannySetupContext("encode", 0); - /* "numcodecs/blosc.pyx":481 - * + /* "numcodecs/blosc.pyx":487 + * + * def encode(self, buf): + * self._check_buffer_size(buf) # <<<<<<<<<<<<<< + * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) + * + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_check_buffer_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 487, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_buf) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_buf); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 487, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "numcodecs/blosc.pyx":488 * def encode(self, buf): + * self._check_buffer_size(buf) * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) # <<<<<<<<<<<<<< - * + * * def decode(self, buf, out=None): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_compress); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 481, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_compress); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 488, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cname_bytes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 481, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cname_bytes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 488, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_clevel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 481, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_clevel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 488, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_shuffle); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 481, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_shuffle); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 488, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_blocksize); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 481, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_blocksize); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 488, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; __pyx_t_8 = 0; @@ -5452,7 +5589,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_2encode(CYTHON_UNUSED PyObjec #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[6] = {__pyx_t_7, __pyx_v_buf, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 481, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 488, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -5464,7 +5601,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_2encode(CYTHON_UNUSED PyObjec #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[6] = {__pyx_t_7, __pyx_v_buf, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 481, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 488, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -5474,7 +5611,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_2encode(CYTHON_UNUSED PyObjec } else #endif { - __pyx_t_9 = PyTuple_New(5+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 481, __pyx_L1_error) + __pyx_t_9 = PyTuple_New(5+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 488, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); if (__pyx_t_7) { __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; @@ -5494,7 +5631,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_2encode(CYTHON_UNUSED PyObjec __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 481, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 488, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } @@ -5503,12 +5640,12 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_2encode(CYTHON_UNUSED PyObjec __pyx_t_1 = 0; goto __pyx_L0; - /* "numcodecs/blosc.pyx":480 + /* "numcodecs/blosc.pyx":486 * self.blocksize = blocksize - * + * * def encode(self, buf): # <<<<<<<<<<<<<< + * self._check_buffer_size(buf) * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) - * */ /* function exit code */ @@ -5529,20 +5666,20 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_2encode(CYTHON_UNUSED PyObjec return __pyx_r; } -/* "numcodecs/blosc.pyx":483 +/* "numcodecs/blosc.pyx":490 * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) - * + * * def decode(self, buf, out=None): # <<<<<<<<<<<<<< + * self._check_buffer_size(buf) * return decompress(buf, out) - * */ /* Python wrapper */ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_5decode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_9numcodecs_5blosc_5Blosc_4decode[] = "Blosc.decode(self, buf, out=None)"; -static PyMethodDef __pyx_mdef_9numcodecs_5blosc_5Blosc_5decode = {"decode", (PyCFunction)__pyx_pw_9numcodecs_5blosc_5Blosc_5decode, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9numcodecs_5blosc_5Blosc_4decode}; +static PyMethodDef __pyx_mdef_9numcodecs_5blosc_5Blosc_5decode = {"decode", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9numcodecs_5blosc_5Blosc_5decode, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9numcodecs_5blosc_5Blosc_4decode}; static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_5decode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - CYTHON_UNUSED PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_self = 0; PyObject *__pyx_v_buf = 0; PyObject *__pyx_v_out = 0; PyObject *__pyx_r = 0; @@ -5574,7 +5711,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_5decode(PyObject *__pyx_self, case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buf)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, 1); __PYX_ERR(0, 483, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, 1); __PYX_ERR(0, 490, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -5584,7 +5721,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_5decode(PyObject *__pyx_self, } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode") < 0)) __PYX_ERR(0, 483, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode") < 0)) __PYX_ERR(0, 490, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -5602,7 +5739,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_5decode(PyObject *__pyx_self, } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 483, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 490, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.blosc.Blosc.decode", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -5615,7 +5752,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_5decode(PyObject *__pyx_self, return __pyx_r; } -static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_4decode(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_buf, PyObject *__pyx_v_out) { +static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_4decode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_buf, PyObject *__pyx_v_out) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -5625,15 +5762,41 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_4decode(CYTHON_UNUSED PyObjec PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("decode", 0); - /* "numcodecs/blosc.pyx":484 - * + /* "numcodecs/blosc.pyx":491 + * * def decode(self, buf, out=None): + * self._check_buffer_size(buf) # <<<<<<<<<<<<<< + * return decompress(buf, out) + * + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_check_buffer_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 491, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_buf) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_buf); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 491, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "numcodecs/blosc.pyx":492 + * def decode(self, buf, out=None): + * self._check_buffer_size(buf) * return decompress(buf, out) # <<<<<<<<<<<<<< - * + * * def __repr__(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_decompress); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 484, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_decompress); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 492, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; __pyx_t_4 = 0; @@ -5650,7 +5813,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_4decode(CYTHON_UNUSED PyObjec #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_buf, __pyx_v_out}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 484, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 492, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else @@ -5658,13 +5821,13 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_4decode(CYTHON_UNUSED PyObjec #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_buf, __pyx_v_out}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 484, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 492, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif { - __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 484, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 492, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (__pyx_t_3) { __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; @@ -5675,7 +5838,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_4decode(CYTHON_UNUSED PyObjec __Pyx_INCREF(__pyx_v_out); __Pyx_GIVEREF(__pyx_v_out); PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_out); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 484, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 492, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } @@ -5684,12 +5847,12 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_4decode(CYTHON_UNUSED PyObjec __pyx_t_1 = 0; goto __pyx_L0; - /* "numcodecs/blosc.pyx":483 + /* "numcodecs/blosc.pyx":490 * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) - * + * * def decode(self, buf, out=None): # <<<<<<<<<<<<<< + * self._check_buffer_size(buf) * return decompress(buf, out) - * */ /* function exit code */ @@ -5706,9 +5869,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_4decode(CYTHON_UNUSED PyObjec return __pyx_r; } -/* "numcodecs/blosc.pyx":486 +/* "numcodecs/blosc.pyx":494 * return decompress(buf, out) - * + * * def __repr__(self): # <<<<<<<<<<<<<< * r = '%s(cname=%r, clevel=%r, shuffle=%s, blocksize=%s)' % \ * (type(self).__name__, @@ -5741,72 +5904,72 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_6__repr__(CYTHON_UNUSED PyObj PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("__repr__", 0); - /* "numcodecs/blosc.pyx":488 + /* "numcodecs/blosc.pyx":496 * def __repr__(self): * r = '%s(cname=%r, clevel=%r, shuffle=%s, blocksize=%s)' % \ * (type(self).__name__, # <<<<<<<<<<<<<< * self.cname, * self.clevel, */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_self)), __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 488, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_self)), __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 496, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - /* "numcodecs/blosc.pyx":489 + /* "numcodecs/blosc.pyx":497 * r = '%s(cname=%r, clevel=%r, shuffle=%s, blocksize=%s)' % \ * (type(self).__name__, * self.cname, # <<<<<<<<<<<<<< * self.clevel, * _shuffle_repr[self.shuffle + 1], */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cname); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 489, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cname); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 497, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - /* "numcodecs/blosc.pyx":490 + /* "numcodecs/blosc.pyx":498 * (type(self).__name__, * self.cname, * self.clevel, # <<<<<<<<<<<<<< * _shuffle_repr[self.shuffle + 1], * self.blocksize) */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_clevel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 490, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_clevel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 498, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - /* "numcodecs/blosc.pyx":491 + /* "numcodecs/blosc.pyx":499 * self.cname, * self.clevel, * _shuffle_repr[self.shuffle + 1], # <<<<<<<<<<<<<< * self.blocksize) * return r */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_shuffle_repr); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 491, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_shuffle_repr); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 499, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_shuffle); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 491, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_shuffle); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 499, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_5, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 491, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_5, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 499, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 491, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 499, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "numcodecs/blosc.pyx":492 + /* "numcodecs/blosc.pyx":500 * self.clevel, * _shuffle_repr[self.shuffle + 1], * self.blocksize) # <<<<<<<<<<<<<< * return r */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_blocksize); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 492, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_blocksize); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 500, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - /* "numcodecs/blosc.pyx":488 + /* "numcodecs/blosc.pyx":496 * def __repr__(self): * r = '%s(cname=%r, clevel=%r, shuffle=%s, blocksize=%s)' % \ * (type(self).__name__, # <<<<<<<<<<<<<< * self.cname, * self.clevel, */ - __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 488, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 496, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); @@ -5824,20 +5987,20 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_6__repr__(CYTHON_UNUSED PyObj __pyx_t_5 = 0; __pyx_t_6 = 0; - /* "numcodecs/blosc.pyx":487 - * + /* "numcodecs/blosc.pyx":495 + * * def __repr__(self): * r = '%s(cname=%r, clevel=%r, shuffle=%s, blocksize=%s)' % \ # <<<<<<<<<<<<<< * (type(self).__name__, * self.cname, */ - __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_s_cname_r_clevel_r_shuffle_s_bl, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 487, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_s_cname_r_clevel_r_shuffle_s_bl, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 495, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_r = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0; - /* "numcodecs/blosc.pyx":493 + /* "numcodecs/blosc.pyx":501 * _shuffle_repr[self.shuffle + 1], * self.blocksize) * return r # <<<<<<<<<<<<<< @@ -5847,9 +6010,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_6__repr__(CYTHON_UNUSED PyObj __pyx_r = __pyx_v_r; goto __pyx_L0; - /* "numcodecs/blosc.pyx":486 + /* "numcodecs/blosc.pyx":494 * return decompress(buf, out) - * + * * def __repr__(self): # <<<<<<<<<<<<<< * r = '%s(cname=%r, clevel=%r, shuffle=%s, blocksize=%s)' % \ * (type(self).__name__, @@ -5874,7 +6037,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_6__repr__(CYTHON_UNUSED PyObj /* "array.pxd":93 * __data_union data - * + * * def __getbuffer__(self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< * # This implementation of getbuffer is geared towards Cython * # requirements, and does not yet fulfill the PEP. @@ -5915,7 +6078,7 @@ static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_se * # In particular strided access is always provided regardless * # of flags * item_count = Py_SIZE(self) # <<<<<<<<<<<<<< - * + * * info.suboffsets = NULL */ __pyx_t_1 = PyInt_FromSsize_t(Py_SIZE(((PyObject *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 98, __pyx_L1_error) @@ -5925,7 +6088,7 @@ static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_se /* "array.pxd":100 * item_count = Py_SIZE(self) - * + * * info.suboffsets = NULL # <<<<<<<<<<<<<< * info.buf = self.data.as_chars * info.readonly = 0 @@ -5933,7 +6096,7 @@ static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_se __pyx_v_info->suboffsets = NULL; /* "array.pxd":101 - * + * * info.suboffsets = NULL * info.buf = self.data.as_chars # <<<<<<<<<<<<<< * info.readonly = 0 @@ -5965,7 +6128,7 @@ static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_se * info.ndim = 1 * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float) # <<<<<<<<<<<<<< * info.len = info.itemsize * item_count - * + * */ __pyx_t_3 = __pyx_v_self->ob_descr->itemsize; __pyx_v_info->itemsize = __pyx_t_3; @@ -5974,7 +6137,7 @@ static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_se * info.ndim = 1 * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float) * info.len = info.itemsize * item_count # <<<<<<<<<<<<<< - * + * * info.shape = PyObject_Malloc(sizeof(Py_ssize_t) + 2) */ __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_info->itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 105, __pyx_L1_error) @@ -5988,7 +6151,7 @@ static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_se /* "array.pxd":107 * info.len = info.itemsize * item_count - * + * * info.shape = PyObject_Malloc(sizeof(Py_ssize_t) + 2) # <<<<<<<<<<<<<< * if not info.shape: * raise MemoryError() @@ -5996,7 +6159,7 @@ static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_se __pyx_v_info->shape = ((Py_ssize_t *)PyObject_Malloc(((sizeof(Py_ssize_t)) + 2))); /* "array.pxd":108 - * + * * info.shape = PyObject_Malloc(sizeof(Py_ssize_t) + 2) * if not info.shape: # <<<<<<<<<<<<<< * raise MemoryError() @@ -6015,7 +6178,7 @@ static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_se PyErr_NoMemory(); __PYX_ERR(1, 109, __pyx_L1_error) /* "array.pxd":108 - * + * * info.shape = PyObject_Malloc(sizeof(Py_ssize_t) + 2) * if not info.shape: # <<<<<<<<<<<<<< * raise MemoryError() @@ -6028,7 +6191,7 @@ static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_se * raise MemoryError() * info.shape[0] = item_count # constant regardless of resizing # <<<<<<<<<<<<<< * info.strides = &info.itemsize - * + * */ __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_item_count); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 110, __pyx_L1_error) (__pyx_v_info->shape[0]) = __pyx_t_5; @@ -6037,14 +6200,14 @@ static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_se * raise MemoryError() * info.shape[0] = item_count # constant regardless of resizing * info.strides = &info.itemsize # <<<<<<<<<<<<<< - * + * * info.format = (info.shape + 1) */ __pyx_v_info->strides = (&__pyx_v_info->itemsize); /* "array.pxd":113 * info.strides = &info.itemsize - * + * * info.format = (info.shape + 1) # <<<<<<<<<<<<<< * info.format[0] = self.ob_descr.typecode * info.format[1] = 0 @@ -6052,7 +6215,7 @@ static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_se __pyx_v_info->format = ((char *)(__pyx_v_info->shape + 1)); /* "array.pxd":114 - * + * * info.format = (info.shape + 1) * info.format[0] = self.ob_descr.typecode # <<<<<<<<<<<<<< * info.format[1] = 0 @@ -6066,7 +6229,7 @@ static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_se * info.format[0] = self.ob_descr.typecode * info.format[1] = 0 # <<<<<<<<<<<<<< * info.obj = self - * + * */ (__pyx_v_info->format[1]) = 0; @@ -6074,7 +6237,7 @@ static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_se * info.format[0] = self.ob_descr.typecode * info.format[1] = 0 * info.obj = self # <<<<<<<<<<<<<< - * + * * def __releasebuffer__(self, Py_buffer* info): */ __Pyx_INCREF(((PyObject *)__pyx_v_self)); @@ -6085,7 +6248,7 @@ static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_se /* "array.pxd":93 * __data_union data - * + * * def __getbuffer__(self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< * # This implementation of getbuffer is geared towards Cython * # requirements, and does not yet fulfill the PEP. @@ -6117,10 +6280,10 @@ static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_se /* "array.pxd":118 * info.obj = self - * + * * def __releasebuffer__(self, Py_buffer* info): # <<<<<<<<<<<<<< * PyObject_Free(info.shape) - * + * */ /* Python wrapper */ @@ -6139,20 +6302,20 @@ static void __pyx_pf_7cpython_5array_5array_2__releasebuffer__(CYTHON_UNUSED arr __Pyx_RefNannySetupContext("__releasebuffer__", 0); /* "array.pxd":119 - * + * * def __releasebuffer__(self, Py_buffer* info): * PyObject_Free(info.shape) # <<<<<<<<<<<<<< - * + * * array newarrayobject(PyTypeObject* type, Py_ssize_t size, arraydescr *descr) */ PyObject_Free(__pyx_v_info->shape); /* "array.pxd":118 * info.obj = self - * + * * def __releasebuffer__(self, Py_buffer* info): # <<<<<<<<<<<<<< * PyObject_Free(info.shape) - * + * */ /* function exit code */ @@ -6160,8 +6323,8 @@ static void __pyx_pf_7cpython_5array_5array_2__releasebuffer__(CYTHON_UNUSED arr } /* "array.pxd":130 - * - * + * + * * cdef inline array clone(array template, Py_ssize_t length, bint zero): # <<<<<<<<<<<<<< * """ fast creation of a new array, given a template array. * type will be same as template. @@ -6213,7 +6376,7 @@ static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_clone(arrayobject *__p * if zero and op is not None: * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize) # <<<<<<<<<<<<<< * return op - * + * */ (void)(memset(__pyx_v_op->data.as_chars, 0, (__pyx_v_length * __pyx_v_op->ob_descr->itemsize))); @@ -6230,7 +6393,7 @@ static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_clone(arrayobject *__p * if zero and op is not None: * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize) * return op # <<<<<<<<<<<<<< - * + * * cdef inline array copy(array self): */ __Pyx_XDECREF(((PyObject *)__pyx_r)); @@ -6239,8 +6402,8 @@ static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_clone(arrayobject *__p goto __pyx_L0; /* "array.pxd":130 - * - * + * + * * cdef inline array clone(array template, Py_ssize_t length, bint zero): # <<<<<<<<<<<<<< * """ fast creation of a new array, given a template array. * type will be same as template. @@ -6260,7 +6423,7 @@ static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_clone(arrayobject *__p /* "array.pxd":139 * return op - * + * * cdef inline array copy(array self): # <<<<<<<<<<<<<< * """ make a copy of an array. """ * op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr) @@ -6290,7 +6453,7 @@ static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_copy(arrayobject *__py * op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr) * memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize) # <<<<<<<<<<<<<< * return op - * + * */ (void)(memcpy(__pyx_v_op->data.as_chars, __pyx_v_self->data.as_chars, (Py_SIZE(((PyObject *)__pyx_v_op)) * __pyx_v_op->ob_descr->itemsize))); @@ -6298,7 +6461,7 @@ static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_copy(arrayobject *__py * op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr) * memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize) * return op # <<<<<<<<<<<<<< - * + * * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1: */ __Pyx_XDECREF(((PyObject *)__pyx_r)); @@ -6308,7 +6471,7 @@ static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_copy(arrayobject *__py /* "array.pxd":139 * return op - * + * * cdef inline array copy(array self): # <<<<<<<<<<<<<< * """ make a copy of an array. """ * op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr) @@ -6328,7 +6491,7 @@ static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_copy(arrayobject *__py /* "array.pxd":145 * return op - * + * * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1: # <<<<<<<<<<<<<< * """ efficient appending of new stuff of same type * (e.g. of same array type) @@ -6375,7 +6538,7 @@ static CYTHON_INLINE int __pyx_f_7cpython_5array_extend_buffer(arrayobject *__py * resize_smart(self, origsize + n) * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize) # <<<<<<<<<<<<<< * return 0 - * + * */ (void)(memcpy((__pyx_v_self->data.as_chars + (__pyx_v_origsize * __pyx_v_itemsize)), __pyx_v_stuff, (__pyx_v_n * __pyx_v_itemsize))); @@ -6383,7 +6546,7 @@ static CYTHON_INLINE int __pyx_f_7cpython_5array_extend_buffer(arrayobject *__py * resize_smart(self, origsize + n) * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize) * return 0 # <<<<<<<<<<<<<< - * + * * cdef inline int extend(array self, array other) except -1: */ __pyx_r = 0; @@ -6391,7 +6554,7 @@ static CYTHON_INLINE int __pyx_f_7cpython_5array_extend_buffer(arrayobject *__py /* "array.pxd":145 * return op - * + * * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1: # <<<<<<<<<<<<<< * """ efficient appending of new stuff of same type * (e.g. of same array type) @@ -6408,7 +6571,7 @@ static CYTHON_INLINE int __pyx_f_7cpython_5array_extend_buffer(arrayobject *__py /* "array.pxd":155 * return 0 - * + * * cdef inline int extend(array self, array other) except -1: # <<<<<<<<<<<<<< * """ extend array with data from another array; types must match. """ * if self.ob_descr.typecode != other.ob_descr.typecode: @@ -6436,7 +6599,7 @@ static CYTHON_INLINE int __pyx_f_7cpython_5array_extend(arrayobject *__pyx_v_sel * if self.ob_descr.typecode != other.ob_descr.typecode: * PyErr_BadArgument() # <<<<<<<<<<<<<< * return extend_buffer(self, other.data.as_chars, Py_SIZE(other)) - * + * */ __pyx_t_2 = PyErr_BadArgument(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 158, __pyx_L1_error) @@ -6453,7 +6616,7 @@ static CYTHON_INLINE int __pyx_f_7cpython_5array_extend(arrayobject *__pyx_v_sel * if self.ob_descr.typecode != other.ob_descr.typecode: * PyErr_BadArgument() * return extend_buffer(self, other.data.as_chars, Py_SIZE(other)) # <<<<<<<<<<<<<< - * + * * cdef inline void zero(array self): */ __pyx_t_2 = __pyx_f_7cpython_5array_extend_buffer(__pyx_v_self, __pyx_v_other->data.as_chars, Py_SIZE(((PyObject *)__pyx_v_other))); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 159, __pyx_L1_error) @@ -6462,7 +6625,7 @@ static CYTHON_INLINE int __pyx_f_7cpython_5array_extend(arrayobject *__pyx_v_sel /* "array.pxd":155 * return 0 - * + * * cdef inline int extend(array self, array other) except -1: # <<<<<<<<<<<<<< * """ extend array with data from another array; types must match. """ * if self.ob_descr.typecode != other.ob_descr.typecode: @@ -6479,7 +6642,7 @@ static CYTHON_INLINE int __pyx_f_7cpython_5array_extend(arrayobject *__pyx_v_sel /* "array.pxd":161 * return extend_buffer(self, other.data.as_chars, Py_SIZE(other)) - * + * * cdef inline void zero(array self): # <<<<<<<<<<<<<< * """ set all elements of array to zero. """ * memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize) @@ -6498,7 +6661,7 @@ static CYTHON_INLINE void __pyx_f_7cpython_5array_zero(arrayobject *__pyx_v_self /* "array.pxd":161 * return extend_buffer(self, other.data.as_chars, Py_SIZE(other)) - * + * * cdef inline void zero(array self): # <<<<<<<<<<<<<< * """ set all elements of array to zero. """ * memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize) @@ -6543,8 +6706,18 @@ static struct PyModuleDef __pyx_moduledef = { NULL /* m_free */ }; #endif +#ifndef CYTHON_SMALL_CODE +#if defined(__clang__) + #define CYTHON_SMALL_CODE +#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) + #define CYTHON_SMALL_CODE __attribute__((cold)) +#else + #define CYTHON_SMALL_CODE +#endif +#endif static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0}, {&__pyx_n_s_AUTOBLOCKS, __pyx_k_AUTOBLOCKS, sizeof(__pyx_k_AUTOBLOCKS), 0, 0, 1, 1}, {&__pyx_n_s_AUTOSHUFFLE, __pyx_k_AUTOSHUFFLE, sizeof(__pyx_k_AUTOSHUFFLE), 0, 0, 1, 1}, {&__pyx_n_s_BITSHUFFLE, __pyx_k_BITSHUFFLE, sizeof(__pyx_k_BITSHUFFLE), 0, 0, 1, 1}, @@ -6565,13 +6738,13 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_MainThread, __pyx_k_MainThread, sizeof(__pyx_k_MainThread), 0, 0, 1, 1}, {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, {&__pyx_n_s_NOSHUFFLE, __pyx_k_NOSHUFFLE, sizeof(__pyx_k_NOSHUFFLE), 0, 0, 1, 1}, + {&__pyx_n_s_OSError, __pyx_k_OSError, sizeof(__pyx_k_OSError), 0, 0, 1, 1}, {&__pyx_n_s_PY2, __pyx_k_PY2, sizeof(__pyx_k_PY2), 0, 0, 1, 1}, {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1}, {&__pyx_n_s_SHUFFLE, __pyx_k_SHUFFLE, sizeof(__pyx_k_SHUFFLE), 0, 0, 1, 1}, {&__pyx_n_s_VERSION_DATE, __pyx_k_VERSION_DATE, sizeof(__pyx_k_VERSION_DATE), 0, 0, 1, 1}, {&__pyx_n_s_VERSION_STRING, __pyx_k_VERSION_STRING, sizeof(__pyx_k_VERSION_STRING), 0, 0, 1, 1}, {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, - {&__pyx_kp_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 0}, {&__pyx_n_s_abc, __pyx_k_abc, sizeof(__pyx_k_abc), 0, 0, 1, 1}, {&__pyx_n_s_ascii, __pyx_k_ascii, sizeof(__pyx_k_ascii), 0, 0, 1, 1}, {&__pyx_kp_s_bad_compressor_or_compressor_not, __pyx_k_bad_compressor_or_compressor_not, sizeof(__pyx_k_bad_compressor_or_compressor_not), 0, 0, 1, 0}, @@ -6583,6 +6756,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_cbuffer_metainfo, __pyx_k_cbuffer_metainfo, sizeof(__pyx_k_cbuffer_metainfo), 0, 0, 1, 1}, {&__pyx_n_s_cbuffer_sizes, __pyx_k_cbuffer_sizes, sizeof(__pyx_k_cbuffer_sizes), 0, 0, 1, 1}, {&__pyx_n_s_cbytes, __pyx_k_cbytes, sizeof(__pyx_k_cbytes), 0, 0, 1, 1}, + {&__pyx_n_s_check_buffer_size, __pyx_k_check_buffer_size, sizeof(__pyx_k_check_buffer_size), 0, 0, 1, 1}, {&__pyx_n_s_clevel, __pyx_k_clevel, sizeof(__pyx_k_clevel), 0, 0, 1, 1}, {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, {&__pyx_n_s_cname, __pyx_k_cname, sizeof(__pyx_k_cname), 0, 0, 1, 1}, @@ -6666,282 +6840,228 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; -static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 212, __pyx_L1_error) - __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 319, __pyx_L1_error) +static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_OSError = __Pyx_GetBuiltinName(__pyx_n_s_OSError); if (!__pyx_builtin_OSError) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 214, __pyx_L1_error) + __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 321, __pyx_L1_error) __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 109, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; } -static int __Pyx_InitCachedConstants(void) { +static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "numcodecs/blosc.pyx":101 - * instead.""" - * if isinstance(cname, text_type): - * cname = cname.encode('ascii') # <<<<<<<<<<<<<< - * return blosc_compname_to_compcode(cname) - * - */ - __pyx_tuple_ = PyTuple_Pack(1, __pyx_n_s_ascii); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 101, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple_); - __Pyx_GIVEREF(__pyx_tuple_); - - /* "numcodecs/blosc.pyx":109 - * s = blosc_list_compressors() - * if not PY2: - * s = s.decode('ascii') # <<<<<<<<<<<<<< - * return s.split(',') - * - */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_n_s_ascii); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 109, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__2); - __Pyx_GIVEREF(__pyx_tuple__2); - - /* "numcodecs/blosc.pyx":110 - * if not PY2: - * s = s.decode('ascii') - * return s.split(',') # <<<<<<<<<<<<<< - * - * - */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s__3); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 110, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__4); - __Pyx_GIVEREF(__pyx_tuple__4); - - /* "numcodecs/blosc.pyx":168 - * - * if not PY2: - * complib = complib.decode('ascii') # <<<<<<<<<<<<<< - * - * return complib - */ - __pyx_tuple__5 = PyTuple_Pack(1, __pyx_n_s_ascii); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 168, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); - - /* "numcodecs/blosc.pyx":289 + /* "numcodecs/blosc.pyx":291 * # to ensure no-one else can modify the global context while we're setting it * # up and using it. * with mutex: # <<<<<<<<<<<<<< - * + * * # set compressor */ - __pyx_tuple__8 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 289, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); - - /* "numcodecs/blosc.pyx":473 - * self.cname = cname - * if isinstance(cname, text_type): - * self._cname_bytes = cname.encode('ascii') # <<<<<<<<<<<<<< - * else: - * self._cname_bytes = cname - */ - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_n_s_ascii); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 473, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__9); - __Pyx_GIVEREF(__pyx_tuple__9); + __pyx_tuple__4 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 291, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__4); + __Pyx_GIVEREF(__pyx_tuple__4); - /* "numcodecs/blosc.pyx":86 - * - * + /* "numcodecs/blosc.pyx":88 + * + * * def init(): # <<<<<<<<<<<<<< * """Initialize the Blosc library environment.""" * blosc_init() */ - __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_init, 86, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_init, 88, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 88, __pyx_L1_error) - /* "numcodecs/blosc.pyx":91 - * - * + /* "numcodecs/blosc.pyx":93 + * + * * def destroy(): # <<<<<<<<<<<<<< * """Destroy the Blosc library environment.""" * blosc_destroy() */ - __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_destroy, 91, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 91, __pyx_L1_error) + __pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_destroy, 93, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(0, 93, __pyx_L1_error) - /* "numcodecs/blosc.pyx":96 - * - * + /* "numcodecs/blosc.pyx":98 + * + * * def compname_to_compcode(cname): # <<<<<<<<<<<<<< * """Return the compressor code associated with the compressor name. If the compressor * name is not recognized, or there is not support for it in this build, -1 is returned */ - __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_cname); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 96, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__12); - __Pyx_GIVEREF(__pyx_tuple__12); - __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_compname_to_compcode, 96, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 96, __pyx_L1_error) + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_n_s_cname); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__7); + __Pyx_GIVEREF(__pyx_tuple__7); + __pyx_codeobj__8 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__7, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_compname_to_compcode, 98, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__8)) __PYX_ERR(0, 98, __pyx_L1_error) - /* "numcodecs/blosc.pyx":105 - * - * + /* "numcodecs/blosc.pyx":107 + * + * * def list_compressors(): # <<<<<<<<<<<<<< * """Get a list of compressors supported in the current build.""" * s = blosc_list_compressors() */ - __pyx_tuple__14 = PyTuple_Pack(1, __pyx_n_s_s); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 105, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__14); - __Pyx_GIVEREF(__pyx_tuple__14); - __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_list_compressors, 105, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 105, __pyx_L1_error) + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_n_s_s); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__9); + __Pyx_GIVEREF(__pyx_tuple__9); + __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_list_compressors, 107, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 107, __pyx_L1_error) - /* "numcodecs/blosc.pyx":113 - * - * + /* "numcodecs/blosc.pyx":115 + * + * * def get_nthreads(): # <<<<<<<<<<<<<< * """Get the number of threads that Blosc uses internally for compression and * decompression.""" */ - __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_get_nthreads, 113, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 113, __pyx_L1_error) + __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_get_nthreads, 115, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 115, __pyx_L1_error) - /* "numcodecs/blosc.pyx":119 - * - * + /* "numcodecs/blosc.pyx":121 + * + * * def set_nthreads(int nthreads): # <<<<<<<<<<<<<< * """Set the number of threads that Blosc uses internally for compression and * decompression.""" */ - __pyx_tuple__17 = PyTuple_Pack(2, __pyx_n_s_nthreads, __pyx_n_s_nthreads); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 119, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__17); - __Pyx_GIVEREF(__pyx_tuple__17); - __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_set_nthreads, 119, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 119, __pyx_L1_error) + __pyx_tuple__12 = PyTuple_Pack(2, __pyx_n_s_nthreads, __pyx_n_s_nthreads); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__12); + __Pyx_GIVEREF(__pyx_tuple__12); + __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_set_nthreads, 121, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 121, __pyx_L1_error) - /* "numcodecs/blosc.pyx":125 - * - * + /* "numcodecs/blosc.pyx":127 + * + * * def cbuffer_sizes(source): # <<<<<<<<<<<<<< * """Return information about a compressed buffer, namely the number of uncompressed * bytes (`nbytes`) and compressed (`cbytes`). It also returns the `blocksize` (which */ - __pyx_tuple__19 = PyTuple_Pack(5, __pyx_n_s_source, __pyx_n_s_buffer, __pyx_n_s_nbytes, __pyx_n_s_cbytes, __pyx_n_s_blocksize); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 125, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__19); - __Pyx_GIVEREF(__pyx_tuple__19); - __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_cbuffer_sizes, 125, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 125, __pyx_L1_error) + __pyx_tuple__14 = PyTuple_Pack(5, __pyx_n_s_source, __pyx_n_s_buffer, __pyx_n_s_nbytes, __pyx_n_s_cbytes, __pyx_n_s_blocksize); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__14); + __Pyx_GIVEREF(__pyx_tuple__14); + __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_cbuffer_sizes, 127, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 127, __pyx_L1_error) - /* "numcodecs/blosc.pyx":153 - * - * + /* "numcodecs/blosc.pyx":155 + * + * * def cbuffer_complib(source): # <<<<<<<<<<<<<< * """Return the name of the compression library used to compress `source`.""" * cdef: */ - __pyx_tuple__21 = PyTuple_Pack(3, __pyx_n_s_source, __pyx_n_s_buffer, __pyx_n_s_complib); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 153, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__21); - __Pyx_GIVEREF(__pyx_tuple__21); - __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_cbuffer_complib, 153, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 153, __pyx_L1_error) + __pyx_tuple__16 = PyTuple_Pack(3, __pyx_n_s_source, __pyx_n_s_buffer, __pyx_n_s_complib); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 155, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__16); + __Pyx_GIVEREF(__pyx_tuple__16); + __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_cbuffer_complib, 155, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 155, __pyx_L1_error) - /* "numcodecs/blosc.pyx":173 - * - * + /* "numcodecs/blosc.pyx":175 + * + * * def cbuffer_metainfo(source): # <<<<<<<<<<<<<< * """Return some meta-information about the compressed buffer in `source`, including * the typesize, whether the shuffle or bit-shuffle filters were used, and the */ - __pyx_tuple__23 = PyTuple_Pack(6, __pyx_n_s_source, __pyx_n_s_buffer, __pyx_n_s_typesize, __pyx_n_s_flags, __pyx_n_s_shuffle, __pyx_n_s_memcpyed); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 173, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__23); - __Pyx_GIVEREF(__pyx_tuple__23); - __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_cbuffer_metainfo, 173, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 173, __pyx_L1_error) + __pyx_tuple__18 = PyTuple_Pack(6, __pyx_n_s_source, __pyx_n_s_buffer, __pyx_n_s_typesize, __pyx_n_s_flags, __pyx_n_s_shuffle, __pyx_n_s_memcpyed); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 175, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__18); + __Pyx_GIVEREF(__pyx_tuple__18); + __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_cbuffer_metainfo, 175, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 175, __pyx_L1_error) - /* "numcodecs/blosc.pyx":211 - * - * + /* "numcodecs/blosc.pyx":213 + * + * * def err_bad_cname(cname): # <<<<<<<<<<<<<< * raise ValueError('bad compressor or compressor not supported: %r; expected one of ' * '%s' % (cname, list_compressors())) */ - __pyx_tuple__25 = PyTuple_Pack(1, __pyx_n_s_cname); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 211, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__25); - __Pyx_GIVEREF(__pyx_tuple__25); - __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_err_bad_cname, 211, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 211, __pyx_L1_error) + __pyx_tuple__20 = PyTuple_Pack(1, __pyx_n_s_cname); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 213, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__20); + __Pyx_GIVEREF(__pyx_tuple__20); + __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_err_bad_cname, 213, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 213, __pyx_L1_error) - /* "numcodecs/blosc.pyx":216 - * - * + /* "numcodecs/blosc.pyx":218 + * + * * def compress(source, char* cname, int clevel, int shuffle=SHUFFLE, # <<<<<<<<<<<<<< * int blocksize=AUTOBLOCKS): * """Compress data. */ - __pyx_tuple__27 = PyTuple_Pack(14, __pyx_n_s_source, __pyx_n_s_cname, __pyx_n_s_clevel, __pyx_n_s_shuffle, __pyx_n_s_blocksize, __pyx_n_s_source_ptr, __pyx_n_s_dest_ptr, __pyx_n_s_source_buffer, __pyx_n_s_nbytes, __pyx_n_s_itemsize, __pyx_n_s_cbytes, __pyx_n_s_dest, __pyx_n_s_cname_str, __pyx_n_s_compressor_set); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 216, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__27); - __Pyx_GIVEREF(__pyx_tuple__27); - __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(5, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_compress, 216, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 216, __pyx_L1_error) + __pyx_tuple__22 = PyTuple_Pack(14, __pyx_n_s_source, __pyx_n_s_cname, __pyx_n_s_clevel, __pyx_n_s_shuffle, __pyx_n_s_blocksize, __pyx_n_s_source_ptr, __pyx_n_s_dest_ptr, __pyx_n_s_source_buffer, __pyx_n_s_nbytes, __pyx_n_s_itemsize, __pyx_n_s_cbytes, __pyx_n_s_dest, __pyx_n_s_cname_str, __pyx_n_s_compressor_set); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 218, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__22); + __Pyx_GIVEREF(__pyx_tuple__22); + __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(5, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_compress, 218, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 218, __pyx_L1_error) - /* "numcodecs/blosc.pyx":327 - * - * + /* "numcodecs/blosc.pyx":329 + * + * * def decompress(source, dest=None): # <<<<<<<<<<<<<< * """Decompress data. - * + * */ - __pyx_tuple__29 = PyTuple_Pack(11, __pyx_n_s_source, __pyx_n_s_dest, __pyx_n_s_ret, __pyx_n_s_source_ptr, __pyx_n_s_dest_ptr, __pyx_n_s_source_buffer, __pyx_n_s_dest_buffer, __pyx_n_s_nbytes, __pyx_n_s_cbytes, __pyx_n_s_blocksize, __pyx_n_s_dest_nbytes); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 327, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__29); - __Pyx_GIVEREF(__pyx_tuple__29); - __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(2, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_decompress, 327, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 327, __pyx_L1_error) + __pyx_tuple__24 = PyTuple_Pack(11, __pyx_n_s_source, __pyx_n_s_dest, __pyx_n_s_ret, __pyx_n_s_source_ptr, __pyx_n_s_dest_ptr, __pyx_n_s_source_buffer, __pyx_n_s_dest_buffer, __pyx_n_s_nbytes, __pyx_n_s_cbytes, __pyx_n_s_blocksize, __pyx_n_s_dest_nbytes); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 329, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__24); + __Pyx_GIVEREF(__pyx_tuple__24); + __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(2, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_decompress, 329, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 329, __pyx_L1_error) - /* "numcodecs/blosc.pyx":405 - * - * + /* "numcodecs/blosc.pyx":407 + * + * * def _get_use_threads(): # <<<<<<<<<<<<<< * global use_threads * proc = multiprocessing.current_process() */ - __pyx_tuple__31 = PyTuple_Pack(2, __pyx_n_s_proc, __pyx_n_s_use_threads_2); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 405, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__31); - __Pyx_GIVEREF(__pyx_tuple__31); - __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_get_use_threads, 405, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 405, __pyx_L1_error) + __pyx_tuple__26 = PyTuple_Pack(2, __pyx_n_s_proc, __pyx_n_s_use_threads_2); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__26); + __Pyx_GIVEREF(__pyx_tuple__26); + __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_get_use_threads, 407, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 407, __pyx_L1_error) - /* "numcodecs/blosc.pyx":470 + /* "numcodecs/blosc.pyx":476 * AUTOSHUFFLE = AUTOSHUFFLE - * + * * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): # <<<<<<<<<<<<<< * self.cname = cname * if isinstance(cname, text_type): */ - __pyx_tuple__33 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_cname, __pyx_n_s_clevel, __pyx_n_s_shuffle, __pyx_n_s_blocksize); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 470, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__33); - __Pyx_GIVEREF(__pyx_tuple__33); - __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_init_2, 470, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_tuple__28 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_cname, __pyx_n_s_clevel, __pyx_n_s_shuffle, __pyx_n_s_blocksize); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 476, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__28); + __Pyx_GIVEREF(__pyx_tuple__28); + __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_init_2, 476, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 476, __pyx_L1_error) - /* "numcodecs/blosc.pyx":480 + /* "numcodecs/blosc.pyx":486 * self.blocksize = blocksize - * + * * def encode(self, buf): # <<<<<<<<<<<<<< + * self._check_buffer_size(buf) * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) - * */ - __pyx_tuple__35 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_buf); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 480, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__35); - __Pyx_GIVEREF(__pyx_tuple__35); - __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_encode, 480, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 480, __pyx_L1_error) + __pyx_tuple__30 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_buf); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__30); + __Pyx_GIVEREF(__pyx_tuple__30); + __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_encode, 486, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 486, __pyx_L1_error) - /* "numcodecs/blosc.pyx":483 + /* "numcodecs/blosc.pyx":490 * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) - * + * * def decode(self, buf, out=None): # <<<<<<<<<<<<<< + * self._check_buffer_size(buf) * return decompress(buf, out) - * */ - __pyx_tuple__37 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_buf, __pyx_n_s_out); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 483, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__37); - __Pyx_GIVEREF(__pyx_tuple__37); - __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_decode, 483, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 483, __pyx_L1_error) - __pyx_tuple__39 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 483, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__39); - __Pyx_GIVEREF(__pyx_tuple__39); + __pyx_tuple__32 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_buf, __pyx_n_s_out); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 490, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__32); + __Pyx_GIVEREF(__pyx_tuple__32); + __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_decode, 490, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 490, __pyx_L1_error) + __pyx_tuple__34 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 490, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__34); + __Pyx_GIVEREF(__pyx_tuple__34); - /* "numcodecs/blosc.pyx":486 + /* "numcodecs/blosc.pyx":494 * return decompress(buf, out) - * + * * def __repr__(self): # <<<<<<<<<<<<<< * r = '%s(cname=%r, clevel=%r, shuffle=%s, blocksize=%s)' % \ * (type(self).__name__, */ - __pyx_tuple__40 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_r); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 486, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__40); - __Pyx_GIVEREF(__pyx_tuple__40); - __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_repr, 486, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 486, __pyx_L1_error) + __pyx_tuple__35 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_r); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 494, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__35); + __Pyx_GIVEREF(__pyx_tuple__35); + __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_repr, 494, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 494, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -6949,7 +7069,7 @@ static int __Pyx_InitCachedConstants(void) { return -1; } -static int __Pyx_InitGlobals(void) { +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) @@ -6960,13 +7080,13 @@ static int __Pyx_InitGlobals(void) { return -1; } -static int __Pyx_modinit_global_init_code(void); /*proto*/ -static int __Pyx_modinit_variable_export_code(void); /*proto*/ -static int __Pyx_modinit_function_export_code(void); /*proto*/ -static int __Pyx_modinit_type_init_code(void); /*proto*/ -static int __Pyx_modinit_type_import_code(void); /*proto*/ -static int __Pyx_modinit_variable_import_code(void); /*proto*/ -static int __Pyx_modinit_function_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ static int __Pyx_modinit_global_init_code(void) { __Pyx_RefNannyDeclarations @@ -7002,23 +7122,45 @@ static int __Pyx_modinit_type_init_code(void) { static int __Pyx_modinit_type_import_code(void) { __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); /*--- Type import code ---*/ - __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 sizeof(PyTypeObject), #else sizeof(PyHeapTypeObject), #endif - 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) __PYX_ERR(2, 9, __pyx_L1_error) - __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) __PYX_ERR(3, 8, __pyx_L1_error) - __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) __PYX_ERR(4, 15, __pyx_L1_error) - __pyx_ptype_7cpython_5array_array = __Pyx_ImportType("array", "array", sizeof(arrayobject), 0); if (unlikely(!__pyx_ptype_7cpython_5array_array)) __PYX_ERR(1, 58, __pyx_L1_error) - __pyx_ptype_9numcodecs_10compat_ext_Buffer = __Pyx_ImportType("numcodecs.compat_ext", "Buffer", sizeof(struct __pyx_obj_9numcodecs_10compat_ext_Buffer), 1); if (unlikely(!__pyx_ptype_9numcodecs_10compat_ext_Buffer)) __PYX_ERR(5, 5, __pyx_L1_error) + __Pyx_ImportType_CheckSize_Warn); + if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), __Pyx_ImportType_CheckSize_Warn); + if (!__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(3, 8, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), __Pyx_ImportType_CheckSize_Warn); + if (!__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(4, 15, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("array"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 58, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_ptype_7cpython_5array_array = __Pyx_ImportType(__pyx_t_1, "array", "array", sizeof(arrayobject), __Pyx_ImportType_CheckSize_Warn); + if (!__pyx_ptype_7cpython_5array_array) __PYX_ERR(1, 58, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("numcodecs.compat_ext"); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_ptype_9numcodecs_10compat_ext_Buffer = __Pyx_ImportType(__pyx_t_1, "numcodecs.compat_ext", "Buffer", sizeof(struct __pyx_obj_9numcodecs_10compat_ext_Buffer), __Pyx_ImportType_CheckSize_Warn); + if (!__pyx_ptype_9numcodecs_10compat_ext_Buffer) __PYX_ERR(5, 5, __pyx_L1_error) __pyx_vtabptr_9numcodecs_10compat_ext_Buffer = (struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer*)__Pyx_GetVtable(__pyx_ptype_9numcodecs_10compat_ext_Buffer->tp_dict); if (unlikely(!__pyx_vtabptr_9numcodecs_10compat_ext_Buffer)) __PYX_ERR(5, 5, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); __Pyx_RefNannyFinishContext(); return -1; } @@ -7053,15 +7195,6 @@ static int __Pyx_modinit_function_import_code(void) { #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC #endif #endif -#ifndef CYTHON_SMALL_CODE -#if defined(__clang__) - #define CYTHON_SMALL_CODE -#elif defined(__GNUC__) - #define CYTHON_SMALL_CODE __attribute__((optimize("Os"))) -#else - #define CYTHON_SMALL_CODE -#endif -#endif #if PY_MAJOR_VERSION < 3 @@ -7074,7 +7207,30 @@ __Pyx_PyMODINIT_FUNC PyInit_blosc(void) { return PyModuleDef_Init(&__pyx_moduledef); } -static int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name) { +static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { + #if PY_VERSION_HEX >= 0x030700A1 + static PY_INT64_T main_interpreter_id = -1; + PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); + if (main_interpreter_id == -1) { + main_interpreter_id = current_id; + return (unlikely(current_id == -1)) ? -1 : 0; + } else if (unlikely(main_interpreter_id != current_id)) + #else + static PyInterpreterState *main_interpreter = NULL; + PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; + if (!main_interpreter) { + main_interpreter = current_interpreter; + } else if (unlikely(main_interpreter != current_interpreter)) + #endif + { + PyErr_SetString( + PyExc_ImportError, + "Interpreter change detected - this module can only be loaded into one interpreter per process."); + return -1; + } + return 0; +} +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name) { PyObject *value = PyObject_GetAttrString(spec, from_name); int result = 0; if (likely(value)) { @@ -7087,8 +7243,10 @@ static int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const ch } return result; } -static PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { +static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { PyObject *module = NULL, *moddict, *modname; + if (__Pyx_check_single_interpreter()) + return NULL; if (__pyx_m) return __Pyx_NewRef(__pyx_m); modname = PyObject_GetAttrString(spec, "name"); @@ -7109,7 +7267,7 @@ static PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *d } -static int __pyx_pymod_exec_blosc(PyObject *__pyx_pyinit_module) +static CYTHON_SMALL_CODE int __pyx_pymod_exec_blosc(PyObject *__pyx_pyinit_module) #endif #endif { @@ -7117,13 +7275,20 @@ static int __pyx_pymod_exec_blosc(PyObject *__pyx_pyinit_module) PyObject *__pyx_t_2 = NULL; int __pyx_t_3; int __pyx_t_4; - int __pyx_t_5; + PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; + int __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; __Pyx_RefNannyDeclarations #if CYTHON_PEP489_MULTI_PHASE_INIT - if (__pyx_m && __pyx_m == __pyx_pyinit_module) return 0; + if (__pyx_m) { + if (__pyx_m == __pyx_pyinit_module) return 0; + PyErr_SetString(PyExc_RuntimeError, "Module 'blosc' has already been imported. Re-initialisation is not supported."); + return -1; + } #elif PY_MAJOR_VERSION >= 3 if (__pyx_m) return __Pyx_NewRef(__pyx_m); #endif @@ -7138,6 +7303,9 @@ if (!__Pyx_RefNanny) { #endif __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_blosc(void)", 0); if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #ifdef __Pxy_PyFrame_Initialize_Offsets + __Pxy_PyFrame_Initialize_Offsets(); + #endif __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) @@ -7192,7 +7360,7 @@ if (!__Pyx_RefNanny) { if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif if (__pyx_module_is_main_numcodecs__blosc) { - if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) } #if PY_MAJOR_VERSION >= 3 { @@ -7236,7 +7404,7 @@ if (!__Pyx_RefNanny) { * import threading * import multiprocessing # <<<<<<<<<<<<<< * import os - * + * */ __pyx_t_1 = __Pyx_Import(__pyx_n_s_multiprocessing, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); @@ -7247,8 +7415,8 @@ if (!__Pyx_RefNanny) { * import threading * import multiprocessing * import os # <<<<<<<<<<<<<< - * - * + * + * */ __pyx_t_1 = __Pyx_Import(__pyx_n_s_os, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); @@ -7256,7 +7424,7 @@ if (!__Pyx_RefNanny) { __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "numcodecs/blosc.pyx":17 - * + * * from .compat_ext cimport Buffer * from .compat_ext import Buffer # <<<<<<<<<<<<<< * from .compat import PY2, text_type @@ -7277,7 +7445,7 @@ if (!__Pyx_RefNanny) { * from .compat_ext import Buffer * from .compat import PY2, text_type # <<<<<<<<<<<<<< * from .abc import Codec - * + * */ __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); @@ -7304,8 +7472,8 @@ if (!__Pyx_RefNanny) { * from .compat_ext import Buffer * from .compat import PY2, text_type * from .abc import Codec # <<<<<<<<<<<<<< - * - * + * + * */ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); @@ -7322,8 +7490,8 @@ if (!__Pyx_RefNanny) { __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "numcodecs/blosc.pyx":60 - * - * + * + * * MAX_OVERHEAD = BLOSC_MAX_OVERHEAD # <<<<<<<<<<<<<< * MAX_BUFFERSIZE = BLOSC_MAX_BUFFERSIZE * MAX_THREADS = BLOSC_MAX_THREADS @@ -7334,7 +7502,7 @@ if (!__Pyx_RefNanny) { __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "numcodecs/blosc.pyx":61 - * + * * MAX_OVERHEAD = BLOSC_MAX_OVERHEAD * MAX_BUFFERSIZE = BLOSC_MAX_BUFFERSIZE # <<<<<<<<<<<<<< * MAX_THREADS = BLOSC_MAX_THREADS @@ -7400,7 +7568,7 @@ if (!__Pyx_RefNanny) { * VERSION_STRING = VERSION_STRING.decode() * VERSION_DATE = VERSION_DATE.decode() */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_PY2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PY2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -7414,7 +7582,7 @@ if (!__Pyx_RefNanny) { * VERSION_DATE = VERSION_DATE.decode() * __version__ = VERSION_STRING */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_VERSION_STRING); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 67, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_VERSION_STRING); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_decode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); @@ -7432,7 +7600,7 @@ if (!__Pyx_RefNanny) { * __version__ = VERSION_STRING * NOSHUFFLE = BLOSC_NOSHUFFLE */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_VERSION_DATE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_VERSION_DATE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_decode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); @@ -7459,7 +7627,7 @@ if (!__Pyx_RefNanny) { * NOSHUFFLE = BLOSC_NOSHUFFLE * SHUFFLE = BLOSC_SHUFFLE */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_VERSION_STRING); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_VERSION_STRING); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_version, __pyx_t_2) < 0) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -7513,421 +7681,504 @@ if (!__Pyx_RefNanny) { * AUTOSHUFFLE = -1 * # automatic block size - let blosc decide * AUTOBLOCKS = 0 # <<<<<<<<<<<<<< - * + * * # synchronization */ if (PyDict_SetItem(__pyx_d, __pyx_n_s_AUTOBLOCKS, __pyx_int_0) < 0) __PYX_ERR(0, 76, __pyx_L1_error) /* "numcodecs/blosc.pyx":79 - * + * * # synchronization - * mutex = multiprocessing.Lock() # <<<<<<<<<<<<<< - * - * + * try: # <<<<<<<<<<<<<< + * mutex = multiprocessing.Lock() + * except OSError: */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_multiprocessing); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Lock); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_mutex, __pyx_t_2) < 0) __PYX_ERR(0, 79, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + /*try:*/ { + + /* "numcodecs/blosc.pyx":80 + * # synchronization + * try: + * mutex = multiprocessing.Lock() # <<<<<<<<<<<<<< + * except OSError: + * mutex = None + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_multiprocessing); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Lock); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_mutex, __pyx_t_2) < 0) __PYX_ERR(0, 80, __pyx_L3_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "numcodecs/blosc.pyx":79 + * + * # synchronization + * try: # <<<<<<<<<<<<<< + * mutex = multiprocessing.Lock() + * except OSError: + */ + } + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "numcodecs/blosc.pyx":81 + * try: + * mutex = multiprocessing.Lock() + * except OSError: # <<<<<<<<<<<<<< + * mutex = None + * + */ + __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_OSError); + if (__pyx_t_8) { + __Pyx_AddTraceback("numcodecs.blosc", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_9) < 0) __PYX_ERR(0, 81, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_9); + + /* "numcodecs/blosc.pyx":82 + * mutex = multiprocessing.Lock() + * except OSError: + * mutex = None # <<<<<<<<<<<<<< + * + * # store ID of process that first loads the module, so we can detect a fork later + */ + if (PyDict_SetItem(__pyx_d, __pyx_n_s_mutex, Py_None) < 0) __PYX_ERR(0, 82, __pyx_L5_except_error) + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L4_exception_handled; + } + goto __pyx_L5_except_error; + __pyx_L5_except_error:; - /* "numcodecs/blosc.pyx":83 - * + /* "numcodecs/blosc.pyx":79 + * + * # synchronization + * try: # <<<<<<<<<<<<<< + * mutex = multiprocessing.Lock() + * except OSError: + */ + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); + goto __pyx_L1_error; + __pyx_L4_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); + __pyx_L8_try_end:; + } + + /* "numcodecs/blosc.pyx":85 + * * # store ID of process that first loads the module, so we can detect a fork later * _importer_pid = os.getpid() # <<<<<<<<<<<<<< - * - * + * + * */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_getpid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_os); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_getpid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_importer_pid, __pyx_t_2) < 0) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_importer_pid, __pyx_t_9) < 0) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":86 - * - * + /* "numcodecs/blosc.pyx":88 + * + * * def init(): # <<<<<<<<<<<<<< * """Initialize the Blosc library environment.""" * blosc_init() */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_1init, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_1init, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_init, __pyx_t_9) < 0) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":91 - * - * + /* "numcodecs/blosc.pyx":93 + * + * * def destroy(): # <<<<<<<<<<<<<< * """Destroy the Blosc library environment.""" * blosc_destroy() */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_3destroy, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_destroy, __pyx_t_2) < 0) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_3destroy, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 93, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_destroy, __pyx_t_9) < 0) __PYX_ERR(0, 93, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":96 - * - * + /* "numcodecs/blosc.pyx":98 + * + * * def compname_to_compcode(cname): # <<<<<<<<<<<<<< * """Return the compressor code associated with the compressor name. If the compressor * name is not recognized, or there is not support for it in this build, -1 is returned */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5compname_to_compcode, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_compname_to_compcode, __pyx_t_2) < 0) __PYX_ERR(0, 96, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5compname_to_compcode, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_compname_to_compcode, __pyx_t_9) < 0) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":105 - * - * + /* "numcodecs/blosc.pyx":107 + * + * * def list_compressors(): # <<<<<<<<<<<<<< * """Get a list of compressors supported in the current build.""" * s = blosc_list_compressors() */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_7list_compressors, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 105, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_list_compressors, __pyx_t_2) < 0) __PYX_ERR(0, 105, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_7list_compressors, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_list_compressors, __pyx_t_9) < 0) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":113 - * - * + /* "numcodecs/blosc.pyx":115 + * + * * def get_nthreads(): # <<<<<<<<<<<<<< * """Get the number of threads that Blosc uses internally for compression and * decompression.""" */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_9get_nthreads, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_nthreads, __pyx_t_2) < 0) __PYX_ERR(0, 113, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_9get_nthreads, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 115, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_nthreads, __pyx_t_9) < 0) __PYX_ERR(0, 115, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":119 - * - * + /* "numcodecs/blosc.pyx":121 + * + * * def set_nthreads(int nthreads): # <<<<<<<<<<<<<< * """Set the number of threads that Blosc uses internally for compression and * decompression.""" */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_11set_nthreads, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 119, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_nthreads, __pyx_t_2) < 0) __PYX_ERR(0, 119, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_11set_nthreads, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_nthreads, __pyx_t_9) < 0) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":125 - * - * + /* "numcodecs/blosc.pyx":127 + * + * * def cbuffer_sizes(source): # <<<<<<<<<<<<<< * """Return information about a compressed buffer, namely the number of uncompressed * bytes (`nbytes`) and compressed (`cbytes`). It also returns the `blocksize` (which */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_13cbuffer_sizes, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 125, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_cbuffer_sizes, __pyx_t_2) < 0) __PYX_ERR(0, 125, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_13cbuffer_sizes, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_cbuffer_sizes, __pyx_t_9) < 0) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":153 - * - * + /* "numcodecs/blosc.pyx":155 + * + * * def cbuffer_complib(source): # <<<<<<<<<<<<<< * """Return the name of the compression library used to compress `source`.""" * cdef: */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_15cbuffer_complib, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_cbuffer_complib, __pyx_t_2) < 0) __PYX_ERR(0, 153, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_15cbuffer_complib, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 155, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_cbuffer_complib, __pyx_t_9) < 0) __PYX_ERR(0, 155, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":173 - * - * + /* "numcodecs/blosc.pyx":175 + * + * * def cbuffer_metainfo(source): # <<<<<<<<<<<<<< * """Return some meta-information about the compressed buffer in `source`, including * the typesize, whether the shuffle or bit-shuffle filters were used, and the */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_17cbuffer_metainfo, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_cbuffer_metainfo, __pyx_t_2) < 0) __PYX_ERR(0, 173, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_17cbuffer_metainfo, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 175, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_cbuffer_metainfo, __pyx_t_9) < 0) __PYX_ERR(0, 175, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":211 - * - * + /* "numcodecs/blosc.pyx":213 + * + * * def err_bad_cname(cname): # <<<<<<<<<<<<<< * raise ValueError('bad compressor or compressor not supported: %r; expected one of ' * '%s' % (cname, list_compressors())) - */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_19err_bad_cname, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 211, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_err_bad_cname, __pyx_t_2) < 0) __PYX_ERR(0, 211, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + */ + __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_19err_bad_cname, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 213, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_err_bad_cname, __pyx_t_9) < 0) __PYX_ERR(0, 213, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":216 - * - * + /* "numcodecs/blosc.pyx":218 + * + * * def compress(source, char* cname, int clevel, int shuffle=SHUFFLE, # <<<<<<<<<<<<<< * int blocksize=AUTOBLOCKS): * """Compress data. */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_SHUFFLE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_k__6 = __pyx_t_5; + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_SHUFFLE); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 218, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_9); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 218, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_k__2 = __pyx_t_8; - /* "numcodecs/blosc.pyx":217 - * + /* "numcodecs/blosc.pyx":219 + * * def compress(source, char* cname, int clevel, int shuffle=SHUFFLE, * int blocksize=AUTOBLOCKS): # <<<<<<<<<<<<<< * """Compress data. - * + * */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_AUTOBLOCKS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 217, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 217, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_k__7 = __pyx_t_5; + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_AUTOBLOCKS); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 219, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_9); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 219, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_k__3 = __pyx_t_8; - /* "numcodecs/blosc.pyx":216 - * - * + /* "numcodecs/blosc.pyx":218 + * + * * def compress(source, char* cname, int clevel, int shuffle=SHUFFLE, # <<<<<<<<<<<<<< * int blocksize=AUTOBLOCKS): * """Compress data. */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_21compress, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_compress, __pyx_t_2) < 0) __PYX_ERR(0, 216, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_21compress, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 218, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_compress, __pyx_t_9) < 0) __PYX_ERR(0, 218, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":327 - * - * + /* "numcodecs/blosc.pyx":329 + * + * * def decompress(source, dest=None): # <<<<<<<<<<<<<< * """Decompress data. - * + * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_23decompress, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 327, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_decompress, __pyx_t_2) < 0) __PYX_ERR(0, 327, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_23decompress, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 329, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_decompress, __pyx_t_9) < 0) __PYX_ERR(0, 329, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":402 + /* "numcodecs/blosc.pyx":404 * # set the value of this variable to True or False to override the * # default adaptive behaviour * use_threads = None # <<<<<<<<<<<<<< - * - * + * + * */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_use_threads, Py_None) < 0) __PYX_ERR(0, 402, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_use_threads, Py_None) < 0) __PYX_ERR(0, 404, __pyx_L1_error) - /* "numcodecs/blosc.pyx":405 - * - * + /* "numcodecs/blosc.pyx":407 + * + * * def _get_use_threads(): # <<<<<<<<<<<<<< * global use_threads * proc = multiprocessing.current_process() */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_25_get_use_threads, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 405, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_use_threads, __pyx_t_2) < 0) __PYX_ERR(0, 405, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_25_get_use_threads, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_use_threads, __pyx_t_9) < 0) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":437 - * - * + /* "numcodecs/blosc.pyx":443 + * + * * _shuffle_repr = ['AUTOSHUFFLE', 'NOSHUFFLE', 'SHUFFLE', 'BITSHUFFLE'] # <<<<<<<<<<<<<< - * - * + * + * */ - __pyx_t_2 = PyList_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 437, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = PyList_New(4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 443, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(__pyx_n_s_AUTOSHUFFLE); __Pyx_GIVEREF(__pyx_n_s_AUTOSHUFFLE); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_AUTOSHUFFLE); + PyList_SET_ITEM(__pyx_t_9, 0, __pyx_n_s_AUTOSHUFFLE); __Pyx_INCREF(__pyx_n_s_NOSHUFFLE); __Pyx_GIVEREF(__pyx_n_s_NOSHUFFLE); - PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_NOSHUFFLE); + PyList_SET_ITEM(__pyx_t_9, 1, __pyx_n_s_NOSHUFFLE); __Pyx_INCREF(__pyx_n_s_SHUFFLE); __Pyx_GIVEREF(__pyx_n_s_SHUFFLE); - PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_SHUFFLE); + PyList_SET_ITEM(__pyx_t_9, 2, __pyx_n_s_SHUFFLE); __Pyx_INCREF(__pyx_n_s_BITSHUFFLE); __Pyx_GIVEREF(__pyx_n_s_BITSHUFFLE); - PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_s_BITSHUFFLE); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_shuffle_repr, __pyx_t_2) < 0) __PYX_ERR(0, 437, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyList_SET_ITEM(__pyx_t_9, 3, __pyx_n_s_BITSHUFFLE); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_shuffle_repr, __pyx_t_9) < 0) __PYX_ERR(0, 443, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":440 - * - * + /* "numcodecs/blosc.pyx":446 + * + * * class Blosc(Codec): # <<<<<<<<<<<<<< * """Codec providing compression using the Blosc meta-compressor. - * + * */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Codec); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 440, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 440, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_Codec); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 446, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 446, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 440, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 446, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_9, __pyx_t_1, __pyx_n_s_Blosc, __pyx_n_s_Blosc, (PyObject *) NULL, __pyx_n_s_numcodecs_blosc, __pyx_kp_s_Codec_providing_compression_usin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 446, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_Blosc, __pyx_n_s_Blosc, (PyObject *) NULL, __pyx_n_s_numcodecs_blosc, __pyx_kp_s_Codec_providing_compression_usin); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 440, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - /* "numcodecs/blosc.pyx":464 + /* "numcodecs/blosc.pyx":470 * """ - * + * * codec_id = 'blosc' # <<<<<<<<<<<<<< * NOSHUFFLE = NOSHUFFLE * SHUFFLE = SHUFFLE */ - if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_codec_id, __pyx_n_s_blosc) < 0) __PYX_ERR(0, 464, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_codec_id, __pyx_n_s_blosc) < 0) __PYX_ERR(0, 470, __pyx_L1_error) - /* "numcodecs/blosc.pyx":465 - * + /* "numcodecs/blosc.pyx":471 + * * codec_id = 'blosc' * NOSHUFFLE = NOSHUFFLE # <<<<<<<<<<<<<< * SHUFFLE = SHUFFLE * BITSHUFFLE = BITSHUFFLE */ - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_NOSHUFFLE); - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 465, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_NOSHUFFLE, __pyx_t_7) < 0) __PYX_ERR(0, 465, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_NOSHUFFLE); + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 471, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_NOSHUFFLE, __pyx_t_10) < 0) __PYX_ERR(0, 471, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "numcodecs/blosc.pyx":466 + /* "numcodecs/blosc.pyx":472 * codec_id = 'blosc' * NOSHUFFLE = NOSHUFFLE * SHUFFLE = SHUFFLE # <<<<<<<<<<<<<< * BITSHUFFLE = BITSHUFFLE * AUTOSHUFFLE = AUTOSHUFFLE */ - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_SHUFFLE); - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 466, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_SHUFFLE, __pyx_t_7) < 0) __PYX_ERR(0, 466, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_SHUFFLE); + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 472, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_SHUFFLE, __pyx_t_10) < 0) __PYX_ERR(0, 472, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "numcodecs/blosc.pyx":467 + /* "numcodecs/blosc.pyx":473 * NOSHUFFLE = NOSHUFFLE * SHUFFLE = SHUFFLE * BITSHUFFLE = BITSHUFFLE # <<<<<<<<<<<<<< * AUTOSHUFFLE = AUTOSHUFFLE - * + * */ - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_BITSHUFFLE); - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 467, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_BITSHUFFLE, __pyx_t_7) < 0) __PYX_ERR(0, 467, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_BITSHUFFLE); + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 473, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_BITSHUFFLE, __pyx_t_10) < 0) __PYX_ERR(0, 473, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "numcodecs/blosc.pyx":468 + /* "numcodecs/blosc.pyx":474 * SHUFFLE = SHUFFLE * BITSHUFFLE = BITSHUFFLE * AUTOSHUFFLE = AUTOSHUFFLE # <<<<<<<<<<<<<< - * + * * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): */ - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_AUTOSHUFFLE); - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 468, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_AUTOSHUFFLE, __pyx_t_7) < 0) __PYX_ERR(0, 468, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_AUTOSHUFFLE); + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 474, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_AUTOSHUFFLE, __pyx_t_10) < 0) __PYX_ERR(0, 474, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "numcodecs/blosc.pyx":470 + /* "numcodecs/blosc.pyx":476 * AUTOSHUFFLE = AUTOSHUFFLE - * + * * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): # <<<<<<<<<<<<<< * self.cname = cname * if isinstance(cname, text_type): */ - __pyx_t_7 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5Blosc_1__init__, 0, __pyx_n_s_Blosc___init, NULL, __pyx_n_s_numcodecs_blosc, __pyx_d, ((PyObject *)__pyx_codeobj__34)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 470, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (!__Pyx_CyFunction_InitDefaults(__pyx_t_7, sizeof(__pyx_defaults), 2)) __PYX_ERR(0, 470, __pyx_L1_error) - __pyx_t_8 = PyObject_GetItem(__pyx_t_6, __pyx_n_s_SHUFFLE); - if (unlikely(!__pyx_t_8)) { + __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5Blosc_1__init__, 0, __pyx_n_s_Blosc___init, NULL, __pyx_n_s_numcodecs_blosc, __pyx_d, ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 476, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (!__Pyx_CyFunction_InitDefaults(__pyx_t_10, sizeof(__pyx_defaults), 2)) __PYX_ERR(0, 476, __pyx_L1_error) + __pyx_t_11 = PyObject_GetItem(__pyx_t_2, __pyx_n_s_SHUFFLE); + if (unlikely(!__pyx_t_11)) { PyErr_Clear(); - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_SHUFFLE); + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_SHUFFLE); } - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 470, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_7)->__pyx_arg_shuffle = __pyx_t_8; - __Pyx_GIVEREF(__pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_AUTOBLOCKS); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 470, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_7)->__pyx_arg_blocksize = __pyx_t_8; - __Pyx_GIVEREF(__pyx_t_8); - __pyx_t_8 = 0; - __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_7, __pyx_pf_9numcodecs_5blosc_26__defaults__); - if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_init_2, __pyx_t_7) < 0) __PYX_ERR(0, 470, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 476, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_10)->__pyx_arg_shuffle = __pyx_t_11; + __Pyx_GIVEREF(__pyx_t_11); + __pyx_t_11 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_AUTOBLOCKS); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 476, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_10)->__pyx_arg_blocksize = __pyx_t_11; + __Pyx_GIVEREF(__pyx_t_11); + __pyx_t_11 = 0; + __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_10, __pyx_pf_9numcodecs_5blosc_26__defaults__); + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init_2, __pyx_t_10) < 0) __PYX_ERR(0, 476, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "numcodecs/blosc.pyx":480 + /* "numcodecs/blosc.pyx":486 * self.blocksize = blocksize - * + * * def encode(self, buf): # <<<<<<<<<<<<<< + * self._check_buffer_size(buf) * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) - * */ - __pyx_t_7 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5Blosc_3encode, 0, __pyx_n_s_Blosc_encode, NULL, __pyx_n_s_numcodecs_blosc, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 480, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_encode, __pyx_t_7) < 0) __PYX_ERR(0, 480, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5Blosc_3encode, 0, __pyx_n_s_Blosc_encode, NULL, __pyx_n_s_numcodecs_blosc, __pyx_d, ((PyObject *)__pyx_codeobj__31)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_encode, __pyx_t_10) < 0) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "numcodecs/blosc.pyx":483 + /* "numcodecs/blosc.pyx":490 * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) - * + * * def decode(self, buf, out=None): # <<<<<<<<<<<<<< + * self._check_buffer_size(buf) * return decompress(buf, out) - * */ - __pyx_t_7 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5Blosc_5decode, 0, __pyx_n_s_Blosc_decode, NULL, __pyx_n_s_numcodecs_blosc, __pyx_d, ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 483, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__39); - if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_decode, __pyx_t_7) < 0) __PYX_ERR(0, 483, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5Blosc_5decode, 0, __pyx_n_s_Blosc_decode, NULL, __pyx_n_s_numcodecs_blosc, __pyx_d, ((PyObject *)__pyx_codeobj__33)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 490, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_10, __pyx_tuple__34); + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_decode, __pyx_t_10) < 0) __PYX_ERR(0, 490, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "numcodecs/blosc.pyx":486 + /* "numcodecs/blosc.pyx":494 * return decompress(buf, out) - * + * * def __repr__(self): # <<<<<<<<<<<<<< * r = '%s(cname=%r, clevel=%r, shuffle=%s, blocksize=%s)' % \ * (type(self).__name__, */ - __pyx_t_7 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5Blosc_7__repr__, 0, __pyx_n_s_Blosc___repr, NULL, __pyx_n_s_numcodecs_blosc, __pyx_d, ((PyObject *)__pyx_codeobj__41)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 486, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_repr, __pyx_t_7) < 0) __PYX_ERR(0, 486, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5Blosc_7__repr__, 0, __pyx_n_s_Blosc___repr, NULL, __pyx_n_s_numcodecs_blosc, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 494, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_repr, __pyx_t_10) < 0) __PYX_ERR(0, 494, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "numcodecs/blosc.pyx":440 - * - * + /* "numcodecs/blosc.pyx":446 + * + * * class Blosc(Codec): # <<<<<<<<<<<<<< * """Codec providing compression using the Blosc meta-compressor. - * + * */ - __pyx_t_7 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_Blosc, __pyx_t_1, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 440, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_Blosc, __pyx_t_7) < 0) __PYX_ERR(0, 440, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_10 = __Pyx_Py3ClassCreate(__pyx_t_9, __pyx_n_s_Blosc, __pyx_t_1, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 446, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Blosc, __pyx_t_10) < 0) __PYX_ERR(0, 446, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "numcodecs/blosc.pyx":1 @@ -7942,7 +8193,7 @@ if (!__Pyx_RefNanny) { /* "array.pxd":161 * return extend_buffer(self, other.data.as_chars, Py_SIZE(other)) - * + * * cdef inline void zero(array self): # <<<<<<<<<<<<<< * """ set all elements of array to zero. """ * memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize) @@ -7954,14 +8205,14 @@ if (!__Pyx_RefNanny) { __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); if (__pyx_m) { if (__pyx_d) { - __Pyx_AddTraceback("init numcodecs.blosc", 0, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("init numcodecs.blosc", __pyx_clineno, __pyx_lineno, __pyx_filename); } - Py_DECREF(__pyx_m); __pyx_m = 0; + Py_CLEAR(__pyx_m); } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init numcodecs.blosc"); } @@ -7982,9 +8233,9 @@ if (!__Pyx_RefNanny) { static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; - m = PyImport_ImportModule((char *)modname); + m = PyImport_ImportModule(modname); if (!m) goto end; - p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + p = PyObject_GetAttrString(m, "RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: @@ -8023,61 +8274,49 @@ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { } /* GetModuleGlobalName */ -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { +#if CYTHON_USE_DICT_VERSIONS +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) +#else +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) +#endif +{ PyObject *result; #if !CYTHON_AVOID_BORROWED_REFS #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) if (likely(result)) { - Py_INCREF(result); + return __Pyx_NewRef(result); } else if (unlikely(PyErr_Occurred())) { - result = NULL; - } else { + return NULL; + } #else result = PyDict_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) if (likely(result)) { - Py_INCREF(result); - } else { + return __Pyx_NewRef(result); + } #endif #else result = PyObject_GetItem(__pyx_d, name); - if (!result) { - PyErr_Clear(); -#endif - result = __Pyx_GetBuiltinName(name); - } - return result; -} - -/* PyObjectCall */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = func->ob_type->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); } - return result; -} + PyErr_Clear(); #endif + return __Pyx_GetBuiltinName(name); +} /* PyCFunctionFastCall */ - #if CYTHON_FAST_PYCCALL +#if CYTHON_FAST_PYCCALL static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { PyCFunctionObject *func = (PyCFunctionObject*)func_obj; PyCFunction meth = PyCFunction_GET_FUNCTION(func); PyObject *self = PyCFunction_GET_SELF(func); int flags = PyCFunction_GET_FLAGS(func); assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS))); + assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); assert(nargs >= 0); assert(nargs == 0 || args != NULL); /* _PyCFunction_FastCallDict() must not be called with an exception set, @@ -8085,16 +8324,15 @@ static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, P caller loses its exception */ assert(!PyErr_Occurred()); if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { - return (*((__Pyx_PyCFunctionFastWithKeywords)meth)) (self, args, nargs, NULL); + return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); } else { - return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs); + return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); } } #endif /* PyFunctionFastCall */ - #if CYTHON_FAST_PYCALL -#include "frameobject.h" +#if CYTHON_FAST_PYCALL static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, PyObject *globals) { PyFrameObject *f; @@ -8112,7 +8350,7 @@ static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args if (f == NULL) { return NULL; } - fastlocals = f->f_localsplus; + fastlocals = __Pyx_PyFrame_GetLocalsplus(f); for (i = 0; i < na; i++) { Py_INCREF(*args); fastlocals[i] = *args++; @@ -8212,8 +8450,57 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #endif #endif +/* PyObjectCall */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *result; + ternaryfunc call = func->ob_type->tp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = (*call)(func, arg, kw); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectCall2Args */ +static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { + PyObject *args, *result = NULL; + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(function)) { + PyObject *args[2] = {arg1, arg2}; + return __Pyx_PyFunction_FastCall(function, args, 2); + } + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(function)) { + PyObject *args[2] = {arg1, arg2}; + return __Pyx_PyCFunction_FastCall(function, args, 2); + } + #endif + args = PyTuple_New(2); + if (unlikely(!args)) goto done; + Py_INCREF(arg1); + PyTuple_SET_ITEM(args, 0, arg1); + Py_INCREF(arg2); + PyTuple_SET_ITEM(args, 1, arg2); + Py_INCREF(function); + result = __Pyx_PyObject_Call(function, args, NULL); + Py_DECREF(args); + Py_DECREF(function); +done: + return result; +} + /* PyObjectCallMethO */ - #if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { PyObject *self, *result; PyCFunction cfunc; @@ -8233,7 +8520,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject #endif /* PyObjectCallOneArg */ - #if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { PyObject *result; PyObject *args = PyTuple_New(1); @@ -8273,7 +8560,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObjec #endif /* PyObjectCallNoArg */ - #if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { #if CYTHON_FAST_PYCALL if (PyFunction_Check(func)) { @@ -8281,10 +8568,11 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { } #endif #ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || __Pyx_TypeCheck(func, __pyx_CyFunctionType))) { + if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func))) #else - if (likely(PyCFunction_Check(func))) { + if (likely(PyCFunction_Check(func))) #endif + { if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { return __Pyx_PyObject_CallMethO(func, NULL); } @@ -8294,7 +8582,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { #endif /* PyErrFetchRestore */ - #if CYTHON_FAST_THREAD_STATE +#if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; tmp_type = tstate->curexc_type; @@ -8318,7 +8606,7 @@ static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject #endif /* RaiseException */ - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { __Pyx_PyThreadState_declare @@ -8477,7 +8765,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject #endif /* RaiseArgTupleInvalid */ - static void __Pyx_RaiseArgtupleInvalid( +static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, @@ -8503,7 +8791,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } /* RaiseDoubleKeywords */ - static void __Pyx_RaiseDoubleKeywordsError( +static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { @@ -8517,7 +8805,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } /* ParseKeywords */ - static int __Pyx_ParseOptionalKeywords( +static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, @@ -8619,7 +8907,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } /* decode_c_string */ - static CYTHON_INLINE PyObject* __Pyx_decode_c_string( +static CYTHON_INLINE PyObject* __Pyx_decode_c_string( const char* cstring, Py_ssize_t start, Py_ssize_t stop, const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { @@ -8651,13 +8939,29 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } } +/* GetTopmostException */ +#if CYTHON_USE_EXC_INFO_STACK +static _PyErr_StackItem * +__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) +{ + _PyErr_StackItem *exc_info = tstate->exc_info; + while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) && + exc_info->previous_item != NULL) + { + exc_info = exc_info->previous_item; + } + return exc_info; +} +#endif + /* SaveResetException */ - #if CYTHON_FAST_THREAD_STATE +#if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - #if PY_VERSION_HEX >= 0x030700A2 - *type = tstate->exc_state.exc_type; - *value = tstate->exc_state.exc_value; - *tb = tstate->exc_state.exc_traceback; + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + *type = exc_info->exc_type; + *value = exc_info->exc_value; + *tb = exc_info->exc_traceback; #else *type = tstate->exc_type; *value = tstate->exc_value; @@ -8669,13 +8973,14 @@ static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject * } static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; - #if PY_VERSION_HEX >= 0x030700A2 - tmp_type = tstate->exc_state.exc_type; - tmp_value = tstate->exc_state.exc_value; - tmp_tb = tstate->exc_state.exc_traceback; - tstate->exc_state.exc_type = type; - tstate->exc_state.exc_value = value; - tstate->exc_state.exc_traceback = tb; + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = type; + exc_info->exc_value = value; + exc_info->exc_traceback = tb; #else tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; @@ -8691,11 +8996,12 @@ static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject #endif /* GetException */ - #if CYTHON_FAST_THREAD_STATE -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_FAST_THREAD_STATE +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) #else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) #endif +{ PyObject *local_type, *local_value, *local_tb; #if CYTHON_FAST_THREAD_STATE PyObject *tmp_type, *tmp_value, *tmp_tb; @@ -8728,13 +9034,16 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) *value = local_value; *tb = local_tb; #if CYTHON_FAST_THREAD_STATE - #if PY_VERSION_HEX >= 0x030700A2 - tmp_type = tstate->exc_state.exc_type; - tmp_value = tstate->exc_state.exc_value; - tmp_tb = tstate->exc_state.exc_traceback; - tstate->exc_state.exc_type = local_type; - tstate->exc_state.exc_value = local_value; - tstate->exc_state.exc_traceback = local_tb; + #if CYTHON_USE_EXC_INFO_STACK + { + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = local_type; + exc_info->exc_value = local_value; + exc_info->exc_traceback = local_tb; + } #else tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; @@ -8761,16 +9070,17 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) } /* SwapException */ - #if CYTHON_FAST_THREAD_STATE +#if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; - #if PY_VERSION_HEX >= 0x030700A2 - tmp_type = tstate->exc_state.exc_type; - tmp_value = tstate->exc_state.exc_value; - tmp_tb = tstate->exc_state.exc_traceback; - tstate->exc_state.exc_type = *type; - tstate->exc_state.exc_value = *value; - tstate->exc_state.exc_traceback = *tb; + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = *type; + exc_info->exc_value = *value; + exc_info->exc_traceback = *tb; #else tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; @@ -8795,7 +9105,7 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, #endif /* BytesEquals */ - static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { #if CYTHON_COMPILING_IN_PYPY return PyObject_RichCompareBool(s1, s2, equals); #else @@ -8842,7 +9152,7 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, } /* UnicodeEquals */ - static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { #if CYTHON_COMPILING_IN_PYPY return PyObject_RichCompareBool(s1, s2, equals); #else @@ -8921,6 +9231,9 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, } else { int result; PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif if (!py_result) return -1; result = __Pyx_PyObject_IsTrue(py_result); @@ -8941,7 +9254,7 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, } /* GetAttr */ - static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { #if CYTHON_USE_TYPE_SLOTS #if PY_MAJOR_VERSION >= 3 if (likely(PyUnicode_Check(n))) @@ -8954,7 +9267,7 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, } /* HasAttr */ - static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { +static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { PyObject *r; if (unlikely(!__Pyx_PyBaseString_Check(n))) { PyErr_SetString(PyExc_TypeError, @@ -8972,7 +9285,7 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, } /* PyObjectSetAttrStr */ - #if CYTHON_USE_TYPE_SLOTS +#if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { PyTypeObject* tp = Py_TYPE(obj); if (likely(tp->tp_setattro)) @@ -8986,7 +9299,7 @@ static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr #endif /* PyIntBinop */ - #if !CYTHON_COMPILING_IN_PYPY +#if !CYTHON_COMPILING_IN_PYPY static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) { #if PY_MAJOR_VERSION < 3 if (likely(PyInt_CheckExact(op1))) { @@ -9090,8 +9403,8 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED llx = lla + llb; return PyLong_FromLongLong(llx); #endif - - + + } #endif if (PyFloat_CheckExact(op1)) { @@ -9108,7 +9421,7 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED #endif /* GetItemInt */ - static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; r = PyObject_GetItem(o, j); @@ -9123,7 +9436,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_ if (wraparound & unlikely(i < 0)) { wrapped_i += PyList_GET_SIZE(o); } - if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyList_GET_SIZE(o)))) { + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { PyObject *r = PyList_GET_ITEM(o, wrapped_i); Py_INCREF(r); return r; @@ -9141,7 +9454,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize if (wraparound & unlikely(i < 0)) { wrapped_i += PyTuple_GET_SIZE(o); } - if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyTuple_GET_SIZE(o)))) { + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); Py_INCREF(r); return r; @@ -9157,7 +9470,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS if (is_list || PyList_CheckExact(o)) { Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); - if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) { + if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { PyObject *r = PyList_GET_ITEM(o, n); Py_INCREF(r); return r; @@ -9165,7 +9478,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, } else if (PyTuple_CheckExact(o)) { Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, n); Py_INCREF(r); return r; @@ -9195,7 +9508,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, } /* ObjectGetItem */ - #if CYTHON_USE_TYPE_SLOTS +#if CYTHON_USE_TYPE_SLOTS static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) { PyObject *runerr; Py_ssize_t key_value; @@ -9223,8 +9536,69 @@ static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { } #endif +/* TypeImport */ +#ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name, + size_t size, enum __Pyx_ImportType_CheckSize check_size) +{ + PyObject *result = 0; + char warning[200]; + Py_ssize_t basicsize; +#ifdef Py_LIMITED_API + PyObject *py_basicsize; +#endif + result = PyObject_GetAttrString(module, class_name); + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%.200s.%.200s is not a type object", + module_name, class_name); + goto bad; + } +#ifndef Py_LIMITED_API + basicsize = ((PyTypeObject *)result)->tp_basicsize; +#else + py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); + if (!py_basicsize) + goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; +#endif + if ((size_t)basicsize < size) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize); + goto bad; + } + if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize); + goto bad; + } + else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize); + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(result); + return NULL; +} +#endif + /* GetVTable */ - static void* __Pyx_GetVtable(PyObject *dict) { +static void* __Pyx_GetVtable(PyObject *dict) { void* ptr; PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable); if (!ob) @@ -9244,7 +9618,7 @@ static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { } /* Import */ - static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; @@ -9291,7 +9665,7 @@ static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); + name, global_dict, empty_dict, list, py_level, (PyObject *)NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( @@ -9309,7 +9683,7 @@ static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { } /* ImportFrom */ - static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_Format(PyExc_ImportError, @@ -9322,8 +9696,33 @@ static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { return value; } +/* PyErrExceptionMatches */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; icurexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; + if (unlikely(PyTuple_Check(err))) + return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + return __Pyx_PyErr_GivenExceptionMatches(exc_type, err); +} +#endif + /* CalculateMetaclass */ - static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { +static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases); for (i=0; i < nbases; i++) { PyTypeObject *tmptype; @@ -9362,7 +9761,7 @@ static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { } /* FetchCommonType */ - static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { +static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { PyObject* fake_module; PyTypeObject* cached_type = NULL; fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI); @@ -9401,7 +9800,7 @@ static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { } /* CythonFunction */ - #include +#include static PyObject * __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) { @@ -9423,7 +9822,7 @@ __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure return op->func_doc; } static int -__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value) +__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) { PyObject *tmp = op->func_doc; if (value == NULL) { @@ -9435,7 +9834,7 @@ __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value) return 0; } static PyObject * -__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op) +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { if (unlikely(op->func_name == NULL)) { #if PY_MAJOR_VERSION >= 3 @@ -9450,14 +9849,15 @@ __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op) return op->func_name; } static int -__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value) +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) { PyObject *tmp; #if PY_MAJOR_VERSION >= 3 - if (unlikely(value == NULL || !PyUnicode_Check(value))) { + if (unlikely(value == NULL || !PyUnicode_Check(value))) #else - if (unlikely(value == NULL || !PyString_Check(value))) { + if (unlikely(value == NULL || !PyString_Check(value))) #endif + { PyErr_SetString(PyExc_TypeError, "__name__ must be set to a string object"); return -1; @@ -9469,20 +9869,21 @@ __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value) return 0; } static PyObject * -__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op) +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { Py_INCREF(op->func_qualname); return op->func_qualname; } static int -__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value) +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) { PyObject *tmp; #if PY_MAJOR_VERSION >= 3 - if (unlikely(value == NULL || !PyUnicode_Check(value))) { + if (unlikely(value == NULL || !PyUnicode_Check(value))) #else - if (unlikely(value == NULL || !PyString_Check(value))) { + if (unlikely(value == NULL || !PyString_Check(value))) #endif + { PyErr_SetString(PyExc_TypeError, "__qualname__ must be set to a string object"); return -1; @@ -9504,7 +9905,7 @@ __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure return self; } static PyObject * -__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op) +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { if (unlikely(op->func_dict == NULL)) { op->func_dict = PyDict_New(); @@ -9515,7 +9916,7 @@ __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op) return op->func_dict; } static int -__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value) +__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) { PyObject *tmp; if (unlikely(value == NULL)) { @@ -9535,19 +9936,19 @@ __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value) return 0; } static PyObject * -__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op) +__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { Py_INCREF(op->func_globals); return op->func_globals; } static PyObject * -__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op) +__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { Py_INCREF(Py_None); return Py_None; } static PyObject * -__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op) +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { PyObject* result = (op->func_code) ? op->func_code : Py_None; Py_INCREF(result); @@ -9576,7 +9977,7 @@ __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { return result; } static int -__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) { +__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { PyObject* tmp; if (!value) { value = Py_None; @@ -9592,7 +9993,7 @@ __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) { return 0; } static PyObject * -__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) { +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { PyObject* result = op->defaults_tuple; if (unlikely(!result)) { if (op->defaults_getter) { @@ -9606,7 +10007,7 @@ __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) { return result; } static int -__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) { +__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { PyObject* tmp; if (!value) { value = Py_None; @@ -9622,7 +10023,7 @@ __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) { return 0; } static PyObject * -__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) { +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { PyObject* result = op->defaults_kwdict; if (unlikely(!result)) { if (op->defaults_getter) { @@ -9636,7 +10037,7 @@ __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) { return result; } static int -__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) { +__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { PyObject* tmp; if (!value || value == Py_None) { value = NULL; @@ -9652,7 +10053,7 @@ __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) { return 0; } static PyObject * -__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) { +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { PyObject* result = op->func_annotations; if (unlikely(!result)) { result = PyDict_New(); @@ -9832,7 +10233,7 @@ static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, Py return (*meth)(self, arg); break; case METH_VARARGS | METH_KEYWORDS: - return (*(PyCFunctionWithKeywords)meth)(self, arg, kw); + return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw); case METH_NOARGS: if (likely(kw == NULL || PyDict_Size(kw) == 0)) { size = PyTuple_GET_SIZE(arg); @@ -9995,7 +10396,7 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, Py } /* Py3ClassCreate */ - static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, +static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) { PyObject *ns; if (metaclass) { @@ -10062,18 +10463,23 @@ static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObj } /* CLineInTraceback */ - #ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) { +#ifndef CYTHON_CLINE_IN_TRACEBACK +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { PyObject *use_cline; PyObject *ptype, *pvalue, *ptraceback; #if CYTHON_COMPILING_IN_CPYTHON PyObject **cython_runtime_dict; #endif + if (unlikely(!__pyx_cython_runtime)) { + return c_line; + } __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); #if CYTHON_COMPILING_IN_CPYTHON cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); if (likely(cython_runtime_dict)) { - use_cline = __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback); + __PYX_PY_DICT_LOOKUP_IF_MODIFIED( + use_cline, *cython_runtime_dict, + __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback)) } else #endif { @@ -10090,7 +10496,7 @@ static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_li c_line = 0; PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); } - else if (PyObject_Not(use_cline) != 0) { + else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { c_line = 0; } __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); @@ -10099,7 +10505,7 @@ static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_li #endif /* CodeObjectCache */ - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; @@ -10179,7 +10585,7 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { } /* AddTraceback */ - #include "compile.h" +#include "compile.h" #include "frameobject.h" #include "traceback.h" static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( @@ -10264,8 +10670,8 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { - const int neg_one = (int) -1, const_zero = (int) 0; +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { + const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(int) < sizeof(long)) { @@ -10295,7 +10701,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntFromPyVerify */ - #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ +#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) @@ -10317,8 +10723,8 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntFromPy */ - static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { - const int neg_one = (int) -1, const_zero = (int) 0; +static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { + const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -10506,8 +10912,8 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { - const long neg_one = (long) -1, const_zero = (long) 0; +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { + const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(long) < sizeof(long)) { @@ -10537,8 +10943,8 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntFromPy */ - static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { - const long neg_one = (long) -1, const_zero = (long) 0; +static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { + const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -10726,7 +11132,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* FastTypeChecks */ - #if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { while (a) { a = a->tp_base; @@ -10781,14 +11187,42 @@ static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, return res; } #endif +static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + assert(PyExceptionClass_Check(exc_type)); + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; itp_basicsize; -#else - py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); - if (!py_basicsize) - goto bad; - basicsize = PyLong_AsSsize_t(py_basicsize); - Py_DECREF(py_basicsize); - py_basicsize = 0; - if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) - goto bad; -#endif - if (!strict && (size_t)basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), - "%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd", - module_name, class_name, basicsize, size); - if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; - } - else if ((size_t)basicsize != size) { - PyErr_Format(PyExc_ValueError, - "%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd", - module_name, class_name, basicsize, size); - goto bad; - } - return (PyTypeObject *)result; -bad: - Py_XDECREF(py_module); - Py_XDECREF(result); - return NULL; -} -#endif - /* InitStrings */ - static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { @@ -11006,6 +11357,13 @@ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { + int retval; + if (unlikely(!x)) return -1; + retval = __Pyx_PyObject_IsTrue(x); + Py_DECREF(x); + return retval; +} static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { #if PY_MAJOR_VERSION >= 3 if (PyLong_Check(result)) { @@ -11083,7 +11441,7 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { if (sizeof(Py_ssize_t) >= sizeof(long)) return PyInt_AS_LONG(b); else - return PyInt_AsSsize_t(x); + return PyInt_AsSsize_t(b); } #endif if (likely(PyLong_CheckExact(b))) { @@ -11137,6 +11495,9 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_DECREF(x); return ival; } +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { + return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); +} static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { return PyInt_FromSize_t(ival); } diff --git a/numcodecs/blosc.pyx b/numcodecs/blosc.pyx index 28d2301c..ded03de9 100644 --- a/numcodecs/blosc.pyx +++ b/numcodecs/blosc.pyx @@ -485,9 +485,11 @@ class Blosc(Codec): self.blocksize = blocksize def encode(self, buf): + self._check_buffer_size(buf) return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) def decode(self, buf, out=None): + self._check_buffer_size(buf) return decompress(buf, out) def __repr__(self): diff --git a/numcodecs/tests/test_blosc.py b/numcodecs/tests/test_blosc.py index 007b3aba..7396bdfd 100644 --- a/numcodecs/tests/test_blosc.py +++ b/numcodecs/tests/test_blosc.py @@ -240,11 +240,26 @@ def test_decompression_error_handling(): codec.decode(bytearray(0)) -def test_compression_error_handling(): - a = np.zeros(2**31 - 1, dtype=np.int8) - # If we turn on thread support, we block on a mutex on the second codec that - # we try. - blosc.use_threads = False - for codec in codecs: - with pytest.raises(RuntimeError): - codec.encode(a) +def test_max_buffer_size(): + for max_buffer_size in [4, 64, 1024]: + for codec in codecs: + old_max_buffer_size = codec.max_buffer_size + try: + codec.max_buffer_size = max_buffer_size + # Just up the max_buffer_size is fine. + codec.encode(np.zeros(max_buffer_size - 1, dtype=np.int8)) + codec.encode(np.zeros(max_buffer_size, dtype=np.int8)) + + buffers = [ + bytes(b"x" * (max_buffer_size + 1)), + np.zeros(max_buffer_size + 1, dtype=np.int8), + np.zeros(max_buffer_size + 2, dtype=np.int8), + np.zeros(max_buffer_size, dtype=np.int16), + np.zeros(max_buffer_size, dtype=np.int32)] + for buf in buffers: + with pytest.raises(ValueError): + codec.encode(buf) + with pytest.raises(ValueError): + codec.decode(buf) + finally: + codec.max_buffer_size = old_max_buffer_size From 3ab36ebad2185e37df47ce7c2126b98330acc8fc Mon Sep 17 00:00:00 2001 From: John Kirkham Date: Tue, 27 Nov 2018 18:39:26 -0500 Subject: [PATCH 3/7] Switch ABC to use `ensure_ndarray` to get `nbytes` --- numcodecs/abc.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/numcodecs/abc.py b/numcodecs/abc.py index 9b81c1c0..4f0106f6 100644 --- a/numcodecs/abc.py +++ b/numcodecs/abc.py @@ -30,7 +30,7 @@ """ from __future__ import absolute_import, print_function, division -from numcodecs.compat import handle_datetime +from numcodecs.compat import ensure_ndarray class Codec(object): @@ -46,8 +46,7 @@ class Codec(object): """Maximum size of a buffer that can be encoded or decoded.""" def _check_buffer_size(self, buf): - buf = handle_datetime(buf) - bufsize = memoryview(buf).nbytes + bufsize = ensure_ndarray(buf).nbytes if bufsize > self.max_buffer_size: msg = "{} codec does not support buffers of > {} bytes".format( self.codec_id, self.max_buffer_size) From e4f91526c23b69aee370e81c32e554254130733d Mon Sep 17 00:00:00 2001 From: Jerome Kelleher Date: Wed, 28 Nov 2018 15:34:25 +0000 Subject: [PATCH 4/7] Added max_buffer_size to ensure_contiguous_ndarray. Reverted earlier changes to the ABC layer as converting to ndarray and checking buffer size seems pointless and inefficient. --- numcodecs/abc.py | 13 - numcodecs/blosc.c | 2464 +++++++++++--------------------- numcodecs/blosc.pyx | 7 +- numcodecs/compat.py | 13 +- numcodecs/lz4.c | 376 +++-- numcodecs/lz4.pyx | 5 +- numcodecs/tests/common.py | 24 + numcodecs/tests/test_blosc.py | 28 +- numcodecs/tests/test_compat.py | 17 + numcodecs/tests/test_lz4.py | 9 +- 10 files changed, 1186 insertions(+), 1770 deletions(-) diff --git a/numcodecs/abc.py b/numcodecs/abc.py index 4f0106f6..3ab898f4 100644 --- a/numcodecs/abc.py +++ b/numcodecs/abc.py @@ -30,7 +30,6 @@ """ from __future__ import absolute_import, print_function, division -from numcodecs.compat import ensure_ndarray class Codec(object): @@ -40,18 +39,6 @@ class Codec(object): codec_id = None """Codec identifier.""" - # 2GiB limit by default. Codecs can override this in subclasses if larger - # buffers are supported. - max_buffer_size = 2**31 - 1 - """Maximum size of a buffer that can be encoded or decoded.""" - - def _check_buffer_size(self, buf): - bufsize = ensure_ndarray(buf).nbytes - if bufsize > self.max_buffer_size: - msg = "{} codec does not support buffers of > {} bytes".format( - self.codec_id, self.max_buffer_size) - raise ValueError(msg) - def encode(self, buf): # pragma: no cover """Encode data in `buf`. diff --git a/numcodecs/blosc.c b/numcodecs/blosc.c index b6935b0e..b918d00d 100644 --- a/numcodecs/blosc.c +++ b/numcodecs/blosc.c @@ -712,7 +712,6 @@ static CYTHON_INLINE float __PYX_NAN() { /* Early includes */ #include #include -#include "pythread.h" #include "blosc.h" #ifdef _OPENMP #include @@ -922,10 +921,7 @@ static const char *__pyx_filename; static const char *__pyx_f[] = { "numcodecs/blosc.pyx", - "array.pxd", "type.pxd", - "bool.pxd", - "complex.pxd", "numcodecs/compat_ext.pxd", }; /* NoFastGil.proto */ @@ -942,10 +938,6 @@ static const char *__pyx_f[] = { /*--- Type declarations ---*/ -#ifndef _ARRAYARRAY_H -struct arrayobject; -typedef struct arrayobject arrayobject; -#endif struct __pyx_obj_9numcodecs_10compat_ext_Buffer; struct __pyx_defaults; typedef struct __pyx_defaults __pyx_defaults; @@ -954,7 +946,7 @@ struct __pyx_defaults { PyObject *__pyx_arg_blocksize; }; -/* "compat_ext.pxd":5 +/* "compat_ext.pxd":4 * * * cdef class Buffer: # <<<<<<<<<<<<<< @@ -968,9 +960,7 @@ struct __pyx_obj_9numcodecs_10compat_ext_Buffer { Py_buffer buffer; size_t nbytes; size_t itemsize; - arrayobject *arr; - int new_buffer; - int released; + int acquired; }; @@ -1467,121 +1457,6 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); -/* ArrayAPI.proto */ -#ifndef _ARRAYARRAY_H -#define _ARRAYARRAY_H -typedef struct arraydescr { - int typecode; - int itemsize; - PyObject * (*getitem)(struct arrayobject *, Py_ssize_t); - int (*setitem)(struct arrayobject *, Py_ssize_t, PyObject *); -#if PY_MAJOR_VERSION >= 3 - char *formats; -#endif -} arraydescr; -struct arrayobject { - PyObject_HEAD - Py_ssize_t ob_size; - union { - char *ob_item; - float *as_floats; - double *as_doubles; - int *as_ints; - unsigned int *as_uints; - unsigned char *as_uchars; - signed char *as_schars; - char *as_chars; - unsigned long *as_ulongs; - long *as_longs; -#if PY_MAJOR_VERSION >= 3 - unsigned long long *as_ulonglongs; - long long *as_longlongs; -#endif - short *as_shorts; - unsigned short *as_ushorts; - Py_UNICODE *as_pyunicodes; - void *as_voidptr; - } data; - Py_ssize_t allocated; - struct arraydescr *ob_descr; - PyObject *weakreflist; -#if PY_MAJOR_VERSION >= 3 - int ob_exports; -#endif -}; -#ifndef NO_NEWARRAY_INLINE -static CYTHON_INLINE PyObject * newarrayobject(PyTypeObject *type, Py_ssize_t size, - struct arraydescr *descr) { - arrayobject *op; - size_t nbytes; - if (size < 0) { - PyErr_BadInternalCall(); - return NULL; - } - nbytes = size * descr->itemsize; - if (nbytes / descr->itemsize != (size_t)size) { - return PyErr_NoMemory(); - } - op = (arrayobject *) type->tp_alloc(type, 0); - if (op == NULL) { - return NULL; - } - op->ob_descr = descr; - op->allocated = size; - op->weakreflist = NULL; - op->ob_size = size; - if (size <= 0) { - op->data.ob_item = NULL; - } - else { - op->data.ob_item = PyMem_NEW(char, nbytes); - if (op->data.ob_item == NULL) { - Py_DECREF(op); - return PyErr_NoMemory(); - } - } - return (PyObject *) op; -} -#else -PyObject* newarrayobject(PyTypeObject *type, Py_ssize_t size, - struct arraydescr *descr); -#endif -static CYTHON_INLINE int resize(arrayobject *self, Py_ssize_t n) { - void *items = (void*) self->data.ob_item; - PyMem_Resize(items, char, (size_t)(n * self->ob_descr->itemsize)); - if (items == NULL) { - PyErr_NoMemory(); - return -1; - } - self->data.ob_item = (char*) items; - self->ob_size = n; - self->allocated = n; - return 0; -} -static CYTHON_INLINE int resize_smart(arrayobject *self, Py_ssize_t n) { - void *items = (void*) self->data.ob_item; - Py_ssize_t newsize; - if (n < self->allocated && n*4 > self->allocated) { - self->ob_size = n; - return 0; - } - newsize = n + (n / 2) + 1; - if (newsize <= n) { - PyErr_NoMemory(); - return -1; - } - PyMem_Resize(items, char, (size_t)(newsize * self->ob_descr->itemsize)); - if (items == NULL) { - PyErr_NoMemory(); - return -1; - } - self->data.ob_item = (char*) items; - self->ob_size = n; - self->allocated = newsize; - return 0; -} -#endif - /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); @@ -1622,84 +1497,12 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'cpython.type' */ static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; -/* Module declarations from 'cpython.version' */ - -/* Module declarations from 'cpython.ref' */ - -/* Module declarations from 'cpython.exc' */ - -/* Module declarations from 'cpython.module' */ - -/* Module declarations from 'cpython.mem' */ - -/* Module declarations from 'cpython.tuple' */ - -/* Module declarations from 'cpython.list' */ - -/* Module declarations from 'cpython.sequence' */ - -/* Module declarations from 'cpython.mapping' */ - -/* Module declarations from 'cpython.iterator' */ - -/* Module declarations from 'cpython.number' */ - -/* Module declarations from 'cpython.int' */ - -/* Module declarations from '__builtin__' */ - -/* Module declarations from 'cpython.bool' */ -static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0; - -/* Module declarations from 'cpython.long' */ - -/* Module declarations from 'cpython.float' */ - -/* Module declarations from '__builtin__' */ - -/* Module declarations from 'cpython.complex' */ -static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0; - -/* Module declarations from 'cpython.string' */ - -/* Module declarations from 'cpython.unicode' */ - -/* Module declarations from 'cpython.dict' */ - -/* Module declarations from 'cpython.instance' */ - -/* Module declarations from 'cpython.function' */ - -/* Module declarations from 'cpython.method' */ - -/* Module declarations from 'cpython.weakref' */ - -/* Module declarations from 'cpython.getargs' */ - -/* Module declarations from 'cpython.pythread' */ - -/* Module declarations from 'cpython.pystate' */ - -/* Module declarations from 'cpython.cobject' */ - -/* Module declarations from 'cpython.oldbuffer' */ - -/* Module declarations from 'cpython.set' */ - -/* Module declarations from 'cpython.pycapsule' */ - /* Module declarations from 'cpython' */ /* Module declarations from 'cpython.object' */ /* Module declarations from 'cpython.bytes' */ -/* Module declarations from 'array' */ - -/* Module declarations from 'cpython.array' */ -static PyTypeObject *__pyx_ptype_7cpython_5array_array = 0; -static CYTHON_INLINE int __pyx_f_7cpython_5array_extend_buffer(arrayobject *, char *, Py_ssize_t); /*proto*/ - /* Module declarations from 'numcodecs.compat_ext' */ static PyTypeObject *__pyx_ptype_9numcodecs_10compat_ext_Buffer = 0; @@ -1712,7 +1515,6 @@ int __pyx_module_is_main_numcodecs__blosc = 0; static PyObject *__pyx_builtin_OSError; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_RuntimeError; -static PyObject *__pyx_builtin_MemoryError; static const char __pyx_k_[] = ","; static const char __pyx_k_r[] = "r"; static const char __pyx_k_s[] = "s"; @@ -1790,7 +1592,6 @@ static const char __pyx_k_source_ptr[] = "source_ptr"; static const char __pyx_k_AUTOSHUFFLE[] = "AUTOSHUFFLE"; static const char __pyx_k_MAX_THREADS[] = "MAX_THREADS"; static const char __pyx_k_MainProcess[] = "MainProcess"; -static const char __pyx_k_MemoryError[] = "MemoryError"; static const char __pyx_k_cname_bytes[] = "_cname_bytes"; static const char __pyx_k_dest_buffer[] = "dest_buffer"; static const char __pyx_k_dest_nbytes[] = "dest_nbytes"; @@ -1816,14 +1617,15 @@ static const char __pyx_k_MAX_BUFFERSIZE[] = "MAX_BUFFERSIZE"; static const char __pyx_k_VERSION_STRING[] = "VERSION_STRING"; static const char __pyx_k_compressor_set[] = "compressor_set"; static const char __pyx_k_current_thread[] = "current_thread"; +static const char __pyx_k_ensure_ndarray[] = "ensure_ndarray"; static const char __pyx_k_cbuffer_complib[] = "cbuffer_complib"; static const char __pyx_k_current_process[] = "current_process"; static const char __pyx_k_get_use_threads[] = "_get_use_threads"; +static const char __pyx_k_max_buffer_size[] = "max_buffer_size"; static const char __pyx_k_multiprocessing[] = "multiprocessing"; static const char __pyx_k_numcodecs_blosc[] = "numcodecs.blosc"; static const char __pyx_k_cbuffer_metainfo[] = "cbuffer_metainfo"; static const char __pyx_k_list_compressors[] = "list_compressors"; -static const char __pyx_k_check_buffer_size[] = "_check_buffer_size"; static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; static const char __pyx_k_numcodecs_blosc_pyx[] = "numcodecs/blosc.pyx"; static const char __pyx_k_compname_to_compcode[] = "compname_to_compcode"; @@ -1853,7 +1655,6 @@ static PyObject *__pyx_n_s_MAX_THREADS; static PyObject *__pyx_n_s_MAX_TYPESIZE; static PyObject *__pyx_n_s_MainProcess; static PyObject *__pyx_n_s_MainThread; -static PyObject *__pyx_n_s_MemoryError; static PyObject *__pyx_n_s_NOSHUFFLE; static PyObject *__pyx_n_s_OSError; static PyObject *__pyx_n_s_PY2; @@ -1873,7 +1674,6 @@ static PyObject *__pyx_n_s_cbuffer_complib; static PyObject *__pyx_n_s_cbuffer_metainfo; static PyObject *__pyx_n_s_cbuffer_sizes; static PyObject *__pyx_n_s_cbytes; -static PyObject *__pyx_n_s_check_buffer_size; static PyObject *__pyx_n_s_clevel; static PyObject *__pyx_n_s_cline_in_traceback; static PyObject *__pyx_n_s_cname; @@ -1898,6 +1698,7 @@ static PyObject *__pyx_kp_s_destination_buffer_too_small_exp; static PyObject *__pyx_n_s_destroy; static PyObject *__pyx_n_s_doc; static PyObject *__pyx_n_s_encode; +static PyObject *__pyx_n_s_ensure_ndarray; static PyObject *__pyx_n_s_enter; static PyObject *__pyx_n_s_err_bad_cname; static PyObject *__pyx_kp_s_error_during_blosc_compression_d; @@ -1917,6 +1718,7 @@ static PyObject *__pyx_n_s_list_compressors; static PyObject *__pyx_n_s_lz4; static PyObject *__pyx_n_s_main; static PyObject *__pyx_n_s_main_thread; +static PyObject *__pyx_n_s_max_buffer_size; static PyObject *__pyx_n_s_memcpyed; static PyObject *__pyx_n_s_metaclass; static PyObject *__pyx_n_s_module; @@ -1973,11 +1775,10 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc___init__(CYTHON_UNUSED PyObje static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_2encode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_buf); /* proto */ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_4decode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_buf, PyObject *__pyx_v_out); /* proto */ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_6__repr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info, CYTHON_UNUSED int __pyx_v_flags); /* proto */ -static void __pyx_pf_7cpython_5array_5array_2__releasebuffer__(CYTHON_UNUSED arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; static PyObject *__pyx_int_5; +static PyObject *__pyx_int_2147483647; static PyObject *__pyx_int_neg_1; static int __pyx_k__2; static int __pyx_k__3; @@ -2016,7 +1817,7 @@ static PyObject *__pyx_codeobj__33; static PyObject *__pyx_codeobj__36; /* Late includes */ -/* "numcodecs/blosc.pyx":88 +/* "numcodecs/blosc.pyx":89 * * * def init(): # <<<<<<<<<<<<<< @@ -2044,7 +1845,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_init(CYTHON_UNUSED PyObject *__pyx_s __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("init", 0); - /* "numcodecs/blosc.pyx":90 + /* "numcodecs/blosc.pyx":91 * def init(): * """Initialize the Blosc library environment.""" * blosc_init() # <<<<<<<<<<<<<< @@ -2053,7 +1854,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_init(CYTHON_UNUSED PyObject *__pyx_s */ blosc_init(); - /* "numcodecs/blosc.pyx":88 + /* "numcodecs/blosc.pyx":89 * * * def init(): # <<<<<<<<<<<<<< @@ -2068,7 +1869,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_init(CYTHON_UNUSED PyObject *__pyx_s return __pyx_r; } -/* "numcodecs/blosc.pyx":93 +/* "numcodecs/blosc.pyx":94 * * * def destroy(): # <<<<<<<<<<<<<< @@ -2096,7 +1897,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_2destroy(CYTHON_UNUSED PyObject *__p __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("destroy", 0); - /* "numcodecs/blosc.pyx":95 + /* "numcodecs/blosc.pyx":96 * def destroy(): * """Destroy the Blosc library environment.""" * blosc_destroy() # <<<<<<<<<<<<<< @@ -2105,7 +1906,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_2destroy(CYTHON_UNUSED PyObject *__p */ blosc_destroy(); - /* "numcodecs/blosc.pyx":93 + /* "numcodecs/blosc.pyx":94 * * * def destroy(): # <<<<<<<<<<<<<< @@ -2120,7 +1921,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_2destroy(CYTHON_UNUSED PyObject *__p return __pyx_r; } -/* "numcodecs/blosc.pyx":98 +/* "numcodecs/blosc.pyx":99 * * * def compname_to_compcode(cname): # <<<<<<<<<<<<<< @@ -2155,28 +1956,28 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_4compname_to_compcode(CYTHON_UNUSED __Pyx_RefNannySetupContext("compname_to_compcode", 0); __Pyx_INCREF(__pyx_v_cname); - /* "numcodecs/blosc.pyx":102 + /* "numcodecs/blosc.pyx":103 * name is not recognized, or there is not support for it in this build, -1 is returned * instead.""" * if isinstance(cname, text_type): # <<<<<<<<<<<<<< * cname = cname.encode('ascii') * return blosc_compname_to_compcode(cname) */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_text_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 102, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_text_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_IsInstance(__pyx_v_cname, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 102, __pyx_L1_error) + __pyx_t_2 = PyObject_IsInstance(__pyx_v_cname, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { - /* "numcodecs/blosc.pyx":103 + /* "numcodecs/blosc.pyx":104 * instead.""" * if isinstance(cname, text_type): * cname = cname.encode('ascii') # <<<<<<<<<<<<<< * return blosc_compname_to_compcode(cname) * */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_cname, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 103, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_cname, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { @@ -2190,13 +1991,13 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_4compname_to_compcode(CYTHON_UNUSED } __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_n_s_ascii) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_n_s_ascii); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF_SET(__pyx_v_cname, __pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":102 + /* "numcodecs/blosc.pyx":103 * name is not recognized, or there is not support for it in this build, -1 is returned * instead.""" * if isinstance(cname, text_type): # <<<<<<<<<<<<<< @@ -2205,7 +2006,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_4compname_to_compcode(CYTHON_UNUSED */ } - /* "numcodecs/blosc.pyx":104 + /* "numcodecs/blosc.pyx":105 * if isinstance(cname, text_type): * cname = cname.encode('ascii') * return blosc_compname_to_compcode(cname) # <<<<<<<<<<<<<< @@ -2213,14 +2014,14 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_4compname_to_compcode(CYTHON_UNUSED * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_cname); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyInt_From_int(blosc_compname_to_compcode(__pyx_t_6)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_cname); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 105, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(blosc_compname_to_compcode(__pyx_t_6)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 105, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "numcodecs/blosc.pyx":98 + /* "numcodecs/blosc.pyx":99 * * * def compname_to_compcode(cname): # <<<<<<<<<<<<<< @@ -2242,7 +2043,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_4compname_to_compcode(CYTHON_UNUSED return __pyx_r; } -/* "numcodecs/blosc.pyx":107 +/* "numcodecs/blosc.pyx":108 * * * def list_compressors(): # <<<<<<<<<<<<<< @@ -2276,40 +2077,40 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_6list_compressors(CYTHON_UNUSED PyOb PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("list_compressors", 0); - /* "numcodecs/blosc.pyx":109 + /* "numcodecs/blosc.pyx":110 * def list_compressors(): * """Get a list of compressors supported in the current build.""" * s = blosc_list_compressors() # <<<<<<<<<<<<<< * if not PY2: * s = s.decode('ascii') */ - __pyx_t_1 = __Pyx_PyBytes_FromString(blosc_list_compressors()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBytes_FromString(blosc_list_compressors()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_s = __pyx_t_1; __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":110 + /* "numcodecs/blosc.pyx":111 * """Get a list of compressors supported in the current build.""" * s = blosc_list_compressors() * if not PY2: # <<<<<<<<<<<<<< * s = s.decode('ascii') * return s.split(',') */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PY2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PY2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = ((!__pyx_t_2) != 0); if (__pyx_t_3) { - /* "numcodecs/blosc.pyx":111 + /* "numcodecs/blosc.pyx":112 * s = blosc_list_compressors() * if not PY2: * s = s.decode('ascii') # <<<<<<<<<<<<<< * return s.split(',') * */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_decode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 111, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_decode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { @@ -2323,13 +2124,13 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_6list_compressors(CYTHON_UNUSED PyOb } __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_n_s_ascii) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_n_s_ascii); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":110 + /* "numcodecs/blosc.pyx":111 * """Get a list of compressors supported in the current build.""" * s = blosc_list_compressors() * if not PY2: # <<<<<<<<<<<<<< @@ -2338,7 +2139,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_6list_compressors(CYTHON_UNUSED PyOb */ } - /* "numcodecs/blosc.pyx":112 + /* "numcodecs/blosc.pyx":113 * if not PY2: * s = s.decode('ascii') * return s.split(',') # <<<<<<<<<<<<<< @@ -2346,7 +2147,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_6list_compressors(CYTHON_UNUSED PyOb * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_split); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 112, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_split); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { @@ -2360,14 +2161,14 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_6list_compressors(CYTHON_UNUSED PyOb } __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "numcodecs/blosc.pyx":107 + /* "numcodecs/blosc.pyx":108 * * * def list_compressors(): # <<<<<<<<<<<<<< @@ -2389,7 +2190,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_6list_compressors(CYTHON_UNUSED PyOb return __pyx_r; } -/* "numcodecs/blosc.pyx":115 +/* "numcodecs/blosc.pyx":116 * * * def get_nthreads(): # <<<<<<<<<<<<<< @@ -2418,7 +2219,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_8get_nthreads(CYTHON_UNUSED PyObject PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("get_nthreads", 0); - /* "numcodecs/blosc.pyx":118 + /* "numcodecs/blosc.pyx":119 * """Get the number of threads that Blosc uses internally for compression and * decompression.""" * return blosc_get_nthreads() # <<<<<<<<<<<<<< @@ -2426,13 +2227,13 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_8get_nthreads(CYTHON_UNUSED PyObject * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(blosc_get_nthreads()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(blosc_get_nthreads()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 119, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "numcodecs/blosc.pyx":115 + /* "numcodecs/blosc.pyx":116 * * * def get_nthreads(): # <<<<<<<<<<<<<< @@ -2451,7 +2252,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_8get_nthreads(CYTHON_UNUSED PyObject return __pyx_r; } -/* "numcodecs/blosc.pyx":121 +/* "numcodecs/blosc.pyx":122 * * * def set_nthreads(int nthreads): # <<<<<<<<<<<<<< @@ -2469,7 +2270,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_11set_nthreads(PyObject *__pyx_self, __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_nthreads (wrapper)", 0); assert(__pyx_arg_nthreads); { - __pyx_v_nthreads = __Pyx_PyInt_As_int(__pyx_arg_nthreads); if (unlikely((__pyx_v_nthreads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 121, __pyx_L3_error) + __pyx_v_nthreads = __Pyx_PyInt_As_int(__pyx_arg_nthreads); if (unlikely((__pyx_v_nthreads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 122, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -2490,7 +2291,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_10set_nthreads(CYTHON_UNUSED PyObjec PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("set_nthreads", 0); - /* "numcodecs/blosc.pyx":124 + /* "numcodecs/blosc.pyx":125 * """Set the number of threads that Blosc uses internally for compression and * decompression.""" * return blosc_set_nthreads(nthreads) # <<<<<<<<<<<<<< @@ -2498,13 +2299,13 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_10set_nthreads(CYTHON_UNUSED PyObjec * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(blosc_set_nthreads(__pyx_v_nthreads)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(blosc_set_nthreads(__pyx_v_nthreads)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "numcodecs/blosc.pyx":121 + /* "numcodecs/blosc.pyx":122 * * * def set_nthreads(int nthreads): # <<<<<<<<<<<<<< @@ -2523,7 +2324,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_10set_nthreads(CYTHON_UNUSED PyObjec return __pyx_r; } -/* "numcodecs/blosc.pyx":127 +/* "numcodecs/blosc.pyx":128 * * * def cbuffer_sizes(source): # <<<<<<<<<<<<<< @@ -2559,16 +2360,16 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_12cbuffer_sizes(CYTHON_UNUSED PyObje PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("cbuffer_sizes", 0); - /* "numcodecs/blosc.pyx":144 + /* "numcodecs/blosc.pyx":145 * * # obtain buffer * buffer = Buffer(source, PyBUF_ANY_CONTIGUOUS) # <<<<<<<<<<<<<< * * # determine buffer size */ - __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 144, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 145, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_source); __Pyx_GIVEREF(__pyx_v_source); @@ -2576,13 +2377,13 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_12cbuffer_sizes(CYTHON_UNUSED PyObje __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_buffer = ((struct __pyx_obj_9numcodecs_10compat_ext_Buffer *)__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":147 + /* "numcodecs/blosc.pyx":148 * * # determine buffer size * blosc_cbuffer_sizes(buffer.ptr, &nbytes, &cbytes, &blocksize) # <<<<<<<<<<<<<< @@ -2591,18 +2392,18 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_12cbuffer_sizes(CYTHON_UNUSED PyObje */ blosc_cbuffer_sizes(__pyx_v_buffer->ptr, (&__pyx_v_nbytes), (&__pyx_v_cbytes), (&__pyx_v_blocksize)); - /* "numcodecs/blosc.pyx":150 + /* "numcodecs/blosc.pyx":151 * * # release buffers * buffer.release() # <<<<<<<<<<<<<< * * return nbytes, cbytes, blocksize */ - __pyx_t_1 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_buffer->__pyx_vtab)->release(__pyx_v_buffer, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_buffer->__pyx_vtab)->release(__pyx_v_buffer, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":152 + /* "numcodecs/blosc.pyx":153 * buffer.release() * * return nbytes, cbytes, blocksize # <<<<<<<<<<<<<< @@ -2610,13 +2411,13 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_12cbuffer_sizes(CYTHON_UNUSED PyObje * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_nbytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 152, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_nbytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_cbytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 152, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_cbytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_blocksize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 152, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_blocksize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 152, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); @@ -2631,7 +2432,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_12cbuffer_sizes(CYTHON_UNUSED PyObje __pyx_t_4 = 0; goto __pyx_L0; - /* "numcodecs/blosc.pyx":127 + /* "numcodecs/blosc.pyx":128 * * * def cbuffer_sizes(source): # <<<<<<<<<<<<<< @@ -2654,7 +2455,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_12cbuffer_sizes(CYTHON_UNUSED PyObje return __pyx_r; } -/* "numcodecs/blosc.pyx":155 +/* "numcodecs/blosc.pyx":156 * * * def cbuffer_complib(source): # <<<<<<<<<<<<<< @@ -2689,16 +2490,16 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_14cbuffer_complib(CYTHON_UNUSED PyOb PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("cbuffer_complib", 0); - /* "numcodecs/blosc.pyx":161 + /* "numcodecs/blosc.pyx":162 * * # obtain buffer * buffer = Buffer(source, PyBUF_ANY_CONTIGUOUS) # <<<<<<<<<<<<<< * * # determine buffer size */ - __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 161, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_source); __Pyx_GIVEREF(__pyx_v_source); @@ -2706,57 +2507,57 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_14cbuffer_complib(CYTHON_UNUSED PyOb __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_buffer = ((struct __pyx_obj_9numcodecs_10compat_ext_Buffer *)__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":164 + /* "numcodecs/blosc.pyx":165 * * # determine buffer size * complib = blosc_cbuffer_complib(buffer.ptr) # <<<<<<<<<<<<<< * * # release buffers */ - __pyx_t_1 = __Pyx_PyBytes_FromString(blosc_cbuffer_complib(__pyx_v_buffer->ptr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 164, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBytes_FromString(blosc_cbuffer_complib(__pyx_v_buffer->ptr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_complib = __pyx_t_1; __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":167 + /* "numcodecs/blosc.pyx":168 * * # release buffers * buffer.release() # <<<<<<<<<<<<<< * * if not PY2: */ - __pyx_t_1 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_buffer->__pyx_vtab)->release(__pyx_v_buffer, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 167, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_buffer->__pyx_vtab)->release(__pyx_v_buffer, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":169 + /* "numcodecs/blosc.pyx":170 * buffer.release() * * if not PY2: # <<<<<<<<<<<<<< * complib = complib.decode('ascii') * */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PY2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 169, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PY2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 169, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_4 = ((!__pyx_t_3) != 0); if (__pyx_t_4) { - /* "numcodecs/blosc.pyx":170 + /* "numcodecs/blosc.pyx":171 * * if not PY2: * complib = complib.decode('ascii') # <<<<<<<<<<<<<< * * return complib */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_complib, __pyx_n_s_decode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 170, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_complib, __pyx_n_s_decode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { @@ -2770,13 +2571,13 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_14cbuffer_complib(CYTHON_UNUSED PyOb } __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_n_s_ascii) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_s_ascii); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF_SET(__pyx_v_complib, __pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":169 + /* "numcodecs/blosc.pyx":170 * buffer.release() * * if not PY2: # <<<<<<<<<<<<<< @@ -2785,7 +2586,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_14cbuffer_complib(CYTHON_UNUSED PyOb */ } - /* "numcodecs/blosc.pyx":172 + /* "numcodecs/blosc.pyx":173 * complib = complib.decode('ascii') * * return complib # <<<<<<<<<<<<<< @@ -2797,7 +2598,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_14cbuffer_complib(CYTHON_UNUSED PyOb __pyx_r = __pyx_v_complib; goto __pyx_L0; - /* "numcodecs/blosc.pyx":155 + /* "numcodecs/blosc.pyx":156 * * * def cbuffer_complib(source): # <<<<<<<<<<<<<< @@ -2820,7 +2621,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_14cbuffer_complib(CYTHON_UNUSED PyOb return __pyx_r; } -/* "numcodecs/blosc.pyx":175 +/* "numcodecs/blosc.pyx":176 * * * def cbuffer_metainfo(source): # <<<<<<<<<<<<<< @@ -2857,16 +2658,16 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_16cbuffer_metainfo(CYTHON_UNUSED PyO PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("cbuffer_metainfo", 0); - /* "numcodecs/blosc.pyx":193 + /* "numcodecs/blosc.pyx":194 * * # obtain buffer * buffer = Buffer(source, PyBUF_ANY_CONTIGUOUS) # <<<<<<<<<<<<<< * * # determine buffer size */ - __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_source); __Pyx_GIVEREF(__pyx_v_source); @@ -2874,13 +2675,13 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_16cbuffer_metainfo(CYTHON_UNUSED PyO __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_buffer = ((struct __pyx_obj_9numcodecs_10compat_ext_Buffer *)__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":196 + /* "numcodecs/blosc.pyx":197 * * # determine buffer size * blosc_cbuffer_metainfo(buffer.ptr, &typesize, &flags) # <<<<<<<<<<<<<< @@ -2889,18 +2690,18 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_16cbuffer_metainfo(CYTHON_UNUSED PyO */ blosc_cbuffer_metainfo(__pyx_v_buffer->ptr, (&__pyx_v_typesize), (&__pyx_v_flags)); - /* "numcodecs/blosc.pyx":199 + /* "numcodecs/blosc.pyx":200 * * # release buffers * buffer.release() # <<<<<<<<<<<<<< * * # decompose flags */ - __pyx_t_1 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_buffer->__pyx_vtab)->release(__pyx_v_buffer, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_buffer->__pyx_vtab)->release(__pyx_v_buffer, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":202 + /* "numcodecs/blosc.pyx":203 * * # decompose flags * if flags & BLOSC_DOSHUFFLE: # <<<<<<<<<<<<<< @@ -2910,19 +2711,19 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_16cbuffer_metainfo(CYTHON_UNUSED PyO __pyx_t_3 = ((__pyx_v_flags & BLOSC_DOSHUFFLE) != 0); if (__pyx_t_3) { - /* "numcodecs/blosc.pyx":203 + /* "numcodecs/blosc.pyx":204 * # decompose flags * if flags & BLOSC_DOSHUFFLE: * shuffle = SHUFFLE # <<<<<<<<<<<<<< * elif flags & BLOSC_DOBITSHUFFLE: * shuffle = BITSHUFFLE */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_SHUFFLE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_SHUFFLE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_shuffle = __pyx_t_1; __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":202 + /* "numcodecs/blosc.pyx":203 * * # decompose flags * if flags & BLOSC_DOSHUFFLE: # <<<<<<<<<<<<<< @@ -2932,7 +2733,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_16cbuffer_metainfo(CYTHON_UNUSED PyO goto __pyx_L3; } - /* "numcodecs/blosc.pyx":204 + /* "numcodecs/blosc.pyx":205 * if flags & BLOSC_DOSHUFFLE: * shuffle = SHUFFLE * elif flags & BLOSC_DOBITSHUFFLE: # <<<<<<<<<<<<<< @@ -2942,19 +2743,19 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_16cbuffer_metainfo(CYTHON_UNUSED PyO __pyx_t_3 = ((__pyx_v_flags & BLOSC_DOBITSHUFFLE) != 0); if (__pyx_t_3) { - /* "numcodecs/blosc.pyx":205 + /* "numcodecs/blosc.pyx":206 * shuffle = SHUFFLE * elif flags & BLOSC_DOBITSHUFFLE: * shuffle = BITSHUFFLE # <<<<<<<<<<<<<< * else: * shuffle = NOSHUFFLE */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BITSHUFFLE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BITSHUFFLE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_shuffle = __pyx_t_1; __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":204 + /* "numcodecs/blosc.pyx":205 * if flags & BLOSC_DOSHUFFLE: * shuffle = SHUFFLE * elif flags & BLOSC_DOBITSHUFFLE: # <<<<<<<<<<<<<< @@ -2964,7 +2765,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_16cbuffer_metainfo(CYTHON_UNUSED PyO goto __pyx_L3; } - /* "numcodecs/blosc.pyx":207 + /* "numcodecs/blosc.pyx":208 * shuffle = BITSHUFFLE * else: * shuffle = NOSHUFFLE # <<<<<<<<<<<<<< @@ -2972,14 +2773,14 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_16cbuffer_metainfo(CYTHON_UNUSED PyO * */ /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_NOSHUFFLE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_NOSHUFFLE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_shuffle = __pyx_t_1; __pyx_t_1 = 0; } __pyx_L3:; - /* "numcodecs/blosc.pyx":208 + /* "numcodecs/blosc.pyx":209 * else: * shuffle = NOSHUFFLE * memcpyed = flags & BLOSC_MEMCPYED # <<<<<<<<<<<<<< @@ -2988,7 +2789,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_16cbuffer_metainfo(CYTHON_UNUSED PyO */ __pyx_v_memcpyed = (__pyx_v_flags & BLOSC_MEMCPYED); - /* "numcodecs/blosc.pyx":210 + /* "numcodecs/blosc.pyx":211 * memcpyed = flags & BLOSC_MEMCPYED * * return typesize, shuffle, memcpyed # <<<<<<<<<<<<<< @@ -2996,11 +2797,11 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_16cbuffer_metainfo(CYTHON_UNUSED PyO * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_typesize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_typesize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_memcpyed); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_memcpyed); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 211, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 210, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 211, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); @@ -3015,7 +2816,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_16cbuffer_metainfo(CYTHON_UNUSED PyO __pyx_t_4 = 0; goto __pyx_L0; - /* "numcodecs/blosc.pyx":175 + /* "numcodecs/blosc.pyx":176 * * * def cbuffer_metainfo(source): # <<<<<<<<<<<<<< @@ -3038,7 +2839,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_16cbuffer_metainfo(CYTHON_UNUSED PyO return __pyx_r; } -/* "numcodecs/blosc.pyx":213 +/* "numcodecs/blosc.pyx":214 * * * def err_bad_cname(cname): # <<<<<<<<<<<<<< @@ -3069,14 +2870,14 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_18err_bad_cname(CYTHON_UNUSED PyObje PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("err_bad_cname", 0); - /* "numcodecs/blosc.pyx":215 + /* "numcodecs/blosc.pyx":216 * def err_bad_cname(cname): * raise ValueError('bad compressor or compressor not supported: %r; expected one of ' * '%s' % (cname, list_compressors())) # <<<<<<<<<<<<<< * * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_list_compressors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_list_compressors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { @@ -3090,10 +2891,10 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_18err_bad_cname(CYTHON_UNUSED PyObje } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 215, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_cname); __Pyx_GIVEREF(__pyx_v_cname); @@ -3101,25 +2902,25 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_18err_bad_cname(CYTHON_UNUSED PyObje __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_bad_compressor_or_compressor_not, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 215, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_bad_compressor_or_compressor_not, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":214 + /* "numcodecs/blosc.pyx":215 * * def err_bad_cname(cname): * raise ValueError('bad compressor or compressor not supported: %r; expected one of ' # <<<<<<<<<<<<<< * '%s' % (cname, list_compressors())) * */ - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 214, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 214, __pyx_L1_error) + __PYX_ERR(0, 215, __pyx_L1_error) - /* "numcodecs/blosc.pyx":213 + /* "numcodecs/blosc.pyx":214 * * * def err_bad_cname(cname): # <<<<<<<<<<<<<< @@ -3139,7 +2940,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_18err_bad_cname(CYTHON_UNUSED PyObje return __pyx_r; } -/* "numcodecs/blosc.pyx":218 +/* "numcodecs/blosc.pyx":219 * * * def compress(source, char* cname, int clevel, int shuffle=SHUFFLE, # <<<<<<<<<<<<<< @@ -3189,13 +2990,13 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_21compress(PyObject *__pyx_self, PyO case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cname)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("compress", 0, 3, 5, 1); __PYX_ERR(0, 218, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("compress", 0, 3, 5, 1); __PYX_ERR(0, 219, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clevel)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("compress", 0, 3, 5, 2); __PYX_ERR(0, 218, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("compress", 0, 3, 5, 2); __PYX_ERR(0, 219, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: @@ -3211,7 +3012,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_21compress(PyObject *__pyx_self, PyO } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "compress") < 0)) __PYX_ERR(0, 218, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "compress") < 0)) __PYX_ERR(0, 219, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3227,22 +3028,22 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_21compress(PyObject *__pyx_self, PyO } } __pyx_v_source = values[0]; - __pyx_v_cname = __Pyx_PyObject_AsWritableString(values[1]); if (unlikely((!__pyx_v_cname) && PyErr_Occurred())) __PYX_ERR(0, 218, __pyx_L3_error) - __pyx_v_clevel = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_clevel == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 218, __pyx_L3_error) + __pyx_v_cname = __Pyx_PyObject_AsWritableString(values[1]); if (unlikely((!__pyx_v_cname) && PyErr_Occurred())) __PYX_ERR(0, 219, __pyx_L3_error) + __pyx_v_clevel = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_clevel == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 219, __pyx_L3_error) if (values[3]) { - __pyx_v_shuffle = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_shuffle == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 218, __pyx_L3_error) + __pyx_v_shuffle = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_shuffle == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 219, __pyx_L3_error) } else { __pyx_v_shuffle = __pyx_k__2; } if (values[4]) { - __pyx_v_blocksize = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_blocksize == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 219, __pyx_L3_error) + __pyx_v_blocksize = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_blocksize == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L3_error) } else { __pyx_v_blocksize = __pyx_k__3; } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("compress", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 218, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("compress", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 219, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.blosc.compress", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3286,32 +3087,32 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ PyObject *__pyx_t_17 = NULL; __Pyx_RefNannySetupContext("compress", 0); - /* "numcodecs/blosc.pyx":255 + /* "numcodecs/blosc.pyx":256 * * # check valid cname early * if PY2: # <<<<<<<<<<<<<< * cname_str = cname * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PY2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 255, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PY2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 255, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 256, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "numcodecs/blosc.pyx":256 + /* "numcodecs/blosc.pyx":257 * # check valid cname early * if PY2: * cname_str = cname # <<<<<<<<<<<<<< * else: * cname_str = cname.decode('ascii') */ - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_cname); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_cname); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_cname_str = __pyx_t_1; __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":255 + /* "numcodecs/blosc.pyx":256 * * # check valid cname early * if PY2: # <<<<<<<<<<<<<< @@ -3321,7 +3122,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ goto __pyx_L3; } - /* "numcodecs/blosc.pyx":258 + /* "numcodecs/blosc.pyx":259 * cname_str = cname * else: * cname_str = cname.decode('ascii') # <<<<<<<<<<<<<< @@ -3329,21 +3130,21 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ * err_bad_cname(cname_str) */ /*else*/ { - __pyx_t_1 = __Pyx_decode_c_string(__pyx_v_cname, 0, strlen(__pyx_v_cname), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error) + __pyx_t_1 = __Pyx_decode_c_string(__pyx_v_cname, 0, strlen(__pyx_v_cname), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_cname_str = __pyx_t_1; __pyx_t_1 = 0; } __pyx_L3:; - /* "numcodecs/blosc.pyx":259 + /* "numcodecs/blosc.pyx":260 * else: * cname_str = cname.decode('ascii') * if cname_str not in list_compressors(): # <<<<<<<<<<<<<< * err_bad_cname(cname_str) * */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_list_compressors); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 259, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_list_compressors); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 260, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { @@ -3357,22 +3158,22 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ } __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 260, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_cname_str, __pyx_t_1, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 259, __pyx_L1_error) + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_cname_str, __pyx_t_1, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 260, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = (__pyx_t_2 != 0); if (__pyx_t_5) { - /* "numcodecs/blosc.pyx":260 + /* "numcodecs/blosc.pyx":261 * cname_str = cname.decode('ascii') * if cname_str not in list_compressors(): * err_bad_cname(cname_str) # <<<<<<<<<<<<<< * * # setup source buffer */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_err_bad_cname); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 260, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_err_bad_cname); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 261, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { @@ -3386,12 +3187,12 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ } __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_cname_str) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_cname_str); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 260, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 261, __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; - /* "numcodecs/blosc.pyx":259 + /* "numcodecs/blosc.pyx":260 * else: * cname_str = cname.decode('ascii') * if cname_str not in list_compressors(): # <<<<<<<<<<<<<< @@ -3400,16 +3201,16 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ */ } - /* "numcodecs/blosc.pyx":263 + /* "numcodecs/blosc.pyx":264 * * # setup source buffer * source_buffer = Buffer(source, PyBUF_ANY_CONTIGUOUS) # <<<<<<<<<<<<<< * source_ptr = source_buffer.ptr * nbytes = source_buffer.nbytes */ - __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 263, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 264, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 263, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 264, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_source); __Pyx_GIVEREF(__pyx_v_source); @@ -3417,13 +3218,13 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __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(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 263, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 264, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_source_buffer = ((struct __pyx_obj_9numcodecs_10compat_ext_Buffer *)__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":264 + /* "numcodecs/blosc.pyx":265 * # setup source buffer * source_buffer = Buffer(source, PyBUF_ANY_CONTIGUOUS) * source_ptr = source_buffer.ptr # <<<<<<<<<<<<<< @@ -3433,7 +3234,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __pyx_t_6 = __pyx_v_source_buffer->ptr; __pyx_v_source_ptr = __pyx_t_6; - /* "numcodecs/blosc.pyx":265 + /* "numcodecs/blosc.pyx":266 * source_buffer = Buffer(source, PyBUF_ANY_CONTIGUOUS) * source_ptr = source_buffer.ptr * nbytes = source_buffer.nbytes # <<<<<<<<<<<<<< @@ -3443,7 +3244,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __pyx_t_7 = __pyx_v_source_buffer->nbytes; __pyx_v_nbytes = __pyx_t_7; - /* "numcodecs/blosc.pyx":266 + /* "numcodecs/blosc.pyx":267 * source_ptr = source_buffer.ptr * nbytes = source_buffer.nbytes * itemsize = source_buffer.itemsize # <<<<<<<<<<<<<< @@ -3453,25 +3254,25 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __pyx_t_7 = __pyx_v_source_buffer->itemsize; __pyx_v_itemsize = __pyx_t_7; - /* "numcodecs/blosc.pyx":269 + /* "numcodecs/blosc.pyx":270 * * # determine shuffle * if shuffle == AUTOSHUFFLE: # <<<<<<<<<<<<<< * if itemsize == 1: * shuffle = BITSHUFFLE */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_shuffle); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_shuffle); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 270, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_AUTOSHUFFLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 269, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_AUTOSHUFFLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 270, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 269, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 270, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 269, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 270, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_5) { - /* "numcodecs/blosc.pyx":270 + /* "numcodecs/blosc.pyx":271 * # determine shuffle * if shuffle == AUTOSHUFFLE: * if itemsize == 1: # <<<<<<<<<<<<<< @@ -3481,20 +3282,20 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __pyx_t_5 = ((__pyx_v_itemsize == 1) != 0); if (__pyx_t_5) { - /* "numcodecs/blosc.pyx":271 + /* "numcodecs/blosc.pyx":272 * if shuffle == AUTOSHUFFLE: * if itemsize == 1: * shuffle = BITSHUFFLE # <<<<<<<<<<<<<< * else: * shuffle = SHUFFLE */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_BITSHUFFLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 271, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_BITSHUFFLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 272, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 271, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 272, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_shuffle = __pyx_t_8; - /* "numcodecs/blosc.pyx":270 + /* "numcodecs/blosc.pyx":271 * # determine shuffle * if shuffle == AUTOSHUFFLE: * if itemsize == 1: # <<<<<<<<<<<<<< @@ -3504,7 +3305,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ goto __pyx_L6; } - /* "numcodecs/blosc.pyx":273 + /* "numcodecs/blosc.pyx":274 * shuffle = BITSHUFFLE * else: * shuffle = SHUFFLE # <<<<<<<<<<<<<< @@ -3512,15 +3313,15 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ * raise ValueError('invalid shuffle argument; expected -1, 0, 1 or 2, found %r' % */ /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_SHUFFLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 273, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_SHUFFLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 274, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 273, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 274, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_shuffle = __pyx_t_8; } __pyx_L6:; - /* "numcodecs/blosc.pyx":269 + /* "numcodecs/blosc.pyx":270 * * # determine shuffle * if shuffle == AUTOSHUFFLE: # <<<<<<<<<<<<<< @@ -3530,7 +3331,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ goto __pyx_L5; } - /* "numcodecs/blosc.pyx":274 + /* "numcodecs/blosc.pyx":275 * else: * shuffle = SHUFFLE * elif shuffle not in [NOSHUFFLE, SHUFFLE, BITSHUFFLE]: # <<<<<<<<<<<<<< @@ -3538,76 +3339,76 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ * shuffle) */ __pyx_t_8 = __pyx_v_shuffle; - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 274, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 275, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_NOSHUFFLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 274, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_NOSHUFFLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 275, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error) + __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 275, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 274, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 275, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { } else { __pyx_t_5 = __pyx_t_2; goto __pyx_L7_bool_binop_done; } - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 275, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_SHUFFLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 274, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_SHUFFLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 275, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 274, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 275, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 274, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 275, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_2) { } else { __pyx_t_5 = __pyx_t_2; goto __pyx_L7_bool_binop_done; } - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 274, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 275, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_BITSHUFFLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 274, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_BITSHUFFLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 275, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error) + __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 275, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 274, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 275, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = __pyx_t_2; __pyx_L7_bool_binop_done:; __pyx_t_2 = (__pyx_t_5 != 0); if (unlikely(__pyx_t_2)) { - /* "numcodecs/blosc.pyx":276 + /* "numcodecs/blosc.pyx":277 * elif shuffle not in [NOSHUFFLE, SHUFFLE, BITSHUFFLE]: * raise ValueError('invalid shuffle argument; expected -1, 0, 1 or 2, found %r' % * shuffle) # <<<<<<<<<<<<<< * * try: */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_shuffle); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 276, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_shuffle); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 277, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - /* "numcodecs/blosc.pyx":275 + /* "numcodecs/blosc.pyx":276 * shuffle = SHUFFLE * elif shuffle not in [NOSHUFFLE, SHUFFLE, BITSHUFFLE]: * raise ValueError('invalid shuffle argument; expected -1, 0, 1 or 2, found %r' % # <<<<<<<<<<<<<< * shuffle) * */ - __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_invalid_shuffle_argument_expecte, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 275, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_invalid_shuffle_argument_expecte, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 276, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 275, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 276, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 275, __pyx_L1_error) + __PYX_ERR(0, 276, __pyx_L1_error) - /* "numcodecs/blosc.pyx":274 + /* "numcodecs/blosc.pyx":275 * else: * shuffle = SHUFFLE * elif shuffle not in [NOSHUFFLE, SHUFFLE, BITSHUFFLE]: # <<<<<<<<<<<<<< @@ -3617,7 +3418,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ } __pyx_L5:; - /* "numcodecs/blosc.pyx":278 + /* "numcodecs/blosc.pyx":279 * shuffle) * * try: # <<<<<<<<<<<<<< @@ -3626,19 +3427,19 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ */ /*try:*/ { - /* "numcodecs/blosc.pyx":281 + /* "numcodecs/blosc.pyx":282 * * # setup destination * dest = PyBytes_FromStringAndSize(NULL, nbytes + BLOSC_MAX_OVERHEAD) # <<<<<<<<<<<<<< * dest_ptr = PyBytes_AS_STRING(dest) * */ - __pyx_t_1 = PyBytes_FromStringAndSize(NULL, (__pyx_v_nbytes + BLOSC_MAX_OVERHEAD)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 281, __pyx_L11_error) + __pyx_t_1 = PyBytes_FromStringAndSize(NULL, (__pyx_v_nbytes + BLOSC_MAX_OVERHEAD)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 282, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_dest = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":282 + /* "numcodecs/blosc.pyx":283 * # setup destination * dest = PyBytes_FromStringAndSize(NULL, nbytes + BLOSC_MAX_OVERHEAD) * dest_ptr = PyBytes_AS_STRING(dest) # <<<<<<<<<<<<<< @@ -3647,14 +3448,14 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ */ __pyx_v_dest_ptr = PyBytes_AS_STRING(__pyx_v_dest); - /* "numcodecs/blosc.pyx":285 + /* "numcodecs/blosc.pyx":286 * * # perform compression * if _get_use_threads(): # <<<<<<<<<<<<<< * # allow blosc to use threads internally * */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_get_use_threads); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 285, __pyx_L11_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_get_use_threads); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 286, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { @@ -3668,14 +3469,14 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ } __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 285, __pyx_L11_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 286, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 285, __pyx_L11_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 286, __pyx_L11_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "numcodecs/blosc.pyx":291 + /* "numcodecs/blosc.pyx":292 * # to ensure no-one else can modify the global context while we're setting it * # up and using it. * with mutex: # <<<<<<<<<<<<<< @@ -3683,11 +3484,11 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ * # set compressor */ /*with:*/ { - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_mutex); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 291, __pyx_L11_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_mutex); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 292, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 291, __pyx_L11_error) + __pyx_t_9 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 292, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 291, __pyx_L14_error) + __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 292, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_10 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { @@ -3701,7 +3502,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ } __pyx_t_3 = (__pyx_t_10) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_10) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 291, __pyx_L14_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -3716,7 +3517,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __Pyx_XGOTREF(__pyx_t_13); /*try:*/ { - /* "numcodecs/blosc.pyx":294 + /* "numcodecs/blosc.pyx":295 * * # set compressor * compressor_set = blosc_set_compressor(cname) # <<<<<<<<<<<<<< @@ -3725,7 +3526,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ */ __pyx_v_compressor_set = blosc_set_compressor(__pyx_v_cname); - /* "numcodecs/blosc.pyx":295 + /* "numcodecs/blosc.pyx":296 * # set compressor * compressor_set = blosc_set_compressor(cname) * if compressor_set < 0: # <<<<<<<<<<<<<< @@ -3735,14 +3536,14 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __pyx_t_2 = ((__pyx_v_compressor_set < 0) != 0); if (__pyx_t_2) { - /* "numcodecs/blosc.pyx":298 + /* "numcodecs/blosc.pyx":299 * # shouldn't happen if we checked against list of compressors * # already, but just in case * err_bad_cname(cname_str) # <<<<<<<<<<<<<< * * # set blocksize */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_err_bad_cname); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 298, __pyx_L18_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_err_bad_cname); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 299, __pyx_L18_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { @@ -3756,12 +3557,12 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ } __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_cname_str) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_cname_str); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 298, __pyx_L18_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 299, __pyx_L18_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":295 + /* "numcodecs/blosc.pyx":296 * # set compressor * compressor_set = blosc_set_compressor(cname) * if compressor_set < 0: # <<<<<<<<<<<<<< @@ -3770,7 +3571,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ */ } - /* "numcodecs/blosc.pyx":301 + /* "numcodecs/blosc.pyx":302 * * # set blocksize * blosc_set_blocksize(blocksize) # <<<<<<<<<<<<<< @@ -3779,7 +3580,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ */ blosc_set_blocksize(__pyx_v_blocksize); - /* "numcodecs/blosc.pyx":304 + /* "numcodecs/blosc.pyx":305 * * # perform compression * with nogil: # <<<<<<<<<<<<<< @@ -3794,7 +3595,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ #endif /*try:*/ { - /* "numcodecs/blosc.pyx":305 + /* "numcodecs/blosc.pyx":306 * # perform compression * with nogil: * cbytes = blosc_compress(clevel, shuffle, itemsize, nbytes, source_ptr, # <<<<<<<<<<<<<< @@ -3804,7 +3605,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __pyx_v_cbytes = blosc_compress(__pyx_v_clevel, __pyx_v_shuffle, __pyx_v_itemsize, __pyx_v_nbytes, __pyx_v_source_ptr, __pyx_v_dest_ptr, (__pyx_v_nbytes + BLOSC_MAX_OVERHEAD)); } - /* "numcodecs/blosc.pyx":304 + /* "numcodecs/blosc.pyx":305 * * # perform compression * with nogil: # <<<<<<<<<<<<<< @@ -3823,7 +3624,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ } } - /* "numcodecs/blosc.pyx":291 + /* "numcodecs/blosc.pyx":292 * # to ensure no-one else can modify the global context while we're setting it * # up and using it. * with mutex: # <<<<<<<<<<<<<< @@ -3842,20 +3643,20 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; /*except:*/ { __Pyx_AddTraceback("numcodecs.blosc.compress", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 291, __pyx_L20_except_error) + if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 292, __pyx_L20_except_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 291, __pyx_L20_except_error) + __pyx_t_10 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 292, __pyx_L20_except_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_10, NULL); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 291, __pyx_L20_except_error) + if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 292, __pyx_L20_except_error) __Pyx_GOTREF(__pyx_t_14); __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_14); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (__pyx_t_2 < 0) __PYX_ERR(0, 291, __pyx_L20_except_error) + if (__pyx_t_2 < 0) __PYX_ERR(0, 292, __pyx_L20_except_error) __pyx_t_5 = ((!(__pyx_t_2 != 0)) != 0); if (__pyx_t_5) { __Pyx_GIVEREF(__pyx_t_1); @@ -3863,7 +3664,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __Pyx_XGIVEREF(__pyx_t_4); __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_3, __pyx_t_4); __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; - __PYX_ERR(0, 291, __pyx_L20_except_error) + __PYX_ERR(0, 292, __pyx_L20_except_error) } __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -3889,7 +3690,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ if (__pyx_t_9) { __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_tuple__4, NULL); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 291, __pyx_L11_error) + if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 292, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; } @@ -3904,7 +3705,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __pyx_L31:; } - /* "numcodecs/blosc.pyx":285 + /* "numcodecs/blosc.pyx":286 * * # perform compression * if _get_use_threads(): # <<<<<<<<<<<<<< @@ -3914,7 +3715,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ goto __pyx_L13; } - /* "numcodecs/blosc.pyx":309 + /* "numcodecs/blosc.pyx":310 * * else: * with nogil: # <<<<<<<<<<<<<< @@ -3930,7 +3731,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ #endif /*try:*/ { - /* "numcodecs/blosc.pyx":310 + /* "numcodecs/blosc.pyx":311 * else: * with nogil: * cbytes = blosc_compress_ctx(clevel, shuffle, itemsize, nbytes, source_ptr, # <<<<<<<<<<<<<< @@ -3940,7 +3741,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __pyx_v_cbytes = blosc_compress_ctx(__pyx_v_clevel, __pyx_v_shuffle, __pyx_v_itemsize, __pyx_v_nbytes, __pyx_v_source_ptr, __pyx_v_dest_ptr, (__pyx_v_nbytes + BLOSC_MAX_OVERHEAD), __pyx_v_cname, __pyx_v_blocksize, 1); } - /* "numcodecs/blosc.pyx":309 + /* "numcodecs/blosc.pyx":310 * * else: * with nogil: # <<<<<<<<<<<<<< @@ -3962,7 +3763,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __pyx_L13:; } - /* "numcodecs/blosc.pyx":317 + /* "numcodecs/blosc.pyx":318 * * # release buffers * source_buffer.release() # <<<<<<<<<<<<<< @@ -3971,7 +3772,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ */ /*finally:*/ { /*normal exit:*/{ - __pyx_t_4 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 317, __pyx_L1_error) + __pyx_t_4 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 318, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L12; @@ -3995,7 +3796,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __Pyx_XGOTREF(__pyx_t_17); __pyx_t_8 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_16 = __pyx_filename; { - __pyx_t_4 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 317, __pyx_L36_error) + __pyx_t_4 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 318, __pyx_L36_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } @@ -4028,7 +3829,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __pyx_L12:; } - /* "numcodecs/blosc.pyx":320 + /* "numcodecs/blosc.pyx":321 * * # check compression was successful * if cbytes <= 0: # <<<<<<<<<<<<<< @@ -4038,26 +3839,26 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __pyx_t_5 = ((__pyx_v_cbytes <= 0) != 0); if (unlikely(__pyx_t_5)) { - /* "numcodecs/blosc.pyx":321 + /* "numcodecs/blosc.pyx":322 * # check compression was successful * if cbytes <= 0: * raise RuntimeError('error during blosc compression: %d' % cbytes) # <<<<<<<<<<<<<< * * # resize after compression */ - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_cbytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 321, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_cbytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 322, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_error_during_blosc_compression_d, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 321, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_error_during_blosc_compression_d, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 322, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 321, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 322, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 321, __pyx_L1_error) + __PYX_ERR(0, 322, __pyx_L1_error) - /* "numcodecs/blosc.pyx":320 + /* "numcodecs/blosc.pyx":321 * * # check compression was successful * if cbytes <= 0: # <<<<<<<<<<<<<< @@ -4066,7 +3867,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ */ } - /* "numcodecs/blosc.pyx":324 + /* "numcodecs/blosc.pyx":325 * * # resize after compression * dest = dest[:cbytes] # <<<<<<<<<<<<<< @@ -4075,14 +3876,14 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ */ if (unlikely(__pyx_v_dest == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 324, __pyx_L1_error) + __PYX_ERR(0, 325, __pyx_L1_error) } - __pyx_t_4 = PySequence_GetSlice(__pyx_v_dest, 0, __pyx_v_cbytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 324, __pyx_L1_error) + __pyx_t_4 = PySequence_GetSlice(__pyx_v_dest, 0, __pyx_v_cbytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 325, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF_SET(__pyx_v_dest, ((PyObject*)__pyx_t_4)); __pyx_t_4 = 0; - /* "numcodecs/blosc.pyx":326 + /* "numcodecs/blosc.pyx":327 * dest = dest[:cbytes] * * return dest # <<<<<<<<<<<<<< @@ -4094,7 +3895,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ __pyx_r = __pyx_v_dest; goto __pyx_L0; - /* "numcodecs/blosc.pyx":218 + /* "numcodecs/blosc.pyx":219 * * * def compress(source, char* cname, int clevel, int shuffle=SHUFFLE, # <<<<<<<<<<<<<< @@ -4119,7 +3920,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_20compress(CYTHON_UNUSED PyObject *_ return __pyx_r; } -/* "numcodecs/blosc.pyx":329 +/* "numcodecs/blosc.pyx":330 * * * def decompress(source, dest=None): # <<<<<<<<<<<<<< @@ -4165,7 +3966,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_23decompress(PyObject *__pyx_self, P } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decompress") < 0)) __PYX_ERR(0, 329, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decompress") < 0)) __PYX_ERR(0, 330, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -4181,7 +3982,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_23decompress(PyObject *__pyx_self, P } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("decompress", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 329, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decompress", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 330, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.blosc.decompress", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -4225,7 +4026,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __Pyx_RefNannySetupContext("decompress", 0); __Pyx_INCREF(__pyx_v_dest); - /* "numcodecs/blosc.pyx":351 + /* "numcodecs/blosc.pyx":352 * char *dest_ptr * Buffer source_buffer * Buffer dest_buffer = None # <<<<<<<<<<<<<< @@ -4235,16 +4036,16 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __Pyx_INCREF(Py_None); __pyx_v_dest_buffer = ((struct __pyx_obj_9numcodecs_10compat_ext_Buffer *)Py_None); - /* "numcodecs/blosc.pyx":355 + /* "numcodecs/blosc.pyx":356 * * # setup source buffer * source_buffer = Buffer(source, PyBUF_ANY_CONTIGUOUS) # <<<<<<<<<<<<<< * source_ptr = source_buffer.ptr * */ - __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 356, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 355, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 356, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_source); __Pyx_GIVEREF(__pyx_v_source); @@ -4252,13 +4053,13 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 356, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_source_buffer = ((struct __pyx_obj_9numcodecs_10compat_ext_Buffer *)__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":356 + /* "numcodecs/blosc.pyx":357 * # setup source buffer * source_buffer = Buffer(source, PyBUF_ANY_CONTIGUOUS) * source_ptr = source_buffer.ptr # <<<<<<<<<<<<<< @@ -4268,7 +4069,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_t_3 = __pyx_v_source_buffer->ptr; __pyx_v_source_ptr = __pyx_t_3; - /* "numcodecs/blosc.pyx":359 + /* "numcodecs/blosc.pyx":360 * * # determine buffer size * blosc_cbuffer_sizes(source_ptr, &nbytes, &cbytes, &blocksize) # <<<<<<<<<<<<<< @@ -4277,7 +4078,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject */ blosc_cbuffer_sizes(__pyx_v_source_ptr, (&__pyx_v_nbytes), (&__pyx_v_cbytes), (&__pyx_v_blocksize)); - /* "numcodecs/blosc.pyx":362 + /* "numcodecs/blosc.pyx":363 * * # setup destination buffer * if dest is None: # <<<<<<<<<<<<<< @@ -4288,19 +4089,19 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_t_5 = (__pyx_t_4 != 0); if (__pyx_t_5) { - /* "numcodecs/blosc.pyx":364 + /* "numcodecs/blosc.pyx":365 * if dest is None: * # allocate memory * dest = PyBytes_FromStringAndSize(NULL, nbytes) # <<<<<<<<<<<<<< * dest_ptr = PyBytes_AS_STRING(dest) * dest_nbytes = nbytes */ - __pyx_t_1 = PyBytes_FromStringAndSize(NULL, __pyx_v_nbytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error) + __pyx_t_1 = PyBytes_FromStringAndSize(NULL, __pyx_v_nbytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 365, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF_SET(__pyx_v_dest, __pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":365 + /* "numcodecs/blosc.pyx":366 * # allocate memory * dest = PyBytes_FromStringAndSize(NULL, nbytes) * dest_ptr = PyBytes_AS_STRING(dest) # <<<<<<<<<<<<<< @@ -4309,7 +4110,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject */ __pyx_v_dest_ptr = PyBytes_AS_STRING(__pyx_v_dest); - /* "numcodecs/blosc.pyx":366 + /* "numcodecs/blosc.pyx":367 * dest = PyBytes_FromStringAndSize(NULL, nbytes) * dest_ptr = PyBytes_AS_STRING(dest) * dest_nbytes = nbytes # <<<<<<<<<<<<<< @@ -4318,7 +4119,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject */ __pyx_v_dest_nbytes = __pyx_v_nbytes; - /* "numcodecs/blosc.pyx":362 + /* "numcodecs/blosc.pyx":363 * * # setup destination buffer * if dest is None: # <<<<<<<<<<<<<< @@ -4328,7 +4129,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject goto __pyx_L3; } - /* "numcodecs/blosc.pyx":368 + /* "numcodecs/blosc.pyx":369 * dest_nbytes = nbytes * else: * dest_buffer = Buffer(dest, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) # <<<<<<<<<<<<<< @@ -4336,9 +4137,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject * dest_nbytes = dest_buffer.nbytes */ /*else*/ { - __pyx_t_1 = __Pyx_PyInt_From_int((PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int((PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 369, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 368, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 369, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_dest); __Pyx_GIVEREF(__pyx_v_dest); @@ -4346,13 +4147,13 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 369, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF_SET(__pyx_v_dest_buffer, ((struct __pyx_obj_9numcodecs_10compat_ext_Buffer *)__pyx_t_1)); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":369 + /* "numcodecs/blosc.pyx":370 * else: * dest_buffer = Buffer(dest, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) * dest_ptr = dest_buffer.ptr # <<<<<<<<<<<<<< @@ -4362,7 +4163,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_t_3 = __pyx_v_dest_buffer->ptr; __pyx_v_dest_ptr = __pyx_t_3; - /* "numcodecs/blosc.pyx":370 + /* "numcodecs/blosc.pyx":371 * dest_buffer = Buffer(dest, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) * dest_ptr = dest_buffer.ptr * dest_nbytes = dest_buffer.nbytes # <<<<<<<<<<<<<< @@ -4374,7 +4175,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject } __pyx_L3:; - /* "numcodecs/blosc.pyx":372 + /* "numcodecs/blosc.pyx":373 * dest_nbytes = dest_buffer.nbytes * * try: # <<<<<<<<<<<<<< @@ -4383,7 +4184,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject */ /*try:*/ { - /* "numcodecs/blosc.pyx":375 + /* "numcodecs/blosc.pyx":376 * * # guard condition * if dest_nbytes < nbytes: # <<<<<<<<<<<<<< @@ -4393,18 +4194,18 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_t_5 = ((__pyx_v_dest_nbytes < __pyx_v_nbytes) != 0); if (unlikely(__pyx_t_5)) { - /* "numcodecs/blosc.pyx":377 + /* "numcodecs/blosc.pyx":378 * if dest_nbytes < nbytes: * raise ValueError('destination buffer too small; expected at least %s, ' * 'got %s' % (nbytes, dest_nbytes)) # <<<<<<<<<<<<<< * * # perform decompression */ - __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_nbytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 377, __pyx_L5_error) + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_nbytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 378, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_dest_nbytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 377, __pyx_L5_error) + __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_dest_nbytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 378, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 377, __pyx_L5_error) + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 378, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); @@ -4412,25 +4213,25 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_destination_buffer_too_small_exp, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 377, __pyx_L5_error) + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_destination_buffer_too_small_exp, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 378, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/blosc.pyx":376 + /* "numcodecs/blosc.pyx":377 * # guard condition * if dest_nbytes < nbytes: * raise ValueError('destination buffer too small; expected at least %s, ' # <<<<<<<<<<<<<< * 'got %s' % (nbytes, dest_nbytes)) * */ - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 376, __pyx_L5_error) + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 377, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_7, 0, 0, 0); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(0, 376, __pyx_L5_error) + __PYX_ERR(0, 377, __pyx_L5_error) - /* "numcodecs/blosc.pyx":375 + /* "numcodecs/blosc.pyx":376 * * # guard condition * if dest_nbytes < nbytes: # <<<<<<<<<<<<<< @@ -4439,14 +4240,14 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject */ } - /* "numcodecs/blosc.pyx":380 + /* "numcodecs/blosc.pyx":381 * * # perform decompression * if _get_use_threads(): # <<<<<<<<<<<<<< * # allow blosc to use threads internally * with nogil: */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_use_threads); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 380, __pyx_L5_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_use_threads); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 381, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { @@ -4460,14 +4261,14 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject } __pyx_t_7 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 380, __pyx_L5_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 381, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 380, __pyx_L5_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 381, __pyx_L5_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_5) { - /* "numcodecs/blosc.pyx":382 + /* "numcodecs/blosc.pyx":383 * if _get_use_threads(): * # allow blosc to use threads internally * with nogil: # <<<<<<<<<<<<<< @@ -4482,7 +4283,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject #endif /*try:*/ { - /* "numcodecs/blosc.pyx":383 + /* "numcodecs/blosc.pyx":384 * # allow blosc to use threads internally * with nogil: * ret = blosc_decompress(source_ptr, dest_ptr, nbytes) # <<<<<<<<<<<<<< @@ -4492,7 +4293,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_v_ret = blosc_decompress(__pyx_v_source_ptr, __pyx_v_dest_ptr, __pyx_v_nbytes); } - /* "numcodecs/blosc.pyx":382 + /* "numcodecs/blosc.pyx":383 * if _get_use_threads(): * # allow blosc to use threads internally * with nogil: # <<<<<<<<<<<<<< @@ -4511,7 +4312,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject } } - /* "numcodecs/blosc.pyx":380 + /* "numcodecs/blosc.pyx":381 * * # perform decompression * if _get_use_threads(): # <<<<<<<<<<<<<< @@ -4521,7 +4322,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject goto __pyx_L8; } - /* "numcodecs/blosc.pyx":385 + /* "numcodecs/blosc.pyx":386 * ret = blosc_decompress(source_ptr, dest_ptr, nbytes) * else: * with nogil: # <<<<<<<<<<<<<< @@ -4537,7 +4338,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject #endif /*try:*/ { - /* "numcodecs/blosc.pyx":386 + /* "numcodecs/blosc.pyx":387 * else: * with nogil: * ret = blosc_decompress_ctx(source_ptr, dest_ptr, nbytes, 1) # <<<<<<<<<<<<<< @@ -4547,7 +4348,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_v_ret = blosc_decompress_ctx(__pyx_v_source_ptr, __pyx_v_dest_ptr, __pyx_v_nbytes, 1); } - /* "numcodecs/blosc.pyx":385 + /* "numcodecs/blosc.pyx":386 * ret = blosc_decompress(source_ptr, dest_ptr, nbytes) * else: * with nogil: # <<<<<<<<<<<<<< @@ -4569,7 +4370,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_L8:; } - /* "numcodecs/blosc.pyx":391 + /* "numcodecs/blosc.pyx":392 * * # release buffers * source_buffer.release() # <<<<<<<<<<<<<< @@ -4578,11 +4379,11 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject */ /*finally:*/ { /*normal exit:*/{ - __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 391, __pyx_L1_error) + __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 392, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/blosc.pyx":392 + /* "numcodecs/blosc.pyx":393 * # release buffers * source_buffer.release() * if dest_buffer is not None: # <<<<<<<<<<<<<< @@ -4593,18 +4394,18 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_t_4 = (__pyx_t_5 != 0); if (__pyx_t_4) { - /* "numcodecs/blosc.pyx":393 + /* "numcodecs/blosc.pyx":394 * source_buffer.release() * if dest_buffer is not None: * dest_buffer.release() # <<<<<<<<<<<<<< * * # handle errors */ - __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_dest_buffer->__pyx_vtab)->release(__pyx_v_dest_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 393, __pyx_L1_error) + __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_dest_buffer->__pyx_vtab)->release(__pyx_v_dest_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 394, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/blosc.pyx":392 + /* "numcodecs/blosc.pyx":393 * # release buffers * source_buffer.release() * if dest_buffer is not None: # <<<<<<<<<<<<<< @@ -4633,18 +4434,18 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_t_8 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename; { - /* "numcodecs/blosc.pyx":391 + /* "numcodecs/blosc.pyx":392 * * # release buffers * source_buffer.release() # <<<<<<<<<<<<<< * if dest_buffer is not None: * dest_buffer.release() */ - __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 391, __pyx_L17_error) + __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 392, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/blosc.pyx":392 + /* "numcodecs/blosc.pyx":393 * # release buffers * source_buffer.release() * if dest_buffer is not None: # <<<<<<<<<<<<<< @@ -4655,18 +4456,18 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_t_5 = (__pyx_t_4 != 0); if (__pyx_t_5) { - /* "numcodecs/blosc.pyx":393 + /* "numcodecs/blosc.pyx":394 * source_buffer.release() * if dest_buffer is not None: * dest_buffer.release() # <<<<<<<<<<<<<< * * # handle errors */ - __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_dest_buffer->__pyx_vtab)->release(__pyx_v_dest_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 393, __pyx_L17_error) + __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_dest_buffer->__pyx_vtab)->release(__pyx_v_dest_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 394, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/blosc.pyx":392 + /* "numcodecs/blosc.pyx":393 * # release buffers * source_buffer.release() * if dest_buffer is not None: # <<<<<<<<<<<<<< @@ -4704,7 +4505,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_L6:; } - /* "numcodecs/blosc.pyx":396 + /* "numcodecs/blosc.pyx":397 * * # handle errors * if ret <= 0: # <<<<<<<<<<<<<< @@ -4714,26 +4515,26 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_t_5 = ((__pyx_v_ret <= 0) != 0); if (unlikely(__pyx_t_5)) { - /* "numcodecs/blosc.pyx":397 + /* "numcodecs/blosc.pyx":398 * # handle errors * if ret <= 0: * raise RuntimeError('error during blosc decompression: %d' % ret) # <<<<<<<<<<<<<< * * return dest */ - __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_ret); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 397, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_ret); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 398, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_error_during_blosc_decompression, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 397, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_error_during_blosc_decompression, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 398, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 397, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 398, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_7, 0, 0, 0); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(0, 397, __pyx_L1_error) + __PYX_ERR(0, 398, __pyx_L1_error) - /* "numcodecs/blosc.pyx":396 + /* "numcodecs/blosc.pyx":397 * * # handle errors * if ret <= 0: # <<<<<<<<<<<<<< @@ -4742,7 +4543,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject */ } - /* "numcodecs/blosc.pyx":399 + /* "numcodecs/blosc.pyx":400 * raise RuntimeError('error during blosc decompression: %d' % ret) * * return dest # <<<<<<<<<<<<<< @@ -4754,7 +4555,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_r = __pyx_v_dest; goto __pyx_L0; - /* "numcodecs/blosc.pyx":329 + /* "numcodecs/blosc.pyx":330 * * * def decompress(source, dest=None): # <<<<<<<<<<<<<< @@ -4778,7 +4579,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject return __pyx_r; } -/* "numcodecs/blosc.pyx":407 +/* "numcodecs/blosc.pyx":408 * * * def _get_use_threads(): # <<<<<<<<<<<<<< @@ -4814,16 +4615,16 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("_get_use_threads", 0); - /* "numcodecs/blosc.pyx":409 + /* "numcodecs/blosc.pyx":410 * def _get_use_threads(): * global use_threads * proc = multiprocessing.current_process() # <<<<<<<<<<<<<< * * # check if locks are available, and if not no threads */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_multiprocessing); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 409, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_multiprocessing); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_current_process); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 409, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_current_process); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; @@ -4838,27 +4639,27 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO } __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 409, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_proc = __pyx_t_1; __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":412 + /* "numcodecs/blosc.pyx":413 * * # check if locks are available, and if not no threads * if not mutex: # <<<<<<<<<<<<<< * return False * */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_mutex); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 412, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_mutex); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 413, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 412, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 413, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = ((!__pyx_t_4) != 0); if (__pyx_t_5) { - /* "numcodecs/blosc.pyx":413 + /* "numcodecs/blosc.pyx":414 * # check if locks are available, and if not no threads * if not mutex: * return False # <<<<<<<<<<<<<< @@ -4870,7 +4671,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO __pyx_r = Py_False; goto __pyx_L0; - /* "numcodecs/blosc.pyx":412 + /* "numcodecs/blosc.pyx":413 * * # check if locks are available, and if not no threads * if not mutex: # <<<<<<<<<<<<<< @@ -4879,25 +4680,25 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO */ } - /* "numcodecs/blosc.pyx":416 + /* "numcodecs/blosc.pyx":417 * * # check for fork * if proc.pid != _importer_pid: # <<<<<<<<<<<<<< * # If this module has been imported in the parent process, and the current process * # is a fork, attempting to use blosc in multi-threaded mode will cause a */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_proc, __pyx_n_s_pid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 416, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_proc, __pyx_n_s_pid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 417, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_importer_pid); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 416, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_importer_pid); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 417, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 416, __pyx_L1_error) + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 417, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 416, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 417, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_5) { - /* "numcodecs/blosc.pyx":420 + /* "numcodecs/blosc.pyx":421 * # is a fork, attempting to use blosc in multi-threaded mode will cause a * # program hang, so we force use of blosc ctx functions, i.e., no threads. * return False # <<<<<<<<<<<<<< @@ -4909,7 +4710,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO __pyx_r = Py_False; goto __pyx_L0; - /* "numcodecs/blosc.pyx":416 + /* "numcodecs/blosc.pyx":417 * * # check for fork * if proc.pid != _importer_pid: # <<<<<<<<<<<<<< @@ -4918,25 +4719,25 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO */ } - /* "numcodecs/blosc.pyx":422 + /* "numcodecs/blosc.pyx":423 * return False * * if use_threads in [True, False]: # <<<<<<<<<<<<<< * # user has manually overridden the default behaviour * _use_threads = use_threads */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_use_threads); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 422, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_use_threads); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 423, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, Py_True, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 422, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 422, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, Py_True, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 423, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 423, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_4) { } else { __pyx_t_5 = __pyx_t_4; goto __pyx_L6_bool_binop_done; } - __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, Py_False, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 422, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 422, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, Py_False, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 423, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 423, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __pyx_t_4; __pyx_L6_bool_binop_done:; @@ -4944,19 +4745,19 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO __pyx_t_4 = (__pyx_t_5 != 0); if (__pyx_t_4) { - /* "numcodecs/blosc.pyx":424 + /* "numcodecs/blosc.pyx":425 * if use_threads in [True, False]: * # user has manually overridden the default behaviour * _use_threads = use_threads # <<<<<<<<<<<<<< * * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_use_threads); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 424, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_use_threads); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 425, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v__use_threads = __pyx_t_2; __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":422 + /* "numcodecs/blosc.pyx":423 * return False * * if use_threads in [True, False]: # <<<<<<<<<<<<<< @@ -4966,7 +4767,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO goto __pyx_L5; } - /* "numcodecs/blosc.pyx":433 + /* "numcodecs/blosc.pyx":434 * # program or multi-process program * * if proc.name != 'MainProcess': # <<<<<<<<<<<<<< @@ -4974,13 +4775,13 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO * elif hasattr(threading, 'main_thread'): */ /*else*/ { - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_proc, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 433, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_proc, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 434, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_MainProcess, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 433, __pyx_L1_error) + __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_MainProcess, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 434, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_4) { - /* "numcodecs/blosc.pyx":434 + /* "numcodecs/blosc.pyx":435 * * if proc.name != 'MainProcess': * _use_threads = False # <<<<<<<<<<<<<< @@ -4990,7 +4791,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO __Pyx_INCREF(Py_False); __pyx_v__use_threads = Py_False; - /* "numcodecs/blosc.pyx":433 + /* "numcodecs/blosc.pyx":434 * # program or multi-process program * * if proc.name != 'MainProcess': # <<<<<<<<<<<<<< @@ -5000,30 +4801,30 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO goto __pyx_L8; } - /* "numcodecs/blosc.pyx":435 + /* "numcodecs/blosc.pyx":436 * if proc.name != 'MainProcess': * _use_threads = False * elif hasattr(threading, 'main_thread'): # <<<<<<<<<<<<<< * _use_threads = (threading.main_thread() == threading.current_thread()) * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_threading); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 435, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_threading); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 436, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_HasAttr(__pyx_t_2, __pyx_n_s_main_thread); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 435, __pyx_L1_error) + __pyx_t_4 = __Pyx_HasAttr(__pyx_t_2, __pyx_n_s_main_thread); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 436, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_5 = (__pyx_t_4 != 0); if (__pyx_t_5) { - /* "numcodecs/blosc.pyx":436 + /* "numcodecs/blosc.pyx":437 * _use_threads = False * elif hasattr(threading, 'main_thread'): * _use_threads = (threading.main_thread() == threading.current_thread()) # <<<<<<<<<<<<<< * else: * _use_threads = threading.current_thread().name == 'MainThread' */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_threading); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 436, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_threading); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 437, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_main_thread); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 436, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_main_thread); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 437, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; @@ -5038,12 +4839,12 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO } __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 436, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 437, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_threading); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 436, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_threading); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 437, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_current_thread); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 436, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_current_thread); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 437, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; @@ -5058,16 +4859,16 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_6); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 436, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 437, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 436, __pyx_L1_error) + __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 437, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v__use_threads = __pyx_t_6; __pyx_t_6 = 0; - /* "numcodecs/blosc.pyx":435 + /* "numcodecs/blosc.pyx":436 * if proc.name != 'MainProcess': * _use_threads = False * elif hasattr(threading, 'main_thread'): # <<<<<<<<<<<<<< @@ -5077,7 +4878,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO goto __pyx_L8; } - /* "numcodecs/blosc.pyx":438 + /* "numcodecs/blosc.pyx":439 * _use_threads = (threading.main_thread() == threading.current_thread()) * else: * _use_threads = threading.current_thread().name == 'MainThread' # <<<<<<<<<<<<<< @@ -5085,9 +4886,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO * return _use_threads */ /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_threading); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 438, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_threading); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_current_thread); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 438, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_current_thread); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 439, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; @@ -5102,13 +4903,13 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO } __pyx_t_6 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 438, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 439, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 438, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 439, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_n_s_MainThread, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 438, __pyx_L1_error) + __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_n_s_MainThread, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 439, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v__use_threads = __pyx_t_6; __pyx_t_6 = 0; @@ -5117,7 +4918,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO } __pyx_L5:; - /* "numcodecs/blosc.pyx":440 + /* "numcodecs/blosc.pyx":441 * _use_threads = threading.current_thread().name == 'MainThread' * * return _use_threads # <<<<<<<<<<<<<< @@ -5129,7 +4930,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO __pyx_r = __pyx_v__use_threads; goto __pyx_L0; - /* "numcodecs/blosc.pyx":407 + /* "numcodecs/blosc.pyx":408 * * * def _get_use_threads(): # <<<<<<<<<<<<<< @@ -5153,8 +4954,8 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO return __pyx_r; } -/* "numcodecs/blosc.pyx":476 - * AUTOSHUFFLE = AUTOSHUFFLE +/* "numcodecs/blosc.pyx":478 + * max_buffer_size = 2**31 - 1 * * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): # <<<<<<<<<<<<<< * self.cname = cname @@ -5168,7 +4969,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_26__defaults__(CYTHON_UNUSED PyObjec PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("__defaults__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 476, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 478, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject*)__pyx_n_s_lz4)); __Pyx_GIVEREF(((PyObject*)__pyx_n_s_lz4)); @@ -5182,7 +4983,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_26__defaults__(CYTHON_UNUSED PyObjec __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_blocksize); __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_blocksize); PyTuple_SET_ITEM(__pyx_t_1, 3, __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_blocksize); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 476, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 478, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); @@ -5275,7 +5076,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_1__init__(PyObject *__pyx_sel } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 476, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 478, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -5300,7 +5101,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_1__init__(PyObject *__pyx_sel } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 476, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 478, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.blosc.Blosc.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -5323,37 +5124,37 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc___init__(CYTHON_UNUSED PyObje PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("__init__", 0); - /* "numcodecs/blosc.pyx":477 + /* "numcodecs/blosc.pyx":479 * * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): * self.cname = cname # <<<<<<<<<<<<<< * if isinstance(cname, text_type): * self._cname_bytes = cname.encode('ascii') */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cname, __pyx_v_cname) < 0) __PYX_ERR(0, 477, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cname, __pyx_v_cname) < 0) __PYX_ERR(0, 479, __pyx_L1_error) - /* "numcodecs/blosc.pyx":478 + /* "numcodecs/blosc.pyx":480 * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): * self.cname = cname * if isinstance(cname, text_type): # <<<<<<<<<<<<<< * self._cname_bytes = cname.encode('ascii') * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_text_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 478, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_text_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_IsInstance(__pyx_v_cname, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 478, __pyx_L1_error) + __pyx_t_2 = PyObject_IsInstance(__pyx_v_cname, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { - /* "numcodecs/blosc.pyx":479 + /* "numcodecs/blosc.pyx":481 * self.cname = cname * if isinstance(cname, text_type): * self._cname_bytes = cname.encode('ascii') # <<<<<<<<<<<<<< * else: * self._cname_bytes = cname */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_cname, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 479, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_cname, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 481, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { @@ -5367,13 +5168,13 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc___init__(CYTHON_UNUSED PyObje } __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_n_s_ascii) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_n_s_ascii); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 479, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 481, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cname_bytes, __pyx_t_1) < 0) __PYX_ERR(0, 479, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cname_bytes, __pyx_t_1) < 0) __PYX_ERR(0, 481, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":478 + /* "numcodecs/blosc.pyx":480 * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): * self.cname = cname * if isinstance(cname, text_type): # <<<<<<<<<<<<<< @@ -5383,7 +5184,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc___init__(CYTHON_UNUSED PyObje goto __pyx_L3; } - /* "numcodecs/blosc.pyx":481 + /* "numcodecs/blosc.pyx":483 * self._cname_bytes = cname.encode('ascii') * else: * self._cname_bytes = cname # <<<<<<<<<<<<<< @@ -5391,39 +5192,39 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc___init__(CYTHON_UNUSED PyObje * self.shuffle = shuffle */ /*else*/ { - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cname_bytes, __pyx_v_cname) < 0) __PYX_ERR(0, 481, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cname_bytes, __pyx_v_cname) < 0) __PYX_ERR(0, 483, __pyx_L1_error) } __pyx_L3:; - /* "numcodecs/blosc.pyx":482 + /* "numcodecs/blosc.pyx":484 * else: * self._cname_bytes = cname * self.clevel = clevel # <<<<<<<<<<<<<< * self.shuffle = shuffle * self.blocksize = blocksize */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_clevel, __pyx_v_clevel) < 0) __PYX_ERR(0, 482, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_clevel, __pyx_v_clevel) < 0) __PYX_ERR(0, 484, __pyx_L1_error) - /* "numcodecs/blosc.pyx":483 + /* "numcodecs/blosc.pyx":485 * self._cname_bytes = cname * self.clevel = clevel * self.shuffle = shuffle # <<<<<<<<<<<<<< * self.blocksize = blocksize * */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_shuffle, __pyx_v_shuffle) < 0) __PYX_ERR(0, 483, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_shuffle, __pyx_v_shuffle) < 0) __PYX_ERR(0, 485, __pyx_L1_error) - /* "numcodecs/blosc.pyx":484 + /* "numcodecs/blosc.pyx":486 * self.clevel = clevel * self.shuffle = shuffle * self.blocksize = blocksize # <<<<<<<<<<<<<< * * def encode(self, buf): */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_blocksize, __pyx_v_blocksize) < 0) __PYX_ERR(0, 484, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_blocksize, __pyx_v_blocksize) < 0) __PYX_ERR(0, 486, __pyx_L1_error) - /* "numcodecs/blosc.pyx":476 - * AUTOSHUFFLE = AUTOSHUFFLE + /* "numcodecs/blosc.pyx":478 + * max_buffer_size = 2**31 - 1 * * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): # <<<<<<<<<<<<<< * self.cname = cname @@ -5445,11 +5246,11 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc___init__(CYTHON_UNUSED PyObje return __pyx_r; } -/* "numcodecs/blosc.pyx":486 +/* "numcodecs/blosc.pyx":488 * self.blocksize = blocksize * * def encode(self, buf): # <<<<<<<<<<<<<< - * self._check_buffer_size(buf) + * buf = ensure_ndarray(buf, self.max_buffer_size) * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) */ @@ -5486,11 +5287,11 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_3encode(PyObject *__pyx_self, case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buf)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, 1); __PYX_ERR(0, 486, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, 1); __PYX_ERR(0, 488, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode") < 0)) __PYX_ERR(0, 486, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode") < 0)) __PYX_ERR(0, 488, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -5503,7 +5304,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_3encode(PyObject *__pyx_self, } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 486, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 488, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.blosc.Blosc.encode", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -5523,115 +5324,151 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_2encode(CYTHON_UNUSED PyObjec PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; + int __pyx_t_5; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; + PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; __Pyx_RefNannySetupContext("encode", 0); + __Pyx_INCREF(__pyx_v_buf); - /* "numcodecs/blosc.pyx":487 + /* "numcodecs/blosc.pyx":489 * * def encode(self, buf): - * self._check_buffer_size(buf) # <<<<<<<<<<<<<< + * buf = ensure_ndarray(buf, self.max_buffer_size) # <<<<<<<<<<<<<< * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) * */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_check_buffer_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 487, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ensure_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 489, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_buffer_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 489, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_5 = 1; } } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_buf) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_buf); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 487, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_buf, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 489, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_buf, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 489, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else + #endif + { + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 489, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__pyx_t_4) { + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; + } + __Pyx_INCREF(__pyx_v_buf); + __Pyx_GIVEREF(__pyx_v_buf); + PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_buf); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 489, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_buf, __pyx_t_1); + __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":488 + /* "numcodecs/blosc.pyx":490 * def encode(self, buf): - * self._check_buffer_size(buf) + * buf = ensure_ndarray(buf, self.max_buffer_size) * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) # <<<<<<<<<<<<<< * * def decode(self, buf, out=None): */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_compress); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 488, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_compress); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 490, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cname_bytes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 488, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cname_bytes); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 490, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_clevel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 490, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_clevel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 488, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_shuffle); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 490, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_shuffle); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 488, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_blocksize); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 488, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - __pyx_t_8 = 0; + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_blocksize); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 490, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = NULL; + __pyx_t_5 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_7)) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_8 = 1; + __pyx_t_5 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[6] = {__pyx_t_7, __pyx_v_buf, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 488, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + PyObject *__pyx_temp[6] = {__pyx_t_8, __pyx_v_buf, __pyx_t_6, __pyx_t_3, __pyx_t_4, __pyx_t_7}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[6] = {__pyx_t_7, __pyx_v_buf, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 488, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + PyObject *__pyx_temp[6] = {__pyx_t_8, __pyx_v_buf, __pyx_t_6, __pyx_t_3, __pyx_t_4, __pyx_t_7}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else #endif { - __pyx_t_9 = PyTuple_New(5+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 488, __pyx_L1_error) + __pyx_t_9 = PyTuple_New(5+__pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 490, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - if (__pyx_t_7) { - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; + if (__pyx_t_8) { + __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL; } __Pyx_INCREF(__pyx_v_buf); __Pyx_GIVEREF(__pyx_v_buf); - PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_buf); + PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_5, __pyx_v_buf); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_5, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_5, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_9, 4+__pyx_t_8, __pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_5, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_9, 4+__pyx_t_5, __pyx_t_7); + __pyx_t_6 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_6 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 488, __pyx_L1_error) + __pyx_t_7 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } @@ -5640,11 +5477,11 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_2encode(CYTHON_UNUSED PyObjec __pyx_t_1 = 0; goto __pyx_L0; - /* "numcodecs/blosc.pyx":486 + /* "numcodecs/blosc.pyx":488 * self.blocksize = blocksize * * def encode(self, buf): # <<<<<<<<<<<<<< - * self._check_buffer_size(buf) + * buf = ensure_ndarray(buf, self.max_buffer_size) * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) */ @@ -5654,23 +5491,24 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_2encode(CYTHON_UNUSED PyObjec __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("numcodecs.blosc.Blosc.encode", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_buf); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "numcodecs/blosc.pyx":490 +/* "numcodecs/blosc.pyx":492 * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) * * def decode(self, buf, out=None): # <<<<<<<<<<<<<< - * self._check_buffer_size(buf) + * buf = ensure_ndarray(buf, self.max_buffer_size) * return decompress(buf, out) */ @@ -5711,7 +5549,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_5decode(PyObject *__pyx_self, case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buf)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, 1); __PYX_ERR(0, 490, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, 1); __PYX_ERR(0, 492, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -5721,7 +5559,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_5decode(PyObject *__pyx_self, } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode") < 0)) __PYX_ERR(0, 490, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode") < 0)) __PYX_ERR(0, 492, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -5739,7 +5577,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_5decode(PyObject *__pyx_self, } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 490, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 492, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.blosc.Blosc.decode", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -5758,100 +5596,137 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_4decode(CYTHON_UNUSED PyObjec PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("decode", 0); + __Pyx_INCREF(__pyx_v_buf); - /* "numcodecs/blosc.pyx":491 + /* "numcodecs/blosc.pyx":493 * * def decode(self, buf, out=None): - * self._check_buffer_size(buf) # <<<<<<<<<<<<<< + * buf = ensure_ndarray(buf, self.max_buffer_size) # <<<<<<<<<<<<<< * return decompress(buf, out) * */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_check_buffer_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 491, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ensure_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 493, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_buffer_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 493, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_5 = 1; } } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_buf) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_buf); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 491, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "numcodecs/blosc.pyx":492 - * def decode(self, buf, out=None): - * self._check_buffer_size(buf) - * return decompress(buf, out) # <<<<<<<<<<<<<< - * - * def __repr__(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_decompress); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - __pyx_t_4 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_buf, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 493, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_buf, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 493, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else + #endif + { + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 493, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__pyx_t_4) { + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; + } + __Pyx_INCREF(__pyx_v_buf); + __Pyx_GIVEREF(__pyx_v_buf); + PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_buf); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 493, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_buf, __pyx_t_1); + __pyx_t_1 = 0; + + /* "numcodecs/blosc.pyx":494 + * def decode(self, buf, out=None): + * buf = ensure_ndarray(buf, self.max_buffer_size) + * return decompress(buf, out) # <<<<<<<<<<<<<< + * + * def __repr__(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_decompress); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 494, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_4 = 1; + __pyx_t_5 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_buf, __pyx_v_out}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 492, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_buf, __pyx_v_out}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 494, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_buf, __pyx_v_out}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 492, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_buf, __pyx_v_out}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 494, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif { - __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__pyx_t_3) { - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; + __pyx_t_3 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 494, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__pyx_t_6) { + __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __pyx_t_6 = NULL; } __Pyx_INCREF(__pyx_v_buf); __Pyx_GIVEREF(__pyx_v_buf); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_buf); + PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_5, __pyx_v_buf); __Pyx_INCREF(__pyx_v_out); __Pyx_GIVEREF(__pyx_v_out); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_out); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 492, __pyx_L1_error) + PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_5, __pyx_v_out); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 494, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "numcodecs/blosc.pyx":490 + /* "numcodecs/blosc.pyx":492 * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) * * def decode(self, buf, out=None): # <<<<<<<<<<<<<< - * self._check_buffer_size(buf) + * buf = ensure_ndarray(buf, self.max_buffer_size) * return decompress(buf, out) */ @@ -5860,16 +5735,18 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_4decode(CYTHON_UNUSED PyObjec __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("numcodecs.blosc.Blosc.decode", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_buf); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "numcodecs/blosc.pyx":494 +/* "numcodecs/blosc.pyx":496 * return decompress(buf, out) * * def __repr__(self): # <<<<<<<<<<<<<< @@ -5904,72 +5781,72 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_6__repr__(CYTHON_UNUSED PyObj PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("__repr__", 0); - /* "numcodecs/blosc.pyx":496 + /* "numcodecs/blosc.pyx":498 * def __repr__(self): * r = '%s(cname=%r, clevel=%r, shuffle=%s, blocksize=%s)' % \ * (type(self).__name__, # <<<<<<<<<<<<<< * self.cname, * self.clevel, */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_self)), __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 496, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_self)), __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 498, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - /* "numcodecs/blosc.pyx":497 + /* "numcodecs/blosc.pyx":499 * r = '%s(cname=%r, clevel=%r, shuffle=%s, blocksize=%s)' % \ * (type(self).__name__, * self.cname, # <<<<<<<<<<<<<< * self.clevel, * _shuffle_repr[self.shuffle + 1], */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cname); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 497, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cname); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 499, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - /* "numcodecs/blosc.pyx":498 + /* "numcodecs/blosc.pyx":500 * (type(self).__name__, * self.cname, * self.clevel, # <<<<<<<<<<<<<< * _shuffle_repr[self.shuffle + 1], * self.blocksize) */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_clevel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 498, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_clevel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 500, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - /* "numcodecs/blosc.pyx":499 + /* "numcodecs/blosc.pyx":501 * self.cname, * self.clevel, * _shuffle_repr[self.shuffle + 1], # <<<<<<<<<<<<<< * self.blocksize) * return r */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_shuffle_repr); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 499, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_shuffle_repr); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 501, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_shuffle); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 499, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_shuffle); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 501, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_5, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 499, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_5, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 501, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 499, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 501, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "numcodecs/blosc.pyx":500 + /* "numcodecs/blosc.pyx":502 * self.clevel, * _shuffle_repr[self.shuffle + 1], * self.blocksize) # <<<<<<<<<<<<<< * return r */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_blocksize); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 500, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_blocksize); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - /* "numcodecs/blosc.pyx":496 + /* "numcodecs/blosc.pyx":498 * def __repr__(self): * r = '%s(cname=%r, clevel=%r, shuffle=%s, blocksize=%s)' % \ * (type(self).__name__, # <<<<<<<<<<<<<< * self.cname, * self.clevel, */ - __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 496, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 498, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); @@ -5987,20 +5864,20 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_6__repr__(CYTHON_UNUSED PyObj __pyx_t_5 = 0; __pyx_t_6 = 0; - /* "numcodecs/blosc.pyx":495 + /* "numcodecs/blosc.pyx":497 * * def __repr__(self): * r = '%s(cname=%r, clevel=%r, shuffle=%s, blocksize=%s)' % \ # <<<<<<<<<<<<<< * (type(self).__name__, * self.cname, */ - __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_s_cname_r_clevel_r_shuffle_s_bl, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 495, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_s_cname_r_clevel_r_shuffle_s_bl, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 497, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_r = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0; - /* "numcodecs/blosc.pyx":501 + /* "numcodecs/blosc.pyx":503 * _shuffle_repr[self.shuffle + 1], * self.blocksize) * return r # <<<<<<<<<<<<<< @@ -6010,7 +5887,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_6__repr__(CYTHON_UNUSED PyObj __pyx_r = __pyx_v_r; goto __pyx_L0; - /* "numcodecs/blosc.pyx":494 + /* "numcodecs/blosc.pyx":496 * return decompress(buf, out) * * def __repr__(self): # <<<<<<<<<<<<<< @@ -6035,642 +5912,6 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_6__repr__(CYTHON_UNUSED PyObj return __pyx_r; } -/* "array.pxd":93 - * __data_union data - * - * def __getbuffer__(self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< - * # This implementation of getbuffer is geared towards Cython - * # requirements, and does not yet fulfill the PEP. - */ - -/* Python wrapper */ -static CYTHON_UNUSED int __pyx_pw_7cpython_5array_5array_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_pw_7cpython_5array_5array_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); - __pyx_r = __pyx_pf_7cpython_5array_5array___getbuffer__(((arrayobject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info, CYTHON_UNUSED int __pyx_v_flags) { - PyObject *__pyx_v_item_count = NULL; - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - char *__pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - int __pyx_t_6; - if (__pyx_v_info == NULL) { - PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); - return -1; - } - __Pyx_RefNannySetupContext("__getbuffer__", 0); - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); - - /* "array.pxd":98 - * # In particular strided access is always provided regardless - * # of flags - * item_count = Py_SIZE(self) # <<<<<<<<<<<<<< - * - * info.suboffsets = NULL - */ - __pyx_t_1 = PyInt_FromSsize_t(Py_SIZE(((PyObject *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_item_count = __pyx_t_1; - __pyx_t_1 = 0; - - /* "array.pxd":100 - * item_count = Py_SIZE(self) - * - * info.suboffsets = NULL # <<<<<<<<<<<<<< - * info.buf = self.data.as_chars - * info.readonly = 0 - */ - __pyx_v_info->suboffsets = NULL; - - /* "array.pxd":101 - * - * info.suboffsets = NULL - * info.buf = self.data.as_chars # <<<<<<<<<<<<<< - * info.readonly = 0 - * info.ndim = 1 - */ - __pyx_t_2 = __pyx_v_self->data.as_chars; - __pyx_v_info->buf = __pyx_t_2; - - /* "array.pxd":102 - * info.suboffsets = NULL - * info.buf = self.data.as_chars - * info.readonly = 0 # <<<<<<<<<<<<<< - * info.ndim = 1 - * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float) - */ - __pyx_v_info->readonly = 0; - - /* "array.pxd":103 - * info.buf = self.data.as_chars - * info.readonly = 0 - * info.ndim = 1 # <<<<<<<<<<<<<< - * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float) - * info.len = info.itemsize * item_count - */ - __pyx_v_info->ndim = 1; - - /* "array.pxd":104 - * info.readonly = 0 - * info.ndim = 1 - * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float) # <<<<<<<<<<<<<< - * info.len = info.itemsize * item_count - * - */ - __pyx_t_3 = __pyx_v_self->ob_descr->itemsize; - __pyx_v_info->itemsize = __pyx_t_3; - - /* "array.pxd":105 - * info.ndim = 1 - * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float) - * info.len = info.itemsize * item_count # <<<<<<<<<<<<<< - * - * info.shape = PyObject_Malloc(sizeof(Py_ssize_t) + 2) - */ - __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_info->itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 105, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_v_item_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 105, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 105, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_info->len = __pyx_t_5; - - /* "array.pxd":107 - * info.len = info.itemsize * item_count - * - * info.shape = PyObject_Malloc(sizeof(Py_ssize_t) + 2) # <<<<<<<<<<<<<< - * if not info.shape: - * raise MemoryError() - */ - __pyx_v_info->shape = ((Py_ssize_t *)PyObject_Malloc(((sizeof(Py_ssize_t)) + 2))); - - /* "array.pxd":108 - * - * info.shape = PyObject_Malloc(sizeof(Py_ssize_t) + 2) - * if not info.shape: # <<<<<<<<<<<<<< - * raise MemoryError() - * info.shape[0] = item_count # constant regardless of resizing - */ - __pyx_t_6 = ((!(__pyx_v_info->shape != 0)) != 0); - if (unlikely(__pyx_t_6)) { - - /* "array.pxd":109 - * info.shape = PyObject_Malloc(sizeof(Py_ssize_t) + 2) - * if not info.shape: - * raise MemoryError() # <<<<<<<<<<<<<< - * info.shape[0] = item_count # constant regardless of resizing - * info.strides = &info.itemsize - */ - PyErr_NoMemory(); __PYX_ERR(1, 109, __pyx_L1_error) - - /* "array.pxd":108 - * - * info.shape = PyObject_Malloc(sizeof(Py_ssize_t) + 2) - * if not info.shape: # <<<<<<<<<<<<<< - * raise MemoryError() - * info.shape[0] = item_count # constant regardless of resizing - */ - } - - /* "array.pxd":110 - * if not info.shape: - * raise MemoryError() - * info.shape[0] = item_count # constant regardless of resizing # <<<<<<<<<<<<<< - * info.strides = &info.itemsize - * - */ - __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_item_count); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 110, __pyx_L1_error) - (__pyx_v_info->shape[0]) = __pyx_t_5; - - /* "array.pxd":111 - * raise MemoryError() - * info.shape[0] = item_count # constant regardless of resizing - * info.strides = &info.itemsize # <<<<<<<<<<<<<< - * - * info.format = (info.shape + 1) - */ - __pyx_v_info->strides = (&__pyx_v_info->itemsize); - - /* "array.pxd":113 - * info.strides = &info.itemsize - * - * info.format = (info.shape + 1) # <<<<<<<<<<<<<< - * info.format[0] = self.ob_descr.typecode - * info.format[1] = 0 - */ - __pyx_v_info->format = ((char *)(__pyx_v_info->shape + 1)); - - /* "array.pxd":114 - * - * info.format = (info.shape + 1) - * info.format[0] = self.ob_descr.typecode # <<<<<<<<<<<<<< - * info.format[1] = 0 - * info.obj = self - */ - __pyx_t_3 = __pyx_v_self->ob_descr->typecode; - (__pyx_v_info->format[0]) = __pyx_t_3; - - /* "array.pxd":115 - * info.format = (info.shape + 1) - * info.format[0] = self.ob_descr.typecode - * info.format[1] = 0 # <<<<<<<<<<<<<< - * info.obj = self - * - */ - (__pyx_v_info->format[1]) = 0; - - /* "array.pxd":116 - * info.format[0] = self.ob_descr.typecode - * info.format[1] = 0 - * info.obj = self # <<<<<<<<<<<<<< - * - * def __releasebuffer__(self, Py_buffer* info): - */ - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = ((PyObject *)__pyx_v_self); - - /* "array.pxd":93 - * __data_union data - * - * def __getbuffer__(self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< - * # This implementation of getbuffer is geared towards Cython - * # requirements, and does not yet fulfill the PEP. - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("cpython.array.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - if (__pyx_v_info->obj != NULL) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; - } - goto __pyx_L2; - __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; - } - __pyx_L2:; - __Pyx_XDECREF(__pyx_v_item_count); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "array.pxd":118 - * info.obj = self - * - * def __releasebuffer__(self, Py_buffer* info): # <<<<<<<<<<<<<< - * PyObject_Free(info.shape) - * - */ - -/* Python wrapper */ -static CYTHON_UNUSED void __pyx_pw_7cpython_5array_5array_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static CYTHON_UNUSED void __pyx_pw_7cpython_5array_5array_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); - __pyx_pf_7cpython_5array_5array_2__releasebuffer__(((arrayobject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_pf_7cpython_5array_5array_2__releasebuffer__(CYTHON_UNUSED arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__releasebuffer__", 0); - - /* "array.pxd":119 - * - * def __releasebuffer__(self, Py_buffer* info): - * PyObject_Free(info.shape) # <<<<<<<<<<<<<< - * - * array newarrayobject(PyTypeObject* type, Py_ssize_t size, arraydescr *descr) - */ - PyObject_Free(__pyx_v_info->shape); - - /* "array.pxd":118 - * info.obj = self - * - * def __releasebuffer__(self, Py_buffer* info): # <<<<<<<<<<<<<< - * PyObject_Free(info.shape) - * - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "array.pxd":130 - * - * - * cdef inline array clone(array template, Py_ssize_t length, bint zero): # <<<<<<<<<<<<<< - * """ fast creation of a new array, given a template array. - * type will be same as template. - */ - -static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_clone(arrayobject *__pyx_v_template, Py_ssize_t __pyx_v_length, int __pyx_v_zero) { - arrayobject *__pyx_v_op = NULL; - arrayobject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - __Pyx_RefNannySetupContext("clone", 0); - - /* "array.pxd":134 - * type will be same as template. - * if zero is true, new array will be initialized with zeroes.""" - * op = newarrayobject(Py_TYPE(template), length, template.ob_descr) # <<<<<<<<<<<<<< - * if zero and op is not None: - * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize) - */ - __pyx_t_1 = ((PyObject *)newarrayobject(Py_TYPE(((PyObject *)__pyx_v_template)), __pyx_v_length, __pyx_v_template->ob_descr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 134, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_op = ((arrayobject *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "array.pxd":135 - * if zero is true, new array will be initialized with zeroes.""" - * op = newarrayobject(Py_TYPE(template), length, template.ob_descr) - * if zero and op is not None: # <<<<<<<<<<<<<< - * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize) - * return op - */ - __pyx_t_3 = (__pyx_v_zero != 0); - if (__pyx_t_3) { - } else { - __pyx_t_2 = __pyx_t_3; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_3 = (((PyObject *)__pyx_v_op) != Py_None); - __pyx_t_4 = (__pyx_t_3 != 0); - __pyx_t_2 = __pyx_t_4; - __pyx_L4_bool_binop_done:; - if (__pyx_t_2) { - - /* "array.pxd":136 - * op = newarrayobject(Py_TYPE(template), length, template.ob_descr) - * if zero and op is not None: - * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize) # <<<<<<<<<<<<<< - * return op - * - */ - (void)(memset(__pyx_v_op->data.as_chars, 0, (__pyx_v_length * __pyx_v_op->ob_descr->itemsize))); - - /* "array.pxd":135 - * if zero is true, new array will be initialized with zeroes.""" - * op = newarrayobject(Py_TYPE(template), length, template.ob_descr) - * if zero and op is not None: # <<<<<<<<<<<<<< - * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize) - * return op - */ - } - - /* "array.pxd":137 - * if zero and op is not None: - * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize) - * return op # <<<<<<<<<<<<<< - * - * cdef inline array copy(array self): - */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __Pyx_INCREF(((PyObject *)__pyx_v_op)); - __pyx_r = __pyx_v_op; - goto __pyx_L0; - - /* "array.pxd":130 - * - * - * cdef inline array clone(array template, Py_ssize_t length, bint zero): # <<<<<<<<<<<<<< - * """ fast creation of a new array, given a template array. - * type will be same as template. - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cpython.array.clone", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_op); - __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "array.pxd":139 - * return op - * - * cdef inline array copy(array self): # <<<<<<<<<<<<<< - * """ make a copy of an array. """ - * op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr) - */ - -static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_copy(arrayobject *__pyx_v_self) { - arrayobject *__pyx_v_op = NULL; - arrayobject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("copy", 0); - - /* "array.pxd":141 - * cdef inline array copy(array self): - * """ make a copy of an array. """ - * op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr) # <<<<<<<<<<<<<< - * memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize) - * return op - */ - __pyx_t_1 = ((PyObject *)newarrayobject(Py_TYPE(((PyObject *)__pyx_v_self)), Py_SIZE(((PyObject *)__pyx_v_self)), __pyx_v_self->ob_descr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 141, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_op = ((arrayobject *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "array.pxd":142 - * """ make a copy of an array. """ - * op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr) - * memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize) # <<<<<<<<<<<<<< - * return op - * - */ - (void)(memcpy(__pyx_v_op->data.as_chars, __pyx_v_self->data.as_chars, (Py_SIZE(((PyObject *)__pyx_v_op)) * __pyx_v_op->ob_descr->itemsize))); - - /* "array.pxd":143 - * op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr) - * memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize) - * return op # <<<<<<<<<<<<<< - * - * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1: - */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __Pyx_INCREF(((PyObject *)__pyx_v_op)); - __pyx_r = __pyx_v_op; - goto __pyx_L0; - - /* "array.pxd":139 - * return op - * - * cdef inline array copy(array self): # <<<<<<<<<<<<<< - * """ make a copy of an array. """ - * op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cpython.array.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_op); - __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "array.pxd":145 - * return op - * - * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1: # <<<<<<<<<<<<<< - * """ efficient appending of new stuff of same type - * (e.g. of same array type) - */ - -static CYTHON_INLINE int __pyx_f_7cpython_5array_extend_buffer(arrayobject *__pyx_v_self, char *__pyx_v_stuff, Py_ssize_t __pyx_v_n) { - Py_ssize_t __pyx_v_itemsize; - Py_ssize_t __pyx_v_origsize; - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("extend_buffer", 0); - - /* "array.pxd":149 - * (e.g. of same array type) - * n: number of elements (not number of bytes!) """ - * cdef Py_ssize_t itemsize = self.ob_descr.itemsize # <<<<<<<<<<<<<< - * cdef Py_ssize_t origsize = Py_SIZE(self) - * resize_smart(self, origsize + n) - */ - __pyx_t_1 = __pyx_v_self->ob_descr->itemsize; - __pyx_v_itemsize = __pyx_t_1; - - /* "array.pxd":150 - * n: number of elements (not number of bytes!) """ - * cdef Py_ssize_t itemsize = self.ob_descr.itemsize - * cdef Py_ssize_t origsize = Py_SIZE(self) # <<<<<<<<<<<<<< - * resize_smart(self, origsize + n) - * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize) - */ - __pyx_v_origsize = Py_SIZE(((PyObject *)__pyx_v_self)); - - /* "array.pxd":151 - * cdef Py_ssize_t itemsize = self.ob_descr.itemsize - * cdef Py_ssize_t origsize = Py_SIZE(self) - * resize_smart(self, origsize + n) # <<<<<<<<<<<<<< - * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize) - * return 0 - */ - __pyx_t_1 = resize_smart(__pyx_v_self, (__pyx_v_origsize + __pyx_v_n)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 151, __pyx_L1_error) - - /* "array.pxd":152 - * cdef Py_ssize_t origsize = Py_SIZE(self) - * resize_smart(self, origsize + n) - * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize) # <<<<<<<<<<<<<< - * return 0 - * - */ - (void)(memcpy((__pyx_v_self->data.as_chars + (__pyx_v_origsize * __pyx_v_itemsize)), __pyx_v_stuff, (__pyx_v_n * __pyx_v_itemsize))); - - /* "array.pxd":153 - * resize_smart(self, origsize + n) - * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize) - * return 0 # <<<<<<<<<<<<<< - * - * cdef inline int extend(array self, array other) except -1: - */ - __pyx_r = 0; - goto __pyx_L0; - - /* "array.pxd":145 - * return op - * - * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1: # <<<<<<<<<<<<<< - * """ efficient appending of new stuff of same type - * (e.g. of same array type) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("cpython.array.extend_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "array.pxd":155 - * return 0 - * - * cdef inline int extend(array self, array other) except -1: # <<<<<<<<<<<<<< - * """ extend array with data from another array; types must match. """ - * if self.ob_descr.typecode != other.ob_descr.typecode: - */ - -static CYTHON_INLINE int __pyx_f_7cpython_5array_extend(arrayobject *__pyx_v_self, arrayobject *__pyx_v_other) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - __Pyx_RefNannySetupContext("extend", 0); - - /* "array.pxd":157 - * cdef inline int extend(array self, array other) except -1: - * """ extend array with data from another array; types must match. """ - * if self.ob_descr.typecode != other.ob_descr.typecode: # <<<<<<<<<<<<<< - * PyErr_BadArgument() - * return extend_buffer(self, other.data.as_chars, Py_SIZE(other)) - */ - __pyx_t_1 = ((__pyx_v_self->ob_descr->typecode != __pyx_v_other->ob_descr->typecode) != 0); - if (__pyx_t_1) { - - /* "array.pxd":158 - * """ extend array with data from another array; types must match. """ - * if self.ob_descr.typecode != other.ob_descr.typecode: - * PyErr_BadArgument() # <<<<<<<<<<<<<< - * return extend_buffer(self, other.data.as_chars, Py_SIZE(other)) - * - */ - __pyx_t_2 = PyErr_BadArgument(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 158, __pyx_L1_error) - - /* "array.pxd":157 - * cdef inline int extend(array self, array other) except -1: - * """ extend array with data from another array; types must match. """ - * if self.ob_descr.typecode != other.ob_descr.typecode: # <<<<<<<<<<<<<< - * PyErr_BadArgument() - * return extend_buffer(self, other.data.as_chars, Py_SIZE(other)) - */ - } - - /* "array.pxd":159 - * if self.ob_descr.typecode != other.ob_descr.typecode: - * PyErr_BadArgument() - * return extend_buffer(self, other.data.as_chars, Py_SIZE(other)) # <<<<<<<<<<<<<< - * - * cdef inline void zero(array self): - */ - __pyx_t_2 = __pyx_f_7cpython_5array_extend_buffer(__pyx_v_self, __pyx_v_other->data.as_chars, Py_SIZE(((PyObject *)__pyx_v_other))); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 159, __pyx_L1_error) - __pyx_r = __pyx_t_2; - goto __pyx_L0; - - /* "array.pxd":155 - * return 0 - * - * cdef inline int extend(array self, array other) except -1: # <<<<<<<<<<<<<< - * """ extend array with data from another array; types must match. """ - * if self.ob_descr.typecode != other.ob_descr.typecode: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("cpython.array.extend", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "array.pxd":161 - * return extend_buffer(self, other.data.as_chars, Py_SIZE(other)) - * - * cdef inline void zero(array self): # <<<<<<<<<<<<<< - * """ set all elements of array to zero. """ - * memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize) - */ - -static CYTHON_INLINE void __pyx_f_7cpython_5array_zero(arrayobject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("zero", 0); - - /* "array.pxd":163 - * cdef inline void zero(array self): - * """ set all elements of array to zero. """ - * memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize) # <<<<<<<<<<<<<< - */ - (void)(memset(__pyx_v_self->data.as_chars, 0, (Py_SIZE(((PyObject *)__pyx_v_self)) * __pyx_v_self->ob_descr->itemsize))); - - /* "array.pxd":161 - * return extend_buffer(self, other.data.as_chars, Py_SIZE(other)) - * - * cdef inline void zero(array self): # <<<<<<<<<<<<<< - * """ set all elements of array to zero. """ - * memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize) - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; @@ -6736,7 +5977,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_MAX_TYPESIZE, __pyx_k_MAX_TYPESIZE, sizeof(__pyx_k_MAX_TYPESIZE), 0, 0, 1, 1}, {&__pyx_n_s_MainProcess, __pyx_k_MainProcess, sizeof(__pyx_k_MainProcess), 0, 0, 1, 1}, {&__pyx_n_s_MainThread, __pyx_k_MainThread, sizeof(__pyx_k_MainThread), 0, 0, 1, 1}, - {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, {&__pyx_n_s_NOSHUFFLE, __pyx_k_NOSHUFFLE, sizeof(__pyx_k_NOSHUFFLE), 0, 0, 1, 1}, {&__pyx_n_s_OSError, __pyx_k_OSError, sizeof(__pyx_k_OSError), 0, 0, 1, 1}, {&__pyx_n_s_PY2, __pyx_k_PY2, sizeof(__pyx_k_PY2), 0, 0, 1, 1}, @@ -6756,7 +5996,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_cbuffer_metainfo, __pyx_k_cbuffer_metainfo, sizeof(__pyx_k_cbuffer_metainfo), 0, 0, 1, 1}, {&__pyx_n_s_cbuffer_sizes, __pyx_k_cbuffer_sizes, sizeof(__pyx_k_cbuffer_sizes), 0, 0, 1, 1}, {&__pyx_n_s_cbytes, __pyx_k_cbytes, sizeof(__pyx_k_cbytes), 0, 0, 1, 1}, - {&__pyx_n_s_check_buffer_size, __pyx_k_check_buffer_size, sizeof(__pyx_k_check_buffer_size), 0, 0, 1, 1}, {&__pyx_n_s_clevel, __pyx_k_clevel, sizeof(__pyx_k_clevel), 0, 0, 1, 1}, {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, {&__pyx_n_s_cname, __pyx_k_cname, sizeof(__pyx_k_cname), 0, 0, 1, 1}, @@ -6781,6 +6020,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_destroy, __pyx_k_destroy, sizeof(__pyx_k_destroy), 0, 0, 1, 1}, {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, + {&__pyx_n_s_ensure_ndarray, __pyx_k_ensure_ndarray, sizeof(__pyx_k_ensure_ndarray), 0, 0, 1, 1}, {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1}, {&__pyx_n_s_err_bad_cname, __pyx_k_err_bad_cname, sizeof(__pyx_k_err_bad_cname), 0, 0, 1, 1}, {&__pyx_kp_s_error_during_blosc_compression_d, __pyx_k_error_during_blosc_compression_d, sizeof(__pyx_k_error_during_blosc_compression_d), 0, 0, 1, 0}, @@ -6800,6 +6040,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_lz4, __pyx_k_lz4, sizeof(__pyx_k_lz4), 0, 0, 1, 1}, {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, {&__pyx_n_s_main_thread, __pyx_k_main_thread, sizeof(__pyx_k_main_thread), 0, 0, 1, 1}, + {&__pyx_n_s_max_buffer_size, __pyx_k_max_buffer_size, sizeof(__pyx_k_max_buffer_size), 0, 0, 1, 1}, {&__pyx_n_s_memcpyed, __pyx_k_memcpyed, sizeof(__pyx_k_memcpyed), 0, 0, 1, 1}, {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1}, {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1}, @@ -6841,10 +6082,9 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_OSError = __Pyx_GetBuiltinName(__pyx_n_s_OSError); if (!__pyx_builtin_OSError) __PYX_ERR(0, 81, __pyx_L1_error) - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 214, __pyx_L1_error) - __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 321, __pyx_L1_error) - __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 109, __pyx_L1_error) + __pyx_builtin_OSError = __Pyx_GetBuiltinName(__pyx_n_s_OSError); if (!__pyx_builtin_OSError) __PYX_ERR(0, 82, __pyx_L1_error) + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 215, __pyx_L1_error) + __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 322, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -6854,214 +6094,214 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "numcodecs/blosc.pyx":291 + /* "numcodecs/blosc.pyx":292 * # to ensure no-one else can modify the global context while we're setting it * # up and using it. * with mutex: # <<<<<<<<<<<<<< * * # set compressor */ - __pyx_tuple__4 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 291, __pyx_L1_error) + __pyx_tuple__4 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 292, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); __Pyx_GIVEREF(__pyx_tuple__4); - /* "numcodecs/blosc.pyx":88 + /* "numcodecs/blosc.pyx":89 * * * def init(): # <<<<<<<<<<<<<< * """Initialize the Blosc library environment.""" * blosc_init() */ - __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_init, 88, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_init, 89, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 89, __pyx_L1_error) - /* "numcodecs/blosc.pyx":93 + /* "numcodecs/blosc.pyx":94 * * * def destroy(): # <<<<<<<<<<<<<< * """Destroy the Blosc library environment.""" * blosc_destroy() */ - __pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_destroy, 93, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(0, 93, __pyx_L1_error) + __pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_destroy, 94, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(0, 94, __pyx_L1_error) - /* "numcodecs/blosc.pyx":98 + /* "numcodecs/blosc.pyx":99 * * * def compname_to_compcode(cname): # <<<<<<<<<<<<<< * """Return the compressor code associated with the compressor name. If the compressor * name is not recognized, or there is not support for it in this build, -1 is returned */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_n_s_cname); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_n_s_cname); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__7); __Pyx_GIVEREF(__pyx_tuple__7); - __pyx_codeobj__8 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__7, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_compname_to_compcode, 98, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__8)) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_codeobj__8 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__7, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_compname_to_compcode, 99, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__8)) __PYX_ERR(0, 99, __pyx_L1_error) - /* "numcodecs/blosc.pyx":107 + /* "numcodecs/blosc.pyx":108 * * * def list_compressors(): # <<<<<<<<<<<<<< * """Get a list of compressors supported in the current build.""" * s = blosc_list_compressors() */ - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_n_s_s); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 107, __pyx_L1_error) + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_n_s_s); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9); - __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_list_compressors, 107, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 107, __pyx_L1_error) + __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_list_compressors, 108, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 108, __pyx_L1_error) - /* "numcodecs/blosc.pyx":115 + /* "numcodecs/blosc.pyx":116 * * * def get_nthreads(): # <<<<<<<<<<<<<< * """Get the number of threads that Blosc uses internally for compression and * decompression.""" */ - __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_get_nthreads, 115, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 115, __pyx_L1_error) + __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_get_nthreads, 116, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 116, __pyx_L1_error) - /* "numcodecs/blosc.pyx":121 + /* "numcodecs/blosc.pyx":122 * * * def set_nthreads(int nthreads): # <<<<<<<<<<<<<< * """Set the number of threads that Blosc uses internally for compression and * decompression.""" */ - __pyx_tuple__12 = PyTuple_Pack(2, __pyx_n_s_nthreads, __pyx_n_s_nthreads); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_tuple__12 = PyTuple_Pack(2, __pyx_n_s_nthreads, __pyx_n_s_nthreads); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12); - __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_set_nthreads, 121, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_set_nthreads, 122, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 122, __pyx_L1_error) - /* "numcodecs/blosc.pyx":127 + /* "numcodecs/blosc.pyx":128 * * * def cbuffer_sizes(source): # <<<<<<<<<<<<<< * """Return information about a compressed buffer, namely the number of uncompressed * bytes (`nbytes`) and compressed (`cbytes`). It also returns the `blocksize` (which */ - __pyx_tuple__14 = PyTuple_Pack(5, __pyx_n_s_source, __pyx_n_s_buffer, __pyx_n_s_nbytes, __pyx_n_s_cbytes, __pyx_n_s_blocksize); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 127, __pyx_L1_error) + __pyx_tuple__14 = PyTuple_Pack(5, __pyx_n_s_source, __pyx_n_s_buffer, __pyx_n_s_nbytes, __pyx_n_s_cbytes, __pyx_n_s_blocksize); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 128, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__14); __Pyx_GIVEREF(__pyx_tuple__14); - __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_cbuffer_sizes, 127, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 127, __pyx_L1_error) + __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_cbuffer_sizes, 128, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 128, __pyx_L1_error) - /* "numcodecs/blosc.pyx":155 + /* "numcodecs/blosc.pyx":156 * * * def cbuffer_complib(source): # <<<<<<<<<<<<<< * """Return the name of the compression library used to compress `source`.""" * cdef: */ - __pyx_tuple__16 = PyTuple_Pack(3, __pyx_n_s_source, __pyx_n_s_buffer, __pyx_n_s_complib); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 155, __pyx_L1_error) + __pyx_tuple__16 = PyTuple_Pack(3, __pyx_n_s_source, __pyx_n_s_buffer, __pyx_n_s_complib); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__16); __Pyx_GIVEREF(__pyx_tuple__16); - __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_cbuffer_complib, 155, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 155, __pyx_L1_error) + __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_cbuffer_complib, 156, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 156, __pyx_L1_error) - /* "numcodecs/blosc.pyx":175 + /* "numcodecs/blosc.pyx":176 * * * def cbuffer_metainfo(source): # <<<<<<<<<<<<<< * """Return some meta-information about the compressed buffer in `source`, including * the typesize, whether the shuffle or bit-shuffle filters were used, and the */ - __pyx_tuple__18 = PyTuple_Pack(6, __pyx_n_s_source, __pyx_n_s_buffer, __pyx_n_s_typesize, __pyx_n_s_flags, __pyx_n_s_shuffle, __pyx_n_s_memcpyed); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_tuple__18 = PyTuple_Pack(6, __pyx_n_s_source, __pyx_n_s_buffer, __pyx_n_s_typesize, __pyx_n_s_flags, __pyx_n_s_shuffle, __pyx_n_s_memcpyed); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 176, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__18); __Pyx_GIVEREF(__pyx_tuple__18); - __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_cbuffer_metainfo, 175, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_cbuffer_metainfo, 176, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 176, __pyx_L1_error) - /* "numcodecs/blosc.pyx":213 + /* "numcodecs/blosc.pyx":214 * * * def err_bad_cname(cname): # <<<<<<<<<<<<<< * raise ValueError('bad compressor or compressor not supported: %r; expected one of ' * '%s' % (cname, list_compressors())) */ - __pyx_tuple__20 = PyTuple_Pack(1, __pyx_n_s_cname); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 213, __pyx_L1_error) + __pyx_tuple__20 = PyTuple_Pack(1, __pyx_n_s_cname); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 214, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__20); __Pyx_GIVEREF(__pyx_tuple__20); - __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_err_bad_cname, 213, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 213, __pyx_L1_error) + __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_err_bad_cname, 214, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 214, __pyx_L1_error) - /* "numcodecs/blosc.pyx":218 + /* "numcodecs/blosc.pyx":219 * * * def compress(source, char* cname, int clevel, int shuffle=SHUFFLE, # <<<<<<<<<<<<<< * int blocksize=AUTOBLOCKS): * """Compress data. */ - __pyx_tuple__22 = PyTuple_Pack(14, __pyx_n_s_source, __pyx_n_s_cname, __pyx_n_s_clevel, __pyx_n_s_shuffle, __pyx_n_s_blocksize, __pyx_n_s_source_ptr, __pyx_n_s_dest_ptr, __pyx_n_s_source_buffer, __pyx_n_s_nbytes, __pyx_n_s_itemsize, __pyx_n_s_cbytes, __pyx_n_s_dest, __pyx_n_s_cname_str, __pyx_n_s_compressor_set); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 218, __pyx_L1_error) + __pyx_tuple__22 = PyTuple_Pack(14, __pyx_n_s_source, __pyx_n_s_cname, __pyx_n_s_clevel, __pyx_n_s_shuffle, __pyx_n_s_blocksize, __pyx_n_s_source_ptr, __pyx_n_s_dest_ptr, __pyx_n_s_source_buffer, __pyx_n_s_nbytes, __pyx_n_s_itemsize, __pyx_n_s_cbytes, __pyx_n_s_dest, __pyx_n_s_cname_str, __pyx_n_s_compressor_set); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 219, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__22); __Pyx_GIVEREF(__pyx_tuple__22); - __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(5, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_compress, 218, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 218, __pyx_L1_error) + __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(5, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_compress, 219, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 219, __pyx_L1_error) - /* "numcodecs/blosc.pyx":329 + /* "numcodecs/blosc.pyx":330 * * * def decompress(source, dest=None): # <<<<<<<<<<<<<< * """Decompress data. * */ - __pyx_tuple__24 = PyTuple_Pack(11, __pyx_n_s_source, __pyx_n_s_dest, __pyx_n_s_ret, __pyx_n_s_source_ptr, __pyx_n_s_dest_ptr, __pyx_n_s_source_buffer, __pyx_n_s_dest_buffer, __pyx_n_s_nbytes, __pyx_n_s_cbytes, __pyx_n_s_blocksize, __pyx_n_s_dest_nbytes); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 329, __pyx_L1_error) + __pyx_tuple__24 = PyTuple_Pack(11, __pyx_n_s_source, __pyx_n_s_dest, __pyx_n_s_ret, __pyx_n_s_source_ptr, __pyx_n_s_dest_ptr, __pyx_n_s_source_buffer, __pyx_n_s_dest_buffer, __pyx_n_s_nbytes, __pyx_n_s_cbytes, __pyx_n_s_blocksize, __pyx_n_s_dest_nbytes); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 330, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__24); __Pyx_GIVEREF(__pyx_tuple__24); - __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(2, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_decompress, 329, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 329, __pyx_L1_error) + __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(2, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_decompress, 330, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 330, __pyx_L1_error) - /* "numcodecs/blosc.pyx":407 + /* "numcodecs/blosc.pyx":408 * * * def _get_use_threads(): # <<<<<<<<<<<<<< * global use_threads * proc = multiprocessing.current_process() */ - __pyx_tuple__26 = PyTuple_Pack(2, __pyx_n_s_proc, __pyx_n_s_use_threads_2); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 407, __pyx_L1_error) + __pyx_tuple__26 = PyTuple_Pack(2, __pyx_n_s_proc, __pyx_n_s_use_threads_2); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 408, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__26); __Pyx_GIVEREF(__pyx_tuple__26); - __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_get_use_threads, 407, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 407, __pyx_L1_error) + __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_get_use_threads, 408, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 408, __pyx_L1_error) - /* "numcodecs/blosc.pyx":476 - * AUTOSHUFFLE = AUTOSHUFFLE + /* "numcodecs/blosc.pyx":478 + * max_buffer_size = 2**31 - 1 * * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): # <<<<<<<<<<<<<< * self.cname = cname * if isinstance(cname, text_type): */ - __pyx_tuple__28 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_cname, __pyx_n_s_clevel, __pyx_n_s_shuffle, __pyx_n_s_blocksize); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 476, __pyx_L1_error) + __pyx_tuple__28 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_cname, __pyx_n_s_clevel, __pyx_n_s_shuffle, __pyx_n_s_blocksize); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 478, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__28); __Pyx_GIVEREF(__pyx_tuple__28); - __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_init_2, 476, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 476, __pyx_L1_error) + __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_init_2, 478, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 478, __pyx_L1_error) - /* "numcodecs/blosc.pyx":486 + /* "numcodecs/blosc.pyx":488 * self.blocksize = blocksize * * def encode(self, buf): # <<<<<<<<<<<<<< - * self._check_buffer_size(buf) + * buf = ensure_ndarray(buf, self.max_buffer_size) * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) */ - __pyx_tuple__30 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_buf); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 486, __pyx_L1_error) + __pyx_tuple__30 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_buf); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 488, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__30); __Pyx_GIVEREF(__pyx_tuple__30); - __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_encode, 486, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 486, __pyx_L1_error) + __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_encode, 488, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 488, __pyx_L1_error) - /* "numcodecs/blosc.pyx":490 + /* "numcodecs/blosc.pyx":492 * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) * * def decode(self, buf, out=None): # <<<<<<<<<<<<<< - * self._check_buffer_size(buf) + * buf = ensure_ndarray(buf, self.max_buffer_size) * return decompress(buf, out) */ - __pyx_tuple__32 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_buf, __pyx_n_s_out); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 490, __pyx_L1_error) + __pyx_tuple__32 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_buf, __pyx_n_s_out); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 492, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__32); __Pyx_GIVEREF(__pyx_tuple__32); - __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_decode, 490, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 490, __pyx_L1_error) - __pyx_tuple__34 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 490, __pyx_L1_error) + __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_decode, 492, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 492, __pyx_L1_error) + __pyx_tuple__34 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 492, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__34); __Pyx_GIVEREF(__pyx_tuple__34); - /* "numcodecs/blosc.pyx":494 + /* "numcodecs/blosc.pyx":496 * return decompress(buf, out) * * def __repr__(self): # <<<<<<<<<<<<<< * r = '%s(cname=%r, clevel=%r, shuffle=%s, blocksize=%s)' % \ * (type(self).__name__, */ - __pyx_tuple__35 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_r); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 494, __pyx_L1_error) + __pyx_tuple__35 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_r); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 496, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__35); __Pyx_GIVEREF(__pyx_tuple__35); - __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_repr, 494, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 494, __pyx_L1_error) + __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_repr, 496, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 496, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -7074,6 +6314,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_2147483647 = PyInt_FromLong(2147483647L); if (unlikely(!__pyx_int_2147483647)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error) return 0; __pyx_L1_error:; @@ -7125,7 +6366,7 @@ static int __Pyx_modinit_type_import_code(void) { PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); /*--- Type import code ---*/ - __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error) + __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 @@ -7134,28 +6375,13 @@ static int __Pyx_modinit_type_import_code(void) { sizeof(PyHeapTypeObject), #endif __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(3, 8, __pyx_L1_error) + if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(1, 9, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(4, 15, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyImport_ImportModule("array"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 58, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_7cpython_5array_array = __Pyx_ImportType(__pyx_t_1, "array", "array", sizeof(arrayobject), __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_7cpython_5array_array) __PYX_ERR(1, 58, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyImport_ImportModule("numcodecs.compat_ext"); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 5, __pyx_L1_error) + __pyx_t_1 = PyImport_ImportModule("numcodecs.compat_ext"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_ptype_9numcodecs_10compat_ext_Buffer = __Pyx_ImportType(__pyx_t_1, "numcodecs.compat_ext", "Buffer", sizeof(struct __pyx_obj_9numcodecs_10compat_ext_Buffer), __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_9numcodecs_10compat_ext_Buffer) __PYX_ERR(5, 5, __pyx_L1_error) - __pyx_vtabptr_9numcodecs_10compat_ext_Buffer = (struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer*)__Pyx_GetVtable(__pyx_ptype_9numcodecs_10compat_ext_Buffer->tp_dict); if (unlikely(!__pyx_vtabptr_9numcodecs_10compat_ext_Buffer)) __PYX_ERR(5, 5, __pyx_L1_error) + if (!__pyx_ptype_9numcodecs_10compat_ext_Buffer) __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_vtabptr_9numcodecs_10compat_ext_Buffer = (struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer*)__Pyx_GetVtable(__pyx_ptype_9numcodecs_10compat_ext_Buffer->tp_dict); if (unlikely(!__pyx_vtabptr_9numcodecs_10compat_ext_Buffer)) __PYX_ERR(2, 4, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; @@ -7387,67 +6613,67 @@ if (!__Pyx_RefNanny) { if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif - /* "numcodecs/blosc.pyx":7 - * # cython: binding=False + /* "numcodecs/blosc.pyx":8 + * # cython: language_level=2 * from __future__ import absolute_import, print_function, division * import threading # <<<<<<<<<<<<<< * import multiprocessing * import os */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_threading, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error) + __pyx_t_1 = __Pyx_Import(__pyx_n_s_threading, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_threading, __pyx_t_1) < 0) __PYX_ERR(0, 7, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_threading, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":8 + /* "numcodecs/blosc.pyx":9 * from __future__ import absolute_import, print_function, division * import threading * import multiprocessing # <<<<<<<<<<<<<< * import os * */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_multiprocessing, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error) + __pyx_t_1 = __Pyx_Import(__pyx_n_s_multiprocessing, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_multiprocessing, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_multiprocessing, __pyx_t_1) < 0) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":9 + /* "numcodecs/blosc.pyx":10 * import threading * import multiprocessing * import os # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_os, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error) + __pyx_t_1 = __Pyx_Import(__pyx_n_s_os, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_1) < 0) __PYX_ERR(0, 9, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_1) < 0) __PYX_ERR(0, 10, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":17 + /* "numcodecs/blosc.pyx":18 * * from .compat_ext cimport Buffer * from .compat_ext import Buffer # <<<<<<<<<<<<<< - * from .compat import PY2, text_type + * from .compat import PY2, text_type, ensure_ndarray * from .abc import Codec */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_Buffer); __Pyx_GIVEREF(__pyx_n_s_Buffer); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Buffer); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_compat_ext, __pyx_t_1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) + __pyx_t_2 = __Pyx_Import(__pyx_n_s_compat_ext, __pyx_t_1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":18 + /* "numcodecs/blosc.pyx":19 * from .compat_ext cimport Buffer * from .compat_ext import Buffer - * from .compat import PY2, text_type # <<<<<<<<<<<<<< + * from .compat import PY2, text_type, ensure_ndarray # <<<<<<<<<<<<<< * from .abc import Codec * */ - __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error) + __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_PY2); __Pyx_GIVEREF(__pyx_n_s_PY2); @@ -7455,163 +6681,170 @@ if (!__Pyx_RefNanny) { __Pyx_INCREF(__pyx_n_s_text_type); __Pyx_GIVEREF(__pyx_n_s_text_type); PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_text_type); - __pyx_t_1 = __Pyx_Import(__pyx_n_s_compat, __pyx_t_2, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_INCREF(__pyx_n_s_ensure_ndarray); + __Pyx_GIVEREF(__pyx_n_s_ensure_ndarray); + PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_ensure_ndarray); + __pyx_t_1 = __Pyx_Import(__pyx_n_s_compat, __pyx_t_2, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_PY2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error) + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_PY2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_PY2, __pyx_t_2) < 0) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_text_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_PY2, __pyx_t_2) < 0) __PYX_ERR(0, 18, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_text_type, __pyx_t_2) < 0) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_text_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error) + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ensure_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_text_type, __pyx_t_2) < 0) __PYX_ERR(0, 18, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ensure_ndarray, __pyx_t_2) < 0) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":19 + /* "numcodecs/blosc.pyx":20 * from .compat_ext import Buffer - * from .compat import PY2, text_type + * from .compat import PY2, text_type, ensure_ndarray * from .abc import Codec # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error) + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_Codec); __Pyx_GIVEREF(__pyx_n_s_Codec); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Codec); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_abc, __pyx_t_1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) + __pyx_t_2 = __Pyx_Import(__pyx_n_s_abc, __pyx_t_1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Codec); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error) + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Codec); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_Codec, __pyx_t_1) < 0) __PYX_ERR(0, 19, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Codec, __pyx_t_1) < 0) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":60 + /* "numcodecs/blosc.pyx":61 * * * MAX_OVERHEAD = BLOSC_MAX_OVERHEAD # <<<<<<<<<<<<<< * MAX_BUFFERSIZE = BLOSC_MAX_BUFFERSIZE * MAX_THREADS = BLOSC_MAX_THREADS */ - __pyx_t_2 = __Pyx_PyInt_From_int(BLOSC_MAX_OVERHEAD); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(BLOSC_MAX_OVERHEAD); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_OVERHEAD, __pyx_t_2) < 0) __PYX_ERR(0, 60, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_OVERHEAD, __pyx_t_2) < 0) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":61 + /* "numcodecs/blosc.pyx":62 * * MAX_OVERHEAD = BLOSC_MAX_OVERHEAD * MAX_BUFFERSIZE = BLOSC_MAX_BUFFERSIZE # <<<<<<<<<<<<<< * MAX_THREADS = BLOSC_MAX_THREADS * MAX_TYPESIZE = BLOSC_MAX_TYPESIZE */ - __pyx_t_2 = __Pyx_PyInt_From_int(BLOSC_MAX_BUFFERSIZE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(BLOSC_MAX_BUFFERSIZE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_BUFFERSIZE, __pyx_t_2) < 0) __PYX_ERR(0, 61, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_BUFFERSIZE, __pyx_t_2) < 0) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":62 + /* "numcodecs/blosc.pyx":63 * MAX_OVERHEAD = BLOSC_MAX_OVERHEAD * MAX_BUFFERSIZE = BLOSC_MAX_BUFFERSIZE * MAX_THREADS = BLOSC_MAX_THREADS # <<<<<<<<<<<<<< * MAX_TYPESIZE = BLOSC_MAX_TYPESIZE * VERSION_STRING = BLOSC_VERSION_STRING */ - __pyx_t_2 = __Pyx_PyInt_From_int(BLOSC_MAX_THREADS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(BLOSC_MAX_THREADS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_THREADS, __pyx_t_2) < 0) __PYX_ERR(0, 62, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_THREADS, __pyx_t_2) < 0) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":63 + /* "numcodecs/blosc.pyx":64 * MAX_BUFFERSIZE = BLOSC_MAX_BUFFERSIZE * MAX_THREADS = BLOSC_MAX_THREADS * MAX_TYPESIZE = BLOSC_MAX_TYPESIZE # <<<<<<<<<<<<<< * VERSION_STRING = BLOSC_VERSION_STRING * VERSION_DATE = BLOSC_VERSION_DATE */ - __pyx_t_2 = __Pyx_PyInt_From_int(BLOSC_MAX_TYPESIZE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 63, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(BLOSC_MAX_TYPESIZE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_TYPESIZE, __pyx_t_2) < 0) __PYX_ERR(0, 63, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_TYPESIZE, __pyx_t_2) < 0) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":64 + /* "numcodecs/blosc.pyx":65 * MAX_THREADS = BLOSC_MAX_THREADS * MAX_TYPESIZE = BLOSC_MAX_TYPESIZE * VERSION_STRING = BLOSC_VERSION_STRING # <<<<<<<<<<<<<< * VERSION_DATE = BLOSC_VERSION_DATE * if not PY2: */ - __pyx_t_2 = __Pyx_PyBytes_FromString(((char *)BLOSC_VERSION_STRING)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_FromString(((char *)BLOSC_VERSION_STRING)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_VERSION_STRING, __pyx_t_2) < 0) __PYX_ERR(0, 64, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_VERSION_STRING, __pyx_t_2) < 0) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":65 + /* "numcodecs/blosc.pyx":66 * MAX_TYPESIZE = BLOSC_MAX_TYPESIZE * VERSION_STRING = BLOSC_VERSION_STRING * VERSION_DATE = BLOSC_VERSION_DATE # <<<<<<<<<<<<<< * if not PY2: * VERSION_STRING = VERSION_STRING.decode() */ - __pyx_t_2 = __Pyx_PyBytes_FromString(((char *)BLOSC_VERSION_DATE)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_FromString(((char *)BLOSC_VERSION_DATE)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_VERSION_DATE, __pyx_t_2) < 0) __PYX_ERR(0, 65, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_VERSION_DATE, __pyx_t_2) < 0) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":66 + /* "numcodecs/blosc.pyx":67 * VERSION_STRING = BLOSC_VERSION_STRING * VERSION_DATE = BLOSC_VERSION_DATE * if not PY2: # <<<<<<<<<<<<<< * VERSION_STRING = VERSION_STRING.decode() * VERSION_DATE = VERSION_DATE.decode() */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PY2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PY2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 66, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = ((!__pyx_t_3) != 0); if (__pyx_t_4) { - /* "numcodecs/blosc.pyx":67 + /* "numcodecs/blosc.pyx":68 * VERSION_DATE = BLOSC_VERSION_DATE * if not PY2: * VERSION_STRING = VERSION_STRING.decode() # <<<<<<<<<<<<<< * VERSION_DATE = VERSION_DATE.decode() * __version__ = VERSION_STRING */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_VERSION_STRING); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 67, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_VERSION_STRING); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_decode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_decode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 67, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_VERSION_STRING, __pyx_t_2) < 0) __PYX_ERR(0, 67, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_VERSION_STRING, __pyx_t_2) < 0) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":68 + /* "numcodecs/blosc.pyx":69 * if not PY2: * VERSION_STRING = VERSION_STRING.decode() * VERSION_DATE = VERSION_DATE.decode() # <<<<<<<<<<<<<< * __version__ = VERSION_STRING * NOSHUFFLE = BLOSC_NOSHUFFLE */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_VERSION_DATE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_VERSION_DATE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_decode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_decode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_VERSION_DATE, __pyx_t_2) < 0) __PYX_ERR(0, 68, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_VERSION_DATE, __pyx_t_2) < 0) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":66 + /* "numcodecs/blosc.pyx":67 * VERSION_STRING = BLOSC_VERSION_STRING * VERSION_DATE = BLOSC_VERSION_DATE * if not PY2: # <<<<<<<<<<<<<< @@ -7620,73 +6853,73 @@ if (!__Pyx_RefNanny) { */ } - /* "numcodecs/blosc.pyx":69 + /* "numcodecs/blosc.pyx":70 * VERSION_STRING = VERSION_STRING.decode() * VERSION_DATE = VERSION_DATE.decode() * __version__ = VERSION_STRING # <<<<<<<<<<<<<< * NOSHUFFLE = BLOSC_NOSHUFFLE * SHUFFLE = BLOSC_SHUFFLE */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_VERSION_STRING); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_VERSION_STRING); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_version, __pyx_t_2) < 0) __PYX_ERR(0, 69, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_version, __pyx_t_2) < 0) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":70 + /* "numcodecs/blosc.pyx":71 * VERSION_DATE = VERSION_DATE.decode() * __version__ = VERSION_STRING * NOSHUFFLE = BLOSC_NOSHUFFLE # <<<<<<<<<<<<<< * SHUFFLE = BLOSC_SHUFFLE * BITSHUFFLE = BLOSC_BITSHUFFLE */ - __pyx_t_2 = __Pyx_PyInt_From_int(BLOSC_NOSHUFFLE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(BLOSC_NOSHUFFLE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_NOSHUFFLE, __pyx_t_2) < 0) __PYX_ERR(0, 70, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_NOSHUFFLE, __pyx_t_2) < 0) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":71 + /* "numcodecs/blosc.pyx":72 * __version__ = VERSION_STRING * NOSHUFFLE = BLOSC_NOSHUFFLE * SHUFFLE = BLOSC_SHUFFLE # <<<<<<<<<<<<<< * BITSHUFFLE = BLOSC_BITSHUFFLE * # automatic shuffle */ - __pyx_t_2 = __Pyx_PyInt_From_int(BLOSC_SHUFFLE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 71, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(BLOSC_SHUFFLE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_SHUFFLE, __pyx_t_2) < 0) __PYX_ERR(0, 71, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_SHUFFLE, __pyx_t_2) < 0) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":72 + /* "numcodecs/blosc.pyx":73 * NOSHUFFLE = BLOSC_NOSHUFFLE * SHUFFLE = BLOSC_SHUFFLE * BITSHUFFLE = BLOSC_BITSHUFFLE # <<<<<<<<<<<<<< * # automatic shuffle * AUTOSHUFFLE = -1 */ - __pyx_t_2 = __Pyx_PyInt_From_int(BLOSC_BITSHUFFLE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(BLOSC_BITSHUFFLE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_BITSHUFFLE, __pyx_t_2) < 0) __PYX_ERR(0, 72, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_BITSHUFFLE, __pyx_t_2) < 0) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":74 + /* "numcodecs/blosc.pyx":75 * BITSHUFFLE = BLOSC_BITSHUFFLE * # automatic shuffle * AUTOSHUFFLE = -1 # <<<<<<<<<<<<<< * # automatic block size - let blosc decide * AUTOBLOCKS = 0 */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_AUTOSHUFFLE, __pyx_int_neg_1) < 0) __PYX_ERR(0, 74, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_AUTOSHUFFLE, __pyx_int_neg_1) < 0) __PYX_ERR(0, 75, __pyx_L1_error) - /* "numcodecs/blosc.pyx":76 + /* "numcodecs/blosc.pyx":77 * AUTOSHUFFLE = -1 * # automatic block size - let blosc decide * AUTOBLOCKS = 0 # <<<<<<<<<<<<<< * * # synchronization */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_AUTOBLOCKS, __pyx_int_0) < 0) __PYX_ERR(0, 76, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_AUTOBLOCKS, __pyx_int_0) < 0) __PYX_ERR(0, 77, __pyx_L1_error) - /* "numcodecs/blosc.pyx":79 + /* "numcodecs/blosc.pyx":80 * * # synchronization * try: # <<<<<<<<<<<<<< @@ -7702,25 +6935,25 @@ if (!__Pyx_RefNanny) { __Pyx_XGOTREF(__pyx_t_7); /*try:*/ { - /* "numcodecs/blosc.pyx":80 + /* "numcodecs/blosc.pyx":81 * # synchronization * try: * mutex = multiprocessing.Lock() # <<<<<<<<<<<<<< * except OSError: * mutex = None */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_multiprocessing); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L3_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_multiprocessing); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Lock); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L3_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Lock); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L3_error) + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_mutex, __pyx_t_2) < 0) __PYX_ERR(0, 80, __pyx_L3_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_mutex, __pyx_t_2) < 0) __PYX_ERR(0, 81, __pyx_L3_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":79 + /* "numcodecs/blosc.pyx":80 * * # synchronization * try: # <<<<<<<<<<<<<< @@ -7736,7 +6969,7 @@ if (!__Pyx_RefNanny) { __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":81 + /* "numcodecs/blosc.pyx":82 * try: * mutex = multiprocessing.Lock() * except OSError: # <<<<<<<<<<<<<< @@ -7746,19 +6979,19 @@ if (!__Pyx_RefNanny) { __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_OSError); if (__pyx_t_8) { __Pyx_AddTraceback("numcodecs.blosc", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_9) < 0) __PYX_ERR(0, 81, __pyx_L5_except_error) + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_9) < 0) __PYX_ERR(0, 82, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_9); - /* "numcodecs/blosc.pyx":82 + /* "numcodecs/blosc.pyx":83 * mutex = multiprocessing.Lock() * except OSError: * mutex = None # <<<<<<<<<<<<<< * * # store ID of process that first loads the module, so we can detect a fork later */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_mutex, Py_None) < 0) __PYX_ERR(0, 82, __pyx_L5_except_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_mutex, Py_None) < 0) __PYX_ERR(0, 83, __pyx_L5_except_error) __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; @@ -7767,7 +7000,7 @@ if (!__Pyx_RefNanny) { goto __pyx_L5_except_error; __pyx_L5_except_error:; - /* "numcodecs/blosc.pyx":79 + /* "numcodecs/blosc.pyx":80 * * # synchronization * try: # <<<<<<<<<<<<<< @@ -7787,223 +7020,223 @@ if (!__Pyx_RefNanny) { __pyx_L8_try_end:; } - /* "numcodecs/blosc.pyx":85 + /* "numcodecs/blosc.pyx":86 * * # store ID of process that first loads the module, so we can detect a fork later * _importer_pid = os.getpid() # <<<<<<<<<<<<<< * * */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_os); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_os); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_getpid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_getpid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 85, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_importer_pid, __pyx_t_9) < 0) __PYX_ERR(0, 85, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_importer_pid, __pyx_t_9) < 0) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":88 + /* "numcodecs/blosc.pyx":89 * * * def init(): # <<<<<<<<<<<<<< * """Initialize the Blosc library environment.""" * blosc_init() */ - __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_1init, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_1init, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_init, __pyx_t_9) < 0) __PYX_ERR(0, 88, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_init, __pyx_t_9) < 0) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":93 + /* "numcodecs/blosc.pyx":94 * * * def destroy(): # <<<<<<<<<<<<<< * """Destroy the Blosc library environment.""" * blosc_destroy() */ - __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_3destroy, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 93, __pyx_L1_error) + __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_3destroy, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_destroy, __pyx_t_9) < 0) __PYX_ERR(0, 93, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_destroy, __pyx_t_9) < 0) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":98 + /* "numcodecs/blosc.pyx":99 * * * def compname_to_compcode(cname): # <<<<<<<<<<<<<< * """Return the compressor code associated with the compressor name. If the compressor * name is not recognized, or there is not support for it in this build, -1 is returned */ - __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5compname_to_compcode, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5compname_to_compcode, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_compname_to_compcode, __pyx_t_9) < 0) __PYX_ERR(0, 98, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_compname_to_compcode, __pyx_t_9) < 0) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":107 + /* "numcodecs/blosc.pyx":108 * * * def list_compressors(): # <<<<<<<<<<<<<< * """Get a list of compressors supported in the current build.""" * s = blosc_list_compressors() */ - __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_7list_compressors, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error) + __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_7list_compressors, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_list_compressors, __pyx_t_9) < 0) __PYX_ERR(0, 107, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_list_compressors, __pyx_t_9) < 0) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":115 + /* "numcodecs/blosc.pyx":116 * * * def get_nthreads(): # <<<<<<<<<<<<<< * """Get the number of threads that Blosc uses internally for compression and * decompression.""" */ - __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_9get_nthreads, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 115, __pyx_L1_error) + __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_9get_nthreads, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_nthreads, __pyx_t_9) < 0) __PYX_ERR(0, 115, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_nthreads, __pyx_t_9) < 0) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":121 + /* "numcodecs/blosc.pyx":122 * * * def set_nthreads(int nthreads): # <<<<<<<<<<<<<< * """Set the number of threads that Blosc uses internally for compression and * decompression.""" */ - __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_11set_nthreads, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_11set_nthreads, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_nthreads, __pyx_t_9) < 0) __PYX_ERR(0, 121, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_nthreads, __pyx_t_9) < 0) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":127 + /* "numcodecs/blosc.pyx":128 * * * def cbuffer_sizes(source): # <<<<<<<<<<<<<< * """Return information about a compressed buffer, namely the number of uncompressed * bytes (`nbytes`) and compressed (`cbytes`). It also returns the `blocksize` (which */ - __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_13cbuffer_sizes, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 127, __pyx_L1_error) + __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_13cbuffer_sizes, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 128, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_cbuffer_sizes, __pyx_t_9) < 0) __PYX_ERR(0, 127, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_cbuffer_sizes, __pyx_t_9) < 0) __PYX_ERR(0, 128, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":155 + /* "numcodecs/blosc.pyx":156 * * * def cbuffer_complib(source): # <<<<<<<<<<<<<< * """Return the name of the compression library used to compress `source`.""" * cdef: */ - __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_15cbuffer_complib, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 155, __pyx_L1_error) + __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_15cbuffer_complib, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_cbuffer_complib, __pyx_t_9) < 0) __PYX_ERR(0, 155, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_cbuffer_complib, __pyx_t_9) < 0) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":175 + /* "numcodecs/blosc.pyx":176 * * * def cbuffer_metainfo(source): # <<<<<<<<<<<<<< * """Return some meta-information about the compressed buffer in `source`, including * the typesize, whether the shuffle or bit-shuffle filters were used, and the */ - __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_17cbuffer_metainfo, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_17cbuffer_metainfo, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 176, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_cbuffer_metainfo, __pyx_t_9) < 0) __PYX_ERR(0, 175, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_cbuffer_metainfo, __pyx_t_9) < 0) __PYX_ERR(0, 176, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":213 + /* "numcodecs/blosc.pyx":214 * * * def err_bad_cname(cname): # <<<<<<<<<<<<<< * raise ValueError('bad compressor or compressor not supported: %r; expected one of ' * '%s' % (cname, list_compressors())) */ - __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_19err_bad_cname, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 213, __pyx_L1_error) + __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_19err_bad_cname, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 214, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_err_bad_cname, __pyx_t_9) < 0) __PYX_ERR(0, 213, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_err_bad_cname, __pyx_t_9) < 0) __PYX_ERR(0, 214, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":218 + /* "numcodecs/blosc.pyx":219 * * * def compress(source, char* cname, int clevel, int shuffle=SHUFFLE, # <<<<<<<<<<<<<< * int blocksize=AUTOBLOCKS): * """Compress data. */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_SHUFFLE); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 218, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_SHUFFLE); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 219, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_9); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 218, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_9); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 219, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_k__2 = __pyx_t_8; - /* "numcodecs/blosc.pyx":219 + /* "numcodecs/blosc.pyx":220 * * def compress(source, char* cname, int clevel, int shuffle=SHUFFLE, * int blocksize=AUTOBLOCKS): # <<<<<<<<<<<<<< * """Compress data. * */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_AUTOBLOCKS); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 219, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_AUTOBLOCKS); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_9); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 219, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_9); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_k__3 = __pyx_t_8; - /* "numcodecs/blosc.pyx":218 + /* "numcodecs/blosc.pyx":219 * * * def compress(source, char* cname, int clevel, int shuffle=SHUFFLE, # <<<<<<<<<<<<<< * int blocksize=AUTOBLOCKS): * """Compress data. */ - __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_21compress, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 218, __pyx_L1_error) + __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_21compress, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 219, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_compress, __pyx_t_9) < 0) __PYX_ERR(0, 218, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_compress, __pyx_t_9) < 0) __PYX_ERR(0, 219, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":329 + /* "numcodecs/blosc.pyx":330 * * * def decompress(source, dest=None): # <<<<<<<<<<<<<< * """Decompress data. * */ - __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_23decompress, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 329, __pyx_L1_error) + __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_23decompress, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 330, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_decompress, __pyx_t_9) < 0) __PYX_ERR(0, 329, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_decompress, __pyx_t_9) < 0) __PYX_ERR(0, 330, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":404 + /* "numcodecs/blosc.pyx":405 * # set the value of this variable to True or False to override the * # default adaptive behaviour * use_threads = None # <<<<<<<<<<<<<< * * */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_use_threads, Py_None) < 0) __PYX_ERR(0, 404, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_use_threads, Py_None) < 0) __PYX_ERR(0, 405, __pyx_L1_error) - /* "numcodecs/blosc.pyx":407 + /* "numcodecs/blosc.pyx":408 * * * def _get_use_threads(): # <<<<<<<<<<<<<< * global use_threads * proc = multiprocessing.current_process() */ - __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_25_get_use_threads, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 407, __pyx_L1_error) + __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_25_get_use_threads, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 408, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_use_threads, __pyx_t_9) < 0) __PYX_ERR(0, 407, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_use_threads, __pyx_t_9) < 0) __PYX_ERR(0, 408, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":443 + /* "numcodecs/blosc.pyx":444 * * * _shuffle_repr = ['AUTOSHUFFLE', 'NOSHUFFLE', 'SHUFFLE', 'BITSHUFFLE'] # <<<<<<<<<<<<<< * * */ - __pyx_t_9 = PyList_New(4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 443, __pyx_L1_error) + __pyx_t_9 = PyList_New(4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 444, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(__pyx_n_s_AUTOSHUFFLE); __Pyx_GIVEREF(__pyx_n_s_AUTOSHUFFLE); @@ -8017,38 +7250,38 @@ if (!__Pyx_RefNanny) { __Pyx_INCREF(__pyx_n_s_BITSHUFFLE); __Pyx_GIVEREF(__pyx_n_s_BITSHUFFLE); PyList_SET_ITEM(__pyx_t_9, 3, __pyx_n_s_BITSHUFFLE); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_shuffle_repr, __pyx_t_9) < 0) __PYX_ERR(0, 443, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_shuffle_repr, __pyx_t_9) < 0) __PYX_ERR(0, 444, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":446 + /* "numcodecs/blosc.pyx":447 * * * class Blosc(Codec): # <<<<<<<<<<<<<< * """Codec providing compression using the Blosc meta-compressor. * */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_Codec); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 446, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_Codec); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 447, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 446, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 447, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 446, __pyx_L1_error) + __pyx_t_9 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 447, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_9, __pyx_t_1, __pyx_n_s_Blosc, __pyx_n_s_Blosc, (PyObject *) NULL, __pyx_n_s_numcodecs_blosc, __pyx_kp_s_Codec_providing_compression_usin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 446, __pyx_L1_error) + __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_9, __pyx_t_1, __pyx_n_s_Blosc, __pyx_n_s_Blosc, (PyObject *) NULL, __pyx_n_s_numcodecs_blosc, __pyx_kp_s_Codec_providing_compression_usin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 447, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - /* "numcodecs/blosc.pyx":470 + /* "numcodecs/blosc.pyx":471 * """ * * codec_id = 'blosc' # <<<<<<<<<<<<<< * NOSHUFFLE = NOSHUFFLE * SHUFFLE = SHUFFLE */ - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_codec_id, __pyx_n_s_blosc) < 0) __PYX_ERR(0, 470, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_codec_id, __pyx_n_s_blosc) < 0) __PYX_ERR(0, 471, __pyx_L1_error) - /* "numcodecs/blosc.pyx":471 + /* "numcodecs/blosc.pyx":472 * * codec_id = 'blosc' * NOSHUFFLE = NOSHUFFLE # <<<<<<<<<<<<<< @@ -8056,12 +7289,12 @@ if (!__Pyx_RefNanny) { * BITSHUFFLE = BITSHUFFLE */ __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_NOSHUFFLE); - if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 471, __pyx_L1_error) + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 472, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_NOSHUFFLE, __pyx_t_10) < 0) __PYX_ERR(0, 471, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_NOSHUFFLE, __pyx_t_10) < 0) __PYX_ERR(0, 472, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "numcodecs/blosc.pyx":472 + /* "numcodecs/blosc.pyx":473 * codec_id = 'blosc' * NOSHUFFLE = NOSHUFFLE * SHUFFLE = SHUFFLE # <<<<<<<<<<<<<< @@ -8069,113 +7302,122 @@ if (!__Pyx_RefNanny) { * AUTOSHUFFLE = AUTOSHUFFLE */ __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_SHUFFLE); - if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 472, __pyx_L1_error) + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 473, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_SHUFFLE, __pyx_t_10) < 0) __PYX_ERR(0, 472, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_SHUFFLE, __pyx_t_10) < 0) __PYX_ERR(0, 473, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "numcodecs/blosc.pyx":473 + /* "numcodecs/blosc.pyx":474 * NOSHUFFLE = NOSHUFFLE * SHUFFLE = SHUFFLE * BITSHUFFLE = BITSHUFFLE # <<<<<<<<<<<<<< * AUTOSHUFFLE = AUTOSHUFFLE - * + * max_buffer_size = 2**31 - 1 */ __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_BITSHUFFLE); - if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 473, __pyx_L1_error) + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 474, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_BITSHUFFLE, __pyx_t_10) < 0) __PYX_ERR(0, 473, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_BITSHUFFLE, __pyx_t_10) < 0) __PYX_ERR(0, 474, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "numcodecs/blosc.pyx":474 + /* "numcodecs/blosc.pyx":475 * SHUFFLE = SHUFFLE * BITSHUFFLE = BITSHUFFLE * AUTOSHUFFLE = AUTOSHUFFLE # <<<<<<<<<<<<<< + * max_buffer_size = 2**31 - 1 * - * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): */ __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_AUTOSHUFFLE); - if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 474, __pyx_L1_error) + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 475, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_AUTOSHUFFLE, __pyx_t_10) < 0) __PYX_ERR(0, 474, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_AUTOSHUFFLE, __pyx_t_10) < 0) __PYX_ERR(0, 475, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; /* "numcodecs/blosc.pyx":476 + * BITSHUFFLE = BITSHUFFLE * AUTOSHUFFLE = AUTOSHUFFLE + * max_buffer_size = 2**31 - 1 # <<<<<<<<<<<<<< + * + * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): + */ + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_max_buffer_size, __pyx_int_2147483647) < 0) __PYX_ERR(0, 476, __pyx_L1_error) + + /* "numcodecs/blosc.pyx":478 + * max_buffer_size = 2**31 - 1 * * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): # <<<<<<<<<<<<<< * self.cname = cname * if isinstance(cname, text_type): */ - __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5Blosc_1__init__, 0, __pyx_n_s_Blosc___init, NULL, __pyx_n_s_numcodecs_blosc, __pyx_d, ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 476, __pyx_L1_error) + __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5Blosc_1__init__, 0, __pyx_n_s_Blosc___init, NULL, __pyx_n_s_numcodecs_blosc, __pyx_d, ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 478, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - if (!__Pyx_CyFunction_InitDefaults(__pyx_t_10, sizeof(__pyx_defaults), 2)) __PYX_ERR(0, 476, __pyx_L1_error) + if (!__Pyx_CyFunction_InitDefaults(__pyx_t_10, sizeof(__pyx_defaults), 2)) __PYX_ERR(0, 478, __pyx_L1_error) __pyx_t_11 = PyObject_GetItem(__pyx_t_2, __pyx_n_s_SHUFFLE); if (unlikely(!__pyx_t_11)) { PyErr_Clear(); __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_SHUFFLE); } - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 476, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 478, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_10)->__pyx_arg_shuffle = __pyx_t_11; __Pyx_GIVEREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_AUTOBLOCKS); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 476, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_AUTOBLOCKS); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 478, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_10)->__pyx_arg_blocksize = __pyx_t_11; __Pyx_GIVEREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_10, __pyx_pf_9numcodecs_5blosc_26__defaults__); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init_2, __pyx_t_10) < 0) __PYX_ERR(0, 476, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init_2, __pyx_t_10) < 0) __PYX_ERR(0, 478, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "numcodecs/blosc.pyx":486 + /* "numcodecs/blosc.pyx":488 * self.blocksize = blocksize * * def encode(self, buf): # <<<<<<<<<<<<<< - * self._check_buffer_size(buf) + * buf = ensure_ndarray(buf, self.max_buffer_size) * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) */ - __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5Blosc_3encode, 0, __pyx_n_s_Blosc_encode, NULL, __pyx_n_s_numcodecs_blosc, __pyx_d, ((PyObject *)__pyx_codeobj__31)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 486, __pyx_L1_error) + __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5Blosc_3encode, 0, __pyx_n_s_Blosc_encode, NULL, __pyx_n_s_numcodecs_blosc, __pyx_d, ((PyObject *)__pyx_codeobj__31)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 488, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_encode, __pyx_t_10) < 0) __PYX_ERR(0, 486, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_encode, __pyx_t_10) < 0) __PYX_ERR(0, 488, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "numcodecs/blosc.pyx":490 + /* "numcodecs/blosc.pyx":492 * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) * * def decode(self, buf, out=None): # <<<<<<<<<<<<<< - * self._check_buffer_size(buf) + * buf = ensure_ndarray(buf, self.max_buffer_size) * return decompress(buf, out) */ - __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5Blosc_5decode, 0, __pyx_n_s_Blosc_decode, NULL, __pyx_n_s_numcodecs_blosc, __pyx_d, ((PyObject *)__pyx_codeobj__33)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 490, __pyx_L1_error) + __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5Blosc_5decode, 0, __pyx_n_s_Blosc_decode, NULL, __pyx_n_s_numcodecs_blosc, __pyx_d, ((PyObject *)__pyx_codeobj__33)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 492, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_10, __pyx_tuple__34); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_decode, __pyx_t_10) < 0) __PYX_ERR(0, 490, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_decode, __pyx_t_10) < 0) __PYX_ERR(0, 492, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "numcodecs/blosc.pyx":494 + /* "numcodecs/blosc.pyx":496 * return decompress(buf, out) * * def __repr__(self): # <<<<<<<<<<<<<< * r = '%s(cname=%r, clevel=%r, shuffle=%s, blocksize=%s)' % \ * (type(self).__name__, */ - __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5Blosc_7__repr__, 0, __pyx_n_s_Blosc___repr, NULL, __pyx_n_s_numcodecs_blosc, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 494, __pyx_L1_error) + __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5Blosc_7__repr__, 0, __pyx_n_s_Blosc___repr, NULL, __pyx_n_s_numcodecs_blosc, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 496, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_repr, __pyx_t_10) < 0) __PYX_ERR(0, 494, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_repr, __pyx_t_10) < 0) __PYX_ERR(0, 496, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "numcodecs/blosc.pyx":446 + /* "numcodecs/blosc.pyx":447 * * * class Blosc(Codec): # <<<<<<<<<<<<<< * """Codec providing compression using the Blosc meta-compressor. * */ - __pyx_t_10 = __Pyx_Py3ClassCreate(__pyx_t_9, __pyx_n_s_Blosc, __pyx_t_1, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 446, __pyx_L1_error) + __pyx_t_10 = __Pyx_Py3ClassCreate(__pyx_t_9, __pyx_n_s_Blosc, __pyx_t_1, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 447, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_Blosc, __pyx_t_10) < 0) __PYX_ERR(0, 446, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Blosc, __pyx_t_10) < 0) __PYX_ERR(0, 447, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; @@ -8191,14 +7433,6 @@ if (!__Pyx_RefNanny) { if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "array.pxd":161 - * return extend_buffer(self, other.data.as_chars, Py_SIZE(other)) - * - * cdef inline void zero(array self): # <<<<<<<<<<<<<< - * """ set all elements of array to zero. """ - * memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize) - */ - /*--- Wrapped vars code ---*/ goto __pyx_L0; diff --git a/numcodecs/blosc.pyx b/numcodecs/blosc.pyx index ded03de9..2e99c1fb 100644 --- a/numcodecs/blosc.pyx +++ b/numcodecs/blosc.pyx @@ -16,7 +16,7 @@ from cpython.bytes cimport PyBytes_FromStringAndSize, PyBytes_AS_STRING from .compat_ext cimport Buffer from .compat_ext import Buffer -from .compat import PY2, text_type +from .compat import PY2, text_type, ensure_contiguous_ndarray from .abc import Codec @@ -473,6 +473,7 @@ class Blosc(Codec): SHUFFLE = SHUFFLE BITSHUFFLE = BITSHUFFLE AUTOSHUFFLE = AUTOSHUFFLE + max_buffer_size = 2**31 - 1 def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): self.cname = cname @@ -485,11 +486,11 @@ class Blosc(Codec): self.blocksize = blocksize def encode(self, buf): - self._check_buffer_size(buf) + buf = ensure_contiguous_ndarray(buf, self.max_buffer_size) return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) def decode(self, buf, out=None): - self._check_buffer_size(buf) + buf = ensure_contiguous_ndarray(buf, self.max_buffer_size) return decompress(buf, out) def __repr__(self): diff --git a/numcodecs/compat.py b/numcodecs/compat.py index 10ac223a..bb58b3f7 100644 --- a/numcodecs/compat.py +++ b/numcodecs/compat.py @@ -90,15 +90,20 @@ def ensure_ndarray(buf): return arr -def ensure_contiguous_ndarray(buf): +def ensure_contiguous_ndarray(buf, max_buffer_size=None): """Convenience function to coerce `buf` to a numpy array, if it is not already a numpy array. Also ensures that the returned value exports fully contiguous memory, - and supports the new-style buffer interface. + and supports the new-style buffer interface. If the optional max_buffer_size is + provided, raise a ValueError if the number of bytes consumed by the returned + array exceeds this value. Parameters ---------- buf : array-like or bytes-like A numpy array or any object exporting a buffer interface. + max_buffer_size : int + If specified, the largest allowable value of arr.nbytes, where arr + is the retured array. Returns ------- @@ -132,6 +137,10 @@ def ensure_contiguous_ndarray(buf): else: raise ValueError('an array with contiguous memory is required') + if max_buffer_size is not None and arr.nbytes > max_buffer_size: + msg = "Codec does not support buffers of > {} bytes".format(max_buffer_size) + raise ValueError(msg) + return arr diff --git a/numcodecs/lz4.c b/numcodecs/lz4.c index 84827685..e349e165 100644 --- a/numcodecs/lz4.c +++ b/numcodecs/lz4.c @@ -18,8 +18,8 @@ "name": "numcodecs.lz4", "sources": [ "numcodecs/lz4.pyx", - "c-blosc/internal-complibs/lz4-1.8.1.2/lz4.c", - "c-blosc/internal-complibs/lz4-1.8.1.2/lz4hc.c" + "c-blosc/internal-complibs/lz4-1.8.1.2/lz4hc.c", + "c-blosc/internal-complibs/lz4-1.8.1.2/lz4.c" ] }, "module_name": "numcodecs.lz4" @@ -1357,7 +1357,9 @@ static const char __pyx_k_numcodecs_lz4[] = "numcodecs.lz4"; static const char __pyx_k_source_buffer[] = "source_buffer"; static const char __pyx_k_VERSION_STRING[] = "VERSION_STRING"; static const char __pyx_k_bad_input_data[] = "bad input data"; +static const char __pyx_k_ensure_ndarray[] = "ensure_ndarray"; static const char __pyx_k_compressed_size[] = "compressed_size"; +static const char __pyx_k_max_buffer_size[] = "max_buffer_size"; static const char __pyx_k_s_acceleration_r[] = "%s(acceleration=%r)"; static const char __pyx_k_decompressed_size[] = "decompressed_size"; static const char __pyx_k_numcodecs_lz4_pyx[] = "numcodecs/lz4.pyx"; @@ -1408,10 +1410,12 @@ static PyObject *__pyx_n_s_dest_start; static PyObject *__pyx_kp_s_destination_buffer_too_small_exp; static PyObject *__pyx_n_s_doc; static PyObject *__pyx_n_s_encode; +static PyObject *__pyx_n_s_ensure_ndarray; static PyObject *__pyx_n_s_import; static PyObject *__pyx_n_s_init; static PyObject *__pyx_n_s_lz4; static PyObject *__pyx_n_s_main; +static PyObject *__pyx_n_s_max_buffer_size; static PyObject *__pyx_n_s_metaclass; static PyObject *__pyx_n_s_module; static PyObject *__pyx_n_s_name; @@ -1437,9 +1441,10 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_2decompress(CYTHON_UNUSED PyObject *__ static PyObject *__pyx_pf_9numcodecs_3lz4_4__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_acceleration); /* proto */ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_2encode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_buf); /* proto */ -static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_4decode(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_buf, PyObject *__pyx_v_out); /* proto */ +static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_4decode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_buf, PyObject *__pyx_v_out); /* proto */ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_6__repr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ static PyObject *__pyx_int_1; +static PyObject *__pyx_int_2113929216; static int __pyx_k_; static PyObject *__pyx_tuple__2; static PyObject *__pyx_tuple__3; @@ -2603,8 +2608,8 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_2decompress(CYTHON_UNUSED PyObject *__ return __pyx_r; } -/* "numcodecs/lz4.pyx":215 - * codec_id = 'lz4' +/* "numcodecs/lz4.pyx":216 + * max_buffer_size = 0x7E000000 * * def __init__(self, acceleration=DEFAULT_ACCELERATION): # <<<<<<<<<<<<<< * self.acceleration = acceleration @@ -2618,12 +2623,12 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_4__defaults__(CYTHON_UNUSED PyObject * PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("__defaults__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 215, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_acceleration); __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_acceleration); PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_acceleration); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); @@ -2686,7 +2691,7 @@ static PyObject *__pyx_pw_9numcodecs_3lz4_3LZ4_1__init__(PyObject *__pyx_self, P } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 215, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 216, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -2702,7 +2707,7 @@ static PyObject *__pyx_pw_9numcodecs_3lz4_3LZ4_1__init__(PyObject *__pyx_self, P } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 215, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 216, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.lz4.LZ4.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -2720,17 +2725,17 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4___init__(CYTHON_UNUSED PyObject * __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); - /* "numcodecs/lz4.pyx":216 + /* "numcodecs/lz4.pyx":217 * * def __init__(self, acceleration=DEFAULT_ACCELERATION): * self.acceleration = acceleration # <<<<<<<<<<<<<< * * def encode(self, buf): */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_acceleration, __pyx_v_acceleration) < 0) __PYX_ERR(0, 216, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_acceleration, __pyx_v_acceleration) < 0) __PYX_ERR(0, 217, __pyx_L1_error) - /* "numcodecs/lz4.pyx":215 - * codec_id = 'lz4' + /* "numcodecs/lz4.pyx":216 + * max_buffer_size = 0x7E000000 * * def __init__(self, acceleration=DEFAULT_ACCELERATION): # <<<<<<<<<<<<<< * self.acceleration = acceleration @@ -2749,12 +2754,12 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4___init__(CYTHON_UNUSED PyObject * return __pyx_r; } -/* "numcodecs/lz4.pyx":218 +/* "numcodecs/lz4.pyx":219 * self.acceleration = acceleration * * def encode(self, buf): # <<<<<<<<<<<<<< + * buf = ensure_ndarray(buf, self.max_buffer_size) * return compress(buf, self.acceleration) - * */ /* Python wrapper */ @@ -2790,11 +2795,11 @@ static PyObject *__pyx_pw_9numcodecs_3lz4_3LZ4_3encode(PyObject *__pyx_self, PyO case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buf)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, 1); __PYX_ERR(0, 218, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, 1); __PYX_ERR(0, 219, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode") < 0)) __PYX_ERR(0, 218, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode") < 0)) __PYX_ERR(0, 219, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -2807,7 +2812,7 @@ static PyObject *__pyx_pw_9numcodecs_3lz4_3LZ4_3encode(PyObject *__pyx_self, PyO } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 218, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 219, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.lz4.LZ4.encode", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -2830,18 +2835,18 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_2encode(CYTHON_UNUSED PyObject *_ int __pyx_t_5; PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("encode", 0); + __Pyx_INCREF(__pyx_v_buf); - /* "numcodecs/lz4.pyx":219 + /* "numcodecs/lz4.pyx":220 * * def encode(self, buf): - * return compress(buf, self.acceleration) # <<<<<<<<<<<<<< + * buf = ensure_ndarray(buf, self.max_buffer_size) # <<<<<<<<<<<<<< + * return compress(buf, self.acceleration) * - * def decode(self, buf, out=None): */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_compress); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 219, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ensure_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_acceleration); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 219, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_buffer_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; __pyx_t_5 = 0; @@ -2858,7 +2863,7 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_2encode(CYTHON_UNUSED PyObject *_ #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_buf, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 219, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -2867,14 +2872,14 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_2encode(CYTHON_UNUSED PyObject *_ #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_buf, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 219, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { - __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 219, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; @@ -2885,21 +2890,83 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_2encode(CYTHON_UNUSED PyObject *_ __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_3); __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 219, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_buf, __pyx_t_1); + __pyx_t_1 = 0; + + /* "numcodecs/lz4.pyx":221 + * def encode(self, buf): + * buf = ensure_ndarray(buf, self.max_buffer_size) + * return compress(buf, self.acceleration) # <<<<<<<<<<<<<< + * + * def decode(self, buf, out=None): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_compress); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_acceleration); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_5 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_buf, __pyx_t_6}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_buf, __pyx_t_6}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else + #endif + { + __pyx_t_4 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__pyx_t_3) { + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; + } + __Pyx_INCREF(__pyx_v_buf); + __Pyx_GIVEREF(__pyx_v_buf); + PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_v_buf); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, __pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "numcodecs/lz4.pyx":218 + /* "numcodecs/lz4.pyx":219 * self.acceleration = acceleration * * def encode(self, buf): # <<<<<<<<<<<<<< + * buf = ensure_ndarray(buf, self.max_buffer_size) * return compress(buf, self.acceleration) - * */ /* function exit code */ @@ -2912,17 +2979,18 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_2encode(CYTHON_UNUSED PyObject *_ __Pyx_AddTraceback("numcodecs.lz4.LZ4.encode", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_buf); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "numcodecs/lz4.pyx":221 +/* "numcodecs/lz4.pyx":223 * return compress(buf, self.acceleration) * * def decode(self, buf, out=None): # <<<<<<<<<<<<<< + * buf = ensure_ndarray(buf, self.max_buffer_size) * return decompress(buf, out) - * */ /* Python wrapper */ @@ -2930,7 +2998,7 @@ static PyObject *__pyx_pw_9numcodecs_3lz4_3LZ4_5decode(PyObject *__pyx_self, PyO static char __pyx_doc_9numcodecs_3lz4_3LZ4_4decode[] = "LZ4.decode(self, buf, out=None)"; static PyMethodDef __pyx_mdef_9numcodecs_3lz4_3LZ4_5decode = {"decode", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9numcodecs_3lz4_3LZ4_5decode, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9numcodecs_3lz4_3LZ4_4decode}; static PyObject *__pyx_pw_9numcodecs_3lz4_3LZ4_5decode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - CYTHON_UNUSED PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_self = 0; PyObject *__pyx_v_buf = 0; PyObject *__pyx_v_out = 0; PyObject *__pyx_r = 0; @@ -2962,7 +3030,7 @@ static PyObject *__pyx_pw_9numcodecs_3lz4_3LZ4_5decode(PyObject *__pyx_self, PyO case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buf)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, 1); __PYX_ERR(0, 221, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, 1); __PYX_ERR(0, 223, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -2972,7 +3040,7 @@ static PyObject *__pyx_pw_9numcodecs_3lz4_3LZ4_5decode(PyObject *__pyx_self, PyO } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode") < 0)) __PYX_ERR(0, 221, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode") < 0)) __PYX_ERR(0, 223, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -2990,7 +3058,7 @@ static PyObject *__pyx_pw_9numcodecs_3lz4_3LZ4_5decode(PyObject *__pyx_self, PyO } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 221, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 223, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.lz4.LZ4.decode", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3003,81 +3071,144 @@ static PyObject *__pyx_pw_9numcodecs_3lz4_3LZ4_5decode(PyObject *__pyx_self, PyO return __pyx_r; } -static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_4decode(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_buf, PyObject *__pyx_v_out) { +static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_4decode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_buf, PyObject *__pyx_v_out) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("decode", 0); + __Pyx_INCREF(__pyx_v_buf); - /* "numcodecs/lz4.pyx":222 + /* "numcodecs/lz4.pyx":224 * * def decode(self, buf, out=None): + * buf = ensure_ndarray(buf, self.max_buffer_size) # <<<<<<<<<<<<<< + * return decompress(buf, out) + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ensure_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_buffer_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_5 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_buf, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_buf, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else + #endif + { + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__pyx_t_4) { + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; + } + __Pyx_INCREF(__pyx_v_buf); + __Pyx_GIVEREF(__pyx_v_buf); + PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_buf); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_buf, __pyx_t_1); + __pyx_t_1 = 0; + + /* "numcodecs/lz4.pyx":225 + * def decode(self, buf, out=None): + * buf = ensure_ndarray(buf, self.max_buffer_size) * return decompress(buf, out) # <<<<<<<<<<<<<< * * def __repr__(self): */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_decompress); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 222, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_decompress); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - __pyx_t_4 = 0; + __pyx_t_6 = NULL; + __pyx_t_5 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_4 = 1; + __pyx_t_5 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_buf, __pyx_v_out}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_buf, __pyx_v_out}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_buf, __pyx_v_out}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_buf, __pyx_v_out}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif { - __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 222, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__pyx_t_3) { - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; + __pyx_t_3 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__pyx_t_6) { + __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __pyx_t_6 = NULL; } __Pyx_INCREF(__pyx_v_buf); __Pyx_GIVEREF(__pyx_v_buf); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_buf); + PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_5, __pyx_v_buf); __Pyx_INCREF(__pyx_v_out); __Pyx_GIVEREF(__pyx_v_out); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_out); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error) + PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_5, __pyx_v_out); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "numcodecs/lz4.pyx":221 + /* "numcodecs/lz4.pyx":223 * return compress(buf, self.acceleration) * * def decode(self, buf, out=None): # <<<<<<<<<<<<<< + * buf = ensure_ndarray(buf, self.max_buffer_size) * return decompress(buf, out) - * */ /* function exit code */ @@ -3085,16 +3216,18 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_4decode(CYTHON_UNUSED PyObject *_ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("numcodecs.lz4.LZ4.decode", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_buf); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "numcodecs/lz4.pyx":224 +/* "numcodecs/lz4.pyx":227 * return decompress(buf, out) * * def __repr__(self): # <<<<<<<<<<<<<< @@ -3126,33 +3259,33 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_6__repr__(CYTHON_UNUSED PyObject PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("__repr__", 0); - /* "numcodecs/lz4.pyx":226 + /* "numcodecs/lz4.pyx":229 * def __repr__(self): * r = '%s(acceleration=%r)' % \ * (type(self).__name__, # <<<<<<<<<<<<<< * self.acceleration) * return r */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_self)), __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_self)), __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - /* "numcodecs/lz4.pyx":227 + /* "numcodecs/lz4.pyx":230 * r = '%s(acceleration=%r)' % \ * (type(self).__name__, * self.acceleration) # <<<<<<<<<<<<<< * return r */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_acceleration); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 227, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_acceleration); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 230, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - /* "numcodecs/lz4.pyx":226 + /* "numcodecs/lz4.pyx":229 * def __repr__(self): * r = '%s(acceleration=%r)' % \ * (type(self).__name__, # <<<<<<<<<<<<<< * self.acceleration) * return r */ - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 226, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); @@ -3161,20 +3294,20 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_6__repr__(CYTHON_UNUSED PyObject __pyx_t_1 = 0; __pyx_t_2 = 0; - /* "numcodecs/lz4.pyx":225 + /* "numcodecs/lz4.pyx":228 * * def __repr__(self): * r = '%s(acceleration=%r)' % \ # <<<<<<<<<<<<<< * (type(self).__name__, * self.acceleration) */ - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_s_acceleration_r, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 225, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_s_acceleration_r, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/lz4.pyx":228 + /* "numcodecs/lz4.pyx":231 * (type(self).__name__, * self.acceleration) * return r # <<<<<<<<<<<<<< @@ -3184,7 +3317,7 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_6__repr__(CYTHON_UNUSED PyObject __pyx_r = __pyx_v_r; goto __pyx_L0; - /* "numcodecs/lz4.pyx":224 + /* "numcodecs/lz4.pyx":227 * return decompress(buf, out) * * def __repr__(self): # <<<<<<<<<<<<<< @@ -3291,10 +3424,12 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_destination_buffer_too_small_exp, __pyx_k_destination_buffer_too_small_exp, sizeof(__pyx_k_destination_buffer_too_small_exp), 0, 0, 1, 0}, {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, + {&__pyx_n_s_ensure_ndarray, __pyx_k_ensure_ndarray, sizeof(__pyx_k_ensure_ndarray), 0, 0, 1, 1}, {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, {&__pyx_n_s_lz4, __pyx_k_lz4, sizeof(__pyx_k_lz4), 0, 0, 1, 1}, {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, + {&__pyx_n_s_max_buffer_size, __pyx_k_max_buffer_size, sizeof(__pyx_k_max_buffer_size), 0, 0, 1, 1}, {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1}, {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1}, {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, @@ -3375,56 +3510,56 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(__pyx_tuple__6); __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(2, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_lz4_pyx, __pyx_n_s_decompress, 124, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 124, __pyx_L1_error) - /* "numcodecs/lz4.pyx":215 - * codec_id = 'lz4' + /* "numcodecs/lz4.pyx":216 + * max_buffer_size = 0x7E000000 * * def __init__(self, acceleration=DEFAULT_ACCELERATION): # <<<<<<<<<<<<<< * self.acceleration = acceleration * */ - __pyx_tuple__8 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_acceleration); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 215, __pyx_L1_error) + __pyx_tuple__8 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_acceleration); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8); - __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_lz4_pyx, __pyx_n_s_init, 215, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 215, __pyx_L1_error) + __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_lz4_pyx, __pyx_n_s_init, 216, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 216, __pyx_L1_error) - /* "numcodecs/lz4.pyx":218 + /* "numcodecs/lz4.pyx":219 * self.acceleration = acceleration * * def encode(self, buf): # <<<<<<<<<<<<<< + * buf = ensure_ndarray(buf, self.max_buffer_size) * return compress(buf, self.acceleration) - * */ - __pyx_tuple__10 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_buf); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 218, __pyx_L1_error) + __pyx_tuple__10 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_buf); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 219, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); - __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_lz4_pyx, __pyx_n_s_encode, 218, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 218, __pyx_L1_error) + __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_lz4_pyx, __pyx_n_s_encode, 219, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 219, __pyx_L1_error) - /* "numcodecs/lz4.pyx":221 + /* "numcodecs/lz4.pyx":223 * return compress(buf, self.acceleration) * * def decode(self, buf, out=None): # <<<<<<<<<<<<<< + * buf = ensure_ndarray(buf, self.max_buffer_size) * return decompress(buf, out) - * */ - __pyx_tuple__12 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_buf, __pyx_n_s_out); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 221, __pyx_L1_error) + __pyx_tuple__12 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_buf, __pyx_n_s_out); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12); - __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_lz4_pyx, __pyx_n_s_decode, 221, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 221, __pyx_L1_error) - __pyx_tuple__14 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 221, __pyx_L1_error) + __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_lz4_pyx, __pyx_n_s_decode, 223, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 223, __pyx_L1_error) + __pyx_tuple__14 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__14); __Pyx_GIVEREF(__pyx_tuple__14); - /* "numcodecs/lz4.pyx":224 + /* "numcodecs/lz4.pyx":227 * return decompress(buf, out) * * def __repr__(self): # <<<<<<<<<<<<<< * r = '%s(acceleration=%r)' % \ * (type(self).__name__, */ - __pyx_tuple__15 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_r); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 224, __pyx_L1_error) + __pyx_tuple__15 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_r); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 227, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__15); __Pyx_GIVEREF(__pyx_tuple__15); - __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_lz4_pyx, __pyx_n_s_repr, 224, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 224, __pyx_L1_error) + __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_lz4_pyx, __pyx_n_s_repr, 227, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 227, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -3435,6 +3570,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_2113929216 = PyInt_FromLong(2113929216L); if (unlikely(!__pyx_int_2113929216)) __PYX_ERR(0, 1, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -3733,7 +3869,7 @@ if (!__Pyx_RefNanny) { * * from .compat_ext cimport Buffer * from .compat_ext import Buffer # <<<<<<<<<<<<<< - * from .compat import PY2 + * from .compat import PY2, ensure_ndarray * from .abc import Codec */ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error) @@ -3749,15 +3885,18 @@ if (!__Pyx_RefNanny) { /* "numcodecs/lz4.pyx":16 * from .compat_ext cimport Buffer * from .compat_ext import Buffer - * from .compat import PY2 # <<<<<<<<<<<<<< + * from .compat import PY2, ensure_ndarray # <<<<<<<<<<<<<< * from .abc import Codec * */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) + __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_PY2); __Pyx_GIVEREF(__pyx_n_s_PY2); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PY2); + __Pyx_INCREF(__pyx_n_s_ensure_ndarray); + __Pyx_GIVEREF(__pyx_n_s_ensure_ndarray); + PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_ensure_ndarray); __pyx_t_1 = __Pyx_Import(__pyx_n_s_compat, __pyx_t_2, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -3765,11 +3904,15 @@ if (!__Pyx_RefNanny) { __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_PY2, __pyx_t_2) < 0) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ensure_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ensure_ndarray, __pyx_t_2) < 0) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "numcodecs/lz4.pyx":17 * from .compat_ext import Buffer - * from .compat import PY2 + * from .compat import PY2, ensure_ndarray * from .abc import Codec # <<<<<<<<<<<<<< * * @@ -3919,65 +4062,74 @@ if (!__Pyx_RefNanny) { * """ * * codec_id = 'lz4' # <<<<<<<<<<<<<< + * max_buffer_size = 0x7E000000 * - * def __init__(self, acceleration=DEFAULT_ACCELERATION): */ if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_codec_id, __pyx_n_s_lz4) < 0) __PYX_ERR(0, 213, __pyx_L1_error) - /* "numcodecs/lz4.pyx":215 + /* "numcodecs/lz4.pyx":214 + * * codec_id = 'lz4' + * max_buffer_size = 0x7E000000 # <<<<<<<<<<<<<< + * + * def __init__(self, acceleration=DEFAULT_ACCELERATION): + */ + if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_max_buffer_size, __pyx_int_2113929216) < 0) __PYX_ERR(0, 214, __pyx_L1_error) + + /* "numcodecs/lz4.pyx":216 + * max_buffer_size = 0x7E000000 * * def __init__(self, acceleration=DEFAULT_ACCELERATION): # <<<<<<<<<<<<<< * self.acceleration = acceleration * */ - __pyx_t_7 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_3lz4_3LZ4_1__init__, 0, __pyx_n_s_LZ4___init, NULL, __pyx_n_s_numcodecs_lz4, __pyx_d, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 215, __pyx_L1_error) + __pyx_t_7 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_3lz4_3LZ4_1__init__, 0, __pyx_n_s_LZ4___init, NULL, __pyx_n_s_numcodecs_lz4, __pyx_d, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - if (!__Pyx_CyFunction_InitDefaults(__pyx_t_7, sizeof(__pyx_defaults), 1)) __PYX_ERR(0, 215, __pyx_L1_error) - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_DEFAULT_ACCELERATION); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 215, __pyx_L1_error) + if (!__Pyx_CyFunction_InitDefaults(__pyx_t_7, sizeof(__pyx_defaults), 1)) __PYX_ERR(0, 216, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_DEFAULT_ACCELERATION); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_7)->__pyx_arg_acceleration = __pyx_t_8; __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_7, __pyx_pf_9numcodecs_3lz4_4__defaults__); - if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_init, __pyx_t_7) < 0) __PYX_ERR(0, 215, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_init, __pyx_t_7) < 0) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/lz4.pyx":218 + /* "numcodecs/lz4.pyx":219 * self.acceleration = acceleration * * def encode(self, buf): # <<<<<<<<<<<<<< + * buf = ensure_ndarray(buf, self.max_buffer_size) * return compress(buf, self.acceleration) - * */ - __pyx_t_7 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_3lz4_3LZ4_3encode, 0, __pyx_n_s_LZ4_encode, NULL, __pyx_n_s_numcodecs_lz4, __pyx_d, ((PyObject *)__pyx_codeobj__11)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 218, __pyx_L1_error) + __pyx_t_7 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_3lz4_3LZ4_3encode, 0, __pyx_n_s_LZ4_encode, NULL, __pyx_n_s_numcodecs_lz4, __pyx_d, ((PyObject *)__pyx_codeobj__11)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 219, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_encode, __pyx_t_7) < 0) __PYX_ERR(0, 218, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_encode, __pyx_t_7) < 0) __PYX_ERR(0, 219, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/lz4.pyx":221 + /* "numcodecs/lz4.pyx":223 * return compress(buf, self.acceleration) * * def decode(self, buf, out=None): # <<<<<<<<<<<<<< + * buf = ensure_ndarray(buf, self.max_buffer_size) * return decompress(buf, out) - * */ - __pyx_t_7 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_3lz4_3LZ4_5decode, 0, __pyx_n_s_LZ4_decode, NULL, __pyx_n_s_numcodecs_lz4, __pyx_d, ((PyObject *)__pyx_codeobj__13)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 221, __pyx_L1_error) + __pyx_t_7 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_3lz4_3LZ4_5decode, 0, __pyx_n_s_LZ4_decode, NULL, __pyx_n_s_numcodecs_lz4, __pyx_d, ((PyObject *)__pyx_codeobj__13)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__14); - if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_decode, __pyx_t_7) < 0) __PYX_ERR(0, 221, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_decode, __pyx_t_7) < 0) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/lz4.pyx":224 + /* "numcodecs/lz4.pyx":227 * return decompress(buf, out) * * def __repr__(self): # <<<<<<<<<<<<<< * r = '%s(acceleration=%r)' % \ * (type(self).__name__, */ - __pyx_t_7 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_3lz4_3LZ4_7__repr__, 0, __pyx_n_s_LZ4___repr, NULL, __pyx_n_s_numcodecs_lz4, __pyx_d, ((PyObject *)__pyx_codeobj__16)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 224, __pyx_L1_error) + __pyx_t_7 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_3lz4_3LZ4_7__repr__, 0, __pyx_n_s_LZ4___repr, NULL, __pyx_n_s_numcodecs_lz4, __pyx_d, ((PyObject *)__pyx_codeobj__16)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 227, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_repr, __pyx_t_7) < 0) __PYX_ERR(0, 224, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_repr, __pyx_t_7) < 0) __PYX_ERR(0, 227, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; /* "numcodecs/lz4.pyx":198 diff --git a/numcodecs/lz4.pyx b/numcodecs/lz4.pyx index 0128ce96..172e91c3 100644 --- a/numcodecs/lz4.pyx +++ b/numcodecs/lz4.pyx @@ -13,7 +13,7 @@ from cpython.bytes cimport PyBytes_FromStringAndSize, PyBytes_AS_STRING from .compat_ext cimport Buffer from .compat_ext import Buffer -from .compat import PY2 +from .compat import PY2, ensure_contiguous_ndarray from .abc import Codec @@ -211,14 +211,17 @@ class LZ4(Codec): """ codec_id = 'lz4' + max_buffer_size = 0x7E000000 def __init__(self, acceleration=DEFAULT_ACCELERATION): self.acceleration = acceleration def encode(self, buf): + buf = ensure_contiguous_ndarray(buf, self.max_buffer_size) return compress(buf, self.acceleration) def decode(self, buf, out=None): + buf = ensure_contiguous_ndarray(buf, self.max_buffer_size) return decompress(buf, out) def __repr__(self): diff --git a/numcodecs/tests/common.py b/numcodecs/tests/common.py index f91ddd15..c9558e7e 100644 --- a/numcodecs/tests/common.py +++ b/numcodecs/tests/common.py @@ -250,3 +250,27 @@ def check_err_encode_object_buffer(compressor): a = np.array(['foo', 'bar', 'baz'], dtype=object) with pytest.raises(TypeError): compressor.encode(a) + + +def check_max_buffer_size(codec): + for max_buffer_size in [4, 64, 1024]: + old_max_buffer_size = codec.max_buffer_size + try: + codec.max_buffer_size = max_buffer_size + # Just up the max_buffer_size is fine. + codec.encode(np.zeros(max_buffer_size - 1, dtype=np.int8)) + codec.encode(np.zeros(max_buffer_size, dtype=np.int8)) + + buffers = [ + bytes(b"x" * (max_buffer_size + 1)), + np.zeros(max_buffer_size + 1, dtype=np.int8), + np.zeros(max_buffer_size + 2, dtype=np.int8), + np.zeros(max_buffer_size, dtype=np.int16), + np.zeros(max_buffer_size, dtype=np.int32)] + for buf in buffers: + with pytest.raises(ValueError): + codec.encode(buf) + with pytest.raises(ValueError): + codec.decode(buf) + finally: + codec.max_buffer_size = old_max_buffer_size diff --git a/numcodecs/tests/test_blosc.py b/numcodecs/tests/test_blosc.py index 7396bdfd..8a6ef395 100644 --- a/numcodecs/tests/test_blosc.py +++ b/numcodecs/tests/test_blosc.py @@ -14,7 +14,8 @@ from numcodecs.tests.common import (check_encode_decode, check_config, check_backwards_compatibility, check_err_decode_object_buffer, - check_err_encode_object_buffer) + check_err_encode_object_buffer, + check_max_buffer_size) codecs = [ @@ -241,25 +242,6 @@ def test_decompression_error_handling(): def test_max_buffer_size(): - for max_buffer_size in [4, 64, 1024]: - for codec in codecs: - old_max_buffer_size = codec.max_buffer_size - try: - codec.max_buffer_size = max_buffer_size - # Just up the max_buffer_size is fine. - codec.encode(np.zeros(max_buffer_size - 1, dtype=np.int8)) - codec.encode(np.zeros(max_buffer_size, dtype=np.int8)) - - buffers = [ - bytes(b"x" * (max_buffer_size + 1)), - np.zeros(max_buffer_size + 1, dtype=np.int8), - np.zeros(max_buffer_size + 2, dtype=np.int8), - np.zeros(max_buffer_size, dtype=np.int16), - np.zeros(max_buffer_size, dtype=np.int32)] - for buf in buffers: - with pytest.raises(ValueError): - codec.encode(buf) - with pytest.raises(ValueError): - codec.decode(buf) - finally: - codec.max_buffer_size = old_max_buffer_size + for codec in codecs: + assert codec.max_buffer_size == 2**31 - 1 + check_max_buffer_size(codec) diff --git a/numcodecs/tests/test_compat.py b/numcodecs/tests/test_compat.py index 80a570ca..53311ff4 100644 --- a/numcodecs/tests/test_compat.py +++ b/numcodecs/tests/test_compat.py @@ -87,3 +87,20 @@ def test_ensure_contiguous_ndarray_writeable(): if PY2: # pragma: py3 no cover m = ensure_contiguous_ndarray(np.getbuffer(a)) assert m.flags.writeable == writeable + + +def test_ensure_contiguous_ndarray_max_buffer_size(): + for max_buffer_size in [4, 64, 1024]: + ensure_contiguous_ndarray( + np.zeros(max_buffer_size - 1, dtype=np.int8), max_buffer_size) + ensure_contiguous_ndarray( + np.zeros(max_buffer_size, dtype=np.int8), max_buffer_size) + buffers = [ + bytes(b"x" * (max_buffer_size + 1)), + np.zeros(max_buffer_size + 1, dtype=np.int8), + np.zeros(max_buffer_size + 2, dtype=np.int8), + np.zeros(max_buffer_size, dtype=np.int16), + np.zeros(max_buffer_size, dtype=np.int32)] + for buf in buffers: + with pytest.raises(ValueError): + ensure_contiguous_ndarray(buf, max_buffer_size=max_buffer_size) diff --git a/numcodecs/tests/test_lz4.py b/numcodecs/tests/test_lz4.py index 0bd4d595..e4e88652 100644 --- a/numcodecs/tests/test_lz4.py +++ b/numcodecs/tests/test_lz4.py @@ -10,7 +10,8 @@ from numcodecs.tests.common import (check_encode_decode, check_config, check_repr, check_backwards_compatibility, check_err_decode_object_buffer, - check_err_encode_object_buffer) + check_err_encode_object_buffer, + check_max_buffer_size) codecs = [ @@ -69,3 +70,9 @@ def test_err_decode_object_buffer(): def test_err_encode_object_buffer(): check_err_encode_object_buffer(LZ4()) + + +def test_max_buffer_size(): + for codec in codecs: + assert codec.max_buffer_size == 0x7E000000 + check_max_buffer_size(codec) From 2b091fa44873e595eee98ab2f0369df59aa2fd7a Mon Sep 17 00:00:00 2001 From: Jerome Kelleher Date: Thu, 29 Nov 2018 10:11:59 +0000 Subject: [PATCH 5/7] Removed conversion to array in Buffer. --- numcodecs/blosc.c | 708 +++++++++++++++++---------------- numcodecs/blosc.pyx | 3 +- numcodecs/compat_ext.c | 299 +++++--------- numcodecs/compat_ext.pyx | 3 +- numcodecs/lz4.c | 422 +++++++++++--------- numcodecs/lz4.pyx | 3 +- numcodecs/zstd.c | 833 +++++++++++++++++++++++---------------- numcodecs/zstd.pyx | 10 +- 8 files changed, 1206 insertions(+), 1075 deletions(-) diff --git a/numcodecs/blosc.c b/numcodecs/blosc.c index b918d00d..4b3a0638 100644 --- a/numcodecs/blosc.c +++ b/numcodecs/blosc.c @@ -32,69 +32,69 @@ ], "include_dirs": [ "c-blosc/blosc", - "c-blosc/internal-complibs/snappy-1.1.1", - "c-blosc/internal-complibs/zlib-1.2.8", "c-blosc/internal-complibs/lz4-1.8.1.2", + "c-blosc/internal-complibs/zlib-1.2.8", "c-blosc/internal-complibs/zstd-1.3.4", + "c-blosc/internal-complibs/snappy-1.1.1", + "c-blosc/internal-complibs/zstd-1.3.4/compress", + "c-blosc/internal-complibs/zstd-1.3.4/legacy", "c-blosc/internal-complibs/zstd-1.3.4/deprecated", - "c-blosc/internal-complibs/zstd-1.3.4/dll", "c-blosc/internal-complibs/zstd-1.3.4/dictBuilder", "c-blosc/internal-complibs/zstd-1.3.4/decompress", - "c-blosc/internal-complibs/zstd-1.3.4/legacy", - "c-blosc/internal-complibs/zstd-1.3.4/compress", - "c-blosc/internal-complibs/zstd-1.3.4/common" + "c-blosc/internal-complibs/zstd-1.3.4/common", + "c-blosc/internal-complibs/zstd-1.3.4/dll" ], "name": "numcodecs.blosc", "sources": [ "numcodecs/blosc.pyx", + "c-blosc/blosc/fastcopy.c", "c-blosc/blosc/blosc.c", "c-blosc/blosc/shuffle.c", - "c-blosc/blosc/shuffle-generic.c", "c-blosc/blosc/bitshuffle-generic.c", + "c-blosc/blosc/shuffle-generic.c", "c-blosc/blosc/blosclz.c", - "c-blosc/blosc/fastcopy.c", - "c-blosc/internal-complibs/lz4-1.8.1.2/lz4hc.c", "c-blosc/internal-complibs/lz4-1.8.1.2/lz4.c", - "c-blosc/internal-complibs/snappy-1.1.1/snappy-c.cc", - "c-blosc/internal-complibs/snappy-1.1.1/snappy-sinksource.cc", + "c-blosc/internal-complibs/lz4-1.8.1.2/lz4hc.c", "c-blosc/internal-complibs/snappy-1.1.1/snappy.cc", + "c-blosc/internal-complibs/snappy-1.1.1/snappy-sinksource.cc", "c-blosc/internal-complibs/snappy-1.1.1/snappy-stubs-internal.cc", - "c-blosc/internal-complibs/zlib-1.2.8/infback.c", - "c-blosc/internal-complibs/zlib-1.2.8/uncompr.c", - "c-blosc/internal-complibs/zlib-1.2.8/adler32.c", - "c-blosc/internal-complibs/zlib-1.2.8/gzlib.c", - "c-blosc/internal-complibs/zlib-1.2.8/inftrees.c", - "c-blosc/internal-complibs/zlib-1.2.8/gzclose.c", + "c-blosc/internal-complibs/snappy-1.1.1/snappy-c.cc", "c-blosc/internal-complibs/zlib-1.2.8/zutil.c", - "c-blosc/internal-complibs/zlib-1.2.8/inflate.c", - "c-blosc/internal-complibs/zlib-1.2.8/inffast.c", - "c-blosc/internal-complibs/zlib-1.2.8/gzread.c", "c-blosc/internal-complibs/zlib-1.2.8/compress.c", - "c-blosc/internal-complibs/zlib-1.2.8/trees.c", + "c-blosc/internal-complibs/zlib-1.2.8/inftrees.c", + "c-blosc/internal-complibs/zlib-1.2.8/adler32.c", + "c-blosc/internal-complibs/zlib-1.2.8/inffast.c", "c-blosc/internal-complibs/zlib-1.2.8/crc32.c", + "c-blosc/internal-complibs/zlib-1.2.8/trees.c", "c-blosc/internal-complibs/zlib-1.2.8/deflate.c", + "c-blosc/internal-complibs/zlib-1.2.8/gzclose.c", "c-blosc/internal-complibs/zlib-1.2.8/gzwrite.c", - "c-blosc/internal-complibs/zstd-1.3.4/common/xxhash.c", + "c-blosc/internal-complibs/zlib-1.2.8/uncompr.c", + "c-blosc/internal-complibs/zlib-1.2.8/gzread.c", + "c-blosc/internal-complibs/zlib-1.2.8/infback.c", + "c-blosc/internal-complibs/zlib-1.2.8/gzlib.c", + "c-blosc/internal-complibs/zlib-1.2.8/inflate.c", "c-blosc/internal-complibs/zstd-1.3.4/common/error_private.c", + "c-blosc/internal-complibs/zstd-1.3.4/common/xxhash.c", "c-blosc/internal-complibs/zstd-1.3.4/common/zstd_common.c", - "c-blosc/internal-complibs/zstd-1.3.4/common/pool.c", "c-blosc/internal-complibs/zstd-1.3.4/common/entropy_common.c", - "c-blosc/internal-complibs/zstd-1.3.4/common/threading.c", "c-blosc/internal-complibs/zstd-1.3.4/common/fse_decompress.c", + "c-blosc/internal-complibs/zstd-1.3.4/common/threading.c", + "c-blosc/internal-complibs/zstd-1.3.4/common/pool.c", "c-blosc/internal-complibs/zstd-1.3.4/compress/huf_compress.c", "c-blosc/internal-complibs/zstd-1.3.4/compress/zstdmt_compress.c", - "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_compress.c", - "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_fast.c", - "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_double_fast.c", - "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_ldm.c", "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_lazy.c", + "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_fast.c", "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_opt.c", + "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_double_fast.c", "c-blosc/internal-complibs/zstd-1.3.4/compress/fse_compress.c", - "c-blosc/internal-complibs/zstd-1.3.4/decompress/zstd_decompress.c", + "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_compress.c", + "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_ldm.c", "c-blosc/internal-complibs/zstd-1.3.4/decompress/huf_decompress.c", + "c-blosc/internal-complibs/zstd-1.3.4/decompress/zstd_decompress.c", + "c-blosc/internal-complibs/zstd-1.3.4/dictBuilder/zdict.c", "c-blosc/internal-complibs/zstd-1.3.4/dictBuilder/cover.c", "c-blosc/internal-complibs/zstd-1.3.4/dictBuilder/divsufsort.c", - "c-blosc/internal-complibs/zstd-1.3.4/dictBuilder/zdict.c", "c-blosc/blosc/bitshuffle-sse2.c", "c-blosc/blosc/shuffle-sse2.c", "c-blosc/blosc/shuffle-avx2.c", @@ -1521,6 +1521,7 @@ static const char __pyx_k_s[] = "s"; static const char __pyx_k_os[] = "os"; static const char __pyx_k_PY2[] = "PY2"; static const char __pyx_k_abc[] = "abc"; +static const char __pyx_k_arr[] = "arr"; static const char __pyx_k_buf[] = "buf"; static const char __pyx_k_doc[] = "__doc__"; static const char __pyx_k_lz4[] = "lz4"; @@ -1617,7 +1618,6 @@ static const char __pyx_k_MAX_BUFFERSIZE[] = "MAX_BUFFERSIZE"; static const char __pyx_k_VERSION_STRING[] = "VERSION_STRING"; static const char __pyx_k_compressor_set[] = "compressor_set"; static const char __pyx_k_current_thread[] = "current_thread"; -static const char __pyx_k_ensure_ndarray[] = "ensure_ndarray"; static const char __pyx_k_cbuffer_complib[] = "cbuffer_complib"; static const char __pyx_k_current_process[] = "current_process"; static const char __pyx_k_get_use_threads[] = "_get_use_threads"; @@ -1629,6 +1629,7 @@ static const char __pyx_k_list_compressors[] = "list_compressors"; static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; static const char __pyx_k_numcodecs_blosc_pyx[] = "numcodecs/blosc.pyx"; static const char __pyx_k_compname_to_compcode[] = "compname_to_compcode"; +static const char __pyx_k_ensure_contiguous_ndarray[] = "ensure_contiguous_ndarray"; static const char __pyx_k_s_cname_r_clevel_r_shuffle_s_bl[] = "%s(cname=%r, clevel=%r, shuffle=%s, blocksize=%s)"; static const char __pyx_k_Codec_providing_compression_usin[] = "Codec providing compression using the Blosc meta-compressor.\n\n Parameters\n ----------\n cname : string, optional\n A string naming one of the compression algorithms available within blosc, e.g.,\n 'zstd', 'blosclz', 'lz4', 'lz4hc', 'zlib' or 'snappy'.\n clevel : integer, optional\n An integer between 0 and 9 specifying the compression level.\n shuffle : integer, optional\n Either NOSHUFFLE (0), SHUFFLE (1), BITSHUFFLE (2) or AUTOSHUFFLE (-1). If -1\n (default), bit-shuffle will be used for buffers with itemsize 1,\n and byte-shuffle will be used otherwise.\n blocksize : int\n The requested size of the compressed blocks. If 0 (default), an automatic\n blocksize will be used.\n\n See Also\n --------\n numcodecs.zstd.Zstd, numcodecs.lz4.LZ4\n\n "; static const char __pyx_k_bad_compressor_or_compressor_not[] = "bad compressor or compressor not supported: %r; expected one of %s"; @@ -1664,6 +1665,7 @@ static PyObject *__pyx_n_s_VERSION_DATE; static PyObject *__pyx_n_s_VERSION_STRING; static PyObject *__pyx_n_s_ValueError; static PyObject *__pyx_n_s_abc; +static PyObject *__pyx_n_s_arr; static PyObject *__pyx_n_s_ascii; static PyObject *__pyx_kp_s_bad_compressor_or_compressor_not; static PyObject *__pyx_n_s_blocksize; @@ -1698,7 +1700,7 @@ static PyObject *__pyx_kp_s_destination_buffer_too_small_exp; static PyObject *__pyx_n_s_destroy; static PyObject *__pyx_n_s_doc; static PyObject *__pyx_n_s_encode; -static PyObject *__pyx_n_s_ensure_ndarray; +static PyObject *__pyx_n_s_ensure_contiguous_ndarray; static PyObject *__pyx_n_s_enter; static PyObject *__pyx_n_s_err_bad_cname; static PyObject *__pyx_kp_s_error_during_blosc_compression_d; @@ -4005,6 +4007,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject size_t __pyx_v_cbytes; size_t __pyx_v_blocksize; size_t __pyx_v_dest_nbytes; + PyObject *__pyx_v_arr = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4012,8 +4015,8 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject char *__pyx_t_3; int __pyx_t_4; int __pyx_t_5; - size_t __pyx_t_6; - PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; int __pyx_t_8; int __pyx_t_9; char const *__pyx_t_10; @@ -4115,7 +4118,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject * dest_ptr = PyBytes_AS_STRING(dest) * dest_nbytes = nbytes # <<<<<<<<<<<<<< * else: - * dest_buffer = Buffer(dest, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) + * arr = ensure_contiguous_ndarray(dest) */ __pyx_v_dest_nbytes = __pyx_v_nbytes; @@ -4132,30 +4135,57 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject /* "numcodecs/blosc.pyx":369 * dest_nbytes = nbytes * else: - * dest_buffer = Buffer(dest, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) # <<<<<<<<<<<<<< + * arr = ensure_contiguous_ndarray(dest) # <<<<<<<<<<<<<< + * dest_buffer = Buffer(arr, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) * dest_ptr = dest_buffer.ptr - * dest_nbytes = dest_buffer.nbytes */ /*else*/ { - __pyx_t_1 = __Pyx_PyInt_From_int((PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 369, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ensure_contiguous_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 369, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_6, __pyx_v_dest) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_dest); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 369, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_arr = __pyx_t_1; + __pyx_t_1 = 0; + + /* "numcodecs/blosc.pyx":370 + * else: + * arr = ensure_contiguous_ndarray(dest) + * dest_buffer = Buffer(arr, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) # <<<<<<<<<<<<<< + * dest_ptr = dest_buffer.ptr + * dest_nbytes = dest_buffer.nbytes + */ + __pyx_t_1 = __Pyx_PyInt_From_int((PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 370, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 369, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 370, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_dest); - __Pyx_GIVEREF(__pyx_v_dest); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_dest); + __Pyx_INCREF(__pyx_v_arr); + __Pyx_GIVEREF(__pyx_v_arr); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_arr); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 369, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 370, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF_SET(__pyx_v_dest_buffer, ((struct __pyx_obj_9numcodecs_10compat_ext_Buffer *)__pyx_t_1)); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":370 - * else: - * dest_buffer = Buffer(dest, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) + /* "numcodecs/blosc.pyx":371 + * arr = ensure_contiguous_ndarray(dest) + * dest_buffer = Buffer(arr, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) * dest_ptr = dest_buffer.ptr # <<<<<<<<<<<<<< * dest_nbytes = dest_buffer.nbytes * @@ -4163,19 +4193,19 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_t_3 = __pyx_v_dest_buffer->ptr; __pyx_v_dest_ptr = __pyx_t_3; - /* "numcodecs/blosc.pyx":371 - * dest_buffer = Buffer(dest, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) + /* "numcodecs/blosc.pyx":372 + * dest_buffer = Buffer(arr, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) * dest_ptr = dest_buffer.ptr * dest_nbytes = dest_buffer.nbytes # <<<<<<<<<<<<<< * * try: */ - __pyx_t_6 = __pyx_v_dest_buffer->nbytes; - __pyx_v_dest_nbytes = __pyx_t_6; + __pyx_t_7 = __pyx_v_dest_buffer->nbytes; + __pyx_v_dest_nbytes = __pyx_t_7; } __pyx_L3:; - /* "numcodecs/blosc.pyx":373 + /* "numcodecs/blosc.pyx":374 * dest_nbytes = dest_buffer.nbytes * * try: # <<<<<<<<<<<<<< @@ -4184,7 +4214,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject */ /*try:*/ { - /* "numcodecs/blosc.pyx":376 + /* "numcodecs/blosc.pyx":377 * * # guard condition * if dest_nbytes < nbytes: # <<<<<<<<<<<<<< @@ -4194,44 +4224,44 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_t_5 = ((__pyx_v_dest_nbytes < __pyx_v_nbytes) != 0); if (unlikely(__pyx_t_5)) { - /* "numcodecs/blosc.pyx":378 + /* "numcodecs/blosc.pyx":379 * if dest_nbytes < nbytes: * raise ValueError('destination buffer too small; expected at least %s, ' * 'got %s' % (nbytes, dest_nbytes)) # <<<<<<<<<<<<<< * * # perform decompression */ - __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_nbytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 378, __pyx_L5_error) + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_nbytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 379, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_dest_nbytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 378, __pyx_L5_error) + __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_dest_nbytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 379, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 378, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 379, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_destination_buffer_too_small_exp, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 378, __pyx_L5_error) + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_destination_buffer_too_small_exp, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 379, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "numcodecs/blosc.pyx":377 + /* "numcodecs/blosc.pyx":378 * # guard condition * if dest_nbytes < nbytes: * raise ValueError('destination buffer too small; expected at least %s, ' # <<<<<<<<<<<<<< * 'got %s' % (nbytes, dest_nbytes)) * */ - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 377, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 378, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_7, 0, 0, 0); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(0, 377, __pyx_L5_error) + __Pyx_Raise(__pyx_t_6, 0, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(0, 378, __pyx_L5_error) - /* "numcodecs/blosc.pyx":376 + /* "numcodecs/blosc.pyx":377 * * # guard condition * if dest_nbytes < nbytes: # <<<<<<<<<<<<<< @@ -4240,14 +4270,14 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject */ } - /* "numcodecs/blosc.pyx":381 + /* "numcodecs/blosc.pyx":382 * * # perform decompression * if _get_use_threads(): # <<<<<<<<<<<<<< * # allow blosc to use threads internally * with nogil: */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_use_threads); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 381, __pyx_L5_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_use_threads); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 382, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { @@ -4259,16 +4289,16 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __Pyx_DECREF_SET(__pyx_t_2, function); } } - __pyx_t_7 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_2); + __pyx_t_6 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 381, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_7); + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 382, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 381, __pyx_L5_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 382, __pyx_L5_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_5) { - /* "numcodecs/blosc.pyx":383 + /* "numcodecs/blosc.pyx":384 * if _get_use_threads(): * # allow blosc to use threads internally * with nogil: # <<<<<<<<<<<<<< @@ -4283,7 +4313,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject #endif /*try:*/ { - /* "numcodecs/blosc.pyx":384 + /* "numcodecs/blosc.pyx":385 * # allow blosc to use threads internally * with nogil: * ret = blosc_decompress(source_ptr, dest_ptr, nbytes) # <<<<<<<<<<<<<< @@ -4293,7 +4323,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_v_ret = blosc_decompress(__pyx_v_source_ptr, __pyx_v_dest_ptr, __pyx_v_nbytes); } - /* "numcodecs/blosc.pyx":383 + /* "numcodecs/blosc.pyx":384 * if _get_use_threads(): * # allow blosc to use threads internally * with nogil: # <<<<<<<<<<<<<< @@ -4312,7 +4342,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject } } - /* "numcodecs/blosc.pyx":381 + /* "numcodecs/blosc.pyx":382 * * # perform decompression * if _get_use_threads(): # <<<<<<<<<<<<<< @@ -4322,7 +4352,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject goto __pyx_L8; } - /* "numcodecs/blosc.pyx":386 + /* "numcodecs/blosc.pyx":387 * ret = blosc_decompress(source_ptr, dest_ptr, nbytes) * else: * with nogil: # <<<<<<<<<<<<<< @@ -4338,7 +4368,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject #endif /*try:*/ { - /* "numcodecs/blosc.pyx":387 + /* "numcodecs/blosc.pyx":388 * else: * with nogil: * ret = blosc_decompress_ctx(source_ptr, dest_ptr, nbytes, 1) # <<<<<<<<<<<<<< @@ -4348,7 +4378,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_v_ret = blosc_decompress_ctx(__pyx_v_source_ptr, __pyx_v_dest_ptr, __pyx_v_nbytes, 1); } - /* "numcodecs/blosc.pyx":386 + /* "numcodecs/blosc.pyx":387 * ret = blosc_decompress(source_ptr, dest_ptr, nbytes) * else: * with nogil: # <<<<<<<<<<<<<< @@ -4370,7 +4400,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_L8:; } - /* "numcodecs/blosc.pyx":392 + /* "numcodecs/blosc.pyx":393 * * # release buffers * source_buffer.release() # <<<<<<<<<<<<<< @@ -4379,11 +4409,11 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject */ /*finally:*/ { /*normal exit:*/{ - __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 392, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_6 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 393, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "numcodecs/blosc.pyx":393 + /* "numcodecs/blosc.pyx":394 * # release buffers * source_buffer.release() * if dest_buffer is not None: # <<<<<<<<<<<<<< @@ -4394,18 +4424,18 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_t_4 = (__pyx_t_5 != 0); if (__pyx_t_4) { - /* "numcodecs/blosc.pyx":394 + /* "numcodecs/blosc.pyx":395 * source_buffer.release() * if dest_buffer is not None: * dest_buffer.release() # <<<<<<<<<<<<<< * * # handle errors */ - __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_dest_buffer->__pyx_vtab)->release(__pyx_v_dest_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 394, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_6 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_dest_buffer->__pyx_vtab)->release(__pyx_v_dest_buffer, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 395, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "numcodecs/blosc.pyx":393 + /* "numcodecs/blosc.pyx":394 * # release buffers * source_buffer.release() * if dest_buffer is not None: # <<<<<<<<<<<<<< @@ -4422,7 +4452,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13); __Pyx_XGOTREF(__pyx_t_11); @@ -4434,18 +4464,18 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_t_8 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename; { - /* "numcodecs/blosc.pyx":392 + /* "numcodecs/blosc.pyx":393 * * # release buffers * source_buffer.release() # <<<<<<<<<<<<<< * if dest_buffer is not None: * dest_buffer.release() */ - __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 392, __pyx_L17_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_6 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 393, __pyx_L17_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "numcodecs/blosc.pyx":393 + /* "numcodecs/blosc.pyx":394 * # release buffers * source_buffer.release() * if dest_buffer is not None: # <<<<<<<<<<<<<< @@ -4456,18 +4486,18 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_t_5 = (__pyx_t_4 != 0); if (__pyx_t_5) { - /* "numcodecs/blosc.pyx":394 + /* "numcodecs/blosc.pyx":395 * source_buffer.release() * if dest_buffer is not None: * dest_buffer.release() # <<<<<<<<<<<<<< * * # handle errors */ - __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_dest_buffer->__pyx_vtab)->release(__pyx_v_dest_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 394, __pyx_L17_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_6 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_dest_buffer->__pyx_vtab)->release(__pyx_v_dest_buffer, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 395, __pyx_L17_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "numcodecs/blosc.pyx":393 + /* "numcodecs/blosc.pyx":394 * # release buffers * source_buffer.release() * if dest_buffer is not None: # <<<<<<<<<<<<<< @@ -4505,7 +4535,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_L6:; } - /* "numcodecs/blosc.pyx":397 + /* "numcodecs/blosc.pyx":398 * * # handle errors * if ret <= 0: # <<<<<<<<<<<<<< @@ -4515,26 +4545,26 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_t_5 = ((__pyx_v_ret <= 0) != 0); if (unlikely(__pyx_t_5)) { - /* "numcodecs/blosc.pyx":398 + /* "numcodecs/blosc.pyx":399 * # handle errors * if ret <= 0: * raise RuntimeError('error during blosc decompression: %d' % ret) # <<<<<<<<<<<<<< * * return dest */ - __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_ret); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 398, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_error_during_blosc_decompression, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 398, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_ret); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 399, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_error_during_blosc_decompression, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 399, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 398, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 399, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_7, 0, 0, 0); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(0, 398, __pyx_L1_error) + __Pyx_Raise(__pyx_t_6, 0, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(0, 399, __pyx_L1_error) - /* "numcodecs/blosc.pyx":397 + /* "numcodecs/blosc.pyx":398 * * # handle errors * if ret <= 0: # <<<<<<<<<<<<<< @@ -4543,7 +4573,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject */ } - /* "numcodecs/blosc.pyx":400 + /* "numcodecs/blosc.pyx":401 * raise RuntimeError('error during blosc decompression: %d' % ret) * * return dest # <<<<<<<<<<<<<< @@ -4567,19 +4597,20 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_22decompress(CYTHON_UNUSED PyObject __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("numcodecs.blosc.decompress", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_source_buffer); __Pyx_XDECREF((PyObject *)__pyx_v_dest_buffer); + __Pyx_XDECREF(__pyx_v_arr); __Pyx_XDECREF(__pyx_v_dest); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "numcodecs/blosc.pyx":408 +/* "numcodecs/blosc.pyx":409 * * * def _get_use_threads(): # <<<<<<<<<<<<<< @@ -4615,16 +4646,16 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("_get_use_threads", 0); - /* "numcodecs/blosc.pyx":410 + /* "numcodecs/blosc.pyx":411 * def _get_use_threads(): * global use_threads * proc = multiprocessing.current_process() # <<<<<<<<<<<<<< * * # check if locks are available, and if not no threads */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_multiprocessing); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 410, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_multiprocessing); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 411, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_current_process); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 410, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_current_process); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 411, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; @@ -4639,27 +4670,27 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO } __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 410, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 411, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_proc = __pyx_t_1; __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":413 + /* "numcodecs/blosc.pyx":414 * * # check if locks are available, and if not no threads * if not mutex: # <<<<<<<<<<<<<< * return False * */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_mutex); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 413, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_mutex); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 414, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 413, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 414, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = ((!__pyx_t_4) != 0); if (__pyx_t_5) { - /* "numcodecs/blosc.pyx":414 + /* "numcodecs/blosc.pyx":415 * # check if locks are available, and if not no threads * if not mutex: * return False # <<<<<<<<<<<<<< @@ -4671,7 +4702,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO __pyx_r = Py_False; goto __pyx_L0; - /* "numcodecs/blosc.pyx":413 + /* "numcodecs/blosc.pyx":414 * * # check if locks are available, and if not no threads * if not mutex: # <<<<<<<<<<<<<< @@ -4680,25 +4711,25 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO */ } - /* "numcodecs/blosc.pyx":417 + /* "numcodecs/blosc.pyx":418 * * # check for fork * if proc.pid != _importer_pid: # <<<<<<<<<<<<<< * # If this module has been imported in the parent process, and the current process * # is a fork, attempting to use blosc in multi-threaded mode will cause a */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_proc, __pyx_n_s_pid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 417, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_proc, __pyx_n_s_pid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 418, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_importer_pid); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 417, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_importer_pid); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 418, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 417, __pyx_L1_error) + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 418, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 417, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 418, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_5) { - /* "numcodecs/blosc.pyx":421 + /* "numcodecs/blosc.pyx":422 * # is a fork, attempting to use blosc in multi-threaded mode will cause a * # program hang, so we force use of blosc ctx functions, i.e., no threads. * return False # <<<<<<<<<<<<<< @@ -4710,7 +4741,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO __pyx_r = Py_False; goto __pyx_L0; - /* "numcodecs/blosc.pyx":417 + /* "numcodecs/blosc.pyx":418 * * # check for fork * if proc.pid != _importer_pid: # <<<<<<<<<<<<<< @@ -4719,25 +4750,25 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO */ } - /* "numcodecs/blosc.pyx":423 + /* "numcodecs/blosc.pyx":424 * return False * * if use_threads in [True, False]: # <<<<<<<<<<<<<< * # user has manually overridden the default behaviour * _use_threads = use_threads */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_use_threads); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 423, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_use_threads); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 424, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, Py_True, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 423, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 423, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, Py_True, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 424, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 424, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_4) { } else { __pyx_t_5 = __pyx_t_4; goto __pyx_L6_bool_binop_done; } - __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, Py_False, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 423, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 423, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, Py_False, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 424, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 424, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __pyx_t_4; __pyx_L6_bool_binop_done:; @@ -4745,19 +4776,19 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO __pyx_t_4 = (__pyx_t_5 != 0); if (__pyx_t_4) { - /* "numcodecs/blosc.pyx":425 + /* "numcodecs/blosc.pyx":426 * if use_threads in [True, False]: * # user has manually overridden the default behaviour * _use_threads = use_threads # <<<<<<<<<<<<<< * * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_use_threads); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 425, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_use_threads); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 426, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v__use_threads = __pyx_t_2; __pyx_t_2 = 0; - /* "numcodecs/blosc.pyx":423 + /* "numcodecs/blosc.pyx":424 * return False * * if use_threads in [True, False]: # <<<<<<<<<<<<<< @@ -4767,7 +4798,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO goto __pyx_L5; } - /* "numcodecs/blosc.pyx":434 + /* "numcodecs/blosc.pyx":435 * # program or multi-process program * * if proc.name != 'MainProcess': # <<<<<<<<<<<<<< @@ -4775,13 +4806,13 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO * elif hasattr(threading, 'main_thread'): */ /*else*/ { - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_proc, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 434, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_proc, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 435, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_MainProcess, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 434, __pyx_L1_error) + __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_MainProcess, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 435, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_4) { - /* "numcodecs/blosc.pyx":435 + /* "numcodecs/blosc.pyx":436 * * if proc.name != 'MainProcess': * _use_threads = False # <<<<<<<<<<<<<< @@ -4791,7 +4822,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO __Pyx_INCREF(Py_False); __pyx_v__use_threads = Py_False; - /* "numcodecs/blosc.pyx":434 + /* "numcodecs/blosc.pyx":435 * # program or multi-process program * * if proc.name != 'MainProcess': # <<<<<<<<<<<<<< @@ -4801,30 +4832,30 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO goto __pyx_L8; } - /* "numcodecs/blosc.pyx":436 + /* "numcodecs/blosc.pyx":437 * if proc.name != 'MainProcess': * _use_threads = False * elif hasattr(threading, 'main_thread'): # <<<<<<<<<<<<<< * _use_threads = (threading.main_thread() == threading.current_thread()) * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_threading); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 436, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_threading); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 437, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_HasAttr(__pyx_t_2, __pyx_n_s_main_thread); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 436, __pyx_L1_error) + __pyx_t_4 = __Pyx_HasAttr(__pyx_t_2, __pyx_n_s_main_thread); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 437, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_5 = (__pyx_t_4 != 0); if (__pyx_t_5) { - /* "numcodecs/blosc.pyx":437 + /* "numcodecs/blosc.pyx":438 * _use_threads = False * elif hasattr(threading, 'main_thread'): * _use_threads = (threading.main_thread() == threading.current_thread()) # <<<<<<<<<<<<<< * else: * _use_threads = threading.current_thread().name == 'MainThread' */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_threading); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 437, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_threading); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 438, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_main_thread); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 437, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_main_thread); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 438, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; @@ -4839,12 +4870,12 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO } __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 437, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 438, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_threading); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 437, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_threading); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 438, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_current_thread); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 437, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_current_thread); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 438, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; @@ -4859,16 +4890,16 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_6); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 437, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 438, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 437, __pyx_L1_error) + __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 438, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v__use_threads = __pyx_t_6; __pyx_t_6 = 0; - /* "numcodecs/blosc.pyx":436 + /* "numcodecs/blosc.pyx":437 * if proc.name != 'MainProcess': * _use_threads = False * elif hasattr(threading, 'main_thread'): # <<<<<<<<<<<<<< @@ -4878,7 +4909,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO goto __pyx_L8; } - /* "numcodecs/blosc.pyx":439 + /* "numcodecs/blosc.pyx":440 * _use_threads = (threading.main_thread() == threading.current_thread()) * else: * _use_threads = threading.current_thread().name == 'MainThread' # <<<<<<<<<<<<<< @@ -4886,9 +4917,9 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO * return _use_threads */ /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_threading); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_threading); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 440, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_current_thread); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 439, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_current_thread); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 440, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; @@ -4903,13 +4934,13 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO } __pyx_t_6 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 439, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 440, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 439, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 440, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_n_s_MainThread, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 439, __pyx_L1_error) + __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_n_s_MainThread, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 440, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v__use_threads = __pyx_t_6; __pyx_t_6 = 0; @@ -4918,7 +4949,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO } __pyx_L5:; - /* "numcodecs/blosc.pyx":441 + /* "numcodecs/blosc.pyx":442 * _use_threads = threading.current_thread().name == 'MainThread' * * return _use_threads # <<<<<<<<<<<<<< @@ -4930,7 +4961,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO __pyx_r = __pyx_v__use_threads; goto __pyx_L0; - /* "numcodecs/blosc.pyx":408 + /* "numcodecs/blosc.pyx":409 * * * def _get_use_threads(): # <<<<<<<<<<<<<< @@ -4954,7 +4985,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_24_get_use_threads(CYTHON_UNUSED PyO return __pyx_r; } -/* "numcodecs/blosc.pyx":478 +/* "numcodecs/blosc.pyx":479 * max_buffer_size = 2**31 - 1 * * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): # <<<<<<<<<<<<<< @@ -4969,7 +5000,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_26__defaults__(CYTHON_UNUSED PyObjec PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("__defaults__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 478, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 479, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject*)__pyx_n_s_lz4)); __Pyx_GIVEREF(((PyObject*)__pyx_n_s_lz4)); @@ -4983,7 +5014,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_26__defaults__(CYTHON_UNUSED PyObjec __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_blocksize); __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_blocksize); PyTuple_SET_ITEM(__pyx_t_1, 3, __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_blocksize); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 478, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 479, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); @@ -5076,7 +5107,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_1__init__(PyObject *__pyx_sel } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 478, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 479, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -5101,7 +5132,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_1__init__(PyObject *__pyx_sel } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 478, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 479, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.blosc.Blosc.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -5124,37 +5155,37 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc___init__(CYTHON_UNUSED PyObje PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("__init__", 0); - /* "numcodecs/blosc.pyx":479 + /* "numcodecs/blosc.pyx":480 * * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): * self.cname = cname # <<<<<<<<<<<<<< * if isinstance(cname, text_type): * self._cname_bytes = cname.encode('ascii') */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cname, __pyx_v_cname) < 0) __PYX_ERR(0, 479, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cname, __pyx_v_cname) < 0) __PYX_ERR(0, 480, __pyx_L1_error) - /* "numcodecs/blosc.pyx":480 + /* "numcodecs/blosc.pyx":481 * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): * self.cname = cname * if isinstance(cname, text_type): # <<<<<<<<<<<<<< * self._cname_bytes = cname.encode('ascii') * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_text_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_text_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 481, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_IsInstance(__pyx_v_cname, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 480, __pyx_L1_error) + __pyx_t_2 = PyObject_IsInstance(__pyx_v_cname, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 481, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { - /* "numcodecs/blosc.pyx":481 + /* "numcodecs/blosc.pyx":482 * self.cname = cname * if isinstance(cname, text_type): * self._cname_bytes = cname.encode('ascii') # <<<<<<<<<<<<<< * else: * self._cname_bytes = cname */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_cname, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 481, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_cname, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 482, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { @@ -5168,13 +5199,13 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc___init__(CYTHON_UNUSED PyObje } __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_n_s_ascii) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_n_s_ascii); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 481, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 482, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cname_bytes, __pyx_t_1) < 0) __PYX_ERR(0, 481, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cname_bytes, __pyx_t_1) < 0) __PYX_ERR(0, 482, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":480 + /* "numcodecs/blosc.pyx":481 * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): * self.cname = cname * if isinstance(cname, text_type): # <<<<<<<<<<<<<< @@ -5184,7 +5215,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc___init__(CYTHON_UNUSED PyObje goto __pyx_L3; } - /* "numcodecs/blosc.pyx":483 + /* "numcodecs/blosc.pyx":484 * self._cname_bytes = cname.encode('ascii') * else: * self._cname_bytes = cname # <<<<<<<<<<<<<< @@ -5192,38 +5223,38 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc___init__(CYTHON_UNUSED PyObje * self.shuffle = shuffle */ /*else*/ { - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cname_bytes, __pyx_v_cname) < 0) __PYX_ERR(0, 483, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cname_bytes, __pyx_v_cname) < 0) __PYX_ERR(0, 484, __pyx_L1_error) } __pyx_L3:; - /* "numcodecs/blosc.pyx":484 + /* "numcodecs/blosc.pyx":485 * else: * self._cname_bytes = cname * self.clevel = clevel # <<<<<<<<<<<<<< * self.shuffle = shuffle * self.blocksize = blocksize */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_clevel, __pyx_v_clevel) < 0) __PYX_ERR(0, 484, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_clevel, __pyx_v_clevel) < 0) __PYX_ERR(0, 485, __pyx_L1_error) - /* "numcodecs/blosc.pyx":485 + /* "numcodecs/blosc.pyx":486 * self._cname_bytes = cname * self.clevel = clevel * self.shuffle = shuffle # <<<<<<<<<<<<<< * self.blocksize = blocksize * */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_shuffle, __pyx_v_shuffle) < 0) __PYX_ERR(0, 485, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_shuffle, __pyx_v_shuffle) < 0) __PYX_ERR(0, 486, __pyx_L1_error) - /* "numcodecs/blosc.pyx":486 + /* "numcodecs/blosc.pyx":487 * self.clevel = clevel * self.shuffle = shuffle * self.blocksize = blocksize # <<<<<<<<<<<<<< * * def encode(self, buf): */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_blocksize, __pyx_v_blocksize) < 0) __PYX_ERR(0, 486, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_blocksize, __pyx_v_blocksize) < 0) __PYX_ERR(0, 487, __pyx_L1_error) - /* "numcodecs/blosc.pyx":478 + /* "numcodecs/blosc.pyx":479 * max_buffer_size = 2**31 - 1 * * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): # <<<<<<<<<<<<<< @@ -5246,11 +5277,11 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc___init__(CYTHON_UNUSED PyObje return __pyx_r; } -/* "numcodecs/blosc.pyx":488 +/* "numcodecs/blosc.pyx":489 * self.blocksize = blocksize * * def encode(self, buf): # <<<<<<<<<<<<<< - * buf = ensure_ndarray(buf, self.max_buffer_size) + * buf = ensure_contiguous_ndarray(buf, self.max_buffer_size) * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) */ @@ -5287,11 +5318,11 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_3encode(PyObject *__pyx_self, case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buf)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, 1); __PYX_ERR(0, 488, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, 1); __PYX_ERR(0, 489, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode") < 0)) __PYX_ERR(0, 488, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode") < 0)) __PYX_ERR(0, 489, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -5304,7 +5335,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_3encode(PyObject *__pyx_self, } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 488, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 489, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.blosc.Blosc.encode", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -5332,16 +5363,16 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_2encode(CYTHON_UNUSED PyObjec __Pyx_RefNannySetupContext("encode", 0); __Pyx_INCREF(__pyx_v_buf); - /* "numcodecs/blosc.pyx":489 + /* "numcodecs/blosc.pyx":490 * * def encode(self, buf): - * buf = ensure_ndarray(buf, self.max_buffer_size) # <<<<<<<<<<<<<< + * buf = ensure_contiguous_ndarray(buf, self.max_buffer_size) # <<<<<<<<<<<<<< * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ensure_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 489, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ensure_contiguous_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 490, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_buffer_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 489, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_buffer_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 490, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; __pyx_t_5 = 0; @@ -5358,7 +5389,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_2encode(CYTHON_UNUSED PyObjec #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_buf, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 489, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -5367,14 +5398,14 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_2encode(CYTHON_UNUSED PyObjec #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_buf, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 489, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { - __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 489, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 490, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; @@ -5385,7 +5416,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_2encode(CYTHON_UNUSED PyObjec __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_3); __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 489, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } @@ -5393,23 +5424,23 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_2encode(CYTHON_UNUSED PyObjec __Pyx_DECREF_SET(__pyx_v_buf, __pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":490 + /* "numcodecs/blosc.pyx":491 * def encode(self, buf): - * buf = ensure_ndarray(buf, self.max_buffer_size) + * buf = ensure_contiguous_ndarray(buf, self.max_buffer_size) * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) # <<<<<<<<<<<<<< * * def decode(self, buf, out=None): */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_compress); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 490, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_compress); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 491, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cname_bytes); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 490, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cname_bytes); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 491, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_clevel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 490, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_clevel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 491, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_shuffle); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 490, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_shuffle); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 491, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_blocksize); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 490, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_blocksize); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 491, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; __pyx_t_5 = 0; @@ -5426,7 +5457,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_2encode(CYTHON_UNUSED PyObjec #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[6] = {__pyx_t_8, __pyx_v_buf, __pyx_t_6, __pyx_t_3, __pyx_t_4, __pyx_t_7}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 491, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; @@ -5438,7 +5469,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_2encode(CYTHON_UNUSED PyObjec #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[6] = {__pyx_t_8, __pyx_v_buf, __pyx_t_6, __pyx_t_3, __pyx_t_4, __pyx_t_7}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 491, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; @@ -5448,7 +5479,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_2encode(CYTHON_UNUSED PyObjec } else #endif { - __pyx_t_9 = PyTuple_New(5+__pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 490, __pyx_L1_error) + __pyx_t_9 = PyTuple_New(5+__pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 491, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); if (__pyx_t_8) { __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL; @@ -5468,7 +5499,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_2encode(CYTHON_UNUSED PyObjec __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_7 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 491, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } @@ -5477,11 +5508,11 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_2encode(CYTHON_UNUSED PyObjec __pyx_t_1 = 0; goto __pyx_L0; - /* "numcodecs/blosc.pyx":488 + /* "numcodecs/blosc.pyx":489 * self.blocksize = blocksize * * def encode(self, buf): # <<<<<<<<<<<<<< - * buf = ensure_ndarray(buf, self.max_buffer_size) + * buf = ensure_contiguous_ndarray(buf, self.max_buffer_size) * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) */ @@ -5504,11 +5535,11 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_2encode(CYTHON_UNUSED PyObjec return __pyx_r; } -/* "numcodecs/blosc.pyx":492 +/* "numcodecs/blosc.pyx":493 * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) * * def decode(self, buf, out=None): # <<<<<<<<<<<<<< - * buf = ensure_ndarray(buf, self.max_buffer_size) + * buf = ensure_contiguous_ndarray(buf, self.max_buffer_size) * return decompress(buf, out) */ @@ -5549,7 +5580,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_5decode(PyObject *__pyx_self, case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buf)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, 1); __PYX_ERR(0, 492, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, 1); __PYX_ERR(0, 493, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -5559,7 +5590,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_5decode(PyObject *__pyx_self, } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode") < 0)) __PYX_ERR(0, 492, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode") < 0)) __PYX_ERR(0, 493, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -5577,7 +5608,7 @@ static PyObject *__pyx_pw_9numcodecs_5blosc_5Blosc_5decode(PyObject *__pyx_self, } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 492, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 493, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.blosc.Blosc.decode", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -5602,16 +5633,16 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_4decode(CYTHON_UNUSED PyObjec __Pyx_RefNannySetupContext("decode", 0); __Pyx_INCREF(__pyx_v_buf); - /* "numcodecs/blosc.pyx":493 + /* "numcodecs/blosc.pyx":494 * * def decode(self, buf, out=None): - * buf = ensure_ndarray(buf, self.max_buffer_size) # <<<<<<<<<<<<<< + * buf = ensure_contiguous_ndarray(buf, self.max_buffer_size) # <<<<<<<<<<<<<< * return decompress(buf, out) * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ensure_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 493, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ensure_contiguous_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 494, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_buffer_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 493, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_buffer_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 494, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; __pyx_t_5 = 0; @@ -5628,7 +5659,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_4decode(CYTHON_UNUSED PyObjec #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_buf, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 493, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 494, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -5637,14 +5668,14 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_4decode(CYTHON_UNUSED PyObjec #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_buf, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 493, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 494, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { - __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 493, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 494, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; @@ -5655,7 +5686,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_4decode(CYTHON_UNUSED PyObjec __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_3); __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 493, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 494, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } @@ -5663,15 +5694,15 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_4decode(CYTHON_UNUSED PyObjec __Pyx_DECREF_SET(__pyx_v_buf, __pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/blosc.pyx":494 + /* "numcodecs/blosc.pyx":495 * def decode(self, buf, out=None): - * buf = ensure_ndarray(buf, self.max_buffer_size) + * buf = ensure_contiguous_ndarray(buf, self.max_buffer_size) * return decompress(buf, out) # <<<<<<<<<<<<<< * * def __repr__(self): */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_decompress); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 494, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_decompress); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 495, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_6 = NULL; __pyx_t_5 = 0; @@ -5688,7 +5719,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_4decode(CYTHON_UNUSED PyObjec #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_buf, __pyx_v_out}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 494, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 495, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_1); } else @@ -5696,13 +5727,13 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_4decode(CYTHON_UNUSED PyObjec #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_buf, __pyx_v_out}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 494, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 495, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif { - __pyx_t_3 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 494, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 495, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (__pyx_t_6) { __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __pyx_t_6 = NULL; @@ -5713,7 +5744,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_4decode(CYTHON_UNUSED PyObjec __Pyx_INCREF(__pyx_v_out); __Pyx_GIVEREF(__pyx_v_out); PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_5, __pyx_v_out); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 494, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 495, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } @@ -5722,11 +5753,11 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_4decode(CYTHON_UNUSED PyObjec __pyx_t_1 = 0; goto __pyx_L0; - /* "numcodecs/blosc.pyx":492 + /* "numcodecs/blosc.pyx":493 * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) * * def decode(self, buf, out=None): # <<<<<<<<<<<<<< - * buf = ensure_ndarray(buf, self.max_buffer_size) + * buf = ensure_contiguous_ndarray(buf, self.max_buffer_size) * return decompress(buf, out) */ @@ -5746,7 +5777,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_4decode(CYTHON_UNUSED PyObjec return __pyx_r; } -/* "numcodecs/blosc.pyx":496 +/* "numcodecs/blosc.pyx":497 * return decompress(buf, out) * * def __repr__(self): # <<<<<<<<<<<<<< @@ -5781,72 +5812,72 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_6__repr__(CYTHON_UNUSED PyObj PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("__repr__", 0); - /* "numcodecs/blosc.pyx":498 + /* "numcodecs/blosc.pyx":499 * def __repr__(self): * r = '%s(cname=%r, clevel=%r, shuffle=%s, blocksize=%s)' % \ * (type(self).__name__, # <<<<<<<<<<<<<< * self.cname, * self.clevel, */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_self)), __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 498, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_self)), __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 499, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - /* "numcodecs/blosc.pyx":499 + /* "numcodecs/blosc.pyx":500 * r = '%s(cname=%r, clevel=%r, shuffle=%s, blocksize=%s)' % \ * (type(self).__name__, * self.cname, # <<<<<<<<<<<<<< * self.clevel, * _shuffle_repr[self.shuffle + 1], */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cname); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 499, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cname); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 500, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - /* "numcodecs/blosc.pyx":500 + /* "numcodecs/blosc.pyx":501 * (type(self).__name__, * self.cname, * self.clevel, # <<<<<<<<<<<<<< * _shuffle_repr[self.shuffle + 1], * self.blocksize) */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_clevel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 500, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_clevel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 501, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - /* "numcodecs/blosc.pyx":501 + /* "numcodecs/blosc.pyx":502 * self.cname, * self.clevel, * _shuffle_repr[self.shuffle + 1], # <<<<<<<<<<<<<< * self.blocksize) * return r */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_shuffle_repr); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 501, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_shuffle_repr); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_shuffle); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 501, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_shuffle); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_5, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 501, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_5, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 501, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "numcodecs/blosc.pyx":502 + /* "numcodecs/blosc.pyx":503 * self.clevel, * _shuffle_repr[self.shuffle + 1], * self.blocksize) # <<<<<<<<<<<<<< * return r */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_blocksize); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 502, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_blocksize); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 503, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - /* "numcodecs/blosc.pyx":498 + /* "numcodecs/blosc.pyx":499 * def __repr__(self): * r = '%s(cname=%r, clevel=%r, shuffle=%s, blocksize=%s)' % \ * (type(self).__name__, # <<<<<<<<<<<<<< * self.cname, * self.clevel, */ - __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 498, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 499, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); @@ -5864,20 +5895,20 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_6__repr__(CYTHON_UNUSED PyObj __pyx_t_5 = 0; __pyx_t_6 = 0; - /* "numcodecs/blosc.pyx":497 + /* "numcodecs/blosc.pyx":498 * * def __repr__(self): * r = '%s(cname=%r, clevel=%r, shuffle=%s, blocksize=%s)' % \ # <<<<<<<<<<<<<< * (type(self).__name__, * self.cname, */ - __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_s_cname_r_clevel_r_shuffle_s_bl, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 497, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_s_cname_r_clevel_r_shuffle_s_bl, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 498, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_r = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0; - /* "numcodecs/blosc.pyx":503 + /* "numcodecs/blosc.pyx":504 * _shuffle_repr[self.shuffle + 1], * self.blocksize) * return r # <<<<<<<<<<<<<< @@ -5887,7 +5918,7 @@ static PyObject *__pyx_pf_9numcodecs_5blosc_5Blosc_6__repr__(CYTHON_UNUSED PyObj __pyx_r = __pyx_v_r; goto __pyx_L0; - /* "numcodecs/blosc.pyx":496 + /* "numcodecs/blosc.pyx":497 * return decompress(buf, out) * * def __repr__(self): # <<<<<<<<<<<<<< @@ -5986,6 +6017,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_VERSION_STRING, __pyx_k_VERSION_STRING, sizeof(__pyx_k_VERSION_STRING), 0, 0, 1, 1}, {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, {&__pyx_n_s_abc, __pyx_k_abc, sizeof(__pyx_k_abc), 0, 0, 1, 1}, + {&__pyx_n_s_arr, __pyx_k_arr, sizeof(__pyx_k_arr), 0, 0, 1, 1}, {&__pyx_n_s_ascii, __pyx_k_ascii, sizeof(__pyx_k_ascii), 0, 0, 1, 1}, {&__pyx_kp_s_bad_compressor_or_compressor_not, __pyx_k_bad_compressor_or_compressor_not, sizeof(__pyx_k_bad_compressor_or_compressor_not), 0, 0, 1, 0}, {&__pyx_n_s_blocksize, __pyx_k_blocksize, sizeof(__pyx_k_blocksize), 0, 0, 1, 1}, @@ -6020,7 +6052,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_destroy, __pyx_k_destroy, sizeof(__pyx_k_destroy), 0, 0, 1, 1}, {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, - {&__pyx_n_s_ensure_ndarray, __pyx_k_ensure_ndarray, sizeof(__pyx_k_ensure_ndarray), 0, 0, 1, 1}, + {&__pyx_n_s_ensure_contiguous_ndarray, __pyx_k_ensure_contiguous_ndarray, sizeof(__pyx_k_ensure_contiguous_ndarray), 0, 0, 1, 1}, {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1}, {&__pyx_n_s_err_bad_cname, __pyx_k_err_bad_cname, sizeof(__pyx_k_err_bad_cname), 0, 0, 1, 1}, {&__pyx_kp_s_error_during_blosc_compression_d, __pyx_k_error_during_blosc_compression_d, sizeof(__pyx_k_error_during_blosc_compression_d), 0, 0, 1, 0}, @@ -6235,73 +6267,73 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * """Decompress data. * */ - __pyx_tuple__24 = PyTuple_Pack(11, __pyx_n_s_source, __pyx_n_s_dest, __pyx_n_s_ret, __pyx_n_s_source_ptr, __pyx_n_s_dest_ptr, __pyx_n_s_source_buffer, __pyx_n_s_dest_buffer, __pyx_n_s_nbytes, __pyx_n_s_cbytes, __pyx_n_s_blocksize, __pyx_n_s_dest_nbytes); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 330, __pyx_L1_error) + __pyx_tuple__24 = PyTuple_Pack(12, __pyx_n_s_source, __pyx_n_s_dest, __pyx_n_s_ret, __pyx_n_s_source_ptr, __pyx_n_s_dest_ptr, __pyx_n_s_source_buffer, __pyx_n_s_dest_buffer, __pyx_n_s_nbytes, __pyx_n_s_cbytes, __pyx_n_s_blocksize, __pyx_n_s_dest_nbytes, __pyx_n_s_arr); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 330, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__24); __Pyx_GIVEREF(__pyx_tuple__24); - __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(2, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_decompress, 330, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 330, __pyx_L1_error) + __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(2, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_decompress, 330, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 330, __pyx_L1_error) - /* "numcodecs/blosc.pyx":408 + /* "numcodecs/blosc.pyx":409 * * * def _get_use_threads(): # <<<<<<<<<<<<<< * global use_threads * proc = multiprocessing.current_process() */ - __pyx_tuple__26 = PyTuple_Pack(2, __pyx_n_s_proc, __pyx_n_s_use_threads_2); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 408, __pyx_L1_error) + __pyx_tuple__26 = PyTuple_Pack(2, __pyx_n_s_proc, __pyx_n_s_use_threads_2); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 409, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__26); __Pyx_GIVEREF(__pyx_tuple__26); - __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_get_use_threads, 408, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 408, __pyx_L1_error) + __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_get_use_threads, 409, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 409, __pyx_L1_error) - /* "numcodecs/blosc.pyx":478 + /* "numcodecs/blosc.pyx":479 * max_buffer_size = 2**31 - 1 * * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): # <<<<<<<<<<<<<< * self.cname = cname * if isinstance(cname, text_type): */ - __pyx_tuple__28 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_cname, __pyx_n_s_clevel, __pyx_n_s_shuffle, __pyx_n_s_blocksize); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 478, __pyx_L1_error) + __pyx_tuple__28 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_cname, __pyx_n_s_clevel, __pyx_n_s_shuffle, __pyx_n_s_blocksize); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 479, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__28); __Pyx_GIVEREF(__pyx_tuple__28); - __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_init_2, 478, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 478, __pyx_L1_error) + __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_init_2, 479, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 479, __pyx_L1_error) - /* "numcodecs/blosc.pyx":488 + /* "numcodecs/blosc.pyx":489 * self.blocksize = blocksize * * def encode(self, buf): # <<<<<<<<<<<<<< - * buf = ensure_ndarray(buf, self.max_buffer_size) + * buf = ensure_contiguous_ndarray(buf, self.max_buffer_size) * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) */ - __pyx_tuple__30 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_buf); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 488, __pyx_L1_error) + __pyx_tuple__30 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_buf); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 489, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__30); __Pyx_GIVEREF(__pyx_tuple__30); - __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_encode, 488, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 488, __pyx_L1_error) + __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_encode, 489, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 489, __pyx_L1_error) - /* "numcodecs/blosc.pyx":492 + /* "numcodecs/blosc.pyx":493 * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) * * def decode(self, buf, out=None): # <<<<<<<<<<<<<< - * buf = ensure_ndarray(buf, self.max_buffer_size) + * buf = ensure_contiguous_ndarray(buf, self.max_buffer_size) * return decompress(buf, out) */ - __pyx_tuple__32 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_buf, __pyx_n_s_out); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 492, __pyx_L1_error) + __pyx_tuple__32 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_buf, __pyx_n_s_out); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 493, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__32); __Pyx_GIVEREF(__pyx_tuple__32); - __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_decode, 492, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 492, __pyx_L1_error) - __pyx_tuple__34 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 492, __pyx_L1_error) + __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_decode, 493, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 493, __pyx_L1_error) + __pyx_tuple__34 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 493, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__34); __Pyx_GIVEREF(__pyx_tuple__34); - /* "numcodecs/blosc.pyx":496 + /* "numcodecs/blosc.pyx":497 * return decompress(buf, out) * * def __repr__(self): # <<<<<<<<<<<<<< * r = '%s(cname=%r, clevel=%r, shuffle=%s, blocksize=%s)' % \ * (type(self).__name__, */ - __pyx_tuple__35 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_r); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 496, __pyx_L1_error) + __pyx_tuple__35 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_r); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 497, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__35); __Pyx_GIVEREF(__pyx_tuple__35); - __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_repr, 496, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 496, __pyx_L1_error) + __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_blosc_pyx, __pyx_n_s_repr, 497, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 497, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -6653,7 +6685,7 @@ if (!__Pyx_RefNanny) { * * from .compat_ext cimport Buffer * from .compat_ext import Buffer # <<<<<<<<<<<<<< - * from .compat import PY2, text_type, ensure_ndarray + * from .compat import PY2, text_type, ensure_contiguous_ndarray * from .abc import Codec */ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) @@ -6669,7 +6701,7 @@ if (!__Pyx_RefNanny) { /* "numcodecs/blosc.pyx":19 * from .compat_ext cimport Buffer * from .compat_ext import Buffer - * from .compat import PY2, text_type, ensure_ndarray # <<<<<<<<<<<<<< + * from .compat import PY2, text_type, ensure_contiguous_ndarray # <<<<<<<<<<<<<< * from .abc import Codec * */ @@ -6681,9 +6713,9 @@ if (!__Pyx_RefNanny) { __Pyx_INCREF(__pyx_n_s_text_type); __Pyx_GIVEREF(__pyx_n_s_text_type); PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_text_type); - __Pyx_INCREF(__pyx_n_s_ensure_ndarray); - __Pyx_GIVEREF(__pyx_n_s_ensure_ndarray); - PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_ensure_ndarray); + __Pyx_INCREF(__pyx_n_s_ensure_contiguous_ndarray); + __Pyx_GIVEREF(__pyx_n_s_ensure_contiguous_ndarray); + PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_ensure_contiguous_ndarray); __pyx_t_1 = __Pyx_Import(__pyx_n_s_compat, __pyx_t_2, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -6695,15 +6727,15 @@ if (!__Pyx_RefNanny) { __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_text_type, __pyx_t_2) < 0) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ensure_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ensure_contiguous_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_ensure_ndarray, __pyx_t_2) < 0) __PYX_ERR(0, 19, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ensure_contiguous_ndarray, __pyx_t_2) < 0) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "numcodecs/blosc.pyx":20 * from .compat_ext import Buffer - * from .compat import PY2, text_type, ensure_ndarray + * from .compat import PY2, text_type, ensure_contiguous_ndarray * from .abc import Codec # <<<<<<<<<<<<<< * * @@ -7208,35 +7240,35 @@ if (!__Pyx_RefNanny) { if (PyDict_SetItem(__pyx_d, __pyx_n_s_decompress, __pyx_t_9) < 0) __PYX_ERR(0, 330, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":405 + /* "numcodecs/blosc.pyx":406 * # set the value of this variable to True or False to override the * # default adaptive behaviour * use_threads = None # <<<<<<<<<<<<<< * * */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_use_threads, Py_None) < 0) __PYX_ERR(0, 405, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_use_threads, Py_None) < 0) __PYX_ERR(0, 406, __pyx_L1_error) - /* "numcodecs/blosc.pyx":408 + /* "numcodecs/blosc.pyx":409 * * * def _get_use_threads(): # <<<<<<<<<<<<<< * global use_threads * proc = multiprocessing.current_process() */ - __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_25_get_use_threads, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 408, __pyx_L1_error) + __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_25_get_use_threads, NULL, __pyx_n_s_numcodecs_blosc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 409, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_use_threads, __pyx_t_9) < 0) __PYX_ERR(0, 408, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_use_threads, __pyx_t_9) < 0) __PYX_ERR(0, 409, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":444 + /* "numcodecs/blosc.pyx":445 * * * _shuffle_repr = ['AUTOSHUFFLE', 'NOSHUFFLE', 'SHUFFLE', 'BITSHUFFLE'] # <<<<<<<<<<<<<< * * */ - __pyx_t_9 = PyList_New(4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 444, __pyx_L1_error) + __pyx_t_9 = PyList_New(4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 445, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(__pyx_n_s_AUTOSHUFFLE); __Pyx_GIVEREF(__pyx_n_s_AUTOSHUFFLE); @@ -7250,38 +7282,38 @@ if (!__Pyx_RefNanny) { __Pyx_INCREF(__pyx_n_s_BITSHUFFLE); __Pyx_GIVEREF(__pyx_n_s_BITSHUFFLE); PyList_SET_ITEM(__pyx_t_9, 3, __pyx_n_s_BITSHUFFLE); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_shuffle_repr, __pyx_t_9) < 0) __PYX_ERR(0, 444, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_shuffle_repr, __pyx_t_9) < 0) __PYX_ERR(0, 445, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "numcodecs/blosc.pyx":447 + /* "numcodecs/blosc.pyx":448 * * * class Blosc(Codec): # <<<<<<<<<<<<<< * """Codec providing compression using the Blosc meta-compressor. * */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_Codec); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 447, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_Codec); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 448, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 447, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 448, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 447, __pyx_L1_error) + __pyx_t_9 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 448, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_9, __pyx_t_1, __pyx_n_s_Blosc, __pyx_n_s_Blosc, (PyObject *) NULL, __pyx_n_s_numcodecs_blosc, __pyx_kp_s_Codec_providing_compression_usin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 447, __pyx_L1_error) + __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_9, __pyx_t_1, __pyx_n_s_Blosc, __pyx_n_s_Blosc, (PyObject *) NULL, __pyx_n_s_numcodecs_blosc, __pyx_kp_s_Codec_providing_compression_usin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 448, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - /* "numcodecs/blosc.pyx":471 + /* "numcodecs/blosc.pyx":472 * """ * * codec_id = 'blosc' # <<<<<<<<<<<<<< * NOSHUFFLE = NOSHUFFLE * SHUFFLE = SHUFFLE */ - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_codec_id, __pyx_n_s_blosc) < 0) __PYX_ERR(0, 471, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_codec_id, __pyx_n_s_blosc) < 0) __PYX_ERR(0, 472, __pyx_L1_error) - /* "numcodecs/blosc.pyx":472 + /* "numcodecs/blosc.pyx":473 * * codec_id = 'blosc' * NOSHUFFLE = NOSHUFFLE # <<<<<<<<<<<<<< @@ -7289,12 +7321,12 @@ if (!__Pyx_RefNanny) { * BITSHUFFLE = BITSHUFFLE */ __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_NOSHUFFLE); - if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 472, __pyx_L1_error) + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 473, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_NOSHUFFLE, __pyx_t_10) < 0) __PYX_ERR(0, 472, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_NOSHUFFLE, __pyx_t_10) < 0) __PYX_ERR(0, 473, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "numcodecs/blosc.pyx":473 + /* "numcodecs/blosc.pyx":474 * codec_id = 'blosc' * NOSHUFFLE = NOSHUFFLE * SHUFFLE = SHUFFLE # <<<<<<<<<<<<<< @@ -7302,12 +7334,12 @@ if (!__Pyx_RefNanny) { * AUTOSHUFFLE = AUTOSHUFFLE */ __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_SHUFFLE); - if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 473, __pyx_L1_error) + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 474, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_SHUFFLE, __pyx_t_10) < 0) __PYX_ERR(0, 473, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_SHUFFLE, __pyx_t_10) < 0) __PYX_ERR(0, 474, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "numcodecs/blosc.pyx":474 + /* "numcodecs/blosc.pyx":475 * NOSHUFFLE = NOSHUFFLE * SHUFFLE = SHUFFLE * BITSHUFFLE = BITSHUFFLE # <<<<<<<<<<<<<< @@ -7315,12 +7347,12 @@ if (!__Pyx_RefNanny) { * max_buffer_size = 2**31 - 1 */ __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_BITSHUFFLE); - if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 474, __pyx_L1_error) + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 475, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_BITSHUFFLE, __pyx_t_10) < 0) __PYX_ERR(0, 474, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_BITSHUFFLE, __pyx_t_10) < 0) __PYX_ERR(0, 475, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "numcodecs/blosc.pyx":475 + /* "numcodecs/blosc.pyx":476 * SHUFFLE = SHUFFLE * BITSHUFFLE = BITSHUFFLE * AUTOSHUFFLE = AUTOSHUFFLE # <<<<<<<<<<<<<< @@ -7328,96 +7360,96 @@ if (!__Pyx_RefNanny) { * */ __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_AUTOSHUFFLE); - if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 475, __pyx_L1_error) + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 476, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_AUTOSHUFFLE, __pyx_t_10) < 0) __PYX_ERR(0, 475, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_AUTOSHUFFLE, __pyx_t_10) < 0) __PYX_ERR(0, 476, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "numcodecs/blosc.pyx":476 + /* "numcodecs/blosc.pyx":477 * BITSHUFFLE = BITSHUFFLE * AUTOSHUFFLE = AUTOSHUFFLE * max_buffer_size = 2**31 - 1 # <<<<<<<<<<<<<< * * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): */ - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_max_buffer_size, __pyx_int_2147483647) < 0) __PYX_ERR(0, 476, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_max_buffer_size, __pyx_int_2147483647) < 0) __PYX_ERR(0, 477, __pyx_L1_error) - /* "numcodecs/blosc.pyx":478 + /* "numcodecs/blosc.pyx":479 * max_buffer_size = 2**31 - 1 * * def __init__(self, cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=AUTOBLOCKS): # <<<<<<<<<<<<<< * self.cname = cname * if isinstance(cname, text_type): */ - __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5Blosc_1__init__, 0, __pyx_n_s_Blosc___init, NULL, __pyx_n_s_numcodecs_blosc, __pyx_d, ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 478, __pyx_L1_error) + __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5Blosc_1__init__, 0, __pyx_n_s_Blosc___init, NULL, __pyx_n_s_numcodecs_blosc, __pyx_d, ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 479, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - if (!__Pyx_CyFunction_InitDefaults(__pyx_t_10, sizeof(__pyx_defaults), 2)) __PYX_ERR(0, 478, __pyx_L1_error) + if (!__Pyx_CyFunction_InitDefaults(__pyx_t_10, sizeof(__pyx_defaults), 2)) __PYX_ERR(0, 479, __pyx_L1_error) __pyx_t_11 = PyObject_GetItem(__pyx_t_2, __pyx_n_s_SHUFFLE); if (unlikely(!__pyx_t_11)) { PyErr_Clear(); __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_SHUFFLE); } - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 478, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 479, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_10)->__pyx_arg_shuffle = __pyx_t_11; __Pyx_GIVEREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_AUTOBLOCKS); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 478, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_AUTOBLOCKS); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 479, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_10)->__pyx_arg_blocksize = __pyx_t_11; __Pyx_GIVEREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_10, __pyx_pf_9numcodecs_5blosc_26__defaults__); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init_2, __pyx_t_10) < 0) __PYX_ERR(0, 478, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init_2, __pyx_t_10) < 0) __PYX_ERR(0, 479, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "numcodecs/blosc.pyx":488 + /* "numcodecs/blosc.pyx":489 * self.blocksize = blocksize * * def encode(self, buf): # <<<<<<<<<<<<<< - * buf = ensure_ndarray(buf, self.max_buffer_size) + * buf = ensure_contiguous_ndarray(buf, self.max_buffer_size) * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) */ - __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5Blosc_3encode, 0, __pyx_n_s_Blosc_encode, NULL, __pyx_n_s_numcodecs_blosc, __pyx_d, ((PyObject *)__pyx_codeobj__31)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 488, __pyx_L1_error) + __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5Blosc_3encode, 0, __pyx_n_s_Blosc_encode, NULL, __pyx_n_s_numcodecs_blosc, __pyx_d, ((PyObject *)__pyx_codeobj__31)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 489, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_encode, __pyx_t_10) < 0) __PYX_ERR(0, 488, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_encode, __pyx_t_10) < 0) __PYX_ERR(0, 489, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "numcodecs/blosc.pyx":492 + /* "numcodecs/blosc.pyx":493 * return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize) * * def decode(self, buf, out=None): # <<<<<<<<<<<<<< - * buf = ensure_ndarray(buf, self.max_buffer_size) + * buf = ensure_contiguous_ndarray(buf, self.max_buffer_size) * return decompress(buf, out) */ - __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5Blosc_5decode, 0, __pyx_n_s_Blosc_decode, NULL, __pyx_n_s_numcodecs_blosc, __pyx_d, ((PyObject *)__pyx_codeobj__33)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 492, __pyx_L1_error) + __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5Blosc_5decode, 0, __pyx_n_s_Blosc_decode, NULL, __pyx_n_s_numcodecs_blosc, __pyx_d, ((PyObject *)__pyx_codeobj__33)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 493, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_10, __pyx_tuple__34); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_decode, __pyx_t_10) < 0) __PYX_ERR(0, 492, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_decode, __pyx_t_10) < 0) __PYX_ERR(0, 493, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "numcodecs/blosc.pyx":496 + /* "numcodecs/blosc.pyx":497 * return decompress(buf, out) * * def __repr__(self): # <<<<<<<<<<<<<< * r = '%s(cname=%r, clevel=%r, shuffle=%s, blocksize=%s)' % \ * (type(self).__name__, */ - __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5Blosc_7__repr__, 0, __pyx_n_s_Blosc___repr, NULL, __pyx_n_s_numcodecs_blosc, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 496, __pyx_L1_error) + __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_5blosc_5Blosc_7__repr__, 0, __pyx_n_s_Blosc___repr, NULL, __pyx_n_s_numcodecs_blosc, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 497, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_repr, __pyx_t_10) < 0) __PYX_ERR(0, 496, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_repr, __pyx_t_10) < 0) __PYX_ERR(0, 497, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "numcodecs/blosc.pyx":447 + /* "numcodecs/blosc.pyx":448 * * * class Blosc(Codec): # <<<<<<<<<<<<<< * """Codec providing compression using the Blosc meta-compressor. * */ - __pyx_t_10 = __Pyx_Py3ClassCreate(__pyx_t_9, __pyx_n_s_Blosc, __pyx_t_1, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 447, __pyx_L1_error) + __pyx_t_10 = __Pyx_Py3ClassCreate(__pyx_t_9, __pyx_n_s_Blosc, __pyx_t_1, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 448, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_Blosc, __pyx_t_10) < 0) __PYX_ERR(0, 447, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Blosc, __pyx_t_10) < 0) __PYX_ERR(0, 448, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; diff --git a/numcodecs/blosc.pyx b/numcodecs/blosc.pyx index 2e99c1fb..e66616da 100644 --- a/numcodecs/blosc.pyx +++ b/numcodecs/blosc.pyx @@ -366,7 +366,8 @@ def decompress(source, dest=None): dest_ptr = PyBytes_AS_STRING(dest) dest_nbytes = nbytes else: - dest_buffer = Buffer(dest, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) + arr = ensure_contiguous_ndarray(dest) + dest_buffer = Buffer(arr, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) dest_ptr = dest_buffer.ptr dest_nbytes = dest_buffer.nbytes diff --git a/numcodecs/compat_ext.c b/numcodecs/compat_ext.c index 296f9855..6cb93abe 100644 --- a/numcodecs/compat_ext.c +++ b/numcodecs/compat_ext.c @@ -954,34 +954,6 @@ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ const char* function_name); -/* GetModuleGlobalName.proto */ -#if CYTHON_USE_DICT_VERSIONS -#define __Pyx_GetModuleGlobalName(var, name) {\ - static PY_UINT64_T __pyx_dict_version = 0;\ - static PyObject *__pyx_dict_cached_value = NULL;\ - (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ - (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ - __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} -#define __Pyx_GetModuleGlobalNameUncached(var, name) {\ - PY_UINT64_T __pyx_dict_version;\ - PyObject *__pyx_dict_cached_value;\ - (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); -#else -#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) -#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); -#endif - -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); -#else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) -#endif - /* PyFunctionFastCall.proto */ #if CYTHON_FAST_PYCALL #define __Pyx_PyFunction_FastCall(func, args, nargs)\ @@ -1012,17 +984,11 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) #endif -/* PyObjectCall2Args.proto */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); - /* PyObjectCallMethO.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); #endif -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - /* PyObjectCallNoArg.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); @@ -1030,6 +996,16 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) #endif +/* PyCFunctionFastCall.proto */ +#if CYTHON_FAST_PYCCALL +static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); +#else +#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) +#endif + +/* PyObjectCallOneArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + /* PyThreadStateGet.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; @@ -1220,8 +1196,8 @@ static PyObject *__pyx_tuple__2; * new-style buffer interface in PY2.""" * * def __cinit__(self, obj, flags): # <<<<<<<<<<<<<< - * arr = ensure_contiguous_ndarray(obj) - * PyObject_GetBuffer(arr, &(self.buffer), flags) + * PyObject_GetBuffer(obj, &(self.buffer), flags) + * self.acquired = True */ /* Python wrapper */ @@ -1286,65 +1262,34 @@ static int __pyx_pw_9numcodecs_10compat_ext_6Buffer_1__cinit__(PyObject *__pyx_v } static int __pyx_pf_9numcodecs_10compat_ext_6Buffer___cinit__(struct __pyx_obj_9numcodecs_10compat_ext_Buffer *__pyx_v_self, PyObject *__pyx_v_obj, PyObject *__pyx_v_flags) { - PyObject *__pyx_v_arr = NULL; int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - Py_ssize_t __pyx_t_6; + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; __Pyx_RefNannySetupContext("__cinit__", 0); /* "numcodecs/compat_ext.pyx":19 * * def __cinit__(self, obj, flags): - * arr = ensure_contiguous_ndarray(obj) # <<<<<<<<<<<<<< - * PyObject_GetBuffer(arr, &(self.buffer), flags) + * PyObject_GetBuffer(obj, &(self.buffer), flags) # <<<<<<<<<<<<<< * self.acquired = True + * self.ptr = self.buffer.buf */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ensure_contiguous_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_obj) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_obj); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_arr = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_flags); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 19, __pyx_L1_error) + __pyx_t_2 = PyObject_GetBuffer(__pyx_v_obj, (&__pyx_v_self->buffer), __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 19, __pyx_L1_error) /* "numcodecs/compat_ext.pyx":20 * def __cinit__(self, obj, flags): - * arr = ensure_contiguous_ndarray(obj) - * PyObject_GetBuffer(arr, &(self.buffer), flags) # <<<<<<<<<<<<<< - * self.acquired = True - * self.ptr = self.buffer.buf - */ - __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_flags); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 20, __pyx_L1_error) - __pyx_t_5 = PyObject_GetBuffer(__pyx_v_arr, (&__pyx_v_self->buffer), __pyx_t_4); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 20, __pyx_L1_error) - - /* "numcodecs/compat_ext.pyx":21 - * arr = ensure_contiguous_ndarray(obj) - * PyObject_GetBuffer(arr, &(self.buffer), flags) + * PyObject_GetBuffer(obj, &(self.buffer), flags) * self.acquired = True # <<<<<<<<<<<<<< * self.ptr = self.buffer.buf * self.itemsize = self.buffer.itemsize */ __pyx_v_self->acquired = 1; - /* "numcodecs/compat_ext.pyx":22 - * PyObject_GetBuffer(arr, &(self.buffer), flags) + /* "numcodecs/compat_ext.pyx":21 + * PyObject_GetBuffer(obj, &(self.buffer), flags) * self.acquired = True * self.ptr = self.buffer.buf # <<<<<<<<<<<<<< * self.itemsize = self.buffer.itemsize @@ -1352,50 +1297,46 @@ static int __pyx_pf_9numcodecs_10compat_ext_6Buffer___cinit__(struct __pyx_obj_9 */ __pyx_v_self->ptr = ((char *)__pyx_v_self->buffer.buf); - /* "numcodecs/compat_ext.pyx":23 + /* "numcodecs/compat_ext.pyx":22 * self.acquired = True * self.ptr = self.buffer.buf * self.itemsize = self.buffer.itemsize # <<<<<<<<<<<<<< * self.nbytes = self.buffer.len * */ - __pyx_t_6 = __pyx_v_self->buffer.itemsize; - __pyx_v_self->itemsize = __pyx_t_6; + __pyx_t_3 = __pyx_v_self->buffer.itemsize; + __pyx_v_self->itemsize = __pyx_t_3; - /* "numcodecs/compat_ext.pyx":24 + /* "numcodecs/compat_ext.pyx":23 * self.ptr = self.buffer.buf * self.itemsize = self.buffer.itemsize * self.nbytes = self.buffer.len # <<<<<<<<<<<<<< * * cpdef release(self): */ - __pyx_t_6 = __pyx_v_self->buffer.len; - __pyx_v_self->nbytes = __pyx_t_6; + __pyx_t_3 = __pyx_v_self->buffer.len; + __pyx_v_self->nbytes = __pyx_t_3; /* "numcodecs/compat_ext.pyx":18 * new-style buffer interface in PY2.""" * * def __cinit__(self, obj, flags): # <<<<<<<<<<<<<< - * arr = ensure_contiguous_ndarray(obj) - * PyObject_GetBuffer(arr, &(self.buffer), flags) + * PyObject_GetBuffer(obj, &(self.buffer), flags) + * self.acquired = True */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("numcodecs.compat_ext.Buffer.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_arr); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "numcodecs/compat_ext.pyx":26 +/* "numcodecs/compat_ext.pyx":25 * self.nbytes = self.buffer.len * * cpdef release(self): # <<<<<<<<<<<<<< @@ -1423,7 +1364,7 @@ static PyObject *__pyx_f_9numcodecs_10compat_ext_6Buffer_release(struct __pyx_ob else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_release); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 26, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_release); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9numcodecs_10compat_ext_6Buffer_3release)) { __Pyx_XDECREF(__pyx_r); @@ -1440,7 +1381,7 @@ static PyObject *__pyx_f_9numcodecs_10compat_ext_6Buffer_release(struct __pyx_ob } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 26, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; @@ -1461,7 +1402,7 @@ static PyObject *__pyx_f_9numcodecs_10compat_ext_6Buffer_release(struct __pyx_ob #endif } - /* "numcodecs/compat_ext.pyx":27 + /* "numcodecs/compat_ext.pyx":26 * * cpdef release(self): * if self.acquired: # <<<<<<<<<<<<<< @@ -1471,7 +1412,7 @@ static PyObject *__pyx_f_9numcodecs_10compat_ext_6Buffer_release(struct __pyx_ob __pyx_t_5 = (__pyx_v_self->acquired != 0); if (__pyx_t_5) { - /* "numcodecs/compat_ext.pyx":28 + /* "numcodecs/compat_ext.pyx":27 * cpdef release(self): * if self.acquired: * PyBuffer_Release(&(self.buffer)) # <<<<<<<<<<<<<< @@ -1480,7 +1421,7 @@ static PyObject *__pyx_f_9numcodecs_10compat_ext_6Buffer_release(struct __pyx_ob */ PyBuffer_Release((&__pyx_v_self->buffer)); - /* "numcodecs/compat_ext.pyx":29 + /* "numcodecs/compat_ext.pyx":28 * if self.acquired: * PyBuffer_Release(&(self.buffer)) * self.acquired = False # <<<<<<<<<<<<<< @@ -1489,7 +1430,7 @@ static PyObject *__pyx_f_9numcodecs_10compat_ext_6Buffer_release(struct __pyx_ob */ __pyx_v_self->acquired = 0; - /* "numcodecs/compat_ext.pyx":27 + /* "numcodecs/compat_ext.pyx":26 * * cpdef release(self): * if self.acquired: # <<<<<<<<<<<<<< @@ -1498,7 +1439,7 @@ static PyObject *__pyx_f_9numcodecs_10compat_ext_6Buffer_release(struct __pyx_ob */ } - /* "numcodecs/compat_ext.pyx":26 + /* "numcodecs/compat_ext.pyx":25 * self.nbytes = self.buffer.len * * cpdef release(self): # <<<<<<<<<<<<<< @@ -1542,7 +1483,7 @@ static PyObject *__pyx_pf_9numcodecs_10compat_ext_6Buffer_2release(struct __pyx_ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("release", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_9numcodecs_10compat_ext_6Buffer_release(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 26, __pyx_L1_error) + __pyx_t_1 = __pyx_f_9numcodecs_10compat_ext_6Buffer_release(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1559,7 +1500,7 @@ static PyObject *__pyx_pf_9numcodecs_10compat_ext_6Buffer_2release(struct __pyx_ return __pyx_r; } -/* "numcodecs/compat_ext.pyx":31 +/* "numcodecs/compat_ext.pyx":30 * self.acquired = False * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -1582,16 +1523,16 @@ static void __pyx_pf_9numcodecs_10compat_ext_6Buffer_4__dealloc__(struct __pyx_o PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "numcodecs/compat_ext.pyx":32 + /* "numcodecs/compat_ext.pyx":31 * * def __dealloc__(self): * self.release() # <<<<<<<<<<<<<< */ - __pyx_t_1 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_self->__pyx_vtab)->release(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 32, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_self->__pyx_vtab)->release(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/compat_ext.pyx":31 + /* "numcodecs/compat_ext.pyx":30 * self.acquired = False * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -2448,64 +2389,6 @@ static int __Pyx_ParseOptionalKeywords( return -1; } -/* GetModuleGlobalName */ -#if CYTHON_USE_DICT_VERSIONS -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) -#else -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) -#endif -{ - PyObject *result; -#if !CYTHON_AVOID_BORROWED_REFS -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 - result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } else if (unlikely(PyErr_Occurred())) { - return NULL; - } -#else - result = PyDict_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } -#endif -#else - result = PyObject_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } - PyErr_Clear(); -#endif - return __Pyx_GetBuiltinName(name); -} - -/* PyCFunctionFastCall */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - int flags = PyCFunction_GET_FLAGS(func); - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { - return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); - } else { - return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); - } -} -#endif - /* PyFunctionFastCall */ #if CYTHON_FAST_PYCALL static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, @@ -2645,35 +2528,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg } #endif -/* PyObjectCall2Args */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { - PyObject *args, *result = NULL; - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyFunction_FastCall(function, args, 2); - } - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyCFunction_FastCall(function, args, 2); - } - #endif - args = PyTuple_New(2); - if (unlikely(!args)) goto done; - Py_INCREF(arg1); - PyTuple_SET_ITEM(args, 0, arg1); - Py_INCREF(arg2); - PyTuple_SET_ITEM(args, 1, arg2); - Py_INCREF(function); - result = __Pyx_PyObject_Call(function, args, NULL); - Py_DECREF(args); - Py_DECREF(function); -done: - return result; -} - /* PyObjectCallMethO */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { @@ -2694,6 +2548,51 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject } #endif +/* PyObjectCallNoArg */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { +#if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCall(func, NULL, 0); + } +#endif +#ifdef __Pyx_CyFunction_USED + if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func))) +#else + if (likely(PyCFunction_Check(func))) +#endif + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { + return __Pyx_PyObject_CallMethO(func, NULL); + } + } + return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); +} +#endif + +/* PyCFunctionFastCall */ +#if CYTHON_FAST_PYCCALL +static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { + PyCFunctionObject *func = (PyCFunctionObject*)func_obj; + PyCFunction meth = PyCFunction_GET_FUNCTION(func); + PyObject *self = PyCFunction_GET_SELF(func); + int flags = PyCFunction_GET_FLAGS(func); + assert(PyCFunction_Check(func)); + assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); + assert(nargs >= 0); + assert(nargs == 0 || args != NULL); + /* _PyCFunction_FastCallDict() must not be called with an exception set, + because it may clear it (directly or indirectly) and so the + caller loses its exception */ + assert(!PyErr_Occurred()); + if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { + return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); + } else { + return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); + } +} +#endif + /* PyObjectCallOneArg */ #if CYTHON_COMPILING_IN_CPYTHON static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { @@ -2734,28 +2633,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObjec } #endif -/* PyObjectCallNoArg */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, NULL, 0); - } -#endif -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func))) -#else - if (likely(PyCFunction_Check(func))) -#endif - { - if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { - return __Pyx_PyObject_CallMethO(func, NULL); - } - } - return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); -} -#endif - /* PyErrFetchRestore */ #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { diff --git a/numcodecs/compat_ext.pyx b/numcodecs/compat_ext.pyx index 8ff3d53f..2dfec543 100644 --- a/numcodecs/compat_ext.pyx +++ b/numcodecs/compat_ext.pyx @@ -16,8 +16,7 @@ cdef class Buffer: new-style buffer interface in PY2.""" def __cinit__(self, obj, flags): - arr = ensure_contiguous_ndarray(obj) - PyObject_GetBuffer(arr, &(self.buffer), flags) + PyObject_GetBuffer(obj, &(self.buffer), flags) self.acquired = True self.ptr = self.buffer.buf self.itemsize = self.buffer.itemsize diff --git a/numcodecs/lz4.c b/numcodecs/lz4.c index e349e165..4a6d18b2 100644 --- a/numcodecs/lz4.c +++ b/numcodecs/lz4.c @@ -18,8 +18,8 @@ "name": "numcodecs.lz4", "sources": [ "numcodecs/lz4.pyx", - "c-blosc/internal-complibs/lz4-1.8.1.2/lz4hc.c", - "c-blosc/internal-complibs/lz4-1.8.1.2/lz4.c" + "c-blosc/internal-complibs/lz4-1.8.1.2/lz4.c", + "c-blosc/internal-complibs/lz4-1.8.1.2/lz4hc.c" ] }, "module_name": "numcodecs.lz4" @@ -1114,6 +1114,9 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObjec /* RaiseException.proto */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); +/* PyObjectCall2Args.proto */ +static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); + /* PyObjectSetAttrStr.proto */ #if CYTHON_USE_TYPE_SLOTS #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL) @@ -1310,6 +1313,7 @@ static const char __pyx_k_r[] = "r"; static const char __pyx_k_LZ4[] = "LZ4"; static const char __pyx_k_PY2[] = "PY2"; static const char __pyx_k_abc[] = "abc"; +static const char __pyx_k_arr[] = "arr"; static const char __pyx_k_buf[] = "buf"; static const char __pyx_k_doc[] = "__doc__"; static const char __pyx_k_lz4[] = "lz4"; @@ -1357,7 +1361,6 @@ static const char __pyx_k_numcodecs_lz4[] = "numcodecs.lz4"; static const char __pyx_k_source_buffer[] = "source_buffer"; static const char __pyx_k_VERSION_STRING[] = "VERSION_STRING"; static const char __pyx_k_bad_input_data[] = "bad input data"; -static const char __pyx_k_ensure_ndarray[] = "ensure_ndarray"; static const char __pyx_k_compressed_size[] = "compressed_size"; static const char __pyx_k_max_buffer_size[] = "max_buffer_size"; static const char __pyx_k_s_acceleration_r[] = "%s(acceleration=%r)"; @@ -1367,6 +1370,7 @@ static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; static const char __pyx_k_DEFAULT_ACCELERATION[] = "DEFAULT_ACCELERATION"; static const char __pyx_k_LZ4_compression_error_s[] = "LZ4 compression error: %s"; static const char __pyx_k_LZ4_decompression_error_s[] = "LZ4 decompression error: %s"; +static const char __pyx_k_ensure_contiguous_ndarray[] = "ensure_contiguous_ndarray"; static const char __pyx_k_LZ4_decompression_error_invalid[] = "LZ4 decompression error: invalid input data"; static const char __pyx_k_Codec_providing_compression_usin[] = "Codec providing compression using LZ4.\n\n Parameters\n ----------\n acceleration : int\n Acceleration level. The larger the acceleration value, the faster the algorithm, but also\n the lesser the compression.\n\n See Also\n --------\n numcodecs.zstd.Zstd, numcodecs.blosc.Blosc\n\n "; static const char __pyx_k_LZ4_decompression_error_expected[] = "LZ4 decompression error: expected to decompress %s, got %s"; @@ -1390,6 +1394,7 @@ static PyObject *__pyx_n_s_VERSION_STRING; static PyObject *__pyx_n_s_ValueError; static PyObject *__pyx_n_s_abc; static PyObject *__pyx_n_s_acceleration; +static PyObject *__pyx_n_s_arr; static PyObject *__pyx_n_s_ascii; static PyObject *__pyx_kp_s_bad_input_data; static PyObject *__pyx_n_s_buf; @@ -1410,7 +1415,7 @@ static PyObject *__pyx_n_s_dest_start; static PyObject *__pyx_kp_s_destination_buffer_too_small_exp; static PyObject *__pyx_n_s_doc; static PyObject *__pyx_n_s_encode; -static PyObject *__pyx_n_s_ensure_ndarray; +static PyObject *__pyx_n_s_ensure_contiguous_ndarray; static PyObject *__pyx_n_s_import; static PyObject *__pyx_n_s_init; static PyObject *__pyx_n_s_lz4; @@ -1990,6 +1995,7 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_2decompress(CYTHON_UNUSED PyObject *__ int __pyx_v_source_size; int __pyx_v_dest_size; int __pyx_v_decompressed_size; + PyObject *__pyx_v_arr = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2192,7 +2198,7 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_2decompress(CYTHON_UNUSED PyObject *__ * dest = PyBytes_FromStringAndSize(NULL, dest_size) * dest_ptr = PyBytes_AS_STRING(dest) # <<<<<<<<<<<<<< * else: - * dest_buffer = Buffer(dest, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) + * arr = ensure_contiguous_ndarray(dest) */ __pyx_v_dest_ptr = PyBytes_AS_STRING(__pyx_v_dest); @@ -2209,30 +2215,57 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_2decompress(CYTHON_UNUSED PyObject *__ /* "numcodecs/lz4.pyx":170 * dest_ptr = PyBytes_AS_STRING(dest) * else: - * dest_buffer = Buffer(dest, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) # <<<<<<<<<<<<<< + * arr = ensure_contiguous_ndarray(dest) # <<<<<<<<<<<<<< + * dest_buffer = Buffer(arr, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) * dest_ptr = dest_buffer.ptr - * if dest_buffer.nbytes < dest_size: */ /*else*/ { - __pyx_t_1 = __Pyx_PyInt_From_int((PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L4_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ensure_contiguous_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 170, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_7, __pyx_v_dest) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_dest); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_arr = __pyx_t_1; + __pyx_t_1 = 0; + + /* "numcodecs/lz4.pyx":171 + * else: + * arr = ensure_contiguous_ndarray(dest) + * dest_buffer = Buffer(arr, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) # <<<<<<<<<<<<<< + * dest_ptr = dest_buffer.ptr + * if dest_buffer.nbytes < dest_size: + */ + __pyx_t_1 = __Pyx_PyInt_From_int((PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 170, __pyx_L4_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_dest); - __Pyx_GIVEREF(__pyx_v_dest); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_dest); + __Pyx_INCREF(__pyx_v_arr); + __Pyx_GIVEREF(__pyx_v_arr); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_arr); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L4_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF_SET(__pyx_v_dest_buffer, ((struct __pyx_obj_9numcodecs_10compat_ext_Buffer *)__pyx_t_1)); __pyx_t_1 = 0; - /* "numcodecs/lz4.pyx":171 - * else: - * dest_buffer = Buffer(dest, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) + /* "numcodecs/lz4.pyx":172 + * arr = ensure_contiguous_ndarray(dest) + * dest_buffer = Buffer(arr, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) * dest_ptr = dest_buffer.ptr # <<<<<<<<<<<<<< * if dest_buffer.nbytes < dest_size: * raise ValueError('destination buffer too small; expected at least %s, ' @@ -2240,8 +2273,8 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_2decompress(CYTHON_UNUSED PyObject *__ __pyx_t_3 = __pyx_v_dest_buffer->ptr; __pyx_v_dest_ptr = __pyx_t_3; - /* "numcodecs/lz4.pyx":172 - * dest_buffer = Buffer(dest, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) + /* "numcodecs/lz4.pyx":173 + * dest_buffer = Buffer(arr, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) * dest_ptr = dest_buffer.ptr * if dest_buffer.nbytes < dest_size: # <<<<<<<<<<<<<< * raise ValueError('destination buffer too small; expected at least %s, ' @@ -2250,18 +2283,18 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_2decompress(CYTHON_UNUSED PyObject *__ __pyx_t_6 = ((__pyx_v_dest_buffer->nbytes < __pyx_v_dest_size) != 0); if (unlikely(__pyx_t_6)) { - /* "numcodecs/lz4.pyx":174 + /* "numcodecs/lz4.pyx":175 * if dest_buffer.nbytes < dest_size: * raise ValueError('destination buffer too small; expected at least %s, ' * 'got %s' % (dest_size, dest_buffer.nbytes)) # <<<<<<<<<<<<<< * * # perform decompression */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_dest_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L4_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_dest_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_dest_buffer->nbytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 174, __pyx_L4_error) + __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_dest_buffer->nbytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 175, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 174, __pyx_L4_error) + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 175, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); @@ -2269,26 +2302,26 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_2decompress(CYTHON_UNUSED PyObject *__ PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_destination_buffer_too_small_exp, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 174, __pyx_L4_error) + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_destination_buffer_too_small_exp, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 175, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/lz4.pyx":173 + /* "numcodecs/lz4.pyx":174 * dest_ptr = dest_buffer.ptr * if dest_buffer.nbytes < dest_size: * raise ValueError('destination buffer too small; expected at least %s, ' # <<<<<<<<<<<<<< * 'got %s' % (dest_size, dest_buffer.nbytes)) * */ - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 173, __pyx_L4_error) + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 174, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_7, 0, 0, 0); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(0, 173, __pyx_L4_error) + __PYX_ERR(0, 174, __pyx_L4_error) - /* "numcodecs/lz4.pyx":172 - * dest_buffer = Buffer(dest, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) + /* "numcodecs/lz4.pyx":173 + * dest_buffer = Buffer(arr, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) * dest_ptr = dest_buffer.ptr * if dest_buffer.nbytes < dest_size: # <<<<<<<<<<<<<< * raise ValueError('destination buffer too small; expected at least %s, ' @@ -2298,7 +2331,7 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_2decompress(CYTHON_UNUSED PyObject *__ } __pyx_L8:; - /* "numcodecs/lz4.pyx":177 + /* "numcodecs/lz4.pyx":178 * * # perform decompression * with nogil: # <<<<<<<<<<<<<< @@ -2313,7 +2346,7 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_2decompress(CYTHON_UNUSED PyObject *__ #endif /*try:*/ { - /* "numcodecs/lz4.pyx":178 + /* "numcodecs/lz4.pyx":179 * # perform decompression * with nogil: * decompressed_size = LZ4_decompress_safe(source_start, dest_ptr, source_size, dest_size) # <<<<<<<<<<<<<< @@ -2323,7 +2356,7 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_2decompress(CYTHON_UNUSED PyObject *__ __pyx_v_decompressed_size = LZ4_decompress_safe(__pyx_v_source_start, __pyx_v_dest_ptr, __pyx_v_source_size, __pyx_v_dest_size); } - /* "numcodecs/lz4.pyx":177 + /* "numcodecs/lz4.pyx":178 * * # perform decompression * with nogil: # <<<<<<<<<<<<<< @@ -2343,7 +2376,7 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_2decompress(CYTHON_UNUSED PyObject *__ } } - /* "numcodecs/lz4.pyx":183 + /* "numcodecs/lz4.pyx":184 * * # release buffers * source_buffer.release() # <<<<<<<<<<<<<< @@ -2352,11 +2385,11 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_2decompress(CYTHON_UNUSED PyObject *__ */ /*finally:*/ { /*normal exit:*/{ - __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 183, __pyx_L1_error) + __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 184, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/lz4.pyx":184 + /* "numcodecs/lz4.pyx":185 * # release buffers * source_buffer.release() * if dest_buffer is not None: # <<<<<<<<<<<<<< @@ -2367,18 +2400,18 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_2decompress(CYTHON_UNUSED PyObject *__ __pyx_t_5 = (__pyx_t_6 != 0); if (__pyx_t_5) { - /* "numcodecs/lz4.pyx":185 + /* "numcodecs/lz4.pyx":186 * source_buffer.release() * if dest_buffer is not None: * dest_buffer.release() # <<<<<<<<<<<<<< * * # check decompression was successful */ - __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_dest_buffer->__pyx_vtab)->release(__pyx_v_dest_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 185, __pyx_L1_error) + __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_dest_buffer->__pyx_vtab)->release(__pyx_v_dest_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 186, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/lz4.pyx":184 + /* "numcodecs/lz4.pyx":185 * # release buffers * source_buffer.release() * if dest_buffer is not None: # <<<<<<<<<<<<<< @@ -2407,18 +2440,18 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_2decompress(CYTHON_UNUSED PyObject *__ __pyx_t_8 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename; { - /* "numcodecs/lz4.pyx":183 + /* "numcodecs/lz4.pyx":184 * * # release buffers * source_buffer.release() # <<<<<<<<<<<<<< * if dest_buffer is not None: * dest_buffer.release() */ - __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 183, __pyx_L15_error) + __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 184, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/lz4.pyx":184 + /* "numcodecs/lz4.pyx":185 * # release buffers * source_buffer.release() * if dest_buffer is not None: # <<<<<<<<<<<<<< @@ -2429,18 +2462,18 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_2decompress(CYTHON_UNUSED PyObject *__ __pyx_t_6 = (__pyx_t_5 != 0); if (__pyx_t_6) { - /* "numcodecs/lz4.pyx":185 + /* "numcodecs/lz4.pyx":186 * source_buffer.release() * if dest_buffer is not None: * dest_buffer.release() # <<<<<<<<<<<<<< * * # check decompression was successful */ - __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_dest_buffer->__pyx_vtab)->release(__pyx_v_dest_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 185, __pyx_L15_error) + __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_dest_buffer->__pyx_vtab)->release(__pyx_v_dest_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 186, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/lz4.pyx":184 + /* "numcodecs/lz4.pyx":185 * # release buffers * source_buffer.release() * if dest_buffer is not None: # <<<<<<<<<<<<<< @@ -2478,7 +2511,7 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_2decompress(CYTHON_UNUSED PyObject *__ __pyx_L5:; } - /* "numcodecs/lz4.pyx":188 + /* "numcodecs/lz4.pyx":189 * * # check decompression was successful * if decompressed_size <= 0: # <<<<<<<<<<<<<< @@ -2488,26 +2521,26 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_2decompress(CYTHON_UNUSED PyObject *__ __pyx_t_6 = ((__pyx_v_decompressed_size <= 0) != 0); if (unlikely(__pyx_t_6)) { - /* "numcodecs/lz4.pyx":189 + /* "numcodecs/lz4.pyx":190 * # check decompression was successful * if decompressed_size <= 0: * raise RuntimeError('LZ4 decompression error: %s' % decompressed_size) # <<<<<<<<<<<<<< * elif decompressed_size != dest_size: * raise RuntimeError('LZ4 decompression error: expected to decompress %s, got %s' % */ - __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_decompressed_size); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 189, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_decompressed_size); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 190, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_LZ4_decompression_error_s, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 189, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_LZ4_decompression_error_s, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 190, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 189, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 190, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_7, 0, 0, 0); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(0, 189, __pyx_L1_error) + __PYX_ERR(0, 190, __pyx_L1_error) - /* "numcodecs/lz4.pyx":188 + /* "numcodecs/lz4.pyx":189 * * # check decompression was successful * if decompressed_size <= 0: # <<<<<<<<<<<<<< @@ -2516,7 +2549,7 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_2decompress(CYTHON_UNUSED PyObject *__ */ } - /* "numcodecs/lz4.pyx":190 + /* "numcodecs/lz4.pyx":191 * if decompressed_size <= 0: * raise RuntimeError('LZ4 decompression error: %s' % decompressed_size) * elif decompressed_size != dest_size: # <<<<<<<<<<<<<< @@ -2526,18 +2559,18 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_2decompress(CYTHON_UNUSED PyObject *__ __pyx_t_6 = ((__pyx_v_decompressed_size != __pyx_v_dest_size) != 0); if (unlikely(__pyx_t_6)) { - /* "numcodecs/lz4.pyx":192 + /* "numcodecs/lz4.pyx":193 * elif decompressed_size != dest_size: * raise RuntimeError('LZ4 decompression error: expected to decompress %s, got %s' % * (dest_size, decompressed_size)) # <<<<<<<<<<<<<< * * return dest */ - __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_dest_size); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 192, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_dest_size); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_decompressed_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_decompressed_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7); @@ -2546,24 +2579,24 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_2decompress(CYTHON_UNUSED PyObject *__ __pyx_t_7 = 0; __pyx_t_2 = 0; - /* "numcodecs/lz4.pyx":191 + /* "numcodecs/lz4.pyx":192 * raise RuntimeError('LZ4 decompression error: %s' % decompressed_size) * elif decompressed_size != dest_size: * raise RuntimeError('LZ4 decompression error: expected to decompress %s, got %s' % # <<<<<<<<<<<<<< * (dest_size, decompressed_size)) * */ - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_LZ4_decompression_error_expected, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 191, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_LZ4_decompression_error_expected, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 191, __pyx_L1_error) + __PYX_ERR(0, 192, __pyx_L1_error) - /* "numcodecs/lz4.pyx":190 + /* "numcodecs/lz4.pyx":191 * if decompressed_size <= 0: * raise RuntimeError('LZ4 decompression error: %s' % decompressed_size) * elif decompressed_size != dest_size: # <<<<<<<<<<<<<< @@ -2572,7 +2605,7 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_2decompress(CYTHON_UNUSED PyObject *__ */ } - /* "numcodecs/lz4.pyx":194 + /* "numcodecs/lz4.pyx":195 * (dest_size, decompressed_size)) * * return dest # <<<<<<<<<<<<<< @@ -2602,13 +2635,14 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_2decompress(CYTHON_UNUSED PyObject *__ __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_source_buffer); __Pyx_XDECREF((PyObject *)__pyx_v_dest_buffer); + __Pyx_XDECREF(__pyx_v_arr); __Pyx_XDECREF(__pyx_v_dest); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "numcodecs/lz4.pyx":216 +/* "numcodecs/lz4.pyx":217 * max_buffer_size = 0x7E000000 * * def __init__(self, acceleration=DEFAULT_ACCELERATION): # <<<<<<<<<<<<<< @@ -2623,12 +2657,12 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_4__defaults__(CYTHON_UNUSED PyObject * PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("__defaults__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_acceleration); __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_acceleration); PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_acceleration); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); @@ -2691,7 +2725,7 @@ static PyObject *__pyx_pw_9numcodecs_3lz4_3LZ4_1__init__(PyObject *__pyx_self, P } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 216, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 217, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -2707,7 +2741,7 @@ static PyObject *__pyx_pw_9numcodecs_3lz4_3LZ4_1__init__(PyObject *__pyx_self, P } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 216, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 217, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.lz4.LZ4.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -2725,16 +2759,16 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4___init__(CYTHON_UNUSED PyObject * __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); - /* "numcodecs/lz4.pyx":217 + /* "numcodecs/lz4.pyx":218 * * def __init__(self, acceleration=DEFAULT_ACCELERATION): * self.acceleration = acceleration # <<<<<<<<<<<<<< * * def encode(self, buf): */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_acceleration, __pyx_v_acceleration) < 0) __PYX_ERR(0, 217, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_acceleration, __pyx_v_acceleration) < 0) __PYX_ERR(0, 218, __pyx_L1_error) - /* "numcodecs/lz4.pyx":216 + /* "numcodecs/lz4.pyx":217 * max_buffer_size = 0x7E000000 * * def __init__(self, acceleration=DEFAULT_ACCELERATION): # <<<<<<<<<<<<<< @@ -2754,11 +2788,11 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4___init__(CYTHON_UNUSED PyObject * return __pyx_r; } -/* "numcodecs/lz4.pyx":219 +/* "numcodecs/lz4.pyx":220 * self.acceleration = acceleration * * def encode(self, buf): # <<<<<<<<<<<<<< - * buf = ensure_ndarray(buf, self.max_buffer_size) + * buf = ensure_contiguous_ndarray(buf, self.max_buffer_size) * return compress(buf, self.acceleration) */ @@ -2795,11 +2829,11 @@ static PyObject *__pyx_pw_9numcodecs_3lz4_3LZ4_3encode(PyObject *__pyx_self, PyO case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buf)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, 1); __PYX_ERR(0, 219, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, 1); __PYX_ERR(0, 220, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode") < 0)) __PYX_ERR(0, 219, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode") < 0)) __PYX_ERR(0, 220, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -2812,7 +2846,7 @@ static PyObject *__pyx_pw_9numcodecs_3lz4_3LZ4_3encode(PyObject *__pyx_self, PyO } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 219, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 220, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.lz4.LZ4.encode", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -2837,16 +2871,16 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_2encode(CYTHON_UNUSED PyObject *_ __Pyx_RefNannySetupContext("encode", 0); __Pyx_INCREF(__pyx_v_buf); - /* "numcodecs/lz4.pyx":220 + /* "numcodecs/lz4.pyx":221 * * def encode(self, buf): - * buf = ensure_ndarray(buf, self.max_buffer_size) # <<<<<<<<<<<<<< + * buf = ensure_contiguous_ndarray(buf, self.max_buffer_size) # <<<<<<<<<<<<<< * return compress(buf, self.acceleration) * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ensure_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 220, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ensure_contiguous_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_buffer_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 220, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_buffer_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; __pyx_t_5 = 0; @@ -2863,7 +2897,7 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_2encode(CYTHON_UNUSED PyObject *_ #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_buf, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -2872,14 +2906,14 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_2encode(CYTHON_UNUSED PyObject *_ #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_buf, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { - __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 220, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; @@ -2890,7 +2924,7 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_2encode(CYTHON_UNUSED PyObject *_ __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_3); __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } @@ -2898,17 +2932,17 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_2encode(CYTHON_UNUSED PyObject *_ __Pyx_DECREF_SET(__pyx_v_buf, __pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/lz4.pyx":221 + /* "numcodecs/lz4.pyx":222 * def encode(self, buf): - * buf = ensure_ndarray(buf, self.max_buffer_size) + * buf = ensure_contiguous_ndarray(buf, self.max_buffer_size) * return compress(buf, self.acceleration) # <<<<<<<<<<<<<< * * def decode(self, buf, out=None): */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_compress); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_compress); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_acceleration); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 221, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_acceleration); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_3 = NULL; __pyx_t_5 = 0; @@ -2925,7 +2959,7 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_2encode(CYTHON_UNUSED PyObject *_ #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_buf, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; @@ -2934,14 +2968,14 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_2encode(CYTHON_UNUSED PyObject *_ #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_buf, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else #endif { - __pyx_t_4 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 221, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__pyx_t_3) { __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; @@ -2952,7 +2986,7 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_2encode(CYTHON_UNUSED PyObject *_ __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, __pyx_t_6); __pyx_t_6 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } @@ -2961,11 +2995,11 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_2encode(CYTHON_UNUSED PyObject *_ __pyx_t_1 = 0; goto __pyx_L0; - /* "numcodecs/lz4.pyx":219 + /* "numcodecs/lz4.pyx":220 * self.acceleration = acceleration * * def encode(self, buf): # <<<<<<<<<<<<<< - * buf = ensure_ndarray(buf, self.max_buffer_size) + * buf = ensure_contiguous_ndarray(buf, self.max_buffer_size) * return compress(buf, self.acceleration) */ @@ -2985,11 +3019,11 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_2encode(CYTHON_UNUSED PyObject *_ return __pyx_r; } -/* "numcodecs/lz4.pyx":223 +/* "numcodecs/lz4.pyx":224 * return compress(buf, self.acceleration) * * def decode(self, buf, out=None): # <<<<<<<<<<<<<< - * buf = ensure_ndarray(buf, self.max_buffer_size) + * buf = ensure_contiguous_ndarray(buf, self.max_buffer_size) * return decompress(buf, out) */ @@ -3030,7 +3064,7 @@ static PyObject *__pyx_pw_9numcodecs_3lz4_3LZ4_5decode(PyObject *__pyx_self, PyO case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buf)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, 1); __PYX_ERR(0, 223, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, 1); __PYX_ERR(0, 224, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -3040,7 +3074,7 @@ static PyObject *__pyx_pw_9numcodecs_3lz4_3LZ4_5decode(PyObject *__pyx_self, PyO } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode") < 0)) __PYX_ERR(0, 223, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode") < 0)) __PYX_ERR(0, 224, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3058,7 +3092,7 @@ static PyObject *__pyx_pw_9numcodecs_3lz4_3LZ4_5decode(PyObject *__pyx_self, PyO } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 223, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 224, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.lz4.LZ4.decode", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3083,16 +3117,16 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_4decode(CYTHON_UNUSED PyObject *_ __Pyx_RefNannySetupContext("decode", 0); __Pyx_INCREF(__pyx_v_buf); - /* "numcodecs/lz4.pyx":224 + /* "numcodecs/lz4.pyx":225 * * def decode(self, buf, out=None): - * buf = ensure_ndarray(buf, self.max_buffer_size) # <<<<<<<<<<<<<< + * buf = ensure_contiguous_ndarray(buf, self.max_buffer_size) # <<<<<<<<<<<<<< * return decompress(buf, out) * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ensure_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ensure_contiguous_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_buffer_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 224, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_buffer_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; __pyx_t_5 = 0; @@ -3109,7 +3143,7 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_4decode(CYTHON_UNUSED PyObject *_ #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_buf, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 224, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -3118,14 +3152,14 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_4decode(CYTHON_UNUSED PyObject *_ #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_buf, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 224, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { - __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 224, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; @@ -3136,7 +3170,7 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_4decode(CYTHON_UNUSED PyObject *_ __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_3); __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 224, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } @@ -3144,15 +3178,15 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_4decode(CYTHON_UNUSED PyObject *_ __Pyx_DECREF_SET(__pyx_v_buf, __pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/lz4.pyx":225 + /* "numcodecs/lz4.pyx":226 * def decode(self, buf, out=None): - * buf = ensure_ndarray(buf, self.max_buffer_size) + * buf = ensure_contiguous_ndarray(buf, self.max_buffer_size) * return decompress(buf, out) # <<<<<<<<<<<<<< * * def __repr__(self): */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_decompress); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_decompress); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_6 = NULL; __pyx_t_5 = 0; @@ -3169,7 +3203,7 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_4decode(CYTHON_UNUSED PyObject *_ #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_buf, __pyx_v_out}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_1); } else @@ -3177,13 +3211,13 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_4decode(CYTHON_UNUSED PyObject *_ #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_buf, __pyx_v_out}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif { - __pyx_t_3 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 225, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (__pyx_t_6) { __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __pyx_t_6 = NULL; @@ -3194,7 +3228,7 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_4decode(CYTHON_UNUSED PyObject *_ __Pyx_INCREF(__pyx_v_out); __Pyx_GIVEREF(__pyx_v_out); PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_5, __pyx_v_out); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } @@ -3203,11 +3237,11 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_4decode(CYTHON_UNUSED PyObject *_ __pyx_t_1 = 0; goto __pyx_L0; - /* "numcodecs/lz4.pyx":223 + /* "numcodecs/lz4.pyx":224 * return compress(buf, self.acceleration) * * def decode(self, buf, out=None): # <<<<<<<<<<<<<< - * buf = ensure_ndarray(buf, self.max_buffer_size) + * buf = ensure_contiguous_ndarray(buf, self.max_buffer_size) * return decompress(buf, out) */ @@ -3227,7 +3261,7 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_4decode(CYTHON_UNUSED PyObject *_ return __pyx_r; } -/* "numcodecs/lz4.pyx":227 +/* "numcodecs/lz4.pyx":228 * return decompress(buf, out) * * def __repr__(self): # <<<<<<<<<<<<<< @@ -3259,33 +3293,33 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_6__repr__(CYTHON_UNUSED PyObject PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("__repr__", 0); - /* "numcodecs/lz4.pyx":229 + /* "numcodecs/lz4.pyx":230 * def __repr__(self): * r = '%s(acceleration=%r)' % \ * (type(self).__name__, # <<<<<<<<<<<<<< * self.acceleration) * return r */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_self)), __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_self)), __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - /* "numcodecs/lz4.pyx":230 + /* "numcodecs/lz4.pyx":231 * r = '%s(acceleration=%r)' % \ * (type(self).__name__, * self.acceleration) # <<<<<<<<<<<<<< * return r */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_acceleration); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 230, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_acceleration); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 231, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - /* "numcodecs/lz4.pyx":229 + /* "numcodecs/lz4.pyx":230 * def __repr__(self): * r = '%s(acceleration=%r)' % \ * (type(self).__name__, # <<<<<<<<<<<<<< * self.acceleration) * return r */ - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 229, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 230, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); @@ -3294,20 +3328,20 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_6__repr__(CYTHON_UNUSED PyObject __pyx_t_1 = 0; __pyx_t_2 = 0; - /* "numcodecs/lz4.pyx":228 + /* "numcodecs/lz4.pyx":229 * * def __repr__(self): * r = '%s(acceleration=%r)' % \ # <<<<<<<<<<<<<< * (type(self).__name__, * self.acceleration) */ - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_s_acceleration_r, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 228, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_s_acceleration_r, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/lz4.pyx":231 + /* "numcodecs/lz4.pyx":232 * (type(self).__name__, * self.acceleration) * return r # <<<<<<<<<<<<<< @@ -3317,7 +3351,7 @@ static PyObject *__pyx_pf_9numcodecs_3lz4_3LZ4_6__repr__(CYTHON_UNUSED PyObject __pyx_r = __pyx_v_r; goto __pyx_L0; - /* "numcodecs/lz4.pyx":227 + /* "numcodecs/lz4.pyx":228 * return decompress(buf, out) * * def __repr__(self): # <<<<<<<<<<<<<< @@ -3404,6 +3438,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, {&__pyx_n_s_abc, __pyx_k_abc, sizeof(__pyx_k_abc), 0, 0, 1, 1}, {&__pyx_n_s_acceleration, __pyx_k_acceleration, sizeof(__pyx_k_acceleration), 0, 0, 1, 1}, + {&__pyx_n_s_arr, __pyx_k_arr, sizeof(__pyx_k_arr), 0, 0, 1, 1}, {&__pyx_n_s_ascii, __pyx_k_ascii, sizeof(__pyx_k_ascii), 0, 0, 1, 1}, {&__pyx_kp_s_bad_input_data, __pyx_k_bad_input_data, sizeof(__pyx_k_bad_input_data), 0, 0, 1, 0}, {&__pyx_n_s_buf, __pyx_k_buf, sizeof(__pyx_k_buf), 0, 0, 1, 1}, @@ -3424,7 +3459,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_destination_buffer_too_small_exp, __pyx_k_destination_buffer_too_small_exp, sizeof(__pyx_k_destination_buffer_too_small_exp), 0, 0, 1, 0}, {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, - {&__pyx_n_s_ensure_ndarray, __pyx_k_ensure_ndarray, sizeof(__pyx_k_ensure_ndarray), 0, 0, 1, 1}, + {&__pyx_n_s_ensure_contiguous_ndarray, __pyx_k_ensure_contiguous_ndarray, sizeof(__pyx_k_ensure_contiguous_ndarray), 0, 0, 1, 1}, {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, {&__pyx_n_s_lz4, __pyx_k_lz4, sizeof(__pyx_k_lz4), 0, 0, 1, 1}, @@ -3505,61 +3540,61 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * """Decompress data. * */ - __pyx_tuple__6 = PyTuple_Pack(10, __pyx_n_s_source, __pyx_n_s_dest, __pyx_n_s_source_ptr, __pyx_n_s_source_start, __pyx_n_s_dest_ptr, __pyx_n_s_source_buffer, __pyx_n_s_dest_buffer, __pyx_n_s_source_size, __pyx_n_s_dest_size, __pyx_n_s_decompressed_size); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 124, __pyx_L1_error) + __pyx_tuple__6 = PyTuple_Pack(11, __pyx_n_s_source, __pyx_n_s_dest, __pyx_n_s_source_ptr, __pyx_n_s_source_start, __pyx_n_s_dest_ptr, __pyx_n_s_source_buffer, __pyx_n_s_dest_buffer, __pyx_n_s_source_size, __pyx_n_s_dest_size, __pyx_n_s_decompressed_size, __pyx_n_s_arr); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 124, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__6); __Pyx_GIVEREF(__pyx_tuple__6); - __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(2, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_lz4_pyx, __pyx_n_s_decompress, 124, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 124, __pyx_L1_error) + __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(2, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_lz4_pyx, __pyx_n_s_decompress, 124, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 124, __pyx_L1_error) - /* "numcodecs/lz4.pyx":216 + /* "numcodecs/lz4.pyx":217 * max_buffer_size = 0x7E000000 * * def __init__(self, acceleration=DEFAULT_ACCELERATION): # <<<<<<<<<<<<<< * self.acceleration = acceleration * */ - __pyx_tuple__8 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_acceleration); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 216, __pyx_L1_error) + __pyx_tuple__8 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_acceleration); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8); - __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_lz4_pyx, __pyx_n_s_init, 216, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 216, __pyx_L1_error) + __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_lz4_pyx, __pyx_n_s_init, 217, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 217, __pyx_L1_error) - /* "numcodecs/lz4.pyx":219 + /* "numcodecs/lz4.pyx":220 * self.acceleration = acceleration * * def encode(self, buf): # <<<<<<<<<<<<<< - * buf = ensure_ndarray(buf, self.max_buffer_size) + * buf = ensure_contiguous_ndarray(buf, self.max_buffer_size) * return compress(buf, self.acceleration) */ - __pyx_tuple__10 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_buf); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 219, __pyx_L1_error) + __pyx_tuple__10 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_buf); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); - __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_lz4_pyx, __pyx_n_s_encode, 219, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 219, __pyx_L1_error) + __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_lz4_pyx, __pyx_n_s_encode, 220, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 220, __pyx_L1_error) - /* "numcodecs/lz4.pyx":223 + /* "numcodecs/lz4.pyx":224 * return compress(buf, self.acceleration) * * def decode(self, buf, out=None): # <<<<<<<<<<<<<< - * buf = ensure_ndarray(buf, self.max_buffer_size) + * buf = ensure_contiguous_ndarray(buf, self.max_buffer_size) * return decompress(buf, out) */ - __pyx_tuple__12 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_buf, __pyx_n_s_out); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 223, __pyx_L1_error) + __pyx_tuple__12 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_buf, __pyx_n_s_out); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12); - __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_lz4_pyx, __pyx_n_s_decode, 223, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 223, __pyx_L1_error) - __pyx_tuple__14 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 223, __pyx_L1_error) + __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_lz4_pyx, __pyx_n_s_decode, 224, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 224, __pyx_L1_error) + __pyx_tuple__14 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__14); __Pyx_GIVEREF(__pyx_tuple__14); - /* "numcodecs/lz4.pyx":227 + /* "numcodecs/lz4.pyx":228 * return decompress(buf, out) * * def __repr__(self): # <<<<<<<<<<<<<< * r = '%s(acceleration=%r)' % \ * (type(self).__name__, */ - __pyx_tuple__15 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_r); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 227, __pyx_L1_error) + __pyx_tuple__15 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_r); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 228, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__15); __Pyx_GIVEREF(__pyx_tuple__15); - __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_lz4_pyx, __pyx_n_s_repr, 227, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 227, __pyx_L1_error) + __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_lz4_pyx, __pyx_n_s_repr, 228, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 228, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -3869,7 +3904,7 @@ if (!__Pyx_RefNanny) { * * from .compat_ext cimport Buffer * from .compat_ext import Buffer # <<<<<<<<<<<<<< - * from .compat import PY2, ensure_ndarray + * from .compat import PY2, ensure_contiguous_ndarray * from .abc import Codec */ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error) @@ -3885,7 +3920,7 @@ if (!__Pyx_RefNanny) { /* "numcodecs/lz4.pyx":16 * from .compat_ext cimport Buffer * from .compat_ext import Buffer - * from .compat import PY2, ensure_ndarray # <<<<<<<<<<<<<< + * from .compat import PY2, ensure_contiguous_ndarray # <<<<<<<<<<<<<< * from .abc import Codec * */ @@ -3894,9 +3929,9 @@ if (!__Pyx_RefNanny) { __Pyx_INCREF(__pyx_n_s_PY2); __Pyx_GIVEREF(__pyx_n_s_PY2); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PY2); - __Pyx_INCREF(__pyx_n_s_ensure_ndarray); - __Pyx_GIVEREF(__pyx_n_s_ensure_ndarray); - PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_ensure_ndarray); + __Pyx_INCREF(__pyx_n_s_ensure_contiguous_ndarray); + __Pyx_GIVEREF(__pyx_n_s_ensure_contiguous_ndarray); + PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_ensure_contiguous_ndarray); __pyx_t_1 = __Pyx_Import(__pyx_n_s_compat, __pyx_t_2, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -3904,15 +3939,15 @@ if (!__Pyx_RefNanny) { __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_PY2, __pyx_t_2) < 0) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ensure_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ensure_contiguous_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_ensure_ndarray, __pyx_t_2) < 0) __PYX_ERR(0, 16, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ensure_contiguous_ndarray, __pyx_t_2) < 0) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "numcodecs/lz4.pyx":17 * from .compat_ext import Buffer - * from .compat import PY2, ensure_ndarray + * from .compat import PY2, ensure_contiguous_ndarray * from .abc import Codec # <<<<<<<<<<<<<< * * @@ -4039,109 +4074,109 @@ if (!__Pyx_RefNanny) { if (PyDict_SetItem(__pyx_d, __pyx_n_s_decompress, __pyx_t_2) < 0) __PYX_ERR(0, 124, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/lz4.pyx":198 + /* "numcodecs/lz4.pyx":199 * * * class LZ4(Codec): # <<<<<<<<<<<<<< * """Codec providing compression using LZ4. * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Codec); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 198, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Codec); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 198, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 198, __pyx_L1_error) + __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_LZ4, __pyx_n_s_LZ4, (PyObject *) NULL, __pyx_n_s_numcodecs_lz4, __pyx_kp_s_Codec_providing_compression_usin); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 198, __pyx_L1_error) + __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_LZ4, __pyx_n_s_LZ4, (PyObject *) NULL, __pyx_n_s_numcodecs_lz4, __pyx_kp_s_Codec_providing_compression_usin); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - /* "numcodecs/lz4.pyx":213 + /* "numcodecs/lz4.pyx":214 * """ * * codec_id = 'lz4' # <<<<<<<<<<<<<< * max_buffer_size = 0x7E000000 * */ - if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_codec_id, __pyx_n_s_lz4) < 0) __PYX_ERR(0, 213, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_codec_id, __pyx_n_s_lz4) < 0) __PYX_ERR(0, 214, __pyx_L1_error) - /* "numcodecs/lz4.pyx":214 + /* "numcodecs/lz4.pyx":215 * * codec_id = 'lz4' * max_buffer_size = 0x7E000000 # <<<<<<<<<<<<<< * * def __init__(self, acceleration=DEFAULT_ACCELERATION): */ - if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_max_buffer_size, __pyx_int_2113929216) < 0) __PYX_ERR(0, 214, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_max_buffer_size, __pyx_int_2113929216) < 0) __PYX_ERR(0, 215, __pyx_L1_error) - /* "numcodecs/lz4.pyx":216 + /* "numcodecs/lz4.pyx":217 * max_buffer_size = 0x7E000000 * * def __init__(self, acceleration=DEFAULT_ACCELERATION): # <<<<<<<<<<<<<< * self.acceleration = acceleration * */ - __pyx_t_7 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_3lz4_3LZ4_1__init__, 0, __pyx_n_s_LZ4___init, NULL, __pyx_n_s_numcodecs_lz4, __pyx_d, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 216, __pyx_L1_error) + __pyx_t_7 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_3lz4_3LZ4_1__init__, 0, __pyx_n_s_LZ4___init, NULL, __pyx_n_s_numcodecs_lz4, __pyx_d, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - if (!__Pyx_CyFunction_InitDefaults(__pyx_t_7, sizeof(__pyx_defaults), 1)) __PYX_ERR(0, 216, __pyx_L1_error) - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_DEFAULT_ACCELERATION); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 216, __pyx_L1_error) + if (!__Pyx_CyFunction_InitDefaults(__pyx_t_7, sizeof(__pyx_defaults), 1)) __PYX_ERR(0, 217, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_DEFAULT_ACCELERATION); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_7)->__pyx_arg_acceleration = __pyx_t_8; __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_7, __pyx_pf_9numcodecs_3lz4_4__defaults__); - if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_init, __pyx_t_7) < 0) __PYX_ERR(0, 216, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_init, __pyx_t_7) < 0) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/lz4.pyx":219 + /* "numcodecs/lz4.pyx":220 * self.acceleration = acceleration * * def encode(self, buf): # <<<<<<<<<<<<<< - * buf = ensure_ndarray(buf, self.max_buffer_size) + * buf = ensure_contiguous_ndarray(buf, self.max_buffer_size) * return compress(buf, self.acceleration) */ - __pyx_t_7 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_3lz4_3LZ4_3encode, 0, __pyx_n_s_LZ4_encode, NULL, __pyx_n_s_numcodecs_lz4, __pyx_d, ((PyObject *)__pyx_codeobj__11)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 219, __pyx_L1_error) + __pyx_t_7 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_3lz4_3LZ4_3encode, 0, __pyx_n_s_LZ4_encode, NULL, __pyx_n_s_numcodecs_lz4, __pyx_d, ((PyObject *)__pyx_codeobj__11)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_encode, __pyx_t_7) < 0) __PYX_ERR(0, 219, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_encode, __pyx_t_7) < 0) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/lz4.pyx":223 + /* "numcodecs/lz4.pyx":224 * return compress(buf, self.acceleration) * * def decode(self, buf, out=None): # <<<<<<<<<<<<<< - * buf = ensure_ndarray(buf, self.max_buffer_size) + * buf = ensure_contiguous_ndarray(buf, self.max_buffer_size) * return decompress(buf, out) */ - __pyx_t_7 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_3lz4_3LZ4_5decode, 0, __pyx_n_s_LZ4_decode, NULL, __pyx_n_s_numcodecs_lz4, __pyx_d, ((PyObject *)__pyx_codeobj__13)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 223, __pyx_L1_error) + __pyx_t_7 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_3lz4_3LZ4_5decode, 0, __pyx_n_s_LZ4_decode, NULL, __pyx_n_s_numcodecs_lz4, __pyx_d, ((PyObject *)__pyx_codeobj__13)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__14); - if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_decode, __pyx_t_7) < 0) __PYX_ERR(0, 223, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_decode, __pyx_t_7) < 0) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/lz4.pyx":227 + /* "numcodecs/lz4.pyx":228 * return decompress(buf, out) * * def __repr__(self): # <<<<<<<<<<<<<< * r = '%s(acceleration=%r)' % \ * (type(self).__name__, */ - __pyx_t_7 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_3lz4_3LZ4_7__repr__, 0, __pyx_n_s_LZ4___repr, NULL, __pyx_n_s_numcodecs_lz4, __pyx_d, ((PyObject *)__pyx_codeobj__16)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 227, __pyx_L1_error) + __pyx_t_7 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_3lz4_3LZ4_7__repr__, 0, __pyx_n_s_LZ4___repr, NULL, __pyx_n_s_numcodecs_lz4, __pyx_d, ((PyObject *)__pyx_codeobj__16)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_repr, __pyx_t_7) < 0) __PYX_ERR(0, 227, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_repr, __pyx_t_7) < 0) __PYX_ERR(0, 228, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/lz4.pyx":198 + /* "numcodecs/lz4.pyx":199 * * * class LZ4(Codec): # <<<<<<<<<<<<<< * """Codec providing compression using LZ4. * */ - __pyx_t_7 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_LZ4, __pyx_t_1, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 198, __pyx_L1_error) + __pyx_t_7 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_LZ4, __pyx_t_1, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LZ4, __pyx_t_7) < 0) __PYX_ERR(0, 198, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LZ4, __pyx_t_7) < 0) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -4978,6 +5013,35 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } #endif +/* PyObjectCall2Args */ +static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { + PyObject *args, *result = NULL; + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(function)) { + PyObject *args[2] = {arg1, arg2}; + return __Pyx_PyFunction_FastCall(function, args, 2); + } + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(function)) { + PyObject *args[2] = {arg1, arg2}; + return __Pyx_PyCFunction_FastCall(function, args, 2); + } + #endif + args = PyTuple_New(2); + if (unlikely(!args)) goto done; + Py_INCREF(arg1); + PyTuple_SET_ITEM(args, 0, arg1); + Py_INCREF(arg2); + PyTuple_SET_ITEM(args, 1, arg2); + Py_INCREF(function); + result = __Pyx_PyObject_Call(function, args, NULL); + Py_DECREF(args); + Py_DECREF(function); +done: + return result; +} + /* PyObjectSetAttrStr */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { diff --git a/numcodecs/lz4.pyx b/numcodecs/lz4.pyx index 172e91c3..ea6289c3 100644 --- a/numcodecs/lz4.pyx +++ b/numcodecs/lz4.pyx @@ -167,7 +167,8 @@ def decompress(source, dest=None): dest = PyBytes_FromStringAndSize(NULL, dest_size) dest_ptr = PyBytes_AS_STRING(dest) else: - dest_buffer = Buffer(dest, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) + arr = ensure_contiguous_ndarray(dest) + dest_buffer = Buffer(arr, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) dest_ptr = dest_buffer.ptr if dest_buffer.nbytes < dest_size: raise ValueError('destination buffer too small; expected at least %s, ' diff --git a/numcodecs/zstd.c b/numcodecs/zstd.c index 0542400d..a04e62f0 100644 --- a/numcodecs/zstd.c +++ b/numcodecs/zstd.c @@ -12,38 +12,38 @@ ], "include_dirs": [ "c-blosc/internal-complibs/zstd-1.3.4", - "c-blosc/internal-complibs/zstd-1.3.4/decompress", + "c-blosc/internal-complibs/zstd-1.3.4/compress", "c-blosc/internal-complibs/zstd-1.3.4/legacy", - "c-blosc/internal-complibs/zstd-1.3.4/common", "c-blosc/internal-complibs/zstd-1.3.4/deprecated", - "c-blosc/internal-complibs/zstd-1.3.4/compress", "c-blosc/internal-complibs/zstd-1.3.4/dictBuilder", + "c-blosc/internal-complibs/zstd-1.3.4/decompress", + "c-blosc/internal-complibs/zstd-1.3.4/common", "c-blosc/internal-complibs/zstd-1.3.4/dll" ], "name": "numcodecs.zstd", "sources": [ "numcodecs/zstd.pyx", - "c-blosc/internal-complibs/zstd-1.3.4/common/pool.c", - "c-blosc/internal-complibs/zstd-1.3.4/common/fse_decompress.c", - "c-blosc/internal-complibs/zstd-1.3.4/common/zstd_common.c", - "c-blosc/internal-complibs/zstd-1.3.4/common/threading.c", "c-blosc/internal-complibs/zstd-1.3.4/common/error_private.c", "c-blosc/internal-complibs/zstd-1.3.4/common/xxhash.c", + "c-blosc/internal-complibs/zstd-1.3.4/common/zstd_common.c", "c-blosc/internal-complibs/zstd-1.3.4/common/entropy_common.c", - "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_double_fast.c", + "c-blosc/internal-complibs/zstd-1.3.4/common/fse_decompress.c", + "c-blosc/internal-complibs/zstd-1.3.4/common/threading.c", + "c-blosc/internal-complibs/zstd-1.3.4/common/pool.c", + "c-blosc/internal-complibs/zstd-1.3.4/compress/huf_compress.c", "c-blosc/internal-complibs/zstd-1.3.4/compress/zstdmt_compress.c", - "c-blosc/internal-complibs/zstd-1.3.4/compress/fse_compress.c", "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_lazy.c", - "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_ldm.c", - "c-blosc/internal-complibs/zstd-1.3.4/compress/huf_compress.c", - "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_opt.c", "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_fast.c", + "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_opt.c", + "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_double_fast.c", + "c-blosc/internal-complibs/zstd-1.3.4/compress/fse_compress.c", "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_compress.c", + "c-blosc/internal-complibs/zstd-1.3.4/compress/zstd_ldm.c", "c-blosc/internal-complibs/zstd-1.3.4/decompress/huf_decompress.c", "c-blosc/internal-complibs/zstd-1.3.4/decompress/zstd_decompress.c", - "c-blosc/internal-complibs/zstd-1.3.4/dictBuilder/divsufsort.c", + "c-blosc/internal-complibs/zstd-1.3.4/dictBuilder/zdict.c", "c-blosc/internal-complibs/zstd-1.3.4/dictBuilder/cover.c", - "c-blosc/internal-complibs/zstd-1.3.4/dictBuilder/zdict.c" + "c-blosc/internal-complibs/zstd-1.3.4/dictBuilder/divsufsort.c" ] }, "module_name": "numcodecs.zstd" @@ -1137,6 +1137,9 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObjec /* RaiseException.proto */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); +/* PyObjectCall2Args.proto */ +static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); + /* PyObjectSetAttrStr.proto */ #if CYTHON_USE_TYPE_SLOTS #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL) @@ -1342,6 +1345,7 @@ static PyObject *__pyx_builtin_RuntimeError; static PyObject *__pyx_builtin_ValueError; static const char __pyx_k_r[] = "r"; static const char __pyx_k_abc[] = "abc"; +static const char __pyx_k_arr[] = "arr"; static const char __pyx_k_buf[] = "buf"; static const char __pyx_k_doc[] = "__doc__"; static const char __pyx_k_out[] = "out"; @@ -1359,6 +1363,7 @@ static const char __pyx_k_error[] = "error"; static const char __pyx_k_level[] = "level"; static const char __pyx_k_s_s_s[] = "%s.%s.%s"; static const char __pyx_k_Buffer[] = "Buffer"; +static const char __pyx_k_compat[] = "compat"; static const char __pyx_k_decode[] = "decode"; static const char __pyx_k_encode[] = "encode"; static const char __pyx_k_import[] = "__import__"; @@ -1398,6 +1403,7 @@ static const char __pyx_k_MAJOR_VERSION_NUMBER[] = "MAJOR_VERSION_NUMBER"; static const char __pyx_k_MICRO_VERSION_NUMBER[] = "MICRO_VERSION_NUMBER"; static const char __pyx_k_MINOR_VERSION_NUMBER[] = "MINOR_VERSION_NUMBER"; static const char __pyx_k_Zstd_compression_error_s[] = "Zstd compression error: %s"; +static const char __pyx_k_ensure_contiguous_ndarray[] = "ensure_contiguous_ndarray"; static const char __pyx_k_Zstd_decompression_error_s[] = "Zstd decompression error: %s"; static const char __pyx_k_Codec_providing_compression_usin[] = "Codec providing compression using Zstandard.\n\n Parameters\n ----------\n level : int\n Compression level (1-22).\n\n See Also\n --------\n numcodecs.lz4.LZ4, numcodecs.blosc.Blosc\n\n "; static const char __pyx_k_Zstd_decompression_error_expecte[] = "Zstd decompression error: expected to decompress %s, got %s"; @@ -1424,9 +1430,11 @@ static PyObject *__pyx_kp_s_Zstd_decompression_error_invalid; static PyObject *__pyx_kp_s_Zstd_decompression_error_s; static PyObject *__pyx_n_s_Zstd_encode; static PyObject *__pyx_n_s_abc; +static PyObject *__pyx_n_s_arr; static PyObject *__pyx_n_s_buf; static PyObject *__pyx_n_s_cline_in_traceback; static PyObject *__pyx_n_s_codec_id; +static PyObject *__pyx_n_s_compat; static PyObject *__pyx_n_s_compat_ext; static PyObject *__pyx_n_s_compress; static PyObject *__pyx_n_s_compressed_size; @@ -1440,6 +1448,7 @@ static PyObject *__pyx_n_s_dest_size; static PyObject *__pyx_kp_s_destination_buffer_too_small_exp; static PyObject *__pyx_n_s_doc; static PyObject *__pyx_n_s_encode; +static PyObject *__pyx_n_s_ensure_contiguous_ndarray; static PyObject *__pyx_n_s_error; static PyObject *__pyx_n_s_import; static PyObject *__pyx_n_s_init; @@ -1493,7 +1502,7 @@ static PyObject *__pyx_codeobj__12; static PyObject *__pyx_codeobj__15; /* Late includes */ -/* "numcodecs/zstd.pyx":59 +/* "numcodecs/zstd.pyx":60 * * * def compress(source, int level=DEFAULT_CLEVEL): # <<<<<<<<<<<<<< @@ -1538,7 +1547,7 @@ static PyObject *__pyx_pw_9numcodecs_4zstd_1compress(PyObject *__pyx_self, PyObj } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "compress") < 0)) __PYX_ERR(0, 59, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "compress") < 0)) __PYX_ERR(0, 60, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -1551,14 +1560,14 @@ static PyObject *__pyx_pw_9numcodecs_4zstd_1compress(PyObject *__pyx_self, PyObj } __pyx_v_source = values[0]; if (values[1]) { - __pyx_v_level = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L3_error) + __pyx_v_level = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 60, __pyx_L3_error) } else { __pyx_v_level = __pyx_k_; } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("compress", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 59, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("compress", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 60, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.zstd.compress", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -1599,7 +1608,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_compress(CYTHON_UNUSED PyObject *__py PyObject *__pyx_t_15 = NULL; __Pyx_RefNannySetupContext("compress", 0); - /* "numcodecs/zstd.pyx":84 + /* "numcodecs/zstd.pyx":85 * * # check level * if level <= 0: # <<<<<<<<<<<<<< @@ -1609,20 +1618,20 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_compress(CYTHON_UNUSED PyObject *__py __pyx_t_1 = ((__pyx_v_level <= 0) != 0); if (__pyx_t_1) { - /* "numcodecs/zstd.pyx":85 + /* "numcodecs/zstd.pyx":86 * # check level * if level <= 0: * level = DEFAULT_CLEVEL # <<<<<<<<<<<<<< * if level > MAX_CLEVEL: * level = MAX_CLEVEL */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DEFAULT_CLEVEL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DEFAULT_CLEVEL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 85, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_level = __pyx_t_3; - /* "numcodecs/zstd.pyx":84 + /* "numcodecs/zstd.pyx":85 * * # check level * if level <= 0: # <<<<<<<<<<<<<< @@ -1631,38 +1640,38 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_compress(CYTHON_UNUSED PyObject *__py */ } - /* "numcodecs/zstd.pyx":86 + /* "numcodecs/zstd.pyx":87 * if level <= 0: * level = DEFAULT_CLEVEL * if level > MAX_CLEVEL: # <<<<<<<<<<<<<< * level = MAX_CLEVEL * */ - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_level); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_level); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_MAX_CLEVEL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_MAX_CLEVEL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_1) { - /* "numcodecs/zstd.pyx":87 + /* "numcodecs/zstd.pyx":88 * level = DEFAULT_CLEVEL * if level > MAX_CLEVEL: * level = MAX_CLEVEL # <<<<<<<<<<<<<< * * # setup source buffer */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_MAX_CLEVEL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_MAX_CLEVEL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_level = __pyx_t_3; - /* "numcodecs/zstd.pyx":86 + /* "numcodecs/zstd.pyx":87 * if level <= 0: * level = DEFAULT_CLEVEL * if level > MAX_CLEVEL: # <<<<<<<<<<<<<< @@ -1671,16 +1680,16 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_compress(CYTHON_UNUSED PyObject *__py */ } - /* "numcodecs/zstd.pyx":90 + /* "numcodecs/zstd.pyx":91 * * # setup source buffer * source_buffer = Buffer(source, PyBUF_ANY_CONTIGUOUS) # <<<<<<<<<<<<<< * source_ptr = source_buffer.ptr * source_size = source_buffer.nbytes */ - __pyx_t_5 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 90, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 90, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_source); __Pyx_GIVEREF(__pyx_v_source); @@ -1688,13 +1697,13 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_compress(CYTHON_UNUSED PyObject *__py __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 90, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_source_buffer = ((struct __pyx_obj_9numcodecs_10compat_ext_Buffer *)__pyx_t_5); __pyx_t_5 = 0; - /* "numcodecs/zstd.pyx":91 + /* "numcodecs/zstd.pyx":92 * # setup source buffer * source_buffer = Buffer(source, PyBUF_ANY_CONTIGUOUS) * source_ptr = source_buffer.ptr # <<<<<<<<<<<<<< @@ -1704,7 +1713,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_compress(CYTHON_UNUSED PyObject *__py __pyx_t_6 = __pyx_v_source_buffer->ptr; __pyx_v_source_ptr = __pyx_t_6; - /* "numcodecs/zstd.pyx":92 + /* "numcodecs/zstd.pyx":93 * source_buffer = Buffer(source, PyBUF_ANY_CONTIGUOUS) * source_ptr = source_buffer.ptr * source_size = source_buffer.nbytes # <<<<<<<<<<<<<< @@ -1714,7 +1723,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_compress(CYTHON_UNUSED PyObject *__py __pyx_t_7 = __pyx_v_source_buffer->nbytes; __pyx_v_source_size = __pyx_t_7; - /* "numcodecs/zstd.pyx":94 + /* "numcodecs/zstd.pyx":95 * source_size = source_buffer.nbytes * * try: # <<<<<<<<<<<<<< @@ -1723,7 +1732,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_compress(CYTHON_UNUSED PyObject *__py */ /*try:*/ { - /* "numcodecs/zstd.pyx":97 + /* "numcodecs/zstd.pyx":98 * * # setup destination * dest_size = ZSTD_compressBound(source_size) # <<<<<<<<<<<<<< @@ -1732,19 +1741,19 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_compress(CYTHON_UNUSED PyObject *__py */ __pyx_v_dest_size = ZSTD_compressBound(__pyx_v_source_size); - /* "numcodecs/zstd.pyx":98 + /* "numcodecs/zstd.pyx":99 * # setup destination * dest_size = ZSTD_compressBound(source_size) * dest = PyBytes_FromStringAndSize(NULL, dest_size) # <<<<<<<<<<<<<< * dest_ptr = PyBytes_AS_STRING(dest) * */ - __pyx_t_5 = PyBytes_FromStringAndSize(NULL, __pyx_v_dest_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 98, __pyx_L6_error) + __pyx_t_5 = PyBytes_FromStringAndSize(NULL, __pyx_v_dest_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 99, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_5); __pyx_v_dest = ((PyObject*)__pyx_t_5); __pyx_t_5 = 0; - /* "numcodecs/zstd.pyx":99 + /* "numcodecs/zstd.pyx":100 * dest_size = ZSTD_compressBound(source_size) * dest = PyBytes_FromStringAndSize(NULL, dest_size) * dest_ptr = PyBytes_AS_STRING(dest) # <<<<<<<<<<<<<< @@ -1753,7 +1762,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_compress(CYTHON_UNUSED PyObject *__py */ __pyx_v_dest_ptr = PyBytes_AS_STRING(__pyx_v_dest); - /* "numcodecs/zstd.pyx":102 + /* "numcodecs/zstd.pyx":103 * * # perform compression * with nogil: # <<<<<<<<<<<<<< @@ -1768,7 +1777,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_compress(CYTHON_UNUSED PyObject *__py #endif /*try:*/ { - /* "numcodecs/zstd.pyx":103 + /* "numcodecs/zstd.pyx":104 * # perform compression * with nogil: * compressed_size = ZSTD_compress(dest_ptr, dest_size, source_ptr, source_size, level) # <<<<<<<<<<<<<< @@ -1778,7 +1787,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_compress(CYTHON_UNUSED PyObject *__py __pyx_v_compressed_size = ZSTD_compress(__pyx_v_dest_ptr, __pyx_v_dest_size, __pyx_v_source_ptr, __pyx_v_source_size, __pyx_v_level); } - /* "numcodecs/zstd.pyx":102 + /* "numcodecs/zstd.pyx":103 * * # perform compression * with nogil: # <<<<<<<<<<<<<< @@ -1798,7 +1807,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_compress(CYTHON_UNUSED PyObject *__py } } - /* "numcodecs/zstd.pyx":108 + /* "numcodecs/zstd.pyx":109 * * # release buffers * source_buffer.release() # <<<<<<<<<<<<<< @@ -1807,7 +1816,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_compress(CYTHON_UNUSED PyObject *__py */ /*finally:*/ { /*normal exit:*/{ - __pyx_t_5 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 108, __pyx_L1_error) + __pyx_t_5 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L7; @@ -1830,7 +1839,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_compress(CYTHON_UNUSED PyObject *__py __Pyx_XGOTREF(__pyx_t_15); __pyx_t_3 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename; { - __pyx_t_5 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 108, __pyx_L12_error) + __pyx_t_5 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 109, __pyx_L12_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } @@ -1863,7 +1872,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_compress(CYTHON_UNUSED PyObject *__py __pyx_L7:; } - /* "numcodecs/zstd.pyx":111 + /* "numcodecs/zstd.pyx":112 * * # check compression was successful * if ZSTD_isError(compressed_size): # <<<<<<<<<<<<<< @@ -1873,7 +1882,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_compress(CYTHON_UNUSED PyObject *__py __pyx_t_1 = (ZSTD_isError(__pyx_v_compressed_size) != 0); if (unlikely(__pyx_t_1)) { - /* "numcodecs/zstd.pyx":112 + /* "numcodecs/zstd.pyx":113 * # check compression was successful * if ZSTD_isError(compressed_size): * error = ZSTD_getErrorName(compressed_size) # <<<<<<<<<<<<<< @@ -1882,26 +1891,26 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_compress(CYTHON_UNUSED PyObject *__py */ __pyx_v_error = ZSTD_getErrorName(__pyx_v_compressed_size); - /* "numcodecs/zstd.pyx":113 + /* "numcodecs/zstd.pyx":114 * if ZSTD_isError(compressed_size): * error = ZSTD_getErrorName(compressed_size) * raise RuntimeError('Zstd compression error: %s' % error) # <<<<<<<<<<<<<< * * # resize after compression */ - __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 113, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Zstd_compression_error_s, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 113, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Zstd_compression_error_s, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 113, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __PYX_ERR(0, 113, __pyx_L1_error) + __PYX_ERR(0, 114, __pyx_L1_error) - /* "numcodecs/zstd.pyx":111 + /* "numcodecs/zstd.pyx":112 * * # check compression was successful * if ZSTD_isError(compressed_size): # <<<<<<<<<<<<<< @@ -1910,7 +1919,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_compress(CYTHON_UNUSED PyObject *__py */ } - /* "numcodecs/zstd.pyx":116 + /* "numcodecs/zstd.pyx":117 * * # resize after compression * dest = dest[:compressed_size] # <<<<<<<<<<<<<< @@ -1919,14 +1928,14 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_compress(CYTHON_UNUSED PyObject *__py */ if (unlikely(__pyx_v_dest == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 116, __pyx_L1_error) + __PYX_ERR(0, 117, __pyx_L1_error) } - __pyx_t_5 = PySequence_GetSlice(__pyx_v_dest, 0, __pyx_v_compressed_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 116, __pyx_L1_error) + __pyx_t_5 = PySequence_GetSlice(__pyx_v_dest, 0, __pyx_v_compressed_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF_SET(__pyx_v_dest, ((PyObject*)__pyx_t_5)); __pyx_t_5 = 0; - /* "numcodecs/zstd.pyx":118 + /* "numcodecs/zstd.pyx":119 * dest = dest[:compressed_size] * * return dest # <<<<<<<<<<<<<< @@ -1938,7 +1947,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_compress(CYTHON_UNUSED PyObject *__py __pyx_r = __pyx_v_dest; goto __pyx_L0; - /* "numcodecs/zstd.pyx":59 + /* "numcodecs/zstd.pyx":60 * * * def compress(source, int level=DEFAULT_CLEVEL): # <<<<<<<<<<<<<< @@ -1961,7 +1970,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_compress(CYTHON_UNUSED PyObject *__py return __pyx_r; } -/* "numcodecs/zstd.pyx":121 +/* "numcodecs/zstd.pyx":122 * * * def decompress(source, dest=None): # <<<<<<<<<<<<<< @@ -2007,7 +2016,7 @@ static PyObject *__pyx_pw_9numcodecs_4zstd_3decompress(PyObject *__pyx_self, PyO } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decompress") < 0)) __PYX_ERR(0, 121, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decompress") < 0)) __PYX_ERR(0, 122, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -2023,7 +2032,7 @@ static PyObject *__pyx_pw_9numcodecs_4zstd_3decompress(PyObject *__pyx_self, PyO } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("decompress", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 121, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decompress", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 122, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.zstd.decompress", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -2044,6 +2053,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_2decompress(CYTHON_UNUSED PyObject *_ size_t __pyx_v_source_size; size_t __pyx_v_dest_size; size_t __pyx_v_decompressed_size; + PyObject *__pyx_v_arr = NULL; char const *__pyx_v_error; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -2066,7 +2076,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_2decompress(CYTHON_UNUSED PyObject *_ __Pyx_RefNannySetupContext("decompress", 0); __Pyx_INCREF(__pyx_v_dest); - /* "numcodecs/zstd.pyx":141 + /* "numcodecs/zstd.pyx":142 * char *dest_ptr * Buffer source_buffer * Buffer dest_buffer = None # <<<<<<<<<<<<<< @@ -2076,16 +2086,16 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_2decompress(CYTHON_UNUSED PyObject *_ __Pyx_INCREF(Py_None); __pyx_v_dest_buffer = ((struct __pyx_obj_9numcodecs_10compat_ext_Buffer *)Py_None); - /* "numcodecs/zstd.pyx":145 + /* "numcodecs/zstd.pyx":146 * * # setup source buffer * source_buffer = Buffer(source, PyBUF_ANY_CONTIGUOUS) # <<<<<<<<<<<<<< * source_ptr = source_buffer.ptr * source_size = source_buffer.nbytes */ - __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 146, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_source); __Pyx_GIVEREF(__pyx_v_source); @@ -2093,13 +2103,13 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_2decompress(CYTHON_UNUSED PyObject *_ __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_source_buffer = ((struct __pyx_obj_9numcodecs_10compat_ext_Buffer *)__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/zstd.pyx":146 + /* "numcodecs/zstd.pyx":147 * # setup source buffer * source_buffer = Buffer(source, PyBUF_ANY_CONTIGUOUS) * source_ptr = source_buffer.ptr # <<<<<<<<<<<<<< @@ -2109,7 +2119,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_2decompress(CYTHON_UNUSED PyObject *_ __pyx_t_3 = __pyx_v_source_buffer->ptr; __pyx_v_source_ptr = __pyx_t_3; - /* "numcodecs/zstd.pyx":147 + /* "numcodecs/zstd.pyx":148 * source_buffer = Buffer(source, PyBUF_ANY_CONTIGUOUS) * source_ptr = source_buffer.ptr * source_size = source_buffer.nbytes # <<<<<<<<<<<<<< @@ -2119,7 +2129,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_2decompress(CYTHON_UNUSED PyObject *_ __pyx_t_4 = __pyx_v_source_buffer->nbytes; __pyx_v_source_size = __pyx_t_4; - /* "numcodecs/zstd.pyx":149 + /* "numcodecs/zstd.pyx":150 * source_size = source_buffer.nbytes * * try: # <<<<<<<<<<<<<< @@ -2128,7 +2138,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_2decompress(CYTHON_UNUSED PyObject *_ */ /*try:*/ { - /* "numcodecs/zstd.pyx":152 + /* "numcodecs/zstd.pyx":153 * * # determine uncompressed size * dest_size = ZSTD_getDecompressedSize(source_ptr, source_size) # <<<<<<<<<<<<<< @@ -2137,7 +2147,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_2decompress(CYTHON_UNUSED PyObject *_ */ __pyx_v_dest_size = ZSTD_getDecompressedSize(__pyx_v_source_ptr, __pyx_v_source_size); - /* "numcodecs/zstd.pyx":153 + /* "numcodecs/zstd.pyx":154 * # determine uncompressed size * dest_size = ZSTD_getDecompressedSize(source_ptr, source_size) * if dest_size == 0: # <<<<<<<<<<<<<< @@ -2147,20 +2157,20 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_2decompress(CYTHON_UNUSED PyObject *_ __pyx_t_5 = ((__pyx_v_dest_size == 0) != 0); if (unlikely(__pyx_t_5)) { - /* "numcodecs/zstd.pyx":154 + /* "numcodecs/zstd.pyx":155 * dest_size = ZSTD_getDecompressedSize(source_ptr, source_size) * if dest_size == 0: * raise RuntimeError('Zstd decompression error: invalid input data') # <<<<<<<<<<<<<< * * # setup destination buffer */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L4_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 155, __pyx_L4_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, 154, __pyx_L4_error) + __PYX_ERR(0, 155, __pyx_L4_error) - /* "numcodecs/zstd.pyx":153 + /* "numcodecs/zstd.pyx":154 * # determine uncompressed size * dest_size = ZSTD_getDecompressedSize(source_ptr, source_size) * if dest_size == 0: # <<<<<<<<<<<<<< @@ -2169,7 +2179,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_2decompress(CYTHON_UNUSED PyObject *_ */ } - /* "numcodecs/zstd.pyx":157 + /* "numcodecs/zstd.pyx":158 * * # setup destination buffer * if dest is None: # <<<<<<<<<<<<<< @@ -2180,28 +2190,28 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_2decompress(CYTHON_UNUSED PyObject *_ __pyx_t_6 = (__pyx_t_5 != 0); if (__pyx_t_6) { - /* "numcodecs/zstd.pyx":159 + /* "numcodecs/zstd.pyx":160 * if dest is None: * # allocate memory * dest = PyBytes_FromStringAndSize(NULL, dest_size) # <<<<<<<<<<<<<< * dest_ptr = PyBytes_AS_STRING(dest) * else: */ - __pyx_t_1 = PyBytes_FromStringAndSize(NULL, __pyx_v_dest_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L4_error) + __pyx_t_1 = PyBytes_FromStringAndSize(NULL, __pyx_v_dest_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF_SET(__pyx_v_dest, __pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/zstd.pyx":160 + /* "numcodecs/zstd.pyx":161 * # allocate memory * dest = PyBytes_FromStringAndSize(NULL, dest_size) * dest_ptr = PyBytes_AS_STRING(dest) # <<<<<<<<<<<<<< * else: - * dest_buffer = Buffer(dest, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) + * arr = ensure_contiguous_ndarray(dest) */ __pyx_v_dest_ptr = PyBytes_AS_STRING(__pyx_v_dest); - /* "numcodecs/zstd.pyx":157 + /* "numcodecs/zstd.pyx":158 * * # setup destination buffer * if dest is None: # <<<<<<<<<<<<<< @@ -2211,33 +2221,60 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_2decompress(CYTHON_UNUSED PyObject *_ goto __pyx_L7; } - /* "numcodecs/zstd.pyx":162 + /* "numcodecs/zstd.pyx":163 * dest_ptr = PyBytes_AS_STRING(dest) * else: - * dest_buffer = Buffer(dest, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) # <<<<<<<<<<<<<< + * arr = ensure_contiguous_ndarray(dest) # <<<<<<<<<<<<<< + * dest_buffer = Buffer(arr, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) * dest_ptr = dest_buffer.ptr - * if dest_buffer.nbytes < dest_size: */ /*else*/ { - __pyx_t_1 = __Pyx_PyInt_From_int((PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L4_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ensure_contiguous_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 163, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_7, __pyx_v_dest) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_dest); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L4_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_arr = __pyx_t_1; + __pyx_t_1 = 0; + + /* "numcodecs/zstd.pyx":164 + * else: + * arr = ensure_contiguous_ndarray(dest) + * dest_buffer = Buffer(arr, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) # <<<<<<<<<<<<<< + * dest_ptr = dest_buffer.ptr + * if dest_buffer.nbytes < dest_size: + */ + __pyx_t_1 = __Pyx_PyInt_From_int((PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 164, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 164, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_dest); - __Pyx_GIVEREF(__pyx_v_dest); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_dest); + __Pyx_INCREF(__pyx_v_arr); + __Pyx_GIVEREF(__pyx_v_arr); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_arr); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L4_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 164, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF_SET(__pyx_v_dest_buffer, ((struct __pyx_obj_9numcodecs_10compat_ext_Buffer *)__pyx_t_1)); __pyx_t_1 = 0; - /* "numcodecs/zstd.pyx":163 - * else: - * dest_buffer = Buffer(dest, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) + /* "numcodecs/zstd.pyx":165 + * arr = ensure_contiguous_ndarray(dest) + * dest_buffer = Buffer(arr, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) * dest_ptr = dest_buffer.ptr # <<<<<<<<<<<<<< * if dest_buffer.nbytes < dest_size: * raise ValueError('destination buffer too small; expected at least %s, ' @@ -2245,8 +2282,8 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_2decompress(CYTHON_UNUSED PyObject *_ __pyx_t_3 = __pyx_v_dest_buffer->ptr; __pyx_v_dest_ptr = __pyx_t_3; - /* "numcodecs/zstd.pyx":164 - * dest_buffer = Buffer(dest, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) + /* "numcodecs/zstd.pyx":166 + * dest_buffer = Buffer(arr, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) * dest_ptr = dest_buffer.ptr * if dest_buffer.nbytes < dest_size: # <<<<<<<<<<<<<< * raise ValueError('destination buffer too small; expected at least %s, ' @@ -2255,18 +2292,18 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_2decompress(CYTHON_UNUSED PyObject *_ __pyx_t_6 = ((__pyx_v_dest_buffer->nbytes < __pyx_v_dest_size) != 0); if (unlikely(__pyx_t_6)) { - /* "numcodecs/zstd.pyx":166 + /* "numcodecs/zstd.pyx":168 * if dest_buffer.nbytes < dest_size: * raise ValueError('destination buffer too small; expected at least %s, ' * 'got %s' % (dest_size, dest_buffer.nbytes)) # <<<<<<<<<<<<<< * * # perform decompression */ - __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_dest_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L4_error) + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_dest_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 168, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_dest_buffer->nbytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 166, __pyx_L4_error) + __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_dest_buffer->nbytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 168, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 166, __pyx_L4_error) + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 168, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); @@ -2274,26 +2311,26 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_2decompress(CYTHON_UNUSED PyObject *_ PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_destination_buffer_too_small_exp, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 166, __pyx_L4_error) + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_destination_buffer_too_small_exp, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 168, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/zstd.pyx":165 + /* "numcodecs/zstd.pyx":167 * dest_ptr = dest_buffer.ptr * if dest_buffer.nbytes < dest_size: * raise ValueError('destination buffer too small; expected at least %s, ' # <<<<<<<<<<<<<< * 'got %s' % (dest_size, dest_buffer.nbytes)) * */ - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 165, __pyx_L4_error) + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 167, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_7, 0, 0, 0); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(0, 165, __pyx_L4_error) + __PYX_ERR(0, 167, __pyx_L4_error) - /* "numcodecs/zstd.pyx":164 - * dest_buffer = Buffer(dest, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) + /* "numcodecs/zstd.pyx":166 + * dest_buffer = Buffer(arr, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) * dest_ptr = dest_buffer.ptr * if dest_buffer.nbytes < dest_size: # <<<<<<<<<<<<<< * raise ValueError('destination buffer too small; expected at least %s, ' @@ -2303,7 +2340,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_2decompress(CYTHON_UNUSED PyObject *_ } __pyx_L7:; - /* "numcodecs/zstd.pyx":169 + /* "numcodecs/zstd.pyx":171 * * # perform decompression * with nogil: # <<<<<<<<<<<<<< @@ -2318,7 +2355,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_2decompress(CYTHON_UNUSED PyObject *_ #endif /*try:*/ { - /* "numcodecs/zstd.pyx":170 + /* "numcodecs/zstd.pyx":172 * # perform decompression * with nogil: * decompressed_size = ZSTD_decompress(dest_ptr, dest_size, source_ptr, source_size) # <<<<<<<<<<<<<< @@ -2328,7 +2365,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_2decompress(CYTHON_UNUSED PyObject *_ __pyx_v_decompressed_size = ZSTD_decompress(__pyx_v_dest_ptr, __pyx_v_dest_size, __pyx_v_source_ptr, __pyx_v_source_size); } - /* "numcodecs/zstd.pyx":169 + /* "numcodecs/zstd.pyx":171 * * # perform decompression * with nogil: # <<<<<<<<<<<<<< @@ -2348,7 +2385,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_2decompress(CYTHON_UNUSED PyObject *_ } } - /* "numcodecs/zstd.pyx":175 + /* "numcodecs/zstd.pyx":177 * * # release buffers * source_buffer.release() # <<<<<<<<<<<<<< @@ -2357,11 +2394,11 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_2decompress(CYTHON_UNUSED PyObject *_ */ /*finally:*/ { /*normal exit:*/{ - __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 177, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/zstd.pyx":176 + /* "numcodecs/zstd.pyx":178 * # release buffers * source_buffer.release() * if dest_buffer is not None: # <<<<<<<<<<<<<< @@ -2372,18 +2409,18 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_2decompress(CYTHON_UNUSED PyObject *_ __pyx_t_5 = (__pyx_t_6 != 0); if (__pyx_t_5) { - /* "numcodecs/zstd.pyx":177 + /* "numcodecs/zstd.pyx":179 * source_buffer.release() * if dest_buffer is not None: * dest_buffer.release() # <<<<<<<<<<<<<< * * # check decompression was successful */ - __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_dest_buffer->__pyx_vtab)->release(__pyx_v_dest_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 177, __pyx_L1_error) + __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_dest_buffer->__pyx_vtab)->release(__pyx_v_dest_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 179, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/zstd.pyx":176 + /* "numcodecs/zstd.pyx":178 * # release buffers * source_buffer.release() * if dest_buffer is not None: # <<<<<<<<<<<<<< @@ -2412,18 +2449,18 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_2decompress(CYTHON_UNUSED PyObject *_ __pyx_t_8 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename; { - /* "numcodecs/zstd.pyx":175 + /* "numcodecs/zstd.pyx":177 * * # release buffers * source_buffer.release() # <<<<<<<<<<<<<< * if dest_buffer is not None: * dest_buffer.release() */ - __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 175, __pyx_L14_error) + __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_source_buffer->__pyx_vtab)->release(__pyx_v_source_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 177, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/zstd.pyx":176 + /* "numcodecs/zstd.pyx":178 * # release buffers * source_buffer.release() * if dest_buffer is not None: # <<<<<<<<<<<<<< @@ -2434,18 +2471,18 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_2decompress(CYTHON_UNUSED PyObject *_ __pyx_t_6 = (__pyx_t_5 != 0); if (__pyx_t_6) { - /* "numcodecs/zstd.pyx":177 + /* "numcodecs/zstd.pyx":179 * source_buffer.release() * if dest_buffer is not None: * dest_buffer.release() # <<<<<<<<<<<<<< * * # check decompression was successful */ - __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_dest_buffer->__pyx_vtab)->release(__pyx_v_dest_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 177, __pyx_L14_error) + __pyx_t_7 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_dest_buffer->__pyx_vtab)->release(__pyx_v_dest_buffer, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 179, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "numcodecs/zstd.pyx":176 + /* "numcodecs/zstd.pyx":178 * # release buffers * source_buffer.release() * if dest_buffer is not None: # <<<<<<<<<<<<<< @@ -2483,7 +2520,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_2decompress(CYTHON_UNUSED PyObject *_ __pyx_L5:; } - /* "numcodecs/zstd.pyx":180 + /* "numcodecs/zstd.pyx":182 * * # check decompression was successful * if ZSTD_isError(decompressed_size): # <<<<<<<<<<<<<< @@ -2493,7 +2530,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_2decompress(CYTHON_UNUSED PyObject *_ __pyx_t_6 = (ZSTD_isError(__pyx_v_decompressed_size) != 0); if (unlikely(__pyx_t_6)) { - /* "numcodecs/zstd.pyx":181 + /* "numcodecs/zstd.pyx":183 * # check decompression was successful * if ZSTD_isError(decompressed_size): * error = ZSTD_getErrorName(decompressed_size) # <<<<<<<<<<<<<< @@ -2502,26 +2539,26 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_2decompress(CYTHON_UNUSED PyObject *_ */ __pyx_v_error = ZSTD_getErrorName(__pyx_v_decompressed_size); - /* "numcodecs/zstd.pyx":182 + /* "numcodecs/zstd.pyx":184 * if ZSTD_isError(decompressed_size): * error = ZSTD_getErrorName(decompressed_size) * raise RuntimeError('Zstd decompression error: %s' % error) # <<<<<<<<<<<<<< * elif decompressed_size != dest_size: * raise RuntimeError('Zstd decompression error: expected to decompress %s, got %s' % */ - __pyx_t_7 = __Pyx_PyBytes_FromString(__pyx_v_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 182, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyBytes_FromString(__pyx_v_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 184, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Zstd_decompression_error_s, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 182, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Zstd_decompression_error_s, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 184, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 182, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 184, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_7, 0, 0, 0); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(0, 182, __pyx_L1_error) + __PYX_ERR(0, 184, __pyx_L1_error) - /* "numcodecs/zstd.pyx":180 + /* "numcodecs/zstd.pyx":182 * * # check decompression was successful * if ZSTD_isError(decompressed_size): # <<<<<<<<<<<<<< @@ -2530,7 +2567,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_2decompress(CYTHON_UNUSED PyObject *_ */ } - /* "numcodecs/zstd.pyx":183 + /* "numcodecs/zstd.pyx":185 * error = ZSTD_getErrorName(decompressed_size) * raise RuntimeError('Zstd decompression error: %s' % error) * elif decompressed_size != dest_size: # <<<<<<<<<<<<<< @@ -2540,18 +2577,18 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_2decompress(CYTHON_UNUSED PyObject *_ __pyx_t_6 = ((__pyx_v_decompressed_size != __pyx_v_dest_size) != 0); if (unlikely(__pyx_t_6)) { - /* "numcodecs/zstd.pyx":185 + /* "numcodecs/zstd.pyx":187 * elif decompressed_size != dest_size: * raise RuntimeError('Zstd decompression error: expected to decompress %s, got %s' % * (dest_size, decompressed_size)) # <<<<<<<<<<<<<< * * return dest */ - __pyx_t_7 = __Pyx_PyInt_FromSize_t(__pyx_v_dest_size); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 185, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyInt_FromSize_t(__pyx_v_dest_size); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 187, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_decompressed_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 185, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_decompressed_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 187, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 185, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 187, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7); @@ -2560,24 +2597,24 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_2decompress(CYTHON_UNUSED PyObject *_ __pyx_t_7 = 0; __pyx_t_2 = 0; - /* "numcodecs/zstd.pyx":184 + /* "numcodecs/zstd.pyx":186 * raise RuntimeError('Zstd decompression error: %s' % error) * elif decompressed_size != dest_size: * raise RuntimeError('Zstd decompression error: expected to decompress %s, got %s' % # <<<<<<<<<<<<<< * (dest_size, decompressed_size)) * */ - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Zstd_decompression_error_expecte, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 184, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Zstd_decompression_error_expecte, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 186, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 184, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 184, __pyx_L1_error) + __PYX_ERR(0, 186, __pyx_L1_error) - /* "numcodecs/zstd.pyx":183 + /* "numcodecs/zstd.pyx":185 * error = ZSTD_getErrorName(decompressed_size) * raise RuntimeError('Zstd decompression error: %s' % error) * elif decompressed_size != dest_size: # <<<<<<<<<<<<<< @@ -2586,7 +2623,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_2decompress(CYTHON_UNUSED PyObject *_ */ } - /* "numcodecs/zstd.pyx":187 + /* "numcodecs/zstd.pyx":189 * (dest_size, decompressed_size)) * * return dest # <<<<<<<<<<<<<< @@ -2598,7 +2635,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_2decompress(CYTHON_UNUSED PyObject *_ __pyx_r = __pyx_v_dest; goto __pyx_L0; - /* "numcodecs/zstd.pyx":121 + /* "numcodecs/zstd.pyx":122 * * * def decompress(source, dest=None): # <<<<<<<<<<<<<< @@ -2616,14 +2653,15 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_2decompress(CYTHON_UNUSED PyObject *_ __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_source_buffer); __Pyx_XDECREF((PyObject *)__pyx_v_dest_buffer); + __Pyx_XDECREF(__pyx_v_arr); __Pyx_XDECREF(__pyx_v_dest); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "numcodecs/zstd.pyx":206 - * codec_id = 'zstd' +/* "numcodecs/zstd.pyx":212 + * # enforce a max_buffer_size option here. * * def __init__(self, level=DEFAULT_CLEVEL): # <<<<<<<<<<<<<< * self.level = level @@ -2637,12 +2675,12 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_4__defaults__(CYTHON_UNUSED PyObject PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("__defaults__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 206, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_level); __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_level); PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_level); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 206, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); @@ -2705,7 +2743,7 @@ static PyObject *__pyx_pw_9numcodecs_4zstd_4Zstd_1__init__(PyObject *__pyx_self, } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 206, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 212, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -2721,7 +2759,7 @@ static PyObject *__pyx_pw_9numcodecs_4zstd_4Zstd_1__init__(PyObject *__pyx_self, } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 206, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 212, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.zstd.Zstd.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -2739,17 +2777,17 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_4Zstd___init__(CYTHON_UNUSED PyObject __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); - /* "numcodecs/zstd.pyx":207 + /* "numcodecs/zstd.pyx":213 * * def __init__(self, level=DEFAULT_CLEVEL): * self.level = level # <<<<<<<<<<<<<< * * def encode(self, buf): */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_level, __pyx_v_level) < 0) __PYX_ERR(0, 207, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_level, __pyx_v_level) < 0) __PYX_ERR(0, 213, __pyx_L1_error) - /* "numcodecs/zstd.pyx":206 - * codec_id = 'zstd' + /* "numcodecs/zstd.pyx":212 + * # enforce a max_buffer_size option here. * * def __init__(self, level=DEFAULT_CLEVEL): # <<<<<<<<<<<<<< * self.level = level @@ -2768,12 +2806,12 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_4Zstd___init__(CYTHON_UNUSED PyObject return __pyx_r; } -/* "numcodecs/zstd.pyx":209 +/* "numcodecs/zstd.pyx":215 * self.level = level * * def encode(self, buf): # <<<<<<<<<<<<<< + * buf = ensure_contiguous_ndarray(buf) * return compress(buf, self.level) - * */ /* Python wrapper */ @@ -2809,11 +2847,11 @@ static PyObject *__pyx_pw_9numcodecs_4zstd_4Zstd_3encode(PyObject *__pyx_self, P case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buf)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, 1); __PYX_ERR(0, 209, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, 1); __PYX_ERR(0, 215, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode") < 0)) __PYX_ERR(0, 209, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode") < 0)) __PYX_ERR(0, 215, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -2826,7 +2864,7 @@ static PyObject *__pyx_pw_9numcodecs_4zstd_4Zstd_3encode(PyObject *__pyx_self, P } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 209, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 215, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.zstd.Zstd.encode", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -2849,18 +2887,46 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_4Zstd_2encode(CYTHON_UNUSED PyObject int __pyx_t_5; PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("encode", 0); + __Pyx_INCREF(__pyx_v_buf); - /* "numcodecs/zstd.pyx":210 + /* "numcodecs/zstd.pyx":216 + * + * def encode(self, buf): + * buf = ensure_contiguous_ndarray(buf) # <<<<<<<<<<<<<< + * return compress(buf, self.level) * + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ensure_contiguous_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_buf) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_buf); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_buf, __pyx_t_1); + __pyx_t_1 = 0; + + /* "numcodecs/zstd.pyx":217 * def encode(self, buf): + * buf = ensure_contiguous_ndarray(buf) * return compress(buf, self.level) # <<<<<<<<<<<<<< * * def decode(self, buf, out=None): */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_compress); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_compress); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_level); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 210, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_level); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; __pyx_t_5 = 0; @@ -2877,7 +2943,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_4Zstd_2encode(CYTHON_UNUSED PyObject #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_buf, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -2886,14 +2952,14 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_4Zstd_2encode(CYTHON_UNUSED PyObject #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_buf, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { - __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 210, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; @@ -2904,7 +2970,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_4Zstd_2encode(CYTHON_UNUSED PyObject __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_3); __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } @@ -2913,12 +2979,12 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_4Zstd_2encode(CYTHON_UNUSED PyObject __pyx_t_1 = 0; goto __pyx_L0; - /* "numcodecs/zstd.pyx":209 + /* "numcodecs/zstd.pyx":215 * self.level = level * * def encode(self, buf): # <<<<<<<<<<<<<< + * buf = ensure_contiguous_ndarray(buf) * return compress(buf, self.level) - * */ /* function exit code */ @@ -2931,17 +2997,18 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_4Zstd_2encode(CYTHON_UNUSED PyObject __Pyx_AddTraceback("numcodecs.zstd.Zstd.encode", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_buf); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "numcodecs/zstd.pyx":212 +/* "numcodecs/zstd.pyx":219 * return compress(buf, self.level) * * def decode(self, buf, out=None): # <<<<<<<<<<<<<< + * buf = ensure_contiguous_ndarray(buf) * return decompress(buf, out) - * */ /* Python wrapper */ @@ -2981,7 +3048,7 @@ static PyObject *__pyx_pw_9numcodecs_4zstd_4Zstd_5decode(PyObject *__pyx_self, P case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buf)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, 1); __PYX_ERR(0, 212, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, 1); __PYX_ERR(0, 219, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -2991,7 +3058,7 @@ static PyObject *__pyx_pw_9numcodecs_4zstd_4Zstd_5decode(PyObject *__pyx_self, P } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode") < 0)) __PYX_ERR(0, 212, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode") < 0)) __PYX_ERR(0, 219, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3009,7 +3076,7 @@ static PyObject *__pyx_pw_9numcodecs_4zstd_4Zstd_5decode(PyObject *__pyx_self, P } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 212, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 219, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.zstd.Zstd.decode", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3031,16 +3098,44 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_4Zstd_4decode(CYTHON_UNUSED PyObject int __pyx_t_4; PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("decode", 0); + __Pyx_INCREF(__pyx_v_buf); - /* "numcodecs/zstd.pyx":213 + /* "numcodecs/zstd.pyx":220 * * def decode(self, buf, out=None): + * buf = ensure_contiguous_ndarray(buf) # <<<<<<<<<<<<<< + * return decompress(buf, out) + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ensure_contiguous_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 220, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_buf) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_buf); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_buf, __pyx_t_1); + __pyx_t_1 = 0; + + /* "numcodecs/zstd.pyx":221 + * def decode(self, buf, out=None): + * buf = ensure_contiguous_ndarray(buf) * return decompress(buf, out) # <<<<<<<<<<<<<< * * def __repr__(self): */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_decompress); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 213, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_decompress); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; __pyx_t_4 = 0; @@ -3057,7 +3152,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_4Zstd_4decode(CYTHON_UNUSED PyObject #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_buf, __pyx_v_out}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else @@ -3065,13 +3160,13 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_4Zstd_4decode(CYTHON_UNUSED PyObject #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_buf, __pyx_v_out}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif { - __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 213, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (__pyx_t_3) { __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; @@ -3082,7 +3177,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_4Zstd_4decode(CYTHON_UNUSED PyObject __Pyx_INCREF(__pyx_v_out); __Pyx_GIVEREF(__pyx_v_out); PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_out); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } @@ -3091,12 +3186,12 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_4Zstd_4decode(CYTHON_UNUSED PyObject __pyx_t_1 = 0; goto __pyx_L0; - /* "numcodecs/zstd.pyx":212 + /* "numcodecs/zstd.pyx":219 * return compress(buf, self.level) * * def decode(self, buf, out=None): # <<<<<<<<<<<<<< + * buf = ensure_contiguous_ndarray(buf) * return decompress(buf, out) - * */ /* function exit code */ @@ -3108,12 +3203,13 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_4Zstd_4decode(CYTHON_UNUSED PyObject __Pyx_AddTraceback("numcodecs.zstd.Zstd.decode", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_buf); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "numcodecs/zstd.pyx":215 +/* "numcodecs/zstd.pyx":223 * return decompress(buf, out) * * def __repr__(self): # <<<<<<<<<<<<<< @@ -3145,33 +3241,33 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_4Zstd_6__repr__(CYTHON_UNUSED PyObjec PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("__repr__", 0); - /* "numcodecs/zstd.pyx":217 + /* "numcodecs/zstd.pyx":225 * def __repr__(self): * r = '%s(level=%r)' % \ * (type(self).__name__, # <<<<<<<<<<<<<< * self.level) * return r */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_self)), __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 217, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_self)), __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - /* "numcodecs/zstd.pyx":218 + /* "numcodecs/zstd.pyx":226 * r = '%s(level=%r)' % \ * (type(self).__name__, * self.level) # <<<<<<<<<<<<<< * return r */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_level); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 218, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_level); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - /* "numcodecs/zstd.pyx":217 + /* "numcodecs/zstd.pyx":225 * def __repr__(self): * r = '%s(level=%r)' % \ * (type(self).__name__, # <<<<<<<<<<<<<< * self.level) * return r */ - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 217, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); @@ -3180,20 +3276,20 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_4Zstd_6__repr__(CYTHON_UNUSED PyObjec __pyx_t_1 = 0; __pyx_t_2 = 0; - /* "numcodecs/zstd.pyx":216 + /* "numcodecs/zstd.pyx":224 * * def __repr__(self): * r = '%s(level=%r)' % \ # <<<<<<<<<<<<<< * (type(self).__name__, * self.level) */ - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_s_level_r, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_s_level_r, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/zstd.pyx":219 + /* "numcodecs/zstd.pyx":227 * (type(self).__name__, * self.level) * return r # <<<<<<<<<<<<<< @@ -3203,7 +3299,7 @@ static PyObject *__pyx_pf_9numcodecs_4zstd_4Zstd_6__repr__(CYTHON_UNUSED PyObjec __pyx_r = __pyx_v_r; goto __pyx_L0; - /* "numcodecs/zstd.pyx":215 + /* "numcodecs/zstd.pyx":223 * return decompress(buf, out) * * def __repr__(self): # <<<<<<<<<<<<<< @@ -3292,9 +3388,11 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_Zstd_decompression_error_s, __pyx_k_Zstd_decompression_error_s, sizeof(__pyx_k_Zstd_decompression_error_s), 0, 0, 1, 0}, {&__pyx_n_s_Zstd_encode, __pyx_k_Zstd_encode, sizeof(__pyx_k_Zstd_encode), 0, 0, 1, 1}, {&__pyx_n_s_abc, __pyx_k_abc, sizeof(__pyx_k_abc), 0, 0, 1, 1}, + {&__pyx_n_s_arr, __pyx_k_arr, sizeof(__pyx_k_arr), 0, 0, 1, 1}, {&__pyx_n_s_buf, __pyx_k_buf, sizeof(__pyx_k_buf), 0, 0, 1, 1}, {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, {&__pyx_n_s_codec_id, __pyx_k_codec_id, sizeof(__pyx_k_codec_id), 0, 0, 1, 1}, + {&__pyx_n_s_compat, __pyx_k_compat, sizeof(__pyx_k_compat), 0, 0, 1, 1}, {&__pyx_n_s_compat_ext, __pyx_k_compat_ext, sizeof(__pyx_k_compat_ext), 0, 0, 1, 1}, {&__pyx_n_s_compress, __pyx_k_compress, sizeof(__pyx_k_compress), 0, 0, 1, 1}, {&__pyx_n_s_compressed_size, __pyx_k_compressed_size, sizeof(__pyx_k_compressed_size), 0, 0, 1, 1}, @@ -3308,6 +3406,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_destination_buffer_too_small_exp, __pyx_k_destination_buffer_too_small_exp, sizeof(__pyx_k_destination_buffer_too_small_exp), 0, 0, 1, 0}, {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, + {&__pyx_n_s_ensure_contiguous_ndarray, __pyx_k_ensure_contiguous_ndarray, sizeof(__pyx_k_ensure_contiguous_ndarray), 0, 0, 1, 1}, {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1}, {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, @@ -3337,8 +3436,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 113, __pyx_L1_error) - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 165, __pyx_L1_error) + __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 114, __pyx_L1_error) + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 167, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -3348,91 +3447,91 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "numcodecs/zstd.pyx":154 + /* "numcodecs/zstd.pyx":155 * dest_size = ZSTD_getDecompressedSize(source_ptr, source_size) * if dest_size == 0: * raise RuntimeError('Zstd decompression error: invalid input data') # <<<<<<<<<<<<<< * * # setup destination buffer */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_Zstd_decompression_error_invalid); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 154, __pyx_L1_error) + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_Zstd_decompression_error_invalid); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 155, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); - /* "numcodecs/zstd.pyx":59 + /* "numcodecs/zstd.pyx":60 * * * def compress(source, int level=DEFAULT_CLEVEL): # <<<<<<<<<<<<<< * """Compress data. * */ - __pyx_tuple__3 = PyTuple_Pack(10, __pyx_n_s_source, __pyx_n_s_level, __pyx_n_s_source_ptr, __pyx_n_s_dest_ptr, __pyx_n_s_source_buffer, __pyx_n_s_source_size, __pyx_n_s_dest_size, __pyx_n_s_compressed_size, __pyx_n_s_dest, __pyx_n_s_error); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 59, __pyx_L1_error) + __pyx_tuple__3 = PyTuple_Pack(10, __pyx_n_s_source, __pyx_n_s_level, __pyx_n_s_source_ptr, __pyx_n_s_dest_ptr, __pyx_n_s_source_buffer, __pyx_n_s_source_size, __pyx_n_s_dest_size, __pyx_n_s_compressed_size, __pyx_n_s_dest, __pyx_n_s_error); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); - __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(2, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__3, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_zstd_pyx, __pyx_n_s_compress, 59, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(0, 59, __pyx_L1_error) + __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(2, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__3, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_zstd_pyx, __pyx_n_s_compress, 60, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(0, 60, __pyx_L1_error) - /* "numcodecs/zstd.pyx":121 + /* "numcodecs/zstd.pyx":122 * * * def decompress(source, dest=None): # <<<<<<<<<<<<<< * """Decompress data. * */ - __pyx_tuple__5 = PyTuple_Pack(10, __pyx_n_s_source, __pyx_n_s_dest, __pyx_n_s_source_ptr, __pyx_n_s_dest_ptr, __pyx_n_s_source_buffer, __pyx_n_s_dest_buffer, __pyx_n_s_source_size, __pyx_n_s_dest_size, __pyx_n_s_decompressed_size, __pyx_n_s_error); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_tuple__5 = PyTuple_Pack(11, __pyx_n_s_source, __pyx_n_s_dest, __pyx_n_s_source_ptr, __pyx_n_s_dest_ptr, __pyx_n_s_source_buffer, __pyx_n_s_dest_buffer, __pyx_n_s_source_size, __pyx_n_s_dest_size, __pyx_n_s_decompressed_size, __pyx_n_s_arr, __pyx_n_s_error); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__5); __Pyx_GIVEREF(__pyx_tuple__5); - __pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(2, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_zstd_pyx, __pyx_n_s_decompress, 121, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(2, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_zstd_pyx, __pyx_n_s_decompress, 122, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(0, 122, __pyx_L1_error) - /* "numcodecs/zstd.pyx":206 - * codec_id = 'zstd' + /* "numcodecs/zstd.pyx":212 + * # enforce a max_buffer_size option here. * * def __init__(self, level=DEFAULT_CLEVEL): # <<<<<<<<<<<<<< * self.level = level * */ - __pyx_tuple__7 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_level); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 206, __pyx_L1_error) + __pyx_tuple__7 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_level); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__7); __Pyx_GIVEREF(__pyx_tuple__7); - __pyx_codeobj__8 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__7, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_zstd_pyx, __pyx_n_s_init, 206, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__8)) __PYX_ERR(0, 206, __pyx_L1_error) + __pyx_codeobj__8 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__7, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_zstd_pyx, __pyx_n_s_init, 212, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__8)) __PYX_ERR(0, 212, __pyx_L1_error) - /* "numcodecs/zstd.pyx":209 + /* "numcodecs/zstd.pyx":215 * self.level = level * * def encode(self, buf): # <<<<<<<<<<<<<< + * buf = ensure_contiguous_ndarray(buf) * return compress(buf, self.level) - * */ - __pyx_tuple__9 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_buf); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 209, __pyx_L1_error) + __pyx_tuple__9 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_buf); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 215, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9); - __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_zstd_pyx, __pyx_n_s_encode, 209, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 209, __pyx_L1_error) + __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_zstd_pyx, __pyx_n_s_encode, 215, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 215, __pyx_L1_error) - /* "numcodecs/zstd.pyx":212 + /* "numcodecs/zstd.pyx":219 * return compress(buf, self.level) * * def decode(self, buf, out=None): # <<<<<<<<<<<<<< + * buf = ensure_contiguous_ndarray(buf) * return decompress(buf, out) - * */ - __pyx_tuple__11 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_buf, __pyx_n_s_out); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 212, __pyx_L1_error) + __pyx_tuple__11 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_buf, __pyx_n_s_out); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 219, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__11); __Pyx_GIVEREF(__pyx_tuple__11); - __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_zstd_pyx, __pyx_n_s_decode, 212, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 212, __pyx_L1_error) - __pyx_tuple__13 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 212, __pyx_L1_error) + __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_zstd_pyx, __pyx_n_s_decode, 219, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 219, __pyx_L1_error) + __pyx_tuple__13 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 219, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__13); __Pyx_GIVEREF(__pyx_tuple__13); - /* "numcodecs/zstd.pyx":215 + /* "numcodecs/zstd.pyx":223 * return decompress(buf, out) * * def __repr__(self): # <<<<<<<<<<<<<< * r = '%s(level=%r)' % \ * (type(self).__name__, */ - __pyx_tuple__14 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_r); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 215, __pyx_L1_error) + __pyx_tuple__14 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_r); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__14); __Pyx_GIVEREF(__pyx_tuple__14); - __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_zstd_pyx, __pyx_n_s_repr, 215, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 215, __pyx_L1_error) + __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_zstd_pyx, __pyx_n_s_repr, 223, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -3741,8 +3840,8 @@ if (!__Pyx_RefNanny) { * * from .compat_ext cimport Buffer * from .compat_ext import Buffer # <<<<<<<<<<<<<< + * from .compat import ensure_contiguous_ndarray * from .abc import Codec - * */ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); @@ -3757,320 +3856,341 @@ if (!__Pyx_RefNanny) { /* "numcodecs/zstd.pyx":16 * from .compat_ext cimport Buffer * from .compat_ext import Buffer - * from .abc import Codec # <<<<<<<<<<<<<< - * + * from .compat import ensure_contiguous_ndarray # <<<<<<<<<<<<<< + * from .abc import Codec * */ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_n_s_Codec); - __Pyx_GIVEREF(__pyx_n_s_Codec); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Codec); - __pyx_t_1 = __Pyx_Import(__pyx_n_s_abc, __pyx_t_2, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_INCREF(__pyx_n_s_ensure_contiguous_ndarray); + __Pyx_GIVEREF(__pyx_n_s_ensure_contiguous_ndarray); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_ensure_contiguous_ndarray); + __pyx_t_1 = __Pyx_Import(__pyx_n_s_compat, __pyx_t_2, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Codec); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ensure_contiguous_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_Codec, __pyx_t_2) < 0) __PYX_ERR(0, 16, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ensure_contiguous_ndarray, __pyx_t_2) < 0) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/zstd.pyx":46 + /* "numcodecs/zstd.pyx":17 + * from .compat_ext import Buffer + * from .compat import ensure_contiguous_ndarray + * from .abc import Codec # <<<<<<<<<<<<<< * * - * VERSION_NUMBER = ZSTD_versionNumber() # <<<<<<<<<<<<<< - * MAJOR_VERSION_NUMBER = VERSION_NUMBER // (100 * 100) - * MINOR_VERSION_NUMBER = (VERSION_NUMBER - (MAJOR_VERSION_NUMBER * 100 * 100)) // 100 */ - __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(ZSTD_versionNumber()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error) + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_n_s_Codec); + __Pyx_GIVEREF(__pyx_n_s_Codec); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Codec); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_abc, __pyx_t_1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Codec); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_VERSION_NUMBER, __pyx_t_1) < 0) __PYX_ERR(0, 46, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Codec, __pyx_t_1) < 0) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "numcodecs/zstd.pyx":47 * + * + * VERSION_NUMBER = ZSTD_versionNumber() # <<<<<<<<<<<<<< + * MAJOR_VERSION_NUMBER = VERSION_NUMBER // (100 * 100) + * MINOR_VERSION_NUMBER = (VERSION_NUMBER - (MAJOR_VERSION_NUMBER * 100 * 100)) // 100 + */ + __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(ZSTD_versionNumber()); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_VERSION_NUMBER, __pyx_t_2) < 0) __PYX_ERR(0, 47, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "numcodecs/zstd.pyx":48 + * * VERSION_NUMBER = ZSTD_versionNumber() * MAJOR_VERSION_NUMBER = VERSION_NUMBER // (100 * 100) # <<<<<<<<<<<<<< * MINOR_VERSION_NUMBER = (VERSION_NUMBER - (MAJOR_VERSION_NUMBER * 100 * 100)) // 100 * MICRO_VERSION_NUMBER = ( */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_VERSION_NUMBER); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_FloorDivideObjC(__pyx_t_1, __pyx_int_10000, 0x2710, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_VERSION_NUMBER); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAJOR_VERSION_NUMBER, __pyx_t_2) < 0) __PYX_ERR(0, 47, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_FloorDivideObjC(__pyx_t_2, __pyx_int_10000, 0x2710, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAJOR_VERSION_NUMBER, __pyx_t_1) < 0) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/zstd.pyx":48 + /* "numcodecs/zstd.pyx":49 * VERSION_NUMBER = ZSTD_versionNumber() * MAJOR_VERSION_NUMBER = VERSION_NUMBER // (100 * 100) * MINOR_VERSION_NUMBER = (VERSION_NUMBER - (MAJOR_VERSION_NUMBER * 100 * 100)) // 100 # <<<<<<<<<<<<<< * MICRO_VERSION_NUMBER = ( * VERSION_NUMBER - */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_VERSION_NUMBER); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_MAJOR_VERSION_NUMBER); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_VERSION_NUMBER); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_int_100); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_MAJOR_VERSION_NUMBER); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_int_100); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_int_100); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_int_100); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 48, __pyx_L1_error) + __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_FloorDivideObjC(__pyx_t_3, __pyx_int_100, 0x64, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_FloorDivideObjC(__pyx_t_3, __pyx_int_100, 0x64, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_MINOR_VERSION_NUMBER, __pyx_t_1) < 0) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_MINOR_VERSION_NUMBER, __pyx_t_2) < 0) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/zstd.pyx":50 + /* "numcodecs/zstd.pyx":51 * MINOR_VERSION_NUMBER = (VERSION_NUMBER - (MAJOR_VERSION_NUMBER * 100 * 100)) // 100 * MICRO_VERSION_NUMBER = ( * VERSION_NUMBER - # <<<<<<<<<<<<<< * (MAJOR_VERSION_NUMBER * 100 * 100) - * (MINOR_VERSION_NUMBER * 100) */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_VERSION_NUMBER); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_VERSION_NUMBER); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); - /* "numcodecs/zstd.pyx":51 + /* "numcodecs/zstd.pyx":52 * MICRO_VERSION_NUMBER = ( * VERSION_NUMBER - * (MAJOR_VERSION_NUMBER * 100 * 100) - # <<<<<<<<<<<<<< * (MINOR_VERSION_NUMBER * 100) * ) */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_MAJOR_VERSION_NUMBER); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_MAJOR_VERSION_NUMBER); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_int_100); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_int_100); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_int_100); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error) + __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_int_100); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/zstd.pyx":50 + /* "numcodecs/zstd.pyx":51 * MINOR_VERSION_NUMBER = (VERSION_NUMBER - (MAJOR_VERSION_NUMBER * 100 * 100)) // 100 * MICRO_VERSION_NUMBER = ( * VERSION_NUMBER - # <<<<<<<<<<<<<< * (MAJOR_VERSION_NUMBER * 100 * 100) - * (MINOR_VERSION_NUMBER * 100) */ - __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "numcodecs/zstd.pyx":52 + /* "numcodecs/zstd.pyx":53 * VERSION_NUMBER - * (MAJOR_VERSION_NUMBER * 100 * 100) - * (MINOR_VERSION_NUMBER * 100) # <<<<<<<<<<<<<< * ) * __version__ = '%s.%s.%s' % (MAJOR_VERSION_NUMBER, MINOR_VERSION_NUMBER, MICRO_VERSION_NUMBER) */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_MINOR_VERSION_NUMBER); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_MINOR_VERSION_NUMBER); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_int_100); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_int_100); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "numcodecs/zstd.pyx":51 + /* "numcodecs/zstd.pyx":52 * MICRO_VERSION_NUMBER = ( * VERSION_NUMBER - * (MAJOR_VERSION_NUMBER * 100 * 100) - # <<<<<<<<<<<<<< * (MINOR_VERSION_NUMBER * 100) * ) */ - __pyx_t_3 = PyNumber_Subtract(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error) + __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_MICRO_VERSION_NUMBER, __pyx_t_3) < 0) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_MICRO_VERSION_NUMBER, __pyx_t_3) < 0) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "numcodecs/zstd.pyx":54 + /* "numcodecs/zstd.pyx":55 * (MINOR_VERSION_NUMBER * 100) * ) * __version__ = '%s.%s.%s' % (MAJOR_VERSION_NUMBER, MINOR_VERSION_NUMBER, MICRO_VERSION_NUMBER) # <<<<<<<<<<<<<< * DEFAULT_CLEVEL = 1 * MAX_CLEVEL = ZSTD_maxCLevel() */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_MAJOR_VERSION_NUMBER); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_MAJOR_VERSION_NUMBER); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_MINOR_VERSION_NUMBER); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_MICRO_VERSION_NUMBER); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_MINOR_VERSION_NUMBER); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_MICRO_VERSION_NUMBER); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_1); __pyx_t_3 = 0; - __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_s_s_s, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_s_s_s, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_version, __pyx_t_2) < 0) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_version, __pyx_t_1) < 0) __PYX_ERR(0, 55, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/zstd.pyx":55 + /* "numcodecs/zstd.pyx":56 * ) * __version__ = '%s.%s.%s' % (MAJOR_VERSION_NUMBER, MINOR_VERSION_NUMBER, MICRO_VERSION_NUMBER) * DEFAULT_CLEVEL = 1 # <<<<<<<<<<<<<< * MAX_CLEVEL = ZSTD_maxCLevel() * */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_CLEVEL, __pyx_int_1) < 0) __PYX_ERR(0, 55, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_CLEVEL, __pyx_int_1) < 0) __PYX_ERR(0, 56, __pyx_L1_error) - /* "numcodecs/zstd.pyx":56 + /* "numcodecs/zstd.pyx":57 * __version__ = '%s.%s.%s' % (MAJOR_VERSION_NUMBER, MINOR_VERSION_NUMBER, MICRO_VERSION_NUMBER) * DEFAULT_CLEVEL = 1 * MAX_CLEVEL = ZSTD_maxCLevel() # <<<<<<<<<<<<<< * * */ - __pyx_t_2 = __Pyx_PyInt_From_int(ZSTD_maxCLevel()); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_CLEVEL, __pyx_t_2) < 0) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyInt_From_int(ZSTD_maxCLevel()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_CLEVEL, __pyx_t_1) < 0) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/zstd.pyx":59 + /* "numcodecs/zstd.pyx":60 * * * def compress(source, int level=DEFAULT_CLEVEL): # <<<<<<<<<<<<<< * """Compress data. * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DEFAULT_CLEVEL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_DEFAULT_CLEVEL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 60, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_k_ = __pyx_t_5; - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_4zstd_1compress, NULL, __pyx_n_s_numcodecs_zstd); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_compress, __pyx_t_2) < 0) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_4zstd_1compress, NULL, __pyx_n_s_numcodecs_zstd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_compress, __pyx_t_1) < 0) __PYX_ERR(0, 60, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/zstd.pyx":121 + /* "numcodecs/zstd.pyx":122 * * * def decompress(source, dest=None): # <<<<<<<<<<<<<< * """Decompress data. * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_4zstd_3decompress, NULL, __pyx_n_s_numcodecs_zstd); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_decompress, __pyx_t_2) < 0) __PYX_ERR(0, 121, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_4zstd_3decompress, NULL, __pyx_n_s_numcodecs_zstd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_decompress, __pyx_t_1) < 0) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/zstd.pyx":190 + /* "numcodecs/zstd.pyx":192 * * * class Zstd(Codec): # <<<<<<<<<<<<<< * """Codec providing compression using Zstandard. * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Codec); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 190, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Codec); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_4, __pyx_n_s_Zstd, __pyx_n_s_Zstd, (PyObject *) NULL, __pyx_n_s_numcodecs_zstd, __pyx_kp_s_Codec_providing_compression_usin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_4, __pyx_n_s_Zstd, __pyx_n_s_Zstd, (PyObject *) NULL, __pyx_n_s_numcodecs_zstd, __pyx_kp_s_Codec_providing_compression_usin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); - /* "numcodecs/zstd.pyx":204 + /* "numcodecs/zstd.pyx":206 * """ * * codec_id = 'zstd' # <<<<<<<<<<<<<< * - * def __init__(self, level=DEFAULT_CLEVEL): + * # Note: unlike the LZ4 and Blosc codecs, there does not appear to be a (currently) */ - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_codec_id, __pyx_n_s_zstd) < 0) __PYX_ERR(0, 204, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_codec_id, __pyx_n_s_zstd) < 0) __PYX_ERR(0, 206, __pyx_L1_error) - /* "numcodecs/zstd.pyx":206 - * codec_id = 'zstd' + /* "numcodecs/zstd.pyx":212 + * # enforce a max_buffer_size option here. * * def __init__(self, level=DEFAULT_CLEVEL): # <<<<<<<<<<<<<< * self.level = level * */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_4zstd_4Zstd_1__init__, 0, __pyx_n_s_Zstd___init, NULL, __pyx_n_s_numcodecs_zstd, __pyx_d, ((PyObject *)__pyx_codeobj__8)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 206, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_4zstd_4Zstd_1__init__, 0, __pyx_n_s_Zstd___init, NULL, __pyx_n_s_numcodecs_zstd, __pyx_d, ((PyObject *)__pyx_codeobj__8)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (!__Pyx_CyFunction_InitDefaults(__pyx_t_3, sizeof(__pyx_defaults), 1)) __PYX_ERR(0, 206, __pyx_L1_error) - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_DEFAULT_CLEVEL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 206, __pyx_L1_error) + if (!__Pyx_CyFunction_InitDefaults(__pyx_t_3, sizeof(__pyx_defaults), 1)) __PYX_ERR(0, 212, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_DEFAULT_CLEVEL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_3)->__pyx_arg_level = __pyx_t_6; __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_3, __pyx_pf_9numcodecs_4zstd_4__defaults__); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 206, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "numcodecs/zstd.pyx":209 + /* "numcodecs/zstd.pyx":215 * self.level = level * * def encode(self, buf): # <<<<<<<<<<<<<< + * buf = ensure_contiguous_ndarray(buf) * return compress(buf, self.level) - * */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_4zstd_4Zstd_3encode, 0, __pyx_n_s_Zstd_encode, NULL, __pyx_n_s_numcodecs_zstd, __pyx_d, ((PyObject *)__pyx_codeobj__10)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 209, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_4zstd_4Zstd_3encode, 0, __pyx_n_s_Zstd_encode, NULL, __pyx_n_s_numcodecs_zstd, __pyx_d, ((PyObject *)__pyx_codeobj__10)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 215, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_encode, __pyx_t_3) < 0) __PYX_ERR(0, 209, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_encode, __pyx_t_3) < 0) __PYX_ERR(0, 215, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "numcodecs/zstd.pyx":212 + /* "numcodecs/zstd.pyx":219 * return compress(buf, self.level) * * def decode(self, buf, out=None): # <<<<<<<<<<<<<< + * buf = ensure_contiguous_ndarray(buf) * return decompress(buf, out) - * */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_4zstd_4Zstd_5decode, 0, __pyx_n_s_Zstd_decode, NULL, __pyx_n_s_numcodecs_zstd, __pyx_d, ((PyObject *)__pyx_codeobj__12)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 212, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_4zstd_4Zstd_5decode, 0, __pyx_n_s_Zstd_decode, NULL, __pyx_n_s_numcodecs_zstd, __pyx_d, ((PyObject *)__pyx_codeobj__12)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 219, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__13); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_decode, __pyx_t_3) < 0) __PYX_ERR(0, 212, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_decode, __pyx_t_3) < 0) __PYX_ERR(0, 219, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "numcodecs/zstd.pyx":215 + /* "numcodecs/zstd.pyx":223 * return decompress(buf, out) * * def __repr__(self): # <<<<<<<<<<<<<< * r = '%s(level=%r)' % \ * (type(self).__name__, */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_4zstd_4Zstd_7__repr__, 0, __pyx_n_s_Zstd___repr, NULL, __pyx_n_s_numcodecs_zstd, __pyx_d, ((PyObject *)__pyx_codeobj__15)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 215, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_4zstd_4Zstd_7__repr__, 0, __pyx_n_s_Zstd___repr, NULL, __pyx_n_s_numcodecs_zstd, __pyx_d, ((PyObject *)__pyx_codeobj__15)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_repr, __pyx_t_3) < 0) __PYX_ERR(0, 215, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_repr, __pyx_t_3) < 0) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "numcodecs/zstd.pyx":190 + /* "numcodecs/zstd.pyx":192 * * * class Zstd(Codec): # <<<<<<<<<<<<<< * """Codec providing compression using Zstandard. * */ - __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_Zstd, __pyx_t_4, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 190, __pyx_L1_error) + __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_Zstd, __pyx_t_4, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_Zstd, __pyx_t_3) < 0) __PYX_ERR(0, 190, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Zstd, __pyx_t_3) < 0) __PYX_ERR(0, 192, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "numcodecs/zstd.pyx":1 @@ -4904,6 +5024,35 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } #endif +/* PyObjectCall2Args */ +static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { + PyObject *args, *result = NULL; + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(function)) { + PyObject *args[2] = {arg1, arg2}; + return __Pyx_PyFunction_FastCall(function, args, 2); + } + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(function)) { + PyObject *args[2] = {arg1, arg2}; + return __Pyx_PyCFunction_FastCall(function, args, 2); + } + #endif + args = PyTuple_New(2); + if (unlikely(!args)) goto done; + Py_INCREF(arg1); + PyTuple_SET_ITEM(args, 0, arg1); + Py_INCREF(arg2); + PyTuple_SET_ITEM(args, 1, arg2); + Py_INCREF(function); + result = __Pyx_PyObject_Call(function, args, NULL); + Py_DECREF(args); + Py_DECREF(function); +done: + return result; +} + /* PyObjectSetAttrStr */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { diff --git a/numcodecs/zstd.pyx b/numcodecs/zstd.pyx index a7507910..3fc2e99a 100644 --- a/numcodecs/zstd.pyx +++ b/numcodecs/zstd.pyx @@ -13,6 +13,7 @@ from cpython.bytes cimport PyBytes_FromStringAndSize, PyBytes_AS_STRING from .compat_ext cimport Buffer from .compat_ext import Buffer +from .compat import ensure_contiguous_ndarray from .abc import Codec @@ -159,7 +160,8 @@ def decompress(source, dest=None): dest = PyBytes_FromStringAndSize(NULL, dest_size) dest_ptr = PyBytes_AS_STRING(dest) else: - dest_buffer = Buffer(dest, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) + arr = ensure_contiguous_ndarray(dest) + dest_buffer = Buffer(arr, PyBUF_ANY_CONTIGUOUS | PyBUF_WRITEABLE) dest_ptr = dest_buffer.ptr if dest_buffer.nbytes < dest_size: raise ValueError('destination buffer too small; expected at least %s, ' @@ -202,14 +204,20 @@ class Zstd(Codec): """ codec_id = 'zstd' + + # Note: unlike the LZ4 and Blosc codecs, there does not appear to be a (currently) + # practical limit on the size of buffers that Zstd can process and so we don't + # enforce a max_buffer_size option here. def __init__(self, level=DEFAULT_CLEVEL): self.level = level def encode(self, buf): + buf = ensure_contiguous_ndarray(buf) return compress(buf, self.level) def decode(self, buf, out=None): + buf = ensure_contiguous_ndarray(buf) return decompress(buf, out) def __repr__(self): From 73330357f763fca3b07e5ea778a84dc333045167 Mon Sep 17 00:00:00 2001 From: Jerome Kelleher Date: Thu, 29 Nov 2018 11:57:02 +0000 Subject: [PATCH 6/7] Add ensure_contiguous_array checks to vlen codecs. --- numcodecs/vlen.c | 1766 +++++++++++++++++++++++--------------------- numcodecs/vlen.pyx | 4 + 2 files changed, 944 insertions(+), 826 deletions(-) diff --git a/numcodecs/vlen.c b/numcodecs/vlen.c index 7c949678..9e54b2bd 100644 --- a/numcodecs/vlen.c +++ b/numcodecs/vlen.c @@ -1362,6 +1362,9 @@ static CYTHON_INLINE int __pyx_sub_acquisition_count_locked( static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int); static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int); +/* PyObjectCall2Args.proto */ +static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); + /* SetItemInt.proto */ #define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ @@ -1372,9 +1375,6 @@ static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, int wraparound, int boundscheck); -/* PyObjectCall2Args.proto */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); - /* PyObjectSetAttrStr.proto */ #if CYTHON_USE_TYPE_SLOTS #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL) @@ -2032,6 +2032,7 @@ static const char __pyx_k_range[] = "range"; static const char __pyx_k_shape[] = "shape"; static const char __pyx_k_start[] = "start"; static const char __pyx_k_Buffer[] = "Buffer"; +static const char __pyx_k_compat[] = "compat"; static const char __pyx_k_config[] = "config"; static const char __pyx_k_decode[] = "decode"; static const char __pyx_k_encode[] = "encode"; @@ -2129,6 +2130,7 @@ static const char __pyx_k_contiguous_and_indirect[] = " static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'"; static const char __pyx_k_out_must_be_object_array[] = "out must be object array"; static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d."; +static const char __pyx_k_ensure_contiguous_ndarray[] = "ensure_contiguous_ndarray"; static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array"; static const char __pyx_k_expected_byte_string_found_r[] = "expected byte string, found %r"; static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data."; @@ -2213,6 +2215,7 @@ static PyObject *__pyx_n_s_check_out_param; static PyObject *__pyx_n_s_class; static PyObject *__pyx_n_s_cline_in_traceback; static PyObject *__pyx_n_s_codec_id; +static PyObject *__pyx_n_s_compat; static PyObject *__pyx_n_s_compat_ext; static PyObject *__pyx_n_s_config; static PyObject *__pyx_kp_s_contiguous_and_direct; @@ -2232,6 +2235,7 @@ static PyObject *__pyx_n_s_encode; static PyObject *__pyx_n_s_encoded_lengths; static PyObject *__pyx_n_s_encoded_values; static PyObject *__pyx_n_s_encv; +static PyObject *__pyx_n_s_ensure_contiguous_ndarray; static PyObject *__pyx_n_s_enumerate; static PyObject *__pyx_n_s_error; static PyObject *__pyx_kp_s_expected_byte_string_found_r; @@ -2451,7 +2455,7 @@ static PyObject *__pyx_codeobj__52; static PyObject *__pyx_codeobj__60; /* Late includes */ -/* "numcodecs/vlen.pyx":38 +/* "numcodecs/vlen.pyx":39 * * * def check_out_param(out, n_items): # <<<<<<<<<<<<<< @@ -2492,11 +2496,11 @@ static PyObject *__pyx_pw_9numcodecs_4vlen_1check_out_param(PyObject *__pyx_self case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_items)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("check_out_param", 1, 2, 2, 1); __PYX_ERR(0, 38, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("check_out_param", 1, 2, 2, 1); __PYX_ERR(0, 39, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "check_out_param") < 0)) __PYX_ERR(0, 38, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "check_out_param") < 0)) __PYX_ERR(0, 39, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -2509,7 +2513,7 @@ static PyObject *__pyx_pw_9numcodecs_4vlen_1check_out_param(PyObject *__pyx_self } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("check_out_param", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 38, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("check_out_param", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 39, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.vlen.check_out_param", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -2533,37 +2537,37 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_check_out_param(CYTHON_UNUSED PyObjec __Pyx_RefNannySetupContext("check_out_param", 0); __Pyx_INCREF(__pyx_v_out); - /* "numcodecs/vlen.pyx":39 + /* "numcodecs/vlen.pyx":40 * * def check_out_param(out, n_items): * if not isinstance(out, np.ndarray): # <<<<<<<<<<<<<< * raise TypeError('out must be 1-dimensional array') * if out.dtype != object: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = PyObject_IsInstance(__pyx_v_out, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 39, __pyx_L1_error) + __pyx_t_3 = PyObject_IsInstance(__pyx_v_out, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = ((!(__pyx_t_3 != 0)) != 0); if (unlikely(__pyx_t_4)) { - /* "numcodecs/vlen.pyx":40 + /* "numcodecs/vlen.pyx":41 * def check_out_param(out, n_items): * if not isinstance(out, np.ndarray): * raise TypeError('out must be 1-dimensional array') # <<<<<<<<<<<<<< * if out.dtype != object: * raise ValueError('out must be object array') */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 40, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __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, 40, __pyx_L1_error) + __PYX_ERR(0, 41, __pyx_L1_error) - /* "numcodecs/vlen.pyx":39 + /* "numcodecs/vlen.pyx":40 * * def check_out_param(out, n_items): * if not isinstance(out, np.ndarray): # <<<<<<<<<<<<<< @@ -2572,35 +2576,35 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_check_out_param(CYTHON_UNUSED PyObjec */ } - /* "numcodecs/vlen.pyx":41 + /* "numcodecs/vlen.pyx":42 * if not isinstance(out, np.ndarray): * raise TypeError('out must be 1-dimensional array') * if out.dtype != object: # <<<<<<<<<<<<<< * raise ValueError('out must be object array') * out = out.reshape(-1, order='A') */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_out, __pyx_n_s_dtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_out, __pyx_n_s_dtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_builtin_object, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_builtin_object, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_t_4)) { - /* "numcodecs/vlen.pyx":42 + /* "numcodecs/vlen.pyx":43 * raise TypeError('out must be 1-dimensional array') * if out.dtype != object: * raise ValueError('out must be object array') # <<<<<<<<<<<<<< * out = out.reshape(-1, order='A') * if out.shape[0] < n_items: */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __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, 42, __pyx_L1_error) + __PYX_ERR(0, 43, __pyx_L1_error) - /* "numcodecs/vlen.pyx":41 + /* "numcodecs/vlen.pyx":42 * if not isinstance(out, np.ndarray): * raise TypeError('out must be 1-dimensional array') * if out.dtype != object: # <<<<<<<<<<<<<< @@ -2609,57 +2613,57 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_check_out_param(CYTHON_UNUSED PyObjec */ } - /* "numcodecs/vlen.pyx":43 + /* "numcodecs/vlen.pyx":44 * if out.dtype != object: * raise ValueError('out must be object array') * out = out.reshape(-1, order='A') # <<<<<<<<<<<<<< * if out.shape[0] < n_items: * raise ValueError('out is too small') */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_out, __pyx_n_s_reshape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_out, __pyx_n_s_reshape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_order, __pyx_n_s_A) < 0) __PYX_ERR(0, 43, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__3, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 43, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_order, __pyx_n_s_A) < 0) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__3, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF_SET(__pyx_v_out, __pyx_t_5); __pyx_t_5 = 0; - /* "numcodecs/vlen.pyx":44 + /* "numcodecs/vlen.pyx":45 * raise ValueError('out must be object array') * out = out.reshape(-1, order='A') * if out.shape[0] < n_items: # <<<<<<<<<<<<<< * raise ValueError('out is too small') * return out */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_out, __pyx_n_s_shape); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_out, __pyx_n_s_shape); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_v_n_items, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_v_n_items, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(__pyx_t_4)) { - /* "numcodecs/vlen.pyx":45 + /* "numcodecs/vlen.pyx":46 * out = out.reshape(-1, order='A') * if out.shape[0] < n_items: * raise ValueError('out is too small') # <<<<<<<<<<<<<< * return out * */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 45, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 46, __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, 45, __pyx_L1_error) + __PYX_ERR(0, 46, __pyx_L1_error) - /* "numcodecs/vlen.pyx":44 + /* "numcodecs/vlen.pyx":45 * raise ValueError('out must be object array') * out = out.reshape(-1, order='A') * if out.shape[0] < n_items: # <<<<<<<<<<<<<< @@ -2668,7 +2672,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_check_out_param(CYTHON_UNUSED PyObjec */ } - /* "numcodecs/vlen.pyx":46 + /* "numcodecs/vlen.pyx":47 * if out.shape[0] < n_items: * raise ValueError('out is too small') * return out # <<<<<<<<<<<<<< @@ -2680,7 +2684,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_check_out_param(CYTHON_UNUSED PyObjec __pyx_r = __pyx_v_out; goto __pyx_L0; - /* "numcodecs/vlen.pyx":38 + /* "numcodecs/vlen.pyx":39 * * * def check_out_param(out, n_items): # <<<<<<<<<<<<<< @@ -2702,7 +2706,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_check_out_param(CYTHON_UNUSED PyObjec return __pyx_r; } -/* "numcodecs/vlen.pyx":73 +/* "numcodecs/vlen.pyx":74 * codec_id = 'vlen-utf8' * * def __init__(self): # <<<<<<<<<<<<<< @@ -2737,7 +2741,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8___init__(CYTHON_UNUSED PyOb return __pyx_r; } -/* "numcodecs/vlen.pyx":78 +/* "numcodecs/vlen.pyx":79 * @cython.wraparound(False) * @cython.boundscheck(False) * def encode(self, buf): # <<<<<<<<<<<<<< @@ -2778,11 +2782,11 @@ static PyObject *__pyx_pw_9numcodecs_4vlen_8VLenUTF8_3encode(PyObject *__pyx_sel case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buf)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, 1); __PYX_ERR(0, 78, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, 1); __PYX_ERR(0, 79, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode") < 0)) __PYX_ERR(0, 78, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode") < 0)) __PYX_ERR(0, 79, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -2795,7 +2799,7 @@ static PyObject *__pyx_pw_9numcodecs_4vlen_8VLenUTF8_3encode(PyObject *__pyx_sel } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 78, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 79, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.vlen.VLenUTF8.encode", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -2845,48 +2849,48 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_2encode(CYTHON_UNUSED PyObj Py_ssize_t __pyx_t_19; __Pyx_RefNannySetupContext("encode", 0); - /* "numcodecs/vlen.pyx":91 + /* "numcodecs/vlen.pyx":92 * * # normalise input * input_values = np.asarray(buf, dtype=object).reshape(-1, order='A') # <<<<<<<<<<<<<< * * # determine number of items */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_buf); __Pyx_GIVEREF(__pyx_v_buf); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_buf); - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_builtin_object) < 0) __PYX_ERR(0, 91, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 91, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_builtin_object) < 0) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_reshape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_reshape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 91, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_order, __pyx_n_s_A) < 0) __PYX_ERR(0, 91, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_order, __pyx_n_s_A) < 0) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_object(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 91, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_object(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_input_values = __pyx_t_5; __pyx_t_5.memview = NULL; __pyx_t_5.data = NULL; - /* "numcodecs/vlen.pyx":94 + /* "numcodecs/vlen.pyx":95 * * # determine number of items * n_items = input_values.shape[0] # <<<<<<<<<<<<<< @@ -2895,79 +2899,79 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_2encode(CYTHON_UNUSED PyObj */ __pyx_v_n_items = (__pyx_v_input_values.shape[0]); - /* "numcodecs/vlen.pyx":97 + /* "numcodecs/vlen.pyx":98 * * # setup intermediates * encoded_values = np.empty(n_items, dtype=object) # <<<<<<<<<<<<<< * encoded_lengths = np.empty(n_items, dtype=np.intc) * */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_n_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_n_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_builtin_object) < 0) __PYX_ERR(0, 97, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_builtin_object) < 0) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_object(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_object(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_encoded_values = __pyx_t_5; __pyx_t_5.memview = NULL; __pyx_t_5.data = NULL; - /* "numcodecs/vlen.pyx":98 + /* "numcodecs/vlen.pyx":99 * # setup intermediates * encoded_values = np.empty(n_items, dtype=object) * encoded_lengths = np.empty(n_items, dtype=np.intc) # <<<<<<<<<<<<<< * * # first iteration to convert to bytes */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_n_items); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_n_items); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_intc); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_intc); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 98, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_6, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_6, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_v_encoded_lengths = __pyx_t_7; __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; - /* "numcodecs/vlen.pyx":101 + /* "numcodecs/vlen.pyx":102 * * # first iteration to convert to bytes * data_length = 0 # <<<<<<<<<<<<<< @@ -2976,7 +2980,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_2encode(CYTHON_UNUSED PyObj */ __pyx_v_data_length = 0; - /* "numcodecs/vlen.pyx":102 + /* "numcodecs/vlen.pyx":103 * # first iteration to convert to bytes * data_length = 0 * for i in range(n_items): # <<<<<<<<<<<<<< @@ -2988,7 +2992,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_2encode(CYTHON_UNUSED PyObj for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_i = __pyx_t_10; - /* "numcodecs/vlen.pyx":103 + /* "numcodecs/vlen.pyx":104 * data_length = 0 * for i in range(n_items): * u = input_values[i] # <<<<<<<<<<<<<< @@ -3001,7 +3005,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_2encode(CYTHON_UNUSED PyObj __Pyx_XDECREF_SET(__pyx_v_u, __pyx_t_6); __pyx_t_6 = 0; - /* "numcodecs/vlen.pyx":104 + /* "numcodecs/vlen.pyx":105 * for i in range(n_items): * u = input_values[i] * if u is None or u == 0: # treat these as missing value, normalize # <<<<<<<<<<<<<< @@ -3015,15 +3019,15 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_2encode(CYTHON_UNUSED PyObj __pyx_t_12 = __pyx_t_14; goto __pyx_L6_bool_binop_done; } - __pyx_t_6 = __Pyx_PyInt_EqObjC(__pyx_v_u, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 104, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_EqObjC(__pyx_v_u, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 105, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 104, __pyx_L1_error) + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 105, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_12 = __pyx_t_14; __pyx_L6_bool_binop_done:; if (__pyx_t_12) { - /* "numcodecs/vlen.pyx":105 + /* "numcodecs/vlen.pyx":106 * u = input_values[i] * if u is None or u == 0: # treat these as missing value, normalize * u = u'' # <<<<<<<<<<<<<< @@ -3033,7 +3037,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_2encode(CYTHON_UNUSED PyObj __Pyx_INCREF(__pyx_kp_u__5); __Pyx_DECREF_SET(__pyx_v_u, __pyx_kp_u__5); - /* "numcodecs/vlen.pyx":104 + /* "numcodecs/vlen.pyx":105 * for i in range(n_items): * u = input_values[i] * if u is None or u == 0: # treat these as missing value, normalize # <<<<<<<<<<<<<< @@ -3043,7 +3047,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_2encode(CYTHON_UNUSED PyObj goto __pyx_L5; } - /* "numcodecs/vlen.pyx":106 + /* "numcodecs/vlen.pyx":107 * if u is None or u == 0: # treat these as missing value, normalize * u = u'' * elif not PyUnicode_Check(u): # <<<<<<<<<<<<<< @@ -3053,23 +3057,23 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_2encode(CYTHON_UNUSED PyObj __pyx_t_12 = ((!(PyUnicode_Check(__pyx_v_u) != 0)) != 0); if (unlikely(__pyx_t_12)) { - /* "numcodecs/vlen.pyx":107 + /* "numcodecs/vlen.pyx":108 * u = u'' * elif not PyUnicode_Check(u): * raise TypeError('expected unicode string, found %r' % u) # <<<<<<<<<<<<<< * b = PyUnicode_AsUTF8String(u) * l = PyBytes_GET_SIZE(b) */ - __pyx_t_6 = __Pyx_PyString_FormatSafe(__pyx_kp_s_expected_unicode_string_found_r, __pyx_v_u); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 107, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyString_FormatSafe(__pyx_kp_s_expected_unicode_string_found_r, __pyx_v_u); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 107, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 107, __pyx_L1_error) + __PYX_ERR(0, 108, __pyx_L1_error) - /* "numcodecs/vlen.pyx":106 + /* "numcodecs/vlen.pyx":107 * if u is None or u == 0: # treat these as missing value, normalize * u = u'' * elif not PyUnicode_Check(u): # <<<<<<<<<<<<<< @@ -3079,19 +3083,19 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_2encode(CYTHON_UNUSED PyObj } __pyx_L5:; - /* "numcodecs/vlen.pyx":108 + /* "numcodecs/vlen.pyx":109 * elif not PyUnicode_Check(u): * raise TypeError('expected unicode string, found %r' % u) * b = PyUnicode_AsUTF8String(u) # <<<<<<<<<<<<<< * l = PyBytes_GET_SIZE(b) * encoded_values[i] = b */ - __pyx_t_2 = PyUnicode_AsUTF8String(__pyx_v_u); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error) + __pyx_t_2 = PyUnicode_AsUTF8String(__pyx_v_u); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_XDECREF_SET(__pyx_v_b, ((PyObject*)__pyx_t_2)); __pyx_t_2 = 0; - /* "numcodecs/vlen.pyx":109 + /* "numcodecs/vlen.pyx":110 * raise TypeError('expected unicode string, found %r' % u) * b = PyUnicode_AsUTF8String(u) * l = PyBytes_GET_SIZE(b) # <<<<<<<<<<<<<< @@ -3100,7 +3104,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_2encode(CYTHON_UNUSED PyObj */ __pyx_v_l = PyBytes_GET_SIZE(__pyx_v_b); - /* "numcodecs/vlen.pyx":110 + /* "numcodecs/vlen.pyx":111 * b = PyUnicode_AsUTF8String(u) * l = PyBytes_GET_SIZE(b) * encoded_values[i] = b # <<<<<<<<<<<<<< @@ -3114,7 +3118,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_2encode(CYTHON_UNUSED PyObj *__pyx_t_16 = __pyx_v_b; __Pyx_GIVEREF(*__pyx_t_16); - /* "numcodecs/vlen.pyx":111 + /* "numcodecs/vlen.pyx":112 * l = PyBytes_GET_SIZE(b) * encoded_values[i] = b * data_length += l + 4 # 4 bytes to store item length # <<<<<<<<<<<<<< @@ -3123,7 +3127,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_2encode(CYTHON_UNUSED PyObj */ __pyx_v_data_length = (__pyx_v_data_length + (__pyx_v_l + 4)); - /* "numcodecs/vlen.pyx":112 + /* "numcodecs/vlen.pyx":113 * encoded_values[i] = b * data_length += l + 4 # 4 bytes to store item length * encoded_lengths[i] = l # <<<<<<<<<<<<<< @@ -3134,7 +3138,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_2encode(CYTHON_UNUSED PyObj *((int *) ( /* dim=0 */ (__pyx_v_encoded_lengths.data + __pyx_t_17 * __pyx_v_encoded_lengths.strides[0]) )) = __pyx_v_l; } - /* "numcodecs/vlen.pyx":115 + /* "numcodecs/vlen.pyx":116 * * # setup output * total_length = HEADER_LENGTH + data_length # <<<<<<<<<<<<<< @@ -3143,19 +3147,19 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_2encode(CYTHON_UNUSED PyObj */ __pyx_v_total_length = (__pyx_v_9numcodecs_4vlen_HEADER_LENGTH + __pyx_v_data_length); - /* "numcodecs/vlen.pyx":116 + /* "numcodecs/vlen.pyx":117 * # setup output * total_length = HEADER_LENGTH + data_length * out = PyByteArray_FromStringAndSize(NULL, total_length) # <<<<<<<<<<<<<< * * # write header */ - __pyx_t_2 = PyByteArray_FromStringAndSize(NULL, __pyx_v_total_length); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 116, __pyx_L1_error) + __pyx_t_2 = PyByteArray_FromStringAndSize(NULL, __pyx_v_total_length); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_out = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/vlen.pyx":119 + /* "numcodecs/vlen.pyx":120 * * # write header * data = PyByteArray_AS_STRING(out) # <<<<<<<<<<<<<< @@ -3164,7 +3168,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_2encode(CYTHON_UNUSED PyObj */ __pyx_v_data = PyByteArray_AS_STRING(__pyx_v_out); - /* "numcodecs/vlen.pyx":120 + /* "numcodecs/vlen.pyx":121 * # write header * data = PyByteArray_AS_STRING(out) * store_le32(data, n_items) # <<<<<<<<<<<<<< @@ -3173,7 +3177,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_2encode(CYTHON_UNUSED PyObj */ store_le32(__pyx_v_data, __pyx_v_n_items); - /* "numcodecs/vlen.pyx":123 + /* "numcodecs/vlen.pyx":124 * * # second iteration, store data * data += HEADER_LENGTH # <<<<<<<<<<<<<< @@ -3182,7 +3186,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_2encode(CYTHON_UNUSED PyObj */ __pyx_v_data = (__pyx_v_data + __pyx_v_9numcodecs_4vlen_HEADER_LENGTH); - /* "numcodecs/vlen.pyx":124 + /* "numcodecs/vlen.pyx":125 * # second iteration, store data * data += HEADER_LENGTH * for i in range(n_items): # <<<<<<<<<<<<<< @@ -3194,7 +3198,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_2encode(CYTHON_UNUSED PyObj for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_i = __pyx_t_10; - /* "numcodecs/vlen.pyx":125 + /* "numcodecs/vlen.pyx":126 * data += HEADER_LENGTH * for i in range(n_items): * l = encoded_lengths[i] # <<<<<<<<<<<<<< @@ -3204,7 +3208,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_2encode(CYTHON_UNUSED PyObj __pyx_t_18 = __pyx_v_i; __pyx_v_l = (*((int *) ( /* dim=0 */ (__pyx_v_encoded_lengths.data + __pyx_t_18 * __pyx_v_encoded_lengths.strides[0]) ))); - /* "numcodecs/vlen.pyx":126 + /* "numcodecs/vlen.pyx":127 * for i in range(n_items): * l = encoded_lengths[i] * store_le32(data, l) # <<<<<<<<<<<<<< @@ -3213,7 +3217,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_2encode(CYTHON_UNUSED PyObj */ store_le32(__pyx_v_data, __pyx_v_l); - /* "numcodecs/vlen.pyx":127 + /* "numcodecs/vlen.pyx":128 * l = encoded_lengths[i] * store_le32(data, l) * data += 4 # <<<<<<<<<<<<<< @@ -3222,7 +3226,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_2encode(CYTHON_UNUSED PyObj */ __pyx_v_data = (__pyx_v_data + 4); - /* "numcodecs/vlen.pyx":128 + /* "numcodecs/vlen.pyx":129 * store_le32(data, l) * data += 4 * encv = PyBytes_AS_STRING(encoded_values[i]) # <<<<<<<<<<<<<< @@ -3235,7 +3239,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_2encode(CYTHON_UNUSED PyObj __pyx_v_encv = PyBytes_AS_STRING(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/vlen.pyx":129 + /* "numcodecs/vlen.pyx":130 * data += 4 * encv = PyBytes_AS_STRING(encoded_values[i]) * memcpy(data, encv, l) # <<<<<<<<<<<<<< @@ -3244,7 +3248,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_2encode(CYTHON_UNUSED PyObj */ (void)(memcpy(__pyx_v_data, __pyx_v_encv, __pyx_v_l)); - /* "numcodecs/vlen.pyx":130 + /* "numcodecs/vlen.pyx":131 * encv = PyBytes_AS_STRING(encoded_values[i]) * memcpy(data, encv, l) * data += l # <<<<<<<<<<<<<< @@ -3254,7 +3258,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_2encode(CYTHON_UNUSED PyObj __pyx_v_data = (__pyx_v_data + __pyx_v_l); } - /* "numcodecs/vlen.pyx":132 + /* "numcodecs/vlen.pyx":133 * data += l * * return out # <<<<<<<<<<<<<< @@ -3266,7 +3270,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_2encode(CYTHON_UNUSED PyObj __pyx_r = __pyx_v_out; goto __pyx_L0; - /* "numcodecs/vlen.pyx":78 + /* "numcodecs/vlen.pyx":79 * @cython.wraparound(False) * @cython.boundscheck(False) * def encode(self, buf): # <<<<<<<<<<<<<< @@ -3297,7 +3301,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_2encode(CYTHON_UNUSED PyObj return __pyx_r; } -/* "numcodecs/vlen.pyx":136 +/* "numcodecs/vlen.pyx":137 * @cython.wraparound(False) * @cython.boundscheck(False) * def decode(self, buf, out=None): # <<<<<<<<<<<<<< @@ -3342,7 +3346,7 @@ static PyObject *__pyx_pw_9numcodecs_4vlen_8VLenUTF8_5decode(PyObject *__pyx_sel case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buf)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, 1); __PYX_ERR(0, 136, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, 1); __PYX_ERR(0, 137, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -3352,7 +3356,7 @@ static PyObject *__pyx_pw_9numcodecs_4vlen_8VLenUTF8_5decode(PyObject *__pyx_sel } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode") < 0)) __PYX_ERR(0, 136, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode") < 0)) __PYX_ERR(0, 137, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3370,7 +3374,7 @@ static PyObject *__pyx_pw_9numcodecs_4vlen_8VLenUTF8_5decode(PyObject *__pyx_sel } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 136, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 137, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.vlen.VLenUTF8.decode", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3395,11 +3399,11 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_4decode(CYTHON_UNUSED PyObj __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - size_t __pyx_t_3; - int __pyx_t_4; - char *__pyx_t_5; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + int __pyx_t_5; + char *__pyx_t_6; + int __pyx_t_7; PyObject *__pyx_t_8 = NULL; int __pyx_t_9; PyObject *__pyx_t_10 = NULL; @@ -3407,18 +3411,46 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_4decode(CYTHON_UNUSED PyObj Py_ssize_t __pyx_t_12; Py_ssize_t __pyx_t_13; __Pyx_RefNannySetupContext("decode", 0); + __Pyx_INCREF(__pyx_v_buf); __Pyx_INCREF(__pyx_v_out); - /* "numcodecs/vlen.pyx":144 + /* "numcodecs/vlen.pyx":145 * * # accept any buffer + * buf = ensure_contiguous_ndarray(buf) # <<<<<<<<<<<<<< + * input_buffer = Buffer(buf, PyBUF_ANY_CONTIGUOUS) + * input_length = input_buffer.nbytes + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ensure_contiguous_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_buf) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_buf); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_buf, __pyx_t_1); + __pyx_t_1 = 0; + + /* "numcodecs/vlen.pyx":146 + * # accept any buffer + * buf = ensure_contiguous_ndarray(buf) * input_buffer = Buffer(buf, PyBUF_ANY_CONTIGUOUS) # <<<<<<<<<<<<<< * input_length = input_buffer.nbytes * */ - __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 144, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 146, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_buf); __Pyx_GIVEREF(__pyx_v_buf); @@ -3426,46 +3458,46 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_4decode(CYTHON_UNUSED PyObj __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_input_buffer = ((struct __pyx_obj_9numcodecs_10compat_ext_Buffer *)__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/vlen.pyx":145 - * # accept any buffer + /* "numcodecs/vlen.pyx":147 + * buf = ensure_contiguous_ndarray(buf) * input_buffer = Buffer(buf, PyBUF_ANY_CONTIGUOUS) * input_length = input_buffer.nbytes # <<<<<<<<<<<<<< * * # sanity checks */ - __pyx_t_3 = __pyx_v_input_buffer->nbytes; - __pyx_v_input_length = __pyx_t_3; + __pyx_t_4 = __pyx_v_input_buffer->nbytes; + __pyx_v_input_length = __pyx_t_4; - /* "numcodecs/vlen.pyx":148 + /* "numcodecs/vlen.pyx":150 * * # sanity checks * if input_length < HEADER_LENGTH: # <<<<<<<<<<<<<< * raise ValueError('corrupt buffer, missing or truncated header') * */ - __pyx_t_4 = ((__pyx_v_input_length < __pyx_v_9numcodecs_4vlen_HEADER_LENGTH) != 0); - if (unlikely(__pyx_t_4)) { + __pyx_t_5 = ((__pyx_v_input_length < __pyx_v_9numcodecs_4vlen_HEADER_LENGTH) != 0); + if (unlikely(__pyx_t_5)) { - /* "numcodecs/vlen.pyx":149 + /* "numcodecs/vlen.pyx":151 * # sanity checks * if input_length < HEADER_LENGTH: * raise ValueError('corrupt buffer, missing or truncated header') # <<<<<<<<<<<<<< * * # obtain input data pointer */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __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, 149, __pyx_L1_error) + __PYX_ERR(0, 151, __pyx_L1_error) - /* "numcodecs/vlen.pyx":148 + /* "numcodecs/vlen.pyx":150 * * # sanity checks * if input_length < HEADER_LENGTH: # <<<<<<<<<<<<<< @@ -3474,17 +3506,17 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_4decode(CYTHON_UNUSED PyObj */ } - /* "numcodecs/vlen.pyx":152 + /* "numcodecs/vlen.pyx":154 * * # obtain input data pointer * data = input_buffer.ptr # <<<<<<<<<<<<<< * data_end = data + input_length * */ - __pyx_t_5 = __pyx_v_input_buffer->ptr; - __pyx_v_data = __pyx_t_5; + __pyx_t_6 = __pyx_v_input_buffer->ptr; + __pyx_v_data = __pyx_t_6; - /* "numcodecs/vlen.pyx":153 + /* "numcodecs/vlen.pyx":155 * # obtain input data pointer * data = input_buffer.ptr * data_end = data + input_length # <<<<<<<<<<<<<< @@ -3493,7 +3525,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_4decode(CYTHON_UNUSED PyObj */ __pyx_v_data_end = (__pyx_v_data + __pyx_v_input_length); - /* "numcodecs/vlen.pyx":156 + /* "numcodecs/vlen.pyx":158 * * # load number of items * n_items = load_le32(data) # <<<<<<<<<<<<<< @@ -3502,28 +3534,28 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_4decode(CYTHON_UNUSED PyObj */ __pyx_v_n_items = load_le32(__pyx_v_data); - /* "numcodecs/vlen.pyx":159 + /* "numcodecs/vlen.pyx":161 * * # setup output * if out is not None: # <<<<<<<<<<<<<< * out = check_out_param(out, n_items) * else: */ - __pyx_t_4 = (__pyx_v_out != Py_None); - __pyx_t_6 = (__pyx_t_4 != 0); - if (__pyx_t_6) { + __pyx_t_5 = (__pyx_v_out != Py_None); + __pyx_t_7 = (__pyx_t_5 != 0); + if (__pyx_t_7) { - /* "numcodecs/vlen.pyx":160 + /* "numcodecs/vlen.pyx":162 * # setup output * if out is not None: * out = check_out_param(out, n_items) # <<<<<<<<<<<<<< * else: * out = np.empty(n_items, dtype=object) */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_out_param); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 160, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_out_param); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_n_items); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 160, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_n_items); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 162, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = NULL; __pyx_t_9 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { @@ -3538,24 +3570,24 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_4decode(CYTHON_UNUSED PyObj } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_out, __pyx_t_7}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error) + PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_out, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_out, __pyx_t_7}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error) + PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_out, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { - __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 160, __pyx_L1_error) + __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); if (__pyx_t_8) { __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL; @@ -3563,10 +3595,10 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_4decode(CYTHON_UNUSED PyObj __Pyx_INCREF(__pyx_v_out); __Pyx_GIVEREF(__pyx_v_out); PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_v_out); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } @@ -3574,7 +3606,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_4decode(CYTHON_UNUSED PyObj __Pyx_DECREF_SET(__pyx_v_out, __pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/vlen.pyx":159 + /* "numcodecs/vlen.pyx":161 * * # setup output * if out is not None: # <<<<<<<<<<<<<< @@ -3584,7 +3616,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_4decode(CYTHON_UNUSED PyObj goto __pyx_L4; } - /* "numcodecs/vlen.pyx":162 + /* "numcodecs/vlen.pyx":164 * out = check_out_param(out, n_items) * else: * out = np.empty(n_items, dtype=object) # <<<<<<<<<<<<<< @@ -3592,32 +3624,32 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_4decode(CYTHON_UNUSED PyObj * # iterate and decode - N.B., do not try to cast `out` as object[:] */ /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_n_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error) + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_n_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 162, __pyx_L1_error) + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_builtin_object) < 0) __PYX_ERR(0, 162, __pyx_L1_error) - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 162, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_builtin_object) < 0) __PYX_ERR(0, 164, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 164, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_out, __pyx_t_7); - __pyx_t_7 = 0; + __Pyx_DECREF_SET(__pyx_v_out, __pyx_t_3); + __pyx_t_3 = 0; } __pyx_L4:; - /* "numcodecs/vlen.pyx":167 + /* "numcodecs/vlen.pyx":169 * # as this causes segfaults, possibly similar to * # https://github.com/cython/cython/issues/1608 * data += HEADER_LENGTH # <<<<<<<<<<<<<< @@ -3626,7 +3658,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_4decode(CYTHON_UNUSED PyObj */ __pyx_v_data = (__pyx_v_data + __pyx_v_9numcodecs_4vlen_HEADER_LENGTH); - /* "numcodecs/vlen.pyx":168 + /* "numcodecs/vlen.pyx":170 * # https://github.com/cython/cython/issues/1608 * data += HEADER_LENGTH * for i in range(n_items): # <<<<<<<<<<<<<< @@ -3638,30 +3670,30 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_4decode(CYTHON_UNUSED PyObj for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { __pyx_v_i = __pyx_t_13; - /* "numcodecs/vlen.pyx":169 + /* "numcodecs/vlen.pyx":171 * data += HEADER_LENGTH * for i in range(n_items): * if data + 4 > data_end: # <<<<<<<<<<<<<< * raise ValueError('corrupt buffer, data seem truncated') * l = load_le32(data) */ - __pyx_t_6 = (((__pyx_v_data + 4) > __pyx_v_data_end) != 0); - if (unlikely(__pyx_t_6)) { + __pyx_t_7 = (((__pyx_v_data + 4) > __pyx_v_data_end) != 0); + if (unlikely(__pyx_t_7)) { - /* "numcodecs/vlen.pyx":170 + /* "numcodecs/vlen.pyx":172 * for i in range(n_items): * if data + 4 > data_end: * raise ValueError('corrupt buffer, data seem truncated') # <<<<<<<<<<<<<< * l = load_le32(data) * data += 4 */ - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 170, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_Raise(__pyx_t_7, 0, 0, 0); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(0, 170, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 172, __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, 172, __pyx_L1_error) - /* "numcodecs/vlen.pyx":169 + /* "numcodecs/vlen.pyx":171 * data += HEADER_LENGTH * for i in range(n_items): * if data + 4 > data_end: # <<<<<<<<<<<<<< @@ -3670,7 +3702,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_4decode(CYTHON_UNUSED PyObj */ } - /* "numcodecs/vlen.pyx":171 + /* "numcodecs/vlen.pyx":173 * if data + 4 > data_end: * raise ValueError('corrupt buffer, data seem truncated') * l = load_le32(data) # <<<<<<<<<<<<<< @@ -3679,7 +3711,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_4decode(CYTHON_UNUSED PyObj */ __pyx_v_l = load_le32(__pyx_v_data); - /* "numcodecs/vlen.pyx":172 + /* "numcodecs/vlen.pyx":174 * raise ValueError('corrupt buffer, data seem truncated') * l = load_le32(data) * data += 4 # <<<<<<<<<<<<<< @@ -3688,30 +3720,30 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_4decode(CYTHON_UNUSED PyObj */ __pyx_v_data = (__pyx_v_data + 4); - /* "numcodecs/vlen.pyx":173 + /* "numcodecs/vlen.pyx":175 * l = load_le32(data) * data += 4 * if data + l > data_end: # <<<<<<<<<<<<<< * raise ValueError('corrupt buffer, data seem truncated') * out[i] = PyUnicode_FromStringAndSize(data, l) */ - __pyx_t_6 = (((__pyx_v_data + __pyx_v_l) > __pyx_v_data_end) != 0); - if (unlikely(__pyx_t_6)) { + __pyx_t_7 = (((__pyx_v_data + __pyx_v_l) > __pyx_v_data_end) != 0); + if (unlikely(__pyx_t_7)) { - /* "numcodecs/vlen.pyx":174 + /* "numcodecs/vlen.pyx":176 * data += 4 * if data + l > data_end: * raise ValueError('corrupt buffer, data seem truncated') # <<<<<<<<<<<<<< * out[i] = PyUnicode_FromStringAndSize(data, l) * data += l */ - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 174, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_Raise(__pyx_t_7, 0, 0, 0); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(0, 174, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 176, __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, 176, __pyx_L1_error) - /* "numcodecs/vlen.pyx":173 + /* "numcodecs/vlen.pyx":175 * l = load_le32(data) * data += 4 * if data + l > data_end: # <<<<<<<<<<<<<< @@ -3720,19 +3752,19 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_4decode(CYTHON_UNUSED PyObj */ } - /* "numcodecs/vlen.pyx":175 + /* "numcodecs/vlen.pyx":177 * if data + l > data_end: * raise ValueError('corrupt buffer, data seem truncated') * out[i] = PyUnicode_FromStringAndSize(data, l) # <<<<<<<<<<<<<< * data += l * */ - __pyx_t_7 = PyUnicode_FromStringAndSize(__pyx_v_data, __pyx_v_l); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 175, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (unlikely(__Pyx_SetItemInt(__pyx_v_out, __pyx_v_i, __pyx_t_7, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0) < 0)) __PYX_ERR(0, 175, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_3 = PyUnicode_FromStringAndSize(__pyx_v_data, __pyx_v_l); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 177, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely(__Pyx_SetItemInt(__pyx_v_out, __pyx_v_i, __pyx_t_3, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0) < 0)) __PYX_ERR(0, 177, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "numcodecs/vlen.pyx":176 + /* "numcodecs/vlen.pyx":178 * raise ValueError('corrupt buffer, data seem truncated') * out[i] = PyUnicode_FromStringAndSize(data, l) * data += l # <<<<<<<<<<<<<< @@ -3742,7 +3774,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_4decode(CYTHON_UNUSED PyObj __pyx_v_data = (__pyx_v_data + __pyx_v_l); } - /* "numcodecs/vlen.pyx":178 + /* "numcodecs/vlen.pyx":180 * data += l * * return out # <<<<<<<<<<<<<< @@ -3754,7 +3786,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_4decode(CYTHON_UNUSED PyObj __pyx_r = __pyx_v_out; goto __pyx_L0; - /* "numcodecs/vlen.pyx":136 + /* "numcodecs/vlen.pyx":137 * @cython.wraparound(False) * @cython.boundscheck(False) * def decode(self, buf, out=None): # <<<<<<<<<<<<<< @@ -3766,20 +3798,21 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_8VLenUTF8_4decode(CYTHON_UNUSED PyObj __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_10); __Pyx_AddTraceback("numcodecs.vlen.VLenUTF8.decode", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_input_buffer); + __Pyx_XDECREF(__pyx_v_buf); __Pyx_XDECREF(__pyx_v_out); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "numcodecs/vlen.pyx":205 +/* "numcodecs/vlen.pyx":207 * codec_id = 'vlen-bytes' * * def __init__(self): # <<<<<<<<<<<<<< @@ -3814,7 +3847,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes___init__(CYTHON_UNUSED PyO return __pyx_r; } -/* "numcodecs/vlen.pyx":210 +/* "numcodecs/vlen.pyx":212 * @cython.wraparound(False) * @cython.boundscheck(False) * def encode(self, buf): # <<<<<<<<<<<<<< @@ -3855,11 +3888,11 @@ static PyObject *__pyx_pw_9numcodecs_4vlen_9VLenBytes_3encode(PyObject *__pyx_se case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buf)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, 1); __PYX_ERR(0, 210, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, 1); __PYX_ERR(0, 212, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode") < 0)) __PYX_ERR(0, 210, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode") < 0)) __PYX_ERR(0, 212, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -3872,7 +3905,7 @@ static PyObject *__pyx_pw_9numcodecs_4vlen_9VLenBytes_3encode(PyObject *__pyx_se } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 210, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 212, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.vlen.VLenBytes.encode", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3918,48 +3951,48 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_2encode(CYTHON_UNUSED PyOb Py_ssize_t __pyx_t_17; __Pyx_RefNannySetupContext("encode", 0); - /* "numcodecs/vlen.pyx":221 + /* "numcodecs/vlen.pyx":223 * * # normalise input * values = np.asarray(buf, dtype=object).reshape(-1, order='A') # <<<<<<<<<<<<<< * * # determine number of items */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_buf); __Pyx_GIVEREF(__pyx_v_buf); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_buf); - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 221, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_builtin_object) < 0) __PYX_ERR(0, 221, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 221, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_builtin_object) < 0) __PYX_ERR(0, 223, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_reshape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 221, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_reshape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 221, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_order, __pyx_n_s_A) < 0) __PYX_ERR(0, 221, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_order, __pyx_n_s_A) < 0) __PYX_ERR(0, 223, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_object(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 221, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_object(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_values = __pyx_t_5; __pyx_t_5.memview = NULL; __pyx_t_5.data = NULL; - /* "numcodecs/vlen.pyx":224 + /* "numcodecs/vlen.pyx":226 * * # determine number of items * n_items = values.shape[0] # <<<<<<<<<<<<<< @@ -3968,46 +4001,46 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_2encode(CYTHON_UNUSED PyOb */ __pyx_v_n_items = (__pyx_v_values.shape[0]); - /* "numcodecs/vlen.pyx":227 + /* "numcodecs/vlen.pyx":229 * * # setup intermediates * lengths = np.empty(n_items, dtype=np.intc) # <<<<<<<<<<<<<< * * # first iteration to find lengths */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 227, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 227, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_n_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 227, __pyx_L1_error) + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_n_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 227, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 227, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 227, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_intc); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 227, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_intc); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 227, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 227, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_6, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 227, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_6, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_v_lengths = __pyx_t_7; __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; - /* "numcodecs/vlen.pyx":230 + /* "numcodecs/vlen.pyx":232 * * # first iteration to find lengths * data_length = 0 # <<<<<<<<<<<<<< @@ -4016,7 +4049,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_2encode(CYTHON_UNUSED PyOb */ __pyx_v_data_length = 0; - /* "numcodecs/vlen.pyx":231 + /* "numcodecs/vlen.pyx":233 * # first iteration to find lengths * data_length = 0 * for i in range(n_items): # <<<<<<<<<<<<<< @@ -4028,7 +4061,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_2encode(CYTHON_UNUSED PyOb for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_i = __pyx_t_10; - /* "numcodecs/vlen.pyx":232 + /* "numcodecs/vlen.pyx":234 * data_length = 0 * for i in range(n_items): * b = values[i] # <<<<<<<<<<<<<< @@ -4041,7 +4074,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_2encode(CYTHON_UNUSED PyOb __Pyx_XDECREF_SET(__pyx_v_b, __pyx_t_6); __pyx_t_6 = 0; - /* "numcodecs/vlen.pyx":233 + /* "numcodecs/vlen.pyx":235 * for i in range(n_items): * b = values[i] * if b is None or b == 0: # treat these as missing value, normalize # <<<<<<<<<<<<<< @@ -4055,15 +4088,15 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_2encode(CYTHON_UNUSED PyOb __pyx_t_12 = __pyx_t_14; goto __pyx_L6_bool_binop_done; } - __pyx_t_6 = __Pyx_PyInt_EqObjC(__pyx_v_b, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 233, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_EqObjC(__pyx_v_b, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 235, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 233, __pyx_L1_error) + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 235, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_12 = __pyx_t_14; __pyx_L6_bool_binop_done:; if (__pyx_t_12) { - /* "numcodecs/vlen.pyx":234 + /* "numcodecs/vlen.pyx":236 * b = values[i] * if b is None or b == 0: # treat these as missing value, normalize * b = b'' # <<<<<<<<<<<<<< @@ -4073,7 +4106,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_2encode(CYTHON_UNUSED PyOb __Pyx_INCREF(__pyx_kp_b__5); __Pyx_DECREF_SET(__pyx_v_b, __pyx_kp_b__5); - /* "numcodecs/vlen.pyx":233 + /* "numcodecs/vlen.pyx":235 * for i in range(n_items): * b = values[i] * if b is None or b == 0: # treat these as missing value, normalize # <<<<<<<<<<<<<< @@ -4083,7 +4116,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_2encode(CYTHON_UNUSED PyOb goto __pyx_L5; } - /* "numcodecs/vlen.pyx":235 + /* "numcodecs/vlen.pyx":237 * if b is None or b == 0: # treat these as missing value, normalize * b = b'' * elif not PyBytes_Check(b): # <<<<<<<<<<<<<< @@ -4093,23 +4126,23 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_2encode(CYTHON_UNUSED PyOb __pyx_t_12 = ((!(PyBytes_Check(__pyx_v_b) != 0)) != 0); if (unlikely(__pyx_t_12)) { - /* "numcodecs/vlen.pyx":236 + /* "numcodecs/vlen.pyx":238 * b = b'' * elif not PyBytes_Check(b): * raise TypeError('expected byte string, found %r' % b) # <<<<<<<<<<<<<< * l = PyBytes_GET_SIZE(b) * data_length += l + 4 # 4 bytes to store item length */ - __pyx_t_6 = __Pyx_PyString_FormatSafe(__pyx_kp_s_expected_byte_string_found_r, __pyx_v_b); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 236, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyString_FormatSafe(__pyx_kp_s_expected_byte_string_found_r, __pyx_v_b); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 236, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 236, __pyx_L1_error) + __PYX_ERR(0, 238, __pyx_L1_error) - /* "numcodecs/vlen.pyx":235 + /* "numcodecs/vlen.pyx":237 * if b is None or b == 0: # treat these as missing value, normalize * b = b'' * elif not PyBytes_Check(b): # <<<<<<<<<<<<<< @@ -4119,7 +4152,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_2encode(CYTHON_UNUSED PyOb } __pyx_L5:; - /* "numcodecs/vlen.pyx":237 + /* "numcodecs/vlen.pyx":239 * elif not PyBytes_Check(b): * raise TypeError('expected byte string, found %r' % b) * l = PyBytes_GET_SIZE(b) # <<<<<<<<<<<<<< @@ -4128,7 +4161,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_2encode(CYTHON_UNUSED PyOb */ __pyx_v_l = PyBytes_GET_SIZE(__pyx_v_b); - /* "numcodecs/vlen.pyx":238 + /* "numcodecs/vlen.pyx":240 * raise TypeError('expected byte string, found %r' % b) * l = PyBytes_GET_SIZE(b) * data_length += l + 4 # 4 bytes to store item length # <<<<<<<<<<<<<< @@ -4137,7 +4170,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_2encode(CYTHON_UNUSED PyOb */ __pyx_v_data_length = (__pyx_v_data_length + (__pyx_v_l + 4)); - /* "numcodecs/vlen.pyx":239 + /* "numcodecs/vlen.pyx":241 * l = PyBytes_GET_SIZE(b) * data_length += l + 4 # 4 bytes to store item length * lengths[i] = l # <<<<<<<<<<<<<< @@ -4148,7 +4181,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_2encode(CYTHON_UNUSED PyOb *((int *) ( /* dim=0 */ (__pyx_v_lengths.data + __pyx_t_15 * __pyx_v_lengths.strides[0]) )) = __pyx_v_l; } - /* "numcodecs/vlen.pyx":242 + /* "numcodecs/vlen.pyx":244 * * # setup output * total_length = HEADER_LENGTH + data_length # <<<<<<<<<<<<<< @@ -4157,19 +4190,19 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_2encode(CYTHON_UNUSED PyOb */ __pyx_v_total_length = (__pyx_v_9numcodecs_4vlen_HEADER_LENGTH + __pyx_v_data_length); - /* "numcodecs/vlen.pyx":243 + /* "numcodecs/vlen.pyx":245 * # setup output * total_length = HEADER_LENGTH + data_length * out = PyByteArray_FromStringAndSize(NULL, total_length) # <<<<<<<<<<<<<< * * # write header */ - __pyx_t_1 = PyByteArray_FromStringAndSize(NULL, __pyx_v_total_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __pyx_L1_error) + __pyx_t_1 = PyByteArray_FromStringAndSize(NULL, __pyx_v_total_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_out = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/vlen.pyx":246 + /* "numcodecs/vlen.pyx":248 * * # write header * data = PyByteArray_AS_STRING(out) # <<<<<<<<<<<<<< @@ -4178,7 +4211,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_2encode(CYTHON_UNUSED PyOb */ __pyx_v_data = PyByteArray_AS_STRING(__pyx_v_out); - /* "numcodecs/vlen.pyx":247 + /* "numcodecs/vlen.pyx":249 * # write header * data = PyByteArray_AS_STRING(out) * store_le32(data, n_items) # <<<<<<<<<<<<<< @@ -4187,7 +4220,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_2encode(CYTHON_UNUSED PyOb */ store_le32(__pyx_v_data, __pyx_v_n_items); - /* "numcodecs/vlen.pyx":250 + /* "numcodecs/vlen.pyx":252 * * # second iteration, store data * data += HEADER_LENGTH # <<<<<<<<<<<<<< @@ -4196,7 +4229,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_2encode(CYTHON_UNUSED PyOb */ __pyx_v_data = (__pyx_v_data + __pyx_v_9numcodecs_4vlen_HEADER_LENGTH); - /* "numcodecs/vlen.pyx":251 + /* "numcodecs/vlen.pyx":253 * # second iteration, store data * data += HEADER_LENGTH * for i in range(n_items): # <<<<<<<<<<<<<< @@ -4208,7 +4241,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_2encode(CYTHON_UNUSED PyOb for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_i = __pyx_t_10; - /* "numcodecs/vlen.pyx":252 + /* "numcodecs/vlen.pyx":254 * data += HEADER_LENGTH * for i in range(n_items): * l = lengths[i] # <<<<<<<<<<<<<< @@ -4218,7 +4251,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_2encode(CYTHON_UNUSED PyOb __pyx_t_16 = __pyx_v_i; __pyx_v_l = (*((int *) ( /* dim=0 */ (__pyx_v_lengths.data + __pyx_t_16 * __pyx_v_lengths.strides[0]) ))); - /* "numcodecs/vlen.pyx":253 + /* "numcodecs/vlen.pyx":255 * for i in range(n_items): * l = lengths[i] * store_le32(data, l) # <<<<<<<<<<<<<< @@ -4227,7 +4260,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_2encode(CYTHON_UNUSED PyOb */ store_le32(__pyx_v_data, __pyx_v_l); - /* "numcodecs/vlen.pyx":254 + /* "numcodecs/vlen.pyx":256 * l = lengths[i] * store_le32(data, l) * data += 4 # <<<<<<<<<<<<<< @@ -4236,7 +4269,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_2encode(CYTHON_UNUSED PyOb */ __pyx_v_data = (__pyx_v_data + 4); - /* "numcodecs/vlen.pyx":255 + /* "numcodecs/vlen.pyx":257 * store_le32(data, l) * data += 4 * encv = PyBytes_AS_STRING(values[i]) # <<<<<<<<<<<<<< @@ -4249,7 +4282,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_2encode(CYTHON_UNUSED PyOb __pyx_v_encv = PyBytes_AS_STRING(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/vlen.pyx":256 + /* "numcodecs/vlen.pyx":258 * data += 4 * encv = PyBytes_AS_STRING(values[i]) * memcpy(data, encv, l) # <<<<<<<<<<<<<< @@ -4258,7 +4291,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_2encode(CYTHON_UNUSED PyOb */ (void)(memcpy(__pyx_v_data, __pyx_v_encv, __pyx_v_l)); - /* "numcodecs/vlen.pyx":257 + /* "numcodecs/vlen.pyx":259 * encv = PyBytes_AS_STRING(values[i]) * memcpy(data, encv, l) * data += l # <<<<<<<<<<<<<< @@ -4268,7 +4301,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_2encode(CYTHON_UNUSED PyOb __pyx_v_data = (__pyx_v_data + __pyx_v_l); } - /* "numcodecs/vlen.pyx":259 + /* "numcodecs/vlen.pyx":261 * data += l * * return out # <<<<<<<<<<<<<< @@ -4280,7 +4313,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_2encode(CYTHON_UNUSED PyOb __pyx_r = __pyx_v_out; goto __pyx_L0; - /* "numcodecs/vlen.pyx":210 + /* "numcodecs/vlen.pyx":212 * @cython.wraparound(False) * @cython.boundscheck(False) * def encode(self, buf): # <<<<<<<<<<<<<< @@ -4309,7 +4342,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_2encode(CYTHON_UNUSED PyOb return __pyx_r; } -/* "numcodecs/vlen.pyx":263 +/* "numcodecs/vlen.pyx":265 * @cython.wraparound(False) * @cython.boundscheck(False) * def decode(self, buf, out=None): # <<<<<<<<<<<<<< @@ -4354,7 +4387,7 @@ static PyObject *__pyx_pw_9numcodecs_4vlen_9VLenBytes_5decode(PyObject *__pyx_se case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buf)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, 1); __PYX_ERR(0, 263, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, 1); __PYX_ERR(0, 265, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -4364,7 +4397,7 @@ static PyObject *__pyx_pw_9numcodecs_4vlen_9VLenBytes_5decode(PyObject *__pyx_se } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode") < 0)) __PYX_ERR(0, 263, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode") < 0)) __PYX_ERR(0, 265, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -4382,7 +4415,7 @@ static PyObject *__pyx_pw_9numcodecs_4vlen_9VLenBytes_5decode(PyObject *__pyx_se } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 263, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 265, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.vlen.VLenBytes.decode", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -4407,11 +4440,11 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_4decode(CYTHON_UNUSED PyOb __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - size_t __pyx_t_3; - int __pyx_t_4; - char *__pyx_t_5; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + int __pyx_t_5; + char *__pyx_t_6; + int __pyx_t_7; PyObject *__pyx_t_8 = NULL; int __pyx_t_9; PyObject *__pyx_t_10 = NULL; @@ -4419,18 +4452,46 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_4decode(CYTHON_UNUSED PyOb Py_ssize_t __pyx_t_12; Py_ssize_t __pyx_t_13; __Pyx_RefNannySetupContext("decode", 0); + __Pyx_INCREF(__pyx_v_buf); __Pyx_INCREF(__pyx_v_out); - /* "numcodecs/vlen.pyx":271 + /* "numcodecs/vlen.pyx":273 * * # accept any buffer + * buf = ensure_contiguous_ndarray(buf) # <<<<<<<<<<<<<< + * input_buffer = Buffer(buf, PyBUF_ANY_CONTIGUOUS) + * input_length = input_buffer.nbytes + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ensure_contiguous_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_buf) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_buf); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_buf, __pyx_t_1); + __pyx_t_1 = 0; + + /* "numcodecs/vlen.pyx":274 + * # accept any buffer + * buf = ensure_contiguous_ndarray(buf) * input_buffer = Buffer(buf, PyBUF_ANY_CONTIGUOUS) # <<<<<<<<<<<<<< * input_length = input_buffer.nbytes * */ - __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 271, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 271, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 274, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_buf); __Pyx_GIVEREF(__pyx_v_buf); @@ -4438,46 +4499,46 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_4decode(CYTHON_UNUSED PyOb __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 271, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_input_buffer = ((struct __pyx_obj_9numcodecs_10compat_ext_Buffer *)__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/vlen.pyx":272 - * # accept any buffer + /* "numcodecs/vlen.pyx":275 + * buf = ensure_contiguous_ndarray(buf) * input_buffer = Buffer(buf, PyBUF_ANY_CONTIGUOUS) * input_length = input_buffer.nbytes # <<<<<<<<<<<<<< * * # sanity checks */ - __pyx_t_3 = __pyx_v_input_buffer->nbytes; - __pyx_v_input_length = __pyx_t_3; + __pyx_t_4 = __pyx_v_input_buffer->nbytes; + __pyx_v_input_length = __pyx_t_4; - /* "numcodecs/vlen.pyx":275 + /* "numcodecs/vlen.pyx":278 * * # sanity checks * if input_length < HEADER_LENGTH: # <<<<<<<<<<<<<< * raise ValueError('corrupt buffer, missing or truncated header') * */ - __pyx_t_4 = ((__pyx_v_input_length < __pyx_v_9numcodecs_4vlen_HEADER_LENGTH) != 0); - if (unlikely(__pyx_t_4)) { + __pyx_t_5 = ((__pyx_v_input_length < __pyx_v_9numcodecs_4vlen_HEADER_LENGTH) != 0); + if (unlikely(__pyx_t_5)) { - /* "numcodecs/vlen.pyx":276 + /* "numcodecs/vlen.pyx":279 * # sanity checks * if input_length < HEADER_LENGTH: * raise ValueError('corrupt buffer, missing or truncated header') # <<<<<<<<<<<<<< * * # obtain input data pointer */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 276, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 279, __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, 276, __pyx_L1_error) + __PYX_ERR(0, 279, __pyx_L1_error) - /* "numcodecs/vlen.pyx":275 + /* "numcodecs/vlen.pyx":278 * * # sanity checks * if input_length < HEADER_LENGTH: # <<<<<<<<<<<<<< @@ -4486,17 +4547,17 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_4decode(CYTHON_UNUSED PyOb */ } - /* "numcodecs/vlen.pyx":279 + /* "numcodecs/vlen.pyx":282 * * # obtain input data pointer * data = input_buffer.ptr # <<<<<<<<<<<<<< * data_end = data + input_length * */ - __pyx_t_5 = __pyx_v_input_buffer->ptr; - __pyx_v_data = __pyx_t_5; + __pyx_t_6 = __pyx_v_input_buffer->ptr; + __pyx_v_data = __pyx_t_6; - /* "numcodecs/vlen.pyx":280 + /* "numcodecs/vlen.pyx":283 * # obtain input data pointer * data = input_buffer.ptr * data_end = data + input_length # <<<<<<<<<<<<<< @@ -4505,7 +4566,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_4decode(CYTHON_UNUSED PyOb */ __pyx_v_data_end = (__pyx_v_data + __pyx_v_input_length); - /* "numcodecs/vlen.pyx":283 + /* "numcodecs/vlen.pyx":286 * * # load number of items * n_items = load_le32(data) # <<<<<<<<<<<<<< @@ -4514,28 +4575,28 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_4decode(CYTHON_UNUSED PyOb */ __pyx_v_n_items = load_le32(__pyx_v_data); - /* "numcodecs/vlen.pyx":286 + /* "numcodecs/vlen.pyx":289 * * # setup output * if out is not None: # <<<<<<<<<<<<<< * out = check_out_param(out, n_items) * else: */ - __pyx_t_4 = (__pyx_v_out != Py_None); - __pyx_t_6 = (__pyx_t_4 != 0); - if (__pyx_t_6) { + __pyx_t_5 = (__pyx_v_out != Py_None); + __pyx_t_7 = (__pyx_t_5 != 0); + if (__pyx_t_7) { - /* "numcodecs/vlen.pyx":287 + /* "numcodecs/vlen.pyx":290 * # setup output * if out is not None: * out = check_out_param(out, n_items) # <<<<<<<<<<<<<< * else: * out = np.empty(n_items, dtype=object) */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_out_param); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 287, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_out_param); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 290, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_n_items); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 287, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_n_items); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 290, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = NULL; __pyx_t_9 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { @@ -4550,24 +4611,24 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_4decode(CYTHON_UNUSED PyOb } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_out, __pyx_t_7}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 287, __pyx_L1_error) + PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_out, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 290, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_out, __pyx_t_7}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 287, __pyx_L1_error) + PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_out, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 290, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { - __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 287, __pyx_L1_error) + __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 290, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); if (__pyx_t_8) { __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL; @@ -4575,10 +4636,10 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_4decode(CYTHON_UNUSED PyOb __Pyx_INCREF(__pyx_v_out); __Pyx_GIVEREF(__pyx_v_out); PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_v_out); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 287, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 290, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } @@ -4586,7 +4647,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_4decode(CYTHON_UNUSED PyOb __Pyx_DECREF_SET(__pyx_v_out, __pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/vlen.pyx":286 + /* "numcodecs/vlen.pyx":289 * * # setup output * if out is not None: # <<<<<<<<<<<<<< @@ -4596,7 +4657,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_4decode(CYTHON_UNUSED PyOb goto __pyx_L4; } - /* "numcodecs/vlen.pyx":289 + /* "numcodecs/vlen.pyx":292 * out = check_out_param(out, n_items) * else: * out = np.empty(n_items, dtype=object) # <<<<<<<<<<<<<< @@ -4604,32 +4665,32 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_4decode(CYTHON_UNUSED PyOb * # iterate and decode - N.B., do not try to cast `out` as object[:] */ /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 289, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 292, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 289, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 292, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_n_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 289, __pyx_L1_error) + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_n_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 292, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 289, __pyx_L1_error) + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 292, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 289, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 292, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_builtin_object) < 0) __PYX_ERR(0, 289, __pyx_L1_error) - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 289, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_builtin_object) < 0) __PYX_ERR(0, 292, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_out, __pyx_t_7); - __pyx_t_7 = 0; + __Pyx_DECREF_SET(__pyx_v_out, __pyx_t_3); + __pyx_t_3 = 0; } __pyx_L4:; - /* "numcodecs/vlen.pyx":294 + /* "numcodecs/vlen.pyx":297 * # as this causes segfaults, possibly similar to * # https://github.com/cython/cython/issues/1608 * data += HEADER_LENGTH # <<<<<<<<<<<<<< @@ -4638,7 +4699,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_4decode(CYTHON_UNUSED PyOb */ __pyx_v_data = (__pyx_v_data + __pyx_v_9numcodecs_4vlen_HEADER_LENGTH); - /* "numcodecs/vlen.pyx":295 + /* "numcodecs/vlen.pyx":298 * # https://github.com/cython/cython/issues/1608 * data += HEADER_LENGTH * for i in range(n_items): # <<<<<<<<<<<<<< @@ -4650,30 +4711,30 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_4decode(CYTHON_UNUSED PyOb for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { __pyx_v_i = __pyx_t_13; - /* "numcodecs/vlen.pyx":296 + /* "numcodecs/vlen.pyx":299 * data += HEADER_LENGTH * for i in range(n_items): * if data + 4 > data_end: # <<<<<<<<<<<<<< * raise ValueError('corrupt buffer, data seem truncated') * l = load_le32(data) */ - __pyx_t_6 = (((__pyx_v_data + 4) > __pyx_v_data_end) != 0); - if (unlikely(__pyx_t_6)) { + __pyx_t_7 = (((__pyx_v_data + 4) > __pyx_v_data_end) != 0); + if (unlikely(__pyx_t_7)) { - /* "numcodecs/vlen.pyx":297 + /* "numcodecs/vlen.pyx":300 * for i in range(n_items): * if data + 4 > data_end: * raise ValueError('corrupt buffer, data seem truncated') # <<<<<<<<<<<<<< * l = load_le32(data) * data += 4 */ - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 297, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_Raise(__pyx_t_7, 0, 0, 0); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(0, 297, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 300, __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, 300, __pyx_L1_error) - /* "numcodecs/vlen.pyx":296 + /* "numcodecs/vlen.pyx":299 * data += HEADER_LENGTH * for i in range(n_items): * if data + 4 > data_end: # <<<<<<<<<<<<<< @@ -4682,7 +4743,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_4decode(CYTHON_UNUSED PyOb */ } - /* "numcodecs/vlen.pyx":298 + /* "numcodecs/vlen.pyx":301 * if data + 4 > data_end: * raise ValueError('corrupt buffer, data seem truncated') * l = load_le32(data) # <<<<<<<<<<<<<< @@ -4691,7 +4752,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_4decode(CYTHON_UNUSED PyOb */ __pyx_v_l = load_le32(__pyx_v_data); - /* "numcodecs/vlen.pyx":299 + /* "numcodecs/vlen.pyx":302 * raise ValueError('corrupt buffer, data seem truncated') * l = load_le32(data) * data += 4 # <<<<<<<<<<<<<< @@ -4700,30 +4761,30 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_4decode(CYTHON_UNUSED PyOb */ __pyx_v_data = (__pyx_v_data + 4); - /* "numcodecs/vlen.pyx":300 + /* "numcodecs/vlen.pyx":303 * l = load_le32(data) * data += 4 * if data + l > data_end: # <<<<<<<<<<<<<< * raise ValueError('corrupt buffer, data seem truncated') * out[i] = PyBytes_FromStringAndSize(data, l) */ - __pyx_t_6 = (((__pyx_v_data + __pyx_v_l) > __pyx_v_data_end) != 0); - if (unlikely(__pyx_t_6)) { + __pyx_t_7 = (((__pyx_v_data + __pyx_v_l) > __pyx_v_data_end) != 0); + if (unlikely(__pyx_t_7)) { - /* "numcodecs/vlen.pyx":301 + /* "numcodecs/vlen.pyx":304 * data += 4 * if data + l > data_end: * raise ValueError('corrupt buffer, data seem truncated') # <<<<<<<<<<<<<< * out[i] = PyBytes_FromStringAndSize(data, l) * data += l */ - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 301, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_Raise(__pyx_t_7, 0, 0, 0); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(0, 301, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 304, __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, 304, __pyx_L1_error) - /* "numcodecs/vlen.pyx":300 + /* "numcodecs/vlen.pyx":303 * l = load_le32(data) * data += 4 * if data + l > data_end: # <<<<<<<<<<<<<< @@ -4732,19 +4793,19 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_4decode(CYTHON_UNUSED PyOb */ } - /* "numcodecs/vlen.pyx":302 + /* "numcodecs/vlen.pyx":305 * if data + l > data_end: * raise ValueError('corrupt buffer, data seem truncated') * out[i] = PyBytes_FromStringAndSize(data, l) # <<<<<<<<<<<<<< * data += l * */ - __pyx_t_7 = PyBytes_FromStringAndSize(__pyx_v_data, __pyx_v_l); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 302, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (unlikely(__Pyx_SetItemInt(__pyx_v_out, __pyx_v_i, __pyx_t_7, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0) < 0)) __PYX_ERR(0, 302, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_3 = PyBytes_FromStringAndSize(__pyx_v_data, __pyx_v_l); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 305, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely(__Pyx_SetItemInt(__pyx_v_out, __pyx_v_i, __pyx_t_3, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0) < 0)) __PYX_ERR(0, 305, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "numcodecs/vlen.pyx":303 + /* "numcodecs/vlen.pyx":306 * raise ValueError('corrupt buffer, data seem truncated') * out[i] = PyBytes_FromStringAndSize(data, l) * data += l # <<<<<<<<<<<<<< @@ -4754,7 +4815,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_4decode(CYTHON_UNUSED PyOb __pyx_v_data = (__pyx_v_data + __pyx_v_l); } - /* "numcodecs/vlen.pyx":305 + /* "numcodecs/vlen.pyx":308 * data += l * * return out # <<<<<<<<<<<<<< @@ -4766,7 +4827,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_4decode(CYTHON_UNUSED PyOb __pyx_r = __pyx_v_out; goto __pyx_L0; - /* "numcodecs/vlen.pyx":263 + /* "numcodecs/vlen.pyx":265 * @cython.wraparound(False) * @cython.boundscheck(False) * def decode(self, buf, out=None): # <<<<<<<<<<<<<< @@ -4778,20 +4839,21 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenBytes_4decode(CYTHON_UNUSED PyOb __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_10); __Pyx_AddTraceback("numcodecs.vlen.VLenBytes.decode", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_input_buffer); + __Pyx_XDECREF(__pyx_v_buf); __Pyx_XDECREF(__pyx_v_out); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "numcodecs/vlen.pyx":333 +/* "numcodecs/vlen.pyx":336 * codec_id = 'vlen-array' * * def __init__(self, dtype): # <<<<<<<<<<<<<< @@ -4832,11 +4894,11 @@ static PyObject *__pyx_pw_9numcodecs_4vlen_9VLenArray_1__init__(PyObject *__pyx_ case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 333, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 336, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 333, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 336, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -4849,7 +4911,7 @@ static PyObject *__pyx_pw_9numcodecs_4vlen_9VLenArray_1__init__(PyObject *__pyx_ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 333, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 336, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.vlen.VLenArray.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -4870,16 +4932,16 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray___init__(CYTHON_UNUSED PyO PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("__init__", 0); - /* "numcodecs/vlen.pyx":334 + /* "numcodecs/vlen.pyx":337 * * def __init__(self, dtype): * self.dtype = np.dtype(dtype) # <<<<<<<<<<<<<< * * def get_config(self): */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 334, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 337, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_dtype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 334, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_dtype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 337, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; @@ -4894,13 +4956,13 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray___init__(CYTHON_UNUSED PyO } __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_dtype) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_dtype); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 334, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 337, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 334, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 337, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/vlen.pyx":333 + /* "numcodecs/vlen.pyx":336 * codec_id = 'vlen-array' * * def __init__(self, dtype): # <<<<<<<<<<<<<< @@ -4923,7 +4985,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray___init__(CYTHON_UNUSED PyO return __pyx_r; } -/* "numcodecs/vlen.pyx":336 +/* "numcodecs/vlen.pyx":339 * self.dtype = np.dtype(dtype) * * def get_config(self): # <<<<<<<<<<<<<< @@ -4954,46 +5016,46 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_2get_config(CYTHON_UNUSED PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("get_config", 0); - /* "numcodecs/vlen.pyx":337 + /* "numcodecs/vlen.pyx":340 * * def get_config(self): * config = dict() # <<<<<<<<<<<<<< * config['id'] = self.codec_id * config['dtype'] = self.dtype.str */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 337, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 340, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_config = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/vlen.pyx":338 + /* "numcodecs/vlen.pyx":341 * def get_config(self): * config = dict() * config['id'] = self.codec_id # <<<<<<<<<<<<<< * config['dtype'] = self.dtype.str * return config */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_codec_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 338, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_codec_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 341, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyDict_SetItem(__pyx_v_config, __pyx_n_s_id, __pyx_t_1) < 0)) __PYX_ERR(0, 338, __pyx_L1_error) + if (unlikely(PyDict_SetItem(__pyx_v_config, __pyx_n_s_id, __pyx_t_1) < 0)) __PYX_ERR(0, 341, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/vlen.pyx":339 + /* "numcodecs/vlen.pyx":342 * config = dict() * config['id'] = self.codec_id * config['dtype'] = self.dtype.str # <<<<<<<<<<<<<< * return config * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 339, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 342, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_str); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 339, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_str); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 342, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(PyDict_SetItem(__pyx_v_config, __pyx_n_s_dtype, __pyx_t_2) < 0)) __PYX_ERR(0, 339, __pyx_L1_error) + if (unlikely(PyDict_SetItem(__pyx_v_config, __pyx_n_s_dtype, __pyx_t_2) < 0)) __PYX_ERR(0, 342, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/vlen.pyx":340 + /* "numcodecs/vlen.pyx":343 * config['id'] = self.codec_id * config['dtype'] = self.dtype.str * return config # <<<<<<<<<<<<<< @@ -5005,7 +5067,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_2get_config(CYTHON_UNUSED __pyx_r = __pyx_v_config; goto __pyx_L0; - /* "numcodecs/vlen.pyx":336 + /* "numcodecs/vlen.pyx":339 * self.dtype = np.dtype(dtype) * * def get_config(self): # <<<<<<<<<<<<<< @@ -5026,7 +5088,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_2get_config(CYTHON_UNUSED return __pyx_r; } -/* "numcodecs/vlen.pyx":342 +/* "numcodecs/vlen.pyx":345 * return config * * def __repr__(self): # <<<<<<<<<<<<<< @@ -5057,7 +5119,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_4__repr__(CYTHON_UNUSED Py PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("__repr__", 0); - /* "numcodecs/vlen.pyx":343 + /* "numcodecs/vlen.pyx":346 * * def __repr__(self): * return '%s(dtype=%r)' % (type(self).__name__, self.dtype.str,) # <<<<<<<<<<<<<< @@ -5065,14 +5127,14 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_4__repr__(CYTHON_UNUSED Py * @cython.wraparound(False) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_self)), __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_self)), __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 343, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_str); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 343, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_str); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 343, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); @@ -5080,14 +5142,14 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_4__repr__(CYTHON_UNUSED Py PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); __pyx_t_1 = 0; __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_s_dtype_r, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 343, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_s_dtype_r, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "numcodecs/vlen.pyx":342 + /* "numcodecs/vlen.pyx":345 * return config * * def __repr__(self): # <<<<<<<<<<<<<< @@ -5108,7 +5170,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_4__repr__(CYTHON_UNUSED Py return __pyx_r; } -/* "numcodecs/vlen.pyx":347 +/* "numcodecs/vlen.pyx":350 * @cython.wraparound(False) * @cython.boundscheck(False) * def encode(self, buf): # <<<<<<<<<<<<<< @@ -5149,11 +5211,11 @@ static PyObject *__pyx_pw_9numcodecs_4vlen_9VLenArray_7encode(PyObject *__pyx_se case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buf)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, 1); __PYX_ERR(0, 347, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, 1); __PYX_ERR(0, 350, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode") < 0)) __PYX_ERR(0, 347, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode") < 0)) __PYX_ERR(0, 350, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -5166,7 +5228,7 @@ static PyObject *__pyx_pw_9numcodecs_4vlen_9VLenArray_7encode(PyObject *__pyx_se } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 347, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 350, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.vlen.VLenArray.encode", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -5218,48 +5280,48 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_6encode(CYTHON_UNUSED PyOb char *__pyx_t_21; __Pyx_RefNannySetupContext("encode", 0); - /* "numcodecs/vlen.pyx":361 + /* "numcodecs/vlen.pyx":364 * * # normalise input * values = np.asarray(buf, dtype=object).reshape(-1, order='A') # <<<<<<<<<<<<<< * * # determine number of items */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 361, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 361, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 364, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 361, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_buf); __Pyx_GIVEREF(__pyx_v_buf); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_buf); - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 361, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 364, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_builtin_object) < 0) __PYX_ERR(0, 361, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 361, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_builtin_object) < 0) __PYX_ERR(0, 364, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 364, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_reshape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 361, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_reshape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 364, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 361, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 364, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_order, __pyx_n_s_A) < 0) __PYX_ERR(0, 361, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 361, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_order, __pyx_n_s_A) < 0) __PYX_ERR(0, 364, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_object(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 361, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_object(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 364, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_values = __pyx_t_5; __pyx_t_5.memview = NULL; __pyx_t_5.data = NULL; - /* "numcodecs/vlen.pyx":364 + /* "numcodecs/vlen.pyx":367 * * # determine number of items * n_items = values.shape[0] # <<<<<<<<<<<<<< @@ -5268,79 +5330,79 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_6encode(CYTHON_UNUSED PyOb */ __pyx_v_n_items = (__pyx_v_values.shape[0]); - /* "numcodecs/vlen.pyx":367 + /* "numcodecs/vlen.pyx":370 * * # setup intermediates * normed_values = np.empty(n_items, dtype=object) # <<<<<<<<<<<<<< * lengths = np.empty(n_items, dtype=np.intc) * */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 367, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 370, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 367, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 370, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_n_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 367, __pyx_L1_error) + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_n_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 370, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 367, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 370, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 367, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 370, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_builtin_object) < 0) __PYX_ERR(0, 367, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 367, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_builtin_object) < 0) __PYX_ERR(0, 370, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 370, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_object(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 367, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_object(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 370, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_normed_values = __pyx_t_5; __pyx_t_5.memview = NULL; __pyx_t_5.data = NULL; - /* "numcodecs/vlen.pyx":368 + /* "numcodecs/vlen.pyx":371 * # setup intermediates * normed_values = np.empty(n_items, dtype=object) * lengths = np.empty(n_items, dtype=np.intc) # <<<<<<<<<<<<<< * * # first iteration to convert to bytes */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 368, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 371, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 371, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_n_items); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 368, __pyx_L1_error) + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_n_items); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 371, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 368, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 371, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 368, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 371, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 368, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 371, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_intc); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 368, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_intc); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 371, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 368, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 371, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 368, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 371, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_6, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 368, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_6, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 371, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_v_lengths = __pyx_t_7; __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; - /* "numcodecs/vlen.pyx":371 + /* "numcodecs/vlen.pyx":374 * * # first iteration to convert to bytes * data_length = 0 # <<<<<<<<<<<<<< @@ -5349,7 +5411,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_6encode(CYTHON_UNUSED PyOb */ __pyx_v_data_length = 0; - /* "numcodecs/vlen.pyx":372 + /* "numcodecs/vlen.pyx":375 * # first iteration to convert to bytes * data_length = 0 * for i in range(n_items): # <<<<<<<<<<<<<< @@ -5361,7 +5423,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_6encode(CYTHON_UNUSED PyOb for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_i = __pyx_t_10; - /* "numcodecs/vlen.pyx":373 + /* "numcodecs/vlen.pyx":376 * data_length = 0 * for i in range(n_items): * v = values[i] # <<<<<<<<<<<<<< @@ -5374,7 +5436,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_6encode(CYTHON_UNUSED PyOb __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_6); __pyx_t_6 = 0; - /* "numcodecs/vlen.pyx":374 + /* "numcodecs/vlen.pyx":377 * for i in range(n_items): * v = values[i] * if v is None: # <<<<<<<<<<<<<< @@ -5385,32 +5447,32 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_6encode(CYTHON_UNUSED PyOb __pyx_t_13 = (__pyx_t_12 != 0); if (__pyx_t_13) { - /* "numcodecs/vlen.pyx":375 + /* "numcodecs/vlen.pyx":378 * v = values[i] * if v is None: * v = np.array([], dtype=self.dtype) # <<<<<<<<<<<<<< * else: * v = np.ascontiguousarray(v, self.dtype) */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 375, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 378, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 375, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 378, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 375, __pyx_L1_error) + __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 378, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 375, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 378, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 375, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 378, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 375, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 378, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 375, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 378, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 375, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 378, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -5418,7 +5480,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_6encode(CYTHON_UNUSED PyOb __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/vlen.pyx":374 + /* "numcodecs/vlen.pyx":377 * for i in range(n_items): * v = values[i] * if v is None: # <<<<<<<<<<<<<< @@ -5428,7 +5490,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_6encode(CYTHON_UNUSED PyOb goto __pyx_L5; } - /* "numcodecs/vlen.pyx":377 + /* "numcodecs/vlen.pyx":380 * v = np.array([], dtype=self.dtype) * else: * v = np.ascontiguousarray(v, self.dtype) # <<<<<<<<<<<<<< @@ -5436,12 +5498,12 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_6encode(CYTHON_UNUSED PyOb * raise ValueError('only 1-dimensional arrays are supported') */ /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 377, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 380, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 377, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 380, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 377, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 380, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_2 = NULL; __pyx_t_14 = 0; @@ -5458,7 +5520,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_6encode(CYTHON_UNUSED PyOb #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_v, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 377, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 380, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; @@ -5467,14 +5529,14 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_6encode(CYTHON_UNUSED PyOb #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_v, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 377, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 380, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else #endif { - __pyx_t_4 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 377, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 380, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__pyx_t_2) { __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL; @@ -5485,7 +5547,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_6encode(CYTHON_UNUSED PyOb __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_14, __pyx_t_6); __pyx_t_6 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 377, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 380, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } @@ -5495,36 +5557,36 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_6encode(CYTHON_UNUSED PyOb } __pyx_L5:; - /* "numcodecs/vlen.pyx":378 + /* "numcodecs/vlen.pyx":381 * else: * v = np.ascontiguousarray(v, self.dtype) * if v.ndim != 1: # <<<<<<<<<<<<<< * raise ValueError('only 1-dimensional arrays are supported') * l = v.nbytes */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_v, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 378, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_v, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 381, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_NeObjC(__pyx_t_1, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 378, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_NeObjC(__pyx_t_1, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 381, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 378, __pyx_L1_error) + __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 381, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(__pyx_t_13)) { - /* "numcodecs/vlen.pyx":379 + /* "numcodecs/vlen.pyx":382 * v = np.ascontiguousarray(v, self.dtype) * if v.ndim != 1: * raise ValueError('only 1-dimensional arrays are supported') # <<<<<<<<<<<<<< * l = v.nbytes * normed_values[i] = v */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 379, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 382, __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, 379, __pyx_L1_error) + __PYX_ERR(0, 382, __pyx_L1_error) - /* "numcodecs/vlen.pyx":378 + /* "numcodecs/vlen.pyx":381 * else: * v = np.ascontiguousarray(v, self.dtype) * if v.ndim != 1: # <<<<<<<<<<<<<< @@ -5533,20 +5595,20 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_6encode(CYTHON_UNUSED PyOb */ } - /* "numcodecs/vlen.pyx":380 + /* "numcodecs/vlen.pyx":383 * if v.ndim != 1: * raise ValueError('only 1-dimensional arrays are supported') * l = v.nbytes # <<<<<<<<<<<<<< * normed_values[i] = v * data_length += l + 4 # 4 bytes to store item length */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_v, __pyx_n_s_nbytes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 380, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_v, __pyx_n_s_nbytes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 383, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 380, __pyx_L1_error) + __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 383, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_l = __pyx_t_15; - /* "numcodecs/vlen.pyx":381 + /* "numcodecs/vlen.pyx":384 * raise ValueError('only 1-dimensional arrays are supported') * l = v.nbytes * normed_values[i] = v # <<<<<<<<<<<<<< @@ -5560,7 +5622,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_6encode(CYTHON_UNUSED PyOb *__pyx_t_17 = __pyx_v_v; __Pyx_GIVEREF(*__pyx_t_17); - /* "numcodecs/vlen.pyx":382 + /* "numcodecs/vlen.pyx":385 * l = v.nbytes * normed_values[i] = v * data_length += l + 4 # 4 bytes to store item length # <<<<<<<<<<<<<< @@ -5569,7 +5631,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_6encode(CYTHON_UNUSED PyOb */ __pyx_v_data_length = (__pyx_v_data_length + (__pyx_v_l + 4)); - /* "numcodecs/vlen.pyx":383 + /* "numcodecs/vlen.pyx":386 * normed_values[i] = v * data_length += l + 4 # 4 bytes to store item length * lengths[i] = l # <<<<<<<<<<<<<< @@ -5580,7 +5642,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_6encode(CYTHON_UNUSED PyOb *((int *) ( /* dim=0 */ (__pyx_v_lengths.data + __pyx_t_18 * __pyx_v_lengths.strides[0]) )) = __pyx_v_l; } - /* "numcodecs/vlen.pyx":386 + /* "numcodecs/vlen.pyx":389 * * # setup output * total_length = HEADER_LENGTH + data_length # <<<<<<<<<<<<<< @@ -5589,19 +5651,19 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_6encode(CYTHON_UNUSED PyOb */ __pyx_v_total_length = (__pyx_v_9numcodecs_4vlen_HEADER_LENGTH + __pyx_v_data_length); - /* "numcodecs/vlen.pyx":387 + /* "numcodecs/vlen.pyx":390 * # setup output * total_length = HEADER_LENGTH + data_length * out = PyByteArray_FromStringAndSize(NULL, total_length) # <<<<<<<<<<<<<< * * # write header */ - __pyx_t_3 = PyByteArray_FromStringAndSize(NULL, __pyx_v_total_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 387, __pyx_L1_error) + __pyx_t_3 = PyByteArray_FromStringAndSize(NULL, __pyx_v_total_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 390, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_out = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "numcodecs/vlen.pyx":390 + /* "numcodecs/vlen.pyx":393 * * # write header * data = PyByteArray_AS_STRING(out) # <<<<<<<<<<<<<< @@ -5610,7 +5672,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_6encode(CYTHON_UNUSED PyOb */ __pyx_v_data = PyByteArray_AS_STRING(__pyx_v_out); - /* "numcodecs/vlen.pyx":391 + /* "numcodecs/vlen.pyx":394 * # write header * data = PyByteArray_AS_STRING(out) * store_le32(data, n_items) # <<<<<<<<<<<<<< @@ -5619,7 +5681,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_6encode(CYTHON_UNUSED PyOb */ store_le32(__pyx_v_data, __pyx_v_n_items); - /* "numcodecs/vlen.pyx":394 + /* "numcodecs/vlen.pyx":397 * * # second iteration, store data * data += HEADER_LENGTH # <<<<<<<<<<<<<< @@ -5628,7 +5690,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_6encode(CYTHON_UNUSED PyOb */ __pyx_v_data = (__pyx_v_data + __pyx_v_9numcodecs_4vlen_HEADER_LENGTH); - /* "numcodecs/vlen.pyx":395 + /* "numcodecs/vlen.pyx":398 * # second iteration, store data * data += HEADER_LENGTH * for i in range(n_items): # <<<<<<<<<<<<<< @@ -5640,7 +5702,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_6encode(CYTHON_UNUSED PyOb for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_i = __pyx_t_10; - /* "numcodecs/vlen.pyx":396 + /* "numcodecs/vlen.pyx":399 * data += HEADER_LENGTH * for i in range(n_items): * l = lengths[i] # <<<<<<<<<<<<<< @@ -5650,7 +5712,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_6encode(CYTHON_UNUSED PyOb __pyx_t_19 = __pyx_v_i; __pyx_v_l = (*((int *) ( /* dim=0 */ (__pyx_v_lengths.data + __pyx_t_19 * __pyx_v_lengths.strides[0]) ))); - /* "numcodecs/vlen.pyx":397 + /* "numcodecs/vlen.pyx":400 * for i in range(n_items): * l = lengths[i] * store_le32(data, l) # <<<<<<<<<<<<<< @@ -5659,7 +5721,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_6encode(CYTHON_UNUSED PyOb */ store_le32(__pyx_v_data, __pyx_v_l); - /* "numcodecs/vlen.pyx":398 + /* "numcodecs/vlen.pyx":401 * l = lengths[i] * store_le32(data, l) * data += 4 # <<<<<<<<<<<<<< @@ -5668,7 +5730,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_6encode(CYTHON_UNUSED PyOb */ __pyx_v_data = (__pyx_v_data + 4); - /* "numcodecs/vlen.pyx":399 + /* "numcodecs/vlen.pyx":402 * store_le32(data, l) * data += 4 * value_buffer = Buffer(normed_values[i], PyBUF_ANY_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -5678,9 +5740,9 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_6encode(CYTHON_UNUSED PyOb __pyx_t_20 = __pyx_v_i; __pyx_t_3 = (PyObject *) *((PyObject * *) ( /* dim=0 */ (__pyx_v_normed_values.data + __pyx_t_20 * __pyx_v_normed_values.strides[0]) )); __Pyx_INCREF((PyObject*)__pyx_t_3); - __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 399, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 402, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 399, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 402, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); @@ -5688,13 +5750,13 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_6encode(CYTHON_UNUSED PyOb PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); __pyx_t_3 = 0; __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 399, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 402, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF_SET(__pyx_v_value_buffer, ((struct __pyx_obj_9numcodecs_10compat_ext_Buffer *)__pyx_t_1)); __pyx_t_1 = 0; - /* "numcodecs/vlen.pyx":400 + /* "numcodecs/vlen.pyx":403 * data += 4 * value_buffer = Buffer(normed_values[i], PyBUF_ANY_CONTIGUOUS) * encv = value_buffer.ptr # <<<<<<<<<<<<<< @@ -5704,7 +5766,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_6encode(CYTHON_UNUSED PyOb __pyx_t_21 = __pyx_v_value_buffer->ptr; __pyx_v_encv = __pyx_t_21; - /* "numcodecs/vlen.pyx":401 + /* "numcodecs/vlen.pyx":404 * value_buffer = Buffer(normed_values[i], PyBUF_ANY_CONTIGUOUS) * encv = value_buffer.ptr * memcpy(data, encv, l) # <<<<<<<<<<<<<< @@ -5713,7 +5775,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_6encode(CYTHON_UNUSED PyOb */ (void)(memcpy(__pyx_v_data, __pyx_v_encv, __pyx_v_l)); - /* "numcodecs/vlen.pyx":402 + /* "numcodecs/vlen.pyx":405 * encv = value_buffer.ptr * memcpy(data, encv, l) * data += l # <<<<<<<<<<<<<< @@ -5722,19 +5784,19 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_6encode(CYTHON_UNUSED PyOb */ __pyx_v_data = (__pyx_v_data + __pyx_v_l); - /* "numcodecs/vlen.pyx":403 + /* "numcodecs/vlen.pyx":406 * memcpy(data, encv, l) * data += l * value_buffer.release() # <<<<<<<<<<<<<< * * return out */ - __pyx_t_1 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_value_buffer->__pyx_vtab)->release(__pyx_v_value_buffer, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 403, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_9numcodecs_10compat_ext_Buffer *)__pyx_v_value_buffer->__pyx_vtab)->release(__pyx_v_value_buffer, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 406, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "numcodecs/vlen.pyx":405 + /* "numcodecs/vlen.pyx":408 * value_buffer.release() * * return out # <<<<<<<<<<<<<< @@ -5746,7 +5808,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_6encode(CYTHON_UNUSED PyOb __pyx_r = __pyx_v_out; goto __pyx_L0; - /* "numcodecs/vlen.pyx":347 + /* "numcodecs/vlen.pyx":350 * @cython.wraparound(False) * @cython.boundscheck(False) * def encode(self, buf): # <<<<<<<<<<<<<< @@ -5777,7 +5839,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_6encode(CYTHON_UNUSED PyOb return __pyx_r; } -/* "numcodecs/vlen.pyx":409 +/* "numcodecs/vlen.pyx":412 * @cython.wraparound(False) * @cython.boundscheck(False) * def decode(self, buf, out=None): # <<<<<<<<<<<<<< @@ -5822,7 +5884,7 @@ static PyObject *__pyx_pw_9numcodecs_4vlen_9VLenArray_9decode(PyObject *__pyx_se case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buf)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, 1); __PYX_ERR(0, 409, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, 1); __PYX_ERR(0, 412, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -5832,7 +5894,7 @@ static PyObject *__pyx_pw_9numcodecs_4vlen_9VLenArray_9decode(PyObject *__pyx_se } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode") < 0)) __PYX_ERR(0, 409, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode") < 0)) __PYX_ERR(0, 412, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -5850,7 +5912,7 @@ static PyObject *__pyx_pw_9numcodecs_4vlen_9VLenArray_9decode(PyObject *__pyx_se } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 409, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decode", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 412, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("numcodecs.vlen.VLenArray.decode", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -5875,11 +5937,11 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_8decode(CYTHON_UNUSED PyOb __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - size_t __pyx_t_3; - int __pyx_t_4; - char *__pyx_t_5; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + int __pyx_t_5; + char *__pyx_t_6; + int __pyx_t_7; PyObject *__pyx_t_8 = NULL; int __pyx_t_9; PyObject *__pyx_t_10 = NULL; @@ -5887,18 +5949,46 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_8decode(CYTHON_UNUSED PyOb Py_ssize_t __pyx_t_12; Py_ssize_t __pyx_t_13; __Pyx_RefNannySetupContext("decode", 0); + __Pyx_INCREF(__pyx_v_buf); __Pyx_INCREF(__pyx_v_out); - /* "numcodecs/vlen.pyx":417 - * + /* "numcodecs/vlen.pyx":420 + * + * # accept any buffer + * buf = ensure_contiguous_ndarray(buf) # <<<<<<<<<<<<<< + * input_buffer = Buffer(buf, PyBUF_ANY_CONTIGUOUS) + * input_length = input_buffer.nbytes + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ensure_contiguous_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 420, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_buf) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_buf); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 420, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_buf, __pyx_t_1); + __pyx_t_1 = 0; + + /* "numcodecs/vlen.pyx":421 * # accept any buffer + * buf = ensure_contiguous_ndarray(buf) * input_buffer = Buffer(buf, PyBUF_ANY_CONTIGUOUS) # <<<<<<<<<<<<<< * input_length = input_buffer.nbytes * */ - __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 417, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(PyBUF_ANY_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 421, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 417, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 421, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_buf); __Pyx_GIVEREF(__pyx_v_buf); @@ -5906,46 +5996,46 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_8decode(CYTHON_UNUSED PyOb __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 417, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9numcodecs_10compat_ext_Buffer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 421, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_input_buffer = ((struct __pyx_obj_9numcodecs_10compat_ext_Buffer *)__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/vlen.pyx":418 - * # accept any buffer + /* "numcodecs/vlen.pyx":422 + * buf = ensure_contiguous_ndarray(buf) * input_buffer = Buffer(buf, PyBUF_ANY_CONTIGUOUS) * input_length = input_buffer.nbytes # <<<<<<<<<<<<<< * * # sanity checks */ - __pyx_t_3 = __pyx_v_input_buffer->nbytes; - __pyx_v_input_length = __pyx_t_3; + __pyx_t_4 = __pyx_v_input_buffer->nbytes; + __pyx_v_input_length = __pyx_t_4; - /* "numcodecs/vlen.pyx":421 + /* "numcodecs/vlen.pyx":425 * * # sanity checks * if input_length < HEADER_LENGTH: # <<<<<<<<<<<<<< * raise ValueError('corrupt buffer, missing or truncated header') * */ - __pyx_t_4 = ((__pyx_v_input_length < __pyx_v_9numcodecs_4vlen_HEADER_LENGTH) != 0); - if (unlikely(__pyx_t_4)) { + __pyx_t_5 = ((__pyx_v_input_length < __pyx_v_9numcodecs_4vlen_HEADER_LENGTH) != 0); + if (unlikely(__pyx_t_5)) { - /* "numcodecs/vlen.pyx":422 + /* "numcodecs/vlen.pyx":426 * # sanity checks * if input_length < HEADER_LENGTH: * raise ValueError('corrupt buffer, missing or truncated header') # <<<<<<<<<<<<<< * * # obtain input data pointer */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 422, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 426, __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, 422, __pyx_L1_error) + __PYX_ERR(0, 426, __pyx_L1_error) - /* "numcodecs/vlen.pyx":421 + /* "numcodecs/vlen.pyx":425 * * # sanity checks * if input_length < HEADER_LENGTH: # <<<<<<<<<<<<<< @@ -5954,17 +6044,17 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_8decode(CYTHON_UNUSED PyOb */ } - /* "numcodecs/vlen.pyx":425 + /* "numcodecs/vlen.pyx":429 * * # obtain input data pointer * data = input_buffer.ptr # <<<<<<<<<<<<<< * data_end = data + input_length * */ - __pyx_t_5 = __pyx_v_input_buffer->ptr; - __pyx_v_data = __pyx_t_5; + __pyx_t_6 = __pyx_v_input_buffer->ptr; + __pyx_v_data = __pyx_t_6; - /* "numcodecs/vlen.pyx":426 + /* "numcodecs/vlen.pyx":430 * # obtain input data pointer * data = input_buffer.ptr * data_end = data + input_length # <<<<<<<<<<<<<< @@ -5973,7 +6063,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_8decode(CYTHON_UNUSED PyOb */ __pyx_v_data_end = (__pyx_v_data + __pyx_v_input_length); - /* "numcodecs/vlen.pyx":429 + /* "numcodecs/vlen.pyx":433 * * # load number of items * n_items = load_le32(data) # <<<<<<<<<<<<<< @@ -5982,28 +6072,28 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_8decode(CYTHON_UNUSED PyOb */ __pyx_v_n_items = load_le32(__pyx_v_data); - /* "numcodecs/vlen.pyx":432 + /* "numcodecs/vlen.pyx":436 * * # setup output * if out is not None: # <<<<<<<<<<<<<< * out = check_out_param(out, n_items) * else: */ - __pyx_t_4 = (__pyx_v_out != Py_None); - __pyx_t_6 = (__pyx_t_4 != 0); - if (__pyx_t_6) { + __pyx_t_5 = (__pyx_v_out != Py_None); + __pyx_t_7 = (__pyx_t_5 != 0); + if (__pyx_t_7) { - /* "numcodecs/vlen.pyx":433 + /* "numcodecs/vlen.pyx":437 * # setup output * if out is not None: * out = check_out_param(out, n_items) # <<<<<<<<<<<<<< * else: * out = np.empty(n_items, dtype=object) */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_out_param); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 433, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_out_param); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 437, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_n_items); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 433, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_n_items); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 437, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = NULL; __pyx_t_9 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { @@ -6018,24 +6108,24 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_8decode(CYTHON_UNUSED PyOb } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_out, __pyx_t_7}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 433, __pyx_L1_error) + PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_out, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 437, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_out, __pyx_t_7}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 433, __pyx_L1_error) + PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_out, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 437, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { - __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 433, __pyx_L1_error) + __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 437, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); if (__pyx_t_8) { __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL; @@ -6043,10 +6133,10 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_8decode(CYTHON_UNUSED PyOb __Pyx_INCREF(__pyx_v_out); __Pyx_GIVEREF(__pyx_v_out); PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_v_out); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 433, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 437, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } @@ -6054,7 +6144,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_8decode(CYTHON_UNUSED PyOb __Pyx_DECREF_SET(__pyx_v_out, __pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/vlen.pyx":432 + /* "numcodecs/vlen.pyx":436 * * # setup output * if out is not None: # <<<<<<<<<<<<<< @@ -6064,7 +6154,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_8decode(CYTHON_UNUSED PyOb goto __pyx_L4; } - /* "numcodecs/vlen.pyx":435 + /* "numcodecs/vlen.pyx":439 * out = check_out_param(out, n_items) * else: * out = np.empty(n_items, dtype=object) # <<<<<<<<<<<<<< @@ -6072,32 +6162,32 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_8decode(CYTHON_UNUSED PyOb * # iterate and decode - N.B., do not try to cast `out` as object[:] */ /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 435, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 435, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 439, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_n_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 435, __pyx_L1_error) + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_n_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 435, __pyx_L1_error) + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 439, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 435, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_builtin_object) < 0) __PYX_ERR(0, 435, __pyx_L1_error) - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 435, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_builtin_object) < 0) __PYX_ERR(0, 439, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 439, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_out, __pyx_t_7); - __pyx_t_7 = 0; + __Pyx_DECREF_SET(__pyx_v_out, __pyx_t_3); + __pyx_t_3 = 0; } __pyx_L4:; - /* "numcodecs/vlen.pyx":440 + /* "numcodecs/vlen.pyx":444 * # as this causes segfaults, possibly similar to * # https://github.com/cython/cython/issues/1608 * data += HEADER_LENGTH # <<<<<<<<<<<<<< @@ -6106,7 +6196,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_8decode(CYTHON_UNUSED PyOb */ __pyx_v_data = (__pyx_v_data + __pyx_v_9numcodecs_4vlen_HEADER_LENGTH); - /* "numcodecs/vlen.pyx":441 + /* "numcodecs/vlen.pyx":445 * # https://github.com/cython/cython/issues/1608 * data += HEADER_LENGTH * for i in range(n_items): # <<<<<<<<<<<<<< @@ -6118,30 +6208,30 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_8decode(CYTHON_UNUSED PyOb for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { __pyx_v_i = __pyx_t_13; - /* "numcodecs/vlen.pyx":442 + /* "numcodecs/vlen.pyx":446 * data += HEADER_LENGTH * for i in range(n_items): * if data + 4 > data_end: # <<<<<<<<<<<<<< * raise ValueError('corrupt buffer, data seem truncated') * l = load_le32(data) */ - __pyx_t_6 = (((__pyx_v_data + 4) > __pyx_v_data_end) != 0); - if (unlikely(__pyx_t_6)) { + __pyx_t_7 = (((__pyx_v_data + 4) > __pyx_v_data_end) != 0); + if (unlikely(__pyx_t_7)) { - /* "numcodecs/vlen.pyx":443 + /* "numcodecs/vlen.pyx":447 * for i in range(n_items): * if data + 4 > data_end: * raise ValueError('corrupt buffer, data seem truncated') # <<<<<<<<<<<<<< * l = load_le32(data) * data += 4 */ - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 443, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_Raise(__pyx_t_7, 0, 0, 0); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(0, 443, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 447, __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, 447, __pyx_L1_error) - /* "numcodecs/vlen.pyx":442 + /* "numcodecs/vlen.pyx":446 * data += HEADER_LENGTH * for i in range(n_items): * if data + 4 > data_end: # <<<<<<<<<<<<<< @@ -6150,7 +6240,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_8decode(CYTHON_UNUSED PyOb */ } - /* "numcodecs/vlen.pyx":444 + /* "numcodecs/vlen.pyx":448 * if data + 4 > data_end: * raise ValueError('corrupt buffer, data seem truncated') * l = load_le32(data) # <<<<<<<<<<<<<< @@ -6159,7 +6249,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_8decode(CYTHON_UNUSED PyOb */ __pyx_v_l = load_le32(__pyx_v_data); - /* "numcodecs/vlen.pyx":445 + /* "numcodecs/vlen.pyx":449 * raise ValueError('corrupt buffer, data seem truncated') * l = load_le32(data) * data += 4 # <<<<<<<<<<<<<< @@ -6168,30 +6258,30 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_8decode(CYTHON_UNUSED PyOb */ __pyx_v_data = (__pyx_v_data + 4); - /* "numcodecs/vlen.pyx":446 + /* "numcodecs/vlen.pyx":450 * l = load_le32(data) * data += 4 * if data + l > data_end: # <<<<<<<<<<<<<< * raise ValueError('corrupt buffer, data seem truncated') * out[i] = np.frombuffer(data[:l], dtype=self.dtype) */ - __pyx_t_6 = (((__pyx_v_data + __pyx_v_l) > __pyx_v_data_end) != 0); - if (unlikely(__pyx_t_6)) { + __pyx_t_7 = (((__pyx_v_data + __pyx_v_l) > __pyx_v_data_end) != 0); + if (unlikely(__pyx_t_7)) { - /* "numcodecs/vlen.pyx":447 + /* "numcodecs/vlen.pyx":451 * data += 4 * if data + l > data_end: * raise ValueError('corrupt buffer, data seem truncated') # <<<<<<<<<<<<<< * out[i] = np.frombuffer(data[:l], dtype=self.dtype) * data += l */ - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 447, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_Raise(__pyx_t_7, 0, 0, 0); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(0, 447, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 451, __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, 451, __pyx_L1_error) - /* "numcodecs/vlen.pyx":446 + /* "numcodecs/vlen.pyx":450 * l = load_le32(data) * data += 4 * if data + l > data_end: # <<<<<<<<<<<<<< @@ -6200,40 +6290,40 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_8decode(CYTHON_UNUSED PyOb */ } - /* "numcodecs/vlen.pyx":448 + /* "numcodecs/vlen.pyx":452 * if data + l > data_end: * raise ValueError('corrupt buffer, data seem truncated') * out[i] = np.frombuffer(data[:l], dtype=self.dtype) # <<<<<<<<<<<<<< * data += l * */ - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 448, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_frombuffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 448, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_frombuffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 452, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_data + 0, __pyx_v_l - 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 448, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 448, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_data + 0, __pyx_v_l - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 452, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 448, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 448, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 452, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 448, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 452, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 448, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 452, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(__Pyx_SetItemInt(__pyx_v_out, __pyx_v_i, __pyx_t_2, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0) < 0)) __PYX_ERR(0, 448, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(__Pyx_SetItemInt(__pyx_v_out, __pyx_v_i, __pyx_t_2, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0) < 0)) __PYX_ERR(0, 452, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/vlen.pyx":449 + /* "numcodecs/vlen.pyx":453 * raise ValueError('corrupt buffer, data seem truncated') * out[i] = np.frombuffer(data[:l], dtype=self.dtype) * data += l # <<<<<<<<<<<<<< @@ -6243,7 +6333,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_8decode(CYTHON_UNUSED PyOb __pyx_v_data = (__pyx_v_data + __pyx_v_l); } - /* "numcodecs/vlen.pyx":451 + /* "numcodecs/vlen.pyx":455 * data += l * * return out # <<<<<<<<<<<<<< @@ -6253,7 +6343,7 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_8decode(CYTHON_UNUSED PyOb __pyx_r = __pyx_v_out; goto __pyx_L0; - /* "numcodecs/vlen.pyx":409 + /* "numcodecs/vlen.pyx":412 * @cython.wraparound(False) * @cython.boundscheck(False) * def decode(self, buf, out=None): # <<<<<<<<<<<<<< @@ -6265,13 +6355,14 @@ static PyObject *__pyx_pf_9numcodecs_4vlen_9VLenArray_8decode(CYTHON_UNUSED PyOb __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_10); __Pyx_AddTraceback("numcodecs.vlen.VLenArray.decode", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_input_buffer); + __Pyx_XDECREF(__pyx_v_buf); __Pyx_XDECREF(__pyx_v_out); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); @@ -19826,6 +19917,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, {&__pyx_n_s_codec_id, __pyx_k_codec_id, sizeof(__pyx_k_codec_id), 0, 0, 1, 1}, + {&__pyx_n_s_compat, __pyx_k_compat, sizeof(__pyx_k_compat), 0, 0, 1, 1}, {&__pyx_n_s_compat_ext, __pyx_k_compat_ext, sizeof(__pyx_k_compat_ext), 0, 0, 1, 1}, {&__pyx_n_s_config, __pyx_k_config, sizeof(__pyx_k_config), 0, 0, 1, 1}, {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0}, @@ -19845,6 +19937,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_encoded_lengths, __pyx_k_encoded_lengths, sizeof(__pyx_k_encoded_lengths), 0, 0, 1, 1}, {&__pyx_n_s_encoded_values, __pyx_k_encoded_values, sizeof(__pyx_k_encoded_values), 0, 0, 1, 1}, {&__pyx_n_s_encv, __pyx_k_encv, sizeof(__pyx_k_encv), 0, 0, 1, 1}, + {&__pyx_n_s_ensure_contiguous_ndarray, __pyx_k_ensure_contiguous_ndarray, sizeof(__pyx_k_ensure_contiguous_ndarray), 0, 0, 1, 1}, {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1}, {&__pyx_kp_s_expected_byte_string_found_r, __pyx_k_expected_byte_string_found_r, sizeof(__pyx_k_expected_byte_string_found_r), 0, 0, 1, 0}, @@ -19944,10 +20037,10 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 40, __pyx_L1_error) - __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 41, __pyx_L1_error) - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 42, __pyx_L1_error) - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 102, __pyx_L1_error) + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 42, __pyx_L1_error) + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 43, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 103, __pyx_L1_error) __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 147, __pyx_L1_error) __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 150, __pyx_L1_error) __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 399, __pyx_L1_error) @@ -19962,190 +20055,190 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "numcodecs/vlen.pyx":40 + /* "numcodecs/vlen.pyx":41 * def check_out_param(out, n_items): * if not isinstance(out, np.ndarray): * raise TypeError('out must be 1-dimensional array') # <<<<<<<<<<<<<< * if out.dtype != object: * raise ValueError('out must be object array') */ - __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_out_must_be_1_dimensional_array); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 40, __pyx_L1_error) + __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_out_must_be_1_dimensional_array); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_); - /* "numcodecs/vlen.pyx":42 + /* "numcodecs/vlen.pyx":43 * raise TypeError('out must be 1-dimensional array') * if out.dtype != object: * raise ValueError('out must be object array') # <<<<<<<<<<<<<< * out = out.reshape(-1, order='A') * if out.shape[0] < n_items: */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_out_must_be_object_array); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 42, __pyx_L1_error) + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_out_must_be_object_array); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); - /* "numcodecs/vlen.pyx":43 + /* "numcodecs/vlen.pyx":44 * if out.dtype != object: * raise ValueError('out must be object array') * out = out.reshape(-1, order='A') # <<<<<<<<<<<<<< * if out.shape[0] < n_items: * raise ValueError('out is too small') */ - __pyx_tuple__3 = PyTuple_Pack(1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 43, __pyx_L1_error) + __pyx_tuple__3 = PyTuple_Pack(1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); - /* "numcodecs/vlen.pyx":45 + /* "numcodecs/vlen.pyx":46 * out = out.reshape(-1, order='A') * if out.shape[0] < n_items: * raise ValueError('out is too small') # <<<<<<<<<<<<<< * return out * */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_out_is_too_small); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 45, __pyx_L1_error) + __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_out_is_too_small); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); __Pyx_GIVEREF(__pyx_tuple__4); - /* "numcodecs/vlen.pyx":91 + /* "numcodecs/vlen.pyx":92 * * # normalise input * input_values = np.asarray(buf, dtype=object).reshape(-1, order='A') # <<<<<<<<<<<<<< * * # determine number of items */ - __pyx_tuple__3 = PyTuple_Pack(1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 91, __pyx_L1_error) + __pyx_tuple__3 = PyTuple_Pack(1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); - /* "numcodecs/vlen.pyx":149 + /* "numcodecs/vlen.pyx":151 * # sanity checks * if input_length < HEADER_LENGTH: * raise ValueError('corrupt buffer, missing or truncated header') # <<<<<<<<<<<<<< * * # obtain input data pointer */ - __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_corrupt_buffer_missing_or_trunca); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 149, __pyx_L1_error) + __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_corrupt_buffer_missing_or_trunca); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 151, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__6); __Pyx_GIVEREF(__pyx_tuple__6); - /* "numcodecs/vlen.pyx":170 + /* "numcodecs/vlen.pyx":172 * for i in range(n_items): * if data + 4 > data_end: * raise ValueError('corrupt buffer, data seem truncated') # <<<<<<<<<<<<<< * l = load_le32(data) * data += 4 */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_corrupt_buffer_data_seem_truncat); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 170, __pyx_L1_error) + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_corrupt_buffer_data_seem_truncat); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 172, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__7); __Pyx_GIVEREF(__pyx_tuple__7); - /* "numcodecs/vlen.pyx":174 + /* "numcodecs/vlen.pyx":176 * data += 4 * if data + l > data_end: * raise ValueError('corrupt buffer, data seem truncated') # <<<<<<<<<<<<<< * out[i] = PyUnicode_FromStringAndSize(data, l) * data += l */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_corrupt_buffer_data_seem_truncat); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 174, __pyx_L1_error) + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_corrupt_buffer_data_seem_truncat); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 176, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__7); __Pyx_GIVEREF(__pyx_tuple__7); - /* "numcodecs/vlen.pyx":221 + /* "numcodecs/vlen.pyx":223 * * # normalise input * values = np.asarray(buf, dtype=object).reshape(-1, order='A') # <<<<<<<<<<<<<< * * # determine number of items */ - __pyx_tuple__3 = PyTuple_Pack(1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 221, __pyx_L1_error) + __pyx_tuple__3 = PyTuple_Pack(1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); - /* "numcodecs/vlen.pyx":276 + /* "numcodecs/vlen.pyx":279 * # sanity checks * if input_length < HEADER_LENGTH: * raise ValueError('corrupt buffer, missing or truncated header') # <<<<<<<<<<<<<< * * # obtain input data pointer */ - __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_corrupt_buffer_missing_or_trunca); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 276, __pyx_L1_error) + __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_corrupt_buffer_missing_or_trunca); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 279, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__6); __Pyx_GIVEREF(__pyx_tuple__6); - /* "numcodecs/vlen.pyx":297 + /* "numcodecs/vlen.pyx":300 * for i in range(n_items): * if data + 4 > data_end: * raise ValueError('corrupt buffer, data seem truncated') # <<<<<<<<<<<<<< * l = load_le32(data) * data += 4 */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_corrupt_buffer_data_seem_truncat); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 297, __pyx_L1_error) + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_corrupt_buffer_data_seem_truncat); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 300, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__7); __Pyx_GIVEREF(__pyx_tuple__7); - /* "numcodecs/vlen.pyx":301 + /* "numcodecs/vlen.pyx":304 * data += 4 * if data + l > data_end: * raise ValueError('corrupt buffer, data seem truncated') # <<<<<<<<<<<<<< * out[i] = PyBytes_FromStringAndSize(data, l) * data += l */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_corrupt_buffer_data_seem_truncat); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 301, __pyx_L1_error) + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_corrupt_buffer_data_seem_truncat); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 304, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__7); __Pyx_GIVEREF(__pyx_tuple__7); - /* "numcodecs/vlen.pyx":361 + /* "numcodecs/vlen.pyx":364 * * # normalise input * values = np.asarray(buf, dtype=object).reshape(-1, order='A') # <<<<<<<<<<<<<< * * # determine number of items */ - __pyx_tuple__3 = PyTuple_Pack(1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 361, __pyx_L1_error) + __pyx_tuple__3 = PyTuple_Pack(1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 364, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); - /* "numcodecs/vlen.pyx":379 + /* "numcodecs/vlen.pyx":382 * v = np.ascontiguousarray(v, self.dtype) * if v.ndim != 1: * raise ValueError('only 1-dimensional arrays are supported') # <<<<<<<<<<<<<< * l = v.nbytes * normed_values[i] = v */ - __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_only_1_dimensional_arrays_are_su); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 379, __pyx_L1_error) + __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_only_1_dimensional_arrays_are_su); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 382, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8); - /* "numcodecs/vlen.pyx":422 + /* "numcodecs/vlen.pyx":426 * # sanity checks * if input_length < HEADER_LENGTH: * raise ValueError('corrupt buffer, missing or truncated header') # <<<<<<<<<<<<<< * * # obtain input data pointer */ - __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_corrupt_buffer_missing_or_trunca); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 422, __pyx_L1_error) + __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_corrupt_buffer_missing_or_trunca); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 426, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__6); __Pyx_GIVEREF(__pyx_tuple__6); - /* "numcodecs/vlen.pyx":443 + /* "numcodecs/vlen.pyx":447 * for i in range(n_items): * if data + 4 > data_end: * raise ValueError('corrupt buffer, data seem truncated') # <<<<<<<<<<<<<< * l = load_le32(data) * data += 4 */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_corrupt_buffer_data_seem_truncat); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 443, __pyx_L1_error) + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_corrupt_buffer_data_seem_truncat); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 447, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__7); __Pyx_GIVEREF(__pyx_tuple__7); - /* "numcodecs/vlen.pyx":447 + /* "numcodecs/vlen.pyx":451 * data += 4 * if data + l > data_end: * raise ValueError('corrupt buffer, data seem truncated') # <<<<<<<<<<<<<< * out[i] = np.frombuffer(data[:l], dtype=self.dtype) * data += l */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_corrupt_buffer_data_seem_truncat); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 447, __pyx_L1_error) + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_corrupt_buffer_data_seem_truncat); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 451, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__7); __Pyx_GIVEREF(__pyx_tuple__7); @@ -20363,156 +20456,156 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_tuple__26); __Pyx_GIVEREF(__pyx_tuple__26); - /* "numcodecs/vlen.pyx":38 + /* "numcodecs/vlen.pyx":39 * * * def check_out_param(out, n_items): # <<<<<<<<<<<<<< * if not isinstance(out, np.ndarray): * raise TypeError('out must be 1-dimensional array') */ - __pyx_tuple__27 = PyTuple_Pack(2, __pyx_n_s_out, __pyx_n_s_n_items); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 38, __pyx_L1_error) + __pyx_tuple__27 = PyTuple_Pack(2, __pyx_n_s_out, __pyx_n_s_n_items); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__27); __Pyx_GIVEREF(__pyx_tuple__27); - __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_vlen_pyx, __pyx_n_s_check_out_param, 38, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 38, __pyx_L1_error) + __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_vlen_pyx, __pyx_n_s_check_out_param, 39, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 39, __pyx_L1_error) - /* "numcodecs/vlen.pyx":73 + /* "numcodecs/vlen.pyx":74 * codec_id = 'vlen-utf8' * * def __init__(self): # <<<<<<<<<<<<<< * pass * */ - __pyx_tuple__29 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 73, __pyx_L1_error) + __pyx_tuple__29 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__29); __Pyx_GIVEREF(__pyx_tuple__29); - __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_vlen_pyx, __pyx_n_s_init, 73, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 73, __pyx_L1_error) + __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_vlen_pyx, __pyx_n_s_init, 74, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 74, __pyx_L1_error) - /* "numcodecs/vlen.pyx":78 + /* "numcodecs/vlen.pyx":79 * @cython.wraparound(False) * @cython.boundscheck(False) * def encode(self, buf): # <<<<<<<<<<<<<< * cdef: * Py_ssize_t i, l, n_items, data_length, total_length */ - __pyx_tuple__31 = PyTuple_Pack(15, __pyx_n_s_self, __pyx_n_s_buf, __pyx_n_s_i, __pyx_n_s_l, __pyx_n_s_n_items, __pyx_n_s_data_length, __pyx_n_s_total_length, __pyx_n_s_input_values, __pyx_n_s_encoded_values, __pyx_n_s_encoded_lengths, __pyx_n_s_encv, __pyx_n_s_b, __pyx_n_s_out, __pyx_n_s_data, __pyx_n_s_u); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_tuple__31 = PyTuple_Pack(15, __pyx_n_s_self, __pyx_n_s_buf, __pyx_n_s_i, __pyx_n_s_l, __pyx_n_s_n_items, __pyx_n_s_data_length, __pyx_n_s_total_length, __pyx_n_s_input_values, __pyx_n_s_encoded_values, __pyx_n_s_encoded_lengths, __pyx_n_s_encv, __pyx_n_s_b, __pyx_n_s_out, __pyx_n_s_data, __pyx_n_s_u); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__31); __Pyx_GIVEREF(__pyx_tuple__31); - __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(2, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_vlen_pyx, __pyx_n_s_encode, 78, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(2, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_vlen_pyx, __pyx_n_s_encode, 79, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 79, __pyx_L1_error) - /* "numcodecs/vlen.pyx":136 + /* "numcodecs/vlen.pyx":137 * @cython.wraparound(False) * @cython.boundscheck(False) * def decode(self, buf, out=None): # <<<<<<<<<<<<<< * cdef: * Buffer input_buffer */ - __pyx_tuple__33 = PyTuple_Pack(11, __pyx_n_s_self, __pyx_n_s_buf, __pyx_n_s_out, __pyx_n_s_input_buffer, __pyx_n_s_data, __pyx_n_s_data_end, __pyx_n_s_i, __pyx_n_s_l, __pyx_n_s_n_items, __pyx_n_s_data_length, __pyx_n_s_input_length); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 136, __pyx_L1_error) + __pyx_tuple__33 = PyTuple_Pack(11, __pyx_n_s_self, __pyx_n_s_buf, __pyx_n_s_out, __pyx_n_s_input_buffer, __pyx_n_s_data, __pyx_n_s_data_end, __pyx_n_s_i, __pyx_n_s_l, __pyx_n_s_n_items, __pyx_n_s_data_length, __pyx_n_s_input_length); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 137, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__33); __Pyx_GIVEREF(__pyx_tuple__33); - __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(3, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_vlen_pyx, __pyx_n_s_decode, 136, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 136, __pyx_L1_error) - __pyx_tuple__35 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 136, __pyx_L1_error) + __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(3, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_vlen_pyx, __pyx_n_s_decode, 137, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 137, __pyx_L1_error) + __pyx_tuple__35 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 137, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__35); __Pyx_GIVEREF(__pyx_tuple__35); - /* "numcodecs/vlen.pyx":205 + /* "numcodecs/vlen.pyx":207 * codec_id = 'vlen-bytes' * * def __init__(self): # <<<<<<<<<<<<<< * pass * */ - __pyx_tuple__36 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 205, __pyx_L1_error) + __pyx_tuple__36 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__36); __Pyx_GIVEREF(__pyx_tuple__36); - __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_vlen_pyx, __pyx_n_s_init, 205, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 205, __pyx_L1_error) + __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_vlen_pyx, __pyx_n_s_init, 207, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 207, __pyx_L1_error) - /* "numcodecs/vlen.pyx":210 + /* "numcodecs/vlen.pyx":212 * @cython.wraparound(False) * @cython.boundscheck(False) * def encode(self, buf): # <<<<<<<<<<<<<< * cdef: * Py_ssize_t i, l, n_items, data_length, total_length */ - __pyx_tuple__38 = PyTuple_Pack(13, __pyx_n_s_self, __pyx_n_s_buf, __pyx_n_s_i, __pyx_n_s_l, __pyx_n_s_n_items, __pyx_n_s_data_length, __pyx_n_s_total_length, __pyx_n_s_values, __pyx_n_s_lengths, __pyx_n_s_encv, __pyx_n_s_b, __pyx_n_s_out, __pyx_n_s_data); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 210, __pyx_L1_error) + __pyx_tuple__38 = PyTuple_Pack(13, __pyx_n_s_self, __pyx_n_s_buf, __pyx_n_s_i, __pyx_n_s_l, __pyx_n_s_n_items, __pyx_n_s_data_length, __pyx_n_s_total_length, __pyx_n_s_values, __pyx_n_s_lengths, __pyx_n_s_encv, __pyx_n_s_b, __pyx_n_s_out, __pyx_n_s_data); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__38); __Pyx_GIVEREF(__pyx_tuple__38); - __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(2, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_vlen_pyx, __pyx_n_s_encode, 210, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 210, __pyx_L1_error) + __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(2, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_vlen_pyx, __pyx_n_s_encode, 212, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 212, __pyx_L1_error) - /* "numcodecs/vlen.pyx":263 + /* "numcodecs/vlen.pyx":265 * @cython.wraparound(False) * @cython.boundscheck(False) * def decode(self, buf, out=None): # <<<<<<<<<<<<<< * cdef: * Buffer input_buffer */ - __pyx_tuple__40 = PyTuple_Pack(11, __pyx_n_s_self, __pyx_n_s_buf, __pyx_n_s_out, __pyx_n_s_input_buffer, __pyx_n_s_data, __pyx_n_s_data_end, __pyx_n_s_i, __pyx_n_s_l, __pyx_n_s_n_items, __pyx_n_s_data_length, __pyx_n_s_input_length); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 263, __pyx_L1_error) + __pyx_tuple__40 = PyTuple_Pack(11, __pyx_n_s_self, __pyx_n_s_buf, __pyx_n_s_out, __pyx_n_s_input_buffer, __pyx_n_s_data, __pyx_n_s_data_end, __pyx_n_s_i, __pyx_n_s_l, __pyx_n_s_n_items, __pyx_n_s_data_length, __pyx_n_s_input_length); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 265, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__40); __Pyx_GIVEREF(__pyx_tuple__40); - __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(3, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_vlen_pyx, __pyx_n_s_decode, 263, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 263, __pyx_L1_error) - __pyx_tuple__42 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 263, __pyx_L1_error) + __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(3, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_vlen_pyx, __pyx_n_s_decode, 265, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 265, __pyx_L1_error) + __pyx_tuple__42 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 265, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__42); __Pyx_GIVEREF(__pyx_tuple__42); - /* "numcodecs/vlen.pyx":333 + /* "numcodecs/vlen.pyx":336 * codec_id = 'vlen-array' * * def __init__(self, dtype): # <<<<<<<<<<<<<< * self.dtype = np.dtype(dtype) * */ - __pyx_tuple__43 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_dtype); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 333, __pyx_L1_error) + __pyx_tuple__43 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_dtype); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 336, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__43); __Pyx_GIVEREF(__pyx_tuple__43); - __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_vlen_pyx, __pyx_n_s_init, 333, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 333, __pyx_L1_error) + __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_vlen_pyx, __pyx_n_s_init, 336, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 336, __pyx_L1_error) - /* "numcodecs/vlen.pyx":336 + /* "numcodecs/vlen.pyx":339 * self.dtype = np.dtype(dtype) * * def get_config(self): # <<<<<<<<<<<<<< * config = dict() * config['id'] = self.codec_id */ - __pyx_tuple__45 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_config); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 336, __pyx_L1_error) + __pyx_tuple__45 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_config); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 339, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__45); __Pyx_GIVEREF(__pyx_tuple__45); - __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_vlen_pyx, __pyx_n_s_get_config, 336, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(0, 336, __pyx_L1_error) + __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_vlen_pyx, __pyx_n_s_get_config, 339, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(0, 339, __pyx_L1_error) - /* "numcodecs/vlen.pyx":342 + /* "numcodecs/vlen.pyx":345 * return config * * def __repr__(self): # <<<<<<<<<<<<<< * return '%s(dtype=%r)' % (type(self).__name__, self.dtype.str,) * */ - __pyx_tuple__47 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 342, __pyx_L1_error) + __pyx_tuple__47 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 345, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__47); __Pyx_GIVEREF(__pyx_tuple__47); - __pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_vlen_pyx, __pyx_n_s_repr, 342, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) __PYX_ERR(0, 342, __pyx_L1_error) + __pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_vlen_pyx, __pyx_n_s_repr, 345, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) __PYX_ERR(0, 345, __pyx_L1_error) - /* "numcodecs/vlen.pyx":347 + /* "numcodecs/vlen.pyx":350 * @cython.wraparound(False) * @cython.boundscheck(False) * def encode(self, buf): # <<<<<<<<<<<<<< * cdef: * Py_ssize_t i, l, n_items, data_length, total_length */ - __pyx_tuple__49 = PyTuple_Pack(16, __pyx_n_s_self, __pyx_n_s_buf, __pyx_n_s_i, __pyx_n_s_l, __pyx_n_s_n_items, __pyx_n_s_data_length, __pyx_n_s_total_length, __pyx_n_s_values, __pyx_n_s_normed_values, __pyx_n_s_lengths, __pyx_n_s_encv, __pyx_n_s_b, __pyx_n_s_out, __pyx_n_s_data, __pyx_n_s_value_buffer, __pyx_n_s_v); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 347, __pyx_L1_error) + __pyx_tuple__49 = PyTuple_Pack(16, __pyx_n_s_self, __pyx_n_s_buf, __pyx_n_s_i, __pyx_n_s_l, __pyx_n_s_n_items, __pyx_n_s_data_length, __pyx_n_s_total_length, __pyx_n_s_values, __pyx_n_s_normed_values, __pyx_n_s_lengths, __pyx_n_s_encv, __pyx_n_s_b, __pyx_n_s_out, __pyx_n_s_data, __pyx_n_s_value_buffer, __pyx_n_s_v); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 350, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__49); __Pyx_GIVEREF(__pyx_tuple__49); - __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(2, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_vlen_pyx, __pyx_n_s_encode, 347, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(0, 347, __pyx_L1_error) + __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(2, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_vlen_pyx, __pyx_n_s_encode, 350, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(0, 350, __pyx_L1_error) - /* "numcodecs/vlen.pyx":409 + /* "numcodecs/vlen.pyx":412 * @cython.wraparound(False) * @cython.boundscheck(False) * def decode(self, buf, out=None): # <<<<<<<<<<<<<< * cdef: * Buffer input_buffer */ - __pyx_tuple__51 = PyTuple_Pack(11, __pyx_n_s_self, __pyx_n_s_buf, __pyx_n_s_out, __pyx_n_s_input_buffer, __pyx_n_s_data, __pyx_n_s_data_end, __pyx_n_s_i, __pyx_n_s_l, __pyx_n_s_n_items, __pyx_n_s_data_length, __pyx_n_s_input_length); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 409, __pyx_L1_error) + __pyx_tuple__51 = PyTuple_Pack(11, __pyx_n_s_self, __pyx_n_s_buf, __pyx_n_s_out, __pyx_n_s_input_buffer, __pyx_n_s_data, __pyx_n_s_data_end, __pyx_n_s_i, __pyx_n_s_l, __pyx_n_s_n_items, __pyx_n_s_data_length, __pyx_n_s_input_length); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 412, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__51); __Pyx_GIVEREF(__pyx_tuple__51); - __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(3, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_vlen_pyx, __pyx_n_s_decode, 409, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) __PYX_ERR(0, 409, __pyx_L1_error) - __pyx_tuple__53 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(0, 409, __pyx_L1_error) + __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(3, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_numcodecs_vlen_pyx, __pyx_n_s_decode, 412, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) __PYX_ERR(0, 412, __pyx_L1_error) + __pyx_tuple__53 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(0, 412, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__53); __Pyx_GIVEREF(__pyx_tuple__53); @@ -20982,8 +21075,8 @@ if (!__Pyx_RefNanny) { * from .abc import Codec * from .compat_ext cimport Buffer * from .compat_ext import Buffer # <<<<<<<<<<<<<< + * from .compat import ensure_contiguous_ndarray * from cpython cimport (PyBytes_GET_SIZE, PyBytes_AS_STRING, PyBytes_Check, - * PyBytes_FromStringAndSize, PyUnicode_AsUTF8String) */ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); @@ -20995,7 +21088,28 @@ if (!__Pyx_RefNanny) { __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/vlen.pyx":35 + /* "numcodecs/vlen.pyx":16 + * from .compat_ext cimport Buffer + * from .compat_ext import Buffer + * from .compat import ensure_contiguous_ndarray # <<<<<<<<<<<<<< + * from cpython cimport (PyBytes_GET_SIZE, PyBytes_AS_STRING, PyBytes_Check, + * PyBytes_FromStringAndSize, PyUnicode_AsUTF8String) + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_n_s_ensure_contiguous_ndarray); + __Pyx_GIVEREF(__pyx_n_s_ensure_contiguous_ndarray); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ensure_contiguous_ndarray); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_compat, __pyx_t_1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ensure_contiguous_ndarray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ensure_contiguous_ndarray, __pyx_t_1) < 0) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "numcodecs/vlen.pyx":36 * * # 4 bytes to store number of items * cdef Py_ssize_t HEADER_LENGTH = 4 # <<<<<<<<<<<<<< @@ -21004,291 +21118,291 @@ if (!__Pyx_RefNanny) { */ __pyx_v_9numcodecs_4vlen_HEADER_LENGTH = 4; - /* "numcodecs/vlen.pyx":38 + /* "numcodecs/vlen.pyx":39 * * * def check_out_param(out, n_items): # <<<<<<<<<<<<<< * if not isinstance(out, np.ndarray): * raise TypeError('out must be 1-dimensional array') */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_4vlen_1check_out_param, NULL, __pyx_n_s_numcodecs_vlen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_out_param, __pyx_t_1) < 0) __PYX_ERR(0, 38, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9numcodecs_4vlen_1check_out_param, NULL, __pyx_n_s_numcodecs_vlen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_out_param, __pyx_t_2) < 0) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/vlen.pyx":49 + /* "numcodecs/vlen.pyx":50 * * * class VLenUTF8(Codec): # <<<<<<<<<<<<<< * """Encode variable-length unicode string objects via UTF-8. * */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Codec); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Codec); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_VLenUTF8, __pyx_n_s_VLenUTF8, (PyObject *) NULL, __pyx_n_s_numcodecs_vlen, __pyx_kp_s_Encode_variable_length_unicode_s); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_VLenUTF8, __pyx_n_s_VLenUTF8, (PyObject *) NULL, __pyx_n_s_numcodecs_vlen, __pyx_kp_s_Encode_variable_length_unicode_s); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - /* "numcodecs/vlen.pyx":71 + /* "numcodecs/vlen.pyx":72 * """ * * codec_id = 'vlen-utf8' # <<<<<<<<<<<<<< * * def __init__(self): */ - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_codec_id, __pyx_kp_s_vlen_utf8) < 0) __PYX_ERR(0, 71, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_codec_id, __pyx_kp_s_vlen_utf8) < 0) __PYX_ERR(0, 72, __pyx_L1_error) - /* "numcodecs/vlen.pyx":73 + /* "numcodecs/vlen.pyx":74 * codec_id = 'vlen-utf8' * * def __init__(self): # <<<<<<<<<<<<<< * pass * */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_4vlen_8VLenUTF8_1__init__, 0, __pyx_n_s_VLenUTF8___init, NULL, __pyx_n_s_numcodecs_vlen, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 73, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_4vlen_8VLenUTF8_1__init__, 0, __pyx_n_s_VLenUTF8___init, NULL, __pyx_n_s_numcodecs_vlen, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_init, __pyx_t_4) < 0) __PYX_ERR(0, 73, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_init, __pyx_t_4) < 0) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "numcodecs/vlen.pyx":78 + /* "numcodecs/vlen.pyx":79 * @cython.wraparound(False) * @cython.boundscheck(False) * def encode(self, buf): # <<<<<<<<<<<<<< * cdef: * Py_ssize_t i, l, n_items, data_length, total_length */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_4vlen_8VLenUTF8_3encode, 0, __pyx_n_s_VLenUTF8_encode, NULL, __pyx_n_s_numcodecs_vlen, __pyx_d, ((PyObject *)__pyx_codeobj__32)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_4vlen_8VLenUTF8_3encode, 0, __pyx_n_s_VLenUTF8_encode, NULL, __pyx_n_s_numcodecs_vlen, __pyx_d, ((PyObject *)__pyx_codeobj__32)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_encode, __pyx_t_4) < 0) __PYX_ERR(0, 78, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_encode, __pyx_t_4) < 0) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "numcodecs/vlen.pyx":136 + /* "numcodecs/vlen.pyx":137 * @cython.wraparound(False) * @cython.boundscheck(False) * def decode(self, buf, out=None): # <<<<<<<<<<<<<< * cdef: * Buffer input_buffer */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_4vlen_8VLenUTF8_5decode, 0, __pyx_n_s_VLenUTF8_decode, NULL, __pyx_n_s_numcodecs_vlen, __pyx_d, ((PyObject *)__pyx_codeobj__34)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 136, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_4vlen_8VLenUTF8_5decode, 0, __pyx_n_s_VLenUTF8_decode, NULL, __pyx_n_s_numcodecs_vlen, __pyx_d, ((PyObject *)__pyx_codeobj__34)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 137, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__35); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_decode, __pyx_t_4) < 0) __PYX_ERR(0, 136, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_decode, __pyx_t_4) < 0) __PYX_ERR(0, 137, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "numcodecs/vlen.pyx":49 + /* "numcodecs/vlen.pyx":50 * * * class VLenUTF8(Codec): # <<<<<<<<<<<<<< * """Encode variable-length unicode string objects via UTF-8. * */ - __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_VLenUTF8, __pyx_t_2, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 49, __pyx_L1_error) + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_VLenUTF8, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_VLenUTF8, __pyx_t_4) < 0) __PYX_ERR(0, 49, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_VLenUTF8, __pyx_t_4) < 0) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numcodecs/vlen.pyx":181 + /* "numcodecs/vlen.pyx":183 * * * class VLenBytes(Codec): # <<<<<<<<<<<<<< * """Encode variable-length byte string objects. * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Codec); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 181, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Codec); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 181, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_VLenBytes, __pyx_n_s_VLenBytes, (PyObject *) NULL, __pyx_n_s_numcodecs_vlen, __pyx_kp_s_Encode_variable_length_byte_stri); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 181, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_VLenBytes, __pyx_n_s_VLenBytes, (PyObject *) NULL, __pyx_n_s_numcodecs_vlen, __pyx_kp_s_Encode_variable_length_byte_stri); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - /* "numcodecs/vlen.pyx":203 + /* "numcodecs/vlen.pyx":205 * """ * * codec_id = 'vlen-bytes' # <<<<<<<<<<<<<< * * def __init__(self): */ - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_codec_id, __pyx_kp_s_vlen_bytes) < 0) __PYX_ERR(0, 203, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_codec_id, __pyx_kp_s_vlen_bytes) < 0) __PYX_ERR(0, 205, __pyx_L1_error) - /* "numcodecs/vlen.pyx":205 + /* "numcodecs/vlen.pyx":207 * codec_id = 'vlen-bytes' * * def __init__(self): # <<<<<<<<<<<<<< * pass * */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_4vlen_9VLenBytes_1__init__, 0, __pyx_n_s_VLenBytes___init, NULL, __pyx_n_s_numcodecs_vlen, __pyx_d, ((PyObject *)__pyx_codeobj__37)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 205, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_4vlen_9VLenBytes_1__init__, 0, __pyx_n_s_VLenBytes___init, NULL, __pyx_n_s_numcodecs_vlen, __pyx_d, ((PyObject *)__pyx_codeobj__37)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_init, __pyx_t_4) < 0) __PYX_ERR(0, 205, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_init, __pyx_t_4) < 0) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "numcodecs/vlen.pyx":210 + /* "numcodecs/vlen.pyx":212 * @cython.wraparound(False) * @cython.boundscheck(False) * def encode(self, buf): # <<<<<<<<<<<<<< * cdef: * Py_ssize_t i, l, n_items, data_length, total_length */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_4vlen_9VLenBytes_3encode, 0, __pyx_n_s_VLenBytes_encode, NULL, __pyx_n_s_numcodecs_vlen, __pyx_d, ((PyObject *)__pyx_codeobj__39)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 210, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_4vlen_9VLenBytes_3encode, 0, __pyx_n_s_VLenBytes_encode, NULL, __pyx_n_s_numcodecs_vlen, __pyx_d, ((PyObject *)__pyx_codeobj__39)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_encode, __pyx_t_4) < 0) __PYX_ERR(0, 210, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_encode, __pyx_t_4) < 0) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "numcodecs/vlen.pyx":263 + /* "numcodecs/vlen.pyx":265 * @cython.wraparound(False) * @cython.boundscheck(False) * def decode(self, buf, out=None): # <<<<<<<<<<<<<< * cdef: * Buffer input_buffer */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_4vlen_9VLenBytes_5decode, 0, __pyx_n_s_VLenBytes_decode, NULL, __pyx_n_s_numcodecs_vlen, __pyx_d, ((PyObject *)__pyx_codeobj__41)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 263, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_4vlen_9VLenBytes_5decode, 0, __pyx_n_s_VLenBytes_decode, NULL, __pyx_n_s_numcodecs_vlen, __pyx_d, ((PyObject *)__pyx_codeobj__41)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 265, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__42); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_decode, __pyx_t_4) < 0) __PYX_ERR(0, 263, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_decode, __pyx_t_4) < 0) __PYX_ERR(0, 265, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "numcodecs/vlen.pyx":181 + /* "numcodecs/vlen.pyx":183 * * * class VLenBytes(Codec): # <<<<<<<<<<<<<< * """Encode variable-length byte string objects. * */ - __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_VLenBytes, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 181, __pyx_L1_error) + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_VLenBytes, __pyx_t_2, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_VLenBytes, __pyx_t_4) < 0) __PYX_ERR(0, 181, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_VLenBytes, __pyx_t_4) < 0) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numcodecs/vlen.pyx":308 + /* "numcodecs/vlen.pyx":311 * * * class VLenArray(Codec): # <<<<<<<<<<<<<< * """Encode variable-length 1-dimensional arrays via UTF-8. * */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Codec); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 308, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Codec); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 311, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 308, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 311, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_VLenArray, __pyx_n_s_VLenArray, (PyObject *) NULL, __pyx_n_s_numcodecs_vlen, __pyx_kp_s_Encode_variable_length_1_dimensi); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 308, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 311, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_VLenArray, __pyx_n_s_VLenArray, (PyObject *) NULL, __pyx_n_s_numcodecs_vlen, __pyx_kp_s_Encode_variable_length_1_dimensi); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 311, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - /* "numcodecs/vlen.pyx":331 + /* "numcodecs/vlen.pyx":334 * """ * * codec_id = 'vlen-array' # <<<<<<<<<<<<<< * * def __init__(self, dtype): */ - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_codec_id, __pyx_kp_s_vlen_array) < 0) __PYX_ERR(0, 331, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_codec_id, __pyx_kp_s_vlen_array) < 0) __PYX_ERR(0, 334, __pyx_L1_error) - /* "numcodecs/vlen.pyx":333 + /* "numcodecs/vlen.pyx":336 * codec_id = 'vlen-array' * * def __init__(self, dtype): # <<<<<<<<<<<<<< * self.dtype = np.dtype(dtype) * */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_4vlen_9VLenArray_1__init__, 0, __pyx_n_s_VLenArray___init, NULL, __pyx_n_s_numcodecs_vlen, __pyx_d, ((PyObject *)__pyx_codeobj__44)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 333, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_4vlen_9VLenArray_1__init__, 0, __pyx_n_s_VLenArray___init, NULL, __pyx_n_s_numcodecs_vlen, __pyx_d, ((PyObject *)__pyx_codeobj__44)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 336, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_init, __pyx_t_4) < 0) __PYX_ERR(0, 333, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_init, __pyx_t_4) < 0) __PYX_ERR(0, 336, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "numcodecs/vlen.pyx":336 + /* "numcodecs/vlen.pyx":339 * self.dtype = np.dtype(dtype) * * def get_config(self): # <<<<<<<<<<<<<< * config = dict() * config['id'] = self.codec_id */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_4vlen_9VLenArray_3get_config, 0, __pyx_n_s_VLenArray_get_config, NULL, __pyx_n_s_numcodecs_vlen, __pyx_d, ((PyObject *)__pyx_codeobj__46)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 336, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_4vlen_9VLenArray_3get_config, 0, __pyx_n_s_VLenArray_get_config, NULL, __pyx_n_s_numcodecs_vlen, __pyx_d, ((PyObject *)__pyx_codeobj__46)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 339, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_get_config, __pyx_t_4) < 0) __PYX_ERR(0, 336, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_get_config, __pyx_t_4) < 0) __PYX_ERR(0, 339, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "numcodecs/vlen.pyx":342 + /* "numcodecs/vlen.pyx":345 * return config * * def __repr__(self): # <<<<<<<<<<<<<< * return '%s(dtype=%r)' % (type(self).__name__, self.dtype.str,) * */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_4vlen_9VLenArray_5__repr__, 0, __pyx_n_s_VLenArray___repr, NULL, __pyx_n_s_numcodecs_vlen, __pyx_d, ((PyObject *)__pyx_codeobj__48)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 342, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_4vlen_9VLenArray_5__repr__, 0, __pyx_n_s_VLenArray___repr, NULL, __pyx_n_s_numcodecs_vlen, __pyx_d, ((PyObject *)__pyx_codeobj__48)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 345, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_repr, __pyx_t_4) < 0) __PYX_ERR(0, 342, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_repr, __pyx_t_4) < 0) __PYX_ERR(0, 345, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "numcodecs/vlen.pyx":347 + /* "numcodecs/vlen.pyx":350 * @cython.wraparound(False) * @cython.boundscheck(False) * def encode(self, buf): # <<<<<<<<<<<<<< * cdef: * Py_ssize_t i, l, n_items, data_length, total_length */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_4vlen_9VLenArray_7encode, 0, __pyx_n_s_VLenArray_encode, NULL, __pyx_n_s_numcodecs_vlen, __pyx_d, ((PyObject *)__pyx_codeobj__50)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 347, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_4vlen_9VLenArray_7encode, 0, __pyx_n_s_VLenArray_encode, NULL, __pyx_n_s_numcodecs_vlen, __pyx_d, ((PyObject *)__pyx_codeobj__50)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 350, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_encode, __pyx_t_4) < 0) __PYX_ERR(0, 347, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_encode, __pyx_t_4) < 0) __PYX_ERR(0, 350, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "numcodecs/vlen.pyx":409 + /* "numcodecs/vlen.pyx":412 * @cython.wraparound(False) * @cython.boundscheck(False) * def decode(self, buf, out=None): # <<<<<<<<<<<<<< * cdef: * Buffer input_buffer */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_4vlen_9VLenArray_9decode, 0, __pyx_n_s_VLenArray_decode, NULL, __pyx_n_s_numcodecs_vlen, __pyx_d, ((PyObject *)__pyx_codeobj__52)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 409, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9numcodecs_4vlen_9VLenArray_9decode, 0, __pyx_n_s_VLenArray_decode, NULL, __pyx_n_s_numcodecs_vlen, __pyx_d, ((PyObject *)__pyx_codeobj__52)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 412, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__53); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_decode, __pyx_t_4) < 0) __PYX_ERR(0, 409, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_decode, __pyx_t_4) < 0) __PYX_ERR(0, 412, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "numcodecs/vlen.pyx":308 + /* "numcodecs/vlen.pyx":311 * * * class VLenArray(Codec): # <<<<<<<<<<<<<< * """Encode variable-length 1-dimensional arrays via UTF-8. * */ - __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_VLenArray, __pyx_t_2, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 308, __pyx_L1_error) + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_VLenArray, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 311, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_VLenArray, __pyx_t_4) < 0) __PYX_ERR(0, 308, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_VLenArray, __pyx_t_4) < 0) __PYX_ERR(0, 311, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "numcodecs/vlen.pyx":1 * # -*- coding: utf-8 -*- # <<<<<<<<<<<<<< * # cython: embedsignature=True * # cython: profile=False */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "View.MemoryView":208 * info.obj = self @@ -21297,10 +21411,10 @@ if (!__Pyx_RefNanny) { * * def __dealloc__(array self): */ - __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 208, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(1, 208, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 208, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(1, 208, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_array_type); /* "View.MemoryView":285 @@ -21310,12 +21424,12 @@ if (!__Pyx_RefNanny) { * cdef strided = Enum("") # default * cdef indirect = Enum("") */ - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__54, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 285, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__54, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 285, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(generic); - __Pyx_DECREF_SET(generic, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; + __Pyx_DECREF_SET(generic, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; /* "View.MemoryView":286 * @@ -21324,12 +21438,12 @@ if (!__Pyx_RefNanny) { * cdef indirect = Enum("") * */ - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__55, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 286, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__55, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 286, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(strided); - __Pyx_DECREF_SET(strided, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; + __Pyx_DECREF_SET(strided, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; /* "View.MemoryView":287 * cdef generic = Enum("") @@ -21338,12 +21452,12 @@ if (!__Pyx_RefNanny) { * * */ - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__56, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 287, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__56, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 287, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(indirect); - __Pyx_DECREF_SET(indirect, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; + __Pyx_DECREF_SET(indirect, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; /* "View.MemoryView":290 * @@ -21352,12 +21466,12 @@ if (!__Pyx_RefNanny) { * cdef indirect_contiguous = Enum("") * */ - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__57, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 290, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__57, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 290, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(contiguous); - __Pyx_DECREF_SET(contiguous, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; + __Pyx_DECREF_SET(contiguous, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; /* "View.MemoryView":291 * @@ -21366,12 +21480,12 @@ if (!__Pyx_RefNanny) { * * */ - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 291, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 291, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(indirect_contiguous); - __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; + __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; /* "View.MemoryView":315 * @@ -21406,10 +21520,10 @@ if (!__Pyx_RefNanny) { * * */ - __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 544, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(1, 544, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 544, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(1, 544, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_memoryview_type); /* "View.MemoryView":990 @@ -21419,10 +21533,10 @@ if (!__Pyx_RefNanny) { * * */ - __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 990, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(1, 990, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 990, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(1, 990, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_memoryviewslice_type); /* "(tree fragment)":1 @@ -21430,10 +21544,10 @@ if (!__Pyx_RefNanny) { * if __pyx_checksum != 0xb068931: * from pickle import PickleError as __pyx_PickleError */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_2) < 0) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "(tree fragment)":9 * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) @@ -22390,6 +22504,35 @@ static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice, } } +/* PyObjectCall2Args */ +static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { + PyObject *args, *result = NULL; + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(function)) { + PyObject *args[2] = {arg1, arg2}; + return __Pyx_PyFunction_FastCall(function, args, 2); + } + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(function)) { + PyObject *args[2] = {arg1, arg2}; + return __Pyx_PyCFunction_FastCall(function, args, 2); + } + #endif + args = PyTuple_New(2); + if (unlikely(!args)) goto done; + Py_INCREF(arg1); + PyTuple_SET_ITEM(args, 0, arg1); + Py_INCREF(arg2); + PyTuple_SET_ITEM(args, 1, arg2); + Py_INCREF(function); + result = __Pyx_PyObject_Call(function, args, NULL); + Py_DECREF(args); + Py_DECREF(function); +done: + return result; +} + /* SetItemInt */ static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { int r; @@ -22439,35 +22582,6 @@ static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObje return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); } -/* PyObjectCall2Args */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { - PyObject *args, *result = NULL; - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyFunction_FastCall(function, args, 2); - } - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyCFunction_FastCall(function, args, 2); - } - #endif - args = PyTuple_New(2); - if (unlikely(!args)) goto done; - Py_INCREF(arg1); - PyTuple_SET_ITEM(args, 0, arg1); - Py_INCREF(arg2); - PyTuple_SET_ITEM(args, 1, arg2); - Py_INCREF(function); - result = __Pyx_PyObject_Call(function, args, NULL); - Py_DECREF(args); - Py_DECREF(function); -done: - return result; -} - /* PyObjectSetAttrStr */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { diff --git a/numcodecs/vlen.pyx b/numcodecs/vlen.pyx index 26a4deea..2e838eb9 100644 --- a/numcodecs/vlen.pyx +++ b/numcodecs/vlen.pyx @@ -13,6 +13,7 @@ import numpy as np from .abc import Codec from .compat_ext cimport Buffer from .compat_ext import Buffer +from .compat import ensure_contiguous_ndarray from cpython cimport (PyBytes_GET_SIZE, PyBytes_AS_STRING, PyBytes_Check, PyBytes_FromStringAndSize, PyUnicode_AsUTF8String) from cpython.buffer cimport PyBUF_ANY_CONTIGUOUS @@ -141,6 +142,7 @@ class VLenUTF8(Codec): Py_ssize_t i, l, n_items, data_length, input_length # accept any buffer + buf = ensure_contiguous_ndarray(buf) input_buffer = Buffer(buf, PyBUF_ANY_CONTIGUOUS) input_length = input_buffer.nbytes @@ -268,6 +270,7 @@ class VLenBytes(Codec): Py_ssize_t i, l, n_items, data_length, input_length # accept any buffer + buf = ensure_contiguous_ndarray(buf) input_buffer = Buffer(buf, PyBUF_ANY_CONTIGUOUS) input_length = input_buffer.nbytes @@ -414,6 +417,7 @@ class VLenArray(Codec): Py_ssize_t i, l, n_items, data_length, input_length # accept any buffer + buf = ensure_contiguous_ndarray(buf) input_buffer = Buffer(buf, PyBUF_ANY_CONTIGUOUS) input_length = input_buffer.nbytes From d5a526780ea97e171073bd18bd590d0ff7c4dbb8 Mon Sep 17 00:00:00 2001 From: Alistair Miles Date: Thu, 29 Nov 2018 12:35:22 +0000 Subject: [PATCH 7/7] release notes [ci skip] --- docs/release.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/release.rst b/docs/release.rst index ee9a2283..e4e31ef0 100644 --- a/docs/release.rst +++ b/docs/release.rst @@ -40,6 +40,11 @@ Release notes some codecs, and also simplifies the implementation of some codecs, improving code readability and maintainability. By :user:`John Kirkham ` and :user:`Alistair Miles `; :issue:`119`, :issue:`121`, :issue:`128`. + +* Improvements to handling of errors in the :class:`numcodecs.blosc.Blosc` and + :class:`numcodecs.lz4.LZ4` codecs when the maximum allowed size of an input + buffer is exceeded. By :user:`Jerome Kelleher `, :issue:`80`, + :issue:`81`. .. _release_0.5.5: