diff --git a/src/spavro/fast_binary.c b/src/spavro/fast_binary.c index d7048e1..d4ac3d5 100644 --- a/src/spavro/fast_binary.c +++ b/src/spavro/fast_binary.c @@ -1,8 +1,9 @@ -/* Generated by Cython 0.29.6 */ +/* Generated by Cython 0.29.34 */ /* BEGIN: Cython Metadata { "distutils": { + "depends": [], "name": "spavro.fast_binary", "sources": [ "src/spavro/fast_binary.pyx" @@ -12,15 +13,17 @@ } END: Cython Metadata */ +#ifndef PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN +#endif /* PY_SSIZE_T_CLEAN */ #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #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_6" -#define CYTHON_HEX_VERSION 0x001D06F0 +#define CYTHON_ABI "0_29_34" +#define CYTHON_HEX_VERSION 0x001D22F0 #define CYTHON_FUTURE_DIVISION 0 #include #ifndef offsetof @@ -59,6 +62,7 @@ END: Cython Metadata */ #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_NOGIL 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 #undef CYTHON_USE_PYTYPE_LOOKUP @@ -95,10 +99,14 @@ END: Cython Metadata */ #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif #elif defined(PYSTON_VERSION) #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 1 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_NOGIL 0 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif @@ -136,10 +144,59 @@ END: Cython Metadata */ #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif +#elif defined(PY_NOGIL) + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_PYSTON 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_NOGIL 1 + #ifndef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #endif + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #ifndef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 1 + #endif + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #ifndef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 1 + #endif + #ifndef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 1 + #endif + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 1 + #define CYTHON_COMPILING_IN_NOGIL 0 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif @@ -159,7 +216,7 @@ END: Cython Metadata */ #undef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 0 #elif !defined(CYTHON_USE_PYLONG_INTERNALS) - #define CYTHON_USE_PYLONG_INTERNALS 1 + #define CYTHON_USE_PYLONG_INTERNALS (PY_VERSION_HEX < 0x030C00A5) #endif #ifndef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 1 @@ -167,7 +224,7 @@ END: Cython Metadata */ #ifndef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 1 #endif - #if PY_VERSION_HEX < 0x030300F0 + #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2 #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #elif !defined(CYTHON_USE_UNICODE_WRITER) @@ -182,11 +239,14 @@ END: Cython Metadata */ #ifndef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 1 #endif - #ifndef CYTHON_FAST_THREAD_STATE + #if PY_VERSION_HEX >= 0x030B00A4 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #elif !defined(CYTHON_FAST_THREAD_STATE) #define CYTHON_FAST_THREAD_STATE 1 #endif #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 1 + #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030A0000) #endif #ifndef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) @@ -195,17 +255,25 @@ END: Cython Metadata */ #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) #endif #ifndef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1) + #define CYTHON_USE_DICT_VERSIONS ((PY_VERSION_HEX >= 0x030600B1) && (PY_VERSION_HEX < 0x030C00A5)) #endif - #ifndef CYTHON_USE_EXC_INFO_STACK + #if PY_VERSION_HEX >= 0x030B00A4 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #elif !defined(CYTHON_USE_EXC_INFO_STACK) #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3) #endif + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 + #endif #endif #if !defined(CYTHON_FAST_PYCCALL) #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif #if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" + #if PY_MAJOR_VERSION < 3 + #include "longintrepr.h" + #endif #undef SHIFT #undef BASE #undef MASK @@ -322,8 +390,72 @@ END: Cython Metadata */ #define __Pyx_DefaultClassType PyClass_Type #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_DefaultClassType PyType_Type +#if PY_VERSION_HEX >= 0x030B00A1 + static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; + PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL; + const char *fn_cstr=NULL; + const char *name_cstr=NULL; + PyCodeObject* co=NULL; + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + if (!(kwds=PyDict_New())) goto end; + if (!(argcount=PyLong_FromLong(a))) goto end; + if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end; + if (!(posonlyargcount=PyLong_FromLong(0))) goto end; + if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end; + if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; + if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end; + if (!(nlocals=PyLong_FromLong(l))) goto end; + if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end; + if (!(stacksize=PyLong_FromLong(s))) goto end; + if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end; + if (!(flags=PyLong_FromLong(f))) goto end; + if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end; + if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; + if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; + if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; + if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too; + if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here + if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too; + Py_XDECREF((PyObject*)co); + co = (PyCodeObject*)call_result; + call_result = NULL; + if (0) { + cleanup_code_too: + Py_XDECREF((PyObject*)co); + co = NULL; + } + end: + Py_XDECREF(kwds); + Py_XDECREF(argcount); + Py_XDECREF(posonlyargcount); + Py_XDECREF(kwonlyargcount); + Py_XDECREF(nlocals); + Py_XDECREF(stacksize); + Py_XDECREF(replace); + Py_XDECREF(call_result); + Py_XDECREF(empty); + if (type) { + PyErr_Restore(type, value, traceback); + } + return co; + } +#else #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif #define __Pyx_DefaultClassType PyType_Type #endif #ifndef Py_TPFLAGS_CHECKTYPES @@ -433,8 +565,12 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 - #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ - 0 : _PyUnicode_Ready((PyObject *)(op))) + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_READY(op) (0) + #else + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #endif #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) @@ -442,7 +578,15 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) + #else + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) + #else + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) + #endif + #endif #else #define CYTHON_PEP393_ENABLED 0 #define PyUnicode_1BYTE_KIND 1 @@ -491,8 +635,10 @@ 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 +#ifndef PyObject_Unicode #define PyObject_Unicode PyObject_Str #endif +#endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) @@ -503,6 +649,13 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif +#if PY_VERSION_HEX >= 0x030900A4 + #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) + #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size) +#else + #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt) + #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) +#endif #if CYTHON_ASSUME_SAFE_MACROS #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) #else @@ -536,13 +689,13 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #if PY_VERSION_HEX < 0x030200A4 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t PyInt_AsLong + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t #endif #if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func)) + #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func)) #else #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) #endif @@ -564,8 +717,10 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { } __Pyx_PyAsyncMethodsStruct; #endif -#if defined(WIN32) || defined(MS_WINDOWS) - #define _USE_MATH_DEFINES +#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) + #if !defined(_USE_MATH_DEFINES) + #define _USE_MATH_DEFINES + #endif #endif #include #ifdef NAN @@ -583,11 +738,10 @@ static CYTHON_INLINE float __PYX_NAN() { #define __Pyx_truncl truncl #endif - +#define __PYX_MARK_ERR_POS(f_index, lineno) \ + { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; } #define __PYX_ERR(f_index, lineno, Ln_error) \ -{ \ - __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ -} + { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } #ifndef __PYX_EXTERN_C #ifdef __cplusplus @@ -600,6 +754,8 @@ static CYTHON_INLINE float __PYX_NAN() { #define __PYX_HAVE__spavro__fast_binary #define __PYX_HAVE_API__spavro__fast_binary /* Early includes */ +#include +#include #ifdef _OPENMP #include #endif /* _OPENMP */ @@ -696,6 +852,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #if CYTHON_ASSUME_SAFE_MACROS #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else @@ -809,10 +966,16 @@ static const char *__pyx_filename; static const char *__pyx_f[] = { "src/spavro/fast_binary.pyx", + "array.pxd", "stringsource", + "type.pxd", }; /*--- Type declarations ---*/ +#ifndef _ARRAYARRAY_H +struct arrayobject; +typedef struct arrayobject arrayobject; +#endif struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct__make_union_reader; struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader; struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader; @@ -829,15 +992,6 @@ struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check; struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check; struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union; struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer; -struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer; -struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer; -struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer; -struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer; -struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer; -struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer; -struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer; -struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer; -struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer; struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py; struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object___to_py; struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py; @@ -846,11 +1000,8 @@ struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_double____object___to_py; struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py; struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py; struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_float____object___to_py; -struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____object___to_py; -struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____float___to_py; -struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____double___to_py; -/* "spavro/fast_binary.pyx":103 +/* "spavro/fast_binary.pyx":106 * * * def make_union_reader(union_schema): # <<<<<<<<<<<<<< @@ -864,7 +1015,7 @@ struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct__make_union_reader { }; -/* "spavro/fast_binary.pyx":117 +/* "spavro/fast_binary.pyx":120 * * * def make_record_reader(schema): # <<<<<<<<<<<<<< @@ -879,7 +1030,7 @@ struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader { }; -/* "spavro/fast_binary.pyx":126 +/* "spavro/fast_binary.pyx":129 * * * def make_enum_reader(schema): # <<<<<<<<<<<<<< @@ -893,7 +1044,7 @@ struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader { }; -/* "spavro/fast_binary.pyx":134 +/* "spavro/fast_binary.pyx":137 * return enum_reader * * def make_array_reader(schema): # <<<<<<<<<<<<<< @@ -907,7 +1058,7 @@ struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader { }; -/* "spavro/fast_binary.pyx":151 +/* "spavro/fast_binary.pyx":154 * return array_reader * * def make_map_reader(schema): # <<<<<<<<<<<<<< @@ -921,7 +1072,7 @@ struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader { }; -/* "spavro/fast_binary.pyx":169 +/* "spavro/fast_binary.pyx":172 * return map_reader * * def make_fixed_reader(schema): # <<<<<<<<<<<<<< @@ -935,7 +1086,7 @@ struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader { }; -/* "spavro/fast_binary.pyx":199 +/* "spavro/fast_binary.pyx":202 * * * def make_skip_reader(schema): # <<<<<<<<<<<<<< @@ -949,7 +1100,7 @@ struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader { }; -/* "spavro/fast_binary.pyx":210 +/* "spavro/fast_binary.pyx":213 * * * def make_default_reader(schema): # <<<<<<<<<<<<<< @@ -963,7 +1114,7 @@ struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader }; -/* "spavro/fast_binary.pyx":366 +/* "spavro/fast_binary.pyx":485 * * * def make_record_check(schema): # <<<<<<<<<<<<<< @@ -976,7 +1127,7 @@ struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check { }; -/* "spavro/fast_binary.pyx":373 +/* "spavro/fast_binary.pyx":492 * * * def make_enum_check(schema): # <<<<<<<<<<<<<< @@ -989,7 +1140,7 @@ struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check { }; -/* "spavro/fast_binary.pyx":404 +/* "spavro/fast_binary.pyx":523 * return lambda datum: isinstance(datum, str) or isinstance(datum, bytes) * * def make_array_check(schema): # <<<<<<<<<<<<<< @@ -1002,7 +1153,7 @@ struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check { }; -/* "spavro/fast_binary.pyx":410 +/* "spavro/fast_binary.pyx":529 * return array_check * * def make_union_check(union_schema): # <<<<<<<<<<<<<< @@ -1015,7 +1166,7 @@ struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check { }; -/* "spavro/fast_binary.pyx":416 +/* "spavro/fast_binary.pyx":535 * return union_check * * def make_fixed_check(schema): # <<<<<<<<<<<<<< @@ -1028,7 +1179,7 @@ struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check { }; -/* "spavro/fast_binary.pyx":422 +/* "spavro/fast_binary.pyx":541 * return fixed_check * * def make_map_check(schema): # <<<<<<<<<<<<<< @@ -1041,7 +1192,7 @@ struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check { }; -/* "spavro/fast_binary.pyx":457 +/* "spavro/fast_binary.pyx":576 * * * cdef void create_promotions_for_union(dict writer_lookup_dict): # <<<<<<<<<<<<<< @@ -1054,7 +1205,7 @@ struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11f }; -/* "spavro/fast_binary.pyx":477 +/* "spavro/fast_binary.pyx":596 * * * def make_union_writer(union_schema): # <<<<<<<<<<<<<< @@ -1064,133 +1215,10 @@ struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11f struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer { PyObject_HEAD PyObject *__pyx_v_union_schema; - PyObject *__pyx_v_writer_lookup; PyObject *__pyx_v_writer_lookup_dict; }; -/* "spavro/fast_binary.pyx":561 - * return write_union - * - * def make_enum_writer(schema): # <<<<<<<<<<<<<< - * cdef list symbols = schema['symbols'] - * - */ -struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer { - PyObject_HEAD - PyObject *__pyx_v_schema; - PyObject *__pyx_v_symbols; -}; - - -/* "spavro/fast_binary.pyx":572 - * - * - * def make_record_writer(schema): # <<<<<<<<<<<<<< - * cdef list fields = [WriteField(field['name'], get_writer(field['type'])) for field in schema['fields']] - * - */ -struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer { - PyObject_HEAD - PyObject *__pyx_v_fields; - PyObject *__pyx_v_schema; -}; - - -/* "spavro/fast_binary.pyx":585 - * - * - * def make_array_writer(schema): # <<<<<<<<<<<<<< - * item_writer = get_writer(schema['items']) - * - */ -struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer { - PyObject_HEAD - PyObject *__pyx_v_item_writer; - PyObject *__pyx_v_schema; -}; - - -/* "spavro/fast_binary.pyx":599 - * - * - * def make_map_writer(schema): # <<<<<<<<<<<<<< - * map_value_writer = get_writer(schema['values']) - * - */ -struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer { - PyObject_HEAD - PyObject *__pyx_v_map_value_writer; - PyObject *__pyx_v_schema; -}; - - -/* "spavro/fast_binary.pyx":614 - * - * - * def make_boolean_writer(schema): # <<<<<<<<<<<<<< - * '''Create a boolean writer, adds a validation step before the actual - * write function''' - */ -struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer { - PyObject_HEAD - PyObject *__pyx_v_schema; -}; - - -/* "spavro/fast_binary.pyx":624 - * - * - * def make_fixed_writer(schema): # <<<<<<<<<<<<<< - * '''A writer that must write X bytes defined by the schema''' - * cdef long size = schema['size'] - */ -struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer { - PyObject_HEAD - PyObject *__pyx_v_schema; - long __pyx_v_size; -}; - - -/* "spavro/fast_binary.pyx":636 - * - * - * def make_int_writer(schema): # <<<<<<<<<<<<<< - * '''Create a int writer, adds a validation step before the actual - * write function to make sure the int value doesn't overflow''' - */ -struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer { - PyObject_HEAD - PyObject *__pyx_v_schema; -}; - - -/* "spavro/fast_binary.pyx":648 - * - * - * def make_long_writer(schema): # <<<<<<<<<<<<<< - * '''Create a long writer, adds a validation step before the actual - * write function to make sure the long value doesn't overflow''' - */ -struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer { - PyObject_HEAD - PyObject *__pyx_v_schema; -}; - - -/* "spavro/fast_binary.pyx":659 - * - * - * def make_string_writer(schema): # <<<<<<<<<<<<<< - * def checked_string_writer(outbuf, datum): - * if not isinstance(datum, six.string_types): - */ -struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer { - PyObject_HEAD - PyObject *__pyx_v_schema; -}; - - /* "cfunc.to_py":64 * * @cname("__Pyx_CFunc_void____object____long__long___to_py") @@ -1238,21 +1266,6 @@ struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_float____object___to_py { float (*__pyx_v_f)(PyObject *); }; -struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____object___to_py { - PyObject_HEAD - void (*__pyx_v_f)(PyObject *, PyObject *); -}; - -struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____float___to_py { - PyObject_HEAD - void (*__pyx_v_f)(PyObject *, float); -}; - -struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____double___to_py { - PyObject_HEAD - void (*__pyx_v_f)(PyObject *, double); -}; - /* --- Runtime support code (head) --- */ /* Refnanny.proto */ @@ -1340,7 +1353,7 @@ static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObje #define __Pyx_PyFunction_FastCall(func, args, nargs)\ __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) #if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs); +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); #else #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) #endif @@ -1349,13 +1362,21 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #ifndef Py_MEMBER_SIZE #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) #endif +#if CYTHON_FAST_PYCALL static size_t __pyx_pyframe_localsplus_offset = 0; #include "frameobject.h" +#if PY_VERSION_HEX >= 0x030b00a6 + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif #define __Pxy_PyFrame_Initialize_Offsets()\ ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) #define __Pyx_PyFrame_GetLocalsplus(frame)\ (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) +#endif // CYTHON_FAST_PYCALL #endif /* PyObjectCall.proto */ @@ -1525,18 +1546,18 @@ static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UIN /* GetModuleGlobalName.proto */ #if CYTHON_USE_DICT_VERSIONS -#define __Pyx_GetModuleGlobalName(var, name) {\ +#define __Pyx_GetModuleGlobalName(var, name) do {\ static PY_UINT64_T __pyx_dict_version = 0;\ static PyObject *__pyx_dict_cached_value = NULL;\ (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} -#define __Pyx_GetModuleGlobalNameUncached(var, name) {\ +} while(0) +#define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ PY_UINT64_T __pyx_dict_version;\ PyObject *__pyx_dict_cached_value;\ (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} +} while(0) static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); #else #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) @@ -1552,7 +1573,7 @@ static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { if (likely(L->allocated > len)) { Py_INCREF(x); PyList_SET_ITEM(list, len, x); - Py_SIZE(list) = len+1; + __Pyx_SET_SIZE(list, len + 1); return 0; } return PyList_Append(list, x); @@ -1564,7 +1585,7 @@ static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { /* FetchCommonType.proto */ static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); -/* CythonFunction.proto */ +/* CythonFunctionShared.proto */ #define __Pyx_CyFunction_USED 1 #define __Pyx_CYFUNCTION_STATICMETHOD 0x01 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 @@ -1592,6 +1613,7 @@ typedef struct { PyObject *func_classobj; void *defaults; int defaults_pyobjects; + size_t defaults_size; // used by FusedFunction for copying defaults int flags; PyObject *defaults_tuple; PyObject *defaults_kwdict; @@ -1600,9 +1622,7 @@ typedef struct { } __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, +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, int flags, PyObject* qualname, PyObject *self, PyObject *module, PyObject *globals, @@ -1618,6 +1638,13 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, PyObject *dict); static int __pyx_CyFunction_init(void); +/* CythonFunction.proto */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); + /* PyObjectSetAttrStr.proto */ #if CYTHON_USE_TYPE_SLOTS #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL) @@ -1644,7 +1671,7 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { Py_INCREF(x); PyList_SET_ITEM(list, len, x); - Py_SIZE(list) = len+1; + __Pyx_SET_SIZE(list, len + 1); return 0; } return PyList_Append(list, x); @@ -1696,24 +1723,6 @@ static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* s static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values); #endif -/* RaiseTooManyValuesToUnpack.proto */ -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); - -/* RaiseNeedMoreValuesToUnpack.proto */ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - -/* IterFinish.proto */ -static CYTHON_INLINE int __Pyx_IterFinish(void); - -/* UnpackItemEndCheck.proto */ -static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); - -/* PyDictContains.proto */ -static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, int eq) { - int result = PyDict_Contains(dict, item); - return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); -} - /* UnpackUnboundCMethod.proto */ typedef struct { PyObject *type; @@ -1731,11 +1740,8 @@ static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* #define __Pyx_CallUnboundCMethod1(cfunc, self, arg) __Pyx__CallUnboundCMethod1(cfunc, self, arg) #endif -/* ArgTypeTest.proto */ -#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ - ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ - __Pyx__ArgTypeTest(obj, type, name, exact)) -static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); +/* IterFinish.proto */ +static CYTHON_INLINE int __Pyx_IterFinish(void); /* PyObjectGetMethod.proto */ static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); @@ -1743,6 +1749,15 @@ static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **me /* PyObjectCallMethod0.proto */ static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); +/* RaiseNeedMoreValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +/* RaiseTooManyValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +/* UnpackItemEndCheck.proto */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); + /* RaiseNoneIterError.proto */ static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); @@ -1767,6 +1782,23 @@ static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos, PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict); +/* PyDictContains.proto */ +static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, int eq) { + int result = PyDict_Contains(dict, item); + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + +/* dict_getitem_default.proto */ +static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value); + +/* CallUnboundCMethod2.proto */ +static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2); +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1 +static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2); +#else +#define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2) __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2) +#endif + /* PyObject_GenericGetAttrNoDict.proto */ #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name); @@ -1774,6 +1806,25 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr #endif +/* TypeImport.proto */ +#ifndef __PYX_HAVE_RT_ImportType_proto +#define __PYX_HAVE_RT_ImportType_proto +#if __STDC_VERSION__ >= 201112L +#include +#endif +#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L +#define __PYX_GET_STRUCT_ALIGNMENT(s) alignof(s) +#else +#define __PYX_GET_STRUCT_ALIGNMENT(s) sizeof(void*) +#endif +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, size_t alignment, enum __Pyx_ImportType_CheckSize check_size); +#endif + /* Import.proto */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); @@ -1826,25 +1877,151 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PY_LONG_LONG(PY_LONG_LONG value); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); - -/* CIntFromPy.proto */ -static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_As_PY_LONG_LONG(PyObject *); - -/* CIntFromPy.proto */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); - -/* CIntFromPy.proto */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); - -/* CIntFromPy.proto */ -static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *); - -/* FastTypeChecks.proto */ +/* 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; + __Pyx_SET_SIZE(op, 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; + __Pyx_SET_SIZE(self, 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) { + __Pyx_SET_SIZE(self, 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; + __Pyx_SET_SIZE(self, n); + self->allocated = newsize; + return 0; +} +#endif + +/* GCCDiagnostics.proto */ +#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#define __Pyx_HAS_GCC_DIAGNOSTIC +#endif + +/* CIntFromPy.proto */ +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_As_PY_LONG_LONG(PyObject *); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PY_LONG_LONG(PY_LONG_LONG value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_char(char value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *); + +/* FastTypeChecks.proto */ #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); @@ -1864,6 +2041,31 @@ static int __Pyx_check_binary_version(void); static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); +/* Module declarations from 'libc.string' */ + +/* Module declarations from 'libc.stdio' */ + +/* Module declarations from '__builtin__' */ + +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; + +/* Module declarations from 'cpython.ref' */ + +/* Module declarations from 'cpython.exc' */ + +/* Module declarations from 'cpython.mem' */ + +/* Module declarations from 'array' */ + +/* Module declarations from 'cpython' */ + +/* Module declarations from 'cpython.object' */ + +/* 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 'spavro.fast_binary' */ static PyTypeObject *__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct__make_union_reader = 0; static PyTypeObject *__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader = 0; @@ -1881,15 +2083,6 @@ static PyTypeObject *__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_12_mak static PyTypeObject *__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check = 0; static PyTypeObject *__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union = 0; static PyTypeObject *__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer = 0; -static PyTypeObject *__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer = 0; -static PyTypeObject *__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer = 0; -static PyTypeObject *__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer = 0; -static PyTypeObject *__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer = 0; -static PyTypeObject *__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer = 0; -static PyTypeObject *__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer = 0; -static PyTypeObject *__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer = 0; -static PyTypeObject *__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer = 0; -static PyTypeObject *__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer = 0; static PyTypeObject *__pyx_ptype___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py = 0; static PyTypeObject *__pyx_ptype___pyx_scope_struct____Pyx_CFunc_object____object___to_py = 0; static PyTypeObject *__pyx_ptype___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py = 0; @@ -1898,9 +2091,6 @@ static PyTypeObject *__pyx_ptype___pyx_scope_struct____Pyx_CFunc_double____objec static PyTypeObject *__pyx_ptype___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py = 0; static PyTypeObject *__pyx_ptype___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py = 0; static PyTypeObject *__pyx_ptype___pyx_scope_struct____Pyx_CFunc_float____object___to_py = 0; -static PyTypeObject *__pyx_ptype___pyx_scope_struct____Pyx_CFunc_void____object____object___to_py = 0; -static PyTypeObject *__pyx_ptype___pyx_scope_struct____Pyx_CFunc_void____object____float___to_py = 0; -static PyTypeObject *__pyx_ptype___pyx_scope_struct____Pyx_CFunc_void____object____double___to_py = 0; static PY_LONG_LONG __pyx_f_6spavro_11fast_binary_read_long(PyObject *); /*proto*/ static PyObject *__pyx_f_6spavro_11fast_binary_read_bytes(PyObject *); /*proto*/ static PyObject *__pyx_f_6spavro_11fast_binary_read_null(PyObject *); /*proto*/ @@ -1914,10 +2104,22 @@ static void __pyx_f_6spavro_11fast_binary_write_bytes(PyObject *, PyObject *); / static void __pyx_f_6spavro_11fast_binary_write_utf8(PyObject *, PyObject *); /*proto*/ static void __pyx_f_6spavro_11fast_binary_write_float(PyObject *, float); /*proto*/ static void __pyx_f_6spavro_11fast_binary_write_double(PyObject *, double); /*proto*/ -static void __pyx_f_6spavro_11fast_binary_write_null(PyObject *, PyObject *); /*proto*/ -static void __pyx_f_6spavro_11fast_binary_write_fixed(PyObject *, PyObject *); /*proto*/ static PyObject *__pyx_f_6spavro_11fast_binary_write_boolean(PyObject *, char); /*proto*/ +static void __pyx_f_6spavro_11fast_binary_write_int_to_array(arrayobject *, PY_LONG_LONG); /*proto*/ +static void __pyx_f_6spavro_11fast_binary_write_long_to_array(arrayobject *, PY_LONG_LONG); /*proto*/ +static void __pyx_f_6spavro_11fast_binary_write_bytes_to_array(arrayobject *, PyObject *); /*proto*/ +static void __pyx_f_6spavro_11fast_binary_write_utf8_to_array(arrayobject *, PyObject *); /*proto*/ +static void __pyx_f_6spavro_11fast_binary_write_float_to_array(arrayobject *, float); /*proto*/ +static void __pyx_f_6spavro_11fast_binary_write_double_to_array(arrayobject *, double); /*proto*/ +static void __pyx_f_6spavro_11fast_binary_write_fixed_to_array(arrayobject *, PyObject *); /*proto*/ +static void __pyx_f_6spavro_11fast_binary_write_boolean_to_array(arrayobject *, char); /*proto*/ +static void __pyx_f_6spavro_11fast_binary_write_enum_to_array(arrayobject *, char, PyObject *); /*proto*/ +static void __pyx_f_6spavro_11fast_binary_write_array_to_array(arrayobject *, PyObject *, PyObject *); /*proto*/ +static void __pyx_f_6spavro_11fast_binary_write_map_to_array(arrayobject *, PyObject *, PyObject *); /*proto*/ static void __pyx_f_6spavro_11fast_binary_create_promotions_for_union(PyObject *); /*proto*/ +static void __pyx_f_6spavro_11fast_binary_write_union_to_array(arrayobject *, PyObject *, PyObject *); /*proto*/ +static void __pyx_f_6spavro_11fast_binary_write_record_to_array(arrayobject *, PyObject *, PyObject *); /*proto*/ +static void __pyx_f_6spavro_11fast_binary_execute(arrayobject *, PyObject *, PyObject *); /*proto*/ static PyObject *__Pyx_CFunc_void____object____long__long___to_py(void (*)(PyObject *, PY_LONG_LONG)); /*proto*/ static PyObject *__Pyx_CFunc_object____object___to_py(PyObject *(*)(PyObject *)); /*proto*/ static PyObject *__Pyx_CFunc_unicode____object___to_py(PyObject *(*)(PyObject *)); /*proto*/ @@ -1926,9 +2128,6 @@ static PyObject *__Pyx_CFunc_double____object___to_py(double (*)(PyObject *)); / static PyObject *__Pyx_CFunc_long__long____object___to_py(PY_LONG_LONG (*)(PyObject *)); /*proto*/ static PyObject *__Pyx_CFunc_bytes____object___to_py(PyObject *(*)(PyObject *)); /*proto*/ static PyObject *__Pyx_CFunc_float____object___to_py(float (*)(PyObject *)); /*proto*/ -static PyObject *__Pyx_CFunc_void____object____object___to_py(void (*)(PyObject *, PyObject *)); /*proto*/ -static PyObject *__Pyx_CFunc_void____object____float___to_py(void (*)(PyObject *, float)); /*proto*/ -static PyObject *__Pyx_CFunc_void____object____double___to_py(void (*)(PyObject *, double)); /*proto*/ #define __Pyx_MODULE_NAME "spavro.fast_binary" extern int __pyx_module_is_main_spavro__fast_binary; int __pyx_module_is_main_spavro__fast_binary = 0; @@ -1943,9 +2142,10 @@ static PyObject *__pyx_builtin_all; static PyObject *__pyx_builtin_any; static PyObject *__pyx_builtin_enumerate; static PyObject *__pyx_builtin_RuntimeError; +static PyObject *__pyx_builtin_MemoryError; static const char __pyx_k_[] = "\001"; +static const char __pyx_k_B[] = "B"; static const char __pyx_k_I[] = "!I"; -static const char __pyx_k_e[] = "e"; static const char __pyx_k_i[] = "i"; static const char __pyx_k_n[] = "n"; static const char __pyx_k_fo[] = "fo"; @@ -2023,6 +2223,7 @@ static const char __pyx_k_KeyError[] = "KeyError"; static const char __pyx_k_binascii[] = "binascii"; static const char __pyx_k_checksum[] = "checksum"; static const char __pyx_k_fullname[] = "fullname"; +static const char __pyx_k_iobuffer[] = "iobuffer"; static const char __pyx_k_qualname[] = "__qualname__"; static const char __pyx_k_read_int[] = "read_int"; static const char __pyx_k_skip_int[] = "skip_int"; @@ -2043,7 +2244,6 @@ static const char __pyx_k_skip_null[] = "skip_null"; static const char __pyx_k_skip_utf8[] = "skip_utf8"; static const char __pyx_k_type_list[] = "type_list"; static const char __pyx_k_write_int[] = "write_int"; -static const char __pyx_k_write_map[] = "write_map"; static const char __pyx_k_CheckField[] = "CheckField"; static const char __pyx_k_IndexError[] = "IndexError"; static const char __pyx_k_WriteField[] = "WriteField"; @@ -2051,11 +2251,9 @@ static const char __pyx_k_avro_to_py[] = "avro_to_py"; static const char __pyx_k_block_size[] = "block_size"; static const char __pyx_k_check_type[] = "check_type"; static const char __pyx_k_enum_check[] = "enum_check"; -static const char __pyx_k_enum_index[] = "enum_index"; static const char __pyx_k_get_reader[] = "get_reader"; static const char __pyx_k_get_writer[] = "get_writer"; static const char __pyx_k_item_check[] = "item_check"; -static const char __pyx_k_item_count[] = "item_count"; static const char __pyx_k_map_reader[] = "map_reader"; static const char __pyx_k_namedtuple[] = "namedtuple"; static const char __pyx_k_read_bytes[] = "read_bytes"; @@ -2063,16 +2261,15 @@ static const char __pyx_k_read_float[] = "read_float"; static const char __pyx_k_read_items[] = "read_items"; static const char __pyx_k_skip_bytes[] = "skip_bytes"; static const char __pyx_k_skip_float[] = "skip_float"; -static const char __pyx_k_write_enum[] = "write_enum"; static const char __pyx_k_write_long[] = "write_long"; static const char __pyx_k_write_null[] = "write_null"; static const char __pyx_k_write_utf8[] = "write_utf8"; +static const char __pyx_k_MemoryError[] = "MemoryError"; static const char __pyx_k_array_check[] = "array_check"; static const char __pyx_k_block_count[] = "block_count"; static const char __pyx_k_cfunc_to_py[] = "cfunc.to_py"; static const char __pyx_k_check_crc32[] = "check_crc32"; static const char __pyx_k_collections[] = "collections"; -static const char __pyx_k_data_writer[] = "data_writer"; static const char __pyx_k_enum_reader[] = "enum_reader"; static const char __pyx_k_fixed_check[] = "fixed_check"; static const char __pyx_k_item_reader[] = "item_reader"; @@ -2084,11 +2281,9 @@ static const char __pyx_k_schema_type[] = "schema_type"; static const char __pyx_k_skip_double[] = "skip_double"; static const char __pyx_k_union_check[] = "union_check"; static const char __pyx_k_union_index[] = "union_index"; -static const char __pyx_k_write_array[] = "write_array"; static const char __pyx_k_write_bytes[] = "write_bytes"; static const char __pyx_k_write_crc32[] = "write_crc32"; static const char __pyx_k_write_float[] = "write_float"; -static const char __pyx_k_write_union[] = "write_union"; static const char __pyx_k_RuntimeError[] = "RuntimeError"; static const char __pyx_k_array_reader[] = "array_reader"; static const char __pyx_k_check_string[] = "check_string"; @@ -2107,7 +2302,6 @@ static const char __pyx_k_union_reader[] = "union_reader"; static const char __pyx_k_union_schema[] = "union_schema"; static const char __pyx_k_value_reader[] = "value_reader"; static const char __pyx_k_write_double[] = "write_double"; -static const char __pyx_k_write_record[] = "write_record"; static const char __pyx_k_INT_MAX_VALUE[] = "INT_MAX_VALUE"; static const char __pyx_k_INT_MIN_VALUE[] = "INT_MIN_VALUE"; static const char __pyx_k_custom_schema[] = "custom_schema"; @@ -2153,7 +2347,6 @@ static const char __pyx_k_FastBinaryEncoder[] = "FastBinaryEncoder"; static const char __pyx_k_ReaderPlaceholder[] = "ReaderPlaceholder"; static const char __pyx_k_Write_leaf_values[] = "Write leaf values."; static const char __pyx_k_WriterPlaceholder[] = "WriterPlaceholder"; -static const char __pyx_k_checked_int_write[] = "checked_int_write"; static const char __pyx_k_make_array_reader[] = "make_array_reader"; static const char __pyx_k_make_array_writer[] = "make_array_writer"; static const char __pyx_k_make_double_check[] = "make_double_check"; @@ -2165,7 +2358,6 @@ static const char __pyx_k_make_record_check[] = "make_record_check"; static const char __pyx_k_make_string_check[] = "make_string_check"; static const char __pyx_k_make_union_reader[] = "make_union_reader"; static const char __pyx_k_make_union_writer[] = "make_union_writer"; -static const char __pyx_k_checked_long_write[] = "checked_long_write"; static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; static const char __pyx_k_make_boolean_check[] = "make_boolean_check"; static const char __pyx_k_make_double_reader[] = "make_double_reader"; @@ -2176,26 +2368,23 @@ static const char __pyx_k_make_string_reader[] = "make_string_reader"; static const char __pyx_k_make_string_writer[] = "make_string_writer"; static const char __pyx_k_spavro_fast_binary[] = "spavro.fast_binary"; static const char __pyx_k_writer_lookup_dict[] = "writer_lookup_dict"; -static const char __pyx_k_checked_write_fixed[] = "checked_write_fixed"; +static const char __pyx_k_Not_a_boolean_value[] = "{} - Not a boolean value."; static const char __pyx_k_make_boolean_reader[] = "make_boolean_reader"; static const char __pyx_k_make_boolean_writer[] = "make_boolean_writer"; static const char __pyx_k_make_default_reader[] = "make_default_reader"; static const char __pyx_k_simple_writer_lookup[] = "simple_writer_lookup"; -static const char __pyx_k_checked_string_writer[] = "checked_string_writer"; static const char __pyx_k_complex_writer_lookup[] = "complex_writer_lookup"; +static const char __pyx_k_is_not_a_string_value[] = "{} - is not a string value."; static const char __pyx_k_FastBinaryDecoder_read[] = "FastBinaryDecoder.read"; static const char __pyx_k_FastBinaryDecoder_skip[] = "FastBinaryDecoder.skip"; -static const char __pyx_k_checked_boolean_writer[] = "checked_boolean_writer"; static const char __pyx_k_FastBinaryEncoder_write[] = "FastBinaryEncoder.write"; static const char __pyx_k_FastBinaryDecoder___init[] = "FastBinaryDecoder.__init__"; static const char __pyx_k_FastBinaryEncoder___init[] = "FastBinaryEncoder.__init__"; static const char __pyx_k_ReaderPlaceholder___call[] = "ReaderPlaceholder.__call__"; static const char __pyx_k_ReaderPlaceholder___init[] = "ReaderPlaceholder.__init__"; -static const char __pyx_k_WriterPlaceholder___call[] = "WriterPlaceholder.__call__"; static const char __pyx_k_WriterPlaceholder___init[] = "WriterPlaceholder.__init__"; static const char __pyx_k_FastBinaryDecoder_read_int[] = "FastBinaryDecoder.read_int"; static const char __pyx_k_FastBinaryDecoder_skip_int[] = "FastBinaryDecoder.skip_int"; -static const char __pyx_k_Not_a_boolean_value_Schema[] = "{} - Not a boolean value. Schema: {}"; static const char __pyx_k_src_spavro_fast_binary_pyx[] = "src/spavro/fast_binary.pyx"; static const char __pyx_k_FastBinaryDecoder_read_long[] = "FastBinaryDecoder.read_long"; static const char __pyx_k_FastBinaryDecoder_read_null[] = "FastBinaryDecoder.read_null"; @@ -2214,18 +2403,17 @@ static const char __pyx_k_FastBinaryEncoder_write_null[] = "FastBinaryEncoder.wr static const char __pyx_k_FastBinaryEncoder_write_utf8[] = "FastBinaryEncoder.write_utf8"; static const char __pyx_k_Invalid_type_in_union_Schema[] = "{} - Invalid type ({}) in union. Schema: {}"; static const char __pyx_k_No_matching_schema_for_datum[] = "No matching schema for datum: {}"; -static const char __pyx_k_is_not_a_string_value_Schema[] = "{} - is not a string value. Schema: {}"; static const char __pyx_k_FastBinaryDecoder_check_crc32[] = "FastBinaryDecoder.check_crc32"; static const char __pyx_k_FastBinaryDecoder_read_double[] = "FastBinaryDecoder.read_double"; static const char __pyx_k_FastBinaryDecoder_skip_double[] = "FastBinaryDecoder.skip_double"; static const char __pyx_k_FastBinaryEncoder_write_bytes[] = "FastBinaryEncoder.write_bytes"; static const char __pyx_k_FastBinaryEncoder_write_crc32[] = "FastBinaryEncoder.write_crc32"; static const char __pyx_k_FastBinaryEncoder_write_float[] = "FastBinaryEncoder.write_float"; +static const char __pyx_k_Non_integer_value_or_overflow[] = "{} - Non integer value or overflow."; static const char __pyx_k_Pyx_CFunc_bint____object___to[] = "__Pyx_CFunc_bint____object___to_py..wrap"; static const char __pyx_k_make_byte_check_locals_lambda[] = "make_byte_check.."; static const char __pyx_k_make_long_check_locals_lambda[] = "make_long_check.."; static const char __pyx_k_make_map_reader_locals_lambda[] = "make_map_reader.."; -static const char __pyx_k_make_map_writer_locals_lambda[] = "make_map_writer.."; static const char __pyx_k_make_null_check_locals_lambda[] = "make_null_check.."; static const char __pyx_k_FastBinaryDecoder_read_boolean[] = "FastBinaryDecoder.read_boolean"; static const char __pyx_k_FastBinaryDecoder_skip_boolean[] = "FastBinaryDecoder.skip_boolean"; @@ -2235,60 +2423,42 @@ static const char __pyx_k_Pyx_CFunc_double____object___t[] = "__Pyx_CFunc_double static const char __pyx_k_Pyx_CFunc_float____object___to[] = "__Pyx_CFunc_float____object___to_py..wrap"; static const char __pyx_k_Pyx_CFunc_long__long____object[] = "__Pyx_CFunc_long__long____object___to_py..wrap"; static const char __pyx_k_Pyx_CFunc_object____object___t[] = "__Pyx_CFunc_object____object___to_py..wrap"; -static const char __pyx_k_Pyx_CFunc_void____object____do[] = "__Pyx_CFunc_void____object____double___to_py..wrap"; -static const char __pyx_k_Pyx_CFunc_void____object____fl[] = "__Pyx_CFunc_void____object____float___to_py..wrap"; static const char __pyx_k_Pyx_CFunc_void____object____lo[] = "__Pyx_CFunc_void____object____long__long___to_py..wrap"; -static const char __pyx_k_Pyx_CFunc_void____object____ob[] = "__Pyx_CFunc_void____object____object___to_py..wrap"; static const char __pyx_k_make_enum_reader_locals_lambda[] = "make_enum_reader.."; -static const char __pyx_k_make_enum_writer_locals_lambda[] = "make_enum_writer.."; static const char __pyx_k_make_float_check_locals_lambda[] = "make_float_check.."; static const char __pyx_k_make_skip_reader_locals_lambda[] = "make_skip_reader.."; static const char __pyx_k_FastBinaryEncoder_write_boolean[] = "FastBinaryEncoder.write_boolean"; -static const char __pyx_k_Non_integer_value_or_overflow_S[] = "{} - Non integer value or overflow. Schema: {}"; -static const char __pyx_k_Schema_violation_value_overflow[] = "Schema violation, value overflow. {} can't be stored in schema: {}"; -static const char __pyx_k_Size_Mismatch_for_Fixed_data_Sc[] = "{} - Size Mismatch ({}) for Fixed data. Schema: {}"; +static const char __pyx_k_Schema_violation_value_overflow[] = "Schema violation, value overflow. {} can't be stored in schema"; static const char __pyx_k_make_array_reader_locals_lambda[] = "make_array_reader.."; -static const char __pyx_k_make_array_writer_locals_lambda[] = "make_array_writer.."; static const char __pyx_k_make_default_reader_locals_read[] = "make_default_reader..read_default"; static const char __pyx_k_make_double_check_locals_lambda[] = "make_double_check.."; static const char __pyx_k_make_fixed_reader_locals_lambda[] = "make_fixed_reader.."; -static const char __pyx_k_make_long_writer_locals_checked[] = "make_long_writer..checked_long_write"; static const char __pyx_k_make_map_check_locals_map_check[] = "make_map_check..map_check"; static const char __pyx_k_make_record_check_locals_record[] = "make_record_check..record_check"; -static const char __pyx_k_make_record_writer_locals_write[] = "make_record_writer..write_record"; static const char __pyx_k_make_union_reader_locals_lambda[] = "make_union_reader.."; -static const char __pyx_k_make_union_writer_locals_lambda[] = "make_union_writer.."; static const char __pyx_k_make_union_writer_locals_simple[] = "make_union_writer..simple_writer_lookup"; static const char __pyx_k_Error_writing_record_schema_at_f[] = "Error writing record schema at fieldname: '{}', datum: '{}'"; static const char __pyx_k_Fast_Cython_extension_for_readin[] = "Fast Cython extension for reading / writing and validating AVRO records.\n\nThe main edge this code has is that it parses the schema only once and creates\na reader/writer call tree from the schema shape. All reads and writes then\nno longer consult the schema saving lookups."; -static const char __pyx_k_Schema_violation_is_not_an_examp[] = "Schema violation, {} is not an example of schema {}"; +static const char __pyx_k_Schema_violation_is_not_an_examp[] = "Schema violation, {} is not an example of integer"; static const char __pyx_k_Unable_to_process_union_schema_u[] = "Unable to process union schema {}, union index '{}' doesn't exist. This is most likely because the read schema being used is not compatible with the write schema used to write the data."; static const char __pyx_k_create_promotions_for_union_loca[] = "create_promotions_for_union.."; static const char __pyx_k_make_array_check_locals_array_ch[] = "make_array_check..array_check"; static const char __pyx_k_make_array_reader_locals_array_r[] = "make_array_reader..array_reader"; -static const char __pyx_k_make_array_writer_locals_write_a[] = "make_array_writer..write_array"; static const char __pyx_k_make_boolean_check_locals_lambda[] = "make_boolean_check.."; -static const char __pyx_k_make_boolean_writer_locals_check[] = "make_boolean_writer..checked_boolean_writer"; static const char __pyx_k_make_default_reader_locals_lambd[] = "make_default_reader.."; static const char __pyx_k_make_enum_check_locals_enum_chec[] = "make_enum_check..enum_check"; static const char __pyx_k_make_enum_reader_locals_enum_rea[] = "make_enum_reader..enum_reader"; -static const char __pyx_k_make_enum_writer_locals_write_en[] = "make_enum_writer..write_enum"; static const char __pyx_k_make_fixed_check_locals_fixed_ch[] = "make_fixed_check..fixed_check"; static const char __pyx_k_make_fixed_reader_locals_fixed_r[] = "make_fixed_reader..fixed_reader"; -static const char __pyx_k_make_fixed_writer_locals_checked[] = "make_fixed_writer..checked_write_fixed"; -static const char __pyx_k_make_int_writer_locals_checked_i[] = "make_int_writer..checked_int_write"; static const char __pyx_k_make_map_reader_locals_map_reade[] = "make_map_reader..map_reader"; -static const char __pyx_k_make_map_writer_locals_write_map[] = "make_map_writer..write_map"; static const char __pyx_k_make_record_reader_locals_lambda[] = "make_record_reader.."; static const char __pyx_k_make_record_reader_locals_record[] = "make_record_reader..record_reader"; -static const char __pyx_k_make_record_writer_locals_lambda[] = "make_record_writer.."; static const char __pyx_k_make_skip_reader_locals_read_ski[] = "make_skip_reader..read_skip"; -static const char __pyx_k_make_string_writer_locals_checke[] = "make_string_writer..checked_string_writer"; static const char __pyx_k_make_union_check_locals_union_ch[] = "make_union_check..union_check"; static const char __pyx_k_make_union_reader_locals_union_r[] = "make_union_reader..union_reader"; static const char __pyx_k_make_union_writer_locals_complex[] = "make_union_writer..complex_writer_lookup"; -static const char __pyx_k_make_union_writer_locals_write_u[] = "make_union_writer..write_union"; static PyObject *__pyx_kp_b_; +static PyObject *__pyx_n_s_B; static PyObject *__pyx_n_s_CheckField; static PyObject *__pyx_kp_s_Checksum_failure; static PyObject *__pyx_kp_s_Error_writing_record_schema_at_f; @@ -2333,9 +2503,10 @@ static PyObject *__pyx_kp_s_Invalid_type_in_union_Schema; static PyObject *__pyx_n_s_KeyError; static PyObject *__pyx_n_s_LONG_MAX_VALUE; static PyObject *__pyx_n_s_LONG_MIN_VALUE; +static PyObject *__pyx_n_s_MemoryError; static PyObject *__pyx_kp_s_No_matching_schema_for_datum; -static PyObject *__pyx_kp_s_Non_integer_value_or_overflow_S; -static PyObject *__pyx_kp_s_Not_a_boolean_value_Schema; +static PyObject *__pyx_kp_s_Non_integer_value_or_overflow; +static PyObject *__pyx_kp_s_Not_a_boolean_value; static PyObject *__pyx_n_s_Pyx_CFunc_bint____object___to; static PyObject *__pyx_n_s_Pyx_CFunc_bytes____object___to; static PyObject *__pyx_n_s_Pyx_CFunc_double____object___t; @@ -2343,10 +2514,7 @@ static PyObject *__pyx_n_s_Pyx_CFunc_float____object___to; static PyObject *__pyx_n_s_Pyx_CFunc_long__long____object; static PyObject *__pyx_n_s_Pyx_CFunc_object____object___t; static PyObject *__pyx_n_s_Pyx_CFunc_unicode____object; -static PyObject *__pyx_n_s_Pyx_CFunc_void____object____do; -static PyObject *__pyx_n_s_Pyx_CFunc_void____object____fl; static PyObject *__pyx_n_s_Pyx_CFunc_void____object____lo; -static PyObject *__pyx_n_s_Pyx_CFunc_void____object____ob; static PyObject *__pyx_n_s_ReadField; static PyObject *__pyx_kp_s_Read_leaf_values; static PyObject *__pyx_n_s_ReaderPlaceholder; @@ -2355,13 +2523,11 @@ static PyObject *__pyx_n_s_ReaderPlaceholder___init; static PyObject *__pyx_n_s_RuntimeError; static PyObject *__pyx_kp_s_Schema_violation_is_not_an_examp; static PyObject *__pyx_kp_s_Schema_violation_value_overflow; -static PyObject *__pyx_kp_s_Size_Mismatch_for_Fixed_data_Sc; static PyObject *__pyx_n_s_TypeError; static PyObject *__pyx_kp_s_Unable_to_process_union_schema_u; static PyObject *__pyx_n_s_WriteField; static PyObject *__pyx_kp_s_Write_leaf_values; static PyObject *__pyx_n_s_WriterPlaceholder; -static PyObject *__pyx_n_s_WriterPlaceholder___call; static PyObject *__pyx_n_s_WriterPlaceholder___init; static PyObject *__pyx_n_s__10; static PyObject *__pyx_kp_s__19; @@ -2386,11 +2552,6 @@ static PyObject *__pyx_n_s_check_crc32; static PyObject *__pyx_n_s_check_string; static PyObject *__pyx_n_s_check_type; static PyObject *__pyx_n_s_check_type_map; -static PyObject *__pyx_n_s_checked_boolean_writer; -static PyObject *__pyx_n_s_checked_int_write; -static PyObject *__pyx_n_s_checked_long_write; -static PyObject *__pyx_n_s_checked_string_writer; -static PyObject *__pyx_n_s_checked_write_fixed; static PyObject *__pyx_n_s_checksum; static PyObject *__pyx_n_s_cline_in_traceback; static PyObject *__pyx_n_s_collections; @@ -2399,18 +2560,15 @@ static PyObject *__pyx_n_s_count; static PyObject *__pyx_n_s_crc32; static PyObject *__pyx_n_s_create_promotions_for_union_loca; static PyObject *__pyx_n_s_custom_schema; -static PyObject *__pyx_n_s_data_writer; static PyObject *__pyx_n_s_datum; static PyObject *__pyx_n_s_default; static PyObject *__pyx_n_s_doc; static PyObject *__pyx_n_s_double; static PyObject *__pyx_n_u_double; -static PyObject *__pyx_n_s_e; static PyObject *__pyx_n_s_encode; static PyObject *__pyx_n_s_enum; static PyObject *__pyx_n_u_enum; static PyObject *__pyx_n_s_enum_check; -static PyObject *__pyx_n_s_enum_index; static PyObject *__pyx_n_s_enum_reader; static PyObject *__pyx_n_s_enumerate; static PyObject *__pyx_n_s_field; @@ -2436,10 +2594,10 @@ static PyObject *__pyx_n_s_init; static PyObject *__pyx_n_s_int; static PyObject *__pyx_n_u_int; static PyObject *__pyx_n_s_integer_types; -static PyObject *__pyx_kp_s_is_not_a_string_value_Schema; +static PyObject *__pyx_n_s_iobuffer; +static PyObject *__pyx_kp_s_is_not_a_string_value; static PyObject *__pyx_n_s_item; static PyObject *__pyx_n_s_item_check; -static PyObject *__pyx_n_s_item_count; static PyObject *__pyx_n_s_item_reader; static PyObject *__pyx_n_s_item_writer; static PyObject *__pyx_n_s_items; @@ -2457,13 +2615,10 @@ static PyObject *__pyx_n_s_make_array_reader; static PyObject *__pyx_n_s_make_array_reader_locals_array_r; static PyObject *__pyx_n_s_make_array_reader_locals_lambda; static PyObject *__pyx_n_s_make_array_writer; -static PyObject *__pyx_n_s_make_array_writer_locals_lambda; -static PyObject *__pyx_n_s_make_array_writer_locals_write_a; static PyObject *__pyx_n_s_make_boolean_check; static PyObject *__pyx_n_s_make_boolean_check_locals_lambda; static PyObject *__pyx_n_s_make_boolean_reader; static PyObject *__pyx_n_s_make_boolean_writer; -static PyObject *__pyx_n_s_make_boolean_writer_locals_check; static PyObject *__pyx_n_s_make_byte_check; static PyObject *__pyx_n_s_make_byte_check_locals_lambda; static PyObject *__pyx_n_s_make_byte_reader; @@ -2481,34 +2636,27 @@ static PyObject *__pyx_n_s_make_enum_reader; static PyObject *__pyx_n_s_make_enum_reader_locals_enum_rea; static PyObject *__pyx_n_s_make_enum_reader_locals_lambda; static PyObject *__pyx_n_s_make_enum_writer; -static PyObject *__pyx_n_s_make_enum_writer_locals_lambda; -static PyObject *__pyx_n_s_make_enum_writer_locals_write_en; static PyObject *__pyx_n_s_make_fixed_check; static PyObject *__pyx_n_s_make_fixed_check_locals_fixed_ch; static PyObject *__pyx_n_s_make_fixed_reader; static PyObject *__pyx_n_s_make_fixed_reader_locals_fixed_r; static PyObject *__pyx_n_s_make_fixed_reader_locals_lambda; static PyObject *__pyx_n_s_make_fixed_writer; -static PyObject *__pyx_n_s_make_fixed_writer_locals_checked; static PyObject *__pyx_n_s_make_float_check; static PyObject *__pyx_n_s_make_float_check_locals_lambda; static PyObject *__pyx_n_s_make_float_reader; static PyObject *__pyx_n_s_make_float_writer; static PyObject *__pyx_n_s_make_int_writer; -static PyObject *__pyx_n_s_make_int_writer_locals_checked_i; static PyObject *__pyx_n_s_make_long_check; static PyObject *__pyx_n_s_make_long_check_locals_lambda; static PyObject *__pyx_n_s_make_long_reader; static PyObject *__pyx_n_s_make_long_writer; -static PyObject *__pyx_n_s_make_long_writer_locals_checked; static PyObject *__pyx_n_s_make_map_check; static PyObject *__pyx_n_s_make_map_check_locals_map_check; static PyObject *__pyx_n_s_make_map_reader; static PyObject *__pyx_n_s_make_map_reader_locals_lambda; static PyObject *__pyx_n_s_make_map_reader_locals_map_reade; static PyObject *__pyx_n_s_make_map_writer; -static PyObject *__pyx_n_s_make_map_writer_locals_lambda; -static PyObject *__pyx_n_s_make_map_writer_locals_write_map; static PyObject *__pyx_n_s_make_null_check; static PyObject *__pyx_n_s_make_null_check_locals_lambda; static PyObject *__pyx_n_s_make_null_reader; @@ -2519,15 +2667,12 @@ static PyObject *__pyx_n_s_make_record_reader; static PyObject *__pyx_n_s_make_record_reader_locals_lambda; static PyObject *__pyx_n_s_make_record_reader_locals_record; static PyObject *__pyx_n_s_make_record_writer; -static PyObject *__pyx_n_s_make_record_writer_locals_lambda; -static PyObject *__pyx_n_s_make_record_writer_locals_write; static PyObject *__pyx_n_s_make_skip_reader; static PyObject *__pyx_n_s_make_skip_reader_locals_lambda; static PyObject *__pyx_n_s_make_skip_reader_locals_read_ski; static PyObject *__pyx_n_s_make_string_check; static PyObject *__pyx_n_s_make_string_reader; static PyObject *__pyx_n_s_make_string_writer; -static PyObject *__pyx_n_s_make_string_writer_locals_checke; static PyObject *__pyx_n_s_make_union_check; static PyObject *__pyx_n_s_make_union_check_locals_union_ch; static PyObject *__pyx_n_s_make_union_reader; @@ -2535,9 +2680,7 @@ static PyObject *__pyx_n_s_make_union_reader_locals_lambda; static PyObject *__pyx_n_s_make_union_reader_locals_union_r; static PyObject *__pyx_n_s_make_union_writer; static PyObject *__pyx_n_s_make_union_writer_locals_complex; -static PyObject *__pyx_n_s_make_union_writer_locals_lambda; static PyObject *__pyx_n_s_make_union_writer_locals_simple; -static PyObject *__pyx_n_s_make_union_writer_locals_write_u; static PyObject *__pyx_n_s_map; static PyObject *__pyx_n_u_map; static PyObject *__pyx_n_s_map_check; @@ -2628,19 +2771,14 @@ static PyObject *__pyx_n_s_value_reader; static PyObject *__pyx_n_s_values; static PyObject *__pyx_n_s_wrap; static PyObject *__pyx_n_s_write; -static PyObject *__pyx_n_s_write_array; static PyObject *__pyx_n_s_write_boolean; static PyObject *__pyx_n_s_write_bytes; static PyObject *__pyx_n_s_write_crc32; static PyObject *__pyx_n_s_write_double; -static PyObject *__pyx_n_s_write_enum; static PyObject *__pyx_n_s_write_float; static PyObject *__pyx_n_s_write_int; static PyObject *__pyx_n_s_write_long; -static PyObject *__pyx_n_s_write_map; static PyObject *__pyx_n_s_write_null; -static PyObject *__pyx_n_s_write_record; -static PyObject *__pyx_n_s_write_union; static PyObject *__pyx_n_s_write_utf8; static PyObject *__pyx_n_s_writer; static PyObject *__pyx_n_s_writer_lookup; @@ -2713,37 +2851,21 @@ static PyObject *__pyx_lambda_funcdef_lambda14(PyObject *__pyx_self, PyObject *_ static PyObject *__pyx_lambda_funcdef_lambda15(PyObject *__pyx_self, PyObject *__pyx_v_output_buffer, PyObject *__pyx_v_val); /* proto */ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_union_writer_simple_writer_lookup(PyObject *__pyx_self, PyObject *__pyx_v_datum); /* proto */ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_union_writer_2complex_writer_lookup(PyObject *__pyx_self, PyObject *__pyx_v_datum); /* proto */ -static PyObject *__pyx_pf_6spavro_11fast_binary_17make_union_writer_4write_union(PyObject *__pyx_self, PyObject *__pyx_v_outbuf, PyObject *__pyx_v_datum); /* proto */ -static PyObject *__pyx_lambda_funcdef_lambda16(PyObject *__pyx_self); /* proto */ static PyObject *__pyx_pf_6spavro_11fast_binary_66make_union_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_union_schema); /* proto */ -static PyObject *__pyx_pf_6spavro_11fast_binary_16make_enum_writer_write_enum(PyObject *__pyx_self, PyObject *__pyx_v_outbuf, PyObject *__pyx_v_datum); /* proto */ -static PyObject *__pyx_lambda_funcdef_lambda17(PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_6spavro_11fast_binary_68make_enum_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema); /* proto */ -static PyObject *__pyx_pf_6spavro_11fast_binary_18make_record_writer_write_record(PyObject *__pyx_self, PyObject *__pyx_v_outbuf, PyObject *__pyx_v_datum); /* proto */ -static PyObject *__pyx_lambda_funcdef_lambda18(PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_6spavro_11fast_binary_70make_record_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema); /* proto */ -static PyObject *__pyx_pf_6spavro_11fast_binary_17make_array_writer_write_array(PyObject *__pyx_self, PyObject *__pyx_v_outbuf, PyObject *__pyx_v_datum); /* proto */ -static PyObject *__pyx_lambda_funcdef_lambda19(PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_6spavro_11fast_binary_72make_array_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema); /* proto */ -static PyObject *__pyx_pf_6spavro_11fast_binary_15make_map_writer_write_map(PyObject *__pyx_self, PyObject *__pyx_v_outbuf, PyObject *__pyx_v_datum); /* proto */ -static PyObject *__pyx_lambda_funcdef_lambda20(PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_6spavro_11fast_binary_74make_map_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema); /* proto */ -static PyObject *__pyx_pf_6spavro_11fast_binary_19make_boolean_writer_checked_boolean_writer(PyObject *__pyx_self, PyObject *__pyx_v_outbuf, PyObject *__pyx_v_datum); /* proto */ -static PyObject *__pyx_pf_6spavro_11fast_binary_76make_boolean_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema); /* proto */ -static PyObject *__pyx_pf_6spavro_11fast_binary_17make_fixed_writer_checked_write_fixed(PyObject *__pyx_self, PyObject *__pyx_v_outbuf, PyObject *__pyx_v_datum); /* proto */ -static PyObject *__pyx_pf_6spavro_11fast_binary_78make_fixed_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema); /* proto */ -static PyObject *__pyx_pf_6spavro_11fast_binary_15make_int_writer_checked_int_write(PyObject *__pyx_self, PyObject *__pyx_v_outbuf, PyObject *__pyx_v_datum); /* proto */ -static PyObject *__pyx_pf_6spavro_11fast_binary_80make_int_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema); /* proto */ -static PyObject *__pyx_pf_6spavro_11fast_binary_16make_long_writer_checked_long_write(PyObject *__pyx_self, PyObject *__pyx_v_outbuf, PyObject *__pyx_v_datum); /* proto */ -static PyObject *__pyx_pf_6spavro_11fast_binary_82make_long_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema); /* proto */ -static PyObject *__pyx_pf_6spavro_11fast_binary_18make_string_writer_checked_string_writer(PyObject *__pyx_self, PyObject *__pyx_v_outbuf, PyObject *__pyx_v_datum); /* proto */ -static PyObject *__pyx_pf_6spavro_11fast_binary_84make_string_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema); /* proto */ -static PyObject *__pyx_pf_6spavro_11fast_binary_86make_byte_writer(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema); /* proto */ -static PyObject *__pyx_pf_6spavro_11fast_binary_88make_float_writer(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema); /* proto */ -static PyObject *__pyx_pf_6spavro_11fast_binary_90make_double_writer(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema); /* proto */ -static PyObject *__pyx_pf_6spavro_11fast_binary_92make_null_writer(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema); /* proto */ +static PyObject *__pyx_pf_6spavro_11fast_binary_68make_record_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema); /* proto */ +static PyObject *__pyx_pf_6spavro_11fast_binary_70make_null_writer(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema); /* proto */ +static PyObject *__pyx_pf_6spavro_11fast_binary_72make_string_writer(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema); /* proto */ +static PyObject *__pyx_pf_6spavro_11fast_binary_74make_boolean_writer(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema); /* proto */ +static PyObject *__pyx_pf_6spavro_11fast_binary_76make_double_writer(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema); /* proto */ +static PyObject *__pyx_pf_6spavro_11fast_binary_78make_float_writer(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema); /* proto */ +static PyObject *__pyx_pf_6spavro_11fast_binary_80make_long_writer(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema); /* proto */ +static PyObject *__pyx_pf_6spavro_11fast_binary_82make_byte_writer(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema); /* proto */ +static PyObject *__pyx_pf_6spavro_11fast_binary_84make_int_writer(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema); /* proto */ +static PyObject *__pyx_pf_6spavro_11fast_binary_86make_fixed_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema); /* proto */ +static PyObject *__pyx_pf_6spavro_11fast_binary_88make_enum_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema); /* proto */ +static PyObject *__pyx_pf_6spavro_11fast_binary_90make_array_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema); /* proto */ +static PyObject *__pyx_pf_6spavro_11fast_binary_92make_map_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema); /* proto */ static PyObject *__pyx_pf_6spavro_11fast_binary_17WriterPlaceholder___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6spavro_11fast_binary_17WriterPlaceholder_2__call__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fo, PyObject *__pyx_v_val); /* proto */ static PyObject *__pyx_pf_6spavro_11fast_binary_94get_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema); /* proto */ static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_writer); /* proto */ static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_2write(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_datum); /* proto */ @@ -2776,6 +2898,9 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_32skip_doubl static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_34skip_bytes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_36skip_utf8(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_38skip(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_n); /* proto */ +static PyObject *__pyx_pf_6spavro_11fast_binary_96write(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_iobuffer, PyObject *__pyx_v_datum, PyObject *__pyx_v_writer, CYTHON_UNUSED PyObject *__pyx_v_schema); /* 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_pf_11cfunc_dot_to_py_48__Pyx_CFunc_void____object____long__long___to_py_wrap(PyObject *__pyx_self, PyObject *__pyx_v_outbuf, PY_LONG_LONG __pyx_v_signed_datum); /* proto */ static PyObject *__pyx_pf_11cfunc_dot_to_py_36__Pyx_CFunc_object____object___to_py_wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo); /* proto */ static PyObject *__pyx_pf_11cfunc_dot_to_py_37__Pyx_CFunc_unicode____object___to_py_wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo); /* proto */ @@ -2784,9 +2909,6 @@ static PyObject *__pyx_pf_11cfunc_dot_to_py_36__Pyx_CFunc_double____object___to_ static PyObject *__pyx_pf_11cfunc_dot_to_py_40__Pyx_CFunc_long__long____object___to_py_wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo); /* proto */ static PyObject *__pyx_pf_11cfunc_dot_to_py_35__Pyx_CFunc_bytes____object___to_py_wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo); /* proto */ static PyObject *__pyx_pf_11cfunc_dot_to_py_35__Pyx_CFunc_float____object___to_py_wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo); /* proto */ -static PyObject *__pyx_pf_11cfunc_dot_to_py_44__Pyx_CFunc_void____object____object___to_py_wrap(PyObject *__pyx_self, PyObject *__pyx_v_outbuf, PyObject *__pyx_v_datum); /* proto */ -static PyObject *__pyx_pf_11cfunc_dot_to_py_43__Pyx_CFunc_void____object____float___to_py_wrap(PyObject *__pyx_self, PyObject *__pyx_v_outbuf, float __pyx_v_datum); /* proto */ -static PyObject *__pyx_pf_11cfunc_dot_to_py_44__Pyx_CFunc_void____object____double___to_py_wrap(PyObject *__pyx_self, PyObject *__pyx_v_outbuf, double __pyx_v_datum); /* proto */ static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct__make_union_reader(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ @@ -2803,15 +2925,6 @@ static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_12_make_f static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_object____object___to_py(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ @@ -2820,15 +2933,23 @@ static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_double____object__ static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_float____object___to_py(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_void____object____object___to_py(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_void____object____float___to_py(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_void____object____double___to_py(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get = {0, &__pyx_n_s_get, 0, 0, 0}; static __Pyx_CachedCFunction __pyx_umethod_PyList_Type_count = {0, &__pyx_n_s_count, 0, 0, 0}; static __Pyx_CachedCFunction __pyx_umethod_PyList_Type_index = {0, &__pyx_n_s_index, 0, 0, 0}; static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; +static PyObject *__pyx_int_2; +static PyObject *__pyx_int_3; static PyObject *__pyx_int_4; +static PyObject *__pyx_int_5; +static PyObject *__pyx_int_6; +static PyObject *__pyx_int_7; static PyObject *__pyx_int_8; +static PyObject *__pyx_int_9; +static PyObject *__pyx_int_10; +static PyObject *__pyx_int_11; +static PyObject *__pyx_int_12; +static PyObject *__pyx_int_13; static PyObject *__pyx_int_2147483647; static PyObject *__pyx_int_4294967295; static PyObject *__pyx_int_9223372036854775807; @@ -2851,16 +2972,16 @@ static PyObject *__pyx_tuple__30; static PyObject *__pyx_tuple__32; static PyObject *__pyx_tuple__34; static PyObject *__pyx_tuple__36; -static PyObject *__pyx_tuple__38; -static PyObject *__pyx_tuple__40; -static PyObject *__pyx_tuple__42; -static PyObject *__pyx_tuple__44; -static PyObject *__pyx_tuple__46; -static PyObject *__pyx_tuple__48; -static PyObject *__pyx_tuple__50; -static PyObject *__pyx_tuple__52; -static PyObject *__pyx_tuple__54; -static PyObject *__pyx_tuple__56; +static PyObject *__pyx_tuple__37; +static PyObject *__pyx_tuple__39; +static PyObject *__pyx_tuple__41; +static PyObject *__pyx_tuple__43; +static PyObject *__pyx_tuple__45; +static PyObject *__pyx_tuple__47; +static PyObject *__pyx_tuple__49; +static PyObject *__pyx_tuple__51; +static PyObject *__pyx_tuple__53; +static PyObject *__pyx_tuple__55; static PyObject *__pyx_tuple__57; static PyObject *__pyx_tuple__59; static PyObject *__pyx_tuple__61; @@ -2875,23 +2996,23 @@ static PyObject *__pyx_tuple__77; static PyObject *__pyx_tuple__79; static PyObject *__pyx_tuple__81; static PyObject *__pyx_tuple__83; -static PyObject *__pyx_tuple__85; -static PyObject *__pyx_tuple__87; -static PyObject *__pyx_tuple__89; -static PyObject *__pyx_tuple__91; -static PyObject *__pyx_tuple__93; -static PyObject *__pyx_tuple__95; -static PyObject *__pyx_tuple__97; -static PyObject *__pyx_tuple__99; +static PyObject *__pyx_tuple__84; +static PyObject *__pyx_tuple__86; +static PyObject *__pyx_tuple__88; +static PyObject *__pyx_tuple__90; +static PyObject *__pyx_tuple__92; +static PyObject *__pyx_tuple__94; +static PyObject *__pyx_tuple__96; +static PyObject *__pyx_tuple__98; static PyObject *__pyx_codeobj__3; static PyObject *__pyx_codeobj__5; static PyObject *__pyx_codeobj__7; static PyObject *__pyx_codeobj__9; -static PyObject *__pyx_tuple__101; -static PyObject *__pyx_tuple__103; -static PyObject *__pyx_tuple__105; -static PyObject *__pyx_tuple__107; -static PyObject *__pyx_tuple__109; +static PyObject *__pyx_tuple__100; +static PyObject *__pyx_tuple__102; +static PyObject *__pyx_tuple__104; +static PyObject *__pyx_tuple__106; +static PyObject *__pyx_tuple__108; static PyObject *__pyx_tuple__110; static PyObject *__pyx_tuple__112; static PyObject *__pyx_tuple__114; @@ -2913,8 +3034,9 @@ static PyObject *__pyx_tuple__144; static PyObject *__pyx_tuple__146; static PyObject *__pyx_tuple__148; static PyObject *__pyx_tuple__150; -static PyObject *__pyx_tuple__152; -static PyObject *__pyx_tuple__154; +static PyObject *__pyx_tuple__151; +static PyObject *__pyx_tuple__153; +static PyObject *__pyx_tuple__155; static PyObject *__pyx_tuple__156; static PyObject *__pyx_tuple__158; static PyObject *__pyx_tuple__160; @@ -2926,22 +3048,21 @@ static PyObject *__pyx_tuple__170; static PyObject *__pyx_tuple__172; static PyObject *__pyx_tuple__174; static PyObject *__pyx_tuple__176; -static PyObject *__pyx_tuple__177; +static PyObject *__pyx_tuple__178; static PyObject *__pyx_tuple__179; static PyObject *__pyx_tuple__181; static PyObject *__pyx_tuple__183; -static PyObject *__pyx_tuple__184; -static PyObject *__pyx_tuple__186; -static PyObject *__pyx_tuple__188; -static PyObject *__pyx_tuple__190; -static PyObject *__pyx_tuple__192; -static PyObject *__pyx_tuple__194; -static PyObject *__pyx_tuple__196; -static PyObject *__pyx_tuple__198; -static PyObject *__pyx_tuple__200; -static PyObject *__pyx_tuple__202; -static PyObject *__pyx_tuple__204; -static PyObject *__pyx_tuple__206; +static PyObject *__pyx_tuple__185; +static PyObject *__pyx_tuple__187; +static PyObject *__pyx_tuple__189; +static PyObject *__pyx_tuple__191; +static PyObject *__pyx_tuple__193; +static PyObject *__pyx_tuple__195; +static PyObject *__pyx_tuple__197; +static PyObject *__pyx_tuple__199; +static PyObject *__pyx_tuple__201; +static PyObject *__pyx_tuple__203; +static PyObject *__pyx_tuple__205; static PyObject *__pyx_tuple__207; static PyObject *__pyx_tuple__209; static PyObject *__pyx_tuple__211; @@ -2949,19 +3070,6 @@ static PyObject *__pyx_tuple__213; static PyObject *__pyx_tuple__215; static PyObject *__pyx_tuple__217; static PyObject *__pyx_tuple__219; -static PyObject *__pyx_tuple__221; -static PyObject *__pyx_tuple__223; -static PyObject *__pyx_tuple__225; -static PyObject *__pyx_tuple__227; -static PyObject *__pyx_tuple__229; -static PyObject *__pyx_tuple__231; -static PyObject *__pyx_tuple__233; -static PyObject *__pyx_tuple__235; -static PyObject *__pyx_tuple__237; -static PyObject *__pyx_tuple__239; -static PyObject *__pyx_tuple__241; -static PyObject *__pyx_tuple__243; -static PyObject *__pyx_tuple__245; static PyObject *__pyx_codeobj__12; static PyObject *__pyx_codeobj__14; static PyObject *__pyx_codeobj__16; @@ -2974,16 +3082,16 @@ static PyObject *__pyx_codeobj__29; static PyObject *__pyx_codeobj__31; static PyObject *__pyx_codeobj__33; static PyObject *__pyx_codeobj__35; -static PyObject *__pyx_codeobj__37; -static PyObject *__pyx_codeobj__39; -static PyObject *__pyx_codeobj__41; -static PyObject *__pyx_codeobj__43; -static PyObject *__pyx_codeobj__45; -static PyObject *__pyx_codeobj__47; -static PyObject *__pyx_codeobj__49; -static PyObject *__pyx_codeobj__51; -static PyObject *__pyx_codeobj__53; -static PyObject *__pyx_codeobj__55; +static PyObject *__pyx_codeobj__38; +static PyObject *__pyx_codeobj__40; +static PyObject *__pyx_codeobj__42; +static PyObject *__pyx_codeobj__44; +static PyObject *__pyx_codeobj__46; +static PyObject *__pyx_codeobj__48; +static PyObject *__pyx_codeobj__50; +static PyObject *__pyx_codeobj__52; +static PyObject *__pyx_codeobj__54; +static PyObject *__pyx_codeobj__56; static PyObject *__pyx_codeobj__58; static PyObject *__pyx_codeobj__60; static PyObject *__pyx_codeobj__62; @@ -2997,19 +3105,19 @@ static PyObject *__pyx_codeobj__76; static PyObject *__pyx_codeobj__78; static PyObject *__pyx_codeobj__80; static PyObject *__pyx_codeobj__82; -static PyObject *__pyx_codeobj__84; -static PyObject *__pyx_codeobj__86; -static PyObject *__pyx_codeobj__88; -static PyObject *__pyx_codeobj__90; -static PyObject *__pyx_codeobj__92; -static PyObject *__pyx_codeobj__94; -static PyObject *__pyx_codeobj__96; -static PyObject *__pyx_codeobj__98; -static PyObject *__pyx_codeobj__100; -static PyObject *__pyx_codeobj__102; -static PyObject *__pyx_codeobj__104; -static PyObject *__pyx_codeobj__106; -static PyObject *__pyx_codeobj__108; +static PyObject *__pyx_codeobj__85; +static PyObject *__pyx_codeobj__87; +static PyObject *__pyx_codeobj__89; +static PyObject *__pyx_codeobj__91; +static PyObject *__pyx_codeobj__93; +static PyObject *__pyx_codeobj__95; +static PyObject *__pyx_codeobj__97; +static PyObject *__pyx_codeobj__99; +static PyObject *__pyx_codeobj__101; +static PyObject *__pyx_codeobj__103; +static PyObject *__pyx_codeobj__105; +static PyObject *__pyx_codeobj__107; +static PyObject *__pyx_codeobj__109; static PyObject *__pyx_codeobj__111; static PyObject *__pyx_codeobj__113; static PyObject *__pyx_codeobj__115; @@ -3030,9 +3138,8 @@ static PyObject *__pyx_codeobj__143; static PyObject *__pyx_codeobj__145; static PyObject *__pyx_codeobj__147; static PyObject *__pyx_codeobj__149; -static PyObject *__pyx_codeobj__151; -static PyObject *__pyx_codeobj__153; -static PyObject *__pyx_codeobj__155; +static PyObject *__pyx_codeobj__152; +static PyObject *__pyx_codeobj__154; static PyObject *__pyx_codeobj__157; static PyObject *__pyx_codeobj__159; static PyObject *__pyx_codeobj__161; @@ -3043,20 +3150,21 @@ static PyObject *__pyx_codeobj__169; static PyObject *__pyx_codeobj__171; static PyObject *__pyx_codeobj__173; static PyObject *__pyx_codeobj__175; -static PyObject *__pyx_codeobj__178; +static PyObject *__pyx_codeobj__177; static PyObject *__pyx_codeobj__180; static PyObject *__pyx_codeobj__182; -static PyObject *__pyx_codeobj__185; -static PyObject *__pyx_codeobj__187; -static PyObject *__pyx_codeobj__189; -static PyObject *__pyx_codeobj__191; -static PyObject *__pyx_codeobj__193; -static PyObject *__pyx_codeobj__195; -static PyObject *__pyx_codeobj__197; -static PyObject *__pyx_codeobj__199; -static PyObject *__pyx_codeobj__201; -static PyObject *__pyx_codeobj__203; -static PyObject *__pyx_codeobj__205; +static PyObject *__pyx_codeobj__184; +static PyObject *__pyx_codeobj__186; +static PyObject *__pyx_codeobj__188; +static PyObject *__pyx_codeobj__190; +static PyObject *__pyx_codeobj__192; +static PyObject *__pyx_codeobj__194; +static PyObject *__pyx_codeobj__196; +static PyObject *__pyx_codeobj__198; +static PyObject *__pyx_codeobj__200; +static PyObject *__pyx_codeobj__202; +static PyObject *__pyx_codeobj__204; +static PyObject *__pyx_codeobj__206; static PyObject *__pyx_codeobj__208; static PyObject *__pyx_codeobj__210; static PyObject *__pyx_codeobj__212; @@ -3064,22 +3172,9 @@ static PyObject *__pyx_codeobj__214; static PyObject *__pyx_codeobj__216; static PyObject *__pyx_codeobj__218; static PyObject *__pyx_codeobj__220; -static PyObject *__pyx_codeobj__222; -static PyObject *__pyx_codeobj__224; -static PyObject *__pyx_codeobj__226; -static PyObject *__pyx_codeobj__228; -static PyObject *__pyx_codeobj__230; -static PyObject *__pyx_codeobj__232; -static PyObject *__pyx_codeobj__234; -static PyObject *__pyx_codeobj__236; -static PyObject *__pyx_codeobj__238; -static PyObject *__pyx_codeobj__240; -static PyObject *__pyx_codeobj__242; -static PyObject *__pyx_codeobj__244; -static PyObject *__pyx_codeobj__246; /* Late includes */ -/* "spavro/fast_binary.pyx":15 +/* "spavro/fast_binary.pyx":18 * * * cdef long long read_long(fo): # <<<<<<<<<<<<<< @@ -3100,9 +3195,12 @@ static PY_LONG_LONG __pyx_f_6spavro_11fast_binary_read_long(PyObject *__pyx_v_fo PyObject *__pyx_t_3 = NULL; char *__pyx_t_4; int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("read_long", 0); - /* "spavro/fast_binary.pyx":21 + /* "spavro/fast_binary.pyx":24 * unsigned long long temp_datum * char* c_raw * int shift = 7 # <<<<<<<<<<<<<< @@ -3111,14 +3209,14 @@ static PY_LONG_LONG __pyx_f_6spavro_11fast_binary_read_long(PyObject *__pyx_v_fo */ __pyx_v_shift = 7; - /* "spavro/fast_binary.pyx":24 + /* "spavro/fast_binary.pyx":27 * # this ping-pong casting is required for Python 2.7 * # not sure why exactly * raw = fo.read(1) # <<<<<<<<<<<<<< * c_raw = raw * temp_datum = c_raw[0] */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_fo, __pyx_n_s_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_fo, __pyx_n_s_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { @@ -3132,23 +3230,23 @@ static PY_LONG_LONG __pyx_f_6spavro_11fast_binary_read_long(PyObject *__pyx_v_fo } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_int_1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_int_1); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_raw = __pyx_t_1; __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":25 + /* "spavro/fast_binary.pyx":28 * # not sure why exactly * raw = fo.read(1) * c_raw = raw # <<<<<<<<<<<<<< * temp_datum = c_raw[0] * accum = temp_datum & 0x7F */ - __pyx_t_4 = __Pyx_PyObject_AsWritableString(__pyx_v_raw); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 25, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_AsWritableString(__pyx_v_raw); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 28, __pyx_L1_error) __pyx_v_c_raw = __pyx_t_4; - /* "spavro/fast_binary.pyx":26 + /* "spavro/fast_binary.pyx":29 * raw = fo.read(1) * c_raw = raw * temp_datum = c_raw[0] # <<<<<<<<<<<<<< @@ -3157,7 +3255,7 @@ static PY_LONG_LONG __pyx_f_6spavro_11fast_binary_read_long(PyObject *__pyx_v_fo */ __pyx_v_temp_datum = (__pyx_v_c_raw[0]); - /* "spavro/fast_binary.pyx":27 + /* "spavro/fast_binary.pyx":30 * c_raw = raw * temp_datum = c_raw[0] * accum = temp_datum & 0x7F # <<<<<<<<<<<<<< @@ -3166,7 +3264,7 @@ static PY_LONG_LONG __pyx_f_6spavro_11fast_binary_read_long(PyObject *__pyx_v_fo */ __pyx_v_accum = (__pyx_v_temp_datum & 0x7F); - /* "spavro/fast_binary.pyx":28 + /* "spavro/fast_binary.pyx":31 * temp_datum = c_raw[0] * accum = temp_datum & 0x7F * while (temp_datum & 0x80) != 0: # <<<<<<<<<<<<<< @@ -3177,14 +3275,14 @@ static PY_LONG_LONG __pyx_f_6spavro_11fast_binary_read_long(PyObject *__pyx_v_fo __pyx_t_5 = (((__pyx_v_temp_datum & 0x80) != 0) != 0); if (!__pyx_t_5) break; - /* "spavro/fast_binary.pyx":29 + /* "spavro/fast_binary.pyx":32 * accum = temp_datum & 0x7F * while (temp_datum & 0x80) != 0: * raw = fo.read(1) # <<<<<<<<<<<<<< * c_raw = raw * temp_datum = c_raw[0] */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_fo, __pyx_n_s_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_fo, __pyx_n_s_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { @@ -3198,23 +3296,23 @@ static PY_LONG_LONG __pyx_f_6spavro_11fast_binary_read_long(PyObject *__pyx_v_fo } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_int_1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_int_1); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF_SET(__pyx_v_raw, __pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":30 + /* "spavro/fast_binary.pyx":33 * while (temp_datum & 0x80) != 0: * raw = fo.read(1) * c_raw = raw # <<<<<<<<<<<<<< * temp_datum = c_raw[0] * accum |= (temp_datum & 0x7F) << shift */ - __pyx_t_4 = __Pyx_PyObject_AsWritableString(__pyx_v_raw); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 30, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_AsWritableString(__pyx_v_raw); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 33, __pyx_L1_error) __pyx_v_c_raw = __pyx_t_4; - /* "spavro/fast_binary.pyx":31 + /* "spavro/fast_binary.pyx":34 * raw = fo.read(1) * c_raw = raw * temp_datum = c_raw[0] # <<<<<<<<<<<<<< @@ -3223,7 +3321,7 @@ static PY_LONG_LONG __pyx_f_6spavro_11fast_binary_read_long(PyObject *__pyx_v_fo */ __pyx_v_temp_datum = (__pyx_v_c_raw[0]); - /* "spavro/fast_binary.pyx":32 + /* "spavro/fast_binary.pyx":35 * c_raw = raw * temp_datum = c_raw[0] * accum |= (temp_datum & 0x7F) << shift # <<<<<<<<<<<<<< @@ -3232,7 +3330,7 @@ static PY_LONG_LONG __pyx_f_6spavro_11fast_binary_read_long(PyObject *__pyx_v_fo */ __pyx_v_accum = (__pyx_v_accum | ((__pyx_v_temp_datum & 0x7F) << __pyx_v_shift)); - /* "spavro/fast_binary.pyx":33 + /* "spavro/fast_binary.pyx":36 * temp_datum = c_raw[0] * accum |= (temp_datum & 0x7F) << shift * shift += 7 # <<<<<<<<<<<<<< @@ -3242,7 +3340,7 @@ static PY_LONG_LONG __pyx_f_6spavro_11fast_binary_read_long(PyObject *__pyx_v_fo __pyx_v_shift = (__pyx_v_shift + 7); } - /* "spavro/fast_binary.pyx":37 + /* "spavro/fast_binary.pyx":40 * # bit shift right 1 bit, then xor with the lsb * -1 (which would flip all * # the bits if it is '1' reversing the 2's compliment) * return (accum >> 1) ^ -(accum & 1) # <<<<<<<<<<<<<< @@ -3252,7 +3350,7 @@ static PY_LONG_LONG __pyx_f_6spavro_11fast_binary_read_long(PyObject *__pyx_v_fo __pyx_r = ((__pyx_v_accum >> 1) ^ (-(__pyx_v_accum & 1))); goto __pyx_L0; - /* "spavro/fast_binary.pyx":15 + /* "spavro/fast_binary.pyx":18 * * * cdef long long read_long(fo): # <<<<<<<<<<<<<< @@ -3273,7 +3371,7 @@ static PY_LONG_LONG __pyx_f_6spavro_11fast_binary_read_long(PyObject *__pyx_v_fo return __pyx_r; } -/* "spavro/fast_binary.pyx":40 +/* "spavro/fast_binary.pyx":43 * * * cdef bytes read_bytes(fo): # <<<<<<<<<<<<<< @@ -3288,9 +3386,12 @@ static PyObject *__pyx_f_6spavro_11fast_binary_read_bytes(PyObject *__pyx_v_fo) PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("read_bytes", 0); - /* "spavro/fast_binary.pyx":42 + /* "spavro/fast_binary.pyx":45 * cdef bytes read_bytes(fo): * '''Bytes are a marker for length of bytes and then binary data''' * return fo.read(read_long(fo)) # <<<<<<<<<<<<<< @@ -3298,9 +3399,9 @@ static PyObject *__pyx_f_6spavro_11fast_binary_read_bytes(PyObject *__pyx_v_fo) * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_fo, __pyx_n_s_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_fo, __pyx_n_s_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_f_6spavro_11fast_binary_read_long(__pyx_v_fo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_f_6spavro_11fast_binary_read_long(__pyx_v_fo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { @@ -3315,15 +3416,15 @@ static PyObject *__pyx_f_6spavro_11fast_binary_read_bytes(PyObject *__pyx_v_fo) __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 42, __pyx_L1_error) + if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 45, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "spavro/fast_binary.pyx":40 + /* "spavro/fast_binary.pyx":43 * * * cdef bytes read_bytes(fo): # <<<<<<<<<<<<<< @@ -3345,7 +3446,7 @@ static PyObject *__pyx_f_6spavro_11fast_binary_read_bytes(PyObject *__pyx_v_fo) return __pyx_r; } -/* "spavro/fast_binary.pyx":45 +/* "spavro/fast_binary.pyx":48 * * * cdef read_null(fo): # <<<<<<<<<<<<<< @@ -3358,7 +3459,7 @@ static PyObject *__pyx_f_6spavro_11fast_binary_read_null(CYTHON_UNUSED PyObject __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("read_null", 0); - /* "spavro/fast_binary.pyx":49 + /* "spavro/fast_binary.pyx":52 * null is written as zero bytes * """ * return None # <<<<<<<<<<<<<< @@ -3369,7 +3470,7 @@ static PyObject *__pyx_f_6spavro_11fast_binary_read_null(CYTHON_UNUSED PyObject __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "spavro/fast_binary.pyx":45 + /* "spavro/fast_binary.pyx":48 * * * cdef read_null(fo): # <<<<<<<<<<<<<< @@ -3384,7 +3485,7 @@ static PyObject *__pyx_f_6spavro_11fast_binary_read_null(CYTHON_UNUSED PyObject return __pyx_r; } -/* "spavro/fast_binary.pyx":52 +/* "spavro/fast_binary.pyx":55 * * * cdef bint read_boolean(fo): # <<<<<<<<<<<<<< @@ -3399,16 +3500,19 @@ static int __pyx_f_6spavro_11fast_binary_read_boolean(PyObject *__pyx_v_fo) { PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("read_boolean", 0); - /* "spavro/fast_binary.pyx":57 + /* "spavro/fast_binary.pyx":60 * whose value is either 0 (false) or 1 (true). * """ * return fo.read(1) == b'\x01' # <<<<<<<<<<<<<< * * */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_fo, __pyx_n_s_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_fo, __pyx_n_s_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { @@ -3422,17 +3526,17 @@ static int __pyx_f_6spavro_11fast_binary_read_boolean(PyObject *__pyx_v_fo) { } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_int_1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_int_1); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_kp_b_, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error) + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_kp_b_, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 57, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_4; goto __pyx_L0; - /* "spavro/fast_binary.pyx":52 + /* "spavro/fast_binary.pyx":55 * * * cdef bint read_boolean(fo): # <<<<<<<<<<<<<< @@ -3452,7 +3556,7 @@ static int __pyx_f_6spavro_11fast_binary_read_boolean(PyObject *__pyx_v_fo) { return __pyx_r; } -/* "spavro/fast_binary.pyx":60 +/* "spavro/fast_binary.pyx":63 * * * cdef float read_float(fo): # <<<<<<<<<<<<<< @@ -3469,16 +3573,19 @@ static float __pyx_f_6spavro_11fast_binary_read_float(PyObject *__pyx_v_fo) { PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; char *__pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("read_float", 0); - /* "spavro/fast_binary.pyx":66 + /* "spavro/fast_binary.pyx":69 * Java's floatToIntBits and then encoded in little-endian format. * """ * data = fo.read(4) # <<<<<<<<<<<<<< * cdef char* y = data * return (y)[0] */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_fo, __pyx_n_s_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_fo, __pyx_n_s_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { @@ -3492,23 +3599,23 @@ static float __pyx_f_6spavro_11fast_binary_read_float(PyObject *__pyx_v_fo) { } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_int_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_int_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error) + 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_v_data = __pyx_t_1; __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":67 + /* "spavro/fast_binary.pyx":70 * """ * data = fo.read(4) * cdef char* y = data # <<<<<<<<<<<<<< * return (y)[0] * */ - __pyx_t_4 = __Pyx_PyObject_AsWritableString(__pyx_v_data); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 67, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_AsWritableString(__pyx_v_data); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 70, __pyx_L1_error) __pyx_v_y = __pyx_t_4; - /* "spavro/fast_binary.pyx":68 + /* "spavro/fast_binary.pyx":71 * data = fo.read(4) * cdef char* y = data * return (y)[0] # <<<<<<<<<<<<<< @@ -3518,7 +3625,7 @@ static float __pyx_f_6spavro_11fast_binary_read_float(PyObject *__pyx_v_fo) { __pyx_r = (((float *)__pyx_v_y)[0]); goto __pyx_L0; - /* "spavro/fast_binary.pyx":60 + /* "spavro/fast_binary.pyx":63 * * * cdef float read_float(fo): # <<<<<<<<<<<<<< @@ -3539,7 +3646,7 @@ static float __pyx_f_6spavro_11fast_binary_read_float(PyObject *__pyx_v_fo) { return __pyx_r; } -/* "spavro/fast_binary.pyx":71 +/* "spavro/fast_binary.pyx":74 * * * cdef double read_double(fo): # <<<<<<<<<<<<<< @@ -3556,16 +3663,19 @@ static double __pyx_f_6spavro_11fast_binary_read_double(PyObject *__pyx_v_fo) { PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; char *__pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("read_double", 0); - /* "spavro/fast_binary.pyx":77 + /* "spavro/fast_binary.pyx":80 * Java's doubleToLongBits and then encoded in little-endian format. * """ * data = fo.read(8) # <<<<<<<<<<<<<< * cdef char* y = data * return (y)[0] */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_fo, __pyx_n_s_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_fo, __pyx_n_s_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { @@ -3579,23 +3689,23 @@ static double __pyx_f_6spavro_11fast_binary_read_double(PyObject *__pyx_v_fo) { } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_int_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_int_8); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 77, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_data = __pyx_t_1; __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":78 + /* "spavro/fast_binary.pyx":81 * """ * data = fo.read(8) * cdef char* y = data # <<<<<<<<<<<<<< * return (y)[0] * */ - __pyx_t_4 = __Pyx_PyObject_AsWritableString(__pyx_v_data); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_AsWritableString(__pyx_v_data); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 81, __pyx_L1_error) __pyx_v_y = __pyx_t_4; - /* "spavro/fast_binary.pyx":79 + /* "spavro/fast_binary.pyx":82 * data = fo.read(8) * cdef char* y = data * return (y)[0] # <<<<<<<<<<<<<< @@ -3605,7 +3715,7 @@ static double __pyx_f_6spavro_11fast_binary_read_double(PyObject *__pyx_v_fo) { __pyx_r = (((double *)__pyx_v_y)[0]); goto __pyx_L0; - /* "spavro/fast_binary.pyx":71 + /* "spavro/fast_binary.pyx":74 * * * cdef double read_double(fo): # <<<<<<<<<<<<<< @@ -3626,7 +3736,7 @@ static double __pyx_f_6spavro_11fast_binary_read_double(PyObject *__pyx_v_fo) { return __pyx_r; } -/* "spavro/fast_binary.pyx":81 +/* "spavro/fast_binary.pyx":84 * return (y)[0] * * cdef unicode read_utf8(fo): # <<<<<<<<<<<<<< @@ -3640,21 +3750,24 @@ static PyObject *__pyx_f_6spavro_11fast_binary_read_utf8(PyObject *__pyx_v_fo) { __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("read_utf8", 0); - /* "spavro/fast_binary.pyx":86 + /* "spavro/fast_binary.pyx":89 * that many bytes of UTF-8 encoded character data. * """ * byte_data = read_bytes(fo) # <<<<<<<<<<<<<< * return unicode(byte_data, "utf-8") * */ - __pyx_t_1 = __pyx_f_6spavro_11fast_binary_read_bytes(__pyx_v_fo); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_1 = __pyx_f_6spavro_11fast_binary_read_bytes(__pyx_v_fo); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_byte_data = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":87 + /* "spavro/fast_binary.pyx":90 * """ * byte_data = read_bytes(fo) * return unicode(byte_data, "utf-8") # <<<<<<<<<<<<<< @@ -3662,7 +3775,7 @@ static PyObject *__pyx_f_6spavro_11fast_binary_read_utf8(PyObject *__pyx_v_fo) { * # ====================================================================== */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_byte_data); __Pyx_GIVEREF(__pyx_v_byte_data); @@ -3670,14 +3783,14 @@ static PyObject *__pyx_f_6spavro_11fast_binary_read_utf8(PyObject *__pyx_v_fo) { __Pyx_INCREF(__pyx_kp_s_utf_8); __Pyx_GIVEREF(__pyx_kp_s_utf_8); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_kp_s_utf_8); - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&PyUnicode_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&PyUnicode_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; - /* "spavro/fast_binary.pyx":81 + /* "spavro/fast_binary.pyx":84 * return (y)[0] * * cdef unicode read_utf8(fo): # <<<<<<<<<<<<<< @@ -3698,7 +3811,7 @@ static PyObject *__pyx_f_6spavro_11fast_binary_read_utf8(PyObject *__pyx_v_fo) { return __pyx_r; } -/* "spavro/fast_binary.pyx":94 +/* "spavro/fast_binary.pyx":97 * WriteField = namedtuple('WriteField', ['name', 'writer']) * * cpdef unicode get_type(schema): # <<<<<<<<<<<<<< @@ -3714,9 +3827,12 @@ static PyObject *__pyx_f_6spavro_11fast_binary_get_type(PyObject *__pyx_v_schema int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_type", 0); - /* "spavro/fast_binary.pyx":95 + /* "spavro/fast_binary.pyx":98 * * cpdef unicode get_type(schema): * if isinstance(schema, list): # <<<<<<<<<<<<<< @@ -3727,7 +3843,7 @@ static PyObject *__pyx_f_6spavro_11fast_binary_get_type(PyObject *__pyx_v_schema __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "spavro/fast_binary.pyx":96 + /* "spavro/fast_binary.pyx":99 * cpdef unicode get_type(schema): * if isinstance(schema, list): * return u"union" # <<<<<<<<<<<<<< @@ -3739,7 +3855,7 @@ static PyObject *__pyx_f_6spavro_11fast_binary_get_type(PyObject *__pyx_v_schema __pyx_r = __pyx_n_u_union; goto __pyx_L0; - /* "spavro/fast_binary.pyx":95 + /* "spavro/fast_binary.pyx":98 * * cpdef unicode get_type(schema): * if isinstance(schema, list): # <<<<<<<<<<<<<< @@ -3748,7 +3864,7 @@ static PyObject *__pyx_f_6spavro_11fast_binary_get_type(PyObject *__pyx_v_schema */ } - /* "spavro/fast_binary.pyx":97 + /* "spavro/fast_binary.pyx":100 * if isinstance(schema, list): * return u"union" * elif isinstance(schema, dict): # <<<<<<<<<<<<<< @@ -3759,7 +3875,7 @@ static PyObject *__pyx_f_6spavro_11fast_binary_get_type(PyObject *__pyx_v_schema __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "spavro/fast_binary.pyx":98 + /* "spavro/fast_binary.pyx":101 * return u"union" * elif isinstance(schema, dict): * return unicode(schema['type']) # "record" # <<<<<<<<<<<<<< @@ -3767,16 +3883,16 @@ static PyObject *__pyx_f_6spavro_11fast_binary_get_type(PyObject *__pyx_v_schema * return unicode(schema) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_schema, __pyx_n_s_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_schema, __pyx_n_s_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_Unicode(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Unicode(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L0; - /* "spavro/fast_binary.pyx":97 + /* "spavro/fast_binary.pyx":100 * if isinstance(schema, list): * return u"union" * elif isinstance(schema, dict): # <<<<<<<<<<<<<< @@ -3785,7 +3901,7 @@ static PyObject *__pyx_f_6spavro_11fast_binary_get_type(PyObject *__pyx_v_schema */ } - /* "spavro/fast_binary.pyx":100 + /* "spavro/fast_binary.pyx":103 * return unicode(schema['type']) # "record" * else: * return unicode(schema) # <<<<<<<<<<<<<< @@ -3794,14 +3910,14 @@ static PyObject *__pyx_f_6spavro_11fast_binary_get_type(PyObject *__pyx_v_schema */ /*else*/ { __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyObject_Unicode(__pyx_v_schema); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 100, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Unicode(__pyx_v_schema); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L0; } - /* "spavro/fast_binary.pyx":94 + /* "spavro/fast_binary.pyx":97 * WriteField = namedtuple('WriteField', ['name', 'writer']) * * cpdef unicode get_type(schema): # <<<<<<<<<<<<<< @@ -3838,9 +3954,12 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_get_type(CYTHON_UNUSED PyObject PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_type", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_6spavro_11fast_binary_get_type(__pyx_v_schema, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __pyx_L1_error) + __pyx_t_1 = __pyx_f_6spavro_11fast_binary_get_type(__pyx_v_schema, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3857,7 +3976,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_get_type(CYTHON_UNUSED PyObject return __pyx_r; } -/* "spavro/fast_binary.pyx":103 +/* "spavro/fast_binary.pyx":106 * * * def make_union_reader(union_schema): # <<<<<<<<<<<<<< @@ -3879,7 +3998,7 @@ static PyObject *__pyx_pw_6spavro_11fast_binary_3make_union_reader(PyObject *__p return __pyx_r; } -/* "spavro/fast_binary.pyx":106 +/* "spavro/fast_binary.pyx":109 * cdef list readers = [get_reader(schema) for schema in union_schema] * * def union_reader(fo): # <<<<<<<<<<<<<< @@ -3921,11 +4040,14 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_union_reader_union_reader PyObject *__pyx_t_11 = NULL; PyObject *__pyx_t_12 = NULL; PyObject *__pyx_t_13 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("union_reader", 0); __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct__make_union_reader *) __Pyx_CyFunction_GetClosure(__pyx_self); __pyx_cur_scope = __pyx_outer_scope; - /* "spavro/fast_binary.pyx":108 + /* "spavro/fast_binary.pyx":111 * def union_reader(fo): * '''Read the long index for which schema to process, then use that''' * cdef long long union_index = read_long(fo) # <<<<<<<<<<<<<< @@ -3934,7 +4056,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_union_reader_union_reader */ __pyx_v_union_index = __pyx_f_6spavro_11fast_binary_read_long(__pyx_v_fo); - /* "spavro/fast_binary.pyx":109 + /* "spavro/fast_binary.pyx":112 * '''Read the long index for which schema to process, then use that''' * cdef long long union_index = read_long(fo) * try: # <<<<<<<<<<<<<< @@ -3950,7 +4072,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_union_reader_union_reader __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { - /* "spavro/fast_binary.pyx":110 + /* "spavro/fast_binary.pyx":113 * cdef long long union_index = read_long(fo) * try: * return readers[union_index](fo) # <<<<<<<<<<<<<< @@ -3958,12 +4080,12 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_union_reader_union_reader * raise TypeError("Unable to process union schema {}, union index '{}' doesn't exist. This is most likely because the read schema being used is not compatible with the write schema used to write the data.".format(repr(union_schema), union_index)) */ __Pyx_XDECREF(__pyx_r); - if (unlikely(!__pyx_cur_scope->__pyx_v_readers)) { __Pyx_RaiseClosureNameError("readers"); __PYX_ERR(0, 110, __pyx_L3_error) } + if (unlikely(!__pyx_cur_scope->__pyx_v_readers)) { __Pyx_RaiseClosureNameError("readers"); __PYX_ERR(0, 113, __pyx_L3_error) } if (unlikely(__pyx_cur_scope->__pyx_v_readers == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 110, __pyx_L3_error) + __PYX_ERR(0, 113, __pyx_L3_error) } - __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_cur_scope->__pyx_v_readers, __pyx_v_union_index, PY_LONG_LONG, 1, __Pyx_PyInt_From_PY_LONG_LONG, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 110, __pyx_L3_error) + __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_cur_scope->__pyx_v_readers, __pyx_v_union_index, PY_LONG_LONG, 1, __Pyx_PyInt_From_PY_LONG_LONG, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 113, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { @@ -3977,14 +4099,14 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_union_reader_union_reader } __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_fo) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_fo); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 110, __pyx_L3_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 113, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L7_try_return; - /* "spavro/fast_binary.pyx":109 + /* "spavro/fast_binary.pyx":112 * '''Read the long index for which schema to process, then use that''' * cdef long long union_index = read_long(fo) * try: # <<<<<<<<<<<<<< @@ -3997,7 +4119,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_union_reader_union_reader __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "spavro/fast_binary.pyx":111 + /* "spavro/fast_binary.pyx":114 * try: * return readers[union_index](fo) * except IndexError: # <<<<<<<<<<<<<< @@ -4007,27 +4129,27 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_union_reader_union_reader __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_IndexError); if (__pyx_t_7) { __Pyx_AddTraceback("spavro.fast_binary.make_union_reader.union_reader", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 111, __pyx_L5_except_error) + if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 114, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_6); - /* "spavro/fast_binary.pyx":112 + /* "spavro/fast_binary.pyx":115 * return readers[union_index](fo) * except IndexError: * raise TypeError("Unable to process union schema {}, union index '{}' doesn't exist. This is most likely because the read schema being used is not compatible with the write schema used to write the data.".format(repr(union_schema), union_index)) # <<<<<<<<<<<<<< * union_reader.__reduce__ = lambda: (make_union_reader, (union_schema,)) * return union_reader */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Unable_to_process_union_schema_u, __pyx_n_s_format); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 112, __pyx_L5_except_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Unable_to_process_union_schema_u, __pyx_n_s_format); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 115, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_9); - if (unlikely(!__pyx_cur_scope->__pyx_v_union_schema)) { __Pyx_RaiseClosureNameError("union_schema"); __PYX_ERR(0, 112, __pyx_L5_except_error) } + if (unlikely(!__pyx_cur_scope->__pyx_v_union_schema)) { __Pyx_RaiseClosureNameError("union_schema"); __PYX_ERR(0, 115, __pyx_L5_except_error) } __pyx_t_10 = __pyx_cur_scope->__pyx_v_union_schema; __Pyx_INCREF(__pyx_t_10); - __pyx_t_11 = PyObject_Repr(__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 112, __pyx_L5_except_error) + __pyx_t_11 = PyObject_Repr(__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 115, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_v_union_index); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 112, __pyx_L5_except_error) + __pyx_t_10 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_v_union_index); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 115, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_12 = NULL; __pyx_t_7 = 0; @@ -4044,7 +4166,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_union_reader_union_reader #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_9)) { PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_11, __pyx_t_10}; - __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 112, __pyx_L5_except_error) + __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 115, __pyx_L5_except_error) __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; @@ -4054,7 +4176,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_union_reader_union_reader #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_11, __pyx_t_10}; - __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 112, __pyx_L5_except_error) + __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 115, __pyx_L5_except_error) __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; @@ -4062,7 +4184,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_union_reader_union_reader } else #endif { - __pyx_t_13 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 112, __pyx_L5_except_error) + __pyx_t_13 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 115, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_13); if (__pyx_t_12) { __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12); __pyx_t_12 = NULL; @@ -4073,22 +4195,22 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_union_reader_union_reader PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_7, __pyx_t_10); __pyx_t_11 = 0; __pyx_t_10 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_13, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 112, __pyx_L5_except_error) + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_13, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 115, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; } __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 112, __pyx_L5_except_error) + __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 115, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_Raise(__pyx_t_9, 0, 0, 0); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __PYX_ERR(0, 112, __pyx_L5_except_error) + __PYX_ERR(0, 115, __pyx_L5_except_error) } goto __pyx_L5_except_error; __pyx_L5_except_error:; - /* "spavro/fast_binary.pyx":109 + /* "spavro/fast_binary.pyx":112 * '''Read the long index for which schema to process, then use that''' * cdef long long union_index = read_long(fo) * try: # <<<<<<<<<<<<<< @@ -4108,7 +4230,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_union_reader_union_reader goto __pyx_L0; } - /* "spavro/fast_binary.pyx":106 + /* "spavro/fast_binary.pyx":109 * cdef list readers = [get_reader(schema) for schema in union_schema] * * def union_reader(fo): # <<<<<<<<<<<<<< @@ -4135,7 +4257,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_union_reader_union_reader return __pyx_r; } -/* "spavro/fast_binary.pyx":113 +/* "spavro/fast_binary.pyx":116 * except IndexError: * raise TypeError("Unable to process union schema {}, union index '{}' doesn't exist. This is most likely because the read schema being used is not compatible with the write schema used to write the data.".format(repr(union_schema), union_index)) * union_reader.__reduce__ = lambda: (make_union_reader, (union_schema,)) # <<<<<<<<<<<<<< @@ -4165,19 +4287,22 @@ static PyObject *__pyx_lambda_funcdef_lambda(PyObject *__pyx_self) { PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("lambda", 0); __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct__make_union_reader *) __Pyx_CyFunction_GetClosure(__pyx_self); __pyx_cur_scope = __pyx_outer_scope; __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_union_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_union_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely(!__pyx_cur_scope->__pyx_v_union_schema)) { __Pyx_RaiseClosureNameError("union_schema"); __PYX_ERR(0, 113, __pyx_L1_error) } - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error) + if (unlikely(!__pyx_cur_scope->__pyx_v_union_schema)) { __Pyx_RaiseClosureNameError("union_schema"); __PYX_ERR(0, 116, __pyx_L1_error) } + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_union_schema); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_union_schema); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_union_schema); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 113, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); @@ -4202,7 +4327,7 @@ static PyObject *__pyx_lambda_funcdef_lambda(PyObject *__pyx_self) { return __pyx_r; } -/* "spavro/fast_binary.pyx":103 +/* "spavro/fast_binary.pyx":106 * * * def make_union_reader(union_schema): # <<<<<<<<<<<<<< @@ -4223,12 +4348,15 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_2make_union_reader(CYTHON_UNUSED PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("make_union_reader", 0); __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct__make_union_reader *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct__make_union_reader(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct__make_union_reader, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct__make_union_reader *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 103, __pyx_L1_error) + __PYX_ERR(0, 106, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } @@ -4236,39 +4364,39 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_2make_union_reader(CYTHON_UNUSED __Pyx_INCREF(__pyx_cur_scope->__pyx_v_union_schema); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_union_schema); - /* "spavro/fast_binary.pyx":104 + /* "spavro/fast_binary.pyx":107 * * def make_union_reader(union_schema): * cdef list readers = [get_reader(schema) for schema in union_schema] # <<<<<<<<<<<<<< * * def union_reader(fo): */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_union_schema)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_union_schema)) { __pyx_t_2 = __pyx_cur_scope->__pyx_v_union_schema; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; __pyx_t_4 = NULL; } else { - __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_union_schema); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L1_error) + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_union_schema); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 107, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 104, __pyx_L1_error) + __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 107, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_4)) { if (likely(PyList_CheckExact(__pyx_t_2))) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 104, __pyx_L1_error) + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 107, __pyx_L1_error) #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 104, __pyx_L1_error) + __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 107, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif } else { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 104, __pyx_L1_error) + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 107, __pyx_L1_error) #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 104, __pyx_L1_error) + __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 107, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif } @@ -4278,7 +4406,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_2make_union_reader(CYTHON_UNUSED PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 104, __pyx_L1_error) + else __PYX_ERR(0, 107, __pyx_L1_error) } break; } @@ -4286,7 +4414,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_2make_union_reader(CYTHON_UNUSED } __Pyx_XDECREF_SET(__pyx_v_schema, __pyx_t_5); __pyx_t_5 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_get_reader); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_get_reader); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 107, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -4300,10 +4428,10 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_2make_union_reader(CYTHON_UNUSED } __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_schema) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_schema); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 104, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 107, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 104, __pyx_L1_error) + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 107, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -4311,31 +4439,31 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_2make_union_reader(CYTHON_UNUSED __pyx_cur_scope->__pyx_v_readers = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":106 + /* "spavro/fast_binary.pyx":109 * cdef list readers = [get_reader(schema) for schema in union_schema] * * def union_reader(fo): # <<<<<<<<<<<<<< * '''Read the long index for which schema to process, then use that''' * cdef long long union_index = read_long(fo) */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17make_union_reader_1union_reader, 0, __pyx_n_s_make_union_reader_locals_union_r, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__3)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error) + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17make_union_reader_1union_reader, 0, __pyx_n_s_make_union_reader_locals_union_r, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__3)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_union_reader = __pyx_t_1; __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":113 + /* "spavro/fast_binary.pyx":116 * except IndexError: * raise TypeError("Unable to process union schema {}, union index '{}' doesn't exist. This is most likely because the read schema being used is not compatible with the write schema used to write the data.".format(repr(union_schema), union_index)) * union_reader.__reduce__ = lambda: (make_union_reader, (union_schema,)) # <<<<<<<<<<<<<< * return union_reader * */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17make_union_reader_2lambda, 0, __pyx_n_s_make_union_reader_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error) + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17make_union_reader_2lambda, 0, __pyx_n_s_make_union_reader_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_union_reader, __pyx_n_s_reduce, __pyx_t_1) < 0) __PYX_ERR(0, 113, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_union_reader, __pyx_n_s_reduce, __pyx_t_1) < 0) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":114 + /* "spavro/fast_binary.pyx":117 * raise TypeError("Unable to process union schema {}, union index '{}' doesn't exist. This is most likely because the read schema being used is not compatible with the write schema used to write the data.".format(repr(union_schema), union_index)) * union_reader.__reduce__ = lambda: (make_union_reader, (union_schema,)) * return union_reader # <<<<<<<<<<<<<< @@ -4347,7 +4475,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_2make_union_reader(CYTHON_UNUSED __pyx_r = __pyx_v_union_reader; goto __pyx_L0; - /* "spavro/fast_binary.pyx":103 + /* "spavro/fast_binary.pyx":106 * * * def make_union_reader(union_schema): # <<<<<<<<<<<<<< @@ -4373,7 +4501,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_2make_union_reader(CYTHON_UNUSED return __pyx_r; } -/* "spavro/fast_binary.pyx":117 +/* "spavro/fast_binary.pyx":120 * * * def make_record_reader(schema): # <<<<<<<<<<<<<< @@ -4395,7 +4523,7 @@ static PyObject *__pyx_pw_6spavro_11fast_binary_5make_record_reader(PyObject *__ return __pyx_r; } -/* "spavro/fast_binary.pyx":120 +/* "spavro/fast_binary.pyx":123 * cdef list fields = [ReadField(field['name'], get_reader(field['type']), get_type(field['type']) == 'skip') for field in schema['fields']] * * def record_reader(fo): # <<<<<<<<<<<<<< @@ -4433,11 +4561,14 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_18make_record_reader_record_read PyObject *__pyx_t_8 = NULL; int __pyx_t_9; PyObject *__pyx_t_10 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("record_reader", 0); __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader *) __Pyx_CyFunction_GetClosure(__pyx_self); __pyx_cur_scope = __pyx_outer_scope; - /* "spavro/fast_binary.pyx":121 + /* "spavro/fast_binary.pyx":124 * * def record_reader(fo): * return {field.name: field.reader(fo) for field in fields if not (field.skip and field.reader(fo) is None)} # <<<<<<<<<<<<<< @@ -4446,34 +4577,34 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_18make_record_reader_record_read */ __Pyx_XDECREF(__pyx_r); { /* enter inner scope */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L5_error) + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely(!__pyx_cur_scope->__pyx_v_fields)) { __Pyx_RaiseClosureNameError("fields"); __PYX_ERR(0, 121, __pyx_L5_error) } + if (unlikely(!__pyx_cur_scope->__pyx_v_fields)) { __Pyx_RaiseClosureNameError("fields"); __PYX_ERR(0, 124, __pyx_L5_error) } if (unlikely(__pyx_cur_scope->__pyx_v_fields == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 121, __pyx_L5_error) + __PYX_ERR(0, 124, __pyx_L5_error) } __pyx_t_2 = __pyx_cur_scope->__pyx_v_fields; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; for (;;) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 121, __pyx_L5_error) + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 124, __pyx_L5_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 121, __pyx_L5_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 124, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_4); #endif __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_field, __pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_7genexpr__pyx_v_field, __pyx_n_s_skip); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 121, __pyx_L5_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_7genexpr__pyx_v_field, __pyx_n_s_skip); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 124, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 121, __pyx_L5_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 124, __pyx_L5_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { } else { __pyx_t_5 = __pyx_t_6; goto __pyx_L9_bool_binop_done; } - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_7genexpr__pyx_v_field, __pyx_n_s_reader); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 121, __pyx_L5_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_7genexpr__pyx_v_field, __pyx_n_s_reader); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 124, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { @@ -4487,7 +4618,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_18make_record_reader_record_read } __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_v_fo) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_fo); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 121, __pyx_L5_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 124, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_6 = (__pyx_t_4 == Py_None); @@ -4497,9 +4628,9 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_18make_record_reader_record_read __pyx_L9_bool_binop_done:; __pyx_t_9 = ((!__pyx_t_5) != 0); if (__pyx_t_9) { - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_7genexpr__pyx_v_field, __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 121, __pyx_L5_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_7genexpr__pyx_v_field, __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 124, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_7genexpr__pyx_v_field, __pyx_n_s_reader); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 121, __pyx_L5_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_7genexpr__pyx_v_field, __pyx_n_s_reader); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 124, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_10 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { @@ -4513,10 +4644,10 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_18make_record_reader_record_read } __pyx_t_7 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_10, __pyx_v_fo) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_fo); __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 121, __pyx_L5_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 124, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(PyDict_SetItem(__pyx_t_1, (PyObject*)__pyx_t_4, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 121, __pyx_L5_error) + if (unlikely(PyDict_SetItem(__pyx_t_1, (PyObject*)__pyx_t_4, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 124, __pyx_L5_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } @@ -4533,7 +4664,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_18make_record_reader_record_read __pyx_t_1 = 0; goto __pyx_L0; - /* "spavro/fast_binary.pyx":120 + /* "spavro/fast_binary.pyx":123 * cdef list fields = [ReadField(field['name'], get_reader(field['type']), get_type(field['type']) == 'skip') for field in schema['fields']] * * def record_reader(fo): # <<<<<<<<<<<<<< @@ -4558,7 +4689,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_18make_record_reader_record_read return __pyx_r; } -/* "spavro/fast_binary.pyx":122 +/* "spavro/fast_binary.pyx":125 * def record_reader(fo): * return {field.name: field.reader(fo) for field in fields if not (field.skip and field.reader(fo) is None)} * record_reader.__reduce__ = lambda: (make_record_reader, (schema,)) # <<<<<<<<<<<<<< @@ -4588,19 +4719,22 @@ static PyObject *__pyx_lambda_funcdef_lambda1(PyObject *__pyx_self) { PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("lambda1", 0); __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader *) __Pyx_CyFunction_GetClosure(__pyx_self); __pyx_cur_scope = __pyx_outer_scope; __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_record_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_record_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely(!__pyx_cur_scope->__pyx_v_schema)) { __Pyx_RaiseClosureNameError("schema"); __PYX_ERR(0, 122, __pyx_L1_error) } - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error) + if (unlikely(!__pyx_cur_scope->__pyx_v_schema)) { __Pyx_RaiseClosureNameError("schema"); __PYX_ERR(0, 125, __pyx_L1_error) } + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_schema); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 122, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); @@ -4625,7 +4759,7 @@ static PyObject *__pyx_lambda_funcdef_lambda1(PyObject *__pyx_self) { return __pyx_r; } -/* "spavro/fast_binary.pyx":117 +/* "spavro/fast_binary.pyx":120 * * * def make_record_reader(schema): # <<<<<<<<<<<<<< @@ -4651,12 +4785,15 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_4make_record_reader(CYTHON_UNUSE PyObject *__pyx_t_11 = NULL; int __pyx_t_12; int __pyx_t_13; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("make_record_reader", 0); __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 117, __pyx_L1_error) + __PYX_ERR(0, 120, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } @@ -4664,24 +4801,24 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_4make_record_reader(CYTHON_UNUSE __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); - /* "spavro/fast_binary.pyx":118 + /* "spavro/fast_binary.pyx":121 * * def make_record_reader(schema): * cdef list fields = [ReadField(field['name'], get_reader(field['type']), get_type(field['type']) == 'skip') for field in schema['fields']] # <<<<<<<<<<<<<< * * def record_reader(fo): */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_schema, __pyx_n_s_fields); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_schema, __pyx_n_s_fields); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; __pyx_t_5 = NULL; } else { - __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 121, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; for (;;) { @@ -4689,17 +4826,17 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_4make_record_reader(CYTHON_UNUSE if (likely(PyList_CheckExact(__pyx_t_3))) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 121, __pyx_L1_error) #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif } else { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 121, __pyx_L1_error) #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif } @@ -4709,7 +4846,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_4make_record_reader(CYTHON_UNUSE PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 118, __pyx_L1_error) + else __PYX_ERR(0, 121, __pyx_L1_error) } break; } @@ -4719,13 +4856,13 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_4make_record_reader(CYTHON_UNUSE __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_field, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_ReadField); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_ReadField); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_field, __pyx_n_s_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_field, __pyx_n_s_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_get_reader); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_get_reader); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_field, __pyx_n_s_type); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_field, __pyx_n_s_type); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_11 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { @@ -4740,17 +4877,17 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_4make_record_reader(CYTHON_UNUSE __pyx_t_8 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_11, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 118, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_field, __pyx_n_s_type); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_field, __pyx_n_s_type); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = __pyx_f_6spavro_11fast_binary_get_type(__pyx_t_9, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_10 = __pyx_f_6spavro_11fast_binary_get_type(__pyx_t_9, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_12 = (__Pyx_PyUnicode_Equals(__pyx_t_10, __pyx_n_s_skip, Py_EQ)); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_12 = (__Pyx_PyUnicode_Equals(__pyx_t_10, __pyx_n_s_skip, Py_EQ)); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyBool_FromLong(__pyx_t_12); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyBool_FromLong(__pyx_t_12); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_9 = NULL; __pyx_t_13 = 0; @@ -4767,7 +4904,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_4make_record_reader(CYTHON_UNUSE #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_t_7, __pyx_t_8, __pyx_t_10}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_13, 3+__pyx_t_13); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_13, 3+__pyx_t_13); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; @@ -4778,7 +4915,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_4make_record_reader(CYTHON_UNUSE #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_t_7, __pyx_t_8, __pyx_t_10}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_13, 3+__pyx_t_13); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_13, 3+__pyx_t_13); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; @@ -4787,7 +4924,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_4make_record_reader(CYTHON_UNUSE } else #endif { - __pyx_t_11 = PyTuple_New(3+__pyx_t_13); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_11 = PyTuple_New(3+__pyx_t_13); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); if (__pyx_t_9) { __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL; @@ -4801,12 +4938,12 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_4make_record_reader(CYTHON_UNUSE __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_10 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 118, __pyx_L1_error) + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -4814,31 +4951,31 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_4make_record_reader(CYTHON_UNUSE __pyx_cur_scope->__pyx_v_fields = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":120 + /* "spavro/fast_binary.pyx":123 * cdef list fields = [ReadField(field['name'], get_reader(field['type']), get_type(field['type']) == 'skip') for field in schema['fields']] * * def record_reader(fo): # <<<<<<<<<<<<<< * return {field.name: field.reader(fo) for field in fields if not (field.skip and field.reader(fo) is None)} * record_reader.__reduce__ = lambda: (make_record_reader, (schema,)) */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_18make_record_reader_1record_reader, 0, __pyx_n_s_make_record_reader_locals_record, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__5)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error) + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_18make_record_reader_1record_reader, 0, __pyx_n_s_make_record_reader_locals_record, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__5)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_record_reader = __pyx_t_1; __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":122 + /* "spavro/fast_binary.pyx":125 * def record_reader(fo): * return {field.name: field.reader(fo) for field in fields if not (field.skip and field.reader(fo) is None)} * record_reader.__reduce__ = lambda: (make_record_reader, (schema,)) # <<<<<<<<<<<<<< * return record_reader * */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_18make_record_reader_2lambda1, 0, __pyx_n_s_make_record_reader_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error) + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_18make_record_reader_2lambda1, 0, __pyx_n_s_make_record_reader_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_record_reader, __pyx_n_s_reduce, __pyx_t_1) < 0) __PYX_ERR(0, 122, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_record_reader, __pyx_n_s_reduce, __pyx_t_1) < 0) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":123 + /* "spavro/fast_binary.pyx":126 * return {field.name: field.reader(fo) for field in fields if not (field.skip and field.reader(fo) is None)} * record_reader.__reduce__ = lambda: (make_record_reader, (schema,)) * return record_reader # <<<<<<<<<<<<<< @@ -4850,7 +4987,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_4make_record_reader(CYTHON_UNUSE __pyx_r = __pyx_v_record_reader; goto __pyx_L0; - /* "spavro/fast_binary.pyx":117 + /* "spavro/fast_binary.pyx":120 * * * def make_record_reader(schema): # <<<<<<<<<<<<<< @@ -4879,7 +5016,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_4make_record_reader(CYTHON_UNUSE return __pyx_r; } -/* "spavro/fast_binary.pyx":126 +/* "spavro/fast_binary.pyx":129 * * * def make_enum_reader(schema): # <<<<<<<<<<<<<< @@ -4901,7 +5038,7 @@ static PyObject *__pyx_pw_6spavro_11fast_binary_7make_enum_reader(PyObject *__py return __pyx_r; } -/* "spavro/fast_binary.pyx":129 +/* "spavro/fast_binary.pyx":132 * cdef list symbols = schema['symbols'] * * def enum_reader(fo): # <<<<<<<<<<<<<< @@ -4930,11 +5067,14 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_16make_enum_reader_enum_reader(P __Pyx_RefNannyDeclarations PY_LONG_LONG __pyx_t_1; PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("enum_reader", 0); __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader *) __Pyx_CyFunction_GetClosure(__pyx_self); __pyx_cur_scope = __pyx_outer_scope; - /* "spavro/fast_binary.pyx":130 + /* "spavro/fast_binary.pyx":133 * * def enum_reader(fo): * return symbols[read_long(fo)] # <<<<<<<<<<<<<< @@ -4942,19 +5082,19 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_16make_enum_reader_enum_reader(P * return enum_reader */ __Pyx_XDECREF(__pyx_r); - if (unlikely(!__pyx_cur_scope->__pyx_v_symbols)) { __Pyx_RaiseClosureNameError("symbols"); __PYX_ERR(0, 130, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_v_symbols)) { __Pyx_RaiseClosureNameError("symbols"); __PYX_ERR(0, 133, __pyx_L1_error) } if (unlikely(__pyx_cur_scope->__pyx_v_symbols == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 130, __pyx_L1_error) + __PYX_ERR(0, 133, __pyx_L1_error) } __pyx_t_1 = __pyx_f_6spavro_11fast_binary_read_long(__pyx_v_fo); - __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_cur_scope->__pyx_v_symbols, __pyx_t_1, PY_LONG_LONG, 1, __Pyx_PyInt_From_PY_LONG_LONG, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 130, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_cur_scope->__pyx_v_symbols, __pyx_t_1, PY_LONG_LONG, 1, __Pyx_PyInt_From_PY_LONG_LONG, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 133, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "spavro/fast_binary.pyx":129 + /* "spavro/fast_binary.pyx":132 * cdef list symbols = schema['symbols'] * * def enum_reader(fo): # <<<<<<<<<<<<<< @@ -4973,7 +5113,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_16make_enum_reader_enum_reader(P return __pyx_r; } -/* "spavro/fast_binary.pyx":131 +/* "spavro/fast_binary.pyx":134 * def enum_reader(fo): * return symbols[read_long(fo)] * enum_reader.__reduce__ = lambda: (make_enum_reader, (schema,)) # <<<<<<<<<<<<<< @@ -5003,19 +5143,22 @@ static PyObject *__pyx_lambda_funcdef_lambda2(PyObject *__pyx_self) { PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("lambda2", 0); __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader *) __Pyx_CyFunction_GetClosure(__pyx_self); __pyx_cur_scope = __pyx_outer_scope; __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_enum_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_enum_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely(!__pyx_cur_scope->__pyx_v_schema)) { __Pyx_RaiseClosureNameError("schema"); __PYX_ERR(0, 131, __pyx_L1_error) } - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 131, __pyx_L1_error) + if (unlikely(!__pyx_cur_scope->__pyx_v_schema)) { __Pyx_RaiseClosureNameError("schema"); __PYX_ERR(0, 134, __pyx_L1_error) } + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_schema); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 131, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 134, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); @@ -5040,7 +5183,7 @@ static PyObject *__pyx_lambda_funcdef_lambda2(PyObject *__pyx_self) { return __pyx_r; } -/* "spavro/fast_binary.pyx":126 +/* "spavro/fast_binary.pyx":129 * * * def make_enum_reader(schema): # <<<<<<<<<<<<<< @@ -5054,12 +5197,15 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_6make_enum_reader(CYTHON_UNUSED PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("make_enum_reader", 0); __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 126, __pyx_L1_error) + __PYX_ERR(0, 129, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } @@ -5067,45 +5213,45 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_6make_enum_reader(CYTHON_UNUSED __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); - /* "spavro/fast_binary.pyx":127 + /* "spavro/fast_binary.pyx":130 * * def make_enum_reader(schema): * cdef list symbols = schema['symbols'] # <<<<<<<<<<<<<< * * def enum_reader(fo): */ - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_schema, __pyx_n_s_symbols); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_schema, __pyx_n_s_symbols); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 127, __pyx_L1_error) + if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 130, __pyx_L1_error) __Pyx_GIVEREF(__pyx_t_1); __pyx_cur_scope->__pyx_v_symbols = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":129 + /* "spavro/fast_binary.pyx":132 * cdef list symbols = schema['symbols'] * * def enum_reader(fo): # <<<<<<<<<<<<<< * return symbols[read_long(fo)] * enum_reader.__reduce__ = lambda: (make_enum_reader, (schema,)) */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_16make_enum_reader_1enum_reader, 0, __pyx_n_s_make_enum_reader_locals_enum_rea, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__7)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error) + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_16make_enum_reader_1enum_reader, 0, __pyx_n_s_make_enum_reader_locals_enum_rea, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__7)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_enum_reader = __pyx_t_1; __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":131 + /* "spavro/fast_binary.pyx":134 * def enum_reader(fo): * return symbols[read_long(fo)] * enum_reader.__reduce__ = lambda: (make_enum_reader, (schema,)) # <<<<<<<<<<<<<< * return enum_reader * */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_16make_enum_reader_2lambda2, 0, __pyx_n_s_make_enum_reader_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 131, __pyx_L1_error) + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_16make_enum_reader_2lambda2, 0, __pyx_n_s_make_enum_reader_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_enum_reader, __pyx_n_s_reduce, __pyx_t_1) < 0) __PYX_ERR(0, 131, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_enum_reader, __pyx_n_s_reduce, __pyx_t_1) < 0) __PYX_ERR(0, 134, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":132 + /* "spavro/fast_binary.pyx":135 * return symbols[read_long(fo)] * enum_reader.__reduce__ = lambda: (make_enum_reader, (schema,)) * return enum_reader # <<<<<<<<<<<<<< @@ -5117,7 +5263,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_6make_enum_reader(CYTHON_UNUSED __pyx_r = __pyx_v_enum_reader; goto __pyx_L0; - /* "spavro/fast_binary.pyx":126 + /* "spavro/fast_binary.pyx":129 * * * def make_enum_reader(schema): # <<<<<<<<<<<<<< @@ -5138,7 +5284,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_6make_enum_reader(CYTHON_UNUSED return __pyx_r; } -/* "spavro/fast_binary.pyx":134 +/* "spavro/fast_binary.pyx":137 * return enum_reader * * def make_array_reader(schema): # <<<<<<<<<<<<<< @@ -5160,7 +5306,7 @@ static PyObject *__pyx_pw_6spavro_11fast_binary_9make_array_reader(PyObject *__p return __pyx_r; } -/* "spavro/fast_binary.pyx":136 +/* "spavro/fast_binary.pyx":139 * def make_array_reader(schema): * item_reader = get_reader(schema['items']) * def array_reader(fo): # <<<<<<<<<<<<<< @@ -5199,23 +5345,26 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_array_reader_array_reader PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; int __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("array_reader", 0); __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader *) __Pyx_CyFunction_GetClosure(__pyx_self); __pyx_cur_scope = __pyx_outer_scope; - /* "spavro/fast_binary.pyx":138 + /* "spavro/fast_binary.pyx":141 * def array_reader(fo): * cdef long block_count * cdef list read_items = [] # <<<<<<<<<<<<<< * block_count = read_long(fo) * while block_count != 0: */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 141, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_read_items = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":139 + /* "spavro/fast_binary.pyx":142 * cdef long block_count * cdef list read_items = [] * block_count = read_long(fo) # <<<<<<<<<<<<<< @@ -5224,7 +5373,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_array_reader_array_reader */ __pyx_v_block_count = __pyx_f_6spavro_11fast_binary_read_long(__pyx_v_fo); - /* "spavro/fast_binary.pyx":140 + /* "spavro/fast_binary.pyx":143 * cdef list read_items = [] * block_count = read_long(fo) * while block_count != 0: # <<<<<<<<<<<<<< @@ -5235,7 +5384,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_array_reader_array_reader __pyx_t_2 = ((__pyx_v_block_count != 0) != 0); if (!__pyx_t_2) break; - /* "spavro/fast_binary.pyx":141 + /* "spavro/fast_binary.pyx":144 * block_count = read_long(fo) * while block_count != 0: * if block_count < 0: # <<<<<<<<<<<<<< @@ -5245,7 +5394,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_array_reader_array_reader __pyx_t_2 = ((__pyx_v_block_count < 0) != 0); if (__pyx_t_2) { - /* "spavro/fast_binary.pyx":142 + /* "spavro/fast_binary.pyx":145 * while block_count != 0: * if block_count < 0: * block_count = -block_count # <<<<<<<<<<<<<< @@ -5254,7 +5403,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_array_reader_array_reader */ __pyx_v_block_count = (-__pyx_v_block_count); - /* "spavro/fast_binary.pyx":143 + /* "spavro/fast_binary.pyx":146 * if block_count < 0: * block_count = -block_count * block_size = read_long(fo) # <<<<<<<<<<<<<< @@ -5263,7 +5412,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_array_reader_array_reader */ __pyx_v_block_size = __pyx_f_6spavro_11fast_binary_read_long(__pyx_v_fo); - /* "spavro/fast_binary.pyx":141 + /* "spavro/fast_binary.pyx":144 * block_count = read_long(fo) * while block_count != 0: * if block_count < 0: # <<<<<<<<<<<<<< @@ -5272,7 +5421,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_array_reader_array_reader */ } - /* "spavro/fast_binary.pyx":144 + /* "spavro/fast_binary.pyx":147 * block_count = -block_count * block_size = read_long(fo) * for i in range(block_count): # <<<<<<<<<<<<<< @@ -5284,14 +5433,14 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_array_reader_array_reader for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { __pyx_v_i = __pyx_t_5; - /* "spavro/fast_binary.pyx":145 + /* "spavro/fast_binary.pyx":148 * block_size = read_long(fo) * for i in range(block_count): * read_items.append(item_reader(fo)) # <<<<<<<<<<<<<< * block_count = read_long(fo) * return read_items */ - if (unlikely(!__pyx_cur_scope->__pyx_v_item_reader)) { __Pyx_RaiseClosureNameError("item_reader"); __PYX_ERR(0, 145, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_v_item_reader)) { __Pyx_RaiseClosureNameError("item_reader"); __PYX_ERR(0, 148, __pyx_L1_error) } __Pyx_INCREF(__pyx_cur_scope->__pyx_v_item_reader); __pyx_t_6 = __pyx_cur_scope->__pyx_v_item_reader; __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -5305,14 +5454,14 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_array_reader_array_reader } __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_fo) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_fo); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_read_items, __pyx_t_1); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_read_items, __pyx_t_1); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "spavro/fast_binary.pyx":146 + /* "spavro/fast_binary.pyx":149 * for i in range(block_count): * read_items.append(item_reader(fo)) * block_count = read_long(fo) # <<<<<<<<<<<<<< @@ -5322,7 +5471,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_array_reader_array_reader __pyx_v_block_count = __pyx_f_6spavro_11fast_binary_read_long(__pyx_v_fo); } - /* "spavro/fast_binary.pyx":147 + /* "spavro/fast_binary.pyx":150 * read_items.append(item_reader(fo)) * block_count = read_long(fo) * return read_items # <<<<<<<<<<<<<< @@ -5334,7 +5483,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_array_reader_array_reader __pyx_r = __pyx_v_read_items; goto __pyx_L0; - /* "spavro/fast_binary.pyx":136 + /* "spavro/fast_binary.pyx":139 * def make_array_reader(schema): * item_reader = get_reader(schema['items']) * def array_reader(fo): # <<<<<<<<<<<<<< @@ -5356,7 +5505,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_array_reader_array_reader return __pyx_r; } -/* "spavro/fast_binary.pyx":148 +/* "spavro/fast_binary.pyx":151 * block_count = read_long(fo) * return read_items * array_reader.__reduce__ = lambda: (make_array_reader, (schema,)) # <<<<<<<<<<<<<< @@ -5386,19 +5535,22 @@ static PyObject *__pyx_lambda_funcdef_lambda3(PyObject *__pyx_self) { PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("lambda3", 0); __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader *) __Pyx_CyFunction_GetClosure(__pyx_self); __pyx_cur_scope = __pyx_outer_scope; __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_array_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_array_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely(!__pyx_cur_scope->__pyx_v_schema)) { __Pyx_RaiseClosureNameError("schema"); __PYX_ERR(0, 148, __pyx_L1_error) } - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error) + if (unlikely(!__pyx_cur_scope->__pyx_v_schema)) { __Pyx_RaiseClosureNameError("schema"); __PYX_ERR(0, 151, __pyx_L1_error) } + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 151, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_schema); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 151, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); @@ -5423,7 +5575,7 @@ static PyObject *__pyx_lambda_funcdef_lambda3(PyObject *__pyx_self) { return __pyx_r; } -/* "spavro/fast_binary.pyx":134 +/* "spavro/fast_binary.pyx":137 * return enum_reader * * def make_array_reader(schema): # <<<<<<<<<<<<<< @@ -5440,12 +5592,15 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_8make_array_reader(CYTHON_UNUSED PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("make_array_reader", 0); __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 134, __pyx_L1_error) + __PYX_ERR(0, 137, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } @@ -5453,16 +5608,16 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_8make_array_reader(CYTHON_UNUSED __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); - /* "spavro/fast_binary.pyx":135 + /* "spavro/fast_binary.pyx":138 * * def make_array_reader(schema): * item_reader = get_reader(schema['items']) # <<<<<<<<<<<<<< * def array_reader(fo): * cdef long block_count */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 135, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_schema, __pyx_n_s_items); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 135, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_schema, __pyx_n_s_items); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { @@ -5477,38 +5632,38 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_8make_array_reader(CYTHON_UNUSED __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 135, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GIVEREF(__pyx_t_1); __pyx_cur_scope->__pyx_v_item_reader = __pyx_t_1; __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":136 + /* "spavro/fast_binary.pyx":139 * def make_array_reader(schema): * item_reader = get_reader(schema['items']) * def array_reader(fo): # <<<<<<<<<<<<<< * cdef long block_count * cdef list read_items = [] */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17make_array_reader_1array_reader, 0, __pyx_n_s_make_array_reader_locals_array_r, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error) + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17make_array_reader_1array_reader, 0, __pyx_n_s_make_array_reader_locals_array_r, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_array_reader = __pyx_t_1; __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":148 + /* "spavro/fast_binary.pyx":151 * block_count = read_long(fo) * return read_items * array_reader.__reduce__ = lambda: (make_array_reader, (schema,)) # <<<<<<<<<<<<<< * return array_reader * */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17make_array_reader_2lambda3, 0, __pyx_n_s_make_array_reader_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17make_array_reader_2lambda3, 0, __pyx_n_s_make_array_reader_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_array_reader, __pyx_n_s_reduce, __pyx_t_1) < 0) __PYX_ERR(0, 148, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_array_reader, __pyx_n_s_reduce, __pyx_t_1) < 0) __PYX_ERR(0, 151, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":149 + /* "spavro/fast_binary.pyx":152 * return read_items * array_reader.__reduce__ = lambda: (make_array_reader, (schema,)) * return array_reader # <<<<<<<<<<<<<< @@ -5520,7 +5675,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_8make_array_reader(CYTHON_UNUSED __pyx_r = __pyx_v_array_reader; goto __pyx_L0; - /* "spavro/fast_binary.pyx":134 + /* "spavro/fast_binary.pyx":137 * return enum_reader * * def make_array_reader(schema): # <<<<<<<<<<<<<< @@ -5544,7 +5699,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_8make_array_reader(CYTHON_UNUSED return __pyx_r; } -/* "spavro/fast_binary.pyx":151 +/* "spavro/fast_binary.pyx":154 * return array_reader * * def make_map_reader(schema): # <<<<<<<<<<<<<< @@ -5566,7 +5721,7 @@ static PyObject *__pyx_pw_6spavro_11fast_binary_11make_map_reader(PyObject *__py return __pyx_r; } -/* "spavro/fast_binary.pyx":154 +/* "spavro/fast_binary.pyx":157 * value_reader = get_reader(schema['values']) * * def map_reader(fo): # <<<<<<<<<<<<<< @@ -5605,11 +5760,14 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_15make_map_reader_map_reader(PyO long __pyx_t_5; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("map_reader", 0); __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader *) __Pyx_CyFunction_GetClosure(__pyx_self); __pyx_cur_scope = __pyx_outer_scope; - /* "spavro/fast_binary.pyx":155 + /* "spavro/fast_binary.pyx":158 * * def map_reader(fo): * cdef long block_count = read_long(fo) # <<<<<<<<<<<<<< @@ -5618,19 +5776,19 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_15make_map_reader_map_reader(PyO */ __pyx_v_block_count = __pyx_f_6spavro_11fast_binary_read_long(__pyx_v_fo); - /* "spavro/fast_binary.pyx":156 + /* "spavro/fast_binary.pyx":159 * def map_reader(fo): * cdef long block_count = read_long(fo) * cdef dict read_items = {} # <<<<<<<<<<<<<< * while block_count != 0: * if block_count < 0: */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_read_items = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":157 + /* "spavro/fast_binary.pyx":160 * cdef long block_count = read_long(fo) * cdef dict read_items = {} * while block_count != 0: # <<<<<<<<<<<<<< @@ -5641,7 +5799,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_15make_map_reader_map_reader(PyO __pyx_t_2 = ((__pyx_v_block_count != 0) != 0); if (!__pyx_t_2) break; - /* "spavro/fast_binary.pyx":158 + /* "spavro/fast_binary.pyx":161 * cdef dict read_items = {} * while block_count != 0: * if block_count < 0: # <<<<<<<<<<<<<< @@ -5651,7 +5809,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_15make_map_reader_map_reader(PyO __pyx_t_2 = ((__pyx_v_block_count < 0) != 0); if (__pyx_t_2) { - /* "spavro/fast_binary.pyx":159 + /* "spavro/fast_binary.pyx":162 * while block_count != 0: * if block_count < 0: * block_count = -block_count # <<<<<<<<<<<<<< @@ -5660,7 +5818,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_15make_map_reader_map_reader(PyO */ __pyx_v_block_count = (-__pyx_v_block_count); - /* "spavro/fast_binary.pyx":160 + /* "spavro/fast_binary.pyx":163 * if block_count < 0: * block_count = -block_count * block_size = read_long(fo) # <<<<<<<<<<<<<< @@ -5669,7 +5827,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_15make_map_reader_map_reader(PyO */ __pyx_v_block_size = __pyx_f_6spavro_11fast_binary_read_long(__pyx_v_fo); - /* "spavro/fast_binary.pyx":158 + /* "spavro/fast_binary.pyx":161 * cdef dict read_items = {} * while block_count != 0: * if block_count < 0: # <<<<<<<<<<<<<< @@ -5678,7 +5836,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_15make_map_reader_map_reader(PyO */ } - /* "spavro/fast_binary.pyx":161 + /* "spavro/fast_binary.pyx":164 * block_count = -block_count * block_size = read_long(fo) * for _ in range(block_count): # <<<<<<<<<<<<<< @@ -5690,26 +5848,26 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_15make_map_reader_map_reader(PyO for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { __pyx_v__ = __pyx_t_5; - /* "spavro/fast_binary.pyx":162 + /* "spavro/fast_binary.pyx":165 * block_size = read_long(fo) * for _ in range(block_count): * key = read_utf8(fo) # <<<<<<<<<<<<<< * read_items[key] = value_reader(fo) * block_count = read_long(fo) */ - __pyx_t_1 = __pyx_f_6spavro_11fast_binary_read_utf8(__pyx_v_fo); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error) + __pyx_t_1 = __pyx_f_6spavro_11fast_binary_read_utf8(__pyx_v_fo); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF_SET(__pyx_v_key, ((PyObject*)__pyx_t_1)); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":163 + /* "spavro/fast_binary.pyx":166 * for _ in range(block_count): * key = read_utf8(fo) * read_items[key] = value_reader(fo) # <<<<<<<<<<<<<< * block_count = read_long(fo) * return read_items */ - if (unlikely(!__pyx_cur_scope->__pyx_v_value_reader)) { __Pyx_RaiseClosureNameError("value_reader"); __PYX_ERR(0, 163, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_v_value_reader)) { __Pyx_RaiseClosureNameError("value_reader"); __PYX_ERR(0, 166, __pyx_L1_error) } __Pyx_INCREF(__pyx_cur_scope->__pyx_v_value_reader); __pyx_t_6 = __pyx_cur_scope->__pyx_v_value_reader; __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -5723,14 +5881,14 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_15make_map_reader_map_reader(PyO } __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_fo) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_fo); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(PyDict_SetItem(__pyx_v_read_items, __pyx_v_key, __pyx_t_1) < 0)) __PYX_ERR(0, 163, __pyx_L1_error) + if (unlikely(PyDict_SetItem(__pyx_v_read_items, __pyx_v_key, __pyx_t_1) < 0)) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "spavro/fast_binary.pyx":164 + /* "spavro/fast_binary.pyx":167 * key = read_utf8(fo) * read_items[key] = value_reader(fo) * block_count = read_long(fo) # <<<<<<<<<<<<<< @@ -5740,7 +5898,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_15make_map_reader_map_reader(PyO __pyx_v_block_count = __pyx_f_6spavro_11fast_binary_read_long(__pyx_v_fo); } - /* "spavro/fast_binary.pyx":165 + /* "spavro/fast_binary.pyx":168 * read_items[key] = value_reader(fo) * block_count = read_long(fo) * return read_items # <<<<<<<<<<<<<< @@ -5752,7 +5910,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_15make_map_reader_map_reader(PyO __pyx_r = __pyx_v_read_items; goto __pyx_L0; - /* "spavro/fast_binary.pyx":154 + /* "spavro/fast_binary.pyx":157 * value_reader = get_reader(schema['values']) * * def map_reader(fo): # <<<<<<<<<<<<<< @@ -5775,7 +5933,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_15make_map_reader_map_reader(PyO return __pyx_r; } -/* "spavro/fast_binary.pyx":166 +/* "spavro/fast_binary.pyx":169 * block_count = read_long(fo) * return read_items * map_reader.__reduce__ = lambda: (make_map_reader, (schema,)) # <<<<<<<<<<<<<< @@ -5805,19 +5963,22 @@ static PyObject *__pyx_lambda_funcdef_lambda4(PyObject *__pyx_self) { PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("lambda4", 0); __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader *) __Pyx_CyFunction_GetClosure(__pyx_self); __pyx_cur_scope = __pyx_outer_scope; __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_map_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_map_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely(!__pyx_cur_scope->__pyx_v_schema)) { __Pyx_RaiseClosureNameError("schema"); __PYX_ERR(0, 166, __pyx_L1_error) } - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 166, __pyx_L1_error) + if (unlikely(!__pyx_cur_scope->__pyx_v_schema)) { __Pyx_RaiseClosureNameError("schema"); __PYX_ERR(0, 169, __pyx_L1_error) } + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_schema); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 166, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); @@ -5842,7 +6003,7 @@ static PyObject *__pyx_lambda_funcdef_lambda4(PyObject *__pyx_self) { return __pyx_r; } -/* "spavro/fast_binary.pyx":151 +/* "spavro/fast_binary.pyx":154 * return array_reader * * def make_map_reader(schema): # <<<<<<<<<<<<<< @@ -5859,12 +6020,15 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_10make_map_reader(CYTHON_UNUSED PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("make_map_reader", 0); __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 151, __pyx_L1_error) + __PYX_ERR(0, 154, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } @@ -5872,16 +6036,16 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_10make_map_reader(CYTHON_UNUSED __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); - /* "spavro/fast_binary.pyx":152 + /* "spavro/fast_binary.pyx":155 * * def make_map_reader(schema): * value_reader = get_reader(schema['values']) # <<<<<<<<<<<<<< * * def map_reader(fo): */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 152, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 155, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_schema, __pyx_n_s_values); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 152, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_schema, __pyx_n_s_values); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 155, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { @@ -5896,38 +6060,38 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_10make_map_reader(CYTHON_UNUSED __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 152, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 155, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GIVEREF(__pyx_t_1); __pyx_cur_scope->__pyx_v_value_reader = __pyx_t_1; __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":154 + /* "spavro/fast_binary.pyx":157 * value_reader = get_reader(schema['values']) * * def map_reader(fo): # <<<<<<<<<<<<<< * cdef long block_count = read_long(fo) * cdef dict read_items = {} */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_15make_map_reader_1map_reader, 0, __pyx_n_s_make_map_reader_locals_map_reade, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__12)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error) + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_15make_map_reader_1map_reader, 0, __pyx_n_s_make_map_reader_locals_map_reade, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__12)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 157, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_map_reader = __pyx_t_1; __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":166 + /* "spavro/fast_binary.pyx":169 * block_count = read_long(fo) * return read_items * map_reader.__reduce__ = lambda: (make_map_reader, (schema,)) # <<<<<<<<<<<<<< * return map_reader * */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_15make_map_reader_2lambda4, 0, __pyx_n_s_make_map_reader_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error) + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_15make_map_reader_2lambda4, 0, __pyx_n_s_make_map_reader_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_map_reader, __pyx_n_s_reduce, __pyx_t_1) < 0) __PYX_ERR(0, 166, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_map_reader, __pyx_n_s_reduce, __pyx_t_1) < 0) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":167 + /* "spavro/fast_binary.pyx":170 * return read_items * map_reader.__reduce__ = lambda: (make_map_reader, (schema,)) * return map_reader # <<<<<<<<<<<<<< @@ -5939,7 +6103,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_10make_map_reader(CYTHON_UNUSED __pyx_r = __pyx_v_map_reader; goto __pyx_L0; - /* "spavro/fast_binary.pyx":151 + /* "spavro/fast_binary.pyx":154 * return array_reader * * def make_map_reader(schema): # <<<<<<<<<<<<<< @@ -5963,7 +6127,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_10make_map_reader(CYTHON_UNUSED return __pyx_r; } -/* "spavro/fast_binary.pyx":169 +/* "spavro/fast_binary.pyx":172 * return map_reader * * def make_fixed_reader(schema): # <<<<<<<<<<<<<< @@ -5985,7 +6149,7 @@ static PyObject *__pyx_pw_6spavro_11fast_binary_13make_fixed_reader(PyObject *__ return __pyx_r; } -/* "spavro/fast_binary.pyx":172 +/* "spavro/fast_binary.pyx":175 * cdef long size = schema['size'] * * def fixed_reader(fo): # <<<<<<<<<<<<<< @@ -6016,11 +6180,14 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_fixed_reader_fixed_reader PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("fixed_reader", 0); __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader *) __Pyx_CyFunction_GetClosure(__pyx_self); __pyx_cur_scope = __pyx_outer_scope; - /* "spavro/fast_binary.pyx":173 + /* "spavro/fast_binary.pyx":176 * * def fixed_reader(fo): * return fo.read(size) # <<<<<<<<<<<<<< @@ -6028,9 +6195,9 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_fixed_reader_fixed_reader * return fixed_reader */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_fo, __pyx_n_s_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_fo, __pyx_n_s_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 176, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_cur_scope->__pyx_v_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 173, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_cur_scope->__pyx_v_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 176, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { @@ -6045,14 +6212,14 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_fixed_reader_fixed_reader __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 176, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "spavro/fast_binary.pyx":172 + /* "spavro/fast_binary.pyx":175 * cdef long size = schema['size'] * * def fixed_reader(fo): # <<<<<<<<<<<<<< @@ -6074,7 +6241,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_fixed_reader_fixed_reader return __pyx_r; } -/* "spavro/fast_binary.pyx":174 +/* "spavro/fast_binary.pyx":177 * def fixed_reader(fo): * return fo.read(size) * fixed_reader.__reduce__ = lambda: (make_fixed_reader, (schema,)) # <<<<<<<<<<<<<< @@ -6104,19 +6271,22 @@ static PyObject *__pyx_lambda_funcdef_lambda5(PyObject *__pyx_self) { PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("lambda5", 0); __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader *) __Pyx_CyFunction_GetClosure(__pyx_self); __pyx_cur_scope = __pyx_outer_scope; __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_fixed_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_fixed_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely(!__pyx_cur_scope->__pyx_v_schema)) { __Pyx_RaiseClosureNameError("schema"); __PYX_ERR(0, 174, __pyx_L1_error) } - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 174, __pyx_L1_error) + if (unlikely(!__pyx_cur_scope->__pyx_v_schema)) { __Pyx_RaiseClosureNameError("schema"); __PYX_ERR(0, 177, __pyx_L1_error) } + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_schema); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 174, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 177, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); @@ -6141,7 +6311,7 @@ static PyObject *__pyx_lambda_funcdef_lambda5(PyObject *__pyx_self) { return __pyx_r; } -/* "spavro/fast_binary.pyx":169 +/* "spavro/fast_binary.pyx":172 * return map_reader * * def make_fixed_reader(schema): # <<<<<<<<<<<<<< @@ -6156,12 +6326,15 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_12make_fixed_reader(CYTHON_UNUSE __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; long __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("make_fixed_reader", 0); __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 169, __pyx_L1_error) + __PYX_ERR(0, 172, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } @@ -6169,44 +6342,44 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_12make_fixed_reader(CYTHON_UNUSE __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); - /* "spavro/fast_binary.pyx":170 + /* "spavro/fast_binary.pyx":173 * * def make_fixed_reader(schema): * cdef long size = schema['size'] # <<<<<<<<<<<<<< * * def fixed_reader(fo): */ - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_schema, __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_schema, __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 170, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_cur_scope->__pyx_v_size = __pyx_t_2; - /* "spavro/fast_binary.pyx":172 + /* "spavro/fast_binary.pyx":175 * cdef long size = schema['size'] * * def fixed_reader(fo): # <<<<<<<<<<<<<< * return fo.read(size) * fixed_reader.__reduce__ = lambda: (make_fixed_reader, (schema,)) */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17make_fixed_reader_1fixed_reader, 0, __pyx_n_s_make_fixed_reader_locals_fixed_r, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__14)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error) + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17make_fixed_reader_1fixed_reader, 0, __pyx_n_s_make_fixed_reader_locals_fixed_r, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__14)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_fixed_reader = __pyx_t_1; __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":174 + /* "spavro/fast_binary.pyx":177 * def fixed_reader(fo): * return fo.read(size) * fixed_reader.__reduce__ = lambda: (make_fixed_reader, (schema,)) # <<<<<<<<<<<<<< * return fixed_reader * */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17make_fixed_reader_2lambda5, 0, __pyx_n_s_make_fixed_reader_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error) + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17make_fixed_reader_2lambda5, 0, __pyx_n_s_make_fixed_reader_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_fixed_reader, __pyx_n_s_reduce, __pyx_t_1) < 0) __PYX_ERR(0, 174, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_fixed_reader, __pyx_n_s_reduce, __pyx_t_1) < 0) __PYX_ERR(0, 177, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":175 + /* "spavro/fast_binary.pyx":178 * return fo.read(size) * fixed_reader.__reduce__ = lambda: (make_fixed_reader, (schema,)) * return fixed_reader # <<<<<<<<<<<<<< @@ -6218,7 +6391,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_12make_fixed_reader(CYTHON_UNUSE __pyx_r = __pyx_v_fixed_reader; goto __pyx_L0; - /* "spavro/fast_binary.pyx":169 + /* "spavro/fast_binary.pyx":172 * return map_reader * * def make_fixed_reader(schema): # <<<<<<<<<<<<<< @@ -6239,7 +6412,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_12make_fixed_reader(CYTHON_UNUSE return __pyx_r; } -/* "spavro/fast_binary.pyx":177 +/* "spavro/fast_binary.pyx":180 * return fixed_reader * * def make_null_reader(schema): # <<<<<<<<<<<<<< @@ -6265,9 +6438,12 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_14make_null_reader(CYTHON_UNUSED PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("make_null_reader", 0); - /* "spavro/fast_binary.pyx":178 + /* "spavro/fast_binary.pyx":181 * * def make_null_reader(schema): * return read_null # <<<<<<<<<<<<<< @@ -6275,13 +6451,13 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_14make_null_reader(CYTHON_UNUSED * def make_string_reader(schema): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_CFunc_object____object___to_py(__pyx_f_6spavro_11fast_binary_read_null); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error) + __pyx_t_1 = __Pyx_CFunc_object____object___to_py(__pyx_f_6spavro_11fast_binary_read_null); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "spavro/fast_binary.pyx":177 + /* "spavro/fast_binary.pyx":180 * return fixed_reader * * def make_null_reader(schema): # <<<<<<<<<<<<<< @@ -6300,7 +6476,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_14make_null_reader(CYTHON_UNUSED return __pyx_r; } -/* "spavro/fast_binary.pyx":180 +/* "spavro/fast_binary.pyx":183 * return read_null * * def make_string_reader(schema): # <<<<<<<<<<<<<< @@ -6326,9 +6502,12 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_16make_string_reader(CYTHON_UNUS PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("make_string_reader", 0); - /* "spavro/fast_binary.pyx":181 + /* "spavro/fast_binary.pyx":184 * * def make_string_reader(schema): * return read_utf8 # <<<<<<<<<<<<<< @@ -6336,13 +6515,13 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_16make_string_reader(CYTHON_UNUS * def make_boolean_reader(schema): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_CFunc_unicode____object___to_py(__pyx_f_6spavro_11fast_binary_read_utf8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error) + __pyx_t_1 = __Pyx_CFunc_unicode____object___to_py(__pyx_f_6spavro_11fast_binary_read_utf8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 184, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "spavro/fast_binary.pyx":180 + /* "spavro/fast_binary.pyx":183 * return read_null * * def make_string_reader(schema): # <<<<<<<<<<<<<< @@ -6361,7 +6540,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_16make_string_reader(CYTHON_UNUS return __pyx_r; } -/* "spavro/fast_binary.pyx":183 +/* "spavro/fast_binary.pyx":186 * return read_utf8 * * def make_boolean_reader(schema): # <<<<<<<<<<<<<< @@ -6387,9 +6566,12 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_18make_boolean_reader(CYTHON_UNU PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("make_boolean_reader", 0); - /* "spavro/fast_binary.pyx":184 + /* "spavro/fast_binary.pyx":187 * * def make_boolean_reader(schema): * return read_boolean # <<<<<<<<<<<<<< @@ -6397,13 +6579,13 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_18make_boolean_reader(CYTHON_UNU * def make_double_reader(schema): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_CFunc_bint____object___to_py(__pyx_f_6spavro_11fast_binary_read_boolean); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 184, __pyx_L1_error) + __pyx_t_1 = __Pyx_CFunc_bint____object___to_py(__pyx_f_6spavro_11fast_binary_read_boolean); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 187, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "spavro/fast_binary.pyx":183 + /* "spavro/fast_binary.pyx":186 * return read_utf8 * * def make_boolean_reader(schema): # <<<<<<<<<<<<<< @@ -6422,7 +6604,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_18make_boolean_reader(CYTHON_UNU return __pyx_r; } -/* "spavro/fast_binary.pyx":186 +/* "spavro/fast_binary.pyx":189 * return read_boolean * * def make_double_reader(schema): # <<<<<<<<<<<<<< @@ -6448,9 +6630,12 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_20make_double_reader(CYTHON_UNUS PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("make_double_reader", 0); - /* "spavro/fast_binary.pyx":187 + /* "spavro/fast_binary.pyx":190 * * def make_double_reader(schema): * return read_double # <<<<<<<<<<<<<< @@ -6458,13 +6643,13 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_20make_double_reader(CYTHON_UNUS * def make_long_reader(schema): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_CFunc_double____object___to_py(__pyx_f_6spavro_11fast_binary_read_double); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 187, __pyx_L1_error) + __pyx_t_1 = __Pyx_CFunc_double____object___to_py(__pyx_f_6spavro_11fast_binary_read_double); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "spavro/fast_binary.pyx":186 + /* "spavro/fast_binary.pyx":189 * return read_boolean * * def make_double_reader(schema): # <<<<<<<<<<<<<< @@ -6483,7 +6668,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_20make_double_reader(CYTHON_UNUS return __pyx_r; } -/* "spavro/fast_binary.pyx":189 +/* "spavro/fast_binary.pyx":192 * return read_double * * def make_long_reader(schema): # <<<<<<<<<<<<<< @@ -6509,9 +6694,12 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_22make_long_reader(CYTHON_UNUSED PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("make_long_reader", 0); - /* "spavro/fast_binary.pyx":190 + /* "spavro/fast_binary.pyx":193 * * def make_long_reader(schema): * return read_long # <<<<<<<<<<<<<< @@ -6519,13 +6707,13 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_22make_long_reader(CYTHON_UNUSED * def make_byte_reader(schema): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_CFunc_long__long____object___to_py(__pyx_f_6spavro_11fast_binary_read_long); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error) + __pyx_t_1 = __Pyx_CFunc_long__long____object___to_py(__pyx_f_6spavro_11fast_binary_read_long); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "spavro/fast_binary.pyx":189 + /* "spavro/fast_binary.pyx":192 * return read_double * * def make_long_reader(schema): # <<<<<<<<<<<<<< @@ -6544,7 +6732,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_22make_long_reader(CYTHON_UNUSED return __pyx_r; } -/* "spavro/fast_binary.pyx":192 +/* "spavro/fast_binary.pyx":195 * return read_long * * def make_byte_reader(schema): # <<<<<<<<<<<<<< @@ -6570,9 +6758,12 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_24make_byte_reader(CYTHON_UNUSED PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("make_byte_reader", 0); - /* "spavro/fast_binary.pyx":193 + /* "spavro/fast_binary.pyx":196 * * def make_byte_reader(schema): * return read_bytes # <<<<<<<<<<<<<< @@ -6580,13 +6771,13 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_24make_byte_reader(CYTHON_UNUSED * def make_float_reader(schema): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_CFunc_bytes____object___to_py(__pyx_f_6spavro_11fast_binary_read_bytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error) + __pyx_t_1 = __Pyx_CFunc_bytes____object___to_py(__pyx_f_6spavro_11fast_binary_read_bytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 196, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "spavro/fast_binary.pyx":192 + /* "spavro/fast_binary.pyx":195 * return read_long * * def make_byte_reader(schema): # <<<<<<<<<<<<<< @@ -6605,7 +6796,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_24make_byte_reader(CYTHON_UNUSED return __pyx_r; } -/* "spavro/fast_binary.pyx":195 +/* "spavro/fast_binary.pyx":198 * return read_bytes * * def make_float_reader(schema): # <<<<<<<<<<<<<< @@ -6631,9 +6822,12 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_26make_float_reader(CYTHON_UNUSE PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("make_float_reader", 0); - /* "spavro/fast_binary.pyx":196 + /* "spavro/fast_binary.pyx":199 * * def make_float_reader(schema): * return read_float # <<<<<<<<<<<<<< @@ -6641,13 +6835,13 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_26make_float_reader(CYTHON_UNUSE * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_CFunc_float____object___to_py(__pyx_f_6spavro_11fast_binary_read_float); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 196, __pyx_L1_error) + __pyx_t_1 = __Pyx_CFunc_float____object___to_py(__pyx_f_6spavro_11fast_binary_read_float); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "spavro/fast_binary.pyx":195 + /* "spavro/fast_binary.pyx":198 * return read_bytes * * def make_float_reader(schema): # <<<<<<<<<<<<<< @@ -6666,7 +6860,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_26make_float_reader(CYTHON_UNUSE return __pyx_r; } -/* "spavro/fast_binary.pyx":199 +/* "spavro/fast_binary.pyx":202 * * * def make_skip_reader(schema): # <<<<<<<<<<<<<< @@ -6688,7 +6882,7 @@ static PyObject *__pyx_pw_6spavro_11fast_binary_29make_skip_reader(PyObject *__p return __pyx_r; } -/* "spavro/fast_binary.pyx":203 +/* "spavro/fast_binary.pyx":206 * # in the avro stream properly * value_reader = get_reader(schema['value']) * def read_skip(fo): # <<<<<<<<<<<<<< @@ -6718,18 +6912,21 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_16make_skip_reader_read_skip(PyO PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("read_skip", 0); __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader *) __Pyx_CyFunction_GetClosure(__pyx_self); __pyx_cur_scope = __pyx_outer_scope; - /* "spavro/fast_binary.pyx":204 + /* "spavro/fast_binary.pyx":207 * value_reader = get_reader(schema['value']) * def read_skip(fo): * value_reader(fo) # <<<<<<<<<<<<<< * return None * read_skip.__reduce__ = lambda: (make_skip_reader, (schema,)) */ - if (unlikely(!__pyx_cur_scope->__pyx_v_value_reader)) { __Pyx_RaiseClosureNameError("value_reader"); __PYX_ERR(0, 204, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_v_value_reader)) { __Pyx_RaiseClosureNameError("value_reader"); __PYX_ERR(0, 207, __pyx_L1_error) } __Pyx_INCREF(__pyx_cur_scope->__pyx_v_value_reader); __pyx_t_2 = __pyx_cur_scope->__pyx_v_value_reader; __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { @@ -6743,12 +6940,12 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_16make_skip_reader_read_skip(PyO } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_fo) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_fo); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __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; - /* "spavro/fast_binary.pyx":205 + /* "spavro/fast_binary.pyx":208 * def read_skip(fo): * value_reader(fo) * return None # <<<<<<<<<<<<<< @@ -6759,7 +6956,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_16make_skip_reader_read_skip(PyO __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "spavro/fast_binary.pyx":203 + /* "spavro/fast_binary.pyx":206 * # in the avro stream properly * value_reader = get_reader(schema['value']) * def read_skip(fo): # <<<<<<<<<<<<<< @@ -6780,7 +6977,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_16make_skip_reader_read_skip(PyO return __pyx_r; } -/* "spavro/fast_binary.pyx":206 +/* "spavro/fast_binary.pyx":209 * value_reader(fo) * return None * read_skip.__reduce__ = lambda: (make_skip_reader, (schema,)) # <<<<<<<<<<<<<< @@ -6810,19 +7007,22 @@ static PyObject *__pyx_lambda_funcdef_lambda6(PyObject *__pyx_self) { PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("lambda6", 0); __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader *) __Pyx_CyFunction_GetClosure(__pyx_self); __pyx_cur_scope = __pyx_outer_scope; __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_skip_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 206, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_skip_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely(!__pyx_cur_scope->__pyx_v_schema)) { __Pyx_RaiseClosureNameError("schema"); __PYX_ERR(0, 206, __pyx_L1_error) } - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 206, __pyx_L1_error) + if (unlikely(!__pyx_cur_scope->__pyx_v_schema)) { __Pyx_RaiseClosureNameError("schema"); __PYX_ERR(0, 209, __pyx_L1_error) } + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 209, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_schema); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 206, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 209, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); @@ -6847,7 +7047,7 @@ static PyObject *__pyx_lambda_funcdef_lambda6(PyObject *__pyx_self) { return __pyx_r; } -/* "spavro/fast_binary.pyx":199 +/* "spavro/fast_binary.pyx":202 * * * def make_skip_reader(schema): # <<<<<<<<<<<<<< @@ -6864,12 +7064,15 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_28make_skip_reader(CYTHON_UNUSED PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("make_skip_reader", 0); __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 199, __pyx_L1_error) + __PYX_ERR(0, 202, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } @@ -6877,16 +7080,16 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_28make_skip_reader(CYTHON_UNUSED __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); - /* "spavro/fast_binary.pyx":202 + /* "spavro/fast_binary.pyx":205 * # this will create a regular reader that will iterate the bytes * # in the avro stream properly * value_reader = get_reader(schema['value']) # <<<<<<<<<<<<<< * def read_skip(fo): * value_reader(fo) */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 202, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_schema, __pyx_n_s_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_schema, __pyx_n_s_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { @@ -6901,38 +7104,38 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_28make_skip_reader(CYTHON_UNUSED __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GIVEREF(__pyx_t_1); __pyx_cur_scope->__pyx_v_value_reader = __pyx_t_1; __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":203 + /* "spavro/fast_binary.pyx":206 * # in the avro stream properly * value_reader = get_reader(schema['value']) * def read_skip(fo): # <<<<<<<<<<<<<< * value_reader(fo) * return None */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_16make_skip_reader_1read_skip, 0, __pyx_n_s_make_skip_reader_locals_read_ski, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__16)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error) + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_16make_skip_reader_1read_skip, 0, __pyx_n_s_make_skip_reader_locals_read_ski, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__16)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_read_skip = __pyx_t_1; __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":206 + /* "spavro/fast_binary.pyx":209 * value_reader(fo) * return None * read_skip.__reduce__ = lambda: (make_skip_reader, (schema,)) # <<<<<<<<<<<<<< * return read_skip * */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_16make_skip_reader_2lambda6, 0, __pyx_n_s_make_skip_reader_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 206, __pyx_L1_error) + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_16make_skip_reader_2lambda6, 0, __pyx_n_s_make_skip_reader_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_read_skip, __pyx_n_s_reduce, __pyx_t_1) < 0) __PYX_ERR(0, 206, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_read_skip, __pyx_n_s_reduce, __pyx_t_1) < 0) __PYX_ERR(0, 209, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":207 + /* "spavro/fast_binary.pyx":210 * return None * read_skip.__reduce__ = lambda: (make_skip_reader, (schema,)) * return read_skip # <<<<<<<<<<<<<< @@ -6944,7 +7147,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_28make_skip_reader(CYTHON_UNUSED __pyx_r = __pyx_v_read_skip; goto __pyx_L0; - /* "spavro/fast_binary.pyx":199 + /* "spavro/fast_binary.pyx":202 * * * def make_skip_reader(schema): # <<<<<<<<<<<<<< @@ -6968,7 +7171,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_28make_skip_reader(CYTHON_UNUSED return __pyx_r; } -/* "spavro/fast_binary.pyx":210 +/* "spavro/fast_binary.pyx":213 * * * def make_default_reader(schema): # <<<<<<<<<<<<<< @@ -6990,7 +7193,7 @@ static PyObject *__pyx_pw_6spavro_11fast_binary_31make_default_reader(PyObject * return __pyx_r; } -/* "spavro/fast_binary.pyx":212 +/* "spavro/fast_binary.pyx":215 * def make_default_reader(schema): * value = schema["value"] * def read_default(fo): # <<<<<<<<<<<<<< @@ -7017,11 +7220,14 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_19make_default_reader_read_defau struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader *__pyx_outer_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("read_default", 0); __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader *) __Pyx_CyFunction_GetClosure(__pyx_self); __pyx_cur_scope = __pyx_outer_scope; - /* "spavro/fast_binary.pyx":213 + /* "spavro/fast_binary.pyx":216 * value = schema["value"] * def read_default(fo): * return value # <<<<<<<<<<<<<< @@ -7029,12 +7235,12 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_19make_default_reader_read_defau * return read_default */ __Pyx_XDECREF(__pyx_r); - if (unlikely(!__pyx_cur_scope->__pyx_v_value)) { __Pyx_RaiseClosureNameError("value"); __PYX_ERR(0, 213, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_v_value)) { __Pyx_RaiseClosureNameError("value"); __PYX_ERR(0, 216, __pyx_L1_error) } __Pyx_INCREF(__pyx_cur_scope->__pyx_v_value); __pyx_r = __pyx_cur_scope->__pyx_v_value; goto __pyx_L0; - /* "spavro/fast_binary.pyx":212 + /* "spavro/fast_binary.pyx":215 * def make_default_reader(schema): * value = schema["value"] * def read_default(fo): # <<<<<<<<<<<<<< @@ -7052,7 +7258,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_19make_default_reader_read_defau return __pyx_r; } -/* "spavro/fast_binary.pyx":214 +/* "spavro/fast_binary.pyx":217 * def read_default(fo): * return value * read_default.__reduce__ = lambda: (make_default_reader, (schema,)) # <<<<<<<<<<<<<< @@ -7082,19 +7288,22 @@ static PyObject *__pyx_lambda_funcdef_lambda7(PyObject *__pyx_self) { PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("lambda7", 0); __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader *) __Pyx_CyFunction_GetClosure(__pyx_self); __pyx_cur_scope = __pyx_outer_scope; __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_default_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 214, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_default_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely(!__pyx_cur_scope->__pyx_v_schema)) { __Pyx_RaiseClosureNameError("schema"); __PYX_ERR(0, 214, __pyx_L1_error) } - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 214, __pyx_L1_error) + if (unlikely(!__pyx_cur_scope->__pyx_v_schema)) { __Pyx_RaiseClosureNameError("schema"); __PYX_ERR(0, 217, __pyx_L1_error) } + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_schema); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 214, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); @@ -7119,7 +7328,7 @@ static PyObject *__pyx_lambda_funcdef_lambda7(PyObject *__pyx_self) { return __pyx_r; } -/* "spavro/fast_binary.pyx":210 +/* "spavro/fast_binary.pyx":213 * * * def make_default_reader(schema): # <<<<<<<<<<<<<< @@ -7133,12 +7342,15 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_30make_default_reader(CYTHON_UNU PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("make_default_reader", 0); __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 210, __pyx_L1_error) + __PYX_ERR(0, 213, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } @@ -7146,44 +7358,44 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_30make_default_reader(CYTHON_UNU __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); - /* "spavro/fast_binary.pyx":211 + /* "spavro/fast_binary.pyx":214 * * def make_default_reader(schema): * value = schema["value"] # <<<<<<<<<<<<<< * def read_default(fo): * return value */ - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_schema, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_schema, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 214, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_cur_scope->__pyx_v_value = __pyx_t_1; __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":212 + /* "spavro/fast_binary.pyx":215 * def make_default_reader(schema): * value = schema["value"] * def read_default(fo): # <<<<<<<<<<<<<< * return value * read_default.__reduce__ = lambda: (make_default_reader, (schema,)) */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_19make_default_reader_1read_default, 0, __pyx_n_s_make_default_reader_locals_read, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__18)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error) + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_19make_default_reader_1read_default, 0, __pyx_n_s_make_default_reader_locals_read, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__18)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 215, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_read_default = __pyx_t_1; __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":214 + /* "spavro/fast_binary.pyx":217 * def read_default(fo): * return value * read_default.__reduce__ = lambda: (make_default_reader, (schema,)) # <<<<<<<<<<<<<< * return read_default * */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_19make_default_reader_2lambda7, 0, __pyx_n_s_make_default_reader_locals_lambd, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 214, __pyx_L1_error) + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_19make_default_reader_2lambda7, 0, __pyx_n_s_make_default_reader_locals_lambd, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_read_default, __pyx_n_s_reduce, __pyx_t_1) < 0) __PYX_ERR(0, 214, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_read_default, __pyx_n_s_reduce, __pyx_t_1) < 0) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":215 + /* "spavro/fast_binary.pyx":218 * return value * read_default.__reduce__ = lambda: (make_default_reader, (schema,)) * return read_default # <<<<<<<<<<<<<< @@ -7195,7 +7407,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_30make_default_reader(CYTHON_UNU __pyx_r = __pyx_v_read_default; goto __pyx_L0; - /* "spavro/fast_binary.pyx":210 + /* "spavro/fast_binary.pyx":213 * * * def make_default_reader(schema): # <<<<<<<<<<<<<< @@ -7216,7 +7428,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_30make_default_reader(CYTHON_UNU return __pyx_r; } -/* "spavro/fast_binary.pyx":240 +/* "spavro/fast_binary.pyx":243 * * class ReaderPlaceholder(object): * def __init__(self): # <<<<<<<<<<<<<< @@ -7241,18 +7453,21 @@ static PyObject *__pyx_pw_6spavro_11fast_binary_17ReaderPlaceholder_1__init__(Py static PyObject *__pyx_pf_6spavro_11fast_binary_17ReaderPlaceholder___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "spavro/fast_binary.pyx":241 + /* "spavro/fast_binary.pyx":244 * class ReaderPlaceholder(object): * def __init__(self): * self.reader = None # <<<<<<<<<<<<<< * * def __call__(self, fo): */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_reader, Py_None) < 0) __PYX_ERR(0, 241, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_reader, Py_None) < 0) __PYX_ERR(0, 244, __pyx_L1_error) - /* "spavro/fast_binary.pyx":240 + /* "spavro/fast_binary.pyx":243 * * class ReaderPlaceholder(object): * def __init__(self): # <<<<<<<<<<<<<< @@ -7272,7 +7487,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17ReaderPlaceholder___init__(CYT return __pyx_r; } -/* "spavro/fast_binary.pyx":243 +/* "spavro/fast_binary.pyx":246 * self.reader = None * * def __call__(self, fo): # <<<<<<<<<<<<<< @@ -7286,6 +7501,9 @@ static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17ReaderPlaceholder_3__call_ static PyObject *__pyx_pw_6spavro_11fast_binary_17ReaderPlaceholder_3__call__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; PyObject *__pyx_v_fo = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__call__ (wrapper)", 0); @@ -7312,11 +7530,11 @@ static PyObject *__pyx_pw_6spavro_11fast_binary_17ReaderPlaceholder_3__call__(Py case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fo)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); __PYX_ERR(0, 243, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); __PYX_ERR(0, 246, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) __PYX_ERR(0, 243, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) __PYX_ERR(0, 246, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -7329,7 +7547,7 @@ static PyObject *__pyx_pw_6spavro_11fast_binary_17ReaderPlaceholder_3__call__(Py } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 243, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 246, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("spavro.fast_binary.ReaderPlaceholder.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -7348,9 +7566,12 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17ReaderPlaceholder_2__call__(CY PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__call__", 0); - /* "spavro/fast_binary.pyx":244 + /* "spavro/fast_binary.pyx":247 * * def __call__(self, fo): * return self.reader(fo) # <<<<<<<<<<<<<< @@ -7358,7 +7579,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17ReaderPlaceholder_2__call__(CY * def get_reader(schema): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 244, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 247, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { @@ -7372,14 +7593,14 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17ReaderPlaceholder_2__call__(CY } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_fo) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_fo); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "spavro/fast_binary.pyx":243 + /* "spavro/fast_binary.pyx":246 * self.reader = None * * def __call__(self, fo): # <<<<<<<<<<<<<< @@ -7400,7 +7621,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17ReaderPlaceholder_2__call__(CY return __pyx_r; } -/* "spavro/fast_binary.pyx":246 +/* "spavro/fast_binary.pyx":249 * return self.reader(fo) * * def get_reader(schema): # <<<<<<<<<<<<<< @@ -7444,21 +7665,24 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_32get_reader(CYTHON_UNUSED PyObj int __pyx_t_11; PyObject *__pyx_t_12 = NULL; PyObject *__pyx_t_13 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_reader", 0); - /* "spavro/fast_binary.pyx":247 + /* "spavro/fast_binary.pyx":250 * * def get_reader(schema): * cdef unicode schema_type = get_type(schema) # <<<<<<<<<<<<<< * if schema_type in ('record', 'fixed', 'enum'): * placeholder = ReaderPlaceholder() */ - __pyx_t_1 = __pyx_f_6spavro_11fast_binary_get_type(__pyx_v_schema, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L1_error) + __pyx_t_1 = __pyx_f_6spavro_11fast_binary_get_type(__pyx_v_schema, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_schema_type = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":248 + /* "spavro/fast_binary.pyx":251 * def get_reader(schema): * cdef unicode schema_type = get_type(schema) * if schema_type in ('record', 'fixed', 'enum'): # <<<<<<<<<<<<<< @@ -7467,21 +7691,21 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_32get_reader(CYTHON_UNUSED PyObj */ __Pyx_INCREF(__pyx_v_schema_type); __pyx_t_2 = __pyx_v_schema_type; - __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_n_s_record, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 248, __pyx_L1_error) + __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_n_s_record, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 251, __pyx_L1_error) __pyx_t_5 = (__pyx_t_4 != 0); if (!__pyx_t_5) { } else { __pyx_t_3 = __pyx_t_5; goto __pyx_L4_bool_binop_done; } - __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_n_s_fixed, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 248, __pyx_L1_error) + __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_n_s_fixed, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 251, __pyx_L1_error) __pyx_t_4 = (__pyx_t_5 != 0); if (!__pyx_t_4) { } else { __pyx_t_3 = __pyx_t_4; goto __pyx_L4_bool_binop_done; } - __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_n_s_enum, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 248, __pyx_L1_error) + __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_n_s_enum, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 251, __pyx_L1_error) __pyx_t_5 = (__pyx_t_4 != 0); __pyx_t_3 = __pyx_t_5; __pyx_L4_bool_binop_done:; @@ -7489,14 +7713,14 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_32get_reader(CYTHON_UNUSED PyObj __pyx_t_5 = (__pyx_t_3 != 0); if (__pyx_t_5) { - /* "spavro/fast_binary.pyx":249 + /* "spavro/fast_binary.pyx":252 * cdef unicode schema_type = get_type(schema) * if schema_type in ('record', 'fixed', 'enum'): * placeholder = ReaderPlaceholder() # <<<<<<<<<<<<<< * # using a placeholder because this is recursive and the reader isn't defined * # yet and nested records might refer to this parent schema name */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_ReaderPlaceholder); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 249, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_ReaderPlaceholder); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -7510,20 +7734,20 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_32get_reader(CYTHON_UNUSED PyObj } __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_v_placeholder = __pyx_t_1; __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":252 + /* "spavro/fast_binary.pyx":255 * # using a placeholder because this is recursive and the reader isn't defined * # yet and nested records might refer to this parent schema name * namespace = schema.get('namespace') # <<<<<<<<<<<<<< * name = schema.get('name') * if namespace and "." not in name: */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_schema, __pyx_n_s_get); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 252, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_schema, __pyx_n_s_get); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { @@ -7537,20 +7761,20 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_32get_reader(CYTHON_UNUSED PyObj } __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_n_s_namespace) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_n_s_namespace); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 252, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_v_namespace = __pyx_t_1; __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":253 + /* "spavro/fast_binary.pyx":256 * # yet and nested records might refer to this parent schema name * namespace = schema.get('namespace') * name = schema.get('name') # <<<<<<<<<<<<<< * if namespace and "." not in name: * fullname = '.'.join([namespace, name]) */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_schema, __pyx_n_s_get); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 253, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_schema, __pyx_n_s_get); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 256, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { @@ -7564,39 +7788,39 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_32get_reader(CYTHON_UNUSED PyObj } __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_n_s_name) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_n_s_name); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_v_name = __pyx_t_1; __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":254 + /* "spavro/fast_binary.pyx":257 * namespace = schema.get('namespace') * name = schema.get('name') * if namespace and "." not in name: # <<<<<<<<<<<<<< * fullname = '.'.join([namespace, name]) * else: */ - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_namespace); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 254, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_namespace); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 257, __pyx_L1_error) if (__pyx_t_3) { } else { __pyx_t_5 = __pyx_t_3; goto __pyx_L8_bool_binop_done; } - __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_kp_s__19, __pyx_v_name, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 254, __pyx_L1_error) + __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_kp_s__19, __pyx_v_name, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 257, __pyx_L1_error) __pyx_t_4 = (__pyx_t_3 != 0); __pyx_t_5 = __pyx_t_4; __pyx_L8_bool_binop_done:; if (__pyx_t_5) { - /* "spavro/fast_binary.pyx":255 + /* "spavro/fast_binary.pyx":258 * name = schema.get('name') * if namespace and "." not in name: * fullname = '.'.join([namespace, name]) # <<<<<<<<<<<<<< * else: * fullname = name */ - __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 255, __pyx_L1_error) + __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_namespace); __Pyx_GIVEREF(__pyx_v_namespace); @@ -7604,13 +7828,13 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_32get_reader(CYTHON_UNUSED PyObj __Pyx_INCREF(__pyx_v_name); __Pyx_GIVEREF(__pyx_v_name); PyList_SET_ITEM(__pyx_t_1, 1, __pyx_v_name); - __pyx_t_6 = __Pyx_PyString_Join(__pyx_kp_s__19, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 255, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyString_Join(__pyx_kp_s__19, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_fullname = __pyx_t_6; __pyx_t_6 = 0; - /* "spavro/fast_binary.pyx":254 + /* "spavro/fast_binary.pyx":257 * namespace = schema.get('namespace') * name = schema.get('name') * if namespace and "." not in name: # <<<<<<<<<<<<<< @@ -7620,7 +7844,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_32get_reader(CYTHON_UNUSED PyObj goto __pyx_L7; } - /* "spavro/fast_binary.pyx":257 + /* "spavro/fast_binary.pyx":260 * fullname = '.'.join([namespace, name]) * else: * fullname = name # <<<<<<<<<<<<<< @@ -7633,28 +7857,28 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_32get_reader(CYTHON_UNUSED PyObj } __pyx_L7:; - /* "spavro/fast_binary.pyx":258 + /* "spavro/fast_binary.pyx":261 * else: * fullname = name * schema_cache[fullname] = placeholder # <<<<<<<<<<<<<< * reader = reader_type_map[schema_type](schema) * # now that we've returned, assign the reader to the placeholder */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_schema_cache); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 258, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_schema_cache); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 261, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (unlikely(PyObject_SetItem(__pyx_t_6, __pyx_v_fullname, __pyx_v_placeholder) < 0)) __PYX_ERR(0, 258, __pyx_L1_error) + if (unlikely(PyObject_SetItem(__pyx_t_6, __pyx_v_fullname, __pyx_v_placeholder) < 0)) __PYX_ERR(0, 261, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "spavro/fast_binary.pyx":259 + /* "spavro/fast_binary.pyx":262 * fullname = name * schema_cache[fullname] = placeholder * reader = reader_type_map[schema_type](schema) # <<<<<<<<<<<<<< * # now that we've returned, assign the reader to the placeholder * # so that the execution will work */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_reader_type_map); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_reader_type_map); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 262, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_v_schema_type); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 259, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_v_schema_type); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 262, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; @@ -7669,22 +7893,22 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_32get_reader(CYTHON_UNUSED PyObj } __pyx_t_6 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_1, __pyx_v_schema) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_schema); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 259, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 262, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_reader = __pyx_t_6; __pyx_t_6 = 0; - /* "spavro/fast_binary.pyx":262 + /* "spavro/fast_binary.pyx":265 * # now that we've returned, assign the reader to the placeholder * # so that the execution will work * placeholder.reader = reader # <<<<<<<<<<<<<< * return reader * try: */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_placeholder, __pyx_n_s_reader, __pyx_v_reader) < 0) __PYX_ERR(0, 262, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_placeholder, __pyx_n_s_reader, __pyx_v_reader) < 0) __PYX_ERR(0, 265, __pyx_L1_error) - /* "spavro/fast_binary.pyx":263 + /* "spavro/fast_binary.pyx":266 * # so that the execution will work * placeholder.reader = reader * return reader # <<<<<<<<<<<<<< @@ -7696,7 +7920,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_32get_reader(CYTHON_UNUSED PyObj __pyx_r = __pyx_v_reader; goto __pyx_L0; - /* "spavro/fast_binary.pyx":248 + /* "spavro/fast_binary.pyx":251 * def get_reader(schema): * cdef unicode schema_type = get_type(schema) * if schema_type in ('record', 'fixed', 'enum'): # <<<<<<<<<<<<<< @@ -7705,7 +7929,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_32get_reader(CYTHON_UNUSED PyObj */ } - /* "spavro/fast_binary.pyx":264 + /* "spavro/fast_binary.pyx":267 * placeholder.reader = reader * return reader * try: # <<<<<<<<<<<<<< @@ -7721,16 +7945,16 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_32get_reader(CYTHON_UNUSED PyObj __Pyx_XGOTREF(__pyx_t_10); /*try:*/ { - /* "spavro/fast_binary.pyx":265 + /* "spavro/fast_binary.pyx":268 * return reader * try: * reader = reader_type_map[schema_type](schema) # <<<<<<<<<<<<<< * except KeyError: * reader = schema_cache[schema_type] */ - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_reader_type_map); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 265, __pyx_L10_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_reader_type_map); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 268, __pyx_L10_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_7, __pyx_v_schema_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 265, __pyx_L10_error) + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_7, __pyx_v_schema_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 268, __pyx_L10_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = NULL; @@ -7745,13 +7969,13 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_32get_reader(CYTHON_UNUSED PyObj } __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_7, __pyx_v_schema) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_schema); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 265, __pyx_L10_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 268, __pyx_L10_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_reader = __pyx_t_6; __pyx_t_6 = 0; - /* "spavro/fast_binary.pyx":264 + /* "spavro/fast_binary.pyx":267 * placeholder.reader = reader * return reader * try: # <<<<<<<<<<<<<< @@ -7769,7 +7993,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_32get_reader(CYTHON_UNUSED PyObj __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "spavro/fast_binary.pyx":266 + /* "spavro/fast_binary.pyx":269 * try: * reader = reader_type_map[schema_type](schema) * except KeyError: # <<<<<<<<<<<<<< @@ -7779,21 +8003,21 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_32get_reader(CYTHON_UNUSED PyObj __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError); if (__pyx_t_11) { __Pyx_AddTraceback("spavro.fast_binary.get_reader", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_1, &__pyx_t_7) < 0) __PYX_ERR(0, 266, __pyx_L12_except_error) + if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_1, &__pyx_t_7) < 0) __PYX_ERR(0, 269, __pyx_L12_except_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_7); - /* "spavro/fast_binary.pyx":267 + /* "spavro/fast_binary.pyx":270 * reader = reader_type_map[schema_type](schema) * except KeyError: * reader = schema_cache[schema_type] # <<<<<<<<<<<<<< * * return reader */ - __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_schema_cache); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 267, __pyx_L12_except_error) + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_schema_cache); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 270, __pyx_L12_except_error) __Pyx_GOTREF(__pyx_t_12); - __pyx_t_13 = __Pyx_PyObject_Dict_GetItem(__pyx_t_12, __pyx_v_schema_type); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 267, __pyx_L12_except_error) + __pyx_t_13 = __Pyx_PyObject_Dict_GetItem(__pyx_t_12, __pyx_v_schema_type); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 270, __pyx_L12_except_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_XDECREF_SET(__pyx_v_reader, __pyx_t_13); @@ -7806,7 +8030,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_32get_reader(CYTHON_UNUSED PyObj goto __pyx_L12_except_error; __pyx_L12_except_error:; - /* "spavro/fast_binary.pyx":264 + /* "spavro/fast_binary.pyx":267 * placeholder.reader = reader * return reader * try: # <<<<<<<<<<<<<< @@ -7826,7 +8050,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_32get_reader(CYTHON_UNUSED PyObj __pyx_L15_try_end:; } - /* "spavro/fast_binary.pyx":269 + /* "spavro/fast_binary.pyx":272 * reader = schema_cache[schema_type] * * return reader # <<<<<<<<<<<<<< @@ -7838,7 +8062,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_32get_reader(CYTHON_UNUSED PyObj __pyx_r = __pyx_v_reader; goto __pyx_L0; - /* "spavro/fast_binary.pyx":246 + /* "spavro/fast_binary.pyx":249 * return self.reader(fo) * * def get_reader(schema): # <<<<<<<<<<<<<< @@ -7868,7 +8092,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_32get_reader(CYTHON_UNUSED PyObj return __pyx_r; } -/* "spavro/fast_binary.pyx":274 +/* "spavro/fast_binary.pyx":277 * * * cdef void write_int(outbuf, long long signed_datum): # <<<<<<<<<<<<<< @@ -7885,9 +8109,12 @@ static void __pyx_f_6spavro_11fast_binary_write_int(PyObject *__pyx_v_outbuf, PY PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("write_int", 0); - /* "spavro/fast_binary.pyx":280 + /* "spavro/fast_binary.pyx":283 * unsigned long long datum * char temp_datum * datum = (signed_datum << 1) ^ (signed_datum >> 63) # <<<<<<<<<<<<<< @@ -7896,7 +8123,7 @@ static void __pyx_f_6spavro_11fast_binary_write_int(PyObject *__pyx_v_outbuf, PY */ __pyx_v_datum = ((__pyx_v_signed_datum << 1) ^ (__pyx_v_signed_datum >> 63)); - /* "spavro/fast_binary.pyx":281 + /* "spavro/fast_binary.pyx":284 * char temp_datum * datum = (signed_datum << 1) ^ (signed_datum >> 63) * while datum > 127: # <<<<<<<<<<<<<< @@ -7907,7 +8134,7 @@ static void __pyx_f_6spavro_11fast_binary_write_int(PyObject *__pyx_v_outbuf, PY __pyx_t_1 = ((__pyx_v_datum > 0x7F) != 0); if (!__pyx_t_1) break; - /* "spavro/fast_binary.pyx":282 + /* "spavro/fast_binary.pyx":285 * datum = (signed_datum << 1) ^ (signed_datum >> 63) * while datum > 127: * temp_datum = (datum & 0x7f) | 0x80 # <<<<<<<<<<<<<< @@ -7916,16 +8143,16 @@ static void __pyx_f_6spavro_11fast_binary_write_int(PyObject *__pyx_v_outbuf, PY */ __pyx_v_temp_datum = ((__pyx_v_datum & 0x7f) | 0x80); - /* "spavro/fast_binary.pyx":283 + /* "spavro/fast_binary.pyx":286 * while datum > 127: * temp_datum = (datum & 0x7f) | 0x80 * outbuf.write((&temp_datum)[:sizeof(char)]) # <<<<<<<<<<<<<< * datum >>= 7 * outbuf.write((&datum)[:sizeof(char)]) */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_outbuf, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 283, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_outbuf, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 286, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyBytes_FromStringAndSize(((char *)(&__pyx_v_temp_datum)) + 0, (sizeof(char)) - 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 283, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_FromStringAndSize(((char *)(&__pyx_v_temp_datum)) + 0, (sizeof(char)) - 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 286, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { @@ -7940,12 +8167,12 @@ static void __pyx_f_6spavro_11fast_binary_write_int(PyObject *__pyx_v_outbuf, PY __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 283, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 286, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":284 + /* "spavro/fast_binary.pyx":287 * temp_datum = (datum & 0x7f) | 0x80 * outbuf.write((&temp_datum)[:sizeof(char)]) * datum >>= 7 # <<<<<<<<<<<<<< @@ -7955,16 +8182,16 @@ static void __pyx_f_6spavro_11fast_binary_write_int(PyObject *__pyx_v_outbuf, PY __pyx_v_datum = (__pyx_v_datum >> 7); } - /* "spavro/fast_binary.pyx":285 + /* "spavro/fast_binary.pyx":288 * outbuf.write((&temp_datum)[:sizeof(char)]) * datum >>= 7 * outbuf.write((&datum)[:sizeof(char)]) # <<<<<<<<<<<<<< * * write_long = write_int */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_outbuf, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 285, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_outbuf, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 288, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyBytes_FromStringAndSize(((char *)(&__pyx_v_datum)) + 0, (sizeof(char)) - 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 285, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_FromStringAndSize(((char *)(&__pyx_v_datum)) + 0, (sizeof(char)) - 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 288, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { @@ -7979,12 +8206,12 @@ static void __pyx_f_6spavro_11fast_binary_write_int(PyObject *__pyx_v_outbuf, PY __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 285, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 288, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":274 + /* "spavro/fast_binary.pyx":277 * * * cdef void write_int(outbuf, long long signed_datum): # <<<<<<<<<<<<<< @@ -8004,7 +8231,7 @@ static void __pyx_f_6spavro_11fast_binary_write_int(PyObject *__pyx_v_outbuf, PY __Pyx_RefNannyFinishContext(); } -/* "spavro/fast_binary.pyx":290 +/* "spavro/fast_binary.pyx":293 * * * cdef void write_bytes(outbuf, datum): # <<<<<<<<<<<<<< @@ -8022,28 +8249,31 @@ static void __pyx_f_6spavro_11fast_binary_write_bytes(PyObject *__pyx_v_outbuf, PyObject *__pyx_t_5 = NULL; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("write_bytes", 0); - /* "spavro/fast_binary.pyx":294 + /* "spavro/fast_binary.pyx":297 * Bytes are encoded as a long followed by that many bytes of data. * """ * cdef long byte_count = len(datum) # <<<<<<<<<<<<<< * write_long(outbuf, byte_count) * outbuf.write(datum) */ - __pyx_t_1 = PyObject_Length(__pyx_v_datum); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 294, __pyx_L1_error) + __pyx_t_1 = PyObject_Length(__pyx_v_datum); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 297, __pyx_L1_error) __pyx_v_byte_count = __pyx_t_1; - /* "spavro/fast_binary.pyx":295 + /* "spavro/fast_binary.pyx":298 * """ * cdef long byte_count = len(datum) * write_long(outbuf, byte_count) # <<<<<<<<<<<<<< * outbuf.write(datum) * */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_write_long); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 295, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_write_long); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 298, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_byte_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 295, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_byte_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 298, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; __pyx_t_6 = 0; @@ -8060,7 +8290,7 @@ static void __pyx_f_6spavro_11fast_binary_write_bytes(PyObject *__pyx_v_outbuf, #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_outbuf, __pyx_t_4}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 295, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 298, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -8069,14 +8299,14 @@ static void __pyx_f_6spavro_11fast_binary_write_bytes(PyObject *__pyx_v_outbuf, #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_outbuf, __pyx_t_4}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 295, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 298, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif { - __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 295, __pyx_L1_error) + __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 298, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (__pyx_t_5) { __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; @@ -8087,21 +8317,21 @@ static void __pyx_f_6spavro_11fast_binary_write_bytes(PyObject *__pyx_v_outbuf, __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4); __pyx_t_4 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 295, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 298, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":296 + /* "spavro/fast_binary.pyx":299 * cdef long byte_count = len(datum) * write_long(outbuf, byte_count) * outbuf.write(datum) # <<<<<<<<<<<<<< * * */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_outbuf, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 296, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_outbuf, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 299, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { @@ -8115,12 +8345,12 @@ static void __pyx_f_6spavro_11fast_binary_write_bytes(PyObject *__pyx_v_outbuf, } __pyx_t_2 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_7, __pyx_v_datum) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_datum); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 296, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 299, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":290 + /* "spavro/fast_binary.pyx":293 * * * cdef void write_bytes(outbuf, datum): # <<<<<<<<<<<<<< @@ -8141,7 +8371,7 @@ static void __pyx_f_6spavro_11fast_binary_write_bytes(PyObject *__pyx_v_outbuf, __Pyx_RefNannyFinishContext(); } -/* "spavro/fast_binary.pyx":299 +/* "spavro/fast_binary.pyx":302 * * * cdef void write_utf8(outbuf, datum): # <<<<<<<<<<<<<< @@ -8154,16 +8384,19 @@ static void __pyx_f_6spavro_11fast_binary_write_utf8(PyObject *__pyx_v_outbuf, P PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("write_utf8", 0); - /* "spavro/fast_binary.pyx":303 + /* "spavro/fast_binary.pyx":306 * Unicode are encoded as write_bytes of the utf-8 encoded data. * """ * write_bytes(outbuf, datum.encode("utf-8")) # <<<<<<<<<<<<<< * * */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_datum, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 303, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_datum, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 306, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { @@ -8177,13 +8410,13 @@ static void __pyx_f_6spavro_11fast_binary_write_utf8(PyObject *__pyx_v_outbuf, P } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_utf_8); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 303, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 306, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_f_6spavro_11fast_binary_write_bytes(__pyx_v_outbuf, __pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":299 + /* "spavro/fast_binary.pyx":302 * * * cdef void write_utf8(outbuf, datum): # <<<<<<<<<<<<<< @@ -8202,7 +8435,7 @@ static void __pyx_f_6spavro_11fast_binary_write_utf8(PyObject *__pyx_v_outbuf, P __Pyx_RefNannyFinishContext(); } -/* "spavro/fast_binary.pyx":306 +/* "spavro/fast_binary.pyx":309 * * * cdef void write_float(outbuf, float datum): # <<<<<<<<<<<<<< @@ -8216,18 +8449,21 @@ static void __pyx_f_6spavro_11fast_binary_write_float(PyObject *__pyx_v_outbuf, PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("write_float", 0); - /* "spavro/fast_binary.pyx":312 + /* "spavro/fast_binary.pyx":315 * Java's floatToIntBits and then encoded in little-endian format. * """ * outbuf.write((&datum)[:sizeof(float)]) # <<<<<<<<<<<<<< * * */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_outbuf, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 312, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_outbuf, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 315, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(((char *)(&__pyx_v_datum)) + 0, (sizeof(float)) - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 312, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(((char *)(&__pyx_v_datum)) + 0, (sizeof(float)) - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 315, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { @@ -8242,12 +8478,12 @@ static void __pyx_f_6spavro_11fast_binary_write_float(PyObject *__pyx_v_outbuf, __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 312, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 315, __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; - /* "spavro/fast_binary.pyx":306 + /* "spavro/fast_binary.pyx":309 * * * cdef void write_float(outbuf, float datum): # <<<<<<<<<<<<<< @@ -8267,7 +8503,7 @@ static void __pyx_f_6spavro_11fast_binary_write_float(PyObject *__pyx_v_outbuf, __Pyx_RefNannyFinishContext(); } -/* "spavro/fast_binary.pyx":315 +/* "spavro/fast_binary.pyx":318 * * * cdef void write_double(outbuf, double datum): # <<<<<<<<<<<<<< @@ -8281,18 +8517,21 @@ static void __pyx_f_6spavro_11fast_binary_write_double(PyObject *__pyx_v_outbuf, PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("write_double", 0); - /* "spavro/fast_binary.pyx":321 + /* "spavro/fast_binary.pyx":324 * Java's doubleToLongBits and then encoded in little-endian format. * """ * outbuf.write((&datum)[:sizeof(double)]) # <<<<<<<<<<<<<< * * */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_outbuf, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 321, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_outbuf, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 324, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(((char *)(&__pyx_v_datum)) + 0, (sizeof(double)) - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 321, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(((char *)(&__pyx_v_datum)) + 0, (sizeof(double)) - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 324, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { @@ -8307,12 +8546,12 @@ static void __pyx_f_6spavro_11fast_binary_write_double(PyObject *__pyx_v_outbuf, __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 321, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 324, __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; - /* "spavro/fast_binary.pyx":315 + /* "spavro/fast_binary.pyx":318 * * * cdef void write_double(outbuf, double datum): # <<<<<<<<<<<<<< @@ -8332,83 +8571,7 @@ static void __pyx_f_6spavro_11fast_binary_write_double(PyObject *__pyx_v_outbuf, __Pyx_RefNannyFinishContext(); } -/* "spavro/fast_binary.pyx":324 - * - * - * cdef void write_null(outbuf, datum): # <<<<<<<<<<<<<< - * pass - * - */ - -static void __pyx_f_6spavro_11fast_binary_write_null(CYTHON_UNUSED PyObject *__pyx_v_outbuf, CYTHON_UNUSED PyObject *__pyx_v_datum) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write_null", 0); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "spavro/fast_binary.pyx":328 - * - * - * cdef void write_fixed(outbuf, datum): # <<<<<<<<<<<<<< - * """A fixed writer writes out exactly the bytes up to a count""" - * outbuf.write(datum) - */ - -static void __pyx_f_6spavro_11fast_binary_write_fixed(PyObject *__pyx_v_outbuf, PyObject *__pyx_v_datum) { - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("write_fixed", 0); - - /* "spavro/fast_binary.pyx":330 - * cdef void write_fixed(outbuf, datum): - * """A fixed writer writes out exactly the bytes up to a count""" - * outbuf.write(datum) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_outbuf, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 330, __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_datum) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_datum); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 330, __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; - - /* "spavro/fast_binary.pyx":328 - * - * - * cdef void write_fixed(outbuf, datum): # <<<<<<<<<<<<<< - * """A fixed writer writes out exactly the bytes up to a count""" - * outbuf.write(datum) - */ - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_WriteUnraisable("spavro.fast_binary.write_fixed", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); - __pyx_L0:; - __Pyx_RefNannyFinishContext(); -} - -/* "spavro/fast_binary.pyx":333 +/* "spavro/fast_binary.pyx":327 * * * cdef write_boolean(outbuf, char datum): # <<<<<<<<<<<<<< @@ -8425,9 +8588,12 @@ static PyObject *__pyx_f_6spavro_11fast_binary_write_boolean(PyObject *__pyx_v_o PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("write_boolean", 0); - /* "spavro/fast_binary.pyx":336 + /* "spavro/fast_binary.pyx":330 * """A boolean is written as a single byte whose value is either 0 (false) or * 1 (true).""" * cdef char x = 1 if datum else 0 # <<<<<<<<<<<<<< @@ -8441,16 +8607,16 @@ static PyObject *__pyx_f_6spavro_11fast_binary_write_boolean(PyObject *__pyx_v_o } __pyx_v_x = __pyx_t_1; - /* "spavro/fast_binary.pyx":337 + /* "spavro/fast_binary.pyx":331 * 1 (true).""" * cdef char x = 1 if datum else 0 * outbuf.write((&x)[:sizeof(char)]) # <<<<<<<<<<<<<< * * */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_outbuf, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 337, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_outbuf, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyBytes_FromStringAndSize(((char *)(&__pyx_v_x)) + 0, (sizeof(char)) - 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 337, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_FromStringAndSize(((char *)(&__pyx_v_x)) + 0, (sizeof(char)) - 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 331, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { @@ -8465,12 +8631,12 @@ static PyObject *__pyx_f_6spavro_11fast_binary_write_boolean(PyObject *__pyx_v_o __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 337, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 331, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":333 + /* "spavro/fast_binary.pyx":327 * * * cdef write_boolean(outbuf, char datum): # <<<<<<<<<<<<<< @@ -8494,1423 +8660,1717 @@ static PyObject *__pyx_f_6spavro_11fast_binary_write_boolean(PyObject *__pyx_v_o return __pyx_r; } -/* "spavro/fast_binary.pyx":360 - * CheckField = namedtuple('CheckField', ['name', 'check']) +/* "spavro/fast_binary.pyx":334 * - * def get_check(schema): # <<<<<<<<<<<<<< - * schema = lookup_schema(schema) - * cdef unicode schema_type = get_type(schema) + * + * cdef void write_int_to_array(array.array outbuf, long long signed_datum): # <<<<<<<<<<<<<< + * """int and long values are written using variable-length, zig-zag coding. + * """ */ -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_35get_check(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_35get_check = {"get_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_35get_check, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_35get_check(PyObject *__pyx_self, PyObject *__pyx_v_schema) { - PyObject *__pyx_r = 0; +static void __pyx_f_6spavro_11fast_binary_write_int_to_array(arrayobject *__pyx_v_outbuf, PY_LONG_LONG __pyx_v_signed_datum) { + unsigned PY_LONG_LONG __pyx_v_datum; + char __pyx_v_temp_datum; + size_t __pyx_v_size; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_check (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_34get_check(__pyx_self, ((PyObject *)__pyx_v_schema)); + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write_int_to_array", 0); - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "spavro/fast_binary.pyx":340 + * unsigned long long datum + * char temp_datum + * size_t size = len(outbuf) # <<<<<<<<<<<<<< + * datum = (signed_datum << 1) ^ (signed_datum >> 63) + * while datum > 127: + */ + if (unlikely(((PyObject *)__pyx_v_outbuf) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 340, __pyx_L1_error) + } + __pyx_t_1 = Py_SIZE(((PyObject *)__pyx_v_outbuf)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 340, __pyx_L1_error) + __pyx_v_size = __pyx_t_1; -static PyObject *__pyx_pf_6spavro_11fast_binary_34get_check(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema) { - PyObject *__pyx_v_schema_type = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("get_check", 0); - __Pyx_INCREF(__pyx_v_schema); + /* "spavro/fast_binary.pyx":341 + * char temp_datum + * size_t size = len(outbuf) + * datum = (signed_datum << 1) ^ (signed_datum >> 63) # <<<<<<<<<<<<<< + * while datum > 127: + * temp_datum = (datum & 0x7f) | 0x80 + */ + __pyx_v_datum = ((__pyx_v_signed_datum << 1) ^ (__pyx_v_signed_datum >> 63)); - /* "spavro/fast_binary.pyx":361 - * - * def get_check(schema): - * schema = lookup_schema(schema) # <<<<<<<<<<<<<< - * cdef unicode schema_type = get_type(schema) - * return check_type_map[schema_type](schema) + /* "spavro/fast_binary.pyx":342 + * size_t size = len(outbuf) + * datum = (signed_datum << 1) ^ (signed_datum >> 63) + * while datum > 127: # <<<<<<<<<<<<<< + * temp_datum = (datum & 0x7f) | 0x80 + * array.resize_smart(outbuf, size + 1) */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_lookup_schema); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 361, __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); - } + while (1) { + __pyx_t_2 = ((__pyx_v_datum > 0x7F) != 0); + if (!__pyx_t_2) break; + + /* "spavro/fast_binary.pyx":343 + * datum = (signed_datum << 1) ^ (signed_datum >> 63) + * while datum > 127: + * temp_datum = (datum & 0x7f) | 0x80 # <<<<<<<<<<<<<< + * array.resize_smart(outbuf, size + 1) + * outbuf.data.as_uchars[size] = temp_datum + */ + __pyx_v_temp_datum = ((__pyx_v_datum & 0x7f) | 0x80); + + /* "spavro/fast_binary.pyx":344 + * while datum > 127: + * temp_datum = (datum & 0x7f) | 0x80 + * array.resize_smart(outbuf, size + 1) # <<<<<<<<<<<<<< + * outbuf.data.as_uchars[size] = temp_datum + * size += 1 + */ + __pyx_t_3 = resize_smart(__pyx_v_outbuf, (__pyx_v_size + 1)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 344, __pyx_L1_error) + + /* "spavro/fast_binary.pyx":345 + * temp_datum = (datum & 0x7f) | 0x80 + * array.resize_smart(outbuf, size + 1) + * outbuf.data.as_uchars[size] = temp_datum # <<<<<<<<<<<<<< + * size += 1 + * datum >>= 7 + */ + (__pyx_v_outbuf->data.as_uchars[__pyx_v_size]) = __pyx_v_temp_datum; + + /* "spavro/fast_binary.pyx":346 + * array.resize_smart(outbuf, size + 1) + * outbuf.data.as_uchars[size] = temp_datum + * size += 1 # <<<<<<<<<<<<<< + * datum >>= 7 + * array.resize_smart(outbuf, size + 1) + */ + __pyx_v_size = (__pyx_v_size + 1); + + /* "spavro/fast_binary.pyx":347 + * outbuf.data.as_uchars[size] = temp_datum + * size += 1 + * datum >>= 7 # <<<<<<<<<<<<<< + * array.resize_smart(outbuf, size + 1) + * outbuf.data.as_uchars[size] = datum + */ + __pyx_v_datum = (__pyx_v_datum >> 7); } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_schema) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_schema); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 361, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF_SET(__pyx_v_schema, __pyx_t_1); - __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":362 - * def get_check(schema): - * schema = lookup_schema(schema) - * cdef unicode schema_type = get_type(schema) # <<<<<<<<<<<<<< - * return check_type_map[schema_type](schema) + /* "spavro/fast_binary.pyx":348 + * size += 1 + * datum >>= 7 + * array.resize_smart(outbuf, size + 1) # <<<<<<<<<<<<<< + * outbuf.data.as_uchars[size] = datum * */ - __pyx_t_1 = __pyx_f_6spavro_11fast_binary_get_type(__pyx_v_schema, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 362, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_schema_type = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_3 = resize_smart(__pyx_v_outbuf, (__pyx_v_size + 1)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 348, __pyx_L1_error) - /* "spavro/fast_binary.pyx":363 - * schema = lookup_schema(schema) - * cdef unicode schema_type = get_type(schema) - * return check_type_map[schema_type](schema) # <<<<<<<<<<<<<< - * + /* "spavro/fast_binary.pyx":349 + * datum >>= 7 + * array.resize_smart(outbuf, size + 1) + * outbuf.data.as_uchars[size] = datum # <<<<<<<<<<<<<< * + * cdef void write_long_to_array(array.array outbuf, long long signed_datum): */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_type_map); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 363, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_t_2, __pyx_v_schema_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 363, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_schema) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_schema); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 363, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + (__pyx_v_outbuf->data.as_uchars[__pyx_v_size]) = __pyx_v_datum; - /* "spavro/fast_binary.pyx":360 - * CheckField = namedtuple('CheckField', ['name', 'check']) + /* "spavro/fast_binary.pyx":334 * - * def get_check(schema): # <<<<<<<<<<<<<< - * schema = lookup_schema(schema) - * cdef unicode schema_type = get_type(schema) + * + * cdef void write_int_to_array(array.array outbuf, long long signed_datum): # <<<<<<<<<<<<<< + * """int and long values are written using variable-length, zig-zag coding. + * """ */ /* function exit code */ + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("spavro.fast_binary.get_check", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_WriteUnraisable("spavro.fast_binary.write_int_to_array", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; - __Pyx_XDECREF(__pyx_v_schema_type); - __Pyx_XDECREF(__pyx_v_schema); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "spavro/fast_binary.pyx":366 +/* "spavro/fast_binary.pyx":351 + * outbuf.data.as_uchars[size] = datum * - * - * def make_record_check(schema): # <<<<<<<<<<<<<< - * cdef list fields = [CheckField(field['name'], get_check(field['type'])) for field in schema['fields']] - * def record_check(datum): + * cdef void write_long_to_array(array.array outbuf, long long signed_datum): # <<<<<<<<<<<<<< + * """int and long values are written using variable-length, zig-zag coding. + * """ */ -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_37make_record_check(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_37make_record_check = {"make_record_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_37make_record_check, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_37make_record_check(PyObject *__pyx_self, PyObject *__pyx_v_schema) { - PyObject *__pyx_r = 0; +static void __pyx_f_6spavro_11fast_binary_write_long_to_array(arrayobject *__pyx_v_outbuf, PY_LONG_LONG __pyx_v_signed_datum) { + unsigned PY_LONG_LONG __pyx_v_datum; + char __pyx_v_temp_datum; + size_t __pyx_v_size; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("make_record_check (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_36make_record_check(__pyx_self, ((PyObject *)__pyx_v_schema)); + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write_long_to_array", 0); - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "spavro/fast_binary.pyx":357 + * unsigned long long datum + * char temp_datum + * size_t size = len(outbuf) # <<<<<<<<<<<<<< + * datum = (signed_datum << 1) ^ (signed_datum >> 63) + * while datum > 127: + */ + if (unlikely(((PyObject *)__pyx_v_outbuf) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 357, __pyx_L1_error) + } + __pyx_t_1 = Py_SIZE(((PyObject *)__pyx_v_outbuf)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 357, __pyx_L1_error) + __pyx_v_size = __pyx_t_1; -/* "spavro/fast_binary.pyx":368 - * def make_record_check(schema): - * cdef list fields = [CheckField(field['name'], get_check(field['type'])) for field in schema['fields']] - * def record_check(datum): # <<<<<<<<<<<<<< - * return isinstance(datum, dict) and all([field.check(datum.get(field.name)) for field in fields]) - * return record_check + /* "spavro/fast_binary.pyx":358 + * char temp_datum + * size_t size = len(outbuf) + * datum = (signed_datum << 1) ^ (signed_datum >> 63) # <<<<<<<<<<<<<< + * while datum > 127: + * temp_datum = (datum & 0x7f) | 0x80 */ + __pyx_v_datum = ((__pyx_v_signed_datum << 1) ^ (__pyx_v_signed_datum >> 63)); -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17make_record_check_1record_check(PyObject *__pyx_self, PyObject *__pyx_v_datum); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17make_record_check_1record_check = {"record_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17make_record_check_1record_check, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17make_record_check_1record_check(PyObject *__pyx_self, PyObject *__pyx_v_datum) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("record_check (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_17make_record_check_record_check(__pyx_self, ((PyObject *)__pyx_v_datum)); + /* "spavro/fast_binary.pyx":359 + * size_t size = len(outbuf) + * datum = (signed_datum << 1) ^ (signed_datum >> 63) + * while datum > 127: # <<<<<<<<<<<<<< + * temp_datum = (datum & 0x7f) | 0x80 + * array.resize_smart(outbuf, size + 1) + */ + while (1) { + __pyx_t_2 = ((__pyx_v_datum > 0x7F) != 0); + if (!__pyx_t_2) break; + + /* "spavro/fast_binary.pyx":360 + * datum = (signed_datum << 1) ^ (signed_datum >> 63) + * while datum > 127: + * temp_datum = (datum & 0x7f) | 0x80 # <<<<<<<<<<<<<< + * array.resize_smart(outbuf, size + 1) + * outbuf.data.as_uchars[size] = temp_datum + */ + __pyx_v_temp_datum = ((__pyx_v_datum & 0x7f) | 0x80); + + /* "spavro/fast_binary.pyx":361 + * while datum > 127: + * temp_datum = (datum & 0x7f) | 0x80 + * array.resize_smart(outbuf, size + 1) # <<<<<<<<<<<<<< + * outbuf.data.as_uchars[size] = temp_datum + * size += 1 + */ + __pyx_t_3 = resize_smart(__pyx_v_outbuf, (__pyx_v_size + 1)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 361, __pyx_L1_error) + + /* "spavro/fast_binary.pyx":362 + * temp_datum = (datum & 0x7f) | 0x80 + * array.resize_smart(outbuf, size + 1) + * outbuf.data.as_uchars[size] = temp_datum # <<<<<<<<<<<<<< + * size += 1 + * datum >>= 7 + */ + (__pyx_v_outbuf->data.as_uchars[__pyx_v_size]) = __pyx_v_temp_datum; + + /* "spavro/fast_binary.pyx":363 + * array.resize_smart(outbuf, size + 1) + * outbuf.data.as_uchars[size] = temp_datum + * size += 1 # <<<<<<<<<<<<<< + * datum >>= 7 + * array.resize_smart(outbuf, size + 1) + */ + __pyx_v_size = (__pyx_v_size + 1); + + /* "spavro/fast_binary.pyx":364 + * outbuf.data.as_uchars[size] = temp_datum + * size += 1 + * datum >>= 7 # <<<<<<<<<<<<<< + * array.resize_smart(outbuf, size + 1) + * outbuf.data.as_uchars[size] = datum + */ + __pyx_v_datum = (__pyx_v_datum >> 7); + } + + /* "spavro/fast_binary.pyx":365 + * size += 1 + * datum >>= 7 + * array.resize_smart(outbuf, size + 1) # <<<<<<<<<<<<<< + * outbuf.data.as_uchars[size] = datum + * + */ + __pyx_t_3 = resize_smart(__pyx_v_outbuf, (__pyx_v_size + 1)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 365, __pyx_L1_error) + + /* "spavro/fast_binary.pyx":366 + * datum >>= 7 + * array.resize_smart(outbuf, size + 1) + * outbuf.data.as_uchars[size] = datum # <<<<<<<<<<<<<< + * + * + */ + (__pyx_v_outbuf->data.as_uchars[__pyx_v_size]) = __pyx_v_datum; + + /* "spavro/fast_binary.pyx":351 + * outbuf.data.as_uchars[size] = datum + * + * cdef void write_long_to_array(array.array outbuf, long long signed_datum): # <<<<<<<<<<<<<< + * """int and long values are written using variable-length, zig-zag coding. + * """ + */ /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_WriteUnraisable("spavro.fast_binary.write_long_to_array", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; __Pyx_RefNannyFinishContext(); - return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_17make_record_check_record_check(PyObject *__pyx_self, PyObject *__pyx_v_datum) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check *__pyx_cur_scope; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check *__pyx_outer_scope; - PyObject *__pyx_v_field = NULL; - PyObject *__pyx_r = NULL; +/* "spavro/fast_binary.pyx":369 + * + * + * cdef void write_bytes_to_array(array.array outbuf, datum): # <<<<<<<<<<<<<< + * """ + * Bytes are encoded as a long followed by that many bytes of data. + */ + +static void __pyx_f_6spavro_11fast_binary_write_bytes_to_array(arrayobject *__pyx_v_outbuf, PyObject *__pyx_v_datum) { + size_t __pyx_v_datum_size; + size_t __pyx_v_size; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_1; int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - __Pyx_RefNannySetupContext("record_check", 0); - __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; + char const *__pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write_bytes_to_array", 0); - /* "spavro/fast_binary.pyx":369 - * cdef list fields = [CheckField(field['name'], get_check(field['type'])) for field in schema['fields']] - * def record_check(datum): - * return isinstance(datum, dict) and all([field.check(datum.get(field.name)) for field in fields]) # <<<<<<<<<<<<<< - * return record_check - * + /* "spavro/fast_binary.pyx":374 + * """ + * cdef: + * size_t datum_size = len(datum) # <<<<<<<<<<<<<< + * size_t size = 0 + * write_long_to_array(outbuf, datum_size) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyDict_Check(__pyx_v_datum); - if (__pyx_t_2) { - } else { - __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 369, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L3_bool_binop_done; - } - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 369, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (unlikely(!__pyx_cur_scope->__pyx_v_fields)) { __Pyx_RaiseClosureNameError("fields"); __PYX_ERR(0, 369, __pyx_L1_error) } - if (unlikely(__pyx_cur_scope->__pyx_v_fields == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 369, __pyx_L1_error) - } - __pyx_t_4 = __pyx_cur_scope->__pyx_v_fields; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; - for (;;) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_6); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 369, __pyx_L1_error) - #else - __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 369, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - #endif - __Pyx_XDECREF_SET(__pyx_v_field, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_field, __pyx_n_s_check); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 369, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_datum, __pyx_n_s_get); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 369, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_field, __pyx_n_s_name); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 369, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_11)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_11); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - } - } - __pyx_t_8 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_11, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 369, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - __pyx_t_6 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 369, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 369, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_1 = PyObject_Length(__pyx_v_datum); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 374, __pyx_L1_error) + __pyx_v_datum_size = __pyx_t_1; + + /* "spavro/fast_binary.pyx":375 + * cdef: + * size_t datum_size = len(datum) + * size_t size = 0 # <<<<<<<<<<<<<< + * write_long_to_array(outbuf, datum_size) + * size = len(outbuf) + */ + __pyx_v_size = 0; + + /* "spavro/fast_binary.pyx":376 + * size_t datum_size = len(datum) + * size_t size = 0 + * write_long_to_array(outbuf, datum_size) # <<<<<<<<<<<<<< + * size = len(outbuf) + * array.resize_smart(outbuf, size + datum_size) + */ + __pyx_f_6spavro_11fast_binary_write_long_to_array(__pyx_v_outbuf, __pyx_v_datum_size); + + /* "spavro/fast_binary.pyx":377 + * size_t size = 0 + * write_long_to_array(outbuf, datum_size) + * size = len(outbuf) # <<<<<<<<<<<<<< + * array.resize_smart(outbuf, size + datum_size) + * memcpy(outbuf.data.as_chars + size, datum, datum_size) + */ + if (unlikely(((PyObject *)__pyx_v_outbuf) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 377, __pyx_L1_error) } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_all, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 369, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_INCREF(__pyx_t_4); - __pyx_t_1 = __pyx_t_4; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_L3_bool_binop_done:; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_t_1 = Py_SIZE(((PyObject *)__pyx_v_outbuf)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 377, __pyx_L1_error) + __pyx_v_size = __pyx_t_1; - /* "spavro/fast_binary.pyx":368 - * def make_record_check(schema): - * cdef list fields = [CheckField(field['name'], get_check(field['type'])) for field in schema['fields']] - * def record_check(datum): # <<<<<<<<<<<<<< - * return isinstance(datum, dict) and all([field.check(datum.get(field.name)) for field in fields]) - * return record_check + /* "spavro/fast_binary.pyx":378 + * write_long_to_array(outbuf, datum_size) + * size = len(outbuf) + * array.resize_smart(outbuf, size + datum_size) # <<<<<<<<<<<<<< + * memcpy(outbuf.data.as_chars + size, datum, datum_size) + * + */ + __pyx_t_2 = resize_smart(__pyx_v_outbuf, (__pyx_v_size + __pyx_v_datum_size)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 378, __pyx_L1_error) + + /* "spavro/fast_binary.pyx":379 + * size = len(outbuf) + * array.resize_smart(outbuf, size + datum_size) + * memcpy(outbuf.data.as_chars + size, datum, datum_size) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_3 = __Pyx_PyObject_AsString(__pyx_v_datum); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 379, __pyx_L1_error) + (void)(memcpy((__pyx_v_outbuf->data.as_chars + __pyx_v_size), ((char const *)__pyx_t_3), __pyx_v_datum_size)); + + /* "spavro/fast_binary.pyx":369 + * + * + * cdef void write_bytes_to_array(array.array outbuf, datum): # <<<<<<<<<<<<<< + * """ + * Bytes are encoded as a long followed by that many bytes of data. */ /* function exit code */ + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_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); - __Pyx_AddTraceback("spavro.fast_binary.make_record_check.record_check", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_WriteUnraisable("spavro.fast_binary.write_bytes_to_array", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; - __Pyx_XDECREF(__pyx_v_field); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "spavro/fast_binary.pyx":366 +/* "spavro/fast_binary.pyx":382 * * - * def make_record_check(schema): # <<<<<<<<<<<<<< - * cdef list fields = [CheckField(field['name'], get_check(field['type'])) for field in schema['fields']] - * def record_check(datum): + * cdef void write_utf8_to_array(array.array outbuf, datum): # <<<<<<<<<<<<<< + * """ + * Unicode are encoded as write_bytes_to_array of the utf-8 encoded data. */ -static PyObject *__pyx_pf_6spavro_11fast_binary_36make_record_check(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check *__pyx_cur_scope; - PyObject *__pyx_v_record_check = 0; - PyObject *__pyx_v_field = NULL; - PyObject *__pyx_r = NULL; +static void __pyx_f_6spavro_11fast_binary_write_utf8_to_array(arrayobject *__pyx_v_outbuf, PyObject *__pyx_v_datum) { __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - PyObject *(*__pyx_t_5)(PyObject *); - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - int __pyx_t_12; - __Pyx_RefNannySetupContext("make_record_check", 0); - __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(0, 366, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write_utf8_to_array", 0); - /* "spavro/fast_binary.pyx":367 + /* "spavro/fast_binary.pyx":386 + * Unicode are encoded as write_bytes_to_array of the utf-8 encoded data. + * """ + * write_bytes_to_array(outbuf, datum.encode("utf-8")) # <<<<<<<<<<<<<< + * * - * def make_record_check(schema): - * cdef list fields = [CheckField(field['name'], get_check(field['type'])) for field in schema['fields']] # <<<<<<<<<<<<<< - * def record_check(datum): - * return isinstance(datum, dict) and all([field.check(datum.get(field.name)) for field in fields]) */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_schema, __pyx_n_s_fields); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 367, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_datum, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 386, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; - __pyx_t_5 = NULL; - } else { - __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 367, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - for (;;) { - if (likely(!__pyx_t_5)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 367, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } else { - if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 367, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } - } else { - __pyx_t_2 = __pyx_t_5(__pyx_t_3); - if (unlikely(!__pyx_t_2)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 367, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_XDECREF_SET(__pyx_v_field, __pyx_t_2); - __pyx_t_2 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_CheckField); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_v_field, __pyx_n_s_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_get_check); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_v_field, __pyx_n_s_type); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_11)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_11); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - } - } - __pyx_t_8 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_11, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = NULL; - __pyx_t_12 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - __pyx_t_12 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_7, __pyx_t_8}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_7, __pyx_t_8}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - { - __pyx_t_10 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (__pyx_t_9) { - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL; - } - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_12, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_12, __pyx_t_8); - __pyx_t_7 = 0; - __pyx_t_8 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __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_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_v_fields = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "spavro/fast_binary.pyx":368 - * def make_record_check(schema): - * cdef list fields = [CheckField(field['name'], get_check(field['type'])) for field in schema['fields']] - * def record_check(datum): # <<<<<<<<<<<<<< - * return isinstance(datum, dict) and all([field.check(datum.get(field.name)) for field in fields]) - * return record_check - */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17make_record_check_1record_check, 0, __pyx_n_s_make_record_check_locals_record, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__21)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __pyx_L1_error) + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_utf_8); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 386, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_v_record_check = __pyx_t_1; - __pyx_t_1 = 0; - - /* "spavro/fast_binary.pyx":370 - * def record_check(datum): - * return isinstance(datum, dict) and all([field.check(datum.get(field.name)) for field in fields]) - * return record_check # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_record_check); - __pyx_r = __pyx_v_record_check; - goto __pyx_L0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_f_6spavro_11fast_binary_write_bytes_to_array(__pyx_v_outbuf, __pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":366 + /* "spavro/fast_binary.pyx":382 * * - * def make_record_check(schema): # <<<<<<<<<<<<<< - * cdef list fields = [CheckField(field['name'], get_check(field['type'])) for field in schema['fields']] - * def record_check(datum): + * cdef void write_utf8_to_array(array.array outbuf, datum): # <<<<<<<<<<<<<< + * """ + * Unicode are encoded as write_bytes_to_array of the utf-8 encoded data. */ /* function exit code */ + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_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); - __Pyx_AddTraceback("spavro.fast_binary.make_record_check", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_WriteUnraisable("spavro.fast_binary.write_utf8_to_array", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; - __Pyx_XDECREF(__pyx_v_record_check); - __Pyx_XDECREF(__pyx_v_field); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "spavro/fast_binary.pyx":373 +/* "spavro/fast_binary.pyx":389 * * - * def make_enum_check(schema): # <<<<<<<<<<<<<< - * cdef list symbols = schema['symbols'] - * def enum_check(datum): + * cdef void write_float_to_array(array.array outbuf, float datum): # <<<<<<<<<<<<<< + * """ + * A float is written as 4 bytes. */ -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_39make_enum_check(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_39make_enum_check = {"make_enum_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_39make_enum_check, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_39make_enum_check(PyObject *__pyx_self, PyObject *__pyx_v_schema) { - PyObject *__pyx_r = 0; +static void __pyx_f_6spavro_11fast_binary_write_float_to_array(arrayobject *__pyx_v_outbuf, float __pyx_v_datum) { + size_t __pyx_v_datum_size; + size_t __pyx_v_size; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("make_enum_check (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_38make_enum_check(__pyx_self, ((PyObject *)__pyx_v_schema)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write_float_to_array", 0); -/* "spavro/fast_binary.pyx":375 - * def make_enum_check(schema): - * cdef list symbols = schema['symbols'] - * def enum_check(datum): # <<<<<<<<<<<<<< - * return datum in symbols - * return enum_check + /* "spavro/fast_binary.pyx":396 + * """ + * cdef: + * size_t datum_size = sizeof(float) # <<<<<<<<<<<<<< + * size_t size = len(outbuf) + * array.resize_smart(outbuf, size + datum_size) */ + __pyx_v_datum_size = (sizeof(float)); -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_15make_enum_check_1enum_check(PyObject *__pyx_self, PyObject *__pyx_v_datum); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_15make_enum_check_1enum_check = {"enum_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_15make_enum_check_1enum_check, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_15make_enum_check_1enum_check(PyObject *__pyx_self, PyObject *__pyx_v_datum) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("enum_check (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_15make_enum_check_enum_check(__pyx_self, ((PyObject *)__pyx_v_datum)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "spavro/fast_binary.pyx":397 + * cdef: + * size_t datum_size = sizeof(float) + * size_t size = len(outbuf) # <<<<<<<<<<<<<< + * array.resize_smart(outbuf, size + datum_size) + * memcpy(outbuf.data.as_chars + size, &datum, datum_size) + */ + if (unlikely(((PyObject *)__pyx_v_outbuf) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 397, __pyx_L1_error) + } + __pyx_t_1 = Py_SIZE(((PyObject *)__pyx_v_outbuf)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 397, __pyx_L1_error) + __pyx_v_size = __pyx_t_1; -static PyObject *__pyx_pf_6spavro_11fast_binary_15make_enum_check_enum_check(PyObject *__pyx_self, PyObject *__pyx_v_datum) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check *__pyx_cur_scope; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check *__pyx_outer_scope; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("enum_check", 0); - __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; + /* "spavro/fast_binary.pyx":398 + * size_t datum_size = sizeof(float) + * size_t size = len(outbuf) + * array.resize_smart(outbuf, size + datum_size) # <<<<<<<<<<<<<< + * memcpy(outbuf.data.as_chars + size, &datum, datum_size) + * + */ + __pyx_t_2 = resize_smart(__pyx_v_outbuf, (__pyx_v_size + __pyx_v_datum_size)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 398, __pyx_L1_error) - /* "spavro/fast_binary.pyx":376 - * cdef list symbols = schema['symbols'] - * def enum_check(datum): - * return datum in symbols # <<<<<<<<<<<<<< - * return enum_check + /* "spavro/fast_binary.pyx":399 + * size_t size = len(outbuf) + * array.resize_smart(outbuf, size + datum_size) + * memcpy(outbuf.data.as_chars + size, &datum, datum_size) # <<<<<<<<<<<<<< * + * cdef void write_double_to_array(array.array outbuf, double datum): */ - __Pyx_XDECREF(__pyx_r); - if (unlikely(!__pyx_cur_scope->__pyx_v_symbols)) { __Pyx_RaiseClosureNameError("symbols"); __PYX_ERR(0, 376, __pyx_L1_error) } - __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_datum, __pyx_cur_scope->__pyx_v_symbols, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 376, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 376, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + (void)(memcpy((__pyx_v_outbuf->data.as_chars + __pyx_v_size), ((char const *)(&__pyx_v_datum)), __pyx_v_datum_size)); - /* "spavro/fast_binary.pyx":375 - * def make_enum_check(schema): - * cdef list symbols = schema['symbols'] - * def enum_check(datum): # <<<<<<<<<<<<<< - * return datum in symbols - * return enum_check + /* "spavro/fast_binary.pyx":389 + * + * + * cdef void write_float_to_array(array.array outbuf, float datum): # <<<<<<<<<<<<<< + * """ + * A float is written as 4 bytes. */ /* function exit code */ + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("spavro.fast_binary.make_enum_check.enum_check", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_WriteUnraisable("spavro.fast_binary.write_float_to_array", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "spavro/fast_binary.pyx":373 - * +/* "spavro/fast_binary.pyx":401 + * memcpy(outbuf.data.as_chars + size, &datum, datum_size) * - * def make_enum_check(schema): # <<<<<<<<<<<<<< - * cdef list symbols = schema['symbols'] - * def enum_check(datum): + * cdef void write_double_to_array(array.array outbuf, double datum): # <<<<<<<<<<<<<< + * """ + * A double is written as 8 bytes. */ -static PyObject *__pyx_pf_6spavro_11fast_binary_38make_enum_check(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check *__pyx_cur_scope; - PyObject *__pyx_v_enum_check = 0; - PyObject *__pyx_r = NULL; +static void __pyx_f_6spavro_11fast_binary_write_double_to_array(arrayobject *__pyx_v_outbuf, double __pyx_v_datum) { + size_t __pyx_v_datum_size; + size_t __pyx_v_size; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("make_enum_check", 0); - __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(0, 373, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write_double_to_array", 0); - /* "spavro/fast_binary.pyx":374 - * - * def make_enum_check(schema): - * cdef list symbols = schema['symbols'] # <<<<<<<<<<<<<< - * def enum_check(datum): - * return datum in symbols + /* "spavro/fast_binary.pyx":408 + * """ + * cdef: + * size_t datum_size = sizeof(double) # <<<<<<<<<<<<<< + * size_t size = len(outbuf) + * array.resize_smart(outbuf, size + datum_size) */ - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_schema, __pyx_n_s_symbols); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 374, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 374, __pyx_L1_error) - __Pyx_GIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_v_symbols = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_v_datum_size = (sizeof(double)); - /* "spavro/fast_binary.pyx":375 - * def make_enum_check(schema): - * cdef list symbols = schema['symbols'] - * def enum_check(datum): # <<<<<<<<<<<<<< - * return datum in symbols - * return enum_check + /* "spavro/fast_binary.pyx":409 + * cdef: + * size_t datum_size = sizeof(double) + * size_t size = len(outbuf) # <<<<<<<<<<<<<< + * array.resize_smart(outbuf, size + datum_size) + * memcpy(outbuf.data.as_chars + size, &datum, datum_size) */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_15make_enum_check_1enum_check, 0, __pyx_n_s_make_enum_check_locals_enum_chec, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__23)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 375, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_enum_check = __pyx_t_1; - __pyx_t_1 = 0; + if (unlikely(((PyObject *)__pyx_v_outbuf) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 409, __pyx_L1_error) + } + __pyx_t_1 = Py_SIZE(((PyObject *)__pyx_v_outbuf)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 409, __pyx_L1_error) + __pyx_v_size = __pyx_t_1; - /* "spavro/fast_binary.pyx":377 - * def enum_check(datum): - * return datum in symbols - * return enum_check # <<<<<<<<<<<<<< - * + /* "spavro/fast_binary.pyx":410 + * size_t datum_size = sizeof(double) + * size_t size = len(outbuf) + * array.resize_smart(outbuf, size + datum_size) # <<<<<<<<<<<<<< + * memcpy(outbuf.data.as_chars + size, &datum, datum_size) * */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_enum_check); - __pyx_r = __pyx_v_enum_check; - goto __pyx_L0; + __pyx_t_2 = resize_smart(__pyx_v_outbuf, (__pyx_v_size + __pyx_v_datum_size)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 410, __pyx_L1_error) - /* "spavro/fast_binary.pyx":373 + /* "spavro/fast_binary.pyx":411 + * size_t size = len(outbuf) + * array.resize_smart(outbuf, size + datum_size) + * memcpy(outbuf.data.as_chars + size, &datum, datum_size) # <<<<<<<<<<<<<< * * - * def make_enum_check(schema): # <<<<<<<<<<<<<< - * cdef list symbols = schema['symbols'] - * def enum_check(datum): + */ + (void)(memcpy((__pyx_v_outbuf->data.as_chars + __pyx_v_size), ((char const *)(&__pyx_v_datum)), __pyx_v_datum_size)); + + /* "spavro/fast_binary.pyx":401 + * memcpy(outbuf.data.as_chars + size, &datum, datum_size) + * + * cdef void write_double_to_array(array.array outbuf, double datum): # <<<<<<<<<<<<<< + * """ + * A double is written as 8 bytes. */ /* function exit code */ + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("spavro.fast_binary.make_enum_check", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_WriteUnraisable("spavro.fast_binary.write_double_to_array", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; - __Pyx_XDECREF(__pyx_v_enum_check); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "spavro/fast_binary.pyx":380 +/* "spavro/fast_binary.pyx":414 * * - * def make_null_check(schema): # <<<<<<<<<<<<<< - * return lambda datum: datum is None - * + * cdef void write_fixed_to_array(array.array outbuf, datum): # <<<<<<<<<<<<<< + * """A fixed writer writes out exactly the bytes up to a count""" + * cdef: */ -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_41make_null_check(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_41make_null_check = {"make_null_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_41make_null_check, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_41make_null_check(PyObject *__pyx_self, PyObject *__pyx_v_schema) { - PyObject *__pyx_r = 0; +static void __pyx_f_6spavro_11fast_binary_write_fixed_to_array(arrayobject *__pyx_v_outbuf, PyObject *__pyx_v_datum) { + size_t __pyx_v_datum_size; + size_t __pyx_v_size; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("make_null_check (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_40make_null_check(__pyx_self, ((PyObject *)__pyx_v_schema)); + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + char const *__pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write_fixed_to_array", 0); - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "spavro/fast_binary.pyx":417 + * """A fixed writer writes out exactly the bytes up to a count""" + * cdef: + * size_t datum_size = len(datum) # <<<<<<<<<<<<<< + * size_t size = len(outbuf) + * array.resize_smart(outbuf, size + datum_size) + */ + __pyx_t_1 = PyObject_Length(__pyx_v_datum); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 417, __pyx_L1_error) + __pyx_v_datum_size = __pyx_t_1; + + /* "spavro/fast_binary.pyx":418 + * cdef: + * size_t datum_size = len(datum) + * size_t size = len(outbuf) # <<<<<<<<<<<<<< + * array.resize_smart(outbuf, size + datum_size) + * memcpy(outbuf.data.as_chars + size, datum, datum_size) + */ + if (unlikely(((PyObject *)__pyx_v_outbuf) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 418, __pyx_L1_error) + } + __pyx_t_1 = Py_SIZE(((PyObject *)__pyx_v_outbuf)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 418, __pyx_L1_error) + __pyx_v_size = __pyx_t_1; -/* "spavro/fast_binary.pyx":381 + /* "spavro/fast_binary.pyx":419 + * size_t datum_size = len(datum) + * size_t size = len(outbuf) + * array.resize_smart(outbuf, size + datum_size) # <<<<<<<<<<<<<< + * memcpy(outbuf.data.as_chars + size, datum, datum_size) + * + */ + __pyx_t_2 = resize_smart(__pyx_v_outbuf, (__pyx_v_size + __pyx_v_datum_size)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 419, __pyx_L1_error) + + /* "spavro/fast_binary.pyx":420 + * size_t size = len(outbuf) + * array.resize_smart(outbuf, size + datum_size) + * memcpy(outbuf.data.as_chars + size, datum, datum_size) # <<<<<<<<<<<<<< * - * def make_null_check(schema): - * return lambda datum: datum is None # <<<<<<<<<<<<<< * - * def check_string(datum): */ + __pyx_t_3 = __Pyx_PyObject_AsString(__pyx_v_datum); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 420, __pyx_L1_error) + (void)(memcpy((__pyx_v_outbuf->data.as_chars + __pyx_v_size), ((char const *)__pyx_t_3), __pyx_v_datum_size)); -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_15make_null_check_lambda8(PyObject *__pyx_self, PyObject *__pyx_v_datum); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_15make_null_check_lambda8 = {"lambda8", (PyCFunction)__pyx_pw_6spavro_11fast_binary_15make_null_check_lambda8, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_15make_null_check_lambda8(PyObject *__pyx_self, PyObject *__pyx_v_datum) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("lambda8 (wrapper)", 0); - __pyx_r = __pyx_lambda_funcdef_lambda8(__pyx_self, ((PyObject *)__pyx_v_datum)); + /* "spavro/fast_binary.pyx":414 + * + * + * cdef void write_fixed_to_array(array.array outbuf, datum): # <<<<<<<<<<<<<< + * """A fixed writer writes out exactly the bytes up to a count""" + * cdef: + */ /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_lambda_funcdef_lambda8(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_datum) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("lambda8", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = (__pyx_v_datum == Py_None); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 381, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; goto __pyx_L0; - - /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("spavro.fast_binary.make_null_check.lambda8", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_WriteUnraisable("spavro.fast_binary.write_fixed_to_array", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "spavro/fast_binary.pyx":380 +/* "spavro/fast_binary.pyx":423 * * - * def make_null_check(schema): # <<<<<<<<<<<<<< - * return lambda datum: datum is None - * + * cdef void write_boolean_to_array(array.array outbuf, char datum): # <<<<<<<<<<<<<< + * """A boolean is written as a single byte whose value is either 0 (false) or + * 1 (true).""" */ -static PyObject *__pyx_pf_6spavro_11fast_binary_40make_null_check(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema) { - PyObject *__pyx_r = NULL; +static void __pyx_f_6spavro_11fast_binary_write_boolean_to_array(arrayobject *__pyx_v_outbuf, char __pyx_v_datum) { + char __pyx_v_x; + size_t __pyx_v_size; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("make_null_check", 0); + char __pyx_t_1; + Py_ssize_t __pyx_t_2; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write_boolean_to_array", 0); - /* "spavro/fast_binary.pyx":381 - * - * def make_null_check(schema): - * return lambda datum: datum is None # <<<<<<<<<<<<<< + /* "spavro/fast_binary.pyx":427 + * 1 (true).""" + * cdef: + * char x = 1 if datum else 0 # <<<<<<<<<<<<<< + * size_t size = len(outbuf) + * array.resize_smart(outbuf, size + 1) + */ + if ((__pyx_v_datum != 0)) { + __pyx_t_1 = 1; + } else { + __pyx_t_1 = 0; + } + __pyx_v_x = __pyx_t_1; + + /* "spavro/fast_binary.pyx":428 + * cdef: + * char x = 1 if datum else 0 + * size_t size = len(outbuf) # <<<<<<<<<<<<<< + * array.resize_smart(outbuf, size + 1) + * outbuf.data.as_uchars[size] = x + */ + if (unlikely(((PyObject *)__pyx_v_outbuf) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 428, __pyx_L1_error) + } + __pyx_t_2 = Py_SIZE(((PyObject *)__pyx_v_outbuf)); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 428, __pyx_L1_error) + __pyx_v_size = __pyx_t_2; + + /* "spavro/fast_binary.pyx":429 + * char x = 1 if datum else 0 + * size_t size = len(outbuf) + * array.resize_smart(outbuf, size + 1) # <<<<<<<<<<<<<< + * outbuf.data.as_uchars[size] = x * - * def check_string(datum): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_15make_null_check_lambda8, 0, __pyx_n_s_make_null_check_locals_lambda, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 381, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_t_3 = resize_smart(__pyx_v_outbuf, (__pyx_v_size + 1)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 429, __pyx_L1_error) - /* "spavro/fast_binary.pyx":380 + /* "spavro/fast_binary.pyx":430 + * size_t size = len(outbuf) + * array.resize_smart(outbuf, size + 1) + * outbuf.data.as_uchars[size] = x # <<<<<<<<<<<<<< * * - * def make_null_check(schema): # <<<<<<<<<<<<<< - * return lambda datum: datum is None + */ + (__pyx_v_outbuf->data.as_uchars[__pyx_v_size]) = __pyx_v_x; + + /* "spavro/fast_binary.pyx":423 * + * + * cdef void write_boolean_to_array(array.array outbuf, char datum): # <<<<<<<<<<<<<< + * """A boolean is written as a single byte whose value is either 0 (false) or + * 1 (true).""" */ /* function exit code */ + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("spavro.fast_binary.make_null_check", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_WriteUnraisable("spavro.fast_binary.write_boolean_to_array", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "spavro/fast_binary.pyx":383 - * return lambda datum: datum is None +/* "spavro/fast_binary.pyx":433 * - * def check_string(datum): # <<<<<<<<<<<<<< - * return isinstance(datum, basestring) * + * cdef void write_enum_to_array(array.array outbuf, char datum, list symbols): # <<<<<<<<<<<<<< + * cdef int enum_index = symbols.index(datum) + * write_int_to_array(outbuf, enum_index) */ -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_43check_string(PyObject *__pyx_self, PyObject *__pyx_v_datum); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_43check_string = {"check_string", (PyCFunction)__pyx_pw_6spavro_11fast_binary_43check_string, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_43check_string(PyObject *__pyx_self, PyObject *__pyx_v_datum) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("check_string (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_42check_string(__pyx_self, ((PyObject *)__pyx_v_datum)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_6spavro_11fast_binary_42check_string(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_datum) { - PyObject *__pyx_r = NULL; +static void __pyx_f_6spavro_11fast_binary_write_enum_to_array(arrayobject *__pyx_v_outbuf, char __pyx_v_datum, PyObject *__pyx_v_symbols) { + int __pyx_v_enum_index; __Pyx_RefNannyDeclarations - int __pyx_t_1; + PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("check_string", 0); + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write_enum_to_array", 0); - /* "spavro/fast_binary.pyx":384 + /* "spavro/fast_binary.pyx":434 * - * def check_string(datum): - * return isinstance(datum, basestring) # <<<<<<<<<<<<<< + * cdef void write_enum_to_array(array.array outbuf, char datum, list symbols): + * cdef int enum_index = symbols.index(datum) # <<<<<<<<<<<<<< + * write_int_to_array(outbuf, enum_index) * - * def make_string_check(schema): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBaseString_Check(__pyx_v_datum); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 384, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_char(__pyx_v_datum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyList_Type_index, __pyx_v_symbols, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 434, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 434, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_enum_index = __pyx_t_3; - /* "spavro/fast_binary.pyx":383 - * return lambda datum: datum is None + /* "spavro/fast_binary.pyx":435 + * cdef void write_enum_to_array(array.array outbuf, char datum, list symbols): + * cdef int enum_index = symbols.index(datum) + * write_int_to_array(outbuf, enum_index) # <<<<<<<<<<<<<< + * + * + */ + __pyx_f_6spavro_11fast_binary_write_int_to_array(__pyx_v_outbuf, __pyx_v_enum_index); + + /* "spavro/fast_binary.pyx":433 * - * def check_string(datum): # <<<<<<<<<<<<<< - * return isinstance(datum, basestring) * + * cdef void write_enum_to_array(array.array outbuf, char datum, list symbols): # <<<<<<<<<<<<<< + * cdef int enum_index = symbols.index(datum) + * write_int_to_array(outbuf, enum_index) */ /* function exit code */ + goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("spavro.fast_binary.check_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_WriteUnraisable("spavro.fast_binary.write_enum_to_array", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "spavro/fast_binary.pyx":386 - * return isinstance(datum, basestring) +/* "spavro/fast_binary.pyx":438 * - * def make_string_check(schema): # <<<<<<<<<<<<<< - * return check_string * + * cdef void write_array_to_array(array.array outbuf, list datum, list item_writer): # <<<<<<<<<<<<<< + * cdef: + * size_t item_count = len(datum) */ -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_45make_string_check(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_45make_string_check = {"make_string_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_45make_string_check, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_45make_string_check(PyObject *__pyx_self, PyObject *__pyx_v_schema) { - PyObject *__pyx_r = 0; +static void __pyx_f_6spavro_11fast_binary_write_array_to_array(arrayobject *__pyx_v_outbuf, PyObject *__pyx_v_datum, PyObject *__pyx_v_item_writer) { + size_t __pyx_v_item_count; + PyObject *__pyx_v_item = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("make_string_check (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_44make_string_check(__pyx_self, ((PyObject *)__pyx_v_schema)); + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write_array_to_array", 0); - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "spavro/fast_binary.pyx":440 + * cdef void write_array_to_array(array.array outbuf, list datum, list item_writer): + * cdef: + * size_t item_count = len(datum) # <<<<<<<<<<<<<< + * if item_count > 0: + * write_long_to_array(outbuf, item_count) + */ + if (unlikely(__pyx_v_datum == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 440, __pyx_L1_error) + } + __pyx_t_1 = PyList_GET_SIZE(__pyx_v_datum); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 440, __pyx_L1_error) + __pyx_v_item_count = __pyx_t_1; -static PyObject *__pyx_pf_6spavro_11fast_binary_44make_string_check(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("make_string_check", 0); + /* "spavro/fast_binary.pyx":441 + * cdef: + * size_t item_count = len(datum) + * if item_count > 0: # <<<<<<<<<<<<<< + * write_long_to_array(outbuf, item_count) + * for item in datum: + */ + __pyx_t_2 = ((__pyx_v_item_count > 0) != 0); + if (__pyx_t_2) { + + /* "spavro/fast_binary.pyx":442 + * size_t item_count = len(datum) + * if item_count > 0: + * write_long_to_array(outbuf, item_count) # <<<<<<<<<<<<<< + * for item in datum: + * execute(outbuf, item, item_writer) + */ + __pyx_f_6spavro_11fast_binary_write_long_to_array(__pyx_v_outbuf, __pyx_v_item_count); + + /* "spavro/fast_binary.pyx":441 + * cdef: + * size_t item_count = len(datum) + * if item_count > 0: # <<<<<<<<<<<<<< + * write_long_to_array(outbuf, item_count) + * for item in datum: + */ + } + + /* "spavro/fast_binary.pyx":443 + * if item_count > 0: + * write_long_to_array(outbuf, item_count) + * for item in datum: # <<<<<<<<<<<<<< + * execute(outbuf, item, item_writer) + * write_long_to_array(outbuf, 0) + */ + if (unlikely(__pyx_v_datum == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(0, 443, __pyx_L1_error) + } + __pyx_t_3 = __pyx_v_datum; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0; + for (;;) { + if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 443, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 443, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4); + __pyx_t_4 = 0; - /* "spavro/fast_binary.pyx":387 + /* "spavro/fast_binary.pyx":444 + * write_long_to_array(outbuf, item_count) + * for item in datum: + * execute(outbuf, item, item_writer) # <<<<<<<<<<<<<< + * write_long_to_array(outbuf, 0) + * + */ + __pyx_f_6spavro_11fast_binary_execute(__pyx_v_outbuf, __pyx_v_item, __pyx_v_item_writer); + + /* "spavro/fast_binary.pyx":443 + * if item_count > 0: + * write_long_to_array(outbuf, item_count) + * for item in datum: # <<<<<<<<<<<<<< + * execute(outbuf, item, item_writer) + * write_long_to_array(outbuf, 0) + */ + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spavro/fast_binary.pyx":445 + * for item in datum: + * execute(outbuf, item, item_writer) + * write_long_to_array(outbuf, 0) # <<<<<<<<<<<<<< * - * def make_string_check(schema): - * return check_string # <<<<<<<<<<<<<< * - * def make_long_check(schema): */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_check_string); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 387, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_f_6spavro_11fast_binary_write_long_to_array(__pyx_v_outbuf, 0); - /* "spavro/fast_binary.pyx":386 - * return isinstance(datum, basestring) + /* "spavro/fast_binary.pyx":438 * - * def make_string_check(schema): # <<<<<<<<<<<<<< - * return check_string * + * cdef void write_array_to_array(array.array outbuf, list datum, list item_writer): # <<<<<<<<<<<<<< + * cdef: + * size_t item_count = len(datum) */ /* function exit code */ + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("spavro.fast_binary.make_string_check", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("spavro.fast_binary.write_array_to_array", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_item); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "spavro/fast_binary.pyx":389 - * return check_string +/* "spavro/fast_binary.pyx":448 * - * def make_long_check(schema): # <<<<<<<<<<<<<< - * return lambda datum: isinstance(datum, int) or isinstance(datum, long) * + * cdef void write_map_to_array(array.array outbuf, dict datum, list map_value_writer): # <<<<<<<<<<<<<< + * cdef: + * size_t item_count = len(datum) */ -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_47make_long_check(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_47make_long_check = {"make_long_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_47make_long_check, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_47make_long_check(PyObject *__pyx_self, PyObject *__pyx_v_schema) { - PyObject *__pyx_r = 0; +static void __pyx_f_6spavro_11fast_binary_write_map_to_array(arrayobject *__pyx_v_outbuf, PyObject *__pyx_v_datum, PyObject *__pyx_v_map_value_writer) { + size_t __pyx_v_item_count; + PyObject *__pyx_v_key = NULL; + PyObject *__pyx_v_val = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("make_long_check (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_46make_long_check(__pyx_self, ((PyObject *)__pyx_v_schema)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write_map_to_array", 0); -/* "spavro/fast_binary.pyx":390 - * - * def make_long_check(schema): - * return lambda datum: isinstance(datum, int) or isinstance(datum, long) # <<<<<<<<<<<<<< - * - * def make_boolean_check(schema): + /* "spavro/fast_binary.pyx":450 + * cdef void write_map_to_array(array.array outbuf, dict datum, list map_value_writer): + * cdef: + * size_t item_count = len(datum) # <<<<<<<<<<<<<< + * if item_count > 0: + * write_long_to_array(outbuf, item_count) */ + if (unlikely(__pyx_v_datum == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 450, __pyx_L1_error) + } + __pyx_t_1 = PyDict_Size(__pyx_v_datum); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 450, __pyx_L1_error) + __pyx_v_item_count = __pyx_t_1; -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_15make_long_check_lambda9(PyObject *__pyx_self, PyObject *__pyx_v_datum); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_15make_long_check_lambda9 = {"lambda9", (PyCFunction)__pyx_pw_6spavro_11fast_binary_15make_long_check_lambda9, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_15make_long_check_lambda9(PyObject *__pyx_self, PyObject *__pyx_v_datum) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("lambda9 (wrapper)", 0); - __pyx_r = __pyx_lambda_funcdef_lambda9(__pyx_self, ((PyObject *)__pyx_v_datum)); + /* "spavro/fast_binary.pyx":451 + * cdef: + * size_t item_count = len(datum) + * if item_count > 0: # <<<<<<<<<<<<<< + * write_long_to_array(outbuf, item_count) + * for key, val in datum.iteritems(): + */ + __pyx_t_2 = ((__pyx_v_item_count > 0) != 0); + if (__pyx_t_2) { - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "spavro/fast_binary.pyx":452 + * size_t item_count = len(datum) + * if item_count > 0: + * write_long_to_array(outbuf, item_count) # <<<<<<<<<<<<<< + * for key, val in datum.iteritems(): + * write_utf8_to_array(outbuf, key) + */ + __pyx_f_6spavro_11fast_binary_write_long_to_array(__pyx_v_outbuf, __pyx_v_item_count); -static PyObject *__pyx_lambda_funcdef_lambda9(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_datum) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("lambda9", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyInt_Check(__pyx_v_datum); - if (!__pyx_t_2) { - } else { - __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 390, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L3_bool_binop_done; + /* "spavro/fast_binary.pyx":451 + * cdef: + * size_t item_count = len(datum) + * if item_count > 0: # <<<<<<<<<<<<<< + * write_long_to_array(outbuf, item_count) + * for key, val in datum.iteritems(): + */ } - __pyx_t_2 = PyLong_Check(__pyx_v_datum); - __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 390, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __pyx_t_3; - __pyx_t_3 = 0; - __pyx_L3_bool_binop_done:; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); + /* "spavro/fast_binary.pyx":453 + * if item_count > 0: + * write_long_to_array(outbuf, item_count) + * for key, val in datum.iteritems(): # <<<<<<<<<<<<<< + * write_utf8_to_array(outbuf, key) + * execute(outbuf, val, map_value_writer) + */ + __pyx_t_1 = 0; + if (unlikely(__pyx_v_datum == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems"); + __PYX_ERR(0, 453, __pyx_L1_error) + } + __pyx_t_6 = __Pyx_dict_iterator(__pyx_v_datum, 1, __pyx_n_s_iteritems, (&__pyx_t_4), (&__pyx_t_5)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("spavro.fast_binary.make_long_check.lambda9", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + __pyx_t_3 = __pyx_t_6; + __pyx_t_6 = 0; + while (1) { + __pyx_t_8 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_4, &__pyx_t_1, &__pyx_t_6, &__pyx_t_7, NULL, __pyx_t_5); + if (unlikely(__pyx_t_8 == 0)) break; + if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_7); + __pyx_t_7 = 0; -/* "spavro/fast_binary.pyx":389 - * return check_string - * - * def make_long_check(schema): # <<<<<<<<<<<<<< - * return lambda datum: isinstance(datum, int) or isinstance(datum, long) - * + /* "spavro/fast_binary.pyx":454 + * write_long_to_array(outbuf, item_count) + * for key, val in datum.iteritems(): + * write_utf8_to_array(outbuf, key) # <<<<<<<<<<<<<< + * execute(outbuf, val, map_value_writer) + * write_long_to_array(outbuf, 0) */ + __pyx_f_6spavro_11fast_binary_write_utf8_to_array(__pyx_v_outbuf, __pyx_v_key); -static PyObject *__pyx_pf_6spavro_11fast_binary_46make_long_check(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("make_long_check", 0); + /* "spavro/fast_binary.pyx":455 + * for key, val in datum.iteritems(): + * write_utf8_to_array(outbuf, key) + * execute(outbuf, val, map_value_writer) # <<<<<<<<<<<<<< + * write_long_to_array(outbuf, 0) + * + */ + __pyx_f_6spavro_11fast_binary_execute(__pyx_v_outbuf, __pyx_v_val, __pyx_v_map_value_writer); + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":390 + /* "spavro/fast_binary.pyx":456 + * write_utf8_to_array(outbuf, key) + * execute(outbuf, val, map_value_writer) + * write_long_to_array(outbuf, 0) # <<<<<<<<<<<<<< * - * def make_long_check(schema): - * return lambda datum: isinstance(datum, int) or isinstance(datum, long) # <<<<<<<<<<<<<< * - * def make_boolean_check(schema): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_15make_long_check_lambda9, 0, __pyx_n_s_make_long_check_locals_lambda, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 390, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_f_6spavro_11fast_binary_write_long_to_array(__pyx_v_outbuf, 0); - /* "spavro/fast_binary.pyx":389 - * return check_string + /* "spavro/fast_binary.pyx":448 * - * def make_long_check(schema): # <<<<<<<<<<<<<< - * return lambda datum: isinstance(datum, int) or isinstance(datum, long) * + * cdef void write_map_to_array(array.array outbuf, dict datum, list map_value_writer): # <<<<<<<<<<<<<< + * cdef: + * size_t item_count = len(datum) */ /* function exit code */ + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("spavro.fast_binary.make_long_check", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_WriteUnraisable("spavro.fast_binary.write_map_to_array", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_key); + __Pyx_XDECREF(__pyx_v_val); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "spavro/fast_binary.pyx":392 - * return lambda datum: isinstance(datum, int) or isinstance(datum, long) - * - * def make_boolean_check(schema): # <<<<<<<<<<<<<< - * return lambda datum: isinstance(datum, bool) +/* "spavro/fast_binary.pyx":479 + * CheckField = namedtuple('CheckField', ['name', 'check']) * + * def get_check(schema): # <<<<<<<<<<<<<< + * schema = lookup_schema(schema) + * cdef unicode schema_type = get_type(schema) */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_49make_boolean_check(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_49make_boolean_check = {"make_boolean_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_49make_boolean_check, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_49make_boolean_check(PyObject *__pyx_self, PyObject *__pyx_v_schema) { +static PyObject *__pyx_pw_6spavro_11fast_binary_35get_check(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_35get_check = {"get_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_35get_check, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_35get_check(PyObject *__pyx_self, PyObject *__pyx_v_schema) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("make_boolean_check (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_48make_boolean_check(__pyx_self, ((PyObject *)__pyx_v_schema)); + __Pyx_RefNannySetupContext("get_check (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_34get_check(__pyx_self, ((PyObject *)__pyx_v_schema)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":393 - * - * def make_boolean_check(schema): - * return lambda datum: isinstance(datum, bool) # <<<<<<<<<<<<<< - * - * def make_float_check(schema): - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_18make_boolean_check_lambda10(PyObject *__pyx_self, PyObject *__pyx_v_datum); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_18make_boolean_check_lambda10 = {"lambda10", (PyCFunction)__pyx_pw_6spavro_11fast_binary_18make_boolean_check_lambda10, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_18make_boolean_check_lambda10(PyObject *__pyx_self, PyObject *__pyx_v_datum) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("lambda10 (wrapper)", 0); - __pyx_r = __pyx_lambda_funcdef_lambda10(__pyx_self, ((PyObject *)__pyx_v_datum)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_lambda_funcdef_lambda10(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_datum) { - PyObject *__pyx_r = NULL; +static PyObject *__pyx_pf_6spavro_11fast_binary_34get_check(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema) { + PyObject *__pyx_v_schema_type = 0; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - __Pyx_RefNannySetupContext("lambda10", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject*)&PyBool_Type); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_IsInstance(__pyx_v_datum, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 393, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 393, __pyx_L1_error) + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_check", 0); + __Pyx_INCREF(__pyx_v_schema); + + /* "spavro/fast_binary.pyx":480 + * + * def get_check(schema): + * schema = lookup_schema(schema) # <<<<<<<<<<<<<< + * cdef unicode schema_type = get_type(schema) + * return check_type_map[schema_type](schema) + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_lookup_schema); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 480, __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_schema) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_schema); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_schema, __pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("spavro.fast_binary.make_boolean_check.lambda10", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -/* "spavro/fast_binary.pyx":392 - * return lambda datum: isinstance(datum, int) or isinstance(datum, long) - * - * def make_boolean_check(schema): # <<<<<<<<<<<<<< - * return lambda datum: isinstance(datum, bool) + /* "spavro/fast_binary.pyx":481 + * def get_check(schema): + * schema = lookup_schema(schema) + * cdef unicode schema_type = get_type(schema) # <<<<<<<<<<<<<< + * return check_type_map[schema_type](schema) * */ + __pyx_t_1 = __pyx_f_6spavro_11fast_binary_get_type(__pyx_v_schema, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 481, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_schema_type = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; -static PyObject *__pyx_pf_6spavro_11fast_binary_48make_boolean_check(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("make_boolean_check", 0); - - /* "spavro/fast_binary.pyx":393 + /* "spavro/fast_binary.pyx":482 + * schema = lookup_schema(schema) + * cdef unicode schema_type = get_type(schema) + * return check_type_map[schema_type](schema) # <<<<<<<<<<<<<< * - * def make_boolean_check(schema): - * return lambda datum: isinstance(datum, bool) # <<<<<<<<<<<<<< * - * def make_float_check(schema): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_18make_boolean_check_lambda10, 0, __pyx_n_s_make_boolean_check_locals_lambda, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 393, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_type_map); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_t_2, __pyx_v_schema_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_schema) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_schema); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 482, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "spavro/fast_binary.pyx":392 - * return lambda datum: isinstance(datum, int) or isinstance(datum, long) - * - * def make_boolean_check(schema): # <<<<<<<<<<<<<< - * return lambda datum: isinstance(datum, bool) + /* "spavro/fast_binary.pyx":479 + * CheckField = namedtuple('CheckField', ['name', 'check']) * + * def get_check(schema): # <<<<<<<<<<<<<< + * schema = lookup_schema(schema) + * cdef unicode schema_type = get_type(schema) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("spavro.fast_binary.make_boolean_check", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spavro.fast_binary.get_check", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_schema_type); + __Pyx_XDECREF(__pyx_v_schema); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":395 - * return lambda datum: isinstance(datum, bool) +/* "spavro/fast_binary.pyx":485 * - * def make_float_check(schema): # <<<<<<<<<<<<<< - * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) * + * def make_record_check(schema): # <<<<<<<<<<<<<< + * cdef list fields = [CheckField(field['name'], get_check(field['type'])) for field in schema['fields']] + * def record_check(datum): */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_51make_float_check(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_51make_float_check = {"make_float_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_51make_float_check, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_51make_float_check(PyObject *__pyx_self, PyObject *__pyx_v_schema) { +static PyObject *__pyx_pw_6spavro_11fast_binary_37make_record_check(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_37make_record_check = {"make_record_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_37make_record_check, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_37make_record_check(PyObject *__pyx_self, PyObject *__pyx_v_schema) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("make_float_check (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_50make_float_check(__pyx_self, ((PyObject *)__pyx_v_schema)); + __Pyx_RefNannySetupContext("make_record_check (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_36make_record_check(__pyx_self, ((PyObject *)__pyx_v_schema)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":396 - * - * def make_float_check(schema): - * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) # <<<<<<<<<<<<<< - * - * def make_double_check(schema): +/* "spavro/fast_binary.pyx":487 + * def make_record_check(schema): + * cdef list fields = [CheckField(field['name'], get_check(field['type'])) for field in schema['fields']] + * def record_check(datum): # <<<<<<<<<<<<<< + * return isinstance(datum, dict) and all([field.check(datum.get(field.name)) for field in fields]) + * return record_check */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_16make_float_check_lambda11(PyObject *__pyx_self, PyObject *__pyx_v_datum); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_16make_float_check_lambda11 = {"lambda11", (PyCFunction)__pyx_pw_6spavro_11fast_binary_16make_float_check_lambda11, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_16make_float_check_lambda11(PyObject *__pyx_self, PyObject *__pyx_v_datum) { +static PyObject *__pyx_pw_6spavro_11fast_binary_17make_record_check_1record_check(PyObject *__pyx_self, PyObject *__pyx_v_datum); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17make_record_check_1record_check = {"record_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17make_record_check_1record_check, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17make_record_check_1record_check(PyObject *__pyx_self, PyObject *__pyx_v_datum) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("lambda11 (wrapper)", 0); - __pyx_r = __pyx_lambda_funcdef_lambda11(__pyx_self, ((PyObject *)__pyx_v_datum)); + __Pyx_RefNannySetupContext("record_check (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_17make_record_check_record_check(__pyx_self, ((PyObject *)__pyx_v_datum)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_lambda_funcdef_lambda11(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_datum) { +static PyObject *__pyx_pf_6spavro_11fast_binary_17make_record_check_record_check(PyObject *__pyx_self, PyObject *__pyx_v_datum) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check *__pyx_cur_scope; + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check *__pyx_outer_scope; + PyObject *__pyx_v_field = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("lambda11", 0); + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("record_check", 0); + __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + + /* "spavro/fast_binary.pyx":488 + * cdef list fields = [CheckField(field['name'], get_check(field['type'])) for field in schema['fields']] + * def record_check(datum): + * return isinstance(datum, dict) and all([field.check(datum.get(field.name)) for field in fields]) # <<<<<<<<<<<<<< + * return record_check + * + */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyInt_Check(__pyx_v_datum); - if (!__pyx_t_2) { - } else { - __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 396, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L3_bool_binop_done; - } - __pyx_t_2 = PyLong_Check(__pyx_v_datum); - if (!__pyx_t_2) { + __pyx_t_2 = PyDict_Check(__pyx_v_datum); + if (__pyx_t_2) { } else { - __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 396, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 488, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L3_bool_binop_done; } - __pyx_t_2 = PyFloat_Check(__pyx_v_datum); - __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 396, __pyx_L1_error) + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 488, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __pyx_t_3; - __pyx_t_3 = 0; + if (unlikely(!__pyx_cur_scope->__pyx_v_fields)) { __Pyx_RaiseClosureNameError("fields"); __PYX_ERR(0, 488, __pyx_L1_error) } + if (unlikely(__pyx_cur_scope->__pyx_v_fields == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(0, 488, __pyx_L1_error) + } + __pyx_t_4 = __pyx_cur_scope->__pyx_v_fields; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; + for (;;) { + if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_6); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 488, __pyx_L1_error) + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 488, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + __Pyx_XDECREF_SET(__pyx_v_field, __pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_field, __pyx_n_s_check); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 488, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_datum, __pyx_n_s_get); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 488, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_field, __pyx_n_s_name); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 488, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_11)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_11); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + } + } + __pyx_t_8 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_11, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 488, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + } + } + __pyx_t_6 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 488, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 488, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_all, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 488, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_1 = __pyx_t_4; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_L3_bool_binop_done:; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; + /* "spavro/fast_binary.pyx":487 + * def make_record_check(schema): + * cdef list fields = [CheckField(field['name'], get_check(field['type'])) for field in schema['fields']] + * def record_check(datum): # <<<<<<<<<<<<<< + * return isinstance(datum, dict) and all([field.check(datum.get(field.name)) for field in fields]) + * return record_check + */ + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("spavro.fast_binary.make_float_check.lambda11", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_4); + __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); + __Pyx_AddTraceback("spavro.fast_binary.make_record_check.record_check", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_field); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":395 - * return lambda datum: isinstance(datum, bool) +/* "spavro/fast_binary.pyx":485 * - * def make_float_check(schema): # <<<<<<<<<<<<<< - * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) * + * def make_record_check(schema): # <<<<<<<<<<<<<< + * cdef list fields = [CheckField(field['name'], get_check(field['type'])) for field in schema['fields']] + * def record_check(datum): */ -static PyObject *__pyx_pf_6spavro_11fast_binary_50make_float_check(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema) { +static PyObject *__pyx_pf_6spavro_11fast_binary_36make_record_check(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check *__pyx_cur_scope; + PyObject *__pyx_v_record_check = 0; + PyObject *__pyx_v_field = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("make_float_check", 0); + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *(*__pyx_t_5)(PyObject *); + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + int __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_record_check", 0); + __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 485, __pyx_L1_error) + } else { + __Pyx_GOTREF(__pyx_cur_scope); + } - /* "spavro/fast_binary.pyx":396 - * - * def make_float_check(schema): - * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) # <<<<<<<<<<<<<< + /* "spavro/fast_binary.pyx":486 * - * def make_double_check(schema): + * def make_record_check(schema): + * cdef list fields = [CheckField(field['name'], get_check(field['type'])) for field in schema['fields']] # <<<<<<<<<<<<<< + * def record_check(datum): + * return isinstance(datum, dict) and all([field.check(datum.get(field.name)) for field in fields]) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_16make_float_check_lambda11, 0, __pyx_n_s_make_float_check_locals_lambda, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 396, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 486, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_schema, __pyx_n_s_fields); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 486, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (likely(!__pyx_t_5)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 486, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } else { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 486, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } + } else { + __pyx_t_2 = __pyx_t_5(__pyx_t_3); + if (unlikely(!__pyx_t_2)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 486, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_XDECREF_SET(__pyx_v_field, __pyx_t_2); + __pyx_t_2 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_CheckField); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_v_field, __pyx_n_s_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_get_check); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_v_field, __pyx_n_s_type); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_11)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_11); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + } + } + __pyx_t_8 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_11, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = NULL; + __pyx_t_12 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_12 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_6)) { + PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_7, __pyx_t_8}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { + PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_7, __pyx_t_8}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else + #endif + { + __pyx_t_10 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (__pyx_t_9) { + __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL; + } + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_12, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_12, __pyx_t_8); + __pyx_t_7 = 0; + __pyx_t_8 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_v_fields = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; + + /* "spavro/fast_binary.pyx":487 + * def make_record_check(schema): + * cdef list fields = [CheckField(field['name'], get_check(field['type'])) for field in schema['fields']] + * def record_check(datum): # <<<<<<<<<<<<<< + * return isinstance(datum, dict) and all([field.check(datum.get(field.name)) for field in fields]) + * return record_check + */ + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17make_record_check_1record_check, 0, __pyx_n_s_make_record_check_locals_record, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__21)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 487, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_record_check = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spavro/fast_binary.pyx":489 + * def record_check(datum): + * return isinstance(datum, dict) and all([field.check(datum.get(field.name)) for field in fields]) + * return record_check # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_record_check); + __pyx_r = __pyx_v_record_check; goto __pyx_L0; - /* "spavro/fast_binary.pyx":395 - * return lambda datum: isinstance(datum, bool) + /* "spavro/fast_binary.pyx":485 * - * def make_float_check(schema): # <<<<<<<<<<<<<< - * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) * + * def make_record_check(schema): # <<<<<<<<<<<<<< + * cdef list fields = [CheckField(field['name'], get_check(field['type'])) for field in schema['fields']] + * def record_check(datum): */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("spavro.fast_binary.make_float_check", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __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); + __Pyx_AddTraceback("spavro.fast_binary.make_record_check", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_record_check); + __Pyx_XDECREF(__pyx_v_field); + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":398 - * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) +/* "spavro/fast_binary.pyx":492 * - * def make_double_check(schema): # <<<<<<<<<<<<<< - * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) * + * def make_enum_check(schema): # <<<<<<<<<<<<<< + * cdef list symbols = schema['symbols'] + * def enum_check(datum): */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_53make_double_check(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_53make_double_check = {"make_double_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_53make_double_check, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_53make_double_check(PyObject *__pyx_self, PyObject *__pyx_v_schema) { +static PyObject *__pyx_pw_6spavro_11fast_binary_39make_enum_check(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_39make_enum_check = {"make_enum_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_39make_enum_check, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_39make_enum_check(PyObject *__pyx_self, PyObject *__pyx_v_schema) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("make_double_check (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_52make_double_check(__pyx_self, ((PyObject *)__pyx_v_schema)); + __Pyx_RefNannySetupContext("make_enum_check (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_38make_enum_check(__pyx_self, ((PyObject *)__pyx_v_schema)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":399 - * - * def make_double_check(schema): - * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) # <<<<<<<<<<<<<< - * - * def make_byte_check(schema): +/* "spavro/fast_binary.pyx":494 + * def make_enum_check(schema): + * cdef list symbols = schema['symbols'] + * def enum_check(datum): # <<<<<<<<<<<<<< + * return datum in symbols + * return enum_check */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17make_double_check_lambda12(PyObject *__pyx_self, PyObject *__pyx_v_datum); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17make_double_check_lambda12 = {"lambda12", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17make_double_check_lambda12, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17make_double_check_lambda12(PyObject *__pyx_self, PyObject *__pyx_v_datum) { +static PyObject *__pyx_pw_6spavro_11fast_binary_15make_enum_check_1enum_check(PyObject *__pyx_self, PyObject *__pyx_v_datum); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_15make_enum_check_1enum_check = {"enum_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_15make_enum_check_1enum_check, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_15make_enum_check_1enum_check(PyObject *__pyx_self, PyObject *__pyx_v_datum) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("lambda12 (wrapper)", 0); - __pyx_r = __pyx_lambda_funcdef_lambda12(__pyx_self, ((PyObject *)__pyx_v_datum)); + __Pyx_RefNannySetupContext("enum_check (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_15make_enum_check_enum_check(__pyx_self, ((PyObject *)__pyx_v_datum)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_lambda_funcdef_lambda12(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_datum) { +static PyObject *__pyx_pf_6spavro_11fast_binary_15make_enum_check_enum_check(PyObject *__pyx_self, PyObject *__pyx_v_datum) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check *__pyx_cur_scope; + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check *__pyx_outer_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("lambda12", 0); + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("enum_check", 0); + __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + + /* "spavro/fast_binary.pyx":495 + * cdef list symbols = schema['symbols'] + * def enum_check(datum): + * return datum in symbols # <<<<<<<<<<<<<< + * return enum_check + * + */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyInt_Check(__pyx_v_datum); - if (!__pyx_t_2) { - } else { - __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L3_bool_binop_done; - } - __pyx_t_2 = PyLong_Check(__pyx_v_datum); - if (!__pyx_t_2) { - } else { - __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L3_bool_binop_done; - } - __pyx_t_2 = PyFloat_Check(__pyx_v_datum); - __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __pyx_t_3; - __pyx_t_3 = 0; - __pyx_L3_bool_binop_done:; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + if (unlikely(!__pyx_cur_scope->__pyx_v_symbols)) { __Pyx_RaiseClosureNameError("symbols"); __PYX_ERR(0, 495, __pyx_L1_error) } + __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_datum, __pyx_cur_scope->__pyx_v_symbols, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 495, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 495, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; + /* "spavro/fast_binary.pyx":494 + * def make_enum_check(schema): + * cdef list symbols = schema['symbols'] + * def enum_check(datum): # <<<<<<<<<<<<<< + * return datum in symbols + * return enum_check + */ + /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("spavro.fast_binary.make_double_check.lambda12", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spavro.fast_binary.make_enum_check.enum_check", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -9918,129 +10378,157 @@ static PyObject *__pyx_lambda_funcdef_lambda12(CYTHON_UNUSED PyObject *__pyx_sel return __pyx_r; } -/* "spavro/fast_binary.pyx":398 - * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) +/* "spavro/fast_binary.pyx":492 * - * def make_double_check(schema): # <<<<<<<<<<<<<< - * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) * + * def make_enum_check(schema): # <<<<<<<<<<<<<< + * cdef list symbols = schema['symbols'] + * def enum_check(datum): */ -static PyObject *__pyx_pf_6spavro_11fast_binary_52make_double_check(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema) { +static PyObject *__pyx_pf_6spavro_11fast_binary_38make_enum_check(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check *__pyx_cur_scope; + PyObject *__pyx_v_enum_check = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("make_double_check", 0); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_enum_check", 0); + __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 492, __pyx_L1_error) + } else { + __Pyx_GOTREF(__pyx_cur_scope); + } - /* "spavro/fast_binary.pyx":399 - * - * def make_double_check(schema): - * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) # <<<<<<<<<<<<<< + /* "spavro/fast_binary.pyx":493 * - * def make_byte_check(schema): + * def make_enum_check(schema): + * cdef list symbols = schema['symbols'] # <<<<<<<<<<<<<< + * def enum_check(datum): + * return datum in symbols */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17make_double_check_lambda12, 0, __pyx_n_s_make_double_check_locals_lambda, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 399, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_schema, __pyx_n_s_symbols); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 493, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; + if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 493, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_v_symbols = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spavro/fast_binary.pyx":494 + * def make_enum_check(schema): + * cdef list symbols = schema['symbols'] + * def enum_check(datum): # <<<<<<<<<<<<<< + * return datum in symbols + * return enum_check + */ + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_15make_enum_check_1enum_check, 0, __pyx_n_s_make_enum_check_locals_enum_chec, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__23)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 494, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_enum_check = __pyx_t_1; __pyx_t_1 = 0; + + /* "spavro/fast_binary.pyx":496 + * def enum_check(datum): + * return datum in symbols + * return enum_check # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_enum_check); + __pyx_r = __pyx_v_enum_check; goto __pyx_L0; - /* "spavro/fast_binary.pyx":398 - * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) + /* "spavro/fast_binary.pyx":492 * - * def make_double_check(schema): # <<<<<<<<<<<<<< - * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) * + * def make_enum_check(schema): # <<<<<<<<<<<<<< + * cdef list symbols = schema['symbols'] + * def enum_check(datum): */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("spavro.fast_binary.make_double_check", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.make_enum_check", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_enum_check); + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":401 - * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) +/* "spavro/fast_binary.pyx":499 * - * def make_byte_check(schema): # <<<<<<<<<<<<<< - * return lambda datum: isinstance(datum, str) or isinstance(datum, bytes) + * + * def make_null_check(schema): # <<<<<<<<<<<<<< + * return lambda datum: datum is None * */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_55make_byte_check(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_55make_byte_check = {"make_byte_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_55make_byte_check, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_55make_byte_check(PyObject *__pyx_self, PyObject *__pyx_v_schema) { +static PyObject *__pyx_pw_6spavro_11fast_binary_41make_null_check(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_41make_null_check = {"make_null_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_41make_null_check, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_41make_null_check(PyObject *__pyx_self, PyObject *__pyx_v_schema) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("make_byte_check (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_54make_byte_check(__pyx_self, ((PyObject *)__pyx_v_schema)); + __Pyx_RefNannySetupContext("make_null_check (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_40make_null_check(__pyx_self, ((PyObject *)__pyx_v_schema)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":402 +/* "spavro/fast_binary.pyx":500 * - * def make_byte_check(schema): - * return lambda datum: isinstance(datum, str) or isinstance(datum, bytes) # <<<<<<<<<<<<<< + * def make_null_check(schema): + * return lambda datum: datum is None # <<<<<<<<<<<<<< * - * def make_array_check(schema): + * def check_string(datum): */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_15make_byte_check_lambda13(PyObject *__pyx_self, PyObject *__pyx_v_datum); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_15make_byte_check_lambda13 = {"lambda13", (PyCFunction)__pyx_pw_6spavro_11fast_binary_15make_byte_check_lambda13, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_15make_byte_check_lambda13(PyObject *__pyx_self, PyObject *__pyx_v_datum) { +static PyObject *__pyx_pw_6spavro_11fast_binary_15make_null_check_lambda8(PyObject *__pyx_self, PyObject *__pyx_v_datum); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_15make_null_check_lambda8 = {"lambda8", (PyCFunction)__pyx_pw_6spavro_11fast_binary_15make_null_check_lambda8, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_15make_null_check_lambda8(PyObject *__pyx_self, PyObject *__pyx_v_datum) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("lambda13 (wrapper)", 0); - __pyx_r = __pyx_lambda_funcdef_lambda13(__pyx_self, ((PyObject *)__pyx_v_datum)); + __Pyx_RefNannySetupContext("lambda8 (wrapper)", 0); + __pyx_r = __pyx_lambda_funcdef_lambda8(__pyx_self, ((PyObject *)__pyx_v_datum)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_lambda_funcdef_lambda13(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_datum) { +static PyObject *__pyx_lambda_funcdef_lambda8(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_datum) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("lambda13", 0); + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda8", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyString_Check(__pyx_v_datum); - if (!__pyx_t_2) { - } else { - __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 402, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L3_bool_binop_done; - } - __pyx_t_2 = PyBytes_Check(__pyx_v_datum); - __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 402, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __pyx_t_3; - __pyx_t_3 = 0; - __pyx_L3_bool_binop_done:; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_1 = (__pyx_v_datum == Py_None); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 500, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("spavro.fast_binary.make_byte_check.lambda13", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spavro.fast_binary.make_null_check.lambda8", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -10048,46 +10536,49 @@ static PyObject *__pyx_lambda_funcdef_lambda13(CYTHON_UNUSED PyObject *__pyx_sel return __pyx_r; } -/* "spavro/fast_binary.pyx":401 - * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) +/* "spavro/fast_binary.pyx":499 * - * def make_byte_check(schema): # <<<<<<<<<<<<<< - * return lambda datum: isinstance(datum, str) or isinstance(datum, bytes) + * + * def make_null_check(schema): # <<<<<<<<<<<<<< + * return lambda datum: datum is None * */ -static PyObject *__pyx_pf_6spavro_11fast_binary_54make_byte_check(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema) { +static PyObject *__pyx_pf_6spavro_11fast_binary_40make_null_check(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("make_byte_check", 0); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_null_check", 0); - /* "spavro/fast_binary.pyx":402 + /* "spavro/fast_binary.pyx":500 * - * def make_byte_check(schema): - * return lambda datum: isinstance(datum, str) or isinstance(datum, bytes) # <<<<<<<<<<<<<< + * def make_null_check(schema): + * return lambda datum: datum is None # <<<<<<<<<<<<<< * - * def make_array_check(schema): + * def check_string(datum): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_15make_byte_check_lambda13, 0, __pyx_n_s_make_byte_check_locals_lambda, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 402, __pyx_L1_error) + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_15make_null_check_lambda8, 0, __pyx_n_s_make_null_check_locals_lambda, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 500, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "spavro/fast_binary.pyx":401 - * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) + /* "spavro/fast_binary.pyx":499 * - * def make_byte_check(schema): # <<<<<<<<<<<<<< - * return lambda datum: isinstance(datum, str) or isinstance(datum, bytes) + * + * def make_null_check(schema): # <<<<<<<<<<<<<< + * return lambda datum: datum is None * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("spavro.fast_binary.make_byte_check", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.make_null_check", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -10095,668 +10586,472 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_54make_byte_check(CYTHON_UNUSED return __pyx_r; } -/* "spavro/fast_binary.pyx":404 - * return lambda datum: isinstance(datum, str) or isinstance(datum, bytes) +/* "spavro/fast_binary.pyx":502 + * return lambda datum: datum is None + * + * def check_string(datum): # <<<<<<<<<<<<<< + * return isinstance(datum, basestring) * - * def make_array_check(schema): # <<<<<<<<<<<<<< - * item_check = get_check(schema['items']) - * def array_check(datum): */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_57make_array_check(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_57make_array_check = {"make_array_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_57make_array_check, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_57make_array_check(PyObject *__pyx_self, PyObject *__pyx_v_schema) { +static PyObject *__pyx_pw_6spavro_11fast_binary_43check_string(PyObject *__pyx_self, PyObject *__pyx_v_datum); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_43check_string = {"check_string", (PyCFunction)__pyx_pw_6spavro_11fast_binary_43check_string, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_43check_string(PyObject *__pyx_self, PyObject *__pyx_v_datum) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("make_array_check (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_56make_array_check(__pyx_self, ((PyObject *)__pyx_v_schema)); + __Pyx_RefNannySetupContext("check_string (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_42check_string(__pyx_self, ((PyObject *)__pyx_v_datum)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":406 - * def make_array_check(schema): - * item_check = get_check(schema['items']) - * def array_check(datum): # <<<<<<<<<<<<<< - * return isinstance(datum, list) and all([item_check(item) for item in datum]) - * return array_check +static PyObject *__pyx_pf_6spavro_11fast_binary_42check_string(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_datum) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("check_string", 0); + + /* "spavro/fast_binary.pyx":503 + * + * def check_string(datum): + * return isinstance(datum, basestring) # <<<<<<<<<<<<<< + * + * def make_string_check(schema): */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBaseString_Check(__pyx_v_datum); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 503, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_16make_array_check_1array_check(PyObject *__pyx_self, PyObject *__pyx_v_datum); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_16make_array_check_1array_check = {"array_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_16make_array_check_1array_check, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_16make_array_check_1array_check(PyObject *__pyx_self, PyObject *__pyx_v_datum) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("array_check (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_16make_array_check_array_check(__pyx_self, ((PyObject *)__pyx_v_datum)); + /* "spavro/fast_binary.pyx":502 + * return lambda datum: datum is None + * + * def check_string(datum): # <<<<<<<<<<<<<< + * return isinstance(datum, basestring) + * + */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spavro.fast_binary.check_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_16make_array_check_array_check(PyObject *__pyx_self, PyObject *__pyx_v_datum) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check *__pyx_cur_scope; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check *__pyx_outer_scope; - PyObject *__pyx_v_item = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - PyObject *(*__pyx_t_6)(PyObject *); - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - __Pyx_RefNannySetupContext("array_check", 0); - __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; - - /* "spavro/fast_binary.pyx":407 - * item_check = get_check(schema['items']) - * def array_check(datum): - * return isinstance(datum, list) and all([item_check(item) for item in datum]) # <<<<<<<<<<<<<< - * return array_check +/* "spavro/fast_binary.pyx":505 + * return isinstance(datum, basestring) + * + * def make_string_check(schema): # <<<<<<<<<<<<<< + * return check_string * */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyList_Check(__pyx_v_datum); - if (__pyx_t_2) { - } else { - __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 407, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L3_bool_binop_done; - } - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 407, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (likely(PyList_CheckExact(__pyx_v_datum)) || PyTuple_CheckExact(__pyx_v_datum)) { - __pyx_t_4 = __pyx_v_datum; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; - __pyx_t_6 = NULL; - } else { - __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_datum); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 407, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 407, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_6)) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 407, __pyx_L1_error) - #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 407, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - #endif - } else { - if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 407, __pyx_L1_error) - #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 407, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - #endif - } - } else { - __pyx_t_7 = __pyx_t_6(__pyx_t_4); - if (unlikely(!__pyx_t_7)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 407, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_7); - } - __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7); - __pyx_t_7 = 0; - if (unlikely(!__pyx_cur_scope->__pyx_v_item_check)) { __Pyx_RaiseClosureNameError("item_check"); __PYX_ERR(0, 407, __pyx_L1_error) } - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_item_check); - __pyx_t_8 = __pyx_cur_scope->__pyx_v_item_check; __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - __pyx_t_7 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_v_item) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_item); - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 407, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 407, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_all, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 407, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_INCREF(__pyx_t_4); - __pyx_t_1 = __pyx_t_4; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_L3_bool_binop_done:; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - /* "spavro/fast_binary.pyx":406 - * def make_array_check(schema): - * item_check = get_check(schema['items']) - * def array_check(datum): # <<<<<<<<<<<<<< - * return isinstance(datum, list) and all([item_check(item) for item in datum]) - * return array_check - */ +/* Python wrapper */ +static PyObject *__pyx_pw_6spavro_11fast_binary_45make_string_check(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_45make_string_check = {"make_string_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_45make_string_check, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_45make_string_check(PyObject *__pyx_self, PyObject *__pyx_v_schema) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("make_string_check (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_44make_string_check(__pyx_self, ((PyObject *)__pyx_v_schema)); /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("spavro.fast_binary.make_array_check.array_check", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_item); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":404 - * return lambda datum: isinstance(datum, str) or isinstance(datum, bytes) - * - * def make_array_check(schema): # <<<<<<<<<<<<<< - * item_check = get_check(schema['items']) - * def array_check(datum): - */ - -static PyObject *__pyx_pf_6spavro_11fast_binary_56make_array_check(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check *__pyx_cur_scope; - PyObject *__pyx_v_array_check = 0; +static PyObject *__pyx_pf_6spavro_11fast_binary_44make_string_check(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("make_array_check", 0); - __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(0, 404, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_string_check", 0); - /* "spavro/fast_binary.pyx":405 + /* "spavro/fast_binary.pyx":506 * - * def make_array_check(schema): - * item_check = get_check(schema['items']) # <<<<<<<<<<<<<< - * def array_check(datum): - * return isinstance(datum, list) and all([item_check(item) for item in datum]) - */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_check); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 405, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_schema, __pyx_n_s_items); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 405, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - 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_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 405, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_v_item_check = __pyx_t_1; - __pyx_t_1 = 0; - - /* "spavro/fast_binary.pyx":406 - * def make_array_check(schema): - * item_check = get_check(schema['items']) - * def array_check(datum): # <<<<<<<<<<<<<< - * return isinstance(datum, list) and all([item_check(item) for item in datum]) - * return array_check - */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_16make_array_check_1array_check, 0, __pyx_n_s_make_array_check_locals_array_ch, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__25)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 406, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_array_check = __pyx_t_1; - __pyx_t_1 = 0; - - /* "spavro/fast_binary.pyx":408 - * def array_check(datum): - * return isinstance(datum, list) and all([item_check(item) for item in datum]) - * return array_check # <<<<<<<<<<<<<< + * def make_string_check(schema): + * return check_string # <<<<<<<<<<<<<< * - * def make_union_check(union_schema): + * def make_long_check(schema): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_array_check); - __pyx_r = __pyx_v_array_check; + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_check_string); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 506, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; - /* "spavro/fast_binary.pyx":404 - * return lambda datum: isinstance(datum, str) or isinstance(datum, bytes) + /* "spavro/fast_binary.pyx":505 + * return isinstance(datum, basestring) + * + * def make_string_check(schema): # <<<<<<<<<<<<<< + * return check_string * - * def make_array_check(schema): # <<<<<<<<<<<<<< - * item_check = get_check(schema['items']) - * def array_check(datum): */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("spavro.fast_binary.make_array_check", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.make_string_check", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_array_check); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":410 - * return array_check +/* "spavro/fast_binary.pyx":508 + * return check_string + * + * def make_long_check(schema): # <<<<<<<<<<<<<< + * return lambda datum: isinstance(datum, int) or isinstance(datum, long) * - * def make_union_check(union_schema): # <<<<<<<<<<<<<< - * cdef list union_checks = [get_check(schema) for schema in union_schema] - * def union_check(datum): */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_59make_union_check(PyObject *__pyx_self, PyObject *__pyx_v_union_schema); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_59make_union_check = {"make_union_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_59make_union_check, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_59make_union_check(PyObject *__pyx_self, PyObject *__pyx_v_union_schema) { +static PyObject *__pyx_pw_6spavro_11fast_binary_47make_long_check(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_47make_long_check = {"make_long_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_47make_long_check, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_47make_long_check(PyObject *__pyx_self, PyObject *__pyx_v_schema) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("make_union_check (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_58make_union_check(__pyx_self, ((PyObject *)__pyx_v_union_schema)); + __Pyx_RefNannySetupContext("make_long_check (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_46make_long_check(__pyx_self, ((PyObject *)__pyx_v_schema)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":412 - * def make_union_check(union_schema): - * cdef list union_checks = [get_check(schema) for schema in union_schema] - * def union_check(datum): # <<<<<<<<<<<<<< - * return any([check(datum) for check in union_checks]) - * return union_check +/* "spavro/fast_binary.pyx":509 + * + * def make_long_check(schema): + * return lambda datum: isinstance(datum, int) or isinstance(datum, long) # <<<<<<<<<<<<<< + * + * def make_boolean_check(schema): */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_16make_union_check_1union_check(PyObject *__pyx_self, PyObject *__pyx_v_datum); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_16make_union_check_1union_check = {"union_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_16make_union_check_1union_check, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_16make_union_check_1union_check(PyObject *__pyx_self, PyObject *__pyx_v_datum) { +static PyObject *__pyx_pw_6spavro_11fast_binary_15make_long_check_lambda9(PyObject *__pyx_self, PyObject *__pyx_v_datum); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_15make_long_check_lambda9 = {"lambda9", (PyCFunction)__pyx_pw_6spavro_11fast_binary_15make_long_check_lambda9, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_15make_long_check_lambda9(PyObject *__pyx_self, PyObject *__pyx_v_datum) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("union_check (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_16make_union_check_union_check(__pyx_self, ((PyObject *)__pyx_v_datum)); + __Pyx_RefNannySetupContext("lambda9 (wrapper)", 0); + __pyx_r = __pyx_lambda_funcdef_lambda9(__pyx_self, ((PyObject *)__pyx_v_datum)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_16make_union_check_union_check(PyObject *__pyx_self, PyObject *__pyx_v_datum) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check *__pyx_cur_scope; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check *__pyx_outer_scope; - PyObject *__pyx_v_check = NULL; +static PyObject *__pyx_lambda_funcdef_lambda9(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_datum) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - __Pyx_RefNannySetupContext("union_check", 0); - __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; - - /* "spavro/fast_binary.pyx":413 - * cdef list union_checks = [get_check(schema) for schema in union_schema] - * def union_check(datum): - * return any([check(datum) for check in union_checks]) # <<<<<<<<<<<<<< - * return union_check - * - */ + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda9", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 413, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(!__pyx_cur_scope->__pyx_v_union_checks)) { __Pyx_RaiseClosureNameError("union_checks"); __PYX_ERR(0, 413, __pyx_L1_error) } - if (unlikely(__pyx_cur_scope->__pyx_v_union_checks == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 413, __pyx_L1_error) - } - __pyx_t_2 = __pyx_cur_scope->__pyx_v_union_checks; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; - for (;;) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 413, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 413, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - __Pyx_XDECREF_SET(__pyx_v_check, __pyx_t_4); - __pyx_t_4 = 0; - __Pyx_INCREF(__pyx_v_check); - __pyx_t_5 = __pyx_v_check; __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_datum) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_datum); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 413, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 413, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2 = PyInt_Check(__pyx_v_datum); + if (!__pyx_t_2) { + } else { + __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 509, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L3_bool_binop_done; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_any, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 413, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_2 = PyLong_Check(__pyx_v_datum); + __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 509, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + __pyx_L3_bool_binop_done:; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; - /* "spavro/fast_binary.pyx":412 - * def make_union_check(union_schema): - * cdef list union_checks = [get_check(schema) for schema in union_schema] - * def union_check(datum): # <<<<<<<<<<<<<< - * return any([check(datum) for check in union_checks]) - * return union_check - */ - /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("spavro.fast_binary.make_union_check.union_check", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spavro.fast_binary.make_long_check.lambda9", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_check); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":410 - * return array_check +/* "spavro/fast_binary.pyx":508 + * return check_string + * + * def make_long_check(schema): # <<<<<<<<<<<<<< + * return lambda datum: isinstance(datum, int) or isinstance(datum, long) * - * def make_union_check(union_schema): # <<<<<<<<<<<<<< - * cdef list union_checks = [get_check(schema) for schema in union_schema] - * def union_check(datum): */ -static PyObject *__pyx_pf_6spavro_11fast_binary_58make_union_check(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_union_schema) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check *__pyx_cur_scope; - PyObject *__pyx_v_union_check = 0; - PyObject *__pyx_v_schema = NULL; +static PyObject *__pyx_pf_6spavro_11fast_binary_46make_long_check(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - PyObject *(*__pyx_t_4)(PyObject *); - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - __Pyx_RefNannySetupContext("make_union_check", 0); - __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(0, 410, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_long_check", 0); - /* "spavro/fast_binary.pyx":411 + /* "spavro/fast_binary.pyx":509 * - * def make_union_check(union_schema): - * cdef list union_checks = [get_check(schema) for schema in union_schema] # <<<<<<<<<<<<<< - * def union_check(datum): - * return any([check(datum) for check in union_checks]) - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 411, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (likely(PyList_CheckExact(__pyx_v_union_schema)) || PyTuple_CheckExact(__pyx_v_union_schema)) { - __pyx_t_2 = __pyx_v_union_schema; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_union_schema); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 411, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 411, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 411, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 411, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 411, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 411, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } - } else { - __pyx_t_5 = __pyx_t_4(__pyx_t_2); - if (unlikely(!__pyx_t_5)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 411, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_5); - } - __Pyx_XDECREF_SET(__pyx_v_schema, __pyx_t_5); - __pyx_t_5 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_get_check); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 411, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_schema) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_schema); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 411, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 411, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_v_union_checks = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "spavro/fast_binary.pyx":412 - * def make_union_check(union_schema): - * cdef list union_checks = [get_check(schema) for schema in union_schema] - * def union_check(datum): # <<<<<<<<<<<<<< - * return any([check(datum) for check in union_checks]) - * return union_check - */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_16make_union_check_1union_check, 0, __pyx_n_s_make_union_check_locals_union_ch, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__27)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 412, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_union_check = __pyx_t_1; - __pyx_t_1 = 0; - - /* "spavro/fast_binary.pyx":414 - * def union_check(datum): - * return any([check(datum) for check in union_checks]) - * return union_check # <<<<<<<<<<<<<< + * def make_long_check(schema): + * return lambda datum: isinstance(datum, int) or isinstance(datum, long) # <<<<<<<<<<<<<< * - * def make_fixed_check(schema): + * def make_boolean_check(schema): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_union_check); - __pyx_r = __pyx_v_union_check; + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_15make_long_check_lambda9, 0, __pyx_n_s_make_long_check_locals_lambda, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 509, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; - /* "spavro/fast_binary.pyx":410 - * return array_check + /* "spavro/fast_binary.pyx":508 + * return check_string + * + * def make_long_check(schema): # <<<<<<<<<<<<<< + * return lambda datum: isinstance(datum, int) or isinstance(datum, long) * - * def make_union_check(union_schema): # <<<<<<<<<<<<<< - * cdef list union_checks = [get_check(schema) for schema in union_schema] - * def union_check(datum): */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("spavro.fast_binary.make_union_check", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.make_long_check", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_union_check); - __Pyx_XDECREF(__pyx_v_schema); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":416 - * return union_check +/* "spavro/fast_binary.pyx":511 + * return lambda datum: isinstance(datum, int) or isinstance(datum, long) + * + * def make_boolean_check(schema): # <<<<<<<<<<<<<< + * return lambda datum: isinstance(datum, bool) * - * def make_fixed_check(schema): # <<<<<<<<<<<<<< - * cdef int size = schema['size'] - * def fixed_check(datum): */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_61make_fixed_check(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_61make_fixed_check = {"make_fixed_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_61make_fixed_check, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_61make_fixed_check(PyObject *__pyx_self, PyObject *__pyx_v_schema) { +static PyObject *__pyx_pw_6spavro_11fast_binary_49make_boolean_check(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_49make_boolean_check = {"make_boolean_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_49make_boolean_check, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_49make_boolean_check(PyObject *__pyx_self, PyObject *__pyx_v_schema) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("make_fixed_check (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_60make_fixed_check(__pyx_self, ((PyObject *)__pyx_v_schema)); + __Pyx_RefNannySetupContext("make_boolean_check (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_48make_boolean_check(__pyx_self, ((PyObject *)__pyx_v_schema)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":418 - * def make_fixed_check(schema): - * cdef int size = schema['size'] - * def fixed_check(datum): # <<<<<<<<<<<<<< - * return (isinstance(datum, str) or isinstance(datum, bytes)) and len(datum) == size - * return fixed_check +/* "spavro/fast_binary.pyx":512 + * + * def make_boolean_check(schema): + * return lambda datum: isinstance(datum, bool) # <<<<<<<<<<<<<< + * + * def make_float_check(schema): */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_16make_fixed_check_1fixed_check(PyObject *__pyx_self, PyObject *__pyx_v_datum); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_16make_fixed_check_1fixed_check = {"fixed_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_16make_fixed_check_1fixed_check, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_16make_fixed_check_1fixed_check(PyObject *__pyx_self, PyObject *__pyx_v_datum) { +static PyObject *__pyx_pw_6spavro_11fast_binary_18make_boolean_check_lambda10(PyObject *__pyx_self, PyObject *__pyx_v_datum); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_18make_boolean_check_lambda10 = {"lambda10", (PyCFunction)__pyx_pw_6spavro_11fast_binary_18make_boolean_check_lambda10, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_18make_boolean_check_lambda10(PyObject *__pyx_self, PyObject *__pyx_v_datum) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("fixed_check (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_16make_fixed_check_fixed_check(__pyx_self, ((PyObject *)__pyx_v_datum)); + __Pyx_RefNannySetupContext("lambda10 (wrapper)", 0); + __pyx_r = __pyx_lambda_funcdef_lambda10(__pyx_self, ((PyObject *)__pyx_v_datum)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_16make_fixed_check_fixed_check(PyObject *__pyx_self, PyObject *__pyx_v_datum) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check *__pyx_cur_scope; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check *__pyx_outer_scope; +static PyObject *__pyx_lambda_funcdef_lambda10(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_datum) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - __Pyx_RefNannySetupContext("fixed_check", 0); - __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; - - /* "spavro/fast_binary.pyx":419 - * cdef int size = schema['size'] - * def fixed_check(datum): - * return (isinstance(datum, str) or isinstance(datum, bytes)) and len(datum) == size # <<<<<<<<<<<<<< - * return fixed_check - * - */ + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda10", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyString_Check(__pyx_v_datum); + __pyx_t_1 = ((PyObject*)&PyBool_Type); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = PyObject_IsInstance(__pyx_v_datum, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 512, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 512, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spavro.fast_binary.make_boolean_check.lambda10", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spavro/fast_binary.pyx":511 + * return lambda datum: isinstance(datum, int) or isinstance(datum, long) + * + * def make_boolean_check(schema): # <<<<<<<<<<<<<< + * return lambda datum: isinstance(datum, bool) + * + */ + +static PyObject *__pyx_pf_6spavro_11fast_binary_48make_boolean_check(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_boolean_check", 0); + + /* "spavro/fast_binary.pyx":512 + * + * def make_boolean_check(schema): + * return lambda datum: isinstance(datum, bool) # <<<<<<<<<<<<<< + * + * def make_float_check(schema): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_18make_boolean_check_lambda10, 0, __pyx_n_s_make_boolean_check_locals_lambda, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 512, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spavro/fast_binary.pyx":511 + * return lambda datum: isinstance(datum, int) or isinstance(datum, long) + * + * def make_boolean_check(schema): # <<<<<<<<<<<<<< + * return lambda datum: isinstance(datum, bool) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spavro.fast_binary.make_boolean_check", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spavro/fast_binary.pyx":514 + * return lambda datum: isinstance(datum, bool) + * + * def make_float_check(schema): # <<<<<<<<<<<<<< + * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6spavro_11fast_binary_51make_float_check(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_51make_float_check = {"make_float_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_51make_float_check, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_51make_float_check(PyObject *__pyx_self, PyObject *__pyx_v_schema) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("make_float_check (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_50make_float_check(__pyx_self, ((PyObject *)__pyx_v_schema)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spavro/fast_binary.pyx":515 + * + * def make_float_check(schema): + * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) # <<<<<<<<<<<<<< + * + * def make_double_check(schema): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6spavro_11fast_binary_16make_float_check_lambda11(PyObject *__pyx_self, PyObject *__pyx_v_datum); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_16make_float_check_lambda11 = {"lambda11", (PyCFunction)__pyx_pw_6spavro_11fast_binary_16make_float_check_lambda11, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_16make_float_check_lambda11(PyObject *__pyx_self, PyObject *__pyx_v_datum) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda11 (wrapper)", 0); + __pyx_r = __pyx_lambda_funcdef_lambda11(__pyx_self, ((PyObject *)__pyx_v_datum)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda11(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_datum) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda11", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyInt_Check(__pyx_v_datum); if (!__pyx_t_2) { } else { - goto __pyx_L4_next_and; + __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L3_bool_binop_done; } - __pyx_t_2 = PyBytes_Check(__pyx_v_datum); - if (__pyx_t_2) { + __pyx_t_2 = PyLong_Check(__pyx_v_datum); + if (!__pyx_t_2) { } else { - __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 419, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L3_bool_binop_done; } - __pyx_L4_next_and:; - __pyx_t_4 = PyObject_Length(__pyx_v_datum); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 419, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_4 == __pyx_cur_scope->__pyx_v_size); - __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 419, __pyx_L1_error) + __pyx_t_2 = PyFloat_Check(__pyx_v_datum); + __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __pyx_t_3; __pyx_t_3 = 0; @@ -10765,19 +11060,11 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_16make_fixed_check_fixed_check(P __pyx_t_1 = 0; goto __pyx_L0; - /* "spavro/fast_binary.pyx":418 - * def make_fixed_check(schema): - * cdef int size = schema['size'] - * def fixed_check(datum): # <<<<<<<<<<<<<< - * return (isinstance(datum, str) or isinstance(datum, bytes)) and len(datum) == size - * return fixed_check - */ - /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("spavro.fast_binary.make_fixed_check.fixed_check", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.make_float_check.lambda11", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -10785,2243 +11072,1767 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_16make_fixed_check_fixed_check(P return __pyx_r; } -/* "spavro/fast_binary.pyx":416 - * return union_check +/* "spavro/fast_binary.pyx":514 + * return lambda datum: isinstance(datum, bool) + * + * def make_float_check(schema): # <<<<<<<<<<<<<< + * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) * - * def make_fixed_check(schema): # <<<<<<<<<<<<<< - * cdef int size = schema['size'] - * def fixed_check(datum): */ -static PyObject *__pyx_pf_6spavro_11fast_binary_60make_fixed_check(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check *__pyx_cur_scope; - PyObject *__pyx_v_fixed_check = 0; +static PyObject *__pyx_pf_6spavro_11fast_binary_50make_float_check(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - __Pyx_RefNannySetupContext("make_fixed_check", 0); - __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(0, 416, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_float_check", 0); - /* "spavro/fast_binary.pyx":417 + /* "spavro/fast_binary.pyx":515 * - * def make_fixed_check(schema): - * cdef int size = schema['size'] # <<<<<<<<<<<<<< - * def fixed_check(datum): - * return (isinstance(datum, str) or isinstance(datum, bytes)) and len(datum) == size - */ - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_schema, __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 417, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 417, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_cur_scope->__pyx_v_size = __pyx_t_2; - - /* "spavro/fast_binary.pyx":418 - * def make_fixed_check(schema): - * cdef int size = schema['size'] - * def fixed_check(datum): # <<<<<<<<<<<<<< - * return (isinstance(datum, str) or isinstance(datum, bytes)) and len(datum) == size - * return fixed_check - */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_16make_fixed_check_1fixed_check, 0, __pyx_n_s_make_fixed_check_locals_fixed_ch, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 418, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_fixed_check = __pyx_t_1; - __pyx_t_1 = 0; - - /* "spavro/fast_binary.pyx":420 - * def fixed_check(datum): - * return (isinstance(datum, str) or isinstance(datum, bytes)) and len(datum) == size - * return fixed_check # <<<<<<<<<<<<<< + * def make_float_check(schema): + * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) # <<<<<<<<<<<<<< * - * def make_map_check(schema): + * def make_double_check(schema): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_fixed_check); - __pyx_r = __pyx_v_fixed_check; + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_16make_float_check_lambda11, 0, __pyx_n_s_make_float_check_locals_lambda, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; - /* "spavro/fast_binary.pyx":416 - * return union_check + /* "spavro/fast_binary.pyx":514 + * return lambda datum: isinstance(datum, bool) + * + * def make_float_check(schema): # <<<<<<<<<<<<<< + * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) * - * def make_fixed_check(schema): # <<<<<<<<<<<<<< - * cdef int size = schema['size'] - * def fixed_check(datum): */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("spavro.fast_binary.make_fixed_check", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.make_float_check", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_fixed_check); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":422 - * return fixed_check +/* "spavro/fast_binary.pyx":517 + * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) + * + * def make_double_check(schema): # <<<<<<<<<<<<<< + * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) * - * def make_map_check(schema): # <<<<<<<<<<<<<< - * map_value_check = get_check(schema['values']) - * def map_check(datum): */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_63make_map_check(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_63make_map_check = {"make_map_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_63make_map_check, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_63make_map_check(PyObject *__pyx_self, PyObject *__pyx_v_schema) { +static PyObject *__pyx_pw_6spavro_11fast_binary_53make_double_check(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_53make_double_check = {"make_double_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_53make_double_check, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_53make_double_check(PyObject *__pyx_self, PyObject *__pyx_v_schema) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("make_map_check (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_62make_map_check(__pyx_self, ((PyObject *)__pyx_v_schema)); + __Pyx_RefNannySetupContext("make_double_check (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_52make_double_check(__pyx_self, ((PyObject *)__pyx_v_schema)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":424 - * def make_map_check(schema): - * map_value_check = get_check(schema['values']) - * def map_check(datum): # <<<<<<<<<<<<<< - * return isinstance(datum, dict) and all([check_string(key) and map_value_check(value) for key, value in datum.items()]) - * return map_check +/* "spavro/fast_binary.pyx":518 + * + * def make_double_check(schema): + * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) # <<<<<<<<<<<<<< + * + * def make_byte_check(schema): */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_14make_map_check_1map_check(PyObject *__pyx_self, PyObject *__pyx_v_datum); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_14make_map_check_1map_check = {"map_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_14make_map_check_1map_check, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_14make_map_check_1map_check(PyObject *__pyx_self, PyObject *__pyx_v_datum) { +static PyObject *__pyx_pw_6spavro_11fast_binary_17make_double_check_lambda12(PyObject *__pyx_self, PyObject *__pyx_v_datum); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17make_double_check_lambda12 = {"lambda12", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17make_double_check_lambda12, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17make_double_check_lambda12(PyObject *__pyx_self, PyObject *__pyx_v_datum) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("map_check (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_14make_map_check_map_check(__pyx_self, ((PyObject *)__pyx_v_datum)); + __Pyx_RefNannySetupContext("lambda12 (wrapper)", 0); + __pyx_r = __pyx_lambda_funcdef_lambda12(__pyx_self, ((PyObject *)__pyx_v_datum)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_14make_map_check_map_check(PyObject *__pyx_self, PyObject *__pyx_v_datum) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check *__pyx_cur_scope; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check *__pyx_outer_scope; - PyObject *__pyx_v_key = NULL; - PyObject *__pyx_v_value = NULL; +static PyObject *__pyx_lambda_funcdef_lambda12(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_datum) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - Py_ssize_t __pyx_t_7; - PyObject *(*__pyx_t_8)(PyObject *); - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *(*__pyx_t_11)(PyObject *); - __Pyx_RefNannySetupContext("map_check", 0); - __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; - - /* "spavro/fast_binary.pyx":425 - * map_value_check = get_check(schema['values']) - * def map_check(datum): - * return isinstance(datum, dict) and all([check_string(key) and map_value_check(value) for key, value in datum.items()]) # <<<<<<<<<<<<<< - * return map_check - * - */ + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda12", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyDict_Check(__pyx_v_datum); - if (__pyx_t_2) { + __pyx_t_2 = PyInt_Check(__pyx_v_datum); + if (!__pyx_t_2) { } else { - __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 425, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 518, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L3_bool_binop_done; } - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 425, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_datum, __pyx_n_s_items); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 425, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 425, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { - __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); __pyx_t_7 = 0; - __pyx_t_8 = NULL; + __pyx_t_2 = PyLong_Check(__pyx_v_datum); + if (!__pyx_t_2) { } else { - __pyx_t_7 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 425, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 425, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - for (;;) { - if (likely(!__pyx_t_8)) { - if (likely(PyList_CheckExact(__pyx_t_5))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_5)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 425, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 425, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_5)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 425, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 425, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_8(__pyx_t_5); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 425, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) { - PyObject* sequence = __pyx_t_4; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 425, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_6 = PyList_GET_ITEM(sequence, 0); - __pyx_t_9 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(__pyx_t_9); - #else - __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 425, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 425, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - #endif - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_10 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 425, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext; - index = 0; __pyx_t_6 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_6)) goto __pyx_L7_unpacking_failed; - __Pyx_GOTREF(__pyx_t_6); - index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L7_unpacking_failed; - __Pyx_GOTREF(__pyx_t_9); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) __PYX_ERR(0, 425, __pyx_L1_error) - __pyx_t_11 = NULL; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - goto __pyx_L8_unpacking_done; - __pyx_L7_unpacking_failed:; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_11 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 425, __pyx_L1_error) - __pyx_L8_unpacking_done:; - } - __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_6); - __pyx_t_6 = 0; - __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_9); - __pyx_t_9 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_check_string); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 425, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_10 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_9 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_10, __pyx_v_key) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_key); - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 425, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 425, __pyx_L1_error) - if (__pyx_t_2) { - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else { - __Pyx_INCREF(__pyx_t_9); - __pyx_t_4 = __pyx_t_9; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L9_bool_binop_done; - } - if (unlikely(!__pyx_cur_scope->__pyx_v_map_value_check)) { __Pyx_RaiseClosureNameError("map_value_check"); __PYX_ERR(0, 425, __pyx_L1_error) } - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_map_value_check); - __pyx_t_6 = __pyx_cur_scope->__pyx_v_map_value_check; __pyx_t_10 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_9 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_10, __pyx_v_value) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_value); - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 425, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_INCREF(__pyx_t_9); - __pyx_t_4 = __pyx_t_9; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_L9_bool_binop_done:; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 425, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 518, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L3_bool_binop_done; } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_all, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 425, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_INCREF(__pyx_t_5); - __pyx_t_1 = __pyx_t_5; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_2 = PyFloat_Check(__pyx_v_datum); + __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 518, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; __pyx_L3_bool_binop_done:; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "spavro/fast_binary.pyx":424 - * def make_map_check(schema): - * map_value_check = get_check(schema['values']) - * def map_check(datum): # <<<<<<<<<<<<<< - * return isinstance(datum, dict) and all([check_string(key) and map_value_check(value) for key, value in datum.items()]) - * return map_check - */ - /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("spavro.fast_binary.make_map_check.map_check", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.make_double_check.lambda12", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_key); - __Pyx_XDECREF(__pyx_v_value); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":422 - * return fixed_check +/* "spavro/fast_binary.pyx":517 + * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) + * + * def make_double_check(schema): # <<<<<<<<<<<<<< + * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) * - * def make_map_check(schema): # <<<<<<<<<<<<<< - * map_value_check = get_check(schema['values']) - * def map_check(datum): */ -static PyObject *__pyx_pf_6spavro_11fast_binary_62make_map_check(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check *__pyx_cur_scope; - PyObject *__pyx_v_map_check = 0; +static PyObject *__pyx_pf_6spavro_11fast_binary_52make_double_check(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("make_map_check", 0); - __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(0, 422, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_double_check", 0); - /* "spavro/fast_binary.pyx":423 + /* "spavro/fast_binary.pyx":518 * - * def make_map_check(schema): - * map_value_check = get_check(schema['values']) # <<<<<<<<<<<<<< - * def map_check(datum): - * return isinstance(datum, dict) and all([check_string(key) and map_value_check(value) for key, value in datum.items()]) - */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_check); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 423, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_schema, __pyx_n_s_values); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 423, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - 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_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 423, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_v_map_value_check = __pyx_t_1; - __pyx_t_1 = 0; - - /* "spavro/fast_binary.pyx":424 - * def make_map_check(schema): - * map_value_check = get_check(schema['values']) - * def map_check(datum): # <<<<<<<<<<<<<< - * return isinstance(datum, dict) and all([check_string(key) and map_value_check(value) for key, value in datum.items()]) - * return map_check - */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_14make_map_check_1map_check, 0, __pyx_n_s_make_map_check_locals_map_check, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__31)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 424, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_map_check = __pyx_t_1; - __pyx_t_1 = 0; - - /* "spavro/fast_binary.pyx":426 - * def map_check(datum): - * return isinstance(datum, dict) and all([check_string(key) and map_value_check(value) for key, value in datum.items()]) - * return map_check # <<<<<<<<<<<<<< + * def make_double_check(schema): + * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) # <<<<<<<<<<<<<< * - * check_type_map = { + * def make_byte_check(schema): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_map_check); - __pyx_r = __pyx_v_map_check; + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17make_double_check_lambda12, 0, __pyx_n_s_make_double_check_locals_lambda, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 518, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; - /* "spavro/fast_binary.pyx":422 - * return fixed_check + /* "spavro/fast_binary.pyx":517 + * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) + * + * def make_double_check(schema): # <<<<<<<<<<<<<< + * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) * - * def make_map_check(schema): # <<<<<<<<<<<<<< - * map_value_check = get_check(schema['values']) - * def map_check(datum): */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("spavro.fast_binary.make_map_check", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.make_double_check", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_map_check); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":447 - * # ==================== +/* "spavro/fast_binary.pyx":520 + * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) + * + * def make_byte_check(schema): # <<<<<<<<<<<<<< + * return lambda datum: isinstance(datum, str) or isinstance(datum, bytes) * - * def lookup_schema(schema): # <<<<<<<<<<<<<< - * '''Check if a schema is a standard type, if not, lookup in the custom - * schema dictionary and replace the custom name with the expanded original */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_65lookup_schema(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ -static char __pyx_doc_6spavro_11fast_binary_64lookup_schema[] = "Check if a schema is a standard type, if not, lookup in the custom\n schema dictionary and replace the custom name with the expanded original\n schema."; -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_65lookup_schema = {"lookup_schema", (PyCFunction)__pyx_pw_6spavro_11fast_binary_65lookup_schema, METH_O, __pyx_doc_6spavro_11fast_binary_64lookup_schema}; -static PyObject *__pyx_pw_6spavro_11fast_binary_65lookup_schema(PyObject *__pyx_self, PyObject *__pyx_v_schema) { +static PyObject *__pyx_pw_6spavro_11fast_binary_55make_byte_check(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_55make_byte_check = {"make_byte_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_55make_byte_check, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_55make_byte_check(PyObject *__pyx_self, PyObject *__pyx_v_schema) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("lookup_schema (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_64lookup_schema(__pyx_self, ((PyObject *)__pyx_v_schema)); + __Pyx_RefNannySetupContext("make_byte_check (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_54make_byte_check(__pyx_self, ((PyObject *)__pyx_v_schema)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_64lookup_schema(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema) { - PyObject *__pyx_v_check_type = NULL; +/* "spavro/fast_binary.pyx":521 + * + * def make_byte_check(schema): + * return lambda datum: isinstance(datum, str) or isinstance(datum, bytes) # <<<<<<<<<<<<<< + * + * def make_array_check(schema): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6spavro_11fast_binary_15make_byte_check_lambda13(PyObject *__pyx_self, PyObject *__pyx_v_datum); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_15make_byte_check_lambda13 = {"lambda13", (PyCFunction)__pyx_pw_6spavro_11fast_binary_15make_byte_check_lambda13, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_15make_byte_check_lambda13(PyObject *__pyx_self, PyObject *__pyx_v_datum) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda13 (wrapper)", 0); + __pyx_r = __pyx_lambda_funcdef_lambda13(__pyx_self, ((PyObject *)__pyx_v_datum)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda13(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_datum) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("lookup_schema", 0); - - /* "spavro/fast_binary.pyx":451 - * schema dictionary and replace the custom name with the expanded original - * schema.''' - * check_type = get_type(schema) # <<<<<<<<<<<<<< - * if check_type in writer_type_map: - * return schema - */ - __pyx_t_1 = __pyx_f_6spavro_11fast_binary_get_type(__pyx_v_schema, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_check_type = ((PyObject*)__pyx_t_1); + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda13", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyString_Check(__pyx_v_datum); + if (!__pyx_t_2) { + } else { + __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 521, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L3_bool_binop_done; + } + __pyx_t_2 = PyBytes_Check(__pyx_v_datum); + __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 521, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + __pyx_L3_bool_binop_done:; + __pyx_r = __pyx_t_1; __pyx_t_1 = 0; + goto __pyx_L0; - /* "spavro/fast_binary.pyx":452 - * schema.''' - * check_type = get_type(schema) - * if check_type in writer_type_map: # <<<<<<<<<<<<<< - * return schema - * return custom_schema[check_type] - */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_writer_type_map); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 452, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_check_type, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 452, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spavro.fast_binary.make_byte_check.lambda13", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "spavro/fast_binary.pyx":453 - * check_type = get_type(schema) - * if check_type in writer_type_map: - * return schema # <<<<<<<<<<<<<< - * return custom_schema[check_type] +/* "spavro/fast_binary.pyx":520 + * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) + * + * def make_byte_check(schema): # <<<<<<<<<<<<<< + * return lambda datum: isinstance(datum, str) or isinstance(datum, bytes) * */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_schema); - __pyx_r = __pyx_v_schema; - goto __pyx_L0; - /* "spavro/fast_binary.pyx":452 - * schema.''' - * check_type = get_type(schema) - * if check_type in writer_type_map: # <<<<<<<<<<<<<< - * return schema - * return custom_schema[check_type] - */ - } +static PyObject *__pyx_pf_6spavro_11fast_binary_54make_byte_check(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_byte_check", 0); - /* "spavro/fast_binary.pyx":454 - * if check_type in writer_type_map: - * return schema - * return custom_schema[check_type] # <<<<<<<<<<<<<< + /* "spavro/fast_binary.pyx":521 * + * def make_byte_check(schema): + * return lambda datum: isinstance(datum, str) or isinstance(datum, bytes) # <<<<<<<<<<<<<< * + * def make_array_check(schema): */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_custom_schema); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 454, __pyx_L1_error) + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_15make_byte_check_lambda13, 0, __pyx_n_s_make_byte_check_locals_lambda, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 521, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_v_check_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 454, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; - /* "spavro/fast_binary.pyx":447 - * # ==================== + /* "spavro/fast_binary.pyx":520 + * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) + * + * def make_byte_check(schema): # <<<<<<<<<<<<<< + * return lambda datum: isinstance(datum, str) or isinstance(datum, bytes) * - * def lookup_schema(schema): # <<<<<<<<<<<<<< - * '''Check if a schema is a standard type, if not, lookup in the custom - * schema dictionary and replace the custom name with the expanded original */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("spavro.fast_binary.lookup_schema", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.make_byte_check", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_check_type); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":472 - * # allow strings to be used for byte data, if there's no string type - * if bytes in writer_lookup_dict and str not in writer_lookup_dict: - * writer_lookup_dict[str] = writer_lookup_dict[bytes][0], lambda output_buffer, val: writer_lookup_dict[bytes][1](output_buffer, val.encode('utf-8')) # <<<<<<<<<<<<<< - * if bytes in writer_lookup_dict and unicode not in writer_lookup_dict: - * writer_lookup_dict[unicode] = writer_lookup_dict[bytes][0], lambda output_buffer, val: writer_lookup_dict[bytes][1](output_buffer, val.encode('utf-8')) +/* "spavro/fast_binary.pyx":523 + * return lambda datum: isinstance(datum, str) or isinstance(datum, bytes) + * + * def make_array_check(schema): # <<<<<<<<<<<<<< + * item_check = get_check(schema['items']) + * def array_check(datum): */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_27create_promotions_for_union_lambda14(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_27create_promotions_for_union_lambda14 = {"lambda14", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_27create_promotions_for_union_lambda14, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_27create_promotions_for_union_lambda14(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_output_buffer = 0; - PyObject *__pyx_v_val = 0; +static PyObject *__pyx_pw_6spavro_11fast_binary_57make_array_check(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_57make_array_check = {"make_array_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_57make_array_check, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_57make_array_check(PyObject *__pyx_self, PyObject *__pyx_v_schema) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("lambda14 (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_output_buffer,&__pyx_n_s_val,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_output_buffer)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_val)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("lambda14", 1, 2, 2, 1); __PYX_ERR(0, 472, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lambda14") < 0)) __PYX_ERR(0, 472, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_output_buffer = values[0]; - __pyx_v_val = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("lambda14", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 472, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("spavro.fast_binary.create_promotions_for_union.lambda14", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannySetupContext("make_array_check (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_56make_array_check(__pyx_self, ((PyObject *)__pyx_v_schema)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_lambda_funcdef_lambda14(__pyx_self, __pyx_v_output_buffer, __pyx_v_val); + return __pyx_r; +} + +/* "spavro/fast_binary.pyx":525 + * def make_array_check(schema): + * item_check = get_check(schema['items']) + * def array_check(datum): # <<<<<<<<<<<<<< + * return isinstance(datum, list) and all([item_check(item) for item in datum]) + * return array_check + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6spavro_11fast_binary_16make_array_check_1array_check(PyObject *__pyx_self, PyObject *__pyx_v_datum); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_16make_array_check_1array_check = {"array_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_16make_array_check_1array_check, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_16make_array_check_1array_check(PyObject *__pyx_self, PyObject *__pyx_v_datum) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("array_check (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_16make_array_check_array_check(__pyx_self, ((PyObject *)__pyx_v_datum)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_lambda_funcdef_lambda14(PyObject *__pyx_self, PyObject *__pyx_v_output_buffer, PyObject *__pyx_v_val) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *__pyx_cur_scope; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *__pyx_outer_scope; +static PyObject *__pyx_pf_6spavro_11fast_binary_16make_array_check_array_check(PyObject *__pyx_self, PyObject *__pyx_v_datum) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check *__pyx_cur_scope; + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check *__pyx_outer_scope; + PyObject *__pyx_v_item = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - __Pyx_RefNannySetupContext("lambda14", 0); - __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; - __Pyx_XDECREF(__pyx_r); - if (unlikely(!__pyx_cur_scope->__pyx_v_writer_lookup_dict)) { __Pyx_RaiseClosureNameError("writer_lookup_dict"); __PYX_ERR(0, 472, __pyx_L1_error) } - if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 472, __pyx_L1_error) + Py_ssize_t __pyx_t_5; + PyObject *(*__pyx_t_6)(PyObject *); + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("array_check", 0); + __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + + /* "spavro/fast_binary.pyx":526 + * item_check = get_check(schema['items']) + * def array_check(datum): + * return isinstance(datum, list) and all([item_check(item) for item in datum]) # <<<<<<<<<<<<<< + * return array_check + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyList_Check(__pyx_v_datum); + if (__pyx_t_2) { + } else { + __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 526, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L3_bool_binop_done; } - __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, ((PyObject *)(&PyBytes_Type))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 472, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 472, __pyx_L1_error) + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 526, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_val, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 472, __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); - } + if (likely(PyList_CheckExact(__pyx_v_datum)) || PyTuple_CheckExact(__pyx_v_datum)) { + __pyx_t_4 = __pyx_v_datum; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + } else { + __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_datum); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 526, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 526, __pyx_L1_error) } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_utf_8); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 472, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - __pyx_t_6 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_6 = 1; + for (;;) { + if (likely(!__pyx_t_6)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 526, __pyx_L1_error) + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 526, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + } else { + if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 526, __pyx_L1_error) + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 526, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + } + } else { + __pyx_t_7 = __pyx_t_6(__pyx_t_4); + if (unlikely(!__pyx_t_7)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 526, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_7); } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_output_buffer, __pyx_t_2}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 472, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_output_buffer, __pyx_t_2}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 472, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 472, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7); + __pyx_t_7 = 0; + if (unlikely(!__pyx_cur_scope->__pyx_v_item_check)) { __Pyx_RaiseClosureNameError("item_check"); __PYX_ERR(0, 526, __pyx_L1_error) } + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_item_check); + __pyx_t_8 = __pyx_cur_scope->__pyx_v_item_check; __pyx_t_9 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + } } - __Pyx_INCREF(__pyx_v_output_buffer); - __Pyx_GIVEREF(__pyx_v_output_buffer); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_v_output_buffer); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 472, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_v_item) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_item); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 526, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 526, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_all, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 526, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_1 = __pyx_t_4; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_L3_bool_binop_done:; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; + /* "spavro/fast_binary.pyx":525 + * def make_array_check(schema): + * item_check = get_check(schema['items']) + * def array_check(datum): # <<<<<<<<<<<<<< + * return isinstance(datum, list) and all([item_check(item) for item in datum]) + * return array_check + */ + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("spavro.fast_binary.create_promotions_for_union.lambda14", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("spavro.fast_binary.make_array_check.array_check", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_item); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":474 - * writer_lookup_dict[str] = writer_lookup_dict[bytes][0], lambda output_buffer, val: writer_lookup_dict[bytes][1](output_buffer, val.encode('utf-8')) - * if bytes in writer_lookup_dict and unicode not in writer_lookup_dict: - * writer_lookup_dict[unicode] = writer_lookup_dict[bytes][0], lambda output_buffer, val: writer_lookup_dict[bytes][1](output_buffer, val.encode('utf-8')) # <<<<<<<<<<<<<< - * +/* "spavro/fast_binary.pyx":523 + * return lambda datum: isinstance(datum, str) or isinstance(datum, bytes) * + * def make_array_check(schema): # <<<<<<<<<<<<<< + * item_check = get_check(schema['items']) + * def array_check(datum): */ -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_27create_promotions_for_union_1lambda15(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_27create_promotions_for_union_1lambda15 = {"lambda15", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_27create_promotions_for_union_1lambda15, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_27create_promotions_for_union_1lambda15(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_output_buffer = 0; - PyObject *__pyx_v_val = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("lambda15 (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_output_buffer,&__pyx_n_s_val,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_output_buffer)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_val)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("lambda15", 1, 2, 2, 1); __PYX_ERR(0, 474, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lambda15") < 0)) __PYX_ERR(0, 474, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_output_buffer = values[0]; - __pyx_v_val = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("lambda15", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 474, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("spavro.fast_binary.create_promotions_for_union.lambda15", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_lambda_funcdef_lambda15(__pyx_self, __pyx_v_output_buffer, __pyx_v_val); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_lambda_funcdef_lambda15(PyObject *__pyx_self, PyObject *__pyx_v_output_buffer, PyObject *__pyx_v_val) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *__pyx_cur_scope; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *__pyx_outer_scope; +static PyObject *__pyx_pf_6spavro_11fast_binary_56make_array_check(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check *__pyx_cur_scope; + PyObject *__pyx_v_array_check = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - __Pyx_RefNannySetupContext("lambda15", 0); - __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; - __Pyx_XDECREF(__pyx_r); - if (unlikely(!__pyx_cur_scope->__pyx_v_writer_lookup_dict)) { __Pyx_RaiseClosureNameError("writer_lookup_dict"); __PYX_ERR(0, 474, __pyx_L1_error) } - if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 474, __pyx_L1_error) + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_array_check", 0); + __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 523, __pyx_L1_error) + } else { + __Pyx_GOTREF(__pyx_cur_scope); } - __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, ((PyObject *)(&PyBytes_Type))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 474, __pyx_L1_error) + + /* "spavro/fast_binary.pyx":524 + * + * def make_array_check(schema): + * item_check = get_check(schema['items']) # <<<<<<<<<<<<<< + * def array_check(datum): + * return isinstance(datum, list) and all([item_check(item) for item in datum]) + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_check); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 524, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 474, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_schema, __pyx_n_s_items); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 524, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_val, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 474, __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_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_utf_8); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 474, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; - __pyx_t_6 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + 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_3); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_6 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_output_buffer, __pyx_t_2}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 474, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_output_buffer, __pyx_t_2}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 474, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 474, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; + __Pyx_DECREF_SET(__pyx_t_2, function); } - __Pyx_INCREF(__pyx_v_output_buffer); - __Pyx_GIVEREF(__pyx_v_output_buffer); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_v_output_buffer); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 474, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } + __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_1; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 524, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_v_item_check = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spavro/fast_binary.pyx":525 + * def make_array_check(schema): + * item_check = get_check(schema['items']) + * def array_check(datum): # <<<<<<<<<<<<<< + * return isinstance(datum, list) and all([item_check(item) for item in datum]) + * return array_check + */ + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_16make_array_check_1array_check, 0, __pyx_n_s_make_array_check_locals_array_ch, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__25)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 525, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_array_check = __pyx_t_1; __pyx_t_1 = 0; + + /* "spavro/fast_binary.pyx":527 + * def array_check(datum): + * return isinstance(datum, list) and all([item_check(item) for item in datum]) + * return array_check # <<<<<<<<<<<<<< + * + * def make_union_check(union_schema): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_array_check); + __pyx_r = __pyx_v_array_check; goto __pyx_L0; + /* "spavro/fast_binary.pyx":523 + * return lambda datum: isinstance(datum, str) or isinstance(datum, bytes) + * + * def make_array_check(schema): # <<<<<<<<<<<<<< + * item_check = get_check(schema['items']) + * def array_check(datum): + */ + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("spavro.fast_binary.create_promotions_for_union.lambda15", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.make_array_check", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_array_check); + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":457 - * +/* "spavro/fast_binary.pyx":529 + * return array_check * - * cdef void create_promotions_for_union(dict writer_lookup_dict): # <<<<<<<<<<<<<< - * '''Take the writer lookup for a union and create some aliases and promotion - * cases, and store those back into the writer lookup.''' + * def make_union_check(union_schema): # <<<<<<<<<<<<<< + * cdef list union_checks = [get_check(schema) for schema in union_schema] + * def union_check(datum): */ -static void __pyx_f_6spavro_11fast_binary_create_promotions_for_union(PyObject *__pyx_v_writer_lookup_dict) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *__pyx_cur_scope; +/* Python wrapper */ +static PyObject *__pyx_pw_6spavro_11fast_binary_59make_union_check(PyObject *__pyx_self, PyObject *__pyx_v_union_schema); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_59make_union_check = {"make_union_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_59make_union_check, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_59make_union_check(PyObject *__pyx_self, PyObject *__pyx_v_union_schema) { + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - __Pyx_RefNannySetupContext("create_promotions_for_union", 0); - __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(0, 457, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } - __pyx_cur_scope->__pyx_v_writer_lookup_dict = __pyx_v_writer_lookup_dict; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_writer_lookup_dict); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_writer_lookup_dict); + __Pyx_RefNannySetupContext("make_union_check (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_58make_union_check(__pyx_self, ((PyObject *)__pyx_v_union_schema)); - /* "spavro/fast_binary.pyx":462 - * # handle promotion cases - * # long and int are encoded the same way - * if int in writer_lookup_dict: # <<<<<<<<<<<<<< - * writer_lookup_dict[long] = writer_lookup_dict[int] - * # py2 and py3 both handle str/unicode differently - */ - if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 462, __pyx_L1_error) - } - __pyx_t_1 = (__Pyx_PyDict_ContainsTF(((PyObject *)(&PyInt_Type)), __pyx_cur_scope->__pyx_v_writer_lookup_dict, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 462, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "spavro/fast_binary.pyx":463 - * # long and int are encoded the same way - * if int in writer_lookup_dict: - * writer_lookup_dict[long] = writer_lookup_dict[int] # <<<<<<<<<<<<<< - * # py2 and py3 both handle str/unicode differently - * if unicode in writer_lookup_dict: +/* "spavro/fast_binary.pyx":531 + * def make_union_check(union_schema): + * cdef list union_checks = [get_check(schema) for schema in union_schema] + * def union_check(datum): # <<<<<<<<<<<<<< + * return any([check(datum) for check in union_checks]) + * return union_check */ - if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 463, __pyx_L1_error) - } - __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, ((PyObject *)(&PyInt_Type))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 463, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 463, __pyx_L1_error) - } - if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, ((PyObject *)(&PyLong_Type)), __pyx_t_3) < 0)) __PYX_ERR(0, 463, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":462 - * # handle promotion cases - * # long and int are encoded the same way - * if int in writer_lookup_dict: # <<<<<<<<<<<<<< - * writer_lookup_dict[long] = writer_lookup_dict[int] - * # py2 and py3 both handle str/unicode differently - */ - } +/* Python wrapper */ +static PyObject *__pyx_pw_6spavro_11fast_binary_16make_union_check_1union_check(PyObject *__pyx_self, PyObject *__pyx_v_datum); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_16make_union_check_1union_check = {"union_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_16make_union_check_1union_check, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_16make_union_check_1union_check(PyObject *__pyx_self, PyObject *__pyx_v_datum) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("union_check (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_16make_union_check_union_check(__pyx_self, ((PyObject *)__pyx_v_datum)); - /* "spavro/fast_binary.pyx":465 - * writer_lookup_dict[long] = writer_lookup_dict[int] - * # py2 and py3 both handle str/unicode differently - * if unicode in writer_lookup_dict: # <<<<<<<<<<<<<< - * writer_lookup_dict[str] = writer_lookup_dict[unicode] - * # allow the use of ints to 'find' float unions + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6spavro_11fast_binary_16make_union_check_union_check(PyObject *__pyx_self, PyObject *__pyx_v_datum) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check *__pyx_cur_scope; + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check *__pyx_outer_scope; + PyObject *__pyx_v_check = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("union_check", 0); + __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + + /* "spavro/fast_binary.pyx":532 + * cdef list union_checks = [get_check(schema) for schema in union_schema] + * def union_check(datum): + * return any([check(datum) for check in union_checks]) # <<<<<<<<<<<<<< + * return union_check + * */ - if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 532, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(!__pyx_cur_scope->__pyx_v_union_checks)) { __Pyx_RaiseClosureNameError("union_checks"); __PYX_ERR(0, 532, __pyx_L1_error) } + if (unlikely(__pyx_cur_scope->__pyx_v_union_checks == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 465, __pyx_L1_error) + __PYX_ERR(0, 532, __pyx_L1_error) } - __pyx_t_2 = (__Pyx_PyDict_ContainsTF(((PyObject *)(&PyUnicode_Type)), __pyx_cur_scope->__pyx_v_writer_lookup_dict, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 465, __pyx_L1_error) - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { - - /* "spavro/fast_binary.pyx":466 - * # py2 and py3 both handle str/unicode differently - * if unicode in writer_lookup_dict: - * writer_lookup_dict[str] = writer_lookup_dict[unicode] # <<<<<<<<<<<<<< - * # allow the use of ints to 'find' float unions - * if float in writer_lookup_dict and int not in writer_lookup_dict: - */ - if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 466, __pyx_L1_error) - } - __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, ((PyObject *)(&PyUnicode_Type))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 466, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 466, __pyx_L1_error) + __pyx_t_2 = __pyx_cur_scope->__pyx_v_union_checks; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; + for (;;) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 532, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 532, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + __Pyx_XDECREF_SET(__pyx_v_check, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_v_check); + __pyx_t_5 = __pyx_v_check; __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } } - if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, ((PyObject *)(&PyString_Type)), __pyx_t_3) < 0)) __PYX_ERR(0, 466, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "spavro/fast_binary.pyx":465 - * writer_lookup_dict[long] = writer_lookup_dict[int] - * # py2 and py3 both handle str/unicode differently - * if unicode in writer_lookup_dict: # <<<<<<<<<<<<<< - * writer_lookup_dict[str] = writer_lookup_dict[unicode] - * # allow the use of ints to 'find' float unions - */ + __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_datum) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_datum); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 532, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 532, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_any, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 532, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "spavro/fast_binary.pyx":468 - * writer_lookup_dict[str] = writer_lookup_dict[unicode] - * # allow the use of ints to 'find' float unions - * if float in writer_lookup_dict and int not in writer_lookup_dict: # <<<<<<<<<<<<<< - * writer_lookup_dict[int] = writer_lookup_dict[float] - * # allow strings to be used for byte data, if there's no string type + /* "spavro/fast_binary.pyx":531 + * def make_union_check(union_schema): + * cdef list union_checks = [get_check(schema) for schema in union_schema] + * def union_check(datum): # <<<<<<<<<<<<<< + * return any([check(datum) for check in union_checks]) + * return union_check */ - if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 468, __pyx_L1_error) - } - __pyx_t_2 = (__Pyx_PyDict_ContainsTF(((PyObject *)(&PyFloat_Type)), __pyx_cur_scope->__pyx_v_writer_lookup_dict, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 468, __pyx_L1_error) - __pyx_t_4 = (__pyx_t_2 != 0); - if (__pyx_t_4) { - } else { - __pyx_t_1 = __pyx_t_4; - goto __pyx_L6_bool_binop_done; - } - if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 468, __pyx_L1_error) - } - __pyx_t_4 = (__Pyx_PyDict_ContainsTF(((PyObject *)(&PyInt_Type)), __pyx_cur_scope->__pyx_v_writer_lookup_dict, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 468, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_4 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L6_bool_binop_done:; - if (__pyx_t_1) { - /* "spavro/fast_binary.pyx":469 - * # allow the use of ints to 'find' float unions - * if float in writer_lookup_dict and int not in writer_lookup_dict: - * writer_lookup_dict[int] = writer_lookup_dict[float] # <<<<<<<<<<<<<< - * # allow strings to be used for byte data, if there's no string type - * if bytes in writer_lookup_dict and str not in writer_lookup_dict: - */ - if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 469, __pyx_L1_error) - } - __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, ((PyObject *)(&PyFloat_Type))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 469, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 469, __pyx_L1_error) - } - if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, ((PyObject *)(&PyInt_Type)), __pyx_t_3) < 0)) __PYX_ERR(0, 469, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("spavro.fast_binary.make_union_check.union_check", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_check); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "spavro/fast_binary.pyx":468 - * writer_lookup_dict[str] = writer_lookup_dict[unicode] - * # allow the use of ints to 'find' float unions - * if float in writer_lookup_dict and int not in writer_lookup_dict: # <<<<<<<<<<<<<< - * writer_lookup_dict[int] = writer_lookup_dict[float] - * # allow strings to be used for byte data, if there's no string type +/* "spavro/fast_binary.pyx":529 + * return array_check + * + * def make_union_check(union_schema): # <<<<<<<<<<<<<< + * cdef list union_checks = [get_check(schema) for schema in union_schema] + * def union_check(datum): */ - } - /* "spavro/fast_binary.pyx":471 - * writer_lookup_dict[int] = writer_lookup_dict[float] - * # allow strings to be used for byte data, if there's no string type - * if bytes in writer_lookup_dict and str not in writer_lookup_dict: # <<<<<<<<<<<<<< - * writer_lookup_dict[str] = writer_lookup_dict[bytes][0], lambda output_buffer, val: writer_lookup_dict[bytes][1](output_buffer, val.encode('utf-8')) - * if bytes in writer_lookup_dict and unicode not in writer_lookup_dict: - */ - if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 471, __pyx_L1_error) - } - __pyx_t_2 = (__Pyx_PyDict_ContainsTF(((PyObject *)(&PyBytes_Type)), __pyx_cur_scope->__pyx_v_writer_lookup_dict, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 471, __pyx_L1_error) - __pyx_t_4 = (__pyx_t_2 != 0); - if (__pyx_t_4) { +static PyObject *__pyx_pf_6spavro_11fast_binary_58make_union_check(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_union_schema) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check *__pyx_cur_scope; + PyObject *__pyx_v_union_check = 0; + PyObject *__pyx_v_schema = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_union_check", 0); + __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 529, __pyx_L1_error) } else { - __pyx_t_1 = __pyx_t_4; - goto __pyx_L9_bool_binop_done; - } - if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 471, __pyx_L1_error) + __Pyx_GOTREF(__pyx_cur_scope); } - __pyx_t_4 = (__Pyx_PyDict_ContainsTF(((PyObject *)(&PyString_Type)), __pyx_cur_scope->__pyx_v_writer_lookup_dict, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 471, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_4 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L9_bool_binop_done:; - if (__pyx_t_1) { - /* "spavro/fast_binary.pyx":472 - * # allow strings to be used for byte data, if there's no string type - * if bytes in writer_lookup_dict and str not in writer_lookup_dict: - * writer_lookup_dict[str] = writer_lookup_dict[bytes][0], lambda output_buffer, val: writer_lookup_dict[bytes][1](output_buffer, val.encode('utf-8')) # <<<<<<<<<<<<<< - * if bytes in writer_lookup_dict and unicode not in writer_lookup_dict: - * writer_lookup_dict[unicode] = writer_lookup_dict[bytes][0], lambda output_buffer, val: writer_lookup_dict[bytes][1](output_buffer, val.encode('utf-8')) + /* "spavro/fast_binary.pyx":530 + * + * def make_union_check(union_schema): + * cdef list union_checks = [get_check(schema) for schema in union_schema] # <<<<<<<<<<<<<< + * def union_check(datum): + * return any([check(datum) for check in union_checks]) */ - if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 472, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_v_union_schema)) || PyTuple_CheckExact(__pyx_v_union_schema)) { + __pyx_t_2 = __pyx_v_union_schema; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_union_schema); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 530, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 530, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 530, __pyx_L1_error) + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 530, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + } else { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 530, __pyx_L1_error) + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 530, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + } + } else { + __pyx_t_5 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 530, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_5); } - __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, ((PyObject *)(&PyBytes_Type))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 472, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 472, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_27create_promotions_for_union_lambda14, 0, __pyx_n_s_create_promotions_for_union_loca, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 472, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 472, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_schema, __pyx_t_5); __pyx_t_5 = 0; - __pyx_t_3 = 0; - if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 472, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_get_check); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 530, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } } - if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, ((PyObject *)(&PyString_Type)), __pyx_t_6) < 0)) __PYX_ERR(0, 472, __pyx_L1_error) + __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_schema) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_schema); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 530, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "spavro/fast_binary.pyx":471 - * writer_lookup_dict[int] = writer_lookup_dict[float] - * # allow strings to be used for byte data, if there's no string type - * if bytes in writer_lookup_dict and str not in writer_lookup_dict: # <<<<<<<<<<<<<< - * writer_lookup_dict[str] = writer_lookup_dict[bytes][0], lambda output_buffer, val: writer_lookup_dict[bytes][1](output_buffer, val.encode('utf-8')) - * if bytes in writer_lookup_dict and unicode not in writer_lookup_dict: - */ + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 530, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_v_union_checks = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":473 - * if bytes in writer_lookup_dict and str not in writer_lookup_dict: - * writer_lookup_dict[str] = writer_lookup_dict[bytes][0], lambda output_buffer, val: writer_lookup_dict[bytes][1](output_buffer, val.encode('utf-8')) - * if bytes in writer_lookup_dict and unicode not in writer_lookup_dict: # <<<<<<<<<<<<<< - * writer_lookup_dict[unicode] = writer_lookup_dict[bytes][0], lambda output_buffer, val: writer_lookup_dict[bytes][1](output_buffer, val.encode('utf-8')) - * + /* "spavro/fast_binary.pyx":531 + * def make_union_check(union_schema): + * cdef list union_checks = [get_check(schema) for schema in union_schema] + * def union_check(datum): # <<<<<<<<<<<<<< + * return any([check(datum) for check in union_checks]) + * return union_check */ - if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 473, __pyx_L1_error) - } - __pyx_t_2 = (__Pyx_PyDict_ContainsTF(((PyObject *)(&PyBytes_Type)), __pyx_cur_scope->__pyx_v_writer_lookup_dict, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 473, __pyx_L1_error) - __pyx_t_4 = (__pyx_t_2 != 0); - if (__pyx_t_4) { - } else { - __pyx_t_1 = __pyx_t_4; - goto __pyx_L12_bool_binop_done; - } - if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 473, __pyx_L1_error) - } - __pyx_t_4 = (__Pyx_PyDict_ContainsTF(((PyObject *)(&PyUnicode_Type)), __pyx_cur_scope->__pyx_v_writer_lookup_dict, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 473, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_4 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L12_bool_binop_done:; - if (__pyx_t_1) { + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_16make_union_check_1union_check, 0, __pyx_n_s_make_union_check_locals_union_ch, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__27)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 531, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_union_check = __pyx_t_1; + __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":474 - * writer_lookup_dict[str] = writer_lookup_dict[bytes][0], lambda output_buffer, val: writer_lookup_dict[bytes][1](output_buffer, val.encode('utf-8')) - * if bytes in writer_lookup_dict and unicode not in writer_lookup_dict: - * writer_lookup_dict[unicode] = writer_lookup_dict[bytes][0], lambda output_buffer, val: writer_lookup_dict[bytes][1](output_buffer, val.encode('utf-8')) # <<<<<<<<<<<<<< - * + /* "spavro/fast_binary.pyx":533 + * def union_check(datum): + * return any([check(datum) for check in union_checks]) + * return union_check # <<<<<<<<<<<<<< * + * def make_fixed_check(schema): */ - if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 474, __pyx_L1_error) - } - __pyx_t_6 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, ((PyObject *)(&PyBytes_Type))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 474, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_6, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 474, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_27create_promotions_for_union_1lambda15, 0, __pyx_n_s_create_promotions_for_union_loca, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 474, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 474, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); - __pyx_t_3 = 0; - __pyx_t_6 = 0; - if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 474, __pyx_L1_error) - } - if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, ((PyObject *)(&PyUnicode_Type)), __pyx_t_5) < 0)) __PYX_ERR(0, 474, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_union_check); + __pyx_r = __pyx_v_union_check; + goto __pyx_L0; - /* "spavro/fast_binary.pyx":473 - * if bytes in writer_lookup_dict and str not in writer_lookup_dict: - * writer_lookup_dict[str] = writer_lookup_dict[bytes][0], lambda output_buffer, val: writer_lookup_dict[bytes][1](output_buffer, val.encode('utf-8')) - * if bytes in writer_lookup_dict and unicode not in writer_lookup_dict: # <<<<<<<<<<<<<< - * writer_lookup_dict[unicode] = writer_lookup_dict[bytes][0], lambda output_buffer, val: writer_lookup_dict[bytes][1](output_buffer, val.encode('utf-8')) + /* "spavro/fast_binary.pyx":529 + * return array_check * - */ - } - - /* "spavro/fast_binary.pyx":457 - * - * - * cdef void create_promotions_for_union(dict writer_lookup_dict): # <<<<<<<<<<<<<< - * '''Take the writer lookup for a union and create some aliases and promotion - * cases, and store those back into the writer lookup.''' + * def make_union_check(union_schema): # <<<<<<<<<<<<<< + * cdef list union_checks = [get_check(schema) for schema in union_schema] + * def union_check(datum): */ /* function exit code */ - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_WriteUnraisable("spavro.fast_binary.create_promotions_for_union", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("spavro.fast_binary.make_union_check", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_union_check); + __Pyx_XDECREF(__pyx_v_schema); __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "spavro/fast_binary.pyx":477 - * +/* "spavro/fast_binary.pyx":535 + * return union_check * - * def make_union_writer(union_schema): # <<<<<<<<<<<<<< - * cdef list type_list = [get_type(lookup_schema(schema)) for schema in union_schema] - * # cdef dict writer_lookup + * def make_fixed_check(schema): # <<<<<<<<<<<<<< + * cdef int size = schema['size'] + * def fixed_check(datum): */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_67make_union_writer(PyObject *__pyx_self, PyObject *__pyx_v_union_schema); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_67make_union_writer = {"make_union_writer", (PyCFunction)__pyx_pw_6spavro_11fast_binary_67make_union_writer, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_67make_union_writer(PyObject *__pyx_self, PyObject *__pyx_v_union_schema) { +static PyObject *__pyx_pw_6spavro_11fast_binary_61make_fixed_check(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_61make_fixed_check = {"make_fixed_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_61make_fixed_check, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_61make_fixed_check(PyObject *__pyx_self, PyObject *__pyx_v_schema) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("make_union_writer (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_66make_union_writer(__pyx_self, ((PyObject *)__pyx_v_union_schema)); + __Pyx_RefNannySetupContext("make_fixed_check (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_60make_fixed_check(__pyx_self, ((PyObject *)__pyx_v_schema)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":505 - * # or a float and a double in a union (which is valid but nonsensical - * # in python but valid in avro) - * def simple_writer_lookup(datum): # <<<<<<<<<<<<<< - * try: - * return writer_lookup_dict[type(datum)] +/* "spavro/fast_binary.pyx":537 + * def make_fixed_check(schema): + * cdef int size = schema['size'] + * def fixed_check(datum): # <<<<<<<<<<<<<< + * return (isinstance(datum, str) or isinstance(datum, bytes)) and len(datum) == size + * return fixed_check */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17make_union_writer_1simple_writer_lookup(PyObject *__pyx_self, PyObject *__pyx_v_datum); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17make_union_writer_1simple_writer_lookup = {"simple_writer_lookup", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17make_union_writer_1simple_writer_lookup, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17make_union_writer_1simple_writer_lookup(PyObject *__pyx_self, PyObject *__pyx_v_datum) { +static PyObject *__pyx_pw_6spavro_11fast_binary_16make_fixed_check_1fixed_check(PyObject *__pyx_self, PyObject *__pyx_v_datum); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_16make_fixed_check_1fixed_check = {"fixed_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_16make_fixed_check_1fixed_check, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_16make_fixed_check_1fixed_check(PyObject *__pyx_self, PyObject *__pyx_v_datum) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("simple_writer_lookup (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_17make_union_writer_simple_writer_lookup(__pyx_self, ((PyObject *)__pyx_v_datum)); + __Pyx_RefNannySetupContext("fixed_check (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_16make_fixed_check_fixed_check(__pyx_self, ((PyObject *)__pyx_v_datum)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_17make_union_writer_simple_writer_lookup(PyObject *__pyx_self, PyObject *__pyx_v_datum) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *__pyx_cur_scope; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *__pyx_outer_scope; +static PyObject *__pyx_pf_6spavro_11fast_binary_16make_fixed_check_fixed_check(PyObject *__pyx_self, PyObject *__pyx_v_datum) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check *__pyx_cur_scope; + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check *__pyx_outer_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - __Pyx_RefNannySetupContext("simple_writer_lookup", 0); - __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *) __Pyx_CyFunction_GetClosure(__pyx_self); + Py_ssize_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("fixed_check", 0); + __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check *) __Pyx_CyFunction_GetClosure(__pyx_self); __pyx_cur_scope = __pyx_outer_scope; - /* "spavro/fast_binary.pyx":506 - * # in python but valid in avro) - * def simple_writer_lookup(datum): - * try: # <<<<<<<<<<<<<< - * return writer_lookup_dict[type(datum)] - * except KeyError: + /* "spavro/fast_binary.pyx":538 + * cdef int size = schema['size'] + * def fixed_check(datum): + * return (isinstance(datum, str) or isinstance(datum, bytes)) and len(datum) == size # <<<<<<<<<<<<<< + * return fixed_check + * */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyString_Check(__pyx_v_datum); + if (!__pyx_t_2) { + } else { + goto __pyx_L4_next_and; + } + __pyx_t_2 = PyBytes_Check(__pyx_v_datum); + if (__pyx_t_2) { + } else { + __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 538, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L3_bool_binop_done; + } + __pyx_L4_next_and:; + __pyx_t_4 = PyObject_Length(__pyx_v_datum); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 538, __pyx_L1_error) + __pyx_t_2 = (__pyx_t_4 == __pyx_cur_scope->__pyx_v_size); + __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 538, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + __pyx_L3_bool_binop_done:; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "spavro/fast_binary.pyx":507 - * def simple_writer_lookup(datum): - * try: - * return writer_lookup_dict[type(datum)] # <<<<<<<<<<<<<< - * except KeyError: - * raise TypeError("{} - Invalid type ({}) in union. Schema: {}".format(repr(datum), type(datum), union_schema)) + /* "spavro/fast_binary.pyx":537 + * def make_fixed_check(schema): + * cdef int size = schema['size'] + * def fixed_check(datum): # <<<<<<<<<<<<<< + * return (isinstance(datum, str) or isinstance(datum, bytes)) and len(datum) == size + * return fixed_check */ - __Pyx_XDECREF(__pyx_r); - if (unlikely(!__pyx_cur_scope->__pyx_v_writer_lookup_dict)) { __Pyx_RaiseClosureNameError("writer_lookup_dict"); __PYX_ERR(0, 507, __pyx_L3_error) } - if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 507, __pyx_L3_error) - } - __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, ((PyObject *)Py_TYPE(__pyx_v_datum))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 507, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L7_try_return; - /* "spavro/fast_binary.pyx":506 - * # in python but valid in avro) - * def simple_writer_lookup(datum): - * try: # <<<<<<<<<<<<<< - * return writer_lookup_dict[type(datum)] - * except KeyError: - */ - } - __pyx_L3_error:; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spavro.fast_binary.make_fixed_check.fixed_check", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "spavro/fast_binary.pyx":508 - * try: - * return writer_lookup_dict[type(datum)] - * except KeyError: # <<<<<<<<<<<<<< - * raise TypeError("{} - Invalid type ({}) in union. Schema: {}".format(repr(datum), type(datum), union_schema)) +/* "spavro/fast_binary.pyx":535 + * return union_check * + * def make_fixed_check(schema): # <<<<<<<<<<<<<< + * cdef int size = schema['size'] + * def fixed_check(datum): */ - __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError); - if (__pyx_t_5) { - __Pyx_AddTraceback("spavro.fast_binary.make_union_writer.simple_writer_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 508, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); - /* "spavro/fast_binary.pyx":509 - * return writer_lookup_dict[type(datum)] - * except KeyError: - * raise TypeError("{} - Invalid type ({}) in union. Schema: {}".format(repr(datum), type(datum), union_schema)) # <<<<<<<<<<<<<< +static PyObject *__pyx_pf_6spavro_11fast_binary_60make_fixed_check(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check *__pyx_cur_scope; + PyObject *__pyx_v_fixed_check = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_fixed_check", 0); + __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 535, __pyx_L1_error) + } else { + __Pyx_GOTREF(__pyx_cur_scope); + } + + /* "spavro/fast_binary.pyx":536 * - * writer_lookup = simple_writer_lookup + * def make_fixed_check(schema): + * cdef int size = schema['size'] # <<<<<<<<<<<<<< + * def fixed_check(datum): + * return (isinstance(datum, str) or isinstance(datum, bytes)) and len(datum) == size */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Invalid_type_in_union_Schema, __pyx_n_s_format); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 509, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = PyObject_Repr(__pyx_v_datum); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 509, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_10); - if (unlikely(!__pyx_cur_scope->__pyx_v_union_schema)) { __Pyx_RaiseClosureNameError("union_schema"); __PYX_ERR(0, 509, __pyx_L5_except_error) } - __pyx_t_11 = NULL; - __pyx_t_5 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_11)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_11); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - __pyx_t_5 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_t_10, ((PyObject *)Py_TYPE(__pyx_v_datum)), __pyx_cur_scope->__pyx_v_union_schema}; - __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 509, __pyx_L5_except_error) - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_t_10, ((PyObject *)Py_TYPE(__pyx_v_datum)), __pyx_cur_scope->__pyx_v_union_schema}; - __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 509, __pyx_L5_except_error) - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } else - #endif - { - __pyx_t_12 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 509, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_12); - if (__pyx_t_11) { - __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11); __pyx_t_11 = NULL; - } - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_5, __pyx_t_10); - __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_datum))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_datum))); - PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_5, ((PyObject *)Py_TYPE(__pyx_v_datum))); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_union_schema); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_union_schema); - PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_5, __pyx_cur_scope->__pyx_v_union_schema); - __pyx_t_10 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_12, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 509, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 509, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_Raise(__pyx_t_9, 0, 0, 0); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __PYX_ERR(0, 509, __pyx_L5_except_error) - } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_schema, __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_cur_scope->__pyx_v_size = __pyx_t_2; - /* "spavro/fast_binary.pyx":506 - * # in python but valid in avro) - * def simple_writer_lookup(datum): - * try: # <<<<<<<<<<<<<< - * return writer_lookup_dict[type(datum)] - * except KeyError: + /* "spavro/fast_binary.pyx":537 + * def make_fixed_check(schema): + * cdef int size = schema['size'] + * def fixed_check(datum): # <<<<<<<<<<<<<< + * return (isinstance(datum, str) or isinstance(datum, bytes)) and len(datum) == size + * return fixed_check */ - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L7_try_return:; - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L0; - } + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_16make_fixed_check_1fixed_check, 0, __pyx_n_s_make_fixed_check_locals_fixed_ch, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_fixed_check = __pyx_t_1; + __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":505 - * # or a float and a double in a union (which is valid but nonsensical - * # in python but valid in avro) - * def simple_writer_lookup(datum): # <<<<<<<<<<<<<< - * try: - * return writer_lookup_dict[type(datum)] + /* "spavro/fast_binary.pyx":539 + * def fixed_check(datum): + * return (isinstance(datum, str) or isinstance(datum, bytes)) and len(datum) == size + * return fixed_check # <<<<<<<<<<<<<< + * + * def make_map_check(schema): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_fixed_check); + __pyx_r = __pyx_v_fixed_check; + goto __pyx_L0; + + /* "spavro/fast_binary.pyx":535 + * return union_check + * + * def make_fixed_check(schema): # <<<<<<<<<<<<<< + * cdef int size = schema['size'] + * def fixed_check(datum): */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __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); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_AddTraceback("spavro.fast_binary.make_union_writer.simple_writer_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spavro.fast_binary.make_fixed_check", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_fixed_check); + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":534 - * +/* "spavro/fast_binary.pyx":541 + * return fixed_check * - * def complex_writer_lookup(datum): # <<<<<<<<<<<<<< - * cdef: - * long idx + * def make_map_check(schema): # <<<<<<<<<<<<<< + * map_value_check = get_check(schema['values']) + * def map_check(datum): */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17make_union_writer_3complex_writer_lookup(PyObject *__pyx_self, PyObject *__pyx_v_datum); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17make_union_writer_3complex_writer_lookup = {"complex_writer_lookup", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17make_union_writer_3complex_writer_lookup, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17make_union_writer_3complex_writer_lookup(PyObject *__pyx_self, PyObject *__pyx_v_datum) { +static PyObject *__pyx_pw_6spavro_11fast_binary_63make_map_check(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_63make_map_check = {"make_map_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_63make_map_check, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_63make_map_check(PyObject *__pyx_self, PyObject *__pyx_v_schema) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("complex_writer_lookup (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_17make_union_writer_2complex_writer_lookup(__pyx_self, ((PyObject *)__pyx_v_datum)); + __Pyx_RefNannySetupContext("make_map_check (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_62make_map_check(__pyx_self, ((PyObject *)__pyx_v_schema)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_17make_union_writer_2complex_writer_lookup(PyObject *__pyx_self, PyObject *__pyx_v_datum) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *__pyx_cur_scope; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *__pyx_outer_scope; - long __pyx_v_idx; - PyObject *__pyx_v_lookup_result = 0; - PyObject *__pyx_v_get_check = NULL; - PyObject *__pyx_v_writer = NULL; +/* "spavro/fast_binary.pyx":543 + * def make_map_check(schema): + * map_value_check = get_check(schema['values']) + * def map_check(datum): # <<<<<<<<<<<<<< + * return isinstance(datum, dict) and all([check_string(key) and map_value_check(value) for key, value in datum.items()]) + * return map_check + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6spavro_11fast_binary_14make_map_check_1map_check(PyObject *__pyx_self, PyObject *__pyx_v_datum); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_14make_map_check_1map_check = {"map_check", (PyCFunction)__pyx_pw_6spavro_11fast_binary_14make_map_check_1map_check, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_14make_map_check_1map_check(PyObject *__pyx_self, PyObject *__pyx_v_datum) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("map_check (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_14make_map_check_map_check(__pyx_self, ((PyObject *)__pyx_v_datum)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6spavro_11fast_binary_14make_map_check_map_check(PyObject *__pyx_self, PyObject *__pyx_v_datum) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check *__pyx_cur_scope; + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check *__pyx_outer_scope; + PyObject *__pyx_v_key = NULL; + PyObject *__pyx_v_value = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; + PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; + Py_ssize_t __pyx_t_7; + PyObject *(*__pyx_t_8)(PyObject *); PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - Py_ssize_t __pyx_t_13; - int __pyx_t_14; - PyObject *(*__pyx_t_15)(PyObject *); - long __pyx_t_16; - __Pyx_RefNannySetupContext("complex_writer_lookup", 0); - __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *) __Pyx_CyFunction_GetClosure(__pyx_self); + PyObject *(*__pyx_t_11)(PyObject *); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("map_check", 0); + __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check *) __Pyx_CyFunction_GetClosure(__pyx_self); __pyx_cur_scope = __pyx_outer_scope; - /* "spavro/fast_binary.pyx":538 - * long idx - * list lookup_result - * try: # <<<<<<<<<<<<<< - * lookup_result = writer_lookup_dict[type(datum)] - * except KeyError: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { - - /* "spavro/fast_binary.pyx":539 - * list lookup_result - * try: - * lookup_result = writer_lookup_dict[type(datum)] # <<<<<<<<<<<<<< - * except KeyError: - * raise TypeError("{} - Invalid type ({}) in union. Schema: {}".format(repr(datum), type(datum), union_schema)) + /* "spavro/fast_binary.pyx":544 + * map_value_check = get_check(schema['values']) + * def map_check(datum): + * return isinstance(datum, dict) and all([check_string(key) and map_value_check(value) for key, value in datum.items()]) # <<<<<<<<<<<<<< + * return map_check + * */ - if (unlikely(!__pyx_cur_scope->__pyx_v_writer_lookup_dict)) { __Pyx_RaiseClosureNameError("writer_lookup_dict"); __PYX_ERR(0, 539, __pyx_L3_error) } - if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 539, __pyx_L3_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyDict_Check(__pyx_v_datum); + if (__pyx_t_2) { + } else { + __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 544, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L3_bool_binop_done; + } + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 544, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_datum, __pyx_n_s_items); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 544, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 544, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { + __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); __pyx_t_7 = 0; + __pyx_t_8 = NULL; + } else { + __pyx_t_7 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 544, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 544, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + for (;;) { + if (likely(!__pyx_t_8)) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 544, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 544, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } else { + if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 544, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 544, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } + } else { + __pyx_t_4 = __pyx_t_8(__pyx_t_5); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 544, __pyx_L1_error) + } + break; } - __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, ((PyObject *)Py_TYPE(__pyx_v_datum))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 539, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); - if (!(likely(PyList_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 539, __pyx_L3_error) - __pyx_v_lookup_result = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; - - /* "spavro/fast_binary.pyx":538 - * long idx - * list lookup_result - * try: # <<<<<<<<<<<<<< - * lookup_result = writer_lookup_dict[type(datum)] - * except KeyError: - */ } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8_try_end; - __pyx_L3_error:; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "spavro/fast_binary.pyx":540 - * try: - * lookup_result = writer_lookup_dict[type(datum)] - * except KeyError: # <<<<<<<<<<<<<< - * raise TypeError("{} - Invalid type ({}) in union. Schema: {}".format(repr(datum), type(datum), union_schema)) - * if len(lookup_result) == 1: - */ - __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError); - if (__pyx_t_5) { - __Pyx_AddTraceback("spavro.fast_binary.make_union_writer.complex_writer_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 540, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); - - /* "spavro/fast_binary.pyx":541 - * lookup_result = writer_lookup_dict[type(datum)] - * except KeyError: - * raise TypeError("{} - Invalid type ({}) in union. Schema: {}".format(repr(datum), type(datum), union_schema)) # <<<<<<<<<<<<<< - * if len(lookup_result) == 1: - * idx, get_check, writer = lookup_result[0] - */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Invalid_type_in_union_Schema, __pyx_n_s_format); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 541, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = PyObject_Repr(__pyx_v_datum); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 541, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_10); - if (unlikely(!__pyx_cur_scope->__pyx_v_union_schema)) { __Pyx_RaiseClosureNameError("union_schema"); __PYX_ERR(0, 541, __pyx_L5_except_error) } - __pyx_t_11 = NULL; - __pyx_t_5 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_11)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_11); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - __pyx_t_5 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_t_10, ((PyObject *)Py_TYPE(__pyx_v_datum)), __pyx_cur_scope->__pyx_v_union_schema}; - __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 541, __pyx_L5_except_error) - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_t_10, ((PyObject *)Py_TYPE(__pyx_v_datum)), __pyx_cur_scope->__pyx_v_union_schema}; - __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 541, __pyx_L5_except_error) - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } else - #endif - { - __pyx_t_12 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 541, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_12); - if (__pyx_t_11) { - __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11); __pyx_t_11 = NULL; - } - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_5, __pyx_t_10); - __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_datum))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_datum))); - PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_5, ((PyObject *)Py_TYPE(__pyx_v_datum))); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_union_schema); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_union_schema); - PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_5, __pyx_cur_scope->__pyx_v_union_schema); - __pyx_t_10 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_12, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 541, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 541, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_Raise(__pyx_t_9, 0, 0, 0); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __PYX_ERR(0, 541, __pyx_L5_except_error) - } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; - - /* "spavro/fast_binary.pyx":538 - * long idx - * list lookup_result - * try: # <<<<<<<<<<<<<< - * lookup_result = writer_lookup_dict[type(datum)] - * except KeyError: - */ - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L8_try_end:; - } - - /* "spavro/fast_binary.pyx":542 - * except KeyError: - * raise TypeError("{} - Invalid type ({}) in union. Schema: {}".format(repr(datum), type(datum), union_schema)) - * if len(lookup_result) == 1: # <<<<<<<<<<<<<< - * idx, get_check, writer = lookup_result[0] - * else: - */ - if (unlikely(__pyx_v_lookup_result == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 542, __pyx_L1_error) - } - __pyx_t_13 = PyList_GET_SIZE(__pyx_v_lookup_result); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 542, __pyx_L1_error) - __pyx_t_14 = ((__pyx_t_13 == 1) != 0); - if (__pyx_t_14) { - - /* "spavro/fast_binary.pyx":543 - * raise TypeError("{} - Invalid type ({}) in union. Schema: {}".format(repr(datum), type(datum), union_schema)) - * if len(lookup_result) == 1: - * idx, get_check, writer = lookup_result[0] # <<<<<<<<<<<<<< - * else: - * for idx, get_check, writer in lookup_result: - */ - if (unlikely(__pyx_v_lookup_result == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 543, __pyx_L1_error) - } - __pyx_t_7 = __Pyx_GetItemInt_List(__pyx_v_lookup_result, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 543, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) { - PyObject* sequence = __pyx_t_7; + if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) { + PyObject* sequence = __pyx_t_4; Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 3)) { - if (size > 3) __Pyx_RaiseTooManyValuesError(3); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 543, __pyx_L1_error) + __PYX_ERR(0, 544, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); - __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); + __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_6 = PyList_GET_ITEM(sequence, 0); - __pyx_t_4 = PyList_GET_ITEM(sequence, 1); - __pyx_t_9 = PyList_GET_ITEM(sequence, 2); + __pyx_t_9 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(__pyx_t_9); #else - __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 543, __pyx_L1_error) + __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 544, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 543, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 543, __pyx_L1_error) + __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 544, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); #endif - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { Py_ssize_t index = -1; - __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 543, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_15 = Py_TYPE(__pyx_t_8)->tp_iternext; - index = 0; __pyx_t_6 = __pyx_t_15(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L12_unpacking_failed; + __pyx_t_10 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 544, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext; + index = 0; __pyx_t_6 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_6)) goto __pyx_L7_unpacking_failed; __Pyx_GOTREF(__pyx_t_6); - index = 1; __pyx_t_4 = __pyx_t_15(__pyx_t_8); if (unlikely(!__pyx_t_4)) goto __pyx_L12_unpacking_failed; - __Pyx_GOTREF(__pyx_t_4); - index = 2; __pyx_t_9 = __pyx_t_15(__pyx_t_8); if (unlikely(!__pyx_t_9)) goto __pyx_L12_unpacking_failed; + index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L7_unpacking_failed; __Pyx_GOTREF(__pyx_t_9); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_8), 3) < 0) __PYX_ERR(0, 543, __pyx_L1_error) - __pyx_t_15 = NULL; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L13_unpacking_done; - __pyx_L12_unpacking_failed:; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_15 = NULL; + if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) __PYX_ERR(0, 544, __pyx_L1_error) + __pyx_t_11 = NULL; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L8_unpacking_done; + __pyx_L7_unpacking_failed:; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_11 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 543, __pyx_L1_error) - __pyx_L13_unpacking_done:; + __PYX_ERR(0, 544, __pyx_L1_error) + __pyx_L8_unpacking_done:; } - __pyx_t_16 = __Pyx_PyInt_As_long(__pyx_t_6); if (unlikely((__pyx_t_16 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 543, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_idx = __pyx_t_16; - __pyx_v_get_check = __pyx_t_4; - __pyx_t_4 = 0; - __pyx_v_writer = __pyx_t_9; + __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_9); __pyx_t_9 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_check_string); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 544, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_10 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_10)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + __pyx_t_9 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_10, __pyx_v_key) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_key); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 544, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 544, __pyx_L1_error) + if (__pyx_t_2) { + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } else { + __Pyx_INCREF(__pyx_t_9); + __pyx_t_4 = __pyx_t_9; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L9_bool_binop_done; + } + if (unlikely(!__pyx_cur_scope->__pyx_v_map_value_check)) { __Pyx_RaiseClosureNameError("map_value_check"); __PYX_ERR(0, 544, __pyx_L1_error) } + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_map_value_check); + __pyx_t_6 = __pyx_cur_scope->__pyx_v_map_value_check; __pyx_t_10 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_10)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + __pyx_t_9 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_10, __pyx_v_value) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_value); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 544, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_INCREF(__pyx_t_9); + __pyx_t_4 = __pyx_t_9; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_L9_bool_binop_done:; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 544, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_all, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 544, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_1 = __pyx_t_5; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_L3_bool_binop_done:; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "spavro/fast_binary.pyx":542 - * except KeyError: - * raise TypeError("{} - Invalid type ({}) in union. Schema: {}".format(repr(datum), type(datum), union_schema)) - * if len(lookup_result) == 1: # <<<<<<<<<<<<<< - * idx, get_check, writer = lookup_result[0] - * else: + /* "spavro/fast_binary.pyx":543 + * def make_map_check(schema): + * map_value_check = get_check(schema['values']) + * def map_check(datum): # <<<<<<<<<<<<<< + * return isinstance(datum, dict) and all([check_string(key) and map_value_check(value) for key, value in datum.items()]) + * return map_check */ - goto __pyx_L11; - } - /* "spavro/fast_binary.pyx":545 - * idx, get_check, writer = lookup_result[0] - * else: - * for idx, get_check, writer in lookup_result: # <<<<<<<<<<<<<< - * if get_check(datum): - * break + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("spavro.fast_binary.make_map_check.map_check", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_key); + __Pyx_XDECREF(__pyx_v_value); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spavro/fast_binary.pyx":541 + * return fixed_check + * + * def make_map_check(schema): # <<<<<<<<<<<<<< + * map_value_check = get_check(schema['values']) + * def map_check(datum): */ - /*else*/ { - if (unlikely(__pyx_v_lookup_result == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 545, __pyx_L1_error) - } - __pyx_t_7 = __pyx_v_lookup_result; __Pyx_INCREF(__pyx_t_7); __pyx_t_13 = 0; - for (;;) { - if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_7)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_9 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_13); __Pyx_INCREF(__pyx_t_9); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 545, __pyx_L1_error) - #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_7, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 545, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - #endif - if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) { - PyObject* sequence = __pyx_t_9; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 3)) { - if (size > 3) __Pyx_RaiseTooManyValuesError(3); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 545, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); - __pyx_t_8 = PyTuple_GET_ITEM(sequence, 2); - } else { - __pyx_t_4 = PyList_GET_ITEM(sequence, 0); - __pyx_t_6 = PyList_GET_ITEM(sequence, 1); - __pyx_t_8 = PyList_GET_ITEM(sequence, 2); - } - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(__pyx_t_8); - #else - __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 545, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 545, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 545, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - #endif - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_12 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 545, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_15 = Py_TYPE(__pyx_t_12)->tp_iternext; - index = 0; __pyx_t_4 = __pyx_t_15(__pyx_t_12); if (unlikely(!__pyx_t_4)) goto __pyx_L16_unpacking_failed; - __Pyx_GOTREF(__pyx_t_4); - index = 1; __pyx_t_6 = __pyx_t_15(__pyx_t_12); if (unlikely(!__pyx_t_6)) goto __pyx_L16_unpacking_failed; - __Pyx_GOTREF(__pyx_t_6); - index = 2; __pyx_t_8 = __pyx_t_15(__pyx_t_12); if (unlikely(!__pyx_t_8)) goto __pyx_L16_unpacking_failed; - __Pyx_GOTREF(__pyx_t_8); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_12), 3) < 0) __PYX_ERR(0, 545, __pyx_L1_error) - __pyx_t_15 = NULL; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - goto __pyx_L17_unpacking_done; - __pyx_L16_unpacking_failed:; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_15 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 545, __pyx_L1_error) - __pyx_L17_unpacking_done:; - } - __pyx_t_16 = __Pyx_PyInt_As_long(__pyx_t_4); if (unlikely((__pyx_t_16 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 545, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_idx = __pyx_t_16; - __Pyx_XDECREF_SET(__pyx_v_get_check, __pyx_t_6); - __pyx_t_6 = 0; - __Pyx_XDECREF_SET(__pyx_v_writer, __pyx_t_8); - __pyx_t_8 = 0; - - /* "spavro/fast_binary.pyx":546 - * else: - * for idx, get_check, writer in lookup_result: - * if get_check(datum): # <<<<<<<<<<<<<< - * break - * else: - */ - __Pyx_INCREF(__pyx_v_get_check); - __pyx_t_8 = __pyx_v_get_check; __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - __pyx_t_9 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_6, __pyx_v_datum) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_datum); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 546, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 546, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (__pyx_t_14) { - /* "spavro/fast_binary.pyx":547 - * for idx, get_check, writer in lookup_result: - * if get_check(datum): - * break # <<<<<<<<<<<<<< - * else: - * raise TypeError("No matching schema for datum: {}".format(repr(datum))) - */ - goto __pyx_L15_break; - - /* "spavro/fast_binary.pyx":546 - * else: - * for idx, get_check, writer in lookup_result: - * if get_check(datum): # <<<<<<<<<<<<<< - * break - * else: - */ - } - - /* "spavro/fast_binary.pyx":545 - * idx, get_check, writer = lookup_result[0] - * else: - * for idx, get_check, writer in lookup_result: # <<<<<<<<<<<<<< - * if get_check(datum): - * break - */ - } - /*else*/ { +static PyObject *__pyx_pf_6spavro_11fast_binary_62make_map_check(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check *__pyx_cur_scope; + PyObject *__pyx_v_map_check = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_map_check", 0); + __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 541, __pyx_L1_error) + } else { + __Pyx_GOTREF(__pyx_cur_scope); + } - /* "spavro/fast_binary.pyx":549 - * break - * else: - * raise TypeError("No matching schema for datum: {}".format(repr(datum))) # <<<<<<<<<<<<<< - * return idx, writer + /* "spavro/fast_binary.pyx":542 * + * def make_map_check(schema): + * map_value_check = get_check(schema['values']) # <<<<<<<<<<<<<< + * def map_check(datum): + * return isinstance(datum, dict) and all([check_string(key) and map_value_check(value) for key, value in datum.items()]) */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_No_matching_schema_for_datum, __pyx_n_s_format); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 549, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = PyObject_Repr(__pyx_v_datum); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 549, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - __pyx_t_9 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_4, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_6); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 549, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 549, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(0, 549, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_check); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 542, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_schema, __pyx_n_s_values); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 542, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + 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_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 542, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_v_map_value_check = __pyx_t_1; + __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":545 - * idx, get_check, writer = lookup_result[0] - * else: - * for idx, get_check, writer in lookup_result: # <<<<<<<<<<<<<< - * if get_check(datum): - * break + /* "spavro/fast_binary.pyx":543 + * def make_map_check(schema): + * map_value_check = get_check(schema['values']) + * def map_check(datum): # <<<<<<<<<<<<<< + * return isinstance(datum, dict) and all([check_string(key) and map_value_check(value) for key, value in datum.items()]) + * return map_check */ - __pyx_L15_break:; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - __pyx_L11:; + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_14make_map_check_1map_check, 0, __pyx_n_s_make_map_check_locals_map_check, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__31)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 543, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_map_check = __pyx_t_1; + __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":550 - * else: - * raise TypeError("No matching schema for datum: {}".format(repr(datum))) - * return idx, writer # <<<<<<<<<<<<<< + /* "spavro/fast_binary.pyx":545 + * def map_check(datum): + * return isinstance(datum, dict) and all([check_string(key) and map_value_check(value) for key, value in datum.items()]) + * return map_check # <<<<<<<<<<<<<< * - * writer_lookup = complex_writer_lookup + * check_type_map = { */ __Pyx_XDECREF(__pyx_r); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_idx); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 550, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 550, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); - __Pyx_INCREF(__pyx_v_writer); - __Pyx_GIVEREF(__pyx_v_writer); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_writer); - __pyx_t_7 = 0; - __pyx_r = __pyx_t_8; - __pyx_t_8 = 0; + __Pyx_INCREF(__pyx_v_map_check); + __pyx_r = __pyx_v_map_check; goto __pyx_L0; - /* "spavro/fast_binary.pyx":534 - * + /* "spavro/fast_binary.pyx":541 + * return fixed_check * - * def complex_writer_lookup(datum): # <<<<<<<<<<<<<< - * cdef: - * long idx + * def make_map_check(schema): # <<<<<<<<<<<<<< + * map_value_check = get_check(schema['values']) + * def map_check(datum): */ /* function exit code */ __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_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); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_AddTraceback("spavro.fast_binary.make_union_writer.complex_writer_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.make_map_check", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_lookup_result); - __Pyx_XDECREF(__pyx_v_get_check); - __Pyx_XDECREF(__pyx_v_writer); + __Pyx_XDECREF(__pyx_v_map_check); + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":554 - * writer_lookup = complex_writer_lookup +/* "spavro/fast_binary.pyx":566 + * # ==================== * - * def write_union(outbuf, datum): # <<<<<<<<<<<<<< - * idx, data_writer = writer_lookup(datum) - * write_long(outbuf, idx) + * def lookup_schema(schema): # <<<<<<<<<<<<<< + * '''Check if a schema is a standard type, if not, lookup in the custom + * schema dictionary and replace the custom name with the expanded original */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17make_union_writer_5write_union(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17make_union_writer_5write_union = {"write_union", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17make_union_writer_5write_union, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17make_union_writer_5write_union(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_outbuf = 0; - PyObject *__pyx_v_datum = 0; +static PyObject *__pyx_pw_6spavro_11fast_binary_65lookup_schema(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ +static char __pyx_doc_6spavro_11fast_binary_64lookup_schema[] = "Check if a schema is a standard type, if not, lookup in the custom\n schema dictionary and replace the custom name with the expanded original\n schema."; +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_65lookup_schema = {"lookup_schema", (PyCFunction)__pyx_pw_6spavro_11fast_binary_65lookup_schema, METH_O, __pyx_doc_6spavro_11fast_binary_64lookup_schema}; +static PyObject *__pyx_pw_6spavro_11fast_binary_65lookup_schema(PyObject *__pyx_self, PyObject *__pyx_v_schema) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write_union (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_outbuf,&__pyx_n_s_datum,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outbuf)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_datum)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("write_union", 1, 2, 2, 1); __PYX_ERR(0, 554, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write_union") < 0)) __PYX_ERR(0, 554, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + __Pyx_RefNannySetupContext("lookup_schema (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_64lookup_schema(__pyx_self, ((PyObject *)__pyx_v_schema)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6spavro_11fast_binary_64lookup_schema(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema) { + PyObject *__pyx_v_check_type = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lookup_schema", 0); + + /* "spavro/fast_binary.pyx":570 + * schema dictionary and replace the custom name with the expanded original + * schema.''' + * check_type = get_type(schema) # <<<<<<<<<<<<<< + * if check_type in writer_type_map: + * return schema + */ + __pyx_t_1 = __pyx_f_6spavro_11fast_binary_get_type(__pyx_v_schema, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_check_type = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spavro/fast_binary.pyx":571 + * schema.''' + * check_type = get_type(schema) + * if check_type in writer_type_map: # <<<<<<<<<<<<<< + * return schema + * return custom_schema[check_type] + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_writer_type_map); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 571, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_check_type, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 571, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { + + /* "spavro/fast_binary.pyx":572 + * check_type = get_type(schema) + * if check_type in writer_type_map: + * return schema # <<<<<<<<<<<<<< + * return custom_schema[check_type] + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_schema); + __pyx_r = __pyx_v_schema; + goto __pyx_L0; + + /* "spavro/fast_binary.pyx":571 + * schema.''' + * check_type = get_type(schema) + * if check_type in writer_type_map: # <<<<<<<<<<<<<< + * return schema + * return custom_schema[check_type] + */ + } + + /* "spavro/fast_binary.pyx":573 + * if check_type in writer_type_map: + * return schema + * return custom_schema[check_type] # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_custom_schema); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 573, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_v_check_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 573, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "spavro/fast_binary.pyx":566 + * # ==================== + * + * def lookup_schema(schema): # <<<<<<<<<<<<<< + * '''Check if a schema is a standard type, if not, lookup in the custom + * schema dictionary and replace the custom name with the expanded original + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spavro.fast_binary.lookup_schema", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_check_type); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spavro/fast_binary.pyx":591 + * # allow strings to be used for byte data, if there's no string type + * if bytes in writer_lookup_dict and str not in writer_lookup_dict: + * writer_lookup_dict[str] = writer_lookup_dict[bytes][0], lambda output_buffer, val: writer_lookup_dict[bytes][1](output_buffer, val.encode('utf-8')) # <<<<<<<<<<<<<< + * if bytes in writer_lookup_dict and unicode not in writer_lookup_dict: + * writer_lookup_dict[unicode] = writer_lookup_dict[bytes][0], lambda output_buffer, val: writer_lookup_dict[bytes][1](output_buffer, val.encode('utf-8')) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6spavro_11fast_binary_27create_promotions_for_union_lambda14(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_27create_promotions_for_union_lambda14 = {"lambda14", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_27create_promotions_for_union_lambda14, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_27create_promotions_for_union_lambda14(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_output_buffer = 0; + PyObject *__pyx_v_val = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda14 (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_output_buffer,&__pyx_n_s_val,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_output_buffer)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_val)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("lambda14", 1, 2, 2, 1); __PYX_ERR(0, 591, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lambda14") < 0)) __PYX_ERR(0, 591, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_outbuf = values[0]; - __pyx_v_datum = values[1]; + __pyx_v_output_buffer = values[0]; + __pyx_v_val = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("write_union", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 554, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("lambda14", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 591, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("spavro.fast_binary.make_union_writer.write_union", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.create_promotions_for_union.lambda14", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6spavro_11fast_binary_17make_union_writer_4write_union(__pyx_self, __pyx_v_outbuf, __pyx_v_datum); + __pyx_r = __pyx_lambda_funcdef_lambda14(__pyx_self, __pyx_v_output_buffer, __pyx_v_val); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_17make_union_writer_4write_union(PyObject *__pyx_self, PyObject *__pyx_v_outbuf, PyObject *__pyx_v_datum) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *__pyx_cur_scope; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *__pyx_outer_scope; - PyObject *__pyx_v_idx = NULL; - PyObject *__pyx_v_data_writer = NULL; +static PyObject *__pyx_lambda_funcdef_lambda14(PyObject *__pyx_self, PyObject *__pyx_v_output_buffer, PyObject *__pyx_v_val) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *__pyx_cur_scope; + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *__pyx_outer_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - PyObject *(*__pyx_t_5)(PyObject *); + PyObject *__pyx_t_5 = NULL; int __pyx_t_6; - __Pyx_RefNannySetupContext("write_union", 0); - __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *) __Pyx_CyFunction_GetClosure(__pyx_self); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda14", 0); + __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *) __Pyx_CyFunction_GetClosure(__pyx_self); __pyx_cur_scope = __pyx_outer_scope; - - /* "spavro/fast_binary.pyx":555 - * - * def write_union(outbuf, datum): - * idx, data_writer = writer_lookup(datum) # <<<<<<<<<<<<<< - * write_long(outbuf, idx) - * data_writer(outbuf, datum) - */ - if (unlikely(!__pyx_cur_scope->__pyx_v_writer_lookup)) { __Pyx_RaiseClosureNameError("writer_lookup"); __PYX_ERR(0, 555, __pyx_L1_error) } - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_writer_lookup); - __pyx_t_2 = __pyx_cur_scope->__pyx_v_writer_lookup; __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_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_writer_lookup_dict)) { __Pyx_RaiseClosureNameError("writer_lookup_dict"); __PYX_ERR(0, 591, __pyx_L1_error) } + if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 591, __pyx_L1_error) } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_datum) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_datum); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 555, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, ((PyObject *)(&PyBytes_Type))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { - PyObject* sequence = __pyx_t_1; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 555, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_2 = PyList_GET_ITEM(sequence, 0); - __pyx_t_3 = PyList_GET_ITEM(sequence, 1); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_val, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 591, __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_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - #else - __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 555, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 555, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 555, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext; - index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_2); - index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 555, __pyx_L1_error) - __pyx_t_5 = NULL; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L4_unpacking_done; - __pyx_L3_unpacking_failed:; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 555, __pyx_L1_error) - __pyx_L4_unpacking_done:; } - __pyx_v_idx = __pyx_t_2; - __pyx_t_2 = 0; - __pyx_v_data_writer = __pyx_t_3; - __pyx_t_3 = 0; - - /* "spavro/fast_binary.pyx":556 - * def write_union(outbuf, datum): - * idx, data_writer = writer_lookup(datum) - * write_long(outbuf, idx) # <<<<<<<<<<<<<< - * data_writer(outbuf, datum) - * write_union.__reduce__ = lambda: (make_union_writer, (union_schema,)) - */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_write_long); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = NULL; + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_utf_8); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { + __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_2); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_6 = 1; @@ -13029,172 +12840,225 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_union_writer_4write_union } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_outbuf, __pyx_v_idx}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 556, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_output_buffer, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_outbuf, __pyx_v_idx}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 556, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_output_buffer, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else #endif { - __pyx_t_4 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 556, __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; + __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (__pyx_t_4) { + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; } - __Pyx_INCREF(__pyx_v_outbuf); - __Pyx_GIVEREF(__pyx_v_outbuf); - PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_6, __pyx_v_outbuf); - __Pyx_INCREF(__pyx_v_idx); - __Pyx_GIVEREF(__pyx_v_idx); - PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_6, __pyx_v_idx); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "spavro/fast_binary.pyx":557 - * idx, data_writer = writer_lookup(datum) - * write_long(outbuf, idx) - * data_writer(outbuf, datum) # <<<<<<<<<<<<<< - * write_union.__reduce__ = lambda: (make_union_writer, (union_schema,)) - * return write_union - */ - __Pyx_INCREF(__pyx_v_data_writer); - __pyx_t_3 = __pyx_v_data_writer; __pyx_t_4 = NULL; - __pyx_t_6 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_6 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_outbuf, __pyx_v_datum}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __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[3] = {__pyx_t_4, __pyx_v_outbuf, __pyx_v_datum}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_2 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 557, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL; - } - __Pyx_INCREF(__pyx_v_outbuf); - __Pyx_GIVEREF(__pyx_v_outbuf); - PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_6, __pyx_v_outbuf); - __Pyx_INCREF(__pyx_v_datum); - __Pyx_GIVEREF(__pyx_v_datum); - PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_6, __pyx_v_datum); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L1_error) + __Pyx_INCREF(__pyx_v_output_buffer); + __Pyx_GIVEREF(__pyx_v_output_buffer); + PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_v_output_buffer); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 591, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "spavro/fast_binary.pyx":554 - * writer_lookup = complex_writer_lookup - * - * def write_union(outbuf, datum): # <<<<<<<<<<<<<< - * idx, data_writer = writer_lookup(datum) - * write_long(outbuf, idx) - */ + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("spavro.fast_binary.make_union_writer.write_union", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("spavro.fast_binary.create_promotions_for_union.lambda14", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_idx); - __Pyx_XDECREF(__pyx_v_data_writer); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":558 - * write_long(outbuf, idx) - * data_writer(outbuf, datum) - * write_union.__reduce__ = lambda: (make_union_writer, (union_schema,)) # <<<<<<<<<<<<<< - * return write_union +/* "spavro/fast_binary.pyx":593 + * writer_lookup_dict[str] = writer_lookup_dict[bytes][0], lambda output_buffer, val: writer_lookup_dict[bytes][1](output_buffer, val.encode('utf-8')) + * if bytes in writer_lookup_dict and unicode not in writer_lookup_dict: + * writer_lookup_dict[unicode] = writer_lookup_dict[bytes][0], lambda output_buffer, val: writer_lookup_dict[bytes][1](output_buffer, val.encode('utf-8')) # <<<<<<<<<<<<<< + * * */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17make_union_writer_6lambda16(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17make_union_writer_6lambda16 = {"lambda16", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17make_union_writer_6lambda16, METH_NOARGS, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17make_union_writer_6lambda16(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_6spavro_11fast_binary_27create_promotions_for_union_1lambda15(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_27create_promotions_for_union_1lambda15 = {"lambda15", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_27create_promotions_for_union_1lambda15, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_27create_promotions_for_union_1lambda15(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_output_buffer = 0; + PyObject *__pyx_v_val = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("lambda16 (wrapper)", 0); - __pyx_r = __pyx_lambda_funcdef_lambda16(__pyx_self); + __Pyx_RefNannySetupContext("lambda15 (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_output_buffer,&__pyx_n_s_val,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_output_buffer)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_val)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("lambda15", 1, 2, 2, 1); __PYX_ERR(0, 593, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lambda15") < 0)) __PYX_ERR(0, 593, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_output_buffer = values[0]; + __pyx_v_val = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("lambda15", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 593, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("spavro.fast_binary.create_promotions_for_union.lambda15", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_lambda_funcdef_lambda15(__pyx_self, __pyx_v_output_buffer, __pyx_v_val); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_lambda_funcdef_lambda16(PyObject *__pyx_self) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *__pyx_cur_scope; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *__pyx_outer_scope; +static PyObject *__pyx_lambda_funcdef_lambda15(PyObject *__pyx_self, PyObject *__pyx_v_output_buffer, PyObject *__pyx_v_val) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *__pyx_cur_scope; + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *__pyx_outer_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("lambda16", 0); - __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *) __Pyx_CyFunction_GetClosure(__pyx_self); + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda15", 0); + __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *) __Pyx_CyFunction_GetClosure(__pyx_self); __pyx_cur_scope = __pyx_outer_scope; __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_union_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 558, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(!__pyx_cur_scope->__pyx_v_union_schema)) { __Pyx_RaiseClosureNameError("union_schema"); __PYX_ERR(0, 558, __pyx_L1_error) } - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 558, __pyx_L1_error) + if (unlikely(!__pyx_cur_scope->__pyx_v_writer_lookup_dict)) { __Pyx_RaiseClosureNameError("writer_lookup_dict"); __PYX_ERR(0, 593, __pyx_L1_error) } + if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 593, __pyx_L1_error) + } + __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, ((PyObject *)(&PyBytes_Type))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 593, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_union_schema); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_union_schema); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_union_schema); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 558, __pyx_L1_error) + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 593, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_val, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 593, __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_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_utf_8); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 593, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_6 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_output_buffer, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 593, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_output_buffer, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 593, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else + #endif + { + __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 593, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (__pyx_t_4) { + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; + } + __Pyx_INCREF(__pyx_v_output_buffer); + __Pyx_GIVEREF(__pyx_v_output_buffer); + PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_v_output_buffer); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 593, __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_r = __pyx_t_1; __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; goto __pyx_L0; /* function exit code */ @@ -13202,7 +13066,9 @@ static PyObject *__pyx_lambda_funcdef_lambda16(PyObject *__pyx_self) { __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("spavro.fast_binary.make_union_writer.lambda16", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("spavro.fast_binary.create_promotions_for_union.lambda15", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -13210,2817 +13076,2154 @@ static PyObject *__pyx_lambda_funcdef_lambda16(PyObject *__pyx_self) { return __pyx_r; } -/* "spavro/fast_binary.pyx":477 +/* "spavro/fast_binary.pyx":576 * * - * def make_union_writer(union_schema): # <<<<<<<<<<<<<< - * cdef list type_list = [get_type(lookup_schema(schema)) for schema in union_schema] - * # cdef dict writer_lookup + * cdef void create_promotions_for_union(dict writer_lookup_dict): # <<<<<<<<<<<<<< + * '''Take the writer lookup for a union and create some aliases and promotion + * cases, and store those back into the writer lookup.''' */ -static PyObject *__pyx_pf_6spavro_11fast_binary_66make_union_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_union_schema) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *__pyx_cur_scope; - PyObject *__pyx_v_type_list = 0; - char __pyx_v_simple_union; - long __pyx_v_idx; - PyObject *__pyx_v_simple_writer_lookup = 0; - PyObject *__pyx_v_schema = NULL; - PyObject *__pyx_v_python_type = NULL; - PyObject *__pyx_v_complex_writer_lookup = 0; - PyObject *__pyx_v_write_union = 0; - long __pyx_8genexpr1__pyx_v_idx; - PyObject *__pyx_8genexpr1__pyx_v_schema = NULL; - PyObject *__pyx_r = NULL; +static void __pyx_f_6spavro_11fast_binary_create_promotions_for_union(PyObject *__pyx_v_writer_lookup_dict) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *__pyx_cur_scope; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - PyObject *(*__pyx_t_4)(PyObject *); + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - int __pyx_t_9; - long __pyx_t_10; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - __Pyx_RefNannySetupContext("make_union_writer", 0); - __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer, __pyx_empty_tuple, NULL); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("create_promotions_for_union", 0); + __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *)Py_None); + __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 477, __pyx_L1_error) + __PYX_ERR(0, 576, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } - __pyx_cur_scope->__pyx_v_union_schema = __pyx_v_union_schema; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_union_schema); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_union_schema); + __pyx_cur_scope->__pyx_v_writer_lookup_dict = __pyx_v_writer_lookup_dict; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_writer_lookup_dict); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_writer_lookup_dict); - /* "spavro/fast_binary.pyx":478 - * - * def make_union_writer(union_schema): - * cdef list type_list = [get_type(lookup_schema(schema)) for schema in union_schema] # <<<<<<<<<<<<<< - * # cdef dict writer_lookup - * # cdef list record_list + /* "spavro/fast_binary.pyx":581 + * # handle promotion cases + * # long and int are encoded the same way + * if int in writer_lookup_dict: # <<<<<<<<<<<<<< + * writer_lookup_dict[long] = writer_lookup_dict[int] + * # py2 and py3 both handle str/unicode differently */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 478, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_union_schema)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_union_schema)) { - __pyx_t_2 = __pyx_cur_scope->__pyx_v_union_schema; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_union_schema); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 478, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 478, __pyx_L1_error) + if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(0, 581, __pyx_L1_error) } - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 478, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 478, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 478, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 478, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } - } else { - __pyx_t_5 = __pyx_t_4(__pyx_t_2); - if (unlikely(!__pyx_t_5)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 478, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = (__Pyx_PyDict_ContainsTF(((PyObject *)(&PyInt_Type)), __pyx_cur_scope->__pyx_v_writer_lookup_dict, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 581, __pyx_L1_error) + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { + + /* "spavro/fast_binary.pyx":582 + * # long and int are encoded the same way + * if int in writer_lookup_dict: + * writer_lookup_dict[long] = writer_lookup_dict[int] # <<<<<<<<<<<<<< + * # py2 and py3 both handle str/unicode differently + * if unicode in writer_lookup_dict: + */ + if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 582, __pyx_L1_error) } - __Pyx_XDECREF_SET(__pyx_v_schema, __pyx_t_5); - __pyx_t_5 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_lookup_schema); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 478, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } + __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, ((PyObject *)(&PyInt_Type))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 582, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 582, __pyx_L1_error) } - __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_schema) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_schema); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 478, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __pyx_f_6spavro_11fast_binary_get_type(__pyx_t_5, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 478, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 478, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, ((PyObject *)(&PyLong_Type)), __pyx_t_3) < 0)) __PYX_ERR(0, 582, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spavro/fast_binary.pyx":581 + * # handle promotion cases + * # long and int are encoded the same way + * if int in writer_lookup_dict: # <<<<<<<<<<<<<< + * writer_lookup_dict[long] = writer_lookup_dict[int] + * # py2 and py3 both handle str/unicode differently + */ } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_type_list = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":493 - * # enums, strings and fixed are all python data type unicode or string - * # so those won't work either when mixed - * simple_union = not(type_list.count('record') > 1 or # <<<<<<<<<<<<<< - * len(set(type_list) & set(['string', 'enum', 'fixed', 'bytes'])) > 1 or - * len(set(type_list) & set(['record', 'map'])) > 1) + /* "spavro/fast_binary.pyx":584 + * writer_lookup_dict[long] = writer_lookup_dict[int] + * # py2 and py3 both handle str/unicode differently + * if unicode in writer_lookup_dict: # <<<<<<<<<<<<<< + * writer_lookup_dict[str] = writer_lookup_dict[unicode] + * # allow the use of ints to 'find' float unions */ - __pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyList_Type_count, __pyx_v_type_list, __pyx_n_s_record); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 493, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 493, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 493, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!__pyx_t_9) { - } else { - __pyx_t_8 = __pyx_t_9; - goto __pyx_L5_bool_binop_done; + if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(0, 584, __pyx_L1_error) } + __pyx_t_2 = (__Pyx_PyDict_ContainsTF(((PyObject *)(&PyUnicode_Type)), __pyx_cur_scope->__pyx_v_writer_lookup_dict, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 584, __pyx_L1_error) + __pyx_t_1 = (__pyx_t_2 != 0); + if (__pyx_t_1) { - /* "spavro/fast_binary.pyx":494 - * # so those won't work either when mixed - * simple_union = not(type_list.count('record') > 1 or - * len(set(type_list) & set(['string', 'enum', 'fixed', 'bytes'])) > 1 or # <<<<<<<<<<<<<< - * len(set(type_list) & set(['record', 'map'])) > 1) - * + /* "spavro/fast_binary.pyx":585 + * # py2 and py3 both handle str/unicode differently + * if unicode in writer_lookup_dict: + * writer_lookup_dict[str] = writer_lookup_dict[unicode] # <<<<<<<<<<<<<< + * # allow the use of ints to 'find' float unions + * if float in writer_lookup_dict and int not in writer_lookup_dict: */ - __pyx_t_2 = PySet_New(__pyx_v_type_list); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 494, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 494, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PySet_Add(__pyx_t_1, __pyx_n_s_string) < 0) __PYX_ERR(0, 494, __pyx_L1_error) - if (PySet_Add(__pyx_t_1, __pyx_n_s_enum) < 0) __PYX_ERR(0, 494, __pyx_L1_error) - if (PySet_Add(__pyx_t_1, __pyx_n_s_fixed) < 0) __PYX_ERR(0, 494, __pyx_L1_error) - if (PySet_Add(__pyx_t_1, __pyx_n_s_bytes) < 0) __PYX_ERR(0, 494, __pyx_L1_error) - __pyx_t_6 = PyNumber_And(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 494, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = PySet_GET_SIZE(__pyx_t_6); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 494, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_9 = ((__pyx_t_3 > 1) != 0); - if (!__pyx_t_9) { + if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 585, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, ((PyObject *)(&PyUnicode_Type))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 585, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, ((PyObject *)(&PyString_Type)), __pyx_t_3) < 0)) __PYX_ERR(0, 585, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spavro/fast_binary.pyx":584 + * writer_lookup_dict[long] = writer_lookup_dict[int] + * # py2 and py3 both handle str/unicode differently + * if unicode in writer_lookup_dict: # <<<<<<<<<<<<<< + * writer_lookup_dict[str] = writer_lookup_dict[unicode] + * # allow the use of ints to 'find' float unions + */ + } + + /* "spavro/fast_binary.pyx":587 + * writer_lookup_dict[str] = writer_lookup_dict[unicode] + * # allow the use of ints to 'find' float unions + * if float in writer_lookup_dict and int not in writer_lookup_dict: # <<<<<<<<<<<<<< + * writer_lookup_dict[int] = writer_lookup_dict[float] + * # allow strings to be used for byte data, if there's no string type + */ + if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(0, 587, __pyx_L1_error) + } + __pyx_t_2 = (__Pyx_PyDict_ContainsTF(((PyObject *)(&PyFloat_Type)), __pyx_cur_scope->__pyx_v_writer_lookup_dict, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 587, __pyx_L1_error) + __pyx_t_4 = (__pyx_t_2 != 0); + if (__pyx_t_4) { } else { - __pyx_t_8 = __pyx_t_9; - goto __pyx_L5_bool_binop_done; + __pyx_t_1 = __pyx_t_4; + goto __pyx_L6_bool_binop_done; + } + if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(0, 587, __pyx_L1_error) } + __pyx_t_4 = (__Pyx_PyDict_ContainsTF(((PyObject *)(&PyInt_Type)), __pyx_cur_scope->__pyx_v_writer_lookup_dict, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 587, __pyx_L1_error) + __pyx_t_2 = (__pyx_t_4 != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L6_bool_binop_done:; + if (__pyx_t_1) { - /* "spavro/fast_binary.pyx":495 - * simple_union = not(type_list.count('record') > 1 or - * len(set(type_list) & set(['string', 'enum', 'fixed', 'bytes'])) > 1 or - * len(set(type_list) & set(['record', 'map'])) > 1) # <<<<<<<<<<<<<< - * - * if simple_union: + /* "spavro/fast_binary.pyx":588 + * # allow the use of ints to 'find' float unions + * if float in writer_lookup_dict and int not in writer_lookup_dict: + * writer_lookup_dict[int] = writer_lookup_dict[float] # <<<<<<<<<<<<<< + * # allow strings to be used for byte data, if there's no string type + * if bytes in writer_lookup_dict and str not in writer_lookup_dict: */ - __pyx_t_6 = PySet_New(__pyx_v_type_list); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 495, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 495, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PySet_Add(__pyx_t_1, __pyx_n_s_record) < 0) __PYX_ERR(0, 495, __pyx_L1_error) - if (PySet_Add(__pyx_t_1, __pyx_n_s_map) < 0) __PYX_ERR(0, 495, __pyx_L1_error) - __pyx_t_2 = PyNumber_And(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 495, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = PySet_GET_SIZE(__pyx_t_2); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 495, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_9 = ((__pyx_t_3 > 1) != 0); - __pyx_t_8 = __pyx_t_9; - __pyx_L5_bool_binop_done:; + if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 588, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, ((PyObject *)(&PyFloat_Type))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 588, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 588, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, ((PyObject *)(&PyInt_Type)), __pyx_t_3) < 0)) __PYX_ERR(0, 588, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":493 - * # enums, strings and fixed are all python data type unicode or string - * # so those won't work either when mixed - * simple_union = not(type_list.count('record') > 1 or # <<<<<<<<<<<<<< - * len(set(type_list) & set(['string', 'enum', 'fixed', 'bytes'])) > 1 or - * len(set(type_list) & set(['record', 'map'])) > 1) + /* "spavro/fast_binary.pyx":587 + * writer_lookup_dict[str] = writer_lookup_dict[unicode] + * # allow the use of ints to 'find' float unions + * if float in writer_lookup_dict and int not in writer_lookup_dict: # <<<<<<<<<<<<<< + * writer_lookup_dict[int] = writer_lookup_dict[float] + * # allow strings to be used for byte data, if there's no string type */ - __pyx_v_simple_union = (!__pyx_t_8); + } - /* "spavro/fast_binary.pyx":497 - * len(set(type_list) & set(['record', 'map'])) > 1) - * - * if simple_union: # <<<<<<<<<<<<<< - * writer_lookup_dict = {avro_to_py[get_type(lookup_schema(schema))]: (idx, get_writer(schema)) for idx, schema in enumerate(union_schema)} - * + /* "spavro/fast_binary.pyx":590 + * writer_lookup_dict[int] = writer_lookup_dict[float] + * # allow strings to be used for byte data, if there's no string type + * if bytes in writer_lookup_dict and str not in writer_lookup_dict: # <<<<<<<<<<<<<< + * writer_lookup_dict[str] = writer_lookup_dict[bytes][0], lambda output_buffer, val: writer_lookup_dict[bytes][1](output_buffer, val.encode('utf-8')) + * if bytes in writer_lookup_dict and unicode not in writer_lookup_dict: */ - __pyx_t_8 = (__pyx_v_simple_union != 0); - if (__pyx_t_8) { + if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(0, 590, __pyx_L1_error) + } + __pyx_t_2 = (__Pyx_PyDict_ContainsTF(((PyObject *)(&PyBytes_Type)), __pyx_cur_scope->__pyx_v_writer_lookup_dict, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 590, __pyx_L1_error) + __pyx_t_4 = (__pyx_t_2 != 0); + if (__pyx_t_4) { + } else { + __pyx_t_1 = __pyx_t_4; + goto __pyx_L9_bool_binop_done; + } + if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(0, 590, __pyx_L1_error) + } + __pyx_t_4 = (__Pyx_PyDict_ContainsTF(((PyObject *)(&PyString_Type)), __pyx_cur_scope->__pyx_v_writer_lookup_dict, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 590, __pyx_L1_error) + __pyx_t_2 = (__pyx_t_4 != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L9_bool_binop_done:; + if (__pyx_t_1) { - /* "spavro/fast_binary.pyx":498 - * - * if simple_union: - * writer_lookup_dict = {avro_to_py[get_type(lookup_schema(schema))]: (idx, get_writer(schema)) for idx, schema in enumerate(union_schema)} # <<<<<<<<<<<<<< - * - * create_promotions_for_union(writer_lookup_dict) + /* "spavro/fast_binary.pyx":591 + * # allow strings to be used for byte data, if there's no string type + * if bytes in writer_lookup_dict and str not in writer_lookup_dict: + * writer_lookup_dict[str] = writer_lookup_dict[bytes][0], lambda output_buffer, val: writer_lookup_dict[bytes][1](output_buffer, val.encode('utf-8')) # <<<<<<<<<<<<<< + * if bytes in writer_lookup_dict and unicode not in writer_lookup_dict: + * writer_lookup_dict[unicode] = writer_lookup_dict[bytes][0], lambda output_buffer, val: writer_lookup_dict[bytes][1](output_buffer, val.encode('utf-8')) */ - { /* enter inner scope */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 498, __pyx_L11_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = 0; - if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_union_schema)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_union_schema)) { - __pyx_t_1 = __pyx_cur_scope->__pyx_v_union_schema; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_union_schema); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 498, __pyx_L11_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 498, __pyx_L11_error) - } - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 498, __pyx_L11_error) - #else - __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 498, __pyx_L11_error) - __Pyx_GOTREF(__pyx_t_6); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 498, __pyx_L11_error) - #else - __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 498, __pyx_L11_error) - __Pyx_GOTREF(__pyx_t_6); - #endif - } - } else { - __pyx_t_6 = __pyx_t_4(__pyx_t_1); - if (unlikely(!__pyx_t_6)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 498, __pyx_L11_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_6); - } - __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_schema, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_8genexpr1__pyx_v_idx = __pyx_t_10; - __pyx_t_10 = (__pyx_t_10 + 1); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_avro_to_py); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 498, __pyx_L11_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_lookup_schema); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 498, __pyx_L11_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_11 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_11)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_11); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - __pyx_t_5 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_11, __pyx_8genexpr1__pyx_v_schema) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_8genexpr1__pyx_v_schema); - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 498, __pyx_L11_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __pyx_f_6spavro_11fast_binary_get_type(__pyx_t_5, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 498, __pyx_L11_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 498, __pyx_L11_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_8genexpr1__pyx_v_idx); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 498, __pyx_L11_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_get_writer); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 498, __pyx_L11_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_12 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_11, function); - } - } - __pyx_t_6 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_8genexpr1__pyx_v_schema) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_8genexpr1__pyx_v_schema); - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 498, __pyx_L11_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 498, __pyx_L11_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_6); - __pyx_t_7 = 0; - __pyx_t_6 = 0; - if (unlikely(PyDict_SetItem(__pyx_t_2, (PyObject*)__pyx_t_5, (PyObject*)__pyx_t_11))) __PYX_ERR(0, 498, __pyx_L11_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_schema); __pyx_8genexpr1__pyx_v_schema = 0; - goto __pyx_L14_exit_scope; - __pyx_L11_error:; - __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_schema); __pyx_8genexpr1__pyx_v_schema = 0; - goto __pyx_L1_error; - __pyx_L14_exit_scope:; - } /* exit inner scope */ - __Pyx_GIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_v_writer_lookup_dict = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; + if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 591, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, ((PyObject *)(&PyBytes_Type))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_27create_promotions_for_union_lambda14, 0, __pyx_n_s_create_promotions_for_union_loca, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3); + __pyx_t_5 = 0; + __pyx_t_3 = 0; + if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 591, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, ((PyObject *)(&PyString_Type)), __pyx_t_6) < 0)) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "spavro/fast_binary.pyx":500 - * writer_lookup_dict = {avro_to_py[get_type(lookup_schema(schema))]: (idx, get_writer(schema)) for idx, schema in enumerate(union_schema)} - * - * create_promotions_for_union(writer_lookup_dict) # <<<<<<<<<<<<<< + /* "spavro/fast_binary.pyx":590 + * writer_lookup_dict[int] = writer_lookup_dict[float] + * # allow strings to be used for byte data, if there's no string type + * if bytes in writer_lookup_dict and str not in writer_lookup_dict: # <<<<<<<<<<<<<< + * writer_lookup_dict[str] = writer_lookup_dict[bytes][0], lambda output_buffer, val: writer_lookup_dict[bytes][1](output_buffer, val.encode('utf-8')) + * if bytes in writer_lookup_dict and unicode not in writer_lookup_dict: + */ + } + + /* "spavro/fast_binary.pyx":592 + * if bytes in writer_lookup_dict and str not in writer_lookup_dict: + * writer_lookup_dict[str] = writer_lookup_dict[bytes][0], lambda output_buffer, val: writer_lookup_dict[bytes][1](output_buffer, val.encode('utf-8')) + * if bytes in writer_lookup_dict and unicode not in writer_lookup_dict: # <<<<<<<<<<<<<< + * writer_lookup_dict[unicode] = writer_lookup_dict[bytes][0], lambda output_buffer, val: writer_lookup_dict[bytes][1](output_buffer, val.encode('utf-8')) * - * # warning, this will fail if there's both a long and int in a union */ - __pyx_t_2 = __pyx_cur_scope->__pyx_v_writer_lookup_dict; - __Pyx_INCREF(__pyx_t_2); - __pyx_f_6spavro_11fast_binary_create_promotions_for_union(((PyObject*)__pyx_t_2)); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(0, 592, __pyx_L1_error) + } + __pyx_t_2 = (__Pyx_PyDict_ContainsTF(((PyObject *)(&PyBytes_Type)), __pyx_cur_scope->__pyx_v_writer_lookup_dict, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 592, __pyx_L1_error) + __pyx_t_4 = (__pyx_t_2 != 0); + if (__pyx_t_4) { + } else { + __pyx_t_1 = __pyx_t_4; + goto __pyx_L12_bool_binop_done; + } + if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(0, 592, __pyx_L1_error) + } + __pyx_t_4 = (__Pyx_PyDict_ContainsTF(((PyObject *)(&PyUnicode_Type)), __pyx_cur_scope->__pyx_v_writer_lookup_dict, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 592, __pyx_L1_error) + __pyx_t_2 = (__pyx_t_4 != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L12_bool_binop_done:; + if (__pyx_t_1) { - /* "spavro/fast_binary.pyx":505 - * # or a float and a double in a union (which is valid but nonsensical - * # in python but valid in avro) - * def simple_writer_lookup(datum): # <<<<<<<<<<<<<< - * try: - * return writer_lookup_dict[type(datum)] + /* "spavro/fast_binary.pyx":593 + * writer_lookup_dict[str] = writer_lookup_dict[bytes][0], lambda output_buffer, val: writer_lookup_dict[bytes][1](output_buffer, val.encode('utf-8')) + * if bytes in writer_lookup_dict and unicode not in writer_lookup_dict: + * writer_lookup_dict[unicode] = writer_lookup_dict[bytes][0], lambda output_buffer, val: writer_lookup_dict[bytes][1](output_buffer, val.encode('utf-8')) # <<<<<<<<<<<<<< + * + * */ - __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17make_union_writer_1simple_writer_lookup, 0, __pyx_n_s_make_union_writer_locals_simple, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__33)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 505, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_simple_writer_lookup = __pyx_t_2; - __pyx_t_2 = 0; + if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 593, __pyx_L1_error) + } + __pyx_t_6 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, ((PyObject *)(&PyBytes_Type))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 593, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_6, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 593, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_27create_promotions_for_union_1lambda15, 0, __pyx_n_s_create_promotions_for_union_loca, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 593, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 593, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); + __pyx_t_3 = 0; + __pyx_t_6 = 0; + if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 593, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, ((PyObject *)(&PyUnicode_Type)), __pyx_t_5) < 0)) __PYX_ERR(0, 593, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "spavro/fast_binary.pyx":511 - * raise TypeError("{} - Invalid type ({}) in union. Schema: {}".format(repr(datum), type(datum), union_schema)) + /* "spavro/fast_binary.pyx":592 + * if bytes in writer_lookup_dict and str not in writer_lookup_dict: + * writer_lookup_dict[str] = writer_lookup_dict[bytes][0], lambda output_buffer, val: writer_lookup_dict[bytes][1](output_buffer, val.encode('utf-8')) + * if bytes in writer_lookup_dict and unicode not in writer_lookup_dict: # <<<<<<<<<<<<<< + * writer_lookup_dict[unicode] = writer_lookup_dict[bytes][0], lambda output_buffer, val: writer_lookup_dict[bytes][1](output_buffer, val.encode('utf-8')) * - * writer_lookup = simple_writer_lookup # <<<<<<<<<<<<<< - * else: - * writer_lookup_dict = {} */ - __Pyx_INCREF(__pyx_v_simple_writer_lookup); - __Pyx_GIVEREF(__pyx_v_simple_writer_lookup); - __pyx_cur_scope->__pyx_v_writer_lookup = __pyx_v_simple_writer_lookup; + } - /* "spavro/fast_binary.pyx":497 - * len(set(type_list) & set(['record', 'map'])) > 1) + /* "spavro/fast_binary.pyx":576 * - * if simple_union: # <<<<<<<<<<<<<< - * writer_lookup_dict = {avro_to_py[get_type(lookup_schema(schema))]: (idx, get_writer(schema)) for idx, schema in enumerate(union_schema)} * + * cdef void create_promotions_for_union(dict writer_lookup_dict): # <<<<<<<<<<<<<< + * '''Take the writer lookup for a union and create some aliases and promotion + * cases, and store those back into the writer lookup.''' */ - goto __pyx_L8; - } - /* "spavro/fast_binary.pyx":513 - * writer_lookup = simple_writer_lookup - * else: - * writer_lookup_dict = {} # <<<<<<<<<<<<<< - * for idx, schema in enumerate(union_schema): - * python_type = avro_to_py[get_type(lookup_schema(schema))] + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_WriteUnraisable("spavro.fast_binary.create_promotions_for_union", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_RefNannyFinishContext(); +} + +/* "spavro/fast_binary.pyx":596 + * + * + * def make_union_writer(union_schema): # <<<<<<<<<<<<<< + * cdef list type_list = [get_type(lookup_schema(schema)) for schema in union_schema] + * # cdef dict writer_lookup */ - /*else*/ { - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 513, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_v_writer_lookup_dict = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":514 - * else: - * writer_lookup_dict = {} - * for idx, schema in enumerate(union_schema): # <<<<<<<<<<<<<< - * python_type = avro_to_py[get_type(lookup_schema(schema))] - * # TODO: if fixed and bytes are in the schema then we should check fixed before bytes +/* Python wrapper */ +static PyObject *__pyx_pw_6spavro_11fast_binary_67make_union_writer(PyObject *__pyx_self, PyObject *__pyx_v_union_schema); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_67make_union_writer = {"make_union_writer", (PyCFunction)__pyx_pw_6spavro_11fast_binary_67make_union_writer, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_67make_union_writer(PyObject *__pyx_self, PyObject *__pyx_v_union_schema) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("make_union_writer (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_66make_union_writer(__pyx_self, ((PyObject *)__pyx_v_union_schema)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spavro/fast_binary.pyx":624 + * # or a float and a double in a union (which is valid but nonsensical + * # in python but valid in avro) + * def simple_writer_lookup(datum): # <<<<<<<<<<<<<< + * try: + * return writer_lookup_dict[type(datum)] */ - __pyx_t_10 = 0; - if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_union_schema)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_union_schema)) { - __pyx_t_2 = __pyx_cur_scope->__pyx_v_union_schema; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_union_schema); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 514, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 514, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 514, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_4(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 514, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v_schema, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_v_idx = __pyx_t_10; - __pyx_t_10 = (__pyx_t_10 + 1); - /* "spavro/fast_binary.pyx":515 - * writer_lookup_dict = {} - * for idx, schema in enumerate(union_schema): - * python_type = avro_to_py[get_type(lookup_schema(schema))] # <<<<<<<<<<<<<< - * # TODO: if fixed and bytes are in the schema then we should check fixed before bytes - * # I think, since that's more efficient space wise? - */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_avro_to_py); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 515, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_lookup_schema); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 515, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_11 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_schema) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_schema); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 515, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __pyx_f_6spavro_11fast_binary_get_type(__pyx_t_11, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 515, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 515, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF_SET(__pyx_v_python_type, __pyx_t_11); - __pyx_t_11 = 0; +/* Python wrapper */ +static PyObject *__pyx_pw_6spavro_11fast_binary_17make_union_writer_1simple_writer_lookup(PyObject *__pyx_self, PyObject *__pyx_v_datum); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17make_union_writer_1simple_writer_lookup = {"simple_writer_lookup", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17make_union_writer_1simple_writer_lookup, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17make_union_writer_1simple_writer_lookup(PyObject *__pyx_self, PyObject *__pyx_v_datum) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("simple_writer_lookup (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_17make_union_writer_simple_writer_lookup(__pyx_self, ((PyObject *)__pyx_v_datum)); - /* "spavro/fast_binary.pyx":518 - * # TODO: if fixed and bytes are in the schema then we should check fixed before bytes - * # I think, since that's more efficient space wise? - * if python_type in writer_lookup_dict: # <<<<<<<<<<<<<< - * writer_lookup_dict[python_type] = writer_lookup_dict[python_type] + [(idx, get_check(schema), get_writer(schema))] - * else: - */ - __pyx_t_8 = (__Pyx_PyDict_ContainsTF(__pyx_v_python_type, __pyx_cur_scope->__pyx_v_writer_lookup_dict, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 518, __pyx_L1_error) - __pyx_t_9 = (__pyx_t_8 != 0); - if (__pyx_t_9) { + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "spavro/fast_binary.pyx":519 - * # I think, since that's more efficient space wise? - * if python_type in writer_lookup_dict: - * writer_lookup_dict[python_type] = writer_lookup_dict[python_type] + [(idx, get_check(schema), get_writer(schema))] # <<<<<<<<<<<<<< - * else: - * writer_lookup_dict[python_type] = [(idx, get_check(schema), get_writer(schema))] - */ - __pyx_t_11 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, __pyx_v_python_type); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 519, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 519, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_get_check); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 519, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_schema) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_schema); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 519, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_get_writer); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 519, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_12 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - __pyx_t_6 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_12, __pyx_v_schema) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_schema); - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 519, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 519, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_6); - __pyx_t_5 = 0; - __pyx_t_1 = 0; - __pyx_t_6 = 0; - __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 519, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyList_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_7 = PyNumber_Add(__pyx_t_11, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 519, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, __pyx_v_python_type, __pyx_t_7) < 0)) __PYX_ERR(0, 519, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; +static PyObject *__pyx_pf_6spavro_11fast_binary_17make_union_writer_simple_writer_lookup(PyObject *__pyx_self, PyObject *__pyx_v_datum) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *__pyx_cur_scope; + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("simple_writer_lookup", 0); + __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; - /* "spavro/fast_binary.pyx":518 - * # TODO: if fixed and bytes are in the schema then we should check fixed before bytes - * # I think, since that's more efficient space wise? - * if python_type in writer_lookup_dict: # <<<<<<<<<<<<<< - * writer_lookup_dict[python_type] = writer_lookup_dict[python_type] + [(idx, get_check(schema), get_writer(schema))] - * else: + /* "spavro/fast_binary.pyx":625 + * # in python but valid in avro) + * def simple_writer_lookup(datum): + * try: # <<<<<<<<<<<<<< + * return writer_lookup_dict[type(datum)] + * except KeyError: */ - goto __pyx_L17; - } + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { - /* "spavro/fast_binary.pyx":521 - * writer_lookup_dict[python_type] = writer_lookup_dict[python_type] + [(idx, get_check(schema), get_writer(schema))] - * else: - * writer_lookup_dict[python_type] = [(idx, get_check(schema), get_writer(schema))] # <<<<<<<<<<<<<< - * - * create_promotions_for_union(writer_lookup_dict) + /* "spavro/fast_binary.pyx":626 + * def simple_writer_lookup(datum): + * try: + * return writer_lookup_dict[type(datum)] # <<<<<<<<<<<<<< + * except KeyError: + * raise TypeError("{} - Invalid type ({}) in union. Schema: {}".format(repr(datum), type(datum), union_schema)) */ - /*else*/ { - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_idx); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 521, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_get_check); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 521, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_11); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_11, function); - } - } - __pyx_t_6 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_1, __pyx_v_schema) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_v_schema); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 521, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_get_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 521, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_11 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_v_schema) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_schema); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 521, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 521, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_11); - __pyx_t_7 = 0; - __pyx_t_6 = 0; - __pyx_t_11 = 0; - __pyx_t_11 = PyList_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 521, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_GIVEREF(__pyx_t_1); - PyList_SET_ITEM(__pyx_t_11, 0, __pyx_t_1); - __pyx_t_1 = 0; - if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, __pyx_v_python_type, __pyx_t_11) < 0)) __PYX_ERR(0, 521, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_writer_lookup_dict)) { __Pyx_RaiseClosureNameError("writer_lookup_dict"); __PYX_ERR(0, 626, __pyx_L3_error) } + if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 626, __pyx_L3_error) } - __pyx_L17:; + __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, ((PyObject *)Py_TYPE(__pyx_v_datum))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 626, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L7_try_return; - /* "spavro/fast_binary.pyx":514 - * else: - * writer_lookup_dict = {} - * for idx, schema in enumerate(union_schema): # <<<<<<<<<<<<<< - * python_type = avro_to_py[get_type(lookup_schema(schema))] - * # TODO: if fixed and bytes are in the schema then we should check fixed before bytes + /* "spavro/fast_binary.pyx":625 + * # in python but valid in avro) + * def simple_writer_lookup(datum): + * try: # <<<<<<<<<<<<<< + * return writer_lookup_dict[type(datum)] + * except KeyError: */ } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_L3_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "spavro/fast_binary.pyx":523 - * writer_lookup_dict[python_type] = [(idx, get_check(schema), get_writer(schema))] - * - * create_promotions_for_union(writer_lookup_dict) # <<<<<<<<<<<<<< - * # if int in writer_lookup_dict: - * # writer_lookup_dict[long] = writer_lookup_dict[int] - */ - __pyx_t_2 = __pyx_cur_scope->__pyx_v_writer_lookup_dict; - __Pyx_INCREF(__pyx_t_2); - __pyx_f_6spavro_11fast_binary_create_promotions_for_union(((PyObject*)__pyx_t_2)); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "spavro/fast_binary.pyx":534 - * - * - * def complex_writer_lookup(datum): # <<<<<<<<<<<<<< - * cdef: - * long idx - */ - __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17make_union_writer_3complex_writer_lookup, 0, __pyx_n_s_make_union_writer_locals_complex, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__35)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 534, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_complex_writer_lookup = __pyx_t_2; - __pyx_t_2 = 0; - - /* "spavro/fast_binary.pyx":552 - * return idx, writer - * - * writer_lookup = complex_writer_lookup # <<<<<<<<<<<<<< - * - * def write_union(outbuf, datum): - */ - __Pyx_INCREF(__pyx_v_complex_writer_lookup); - __Pyx_GIVEREF(__pyx_v_complex_writer_lookup); - __pyx_cur_scope->__pyx_v_writer_lookup = __pyx_v_complex_writer_lookup; - } - __pyx_L8:; - - /* "spavro/fast_binary.pyx":554 - * writer_lookup = complex_writer_lookup + /* "spavro/fast_binary.pyx":627 + * try: + * return writer_lookup_dict[type(datum)] + * except KeyError: # <<<<<<<<<<<<<< + * raise TypeError("{} - Invalid type ({}) in union. Schema: {}".format(repr(datum), type(datum), union_schema)) * - * def write_union(outbuf, datum): # <<<<<<<<<<<<<< - * idx, data_writer = writer_lookup(datum) - * write_long(outbuf, idx) */ - __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17make_union_writer_5write_union, 0, __pyx_n_s_make_union_writer_locals_write_u, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__37)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 554, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_write_union = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError); + if (__pyx_t_5) { + __Pyx_AddTraceback("spavro.fast_binary.make_union_writer.simple_writer_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 627, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_7); - /* "spavro/fast_binary.pyx":558 - * write_long(outbuf, idx) - * data_writer(outbuf, datum) - * write_union.__reduce__ = lambda: (make_union_writer, (union_schema,)) # <<<<<<<<<<<<<< - * return write_union + /* "spavro/fast_binary.pyx":628 + * return writer_lookup_dict[type(datum)] + * except KeyError: + * raise TypeError("{} - Invalid type ({}) in union. Schema: {}".format(repr(datum), type(datum), union_schema)) # <<<<<<<<<<<<<< * + * writer_lookup = simple_writer_lookup */ - __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17make_union_writer_6lambda16, 0, __pyx_n_s_make_union_writer_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 558, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_write_union, __pyx_n_s_reduce, __pyx_t_2) < 0) __PYX_ERR(0, 558, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Invalid_type_in_union_Schema, __pyx_n_s_format); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 628, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = PyObject_Repr(__pyx_v_datum); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 628, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_10); + if (unlikely(!__pyx_cur_scope->__pyx_v_union_schema)) { __Pyx_RaiseClosureNameError("union_schema"); __PYX_ERR(0, 628, __pyx_L5_except_error) } + __pyx_t_11 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_11)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_11); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_5 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_9)) { + PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_t_10, ((PyObject *)Py_TYPE(__pyx_v_datum)), __pyx_cur_scope->__pyx_v_union_schema}; + __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 628, __pyx_L5_except_error) + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { + PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_t_10, ((PyObject *)Py_TYPE(__pyx_v_datum)), __pyx_cur_scope->__pyx_v_union_schema}; + __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 628, __pyx_L5_except_error) + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } else + #endif + { + __pyx_t_12 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 628, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_12); + if (__pyx_t_11) { + __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11); __pyx_t_11 = NULL; + } + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_5, __pyx_t_10); + __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_datum))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_datum))); + PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_5, ((PyObject *)Py_TYPE(__pyx_v_datum))); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_union_schema); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_union_schema); + PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_5, __pyx_cur_scope->__pyx_v_union_schema); + __pyx_t_10 = 0; + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_12, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 628, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 628, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_Raise(__pyx_t_9, 0, 0, 0); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __PYX_ERR(0, 628, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + __pyx_L5_except_error:; - /* "spavro/fast_binary.pyx":559 - * data_writer(outbuf, datum) - * write_union.__reduce__ = lambda: (make_union_writer, (union_schema,)) - * return write_union # <<<<<<<<<<<<<< - * - * def make_enum_writer(schema): + /* "spavro/fast_binary.pyx":625 + * # in python but valid in avro) + * def simple_writer_lookup(datum): + * try: # <<<<<<<<<<<<<< + * return writer_lookup_dict[type(datum)] + * except KeyError: */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_write_union); - __pyx_r = __pyx_v_write_union; - goto __pyx_L0; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L7_try_return:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L0; + } - /* "spavro/fast_binary.pyx":477 - * - * - * def make_union_writer(union_schema): # <<<<<<<<<<<<<< - * cdef list type_list = [get_type(lookup_schema(schema)) for schema in union_schema] - * # cdef dict writer_lookup + /* "spavro/fast_binary.pyx":624 + * # or a float and a double in a union (which is valid but nonsensical + * # in python but valid in avro) + * def simple_writer_lookup(datum): # <<<<<<<<<<<<<< + * try: + * return writer_lookup_dict[type(datum)] */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __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); __Pyx_XDECREF(__pyx_t_12); - __Pyx_AddTraceback("spavro.fast_binary.make_union_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.make_union_writer.simple_writer_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_type_list); - __Pyx_XDECREF(__pyx_v_simple_writer_lookup); - __Pyx_XDECREF(__pyx_v_schema); - __Pyx_XDECREF(__pyx_v_python_type); - __Pyx_XDECREF(__pyx_v_complex_writer_lookup); - __Pyx_XDECREF(__pyx_v_write_union); - __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_schema); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":561 - * return write_union +/* "spavro/fast_binary.pyx":653 * - * def make_enum_writer(schema): # <<<<<<<<<<<<<< - * cdef list symbols = schema['symbols'] - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_69make_enum_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_69make_enum_writer = {"make_enum_writer", (PyCFunction)__pyx_pw_6spavro_11fast_binary_69make_enum_writer, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_69make_enum_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("make_enum_writer (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_68make_enum_writer(__pyx_self, ((PyObject *)__pyx_v_schema)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "spavro/fast_binary.pyx":565 * - * # the datum can be str or unicode? - * def write_enum(outbuf, basestring datum): # <<<<<<<<<<<<<< - * cdef int enum_index = symbols.index(datum) - * write_int(outbuf, enum_index) + * def complex_writer_lookup(datum): # <<<<<<<<<<<<<< + * cdef: + * long idx */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_16make_enum_writer_1write_enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_16make_enum_writer_1write_enum = {"write_enum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_16make_enum_writer_1write_enum, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_16make_enum_writer_1write_enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_outbuf = 0; - PyObject *__pyx_v_datum = 0; +static PyObject *__pyx_pw_6spavro_11fast_binary_17make_union_writer_3complex_writer_lookup(PyObject *__pyx_self, PyObject *__pyx_v_datum); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17make_union_writer_3complex_writer_lookup = {"complex_writer_lookup", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17make_union_writer_3complex_writer_lookup, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17make_union_writer_3complex_writer_lookup(PyObject *__pyx_self, PyObject *__pyx_v_datum) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write_enum (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_outbuf,&__pyx_n_s_datum,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outbuf)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_datum)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("write_enum", 1, 2, 2, 1); __PYX_ERR(0, 565, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write_enum") < 0)) __PYX_ERR(0, 565, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_outbuf = values[0]; - __pyx_v_datum = ((PyObject*)values[1]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("write_enum", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 565, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("spavro.fast_binary.make_enum_writer.write_enum", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_datum), (&PyBaseString_Type), 1, "datum", 1))) __PYX_ERR(0, 565, __pyx_L1_error) - __pyx_r = __pyx_pf_6spavro_11fast_binary_16make_enum_writer_write_enum(__pyx_self, __pyx_v_outbuf, __pyx_v_datum); + __Pyx_RefNannySetupContext("complex_writer_lookup (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_17make_union_writer_2complex_writer_lookup(__pyx_self, ((PyObject *)__pyx_v_datum)); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_16make_enum_writer_write_enum(PyObject *__pyx_self, PyObject *__pyx_v_outbuf, PyObject *__pyx_v_datum) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer *__pyx_cur_scope; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer *__pyx_outer_scope; - int __pyx_v_enum_index; +static PyObject *__pyx_pf_6spavro_11fast_binary_17make_union_writer_2complex_writer_lookup(PyObject *__pyx_self, PyObject *__pyx_v_datum) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *__pyx_cur_scope; + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *__pyx_outer_scope; + long __pyx_v_idx; + PyObject *__pyx_v_lookup_result = 0; + PyObject *__pyx_v_get_check = NULL; + PyObject *__pyx_v_writer = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - __Pyx_RefNannySetupContext("write_enum", 0); - __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer *) __Pyx_CyFunction_GetClosure(__pyx_self); + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + Py_ssize_t __pyx_t_13; + int __pyx_t_14; + PyObject *(*__pyx_t_15)(PyObject *); + long __pyx_t_16; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("complex_writer_lookup", 0); + __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *) __Pyx_CyFunction_GetClosure(__pyx_self); __pyx_cur_scope = __pyx_outer_scope; - /* "spavro/fast_binary.pyx":566 - * # the datum can be str or unicode? - * def write_enum(outbuf, basestring datum): - * cdef int enum_index = symbols.index(datum) # <<<<<<<<<<<<<< - * write_int(outbuf, enum_index) - * write_enum.__reduce__ = lambda: (make_enum_writer, (schema,)) - */ - if (unlikely(!__pyx_cur_scope->__pyx_v_symbols)) { __Pyx_RaiseClosureNameError("symbols"); __PYX_ERR(0, 566, __pyx_L1_error) } - __pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyList_Type_index, __pyx_cur_scope->__pyx_v_symbols, __pyx_v_datum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 566, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 566, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_enum_index = __pyx_t_2; - - /* "spavro/fast_binary.pyx":567 - * def write_enum(outbuf, basestring datum): - * cdef int enum_index = symbols.index(datum) - * write_int(outbuf, enum_index) # <<<<<<<<<<<<<< - * write_enum.__reduce__ = lambda: (make_enum_writer, (schema,)) - * return write_enum + /* "spavro/fast_binary.pyx":657 + * long idx + * list lookup_result + * try: # <<<<<<<<<<<<<< + * lookup_result = writer_lookup_dict[type(datum)] + * except KeyError: */ - __pyx_f_6spavro_11fast_binary_write_int(__pyx_v_outbuf, __pyx_v_enum_index); - - /* "spavro/fast_binary.pyx":565 - * - * # the datum can be str or unicode? - * def write_enum(outbuf, basestring datum): # <<<<<<<<<<<<<< - * cdef int enum_index = symbols.index(datum) - * write_int(outbuf, enum_index) - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("spavro.fast_binary.make_enum_writer.write_enum", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "spavro/fast_binary.pyx":568 - * cdef int enum_index = symbols.index(datum) - * write_int(outbuf, enum_index) - * write_enum.__reduce__ = lambda: (make_enum_writer, (schema,)) # <<<<<<<<<<<<<< - * return write_enum - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_16make_enum_writer_2lambda17(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_16make_enum_writer_2lambda17 = {"lambda17", (PyCFunction)__pyx_pw_6spavro_11fast_binary_16make_enum_writer_2lambda17, METH_NOARGS, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_16make_enum_writer_2lambda17(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("lambda17 (wrapper)", 0); - __pyx_r = __pyx_lambda_funcdef_lambda17(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_lambda_funcdef_lambda17(PyObject *__pyx_self) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer *__pyx_cur_scope; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer *__pyx_outer_scope; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("lambda17", 0); - __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_enum_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 568, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(!__pyx_cur_scope->__pyx_v_schema)) { __Pyx_RaiseClosureNameError("schema"); __PYX_ERR(0, 568, __pyx_L1_error) } - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 568, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_schema); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 568, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("spavro.fast_binary.make_enum_writer.lambda17", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { -/* "spavro/fast_binary.pyx":561 - * return write_union - * - * def make_enum_writer(schema): # <<<<<<<<<<<<<< - * cdef list symbols = schema['symbols'] - * + /* "spavro/fast_binary.pyx":658 + * list lookup_result + * try: + * lookup_result = writer_lookup_dict[type(datum)] # <<<<<<<<<<<<<< + * except KeyError: + * raise TypeError("{} - Invalid type ({}) in union. Schema: {}".format(repr(datum), type(datum), union_schema)) */ + if (unlikely(!__pyx_cur_scope->__pyx_v_writer_lookup_dict)) { __Pyx_RaiseClosureNameError("writer_lookup_dict"); __PYX_ERR(0, 658, __pyx_L3_error) } + if (unlikely(__pyx_cur_scope->__pyx_v_writer_lookup_dict == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 658, __pyx_L3_error) + } + __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, ((PyObject *)Py_TYPE(__pyx_v_datum))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 658, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_4); + if (!(likely(PyList_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 658, __pyx_L3_error) + __pyx_v_lookup_result = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; -static PyObject *__pyx_pf_6spavro_11fast_binary_68make_enum_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer *__pyx_cur_scope; - PyObject *__pyx_v_write_enum = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("make_enum_writer", 0); - __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(0, 561, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } - __pyx_cur_scope->__pyx_v_schema = __pyx_v_schema; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); - - /* "spavro/fast_binary.pyx":562 - * - * def make_enum_writer(schema): - * cdef list symbols = schema['symbols'] # <<<<<<<<<<<<<< - * - * # the datum can be str or unicode? + /* "spavro/fast_binary.pyx":657 + * long idx + * list lookup_result + * try: # <<<<<<<<<<<<<< + * lookup_result = writer_lookup_dict[type(datum)] + * except KeyError: */ - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_schema, __pyx_n_s_symbols); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 562, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 562, __pyx_L1_error) - __Pyx_GIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_v_symbols = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "spavro/fast_binary.pyx":565 - * - * # the datum can be str or unicode? - * def write_enum(outbuf, basestring datum): # <<<<<<<<<<<<<< - * cdef int enum_index = symbols.index(datum) - * write_int(outbuf, enum_index) + /* "spavro/fast_binary.pyx":659 + * try: + * lookup_result = writer_lookup_dict[type(datum)] + * except KeyError: # <<<<<<<<<<<<<< + * raise TypeError("{} - Invalid type ({}) in union. Schema: {}".format(repr(datum), type(datum), union_schema)) + * if len(lookup_result) == 1: */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_16make_enum_writer_1write_enum, 0, __pyx_n_s_make_enum_writer_locals_write_en, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__39)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 565, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_write_enum = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError); + if (__pyx_t_5) { + __Pyx_AddTraceback("spavro.fast_binary.make_union_writer.complex_writer_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 659, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_7); - /* "spavro/fast_binary.pyx":568 - * cdef int enum_index = symbols.index(datum) - * write_int(outbuf, enum_index) - * write_enum.__reduce__ = lambda: (make_enum_writer, (schema,)) # <<<<<<<<<<<<<< - * return write_enum - * + /* "spavro/fast_binary.pyx":660 + * lookup_result = writer_lookup_dict[type(datum)] + * except KeyError: + * raise TypeError("{} - Invalid type ({}) in union. Schema: {}".format(repr(datum), type(datum), union_schema)) # <<<<<<<<<<<<<< + * if len(lookup_result) == 1: + * idx, get_check, writer = lookup_result[0] */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_16make_enum_writer_2lambda17, 0, __pyx_n_s_make_enum_writer_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 568, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_write_enum, __pyx_n_s_reduce, __pyx_t_1) < 0) __PYX_ERR(0, 568, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Invalid_type_in_union_Schema, __pyx_n_s_format); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 660, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = PyObject_Repr(__pyx_v_datum); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 660, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_10); + if (unlikely(!__pyx_cur_scope->__pyx_v_union_schema)) { __Pyx_RaiseClosureNameError("union_schema"); __PYX_ERR(0, 660, __pyx_L5_except_error) } + __pyx_t_11 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_11)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_11); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_5 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_9)) { + PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_t_10, ((PyObject *)Py_TYPE(__pyx_v_datum)), __pyx_cur_scope->__pyx_v_union_schema}; + __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 660, __pyx_L5_except_error) + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { + PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_t_10, ((PyObject *)Py_TYPE(__pyx_v_datum)), __pyx_cur_scope->__pyx_v_union_schema}; + __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 660, __pyx_L5_except_error) + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } else + #endif + { + __pyx_t_12 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 660, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_12); + if (__pyx_t_11) { + __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11); __pyx_t_11 = NULL; + } + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_5, __pyx_t_10); + __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_datum))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_datum))); + PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_5, ((PyObject *)Py_TYPE(__pyx_v_datum))); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_union_schema); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_union_schema); + PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_5, __pyx_cur_scope->__pyx_v_union_schema); + __pyx_t_10 = 0; + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_12, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 660, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 660, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_Raise(__pyx_t_9, 0, 0, 0); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __PYX_ERR(0, 660, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + __pyx_L5_except_error:; - /* "spavro/fast_binary.pyx":569 - * write_int(outbuf, enum_index) - * write_enum.__reduce__ = lambda: (make_enum_writer, (schema,)) - * return write_enum # <<<<<<<<<<<<<< - * - * + /* "spavro/fast_binary.pyx":657 + * long idx + * list lookup_result + * try: # <<<<<<<<<<<<<< + * lookup_result = writer_lookup_dict[type(datum)] + * except KeyError: */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_write_enum); - __pyx_r = __pyx_v_write_enum; - goto __pyx_L0; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; + } - /* "spavro/fast_binary.pyx":561 - * return write_union - * - * def make_enum_writer(schema): # <<<<<<<<<<<<<< - * cdef list symbols = schema['symbols'] - * + /* "spavro/fast_binary.pyx":661 + * except KeyError: + * raise TypeError("{} - Invalid type ({}) in union. Schema: {}".format(repr(datum), type(datum), union_schema)) + * if len(lookup_result) == 1: # <<<<<<<<<<<<<< + * idx, get_check, writer = lookup_result[0] + * else: */ + if (unlikely(__pyx_v_lookup_result == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 661, __pyx_L1_error) + } + __pyx_t_13 = PyList_GET_SIZE(__pyx_v_lookup_result); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 661, __pyx_L1_error) + __pyx_t_14 = ((__pyx_t_13 == 1) != 0); + if (__pyx_t_14) { - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("spavro.fast_binary.make_enum_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_write_enum); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "spavro/fast_binary.pyx":572 - * - * - * def make_record_writer(schema): # <<<<<<<<<<<<<< - * cdef list fields = [WriteField(field['name'], get_writer(field['type'])) for field in schema['fields']] - * + /* "spavro/fast_binary.pyx":662 + * raise TypeError("{} - Invalid type ({}) in union. Schema: {}".format(repr(datum), type(datum), union_schema)) + * if len(lookup_result) == 1: + * idx, get_check, writer = lookup_result[0] # <<<<<<<<<<<<<< + * else: + * for idx, get_check, writer in lookup_result: */ - -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_71make_record_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_71make_record_writer = {"make_record_writer", (PyCFunction)__pyx_pw_6spavro_11fast_binary_71make_record_writer, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_71make_record_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("make_record_writer (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_70make_record_writer(__pyx_self, ((PyObject *)__pyx_v_schema)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "spavro/fast_binary.pyx":575 - * cdef list fields = [WriteField(field['name'], get_writer(field['type'])) for field in schema['fields']] - * - * def write_record(outbuf, datum): # <<<<<<<<<<<<<< - * for field in fields: - * try: - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_18make_record_writer_1write_record(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_18make_record_writer_1write_record = {"write_record", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_18make_record_writer_1write_record, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_18make_record_writer_1write_record(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_outbuf = 0; - PyObject *__pyx_v_datum = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write_record (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_outbuf,&__pyx_n_s_datum,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outbuf)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_datum)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("write_record", 1, 2, 2, 1); __PYX_ERR(0, 575, __pyx_L3_error) - } + if (unlikely(__pyx_v_lookup_result == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 662, __pyx_L1_error) + } + __pyx_t_7 = __Pyx_GetItemInt_List(__pyx_v_lookup_result, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 662, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) { + PyObject* sequence = __pyx_t_7; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 3)) { + if (size > 3) __Pyx_RaiseTooManyValuesError(3); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 662, __pyx_L1_error) } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write_record") < 0)) __PYX_ERR(0, 575, __pyx_L3_error) + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); + } else { + __pyx_t_6 = PyList_GET_ITEM(sequence, 0); + __pyx_t_4 = PyList_GET_ITEM(sequence, 1); + __pyx_t_9 = PyList_GET_ITEM(sequence, 2); } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_9); + #else + __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 662, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 662, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 662, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + #endif + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + Py_ssize_t index = -1; + __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 662, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_15 = Py_TYPE(__pyx_t_8)->tp_iternext; + index = 0; __pyx_t_6 = __pyx_t_15(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L12_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + index = 1; __pyx_t_4 = __pyx_t_15(__pyx_t_8); if (unlikely(!__pyx_t_4)) goto __pyx_L12_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + index = 2; __pyx_t_9 = __pyx_t_15(__pyx_t_8); if (unlikely(!__pyx_t_9)) goto __pyx_L12_unpacking_failed; + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_8), 3) < 0) __PYX_ERR(0, 662, __pyx_L1_error) + __pyx_t_15 = NULL; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L13_unpacking_done; + __pyx_L12_unpacking_failed:; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_15 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 662, __pyx_L1_error) + __pyx_L13_unpacking_done:; } - __pyx_v_outbuf = values[0]; - __pyx_v_datum = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("write_record", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 575, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("spavro.fast_binary.make_record_writer.write_record", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6spavro_11fast_binary_18make_record_writer_write_record(__pyx_self, __pyx_v_outbuf, __pyx_v_datum); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_6spavro_11fast_binary_18make_record_writer_write_record(PyObject *__pyx_self, PyObject *__pyx_v_outbuf, PyObject *__pyx_v_datum) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer *__pyx_cur_scope; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer *__pyx_outer_scope; - PyObject *__pyx_v_field = NULL; - CYTHON_UNUSED PyObject *__pyx_v_e = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - int __pyx_t_12; - PyObject *__pyx_t_13 = NULL; - PyObject *__pyx_t_14 = NULL; - PyObject *__pyx_t_15 = NULL; - PyObject *__pyx_t_16 = NULL; - __Pyx_RefNannySetupContext("write_record", 0); - __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; + __pyx_t_16 = __Pyx_PyInt_As_long(__pyx_t_6); if (unlikely((__pyx_t_16 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 662, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_idx = __pyx_t_16; + __pyx_v_get_check = __pyx_t_4; + __pyx_t_4 = 0; + __pyx_v_writer = __pyx_t_9; + __pyx_t_9 = 0; - /* "spavro/fast_binary.pyx":576 - * - * def write_record(outbuf, datum): - * for field in fields: # <<<<<<<<<<<<<< - * try: - * field.writer(outbuf, datum.get(field.name)) + /* "spavro/fast_binary.pyx":661 + * except KeyError: + * raise TypeError("{} - Invalid type ({}) in union. Schema: {}".format(repr(datum), type(datum), union_schema)) + * if len(lookup_result) == 1: # <<<<<<<<<<<<<< + * idx, get_check, writer = lookup_result[0] + * else: */ - if (unlikely(!__pyx_cur_scope->__pyx_v_fields)) { __Pyx_RaiseClosureNameError("fields"); __PYX_ERR(0, 576, __pyx_L1_error) } - if (unlikely(__pyx_cur_scope->__pyx_v_fields == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 576, __pyx_L1_error) + goto __pyx_L11; } - __pyx_t_1 = __pyx_cur_scope->__pyx_v_fields; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; - for (;;) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 576, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 576, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - __Pyx_XDECREF_SET(__pyx_v_field, __pyx_t_3); - __pyx_t_3 = 0; - - /* "spavro/fast_binary.pyx":577 - * def write_record(outbuf, datum): - * for field in fields: - * try: # <<<<<<<<<<<<<< - * field.writer(outbuf, datum.get(field.name)) - * except TypeError as e: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_4); - __Pyx_XGOTREF(__pyx_t_5); - __Pyx_XGOTREF(__pyx_t_6); - /*try:*/ { - /* "spavro/fast_binary.pyx":578 - * for field in fields: - * try: - * field.writer(outbuf, datum.get(field.name)) # <<<<<<<<<<<<<< - * except TypeError as e: - * raise TypeError("Error writing record schema at fieldname: '{}', datum: '{}'".format(field.name, repr(datum.get(field.name)))) + /* "spavro/fast_binary.pyx":664 + * idx, get_check, writer = lookup_result[0] + * else: + * for idx, get_check, writer in lookup_result: # <<<<<<<<<<<<<< + * if get_check(datum): + * break */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_field, __pyx_n_s_writer); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 578, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_datum, __pyx_n_s_get); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 578, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_field, __pyx_n_s_name); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 578, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_11)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_11); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - } + /*else*/ { + if (unlikely(__pyx_v_lookup_result == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(0, 664, __pyx_L1_error) + } + __pyx_t_7 = __pyx_v_lookup_result; __Pyx_INCREF(__pyx_t_7); __pyx_t_13 = 0; + for (;;) { + if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_7)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_9 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_13); __Pyx_INCREF(__pyx_t_9); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 664, __pyx_L1_error) + #else + __pyx_t_9 = PySequence_ITEM(__pyx_t_7, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 664, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + #endif + if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) { + PyObject* sequence = __pyx_t_9; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 3)) { + if (size > 3) __Pyx_RaiseTooManyValuesError(3); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 664, __pyx_L1_error) } - __pyx_t_8 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_11, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 578, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = NULL; - __pyx_t_12 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - __pyx_t_12 = 1; - } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_8 = PyTuple_GET_ITEM(sequence, 2); + } else { + __pyx_t_4 = PyList_GET_ITEM(sequence, 0); + __pyx_t_6 = PyList_GET_ITEM(sequence, 1); + __pyx_t_8 = PyList_GET_ITEM(sequence, 2); } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_v_outbuf, __pyx_t_8}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 578, __pyx_L5_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_v_outbuf, __pyx_t_8}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 578, __pyx_L5_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx_t_8); + #else + __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 664, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 664, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 664, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); #endif - { - __pyx_t_10 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 578, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_10); - if (__pyx_t_9) { - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL; - } - __Pyx_INCREF(__pyx_v_outbuf); - __Pyx_GIVEREF(__pyx_v_outbuf); - PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_12, __pyx_v_outbuf); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_12, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 578, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "spavro/fast_binary.pyx":577 - * def write_record(outbuf, datum): - * for field in fields: - * try: # <<<<<<<<<<<<<< - * field.writer(outbuf, datum.get(field.name)) - * except TypeError as e: - */ + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_12 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 664, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_15 = Py_TYPE(__pyx_t_12)->tp_iternext; + index = 0; __pyx_t_4 = __pyx_t_15(__pyx_t_12); if (unlikely(!__pyx_t_4)) goto __pyx_L16_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + index = 1; __pyx_t_6 = __pyx_t_15(__pyx_t_12); if (unlikely(!__pyx_t_6)) goto __pyx_L16_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + index = 2; __pyx_t_8 = __pyx_t_15(__pyx_t_12); if (unlikely(!__pyx_t_8)) goto __pyx_L16_unpacking_failed; + __Pyx_GOTREF(__pyx_t_8); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_12), 3) < 0) __PYX_ERR(0, 664, __pyx_L1_error) + __pyx_t_15 = NULL; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + goto __pyx_L17_unpacking_done; + __pyx_L16_unpacking_failed:; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_15 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 664, __pyx_L1_error) + __pyx_L17_unpacking_done:; } - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - goto __pyx_L12_try_end; - __pyx_L5_error:; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - - /* "spavro/fast_binary.pyx":579 - * try: - * field.writer(outbuf, datum.get(field.name)) - * except TypeError as e: # <<<<<<<<<<<<<< - * raise TypeError("Error writing record schema at fieldname: '{}', datum: '{}'".format(field.name, repr(datum.get(field.name)))) - * write_record.__reduce__ = lambda: (make_record_writer, (schema,)) - */ - __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError); - if (__pyx_t_12) { - __Pyx_AddTraceback("spavro.fast_binary.make_record_writer.write_record", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_7, &__pyx_t_10) < 0) __PYX_ERR(0, 579, __pyx_L7_except_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_10); - __Pyx_INCREF(__pyx_t_7); - __pyx_v_e = __pyx_t_7; + __pyx_t_16 = __Pyx_PyInt_As_long(__pyx_t_4); if (unlikely((__pyx_t_16 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 664, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_idx = __pyx_t_16; + __Pyx_XDECREF_SET(__pyx_v_get_check, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_XDECREF_SET(__pyx_v_writer, __pyx_t_8); + __pyx_t_8 = 0; - /* "spavro/fast_binary.pyx":580 - * field.writer(outbuf, datum.get(field.name)) - * except TypeError as e: - * raise TypeError("Error writing record schema at fieldname: '{}', datum: '{}'".format(field.name, repr(datum.get(field.name)))) # <<<<<<<<<<<<<< - * write_record.__reduce__ = lambda: (make_record_writer, (schema,)) - * return write_record + /* "spavro/fast_binary.pyx":665 + * else: + * for idx, get_check, writer in lookup_result: + * if get_check(datum): # <<<<<<<<<<<<<< + * break + * else: */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Error_writing_record_schema_at_f, __pyx_n_s_format); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 580, __pyx_L7_except_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_field, __pyx_n_s_name); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 580, __pyx_L7_except_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_datum, __pyx_n_s_get); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 580, __pyx_L7_except_error) - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_field, __pyx_n_s_name); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 580, __pyx_L7_except_error) - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_16 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) { - __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_14); - if (likely(__pyx_t_16)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14); - __Pyx_INCREF(__pyx_t_16); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_14, function); - } - } - __pyx_t_13 = (__pyx_t_16) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_16, __pyx_t_15) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_15); - __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 580, __pyx_L7_except_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = PyObject_Repr(__pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 580, __pyx_L7_except_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = NULL; - __pyx_t_12 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_13)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_13); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - __pyx_t_12 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_t_11, __pyx_t_14}; - __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 580, __pyx_L7_except_error) - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_t_11, __pyx_t_14}; - __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 580, __pyx_L7_except_error) - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - } else - #endif - { - __pyx_t_15 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 580, __pyx_L7_except_error) - __Pyx_GOTREF(__pyx_t_15); - if (__pyx_t_13) { - __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_13); __pyx_t_13 = NULL; - } - __Pyx_GIVEREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_12, __pyx_t_11); - __Pyx_GIVEREF(__pyx_t_14); - PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_12, __pyx_t_14); - __pyx_t_11 = 0; - __pyx_t_14 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_15, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 580, __pyx_L7_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_INCREF(__pyx_v_get_check); + __pyx_t_8 = __pyx_v_get_check; __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 580, __pyx_L7_except_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_Raise(__pyx_t_9, 0, 0, 0); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __PYX_ERR(0, 580, __pyx_L7_except_error) } - goto __pyx_L7_except_error; - __pyx_L7_except_error:; + __pyx_t_9 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_6, __pyx_v_datum) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_datum); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 665, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 665, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (__pyx_t_14) { - /* "spavro/fast_binary.pyx":577 - * def write_record(outbuf, datum): - * for field in fields: - * try: # <<<<<<<<<<<<<< - * field.writer(outbuf, datum.get(field.name)) - * except TypeError as e: + /* "spavro/fast_binary.pyx":666 + * for idx, get_check, writer in lookup_result: + * if get_check(datum): + * break # <<<<<<<<<<<<<< + * else: + * raise TypeError("No matching schema for datum: {}".format(repr(datum))) + */ + goto __pyx_L15_break; + + /* "spavro/fast_binary.pyx":665 + * else: + * for idx, get_check, writer in lookup_result: + * if get_check(datum): # <<<<<<<<<<<<<< + * break + * else: + */ + } + + /* "spavro/fast_binary.pyx":664 + * idx, get_check, writer = lookup_result[0] + * else: + * for idx, get_check, writer in lookup_result: # <<<<<<<<<<<<<< + * if get_check(datum): + * break */ - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6); - goto __pyx_L1_error; - __pyx_L12_try_end:; } + /*else*/ { - /* "spavro/fast_binary.pyx":576 + /* "spavro/fast_binary.pyx":668 + * break + * else: + * raise TypeError("No matching schema for datum: {}".format(repr(datum))) # <<<<<<<<<<<<<< + * return idx, writer * - * def write_record(outbuf, datum): - * for field in fields: # <<<<<<<<<<<<<< - * try: - * field.writer(outbuf, datum.get(field.name)) */ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_No_matching_schema_for_datum, __pyx_n_s_format); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 668, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = PyObject_Repr(__pyx_v_datum); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 668, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + } + } + __pyx_t_9 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_4, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 668, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 668, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(0, 668, __pyx_L1_error) + } + + /* "spavro/fast_binary.pyx":664 + * idx, get_check, writer = lookup_result[0] + * else: + * for idx, get_check, writer in lookup_result: # <<<<<<<<<<<<<< + * if get_check(datum): + * break + */ + __pyx_L15_break:; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_L11:; - /* "spavro/fast_binary.pyx":575 - * cdef list fields = [WriteField(field['name'], get_writer(field['type'])) for field in schema['fields']] + /* "spavro/fast_binary.pyx":669 + * else: + * raise TypeError("No matching schema for datum: {}".format(repr(datum))) + * return idx, writer # <<<<<<<<<<<<<< * - * def write_record(outbuf, datum): # <<<<<<<<<<<<<< - * for field in fields: - * try: + * writer_lookup = complex_writer_lookup + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_idx); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 669, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 669, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); + __Pyx_INCREF(__pyx_v_writer); + __Pyx_GIVEREF(__pyx_v_writer); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_writer); + __pyx_t_7 = 0; + __pyx_r = __pyx_t_8; + __pyx_t_8 = 0; + goto __pyx_L0; + + /* "spavro/fast_binary.pyx":653 + * + * + * def complex_writer_lookup(datum): # <<<<<<<<<<<<<< + * cdef: + * long idx */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __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); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_XDECREF(__pyx_t_14); - __Pyx_XDECREF(__pyx_t_15); - __Pyx_XDECREF(__pyx_t_16); - __Pyx_AddTraceback("spavro.fast_binary.make_record_writer.write_record", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_field); - __Pyx_XDECREF(__pyx_v_e); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "spavro/fast_binary.pyx":581 - * except TypeError as e: - * raise TypeError("Error writing record schema at fieldname: '{}', datum: '{}'".format(field.name, repr(datum.get(field.name)))) - * write_record.__reduce__ = lambda: (make_record_writer, (schema,)) # <<<<<<<<<<<<<< - * return write_record - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_18make_record_writer_2lambda18(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_18make_record_writer_2lambda18 = {"lambda18", (PyCFunction)__pyx_pw_6spavro_11fast_binary_18make_record_writer_2lambda18, METH_NOARGS, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_18make_record_writer_2lambda18(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("lambda18 (wrapper)", 0); - __pyx_r = __pyx_lambda_funcdef_lambda18(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_lambda_funcdef_lambda18(PyObject *__pyx_self) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer *__pyx_cur_scope; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer *__pyx_outer_scope; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("lambda18", 0); - __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_record_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 581, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(!__pyx_cur_scope->__pyx_v_schema)) { __Pyx_RaiseClosureNameError("schema"); __PYX_ERR(0, 581, __pyx_L1_error) } - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 581, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_schema); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 581, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("spavro.fast_binary.make_record_writer.lambda18", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("spavro.fast_binary.make_union_writer.complex_writer_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_lookup_result); + __Pyx_XDECREF(__pyx_v_get_check); + __Pyx_XDECREF(__pyx_v_writer); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":572 - * +/* "spavro/fast_binary.pyx":596 * - * def make_record_writer(schema): # <<<<<<<<<<<<<< - * cdef list fields = [WriteField(field['name'], get_writer(field['type'])) for field in schema['fields']] * + * def make_union_writer(union_schema): # <<<<<<<<<<<<<< + * cdef list type_list = [get_type(lookup_schema(schema)) for schema in union_schema] + * # cdef dict writer_lookup */ -static PyObject *__pyx_pf_6spavro_11fast_binary_70make_record_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer *__pyx_cur_scope; - PyObject *__pyx_v_write_record = 0; - PyObject *__pyx_v_field = NULL; +static PyObject *__pyx_pf_6spavro_11fast_binary_66make_union_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_union_schema) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *__pyx_cur_scope; + PyObject *__pyx_v_type_list = 0; + char __pyx_v_simple_union; + long __pyx_v_idx; + PyObject *__pyx_v_simple_writer_lookup = 0; + PyObject *__pyx_v_writer_lookup = NULL; + PyObject *__pyx_v_schema = NULL; + PyObject *__pyx_v_python_type = NULL; + PyObject *__pyx_v_complex_writer_lookup = 0; + long __pyx_8genexpr1__pyx_v_idx; + PyObject *__pyx_8genexpr1__pyx_v_schema = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - PyObject *(*__pyx_t_5)(PyObject *); + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; + int __pyx_t_8; + int __pyx_t_9; + long __pyx_t_10; PyObject *__pyx_t_11 = NULL; - int __pyx_t_12; - __Pyx_RefNannySetupContext("make_record_writer", 0); - __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer, __pyx_empty_tuple, NULL); + PyObject *__pyx_t_12 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_union_writer", 0); + __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer *)Py_None); + __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 572, __pyx_L1_error) + __PYX_ERR(0, 596, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } - __pyx_cur_scope->__pyx_v_schema = __pyx_v_schema; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); + __pyx_cur_scope->__pyx_v_union_schema = __pyx_v_union_schema; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_union_schema); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_union_schema); - /* "spavro/fast_binary.pyx":573 + /* "spavro/fast_binary.pyx":597 * - * def make_record_writer(schema): - * cdef list fields = [WriteField(field['name'], get_writer(field['type'])) for field in schema['fields']] # <<<<<<<<<<<<<< - * - * def write_record(outbuf, datum): + * def make_union_writer(union_schema): + * cdef list type_list = [get_type(lookup_schema(schema)) for schema in union_schema] # <<<<<<<<<<<<<< + * # cdef dict writer_lookup + * # cdef list record_list */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 573, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 597, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_schema, __pyx_n_s_fields); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; - __pyx_t_5 = NULL; + if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_union_schema)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_union_schema)) { + __pyx_t_2 = __pyx_cur_scope->__pyx_v_union_schema; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; + __pyx_t_4 = NULL; } else { - __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 573, __pyx_L1_error) + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_union_schema); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 597, __pyx_L1_error) } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; for (;;) { - if (likely(!__pyx_t_5)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 573, __pyx_L1_error) + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 597, __pyx_L1_error) #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); #endif } else { - if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 573, __pyx_L1_error) + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 597, __pyx_L1_error) #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); #endif } } else { - __pyx_t_2 = __pyx_t_5(__pyx_t_3); - if (unlikely(!__pyx_t_2)) { + __pyx_t_5 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_5)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 573, __pyx_L1_error) + else __PYX_ERR(0, 597, __pyx_L1_error) } break; } - __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_5); } - __Pyx_XDECREF_SET(__pyx_v_field, __pyx_t_2); - __pyx_t_2 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_WriteField); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 573, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_schema, __pyx_t_5); + __pyx_t_5 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_lookup_schema); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 597, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_v_field, __pyx_n_s_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_get_writer); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_v_field, __pyx_n_s_type); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_11)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_11); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - } - } - __pyx_t_8 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_11, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = NULL; - __pyx_t_12 = 0; + __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_9)) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); - __pyx_t_12 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_7, __pyx_t_8}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_7, __pyx_t_8}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - { - __pyx_t_10 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (__pyx_t_9) { - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL; } - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_12, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_12, __pyx_t_8); - __pyx_t_7 = 0; - __pyx_t_8 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } + __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_schema) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_schema); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __pyx_f_6spavro_11fast_binary_get_type(__pyx_t_5, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 597, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_v_fields = ((PyObject*)__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_type_list = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":575 - * cdef list fields = [WriteField(field['name'], get_writer(field['type'])) for field in schema['fields']] - * - * def write_record(outbuf, datum): # <<<<<<<<<<<<<< - * for field in fields: - * try: + /* "spavro/fast_binary.pyx":612 + * # enums, strings and fixed are all python data type unicode or string + * # so those won't work either when mixed + * simple_union = not(type_list.count('record') > 1 or # <<<<<<<<<<<<<< + * len(set(type_list) & set(['string', 'enum', 'fixed', 'bytes'])) > 1 or + * len(set(type_list) & set(['record', 'map'])) > 1) */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_18make_record_writer_1write_record, 0, __pyx_n_s_make_record_writer_locals_write, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__41)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 575, __pyx_L1_error) + __pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyList_Type_count, __pyx_v_type_list, __pyx_n_s_record); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 612, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_v_write_record = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 612, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 612, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!__pyx_t_9) { + } else { + __pyx_t_8 = __pyx_t_9; + goto __pyx_L5_bool_binop_done; + } - /* "spavro/fast_binary.pyx":581 - * except TypeError as e: - * raise TypeError("Error writing record schema at fieldname: '{}', datum: '{}'".format(field.name, repr(datum.get(field.name)))) - * write_record.__reduce__ = lambda: (make_record_writer, (schema,)) # <<<<<<<<<<<<<< - * return write_record + /* "spavro/fast_binary.pyx":613 + * # so those won't work either when mixed + * simple_union = not(type_list.count('record') > 1 or + * len(set(type_list) & set(['string', 'enum', 'fixed', 'bytes'])) > 1 or # <<<<<<<<<<<<<< + * len(set(type_list) & set(['record', 'map'])) > 1) * */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_18make_record_writer_2lambda18, 0, __pyx_n_s_make_record_writer_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 581, __pyx_L1_error) + __pyx_t_2 = PySet_New(__pyx_v_type_list); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 613, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 613, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_write_record, __pyx_n_s_reduce, __pyx_t_1) < 0) __PYX_ERR(0, 581, __pyx_L1_error) + if (PySet_Add(__pyx_t_1, __pyx_n_s_string) < 0) __PYX_ERR(0, 613, __pyx_L1_error) + if (PySet_Add(__pyx_t_1, __pyx_n_s_enum) < 0) __PYX_ERR(0, 613, __pyx_L1_error) + if (PySet_Add(__pyx_t_1, __pyx_n_s_fixed) < 0) __PYX_ERR(0, 613, __pyx_L1_error) + if (PySet_Add(__pyx_t_1, __pyx_n_s_bytes) < 0) __PYX_ERR(0, 613, __pyx_L1_error) + __pyx_t_6 = PyNumber_And(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 613, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = PySet_GET_SIZE(__pyx_t_6); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 613, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_9 = ((__pyx_t_3 > 1) != 0); + if (!__pyx_t_9) { + } else { + __pyx_t_8 = __pyx_t_9; + goto __pyx_L5_bool_binop_done; + } - /* "spavro/fast_binary.pyx":582 - * raise TypeError("Error writing record schema at fieldname: '{}', datum: '{}'".format(field.name, repr(datum.get(field.name)))) - * write_record.__reduce__ = lambda: (make_record_writer, (schema,)) - * return write_record # <<<<<<<<<<<<<< - * + /* "spavro/fast_binary.pyx":614 + * simple_union = not(type_list.count('record') > 1 or + * len(set(type_list) & set(['string', 'enum', 'fixed', 'bytes'])) > 1 or + * len(set(type_list) & set(['record', 'map'])) > 1) # <<<<<<<<<<<<<< * + * if simple_union: */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_write_record); - __pyx_r = __pyx_v_write_record; - goto __pyx_L0; + __pyx_t_6 = PySet_New(__pyx_v_type_list); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 614, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 614, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PySet_Add(__pyx_t_1, __pyx_n_s_record) < 0) __PYX_ERR(0, 614, __pyx_L1_error) + if (PySet_Add(__pyx_t_1, __pyx_n_s_map) < 0) __PYX_ERR(0, 614, __pyx_L1_error) + __pyx_t_2 = PyNumber_And(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 614, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = PySet_GET_SIZE(__pyx_t_2); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 614, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = ((__pyx_t_3 > 1) != 0); + __pyx_t_8 = __pyx_t_9; + __pyx_L5_bool_binop_done:; - /* "spavro/fast_binary.pyx":572 - * - * - * def make_record_writer(schema): # <<<<<<<<<<<<<< - * cdef list fields = [WriteField(field['name'], get_writer(field['type'])) for field in schema['fields']] - * + /* "spavro/fast_binary.pyx":612 + * # enums, strings and fixed are all python data type unicode or string + * # so those won't work either when mixed + * simple_union = not(type_list.count('record') > 1 or # <<<<<<<<<<<<<< + * len(set(type_list) & set(['string', 'enum', 'fixed', 'bytes'])) > 1 or + * len(set(type_list) & set(['record', 'map'])) > 1) */ + __pyx_v_simple_union = (!__pyx_t_8); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __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); - __Pyx_AddTraceback("spavro.fast_binary.make_record_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_write_record); - __Pyx_XDECREF(__pyx_v_field); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "spavro/fast_binary.pyx":585 - * + /* "spavro/fast_binary.pyx":616 + * len(set(type_list) & set(['record', 'map'])) > 1) * - * def make_array_writer(schema): # <<<<<<<<<<<<<< - * item_writer = get_writer(schema['items']) + * if simple_union: # <<<<<<<<<<<<<< + * writer_lookup_dict = {avro_to_py[get_type(lookup_schema(schema))]: (idx, get_writer(schema)) for idx, schema in enumerate(union_schema)} * */ + __pyx_t_8 = (__pyx_v_simple_union != 0); + if (__pyx_t_8) { -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_73make_array_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_73make_array_writer = {"make_array_writer", (PyCFunction)__pyx_pw_6spavro_11fast_binary_73make_array_writer, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_73make_array_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("make_array_writer (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_72make_array_writer(__pyx_self, ((PyObject *)__pyx_v_schema)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "spavro/fast_binary.pyx":588 - * item_writer = get_writer(schema['items']) + /* "spavro/fast_binary.pyx":617 * - * def write_array(outbuf, list datum): # <<<<<<<<<<<<<< - * cdef long item_count = len(datum) - * if item_count > 0: + * if simple_union: + * writer_lookup_dict = {avro_to_py[get_type(lookup_schema(schema))]: (idx, get_writer(schema)) for idx, schema in enumerate(union_schema)} # <<<<<<<<<<<<<< + * + * create_promotions_for_union(writer_lookup_dict) */ - -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17make_array_writer_1write_array(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17make_array_writer_1write_array = {"write_array", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17make_array_writer_1write_array, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17make_array_writer_1write_array(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_outbuf = 0; - PyObject *__pyx_v_datum = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write_array (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_outbuf,&__pyx_n_s_datum,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; + { /* enter inner scope */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 617, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = 0; + if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_union_schema)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_union_schema)) { + __pyx_t_1 = __pyx_cur_scope->__pyx_v_union_schema; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_union_schema); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 617, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 617, __pyx_L11_error) } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outbuf)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_datum)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("write_array", 1, 2, 2, 1); __PYX_ERR(0, 588, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write_array") < 0)) __PYX_ERR(0, 588, __pyx_L3_error) + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 617, __pyx_L11_error) + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 617, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + } else { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 617, __pyx_L11_error) + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 617, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + } + } else { + __pyx_t_6 = __pyx_t_4(__pyx_t_1); + if (unlikely(!__pyx_t_6)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 617, __pyx_L11_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_6); + } + __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_schema, __pyx_t_6); + __pyx_t_6 = 0; + __pyx_8genexpr1__pyx_v_idx = __pyx_t_10; + __pyx_t_10 = (__pyx_t_10 + 1); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_avro_to_py); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 617, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_lookup_schema); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 617, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_11 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_11)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_11); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + } + } + __pyx_t_5 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_11, __pyx_8genexpr1__pyx_v_schema) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_8genexpr1__pyx_v_schema); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 617, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __pyx_f_6spavro_11fast_binary_get_type(__pyx_t_5, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 617, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 617, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_8genexpr1__pyx_v_idx); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 617, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_get_writer); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 617, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + } + } + __pyx_t_6 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_8genexpr1__pyx_v_schema) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_8genexpr1__pyx_v_schema); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 617, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 617, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_6); + __pyx_t_7 = 0; + __pyx_t_6 = 0; + if (unlikely(PyDict_SetItem(__pyx_t_2, (PyObject*)__pyx_t_5, (PyObject*)__pyx_t_11))) __PYX_ERR(0, 617, __pyx_L11_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_outbuf = values[0]; - __pyx_v_datum = ((PyObject*)values[1]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("write_array", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 588, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("spavro.fast_binary.make_array_writer.write_array", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_datum), (&PyList_Type), 1, "datum", 1))) __PYX_ERR(0, 588, __pyx_L1_error) - __pyx_r = __pyx_pf_6spavro_11fast_binary_17make_array_writer_write_array(__pyx_self, __pyx_v_outbuf, __pyx_v_datum); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_6spavro_11fast_binary_17make_array_writer_write_array(PyObject *__pyx_self, PyObject *__pyx_v_outbuf, PyObject *__pyx_v_datum) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer *__pyx_cur_scope; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer *__pyx_outer_scope; - long __pyx_v_item_count; - PyObject *__pyx_v_item = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - __Pyx_RefNannySetupContext("write_array", 0); - __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_schema); __pyx_8genexpr1__pyx_v_schema = 0; + goto __pyx_L14_exit_scope; + __pyx_L11_error:; + __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_schema); __pyx_8genexpr1__pyx_v_schema = 0; + goto __pyx_L1_error; + __pyx_L14_exit_scope:; + } /* exit inner scope */ + __Pyx_GIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_v_writer_lookup_dict = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":589 + /* "spavro/fast_binary.pyx":619 + * writer_lookup_dict = {avro_to_py[get_type(lookup_schema(schema))]: (idx, get_writer(schema)) for idx, schema in enumerate(union_schema)} + * + * create_promotions_for_union(writer_lookup_dict) # <<<<<<<<<<<<<< * - * def write_array(outbuf, list datum): - * cdef long item_count = len(datum) # <<<<<<<<<<<<<< - * if item_count > 0: - * write_long(outbuf, item_count) + * # warning, this will fail if there's both a long and int in a union */ - if (unlikely(__pyx_v_datum == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 589, __pyx_L1_error) - } - __pyx_t_1 = PyList_GET_SIZE(__pyx_v_datum); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 589, __pyx_L1_error) - __pyx_v_item_count = __pyx_t_1; + __pyx_t_2 = __pyx_cur_scope->__pyx_v_writer_lookup_dict; + __Pyx_INCREF(__pyx_t_2); + __pyx_f_6spavro_11fast_binary_create_promotions_for_union(((PyObject*)__pyx_t_2)); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":590 - * def write_array(outbuf, list datum): - * cdef long item_count = len(datum) - * if item_count > 0: # <<<<<<<<<<<<<< - * write_long(outbuf, item_count) - * for item in datum: + /* "spavro/fast_binary.pyx":624 + * # or a float and a double in a union (which is valid but nonsensical + * # in python but valid in avro) + * def simple_writer_lookup(datum): # <<<<<<<<<<<<<< + * try: + * return writer_lookup_dict[type(datum)] */ - __pyx_t_2 = ((__pyx_v_item_count > 0) != 0); - if (__pyx_t_2) { + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17make_union_writer_1simple_writer_lookup, 0, __pyx_n_s_make_union_writer_locals_simple, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__33)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 624, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_simple_writer_lookup = __pyx_t_2; + __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":591 - * cdef long item_count = len(datum) - * if item_count > 0: - * write_long(outbuf, item_count) # <<<<<<<<<<<<<< - * for item in datum: - * item_writer(outbuf, item) + /* "spavro/fast_binary.pyx":630 + * raise TypeError("{} - Invalid type ({}) in union. Schema: {}".format(repr(datum), type(datum), union_schema)) + * + * writer_lookup = simple_writer_lookup # <<<<<<<<<<<<<< + * else: + * writer_lookup_dict = {} */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_write_long); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 591, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_item_count); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 591, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_outbuf, __pyx_t_5}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 591, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_outbuf, __pyx_t_5}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 591, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 591, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__pyx_t_6) { - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; - } - __Pyx_INCREF(__pyx_v_outbuf); - __Pyx_GIVEREF(__pyx_v_outbuf); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_outbuf); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 591, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_INCREF(__pyx_v_simple_writer_lookup); + __pyx_v_writer_lookup = __pyx_v_simple_writer_lookup; - /* "spavro/fast_binary.pyx":590 - * def write_array(outbuf, list datum): - * cdef long item_count = len(datum) - * if item_count > 0: # <<<<<<<<<<<<<< - * write_long(outbuf, item_count) - * for item in datum: + /* "spavro/fast_binary.pyx":616 + * len(set(type_list) & set(['record', 'map'])) > 1) + * + * if simple_union: # <<<<<<<<<<<<<< + * writer_lookup_dict = {avro_to_py[get_type(lookup_schema(schema))]: (idx, get_writer(schema)) for idx, schema in enumerate(union_schema)} + * */ + goto __pyx_L8; } - /* "spavro/fast_binary.pyx":592 - * if item_count > 0: - * write_long(outbuf, item_count) - * for item in datum: # <<<<<<<<<<<<<< - * item_writer(outbuf, item) - * write_long(outbuf, 0) + /* "spavro/fast_binary.pyx":632 + * writer_lookup = simple_writer_lookup + * else: + * writer_lookup_dict = {} # <<<<<<<<<<<<<< + * for idx, schema in enumerate(union_schema): + * python_type = avro_to_py[get_type(lookup_schema(schema))] */ - if (unlikely(__pyx_v_datum == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 592, __pyx_L1_error) - } - __pyx_t_3 = __pyx_v_datum; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0; - for (;;) { - if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 592, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 592, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4); - __pyx_t_4 = 0; - - /* "spavro/fast_binary.pyx":593 - * write_long(outbuf, item_count) - * for item in datum: - * item_writer(outbuf, item) # <<<<<<<<<<<<<< - * write_long(outbuf, 0) - * write_array.__reduce__ = lambda: (make_array_writer, (schema,)) - */ - if (unlikely(!__pyx_cur_scope->__pyx_v_item_writer)) { __Pyx_RaiseClosureNameError("item_writer"); __PYX_ERR(0, 593, __pyx_L1_error) } - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_item_writer); - __pyx_t_8 = __pyx_cur_scope->__pyx_v_item_writer; __pyx_t_5 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_8)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_outbuf, __pyx_v_item}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 593, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_outbuf, __pyx_v_item}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 593, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else - #endif - { - __pyx_t_6 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 593, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL; - } - __Pyx_INCREF(__pyx_v_outbuf); - __Pyx_GIVEREF(__pyx_v_outbuf); - PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_v_outbuf); - __Pyx_INCREF(__pyx_v_item); - __Pyx_GIVEREF(__pyx_v_item); - PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_v_item); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 593, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + /*else*/ { + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 632, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_v_writer_lookup_dict = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":592 - * if item_count > 0: - * write_long(outbuf, item_count) - * for item in datum: # <<<<<<<<<<<<<< - * item_writer(outbuf, item) - * write_long(outbuf, 0) + /* "spavro/fast_binary.pyx":633 + * else: + * writer_lookup_dict = {} + * for idx, schema in enumerate(union_schema): # <<<<<<<<<<<<<< + * python_type = avro_to_py[get_type(lookup_schema(schema))] + * # TODO: if fixed and bytes are in the schema then we should check fixed before bytes */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "spavro/fast_binary.pyx":594 - * for item in datum: - * item_writer(outbuf, item) - * write_long(outbuf, 0) # <<<<<<<<<<<<<< - * write_array.__reduce__ = lambda: (make_array_writer, (schema,)) - * return write_array - */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_write_long); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 594, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_outbuf, __pyx_int_0}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 594, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_outbuf, __pyx_int_0}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 594, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - { - __pyx_t_6 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 594, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (__pyx_t_8) { - __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); __pyx_t_8 = NULL; + __pyx_t_10 = 0; + if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_union_schema)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_union_schema)) { + __pyx_t_2 = __pyx_cur_scope->__pyx_v_union_schema; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_union_schema); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 633, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 633, __pyx_L1_error) } - __Pyx_INCREF(__pyx_v_outbuf); - __Pyx_GIVEREF(__pyx_v_outbuf); - PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_v_outbuf); - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_int_0); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 594, __pyx_L1_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; + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 633, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 633, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 633, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 633, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } + } else { + __pyx_t_1 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 633, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF_SET(__pyx_v_schema, __pyx_t_1); + __pyx_t_1 = 0; + __pyx_v_idx = __pyx_t_10; + __pyx_t_10 = (__pyx_t_10 + 1); - /* "spavro/fast_binary.pyx":588 - * item_writer = get_writer(schema['items']) - * - * def write_array(outbuf, list datum): # <<<<<<<<<<<<<< - * cdef long item_count = len(datum) - * if item_count > 0: + /* "spavro/fast_binary.pyx":634 + * writer_lookup_dict = {} + * for idx, schema in enumerate(union_schema): + * python_type = avro_to_py[get_type(lookup_schema(schema))] # <<<<<<<<<<<<<< + * # TODO: if fixed and bytes are in the schema then we should check fixed before bytes + * # I think, since that's more efficient space wise? */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_avro_to_py); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 634, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_lookup_schema); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 634, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_11 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_schema) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_schema); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 634, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __pyx_f_6spavro_11fast_binary_get_type(__pyx_t_11, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 634, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 634, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF_SET(__pyx_v_python_type, __pyx_t_11); + __pyx_t_11 = 0; - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("spavro.fast_binary.make_array_writer.write_array", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_item); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "spavro/fast_binary.pyx":595 - * item_writer(outbuf, item) - * write_long(outbuf, 0) - * write_array.__reduce__ = lambda: (make_array_writer, (schema,)) # <<<<<<<<<<<<<< - * return write_array - * + /* "spavro/fast_binary.pyx":637 + * # TODO: if fixed and bytes are in the schema then we should check fixed before bytes + * # I think, since that's more efficient space wise? + * if python_type in writer_lookup_dict: # <<<<<<<<<<<<<< + * writer_lookup_dict[python_type] = writer_lookup_dict[python_type] + [(idx, get_check(schema), get_writer(schema))] + * else: */ + __pyx_t_8 = (__Pyx_PyDict_ContainsTF(__pyx_v_python_type, __pyx_cur_scope->__pyx_v_writer_lookup_dict, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 637, __pyx_L1_error) + __pyx_t_9 = (__pyx_t_8 != 0); + if (__pyx_t_9) { -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17make_array_writer_2lambda19(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17make_array_writer_2lambda19 = {"lambda19", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17make_array_writer_2lambda19, METH_NOARGS, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17make_array_writer_2lambda19(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("lambda19 (wrapper)", 0); - __pyx_r = __pyx_lambda_funcdef_lambda19(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_lambda_funcdef_lambda19(PyObject *__pyx_self) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer *__pyx_cur_scope; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer *__pyx_outer_scope; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("lambda19", 0); - __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_array_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 595, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(!__pyx_cur_scope->__pyx_v_schema)) { __Pyx_RaiseClosureNameError("schema"); __PYX_ERR(0, 595, __pyx_L1_error) } - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 595, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_schema); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 595, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("spavro.fast_binary.make_array_writer.lambda19", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "spavro/fast_binary.pyx":585 - * - * - * def make_array_writer(schema): # <<<<<<<<<<<<<< - * item_writer = get_writer(schema['items']) - * + /* "spavro/fast_binary.pyx":638 + * # I think, since that's more efficient space wise? + * if python_type in writer_lookup_dict: + * writer_lookup_dict[python_type] = writer_lookup_dict[python_type] + [(idx, get_check(schema), get_writer(schema))] # <<<<<<<<<<<<<< + * else: + * writer_lookup_dict[python_type] = [(idx, get_check(schema), get_writer(schema))] */ + __pyx_t_11 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, __pyx_v_python_type); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 638, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 638, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_get_check); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 638, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_schema) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_schema); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 638, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_get_writer); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 638, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_12 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + } + } + __pyx_t_6 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_12, __pyx_v_schema) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_schema); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 638, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 638, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_6); + __pyx_t_5 = 0; + __pyx_t_1 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 638, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_7); + PyList_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_7 = PyNumber_Add(__pyx_t_11, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 638, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, __pyx_v_python_type, __pyx_t_7) < 0)) __PYX_ERR(0, 638, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; -static PyObject *__pyx_pf_6spavro_11fast_binary_72make_array_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer *__pyx_cur_scope; - PyObject *__pyx_v_write_array = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("make_array_writer", 0); - __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(0, 585, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } - __pyx_cur_scope->__pyx_v_schema = __pyx_v_schema; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); + /* "spavro/fast_binary.pyx":637 + * # TODO: if fixed and bytes are in the schema then we should check fixed before bytes + * # I think, since that's more efficient space wise? + * if python_type in writer_lookup_dict: # <<<<<<<<<<<<<< + * writer_lookup_dict[python_type] = writer_lookup_dict[python_type] + [(idx, get_check(schema), get_writer(schema))] + * else: + */ + goto __pyx_L17; + } - /* "spavro/fast_binary.pyx":586 - * - * def make_array_writer(schema): - * item_writer = get_writer(schema['items']) # <<<<<<<<<<<<<< + /* "spavro/fast_binary.pyx":640 + * writer_lookup_dict[python_type] = writer_lookup_dict[python_type] + [(idx, get_check(schema), get_writer(schema))] + * else: + * writer_lookup_dict[python_type] = [(idx, get_check(schema), get_writer(schema))] # <<<<<<<<<<<<<< * - * def write_array(outbuf, list datum): + * create_promotions_for_union(writer_lookup_dict) + */ + /*else*/ { + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_idx); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_get_check); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_1 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + } + } + __pyx_t_6 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_1, __pyx_v_schema) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_v_schema); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_get_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + } + } + __pyx_t_11 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_v_schema) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_schema); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_11); + __pyx_t_7 = 0; + __pyx_t_6 = 0; + __pyx_t_11 = 0; + __pyx_t_11 = PyList_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GIVEREF(__pyx_t_1); + PyList_SET_ITEM(__pyx_t_11, 0, __pyx_t_1); + __pyx_t_1 = 0; + if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_writer_lookup_dict, __pyx_v_python_type, __pyx_t_11) < 0)) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + } + __pyx_L17:; + + /* "spavro/fast_binary.pyx":633 + * else: + * writer_lookup_dict = {} + * for idx, schema in enumerate(union_schema): # <<<<<<<<<<<<<< + * python_type = avro_to_py[get_type(lookup_schema(schema))] + * # TODO: if fixed and bytes are in the schema then we should check fixed before bytes */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_writer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 586, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_schema, __pyx_n_s_items); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 586, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - 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_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 586, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_v_item_writer = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":588 - * item_writer = get_writer(schema['items']) + /* "spavro/fast_binary.pyx":642 + * writer_lookup_dict[python_type] = [(idx, get_check(schema), get_writer(schema))] * - * def write_array(outbuf, list datum): # <<<<<<<<<<<<<< - * cdef long item_count = len(datum) - * if item_count > 0: + * create_promotions_for_union(writer_lookup_dict) # <<<<<<<<<<<<<< + * # if int in writer_lookup_dict: + * # writer_lookup_dict[long] = writer_lookup_dict[int] */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17make_array_writer_1write_array, 0, __pyx_n_s_make_array_writer_locals_write_a, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__43)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 588, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_write_array = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_2 = __pyx_cur_scope->__pyx_v_writer_lookup_dict; + __Pyx_INCREF(__pyx_t_2); + __pyx_f_6spavro_11fast_binary_create_promotions_for_union(((PyObject*)__pyx_t_2)); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":595 - * item_writer(outbuf, item) - * write_long(outbuf, 0) - * write_array.__reduce__ = lambda: (make_array_writer, (schema,)) # <<<<<<<<<<<<<< - * return write_array + /* "spavro/fast_binary.pyx":653 + * * + * def complex_writer_lookup(datum): # <<<<<<<<<<<<<< + * cdef: + * long idx */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17make_array_writer_2lambda19, 0, __pyx_n_s_make_array_writer_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 595, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_write_array, __pyx_n_s_reduce, __pyx_t_1) < 0) __PYX_ERR(0, 595, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17make_union_writer_3complex_writer_lookup, 0, __pyx_n_s_make_union_writer_locals_complex, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__35)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 653, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_complex_writer_lookup = __pyx_t_2; + __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":596 - * write_long(outbuf, 0) - * write_array.__reduce__ = lambda: (make_array_writer, (schema,)) - * return write_array # <<<<<<<<<<<<<< + /* "spavro/fast_binary.pyx":671 + * return idx, writer + * + * writer_lookup = complex_writer_lookup # <<<<<<<<<<<<<< + * + * return [0, writer_lookup] + */ + __Pyx_INCREF(__pyx_v_complex_writer_lookup); + __pyx_v_writer_lookup = __pyx_v_complex_writer_lookup; + } + __pyx_L8:; + + /* "spavro/fast_binary.pyx":673 + * writer_lookup = complex_writer_lookup * + * return [0, writer_lookup] # <<<<<<<<<<<<<< * + * def make_record_writer(schema): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_write_array); - __pyx_r = __pyx_v_write_array; + __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 673, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_int_0); + __Pyx_INCREF(__pyx_v_writer_lookup); + __Pyx_GIVEREF(__pyx_v_writer_lookup); + PyList_SET_ITEM(__pyx_t_2, 1, __pyx_v_writer_lookup); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; - /* "spavro/fast_binary.pyx":585 - * + /* "spavro/fast_binary.pyx":596 * - * def make_array_writer(schema): # <<<<<<<<<<<<<< - * item_writer = get_writer(schema['items']) * + * def make_union_writer(union_schema): # <<<<<<<<<<<<<< + * cdef list type_list = [get_type(lookup_schema(schema)) for schema in union_schema] + * # cdef dict writer_lookup */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("spavro.fast_binary.make_array_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("spavro.fast_binary.make_union_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_write_array); + __Pyx_XDECREF(__pyx_v_type_list); + __Pyx_XDECREF(__pyx_v_simple_writer_lookup); + __Pyx_XDECREF(__pyx_v_writer_lookup); + __Pyx_XDECREF(__pyx_v_schema); + __Pyx_XDECREF(__pyx_v_python_type); + __Pyx_XDECREF(__pyx_v_complex_writer_lookup); + __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_schema); __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":599 - * - * - * def make_map_writer(schema): # <<<<<<<<<<<<<< - * map_value_writer = get_writer(schema['values']) - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_75make_map_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_75make_map_writer = {"make_map_writer", (PyCFunction)__pyx_pw_6spavro_11fast_binary_75make_map_writer, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_75make_map_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("make_map_writer (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_74make_map_writer(__pyx_self, ((PyObject *)__pyx_v_schema)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "spavro/fast_binary.pyx":602 - * map_value_writer = get_writer(schema['values']) +/* "spavro/fast_binary.pyx":675 + * return [0, writer_lookup] * - * def write_map(outbuf, datum): # <<<<<<<<<<<<<< - * cdef long item_count = len(datum) - * if item_count > 0: + * def make_record_writer(schema): # <<<<<<<<<<<<<< + * cdef list fields = [WriteField(field['name'], get_writer(field['type'])) for field in schema['fields']] + * return [1, fields] */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_15make_map_writer_1write_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_15make_map_writer_1write_map = {"write_map", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_15make_map_writer_1write_map, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_15make_map_writer_1write_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_outbuf = 0; - PyObject *__pyx_v_datum = 0; +static PyObject *__pyx_pw_6spavro_11fast_binary_69make_record_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_69make_record_writer = {"make_record_writer", (PyCFunction)__pyx_pw_6spavro_11fast_binary_69make_record_writer, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_69make_record_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write_map (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_outbuf,&__pyx_n_s_datum,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outbuf)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_datum)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("write_map", 1, 2, 2, 1); __PYX_ERR(0, 602, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write_map") < 0)) __PYX_ERR(0, 602, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_outbuf = values[0]; - __pyx_v_datum = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("write_map", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 602, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("spavro.fast_binary.make_map_writer.write_map", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6spavro_11fast_binary_15make_map_writer_write_map(__pyx_self, __pyx_v_outbuf, __pyx_v_datum); + __Pyx_RefNannySetupContext("make_record_writer (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_68make_record_writer(__pyx_self, ((PyObject *)__pyx_v_schema)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_15make_map_writer_write_map(PyObject *__pyx_self, PyObject *__pyx_v_outbuf, PyObject *__pyx_v_datum) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer *__pyx_cur_scope; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer *__pyx_outer_scope; - long __pyx_v_item_count; - PyObject *__pyx_v_key = NULL; - PyObject *__pyx_v_val = NULL; +static PyObject *__pyx_pf_6spavro_11fast_binary_68make_record_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema) { + PyObject *__pyx_v_fields = 0; + PyObject *__pyx_v_field = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - int __pyx_t_2; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *(*__pyx_t_5)(PyObject *); PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; + PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; - Py_ssize_t __pyx_t_9; - int __pyx_t_10; - __Pyx_RefNannySetupContext("write_map", 0); - __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + int __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_record_writer", 0); - /* "spavro/fast_binary.pyx":603 + /* "spavro/fast_binary.pyx":676 + * + * def make_record_writer(schema): + * cdef list fields = [WriteField(field['name'], get_writer(field['type'])) for field in schema['fields']] # <<<<<<<<<<<<<< + * return [1, fields] * - * def write_map(outbuf, datum): - * cdef long item_count = len(datum) # <<<<<<<<<<<<<< - * if item_count > 0: - * write_long(outbuf, item_count) - */ - __pyx_t_1 = PyObject_Length(__pyx_v_datum); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 603, __pyx_L1_error) - __pyx_v_item_count = __pyx_t_1; - - /* "spavro/fast_binary.pyx":604 - * def write_map(outbuf, datum): - * cdef long item_count = len(datum) - * if item_count > 0: # <<<<<<<<<<<<<< - * write_long(outbuf, item_count) - * for key, val in datum.iteritems(): - */ - __pyx_t_2 = ((__pyx_v_item_count > 0) != 0); - if (__pyx_t_2) { - - /* "spavro/fast_binary.pyx":605 - * cdef long item_count = len(datum) - * if item_count > 0: - * write_long(outbuf, item_count) # <<<<<<<<<<<<<< - * for key, val in datum.iteritems(): - * write_utf8(outbuf, key) */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_write_long); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 605, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_item_count); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 605, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_7 = 1; + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_schema, __pyx_n_s_fields); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 676, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (likely(!__pyx_t_5)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 676, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } else { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 676, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_outbuf, __pyx_t_5}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 605, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_outbuf, __pyx_t_5}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 605, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 605, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__pyx_t_6) { - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; + } else { + __pyx_t_2 = __pyx_t_5(__pyx_t_3); + if (unlikely(!__pyx_t_2)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 676, __pyx_L1_error) + } + break; } - __Pyx_INCREF(__pyx_v_outbuf); - __Pyx_GIVEREF(__pyx_v_outbuf); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_outbuf); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 605, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_GOTREF(__pyx_t_2); } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "spavro/fast_binary.pyx":604 - * def write_map(outbuf, datum): - * cdef long item_count = len(datum) - * if item_count > 0: # <<<<<<<<<<<<<< - * write_long(outbuf, item_count) - * for key, val in datum.iteritems(): - */ - } - - /* "spavro/fast_binary.pyx":606 - * if item_count > 0: - * write_long(outbuf, item_count) - * for key, val in datum.iteritems(): # <<<<<<<<<<<<<< - * write_utf8(outbuf, key) - * map_value_writer(outbuf, val) - */ - __pyx_t_1 = 0; - if (unlikely(__pyx_v_datum == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems"); - __PYX_ERR(0, 606, __pyx_L1_error) - } - __pyx_t_4 = __Pyx_dict_iterator(__pyx_v_datum, 0, __pyx_n_s_iteritems, (&__pyx_t_9), (&__pyx_t_7)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 606, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_3); - __pyx_t_3 = __pyx_t_4; - __pyx_t_4 = 0; - while (1) { - __pyx_t_10 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_9, &__pyx_t_1, &__pyx_t_4, &__pyx_t_8, NULL, __pyx_t_7); - if (unlikely(__pyx_t_10 == 0)) break; - if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 606, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_field, __pyx_t_2); + __pyx_t_2 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_WriteField); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_v_field, __pyx_n_s_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_get_writer); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_v_field, __pyx_n_s_type); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_11)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_11); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + } + } + __pyx_t_8 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_11, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 676, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_4); - __pyx_t_4 = 0; - __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_8); - __pyx_t_8 = 0; - - /* "spavro/fast_binary.pyx":607 - * write_long(outbuf, item_count) - * for key, val in datum.iteritems(): - * write_utf8(outbuf, key) # <<<<<<<<<<<<<< - * map_value_writer(outbuf, val) - * write_long(outbuf, 0) - */ - __pyx_f_6spavro_11fast_binary_write_utf8(__pyx_v_outbuf, __pyx_v_key); - - /* "spavro/fast_binary.pyx":608 - * for key, val in datum.iteritems(): - * write_utf8(outbuf, key) - * map_value_writer(outbuf, val) # <<<<<<<<<<<<<< - * write_long(outbuf, 0) - * write_map.__reduce__ = lambda: (make_map_writer, (schema,)) - */ - if (unlikely(!__pyx_cur_scope->__pyx_v_map_value_writer)) { __Pyx_RaiseClosureNameError("map_value_writer"); __PYX_ERR(0, 608, __pyx_L1_error) } - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_map_value_writer); - __pyx_t_4 = __pyx_cur_scope->__pyx_v_map_value_writer; __pyx_t_5 = NULL; - __pyx_t_10 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = NULL; + __pyx_t_12 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_10 = 1; + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_12 = 1; } } #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_outbuf, __pyx_v_val}; - __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 608, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_8); + if (PyFunction_Check(__pyx_t_6)) { + PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_7, __pyx_t_8}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } else #endif #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_outbuf, __pyx_v_val}; - __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 608, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_8); + if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { + PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_7, __pyx_t_8}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } else #endif { - __pyx_t_6 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 608, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL; + __pyx_t_10 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (__pyx_t_9) { + __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL; } - __Pyx_INCREF(__pyx_v_outbuf); - __Pyx_GIVEREF(__pyx_v_outbuf); - PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_10, __pyx_v_outbuf); - __Pyx_INCREF(__pyx_v_val); - __Pyx_GIVEREF(__pyx_v_val); - PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_10, __pyx_v_val); - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 608, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_12, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_12, __pyx_t_8); + __pyx_t_7 = 0; + __pyx_t_8 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_fields = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":609 - * write_utf8(outbuf, key) - * map_value_writer(outbuf, val) - * write_long(outbuf, 0) # <<<<<<<<<<<<<< - * write_map.__reduce__ = lambda: (make_map_writer, (schema,)) - * return write_map + /* "spavro/fast_binary.pyx":677 + * def make_record_writer(schema): + * cdef list fields = [WriteField(field['name'], get_writer(field['type'])) for field in schema['fields']] + * return [1, fields] # <<<<<<<<<<<<<< + * + * def make_null_writer(schema): */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_write_long); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 609, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_4 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_8)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_outbuf, __pyx_int_0}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 609, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_outbuf, __pyx_int_0}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 609, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - { - __pyx_t_6 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 609, __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_outbuf); - __Pyx_GIVEREF(__pyx_v_outbuf); - PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_v_outbuf); - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_int_0); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 609, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 677, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_1); + __Pyx_INCREF(__pyx_v_fields); + __Pyx_GIVEREF(__pyx_v_fields); + PyList_SET_ITEM(__pyx_t_1, 1, __pyx_v_fields); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "spavro/fast_binary.pyx":602 - * map_value_writer = get_writer(schema['values']) + /* "spavro/fast_binary.pyx":675 + * return [0, writer_lookup] * - * def write_map(outbuf, datum): # <<<<<<<<<<<<<< - * cdef long item_count = len(datum) - * if item_count > 0: + * def make_record_writer(schema): # <<<<<<<<<<<<<< + * cdef list fields = [WriteField(field['name'], get_writer(field['type'])) for field in schema['fields']] + * return [1, fields] */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_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_AddTraceback("spavro.fast_binary.make_map_writer.write_map", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("spavro.fast_binary.make_record_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_key); - __Pyx_XDECREF(__pyx_v_val); + __Pyx_XDECREF(__pyx_v_fields); + __Pyx_XDECREF(__pyx_v_field); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":610 - * map_value_writer(outbuf, val) - * write_long(outbuf, 0) - * write_map.__reduce__ = lambda: (make_map_writer, (schema,)) # <<<<<<<<<<<<<< - * return write_map +/* "spavro/fast_binary.pyx":679 + * return [1, fields] + * + * def make_null_writer(schema): # <<<<<<<<<<<<<< + * return [2] * */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_15make_map_writer_2lambda20(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_15make_map_writer_2lambda20 = {"lambda20", (PyCFunction)__pyx_pw_6spavro_11fast_binary_15make_map_writer_2lambda20, METH_NOARGS, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_15make_map_writer_2lambda20(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_6spavro_11fast_binary_71make_null_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_71make_null_writer = {"make_null_writer", (PyCFunction)__pyx_pw_6spavro_11fast_binary_71make_null_writer, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_71make_null_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("lambda20 (wrapper)", 0); - __pyx_r = __pyx_lambda_funcdef_lambda20(__pyx_self); + __Pyx_RefNannySetupContext("make_null_writer (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_70make_null_writer(__pyx_self, ((PyObject *)__pyx_v_schema)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_lambda_funcdef_lambda20(PyObject *__pyx_self) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer *__pyx_cur_scope; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer *__pyx_outer_scope; +static PyObject *__pyx_pf_6spavro_11fast_binary_70make_null_writer(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("lambda20", 0); - __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_null_writer", 0); + + /* "spavro/fast_binary.pyx":680 + * + * def make_null_writer(schema): + * return [2] # <<<<<<<<<<<<<< + * + * def make_string_writer(schema): + */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_map_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 610, __pyx_L1_error) + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 680, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely(!__pyx_cur_scope->__pyx_v_schema)) { __Pyx_RaiseClosureNameError("schema"); __PYX_ERR(0, 610, __pyx_L1_error) } - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 610, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_schema); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 610, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __Pyx_INCREF(__pyx_int_2); + __Pyx_GIVEREF(__pyx_int_2); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_2); + __pyx_r = __pyx_t_1; __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; goto __pyx_L0; + /* "spavro/fast_binary.pyx":679 + * return [1, fields] + * + * def make_null_writer(schema): # <<<<<<<<<<<<<< + * return [2] + * + */ + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("spavro.fast_binary.make_map_writer.lambda20", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.make_null_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -16028,129 +15231,75 @@ static PyObject *__pyx_lambda_funcdef_lambda20(PyObject *__pyx_self) { return __pyx_r; } -/* "spavro/fast_binary.pyx":599 - * +/* "spavro/fast_binary.pyx":682 + * return [2] * - * def make_map_writer(schema): # <<<<<<<<<<<<<< - * map_value_writer = get_writer(schema['values']) + * def make_string_writer(schema): # <<<<<<<<<<<<<< + * return [3] * */ -static PyObject *__pyx_pf_6spavro_11fast_binary_74make_map_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer *__pyx_cur_scope; - PyObject *__pyx_v_write_map = 0; +/* Python wrapper */ +static PyObject *__pyx_pw_6spavro_11fast_binary_73make_string_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_73make_string_writer = {"make_string_writer", (PyCFunction)__pyx_pw_6spavro_11fast_binary_73make_string_writer, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_73make_string_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("make_string_writer (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_72make_string_writer(__pyx_self, ((PyObject *)__pyx_v_schema)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6spavro_11fast_binary_72make_string_writer(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("make_map_writer", 0); - __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(0, 599, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } - __pyx_cur_scope->__pyx_v_schema = __pyx_v_schema; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_string_writer", 0); - /* "spavro/fast_binary.pyx":600 + /* "spavro/fast_binary.pyx":683 * - * def make_map_writer(schema): - * map_value_writer = get_writer(schema['values']) # <<<<<<<<<<<<<< + * def make_string_writer(schema): + * return [3] # <<<<<<<<<<<<<< * - * def write_map(outbuf, datum): + * def make_boolean_writer(schema): */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_writer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 600, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_schema, __pyx_n_s_values); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 600, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - 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_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 600, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 683, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_v_map_value_writer = __pyx_t_1; + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_3); + __pyx_r = __pyx_t_1; __pyx_t_1 = 0; + goto __pyx_L0; - /* "spavro/fast_binary.pyx":602 - * map_value_writer = get_writer(schema['values']) + /* "spavro/fast_binary.pyx":682 + * return [2] * - * def write_map(outbuf, datum): # <<<<<<<<<<<<<< - * cdef long item_count = len(datum) - * if item_count > 0: - */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_15make_map_writer_1write_map, 0, __pyx_n_s_make_map_writer_locals_write_map, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__45)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 602, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_write_map = __pyx_t_1; - __pyx_t_1 = 0; - - /* "spavro/fast_binary.pyx":610 - * map_value_writer(outbuf, val) - * write_long(outbuf, 0) - * write_map.__reduce__ = lambda: (make_map_writer, (schema,)) # <<<<<<<<<<<<<< - * return write_map - * - */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_15make_map_writer_2lambda20, 0, __pyx_n_s_make_map_writer_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 610, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_write_map, __pyx_n_s_reduce, __pyx_t_1) < 0) __PYX_ERR(0, 610, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "spavro/fast_binary.pyx":611 - * write_long(outbuf, 0) - * write_map.__reduce__ = lambda: (make_map_writer, (schema,)) - * return write_map # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_write_map); - __pyx_r = __pyx_v_write_map; - goto __pyx_L0; - - /* "spavro/fast_binary.pyx":599 - * - * - * def make_map_writer(schema): # <<<<<<<<<<<<<< - * map_value_writer = get_writer(schema['values']) + * def make_string_writer(schema): # <<<<<<<<<<<<<< + * return [3] * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("spavro.fast_binary.make_map_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.make_string_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_write_map); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":614 - * +/* "spavro/fast_binary.pyx":685 + * return [3] * * def make_boolean_writer(schema): # <<<<<<<<<<<<<< * '''Create a boolean writer, adds a validation step before the actual @@ -16158,227 +15307,125 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_74make_map_writer(CYTHON_UNUSED */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_77make_boolean_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ -static char __pyx_doc_6spavro_11fast_binary_76make_boolean_writer[] = "Create a boolean writer, adds a validation step before the actual\n write function"; -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_77make_boolean_writer = {"make_boolean_writer", (PyCFunction)__pyx_pw_6spavro_11fast_binary_77make_boolean_writer, METH_O, __pyx_doc_6spavro_11fast_binary_76make_boolean_writer}; -static PyObject *__pyx_pw_6spavro_11fast_binary_77make_boolean_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema) { +static PyObject *__pyx_pw_6spavro_11fast_binary_75make_boolean_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ +static char __pyx_doc_6spavro_11fast_binary_74make_boolean_writer[] = "Create a boolean writer, adds a validation step before the actual\n write function"; +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_75make_boolean_writer = {"make_boolean_writer", (PyCFunction)__pyx_pw_6spavro_11fast_binary_75make_boolean_writer, METH_O, __pyx_doc_6spavro_11fast_binary_74make_boolean_writer}; +static PyObject *__pyx_pw_6spavro_11fast_binary_75make_boolean_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("make_boolean_writer (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_76make_boolean_writer(__pyx_self, ((PyObject *)__pyx_v_schema)); + __pyx_r = __pyx_pf_6spavro_11fast_binary_74make_boolean_writer(__pyx_self, ((PyObject *)__pyx_v_schema)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":617 +static PyObject *__pyx_pf_6spavro_11fast_binary_74make_boolean_writer(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_boolean_writer", 0); + + /* "spavro/fast_binary.pyx":688 * '''Create a boolean writer, adds a validation step before the actual * write function''' - * def checked_boolean_writer(outbuf, datum): # <<<<<<<<<<<<<< - * if not isinstance(datum, bool): - * raise TypeError("{} - Not a boolean value. Schema: {}".format(repr(datum), schema)) + * return [4] # <<<<<<<<<<<<<< + * + * def make_double_writer(schema): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 688, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_int_4); + __Pyx_GIVEREF(__pyx_int_4); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_4); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spavro/fast_binary.pyx":685 + * return [3] + * + * def make_boolean_writer(schema): # <<<<<<<<<<<<<< + * '''Create a boolean writer, adds a validation step before the actual + * write function''' + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spavro.fast_binary.make_boolean_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spavro/fast_binary.pyx":690 + * return [4] + * + * def make_double_writer(schema): # <<<<<<<<<<<<<< + * return [5] + * */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_19make_boolean_writer_1checked_boolean_writer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_19make_boolean_writer_1checked_boolean_writer = {"checked_boolean_writer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_19make_boolean_writer_1checked_boolean_writer, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_19make_boolean_writer_1checked_boolean_writer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_outbuf = 0; - PyObject *__pyx_v_datum = 0; +static PyObject *__pyx_pw_6spavro_11fast_binary_77make_double_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_77make_double_writer = {"make_double_writer", (PyCFunction)__pyx_pw_6spavro_11fast_binary_77make_double_writer, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_77make_double_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("checked_boolean_writer (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_outbuf,&__pyx_n_s_datum,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outbuf)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_datum)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("checked_boolean_writer", 1, 2, 2, 1); __PYX_ERR(0, 617, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "checked_boolean_writer") < 0)) __PYX_ERR(0, 617, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_outbuf = values[0]; - __pyx_v_datum = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("checked_boolean_writer", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 617, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("spavro.fast_binary.make_boolean_writer.checked_boolean_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6spavro_11fast_binary_19make_boolean_writer_checked_boolean_writer(__pyx_self, __pyx_v_outbuf, __pyx_v_datum); + __Pyx_RefNannySetupContext("make_double_writer (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_76make_double_writer(__pyx_self, ((PyObject *)__pyx_v_schema)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_19make_boolean_writer_checked_boolean_writer(PyObject *__pyx_self, PyObject *__pyx_v_outbuf, PyObject *__pyx_v_datum) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer *__pyx_cur_scope; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer *__pyx_outer_scope; +static PyObject *__pyx_pf_6spavro_11fast_binary_76make_double_writer(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - char __pyx_t_9; - __Pyx_RefNannySetupContext("checked_boolean_writer", 0); - __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; - - /* "spavro/fast_binary.pyx":618 - * write function''' - * def checked_boolean_writer(outbuf, datum): - * if not isinstance(datum, bool): # <<<<<<<<<<<<<< - * raise TypeError("{} - Not a boolean value. Schema: {}".format(repr(datum), schema)) - * write_boolean(outbuf, datum) - */ - __pyx_t_1 = ((PyObject*)&PyBool_Type); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_IsInstance(__pyx_v_datum, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 618, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0); - if (unlikely(__pyx_t_3)) { - - /* "spavro/fast_binary.pyx":619 - * def checked_boolean_writer(outbuf, datum): - * if not isinstance(datum, bool): - * raise TypeError("{} - Not a boolean value. Schema: {}".format(repr(datum), schema)) # <<<<<<<<<<<<<< - * write_boolean(outbuf, datum) - * return checked_boolean_writer - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Not_a_boolean_value_Schema, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 619, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_Repr(__pyx_v_datum); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 619, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(!__pyx_cur_scope->__pyx_v_schema)) { __Pyx_RaiseClosureNameError("schema"); __PYX_ERR(0, 619, __pyx_L1_error) } - __pyx_t_6 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_5, __pyx_cur_scope->__pyx_v_schema}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 619, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_5, __pyx_cur_scope->__pyx_v_schema}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 619, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 619, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__pyx_t_6) { - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; - } - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_5); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_cur_scope->__pyx_v_schema); - __pyx_t_5 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 619, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 619, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 619, __pyx_L1_error) - - /* "spavro/fast_binary.pyx":618 - * write function''' - * def checked_boolean_writer(outbuf, datum): - * if not isinstance(datum, bool): # <<<<<<<<<<<<<< - * raise TypeError("{} - Not a boolean value. Schema: {}".format(repr(datum), schema)) - * write_boolean(outbuf, datum) - */ - } + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_double_writer", 0); - /* "spavro/fast_binary.pyx":620 - * if not isinstance(datum, bool): - * raise TypeError("{} - Not a boolean value. Schema: {}".format(repr(datum), schema)) - * write_boolean(outbuf, datum) # <<<<<<<<<<<<<< - * return checked_boolean_writer + /* "spavro/fast_binary.pyx":691 * + * def make_double_writer(schema): + * return [5] # <<<<<<<<<<<<<< + * + * def make_float_writer(schema): */ - __pyx_t_9 = __Pyx_PyInt_As_char(__pyx_v_datum); if (unlikely((__pyx_t_9 == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 620, __pyx_L1_error) - __pyx_t_4 = __pyx_f_6spavro_11fast_binary_write_boolean(__pyx_v_outbuf, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 620, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 691, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_int_5); + __Pyx_GIVEREF(__pyx_int_5); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_5); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "spavro/fast_binary.pyx":617 - * '''Create a boolean writer, adds a validation step before the actual - * write function''' - * def checked_boolean_writer(outbuf, datum): # <<<<<<<<<<<<<< - * if not isinstance(datum, bool): - * raise TypeError("{} - Not a boolean value. Schema: {}".format(repr(datum), schema)) + /* "spavro/fast_binary.pyx":690 + * return [4] + * + * def make_double_writer(schema): # <<<<<<<<<<<<<< + * return [5] + * */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("spavro.fast_binary.make_boolean_writer.checked_boolean_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.make_double_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -16386,311 +15433,269 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_19make_boolean_writer_checked_bo return __pyx_r; } -/* "spavro/fast_binary.pyx":614 +/* "spavro/fast_binary.pyx":693 + * return [5] * + * def make_float_writer(schema): # <<<<<<<<<<<<<< + * return [6] * - * def make_boolean_writer(schema): # <<<<<<<<<<<<<< - * '''Create a boolean writer, adds a validation step before the actual - * write function''' */ -static PyObject *__pyx_pf_6spavro_11fast_binary_76make_boolean_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer *__pyx_cur_scope; - PyObject *__pyx_v_checked_boolean_writer = 0; +/* Python wrapper */ +static PyObject *__pyx_pw_6spavro_11fast_binary_79make_float_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_79make_float_writer = {"make_float_writer", (PyCFunction)__pyx_pw_6spavro_11fast_binary_79make_float_writer, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_79make_float_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("make_float_writer (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_78make_float_writer(__pyx_self, ((PyObject *)__pyx_v_schema)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6spavro_11fast_binary_78make_float_writer(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("make_boolean_writer", 0); - __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(0, 614, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } - __pyx_cur_scope->__pyx_v_schema = __pyx_v_schema; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); - - /* "spavro/fast_binary.pyx":617 - * '''Create a boolean writer, adds a validation step before the actual - * write function''' - * def checked_boolean_writer(outbuf, datum): # <<<<<<<<<<<<<< - * if not isinstance(datum, bool): - * raise TypeError("{} - Not a boolean value. Schema: {}".format(repr(datum), schema)) - */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_19make_boolean_writer_1checked_boolean_writer, 0, __pyx_n_s_make_boolean_writer_locals_check, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__47)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_checked_boolean_writer = __pyx_t_1; - __pyx_t_1 = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_float_writer", 0); - /* "spavro/fast_binary.pyx":621 - * raise TypeError("{} - Not a boolean value. Schema: {}".format(repr(datum), schema)) - * write_boolean(outbuf, datum) - * return checked_boolean_writer # <<<<<<<<<<<<<< + /* "spavro/fast_binary.pyx":694 * + * def make_float_writer(schema): + * return [6] # <<<<<<<<<<<<<< * + * def make_long_writer(schema): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_checked_boolean_writer); - __pyx_r = __pyx_v_checked_boolean_writer; + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 694, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_int_6); + __Pyx_GIVEREF(__pyx_int_6); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_6); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; - /* "spavro/fast_binary.pyx":614 + /* "spavro/fast_binary.pyx":693 + * return [5] * + * def make_float_writer(schema): # <<<<<<<<<<<<<< + * return [6] * - * def make_boolean_writer(schema): # <<<<<<<<<<<<<< - * '''Create a boolean writer, adds a validation step before the actual - * write function''' */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("spavro.fast_binary.make_boolean_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.make_float_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_checked_boolean_writer); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":624 +/* "spavro/fast_binary.pyx":696 + * return [6] * - * - * def make_fixed_writer(schema): # <<<<<<<<<<<<<< - * '''A writer that must write X bytes defined by the schema''' - * cdef long size = schema['size'] + * def make_long_writer(schema): # <<<<<<<<<<<<<< + * '''Create a long writer, adds a validation step before the actual + * write function to make sure the long value doesn't overflow''' */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_79make_fixed_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ -static char __pyx_doc_6spavro_11fast_binary_78make_fixed_writer[] = "A writer that must write X bytes defined by the schema"; -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_79make_fixed_writer = {"make_fixed_writer", (PyCFunction)__pyx_pw_6spavro_11fast_binary_79make_fixed_writer, METH_O, __pyx_doc_6spavro_11fast_binary_78make_fixed_writer}; -static PyObject *__pyx_pw_6spavro_11fast_binary_79make_fixed_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema) { +static PyObject *__pyx_pw_6spavro_11fast_binary_81make_long_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ +static char __pyx_doc_6spavro_11fast_binary_80make_long_writer[] = "Create a long writer, adds a validation step before the actual\n write function to make sure the long value doesn't overflow"; +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_81make_long_writer = {"make_long_writer", (PyCFunction)__pyx_pw_6spavro_11fast_binary_81make_long_writer, METH_O, __pyx_doc_6spavro_11fast_binary_80make_long_writer}; +static PyObject *__pyx_pw_6spavro_11fast_binary_81make_long_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("make_fixed_writer (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_78make_fixed_writer(__pyx_self, ((PyObject *)__pyx_v_schema)); + __Pyx_RefNannySetupContext("make_long_writer (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_80make_long_writer(__pyx_self, ((PyObject *)__pyx_v_schema)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":629 - * # note: not a char* because those are null terminated and fixed - * # has no such limitation - * def checked_write_fixed(outbuf, datum): # <<<<<<<<<<<<<< - * if len(datum) != size: - * raise TypeError("{} - Size Mismatch ({}) for Fixed data. Schema: {}".format(repr(datum), len(datum), schema)) +static PyObject *__pyx_pf_6spavro_11fast_binary_80make_long_writer(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_long_writer", 0); + + /* "spavro/fast_binary.pyx":699 + * '''Create a long writer, adds a validation step before the actual + * write function to make sure the long value doesn't overflow''' + * return [7] # <<<<<<<<<<<<<< + * + * def make_byte_writer(schema): */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_int_7); + __Pyx_GIVEREF(__pyx_int_7); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_7); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17make_fixed_writer_1checked_write_fixed(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17make_fixed_writer_1checked_write_fixed = {"checked_write_fixed", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17make_fixed_writer_1checked_write_fixed, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17make_fixed_writer_1checked_write_fixed(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_outbuf = 0; - PyObject *__pyx_v_datum = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("checked_write_fixed (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_outbuf,&__pyx_n_s_datum,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outbuf)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_datum)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("checked_write_fixed", 1, 2, 2, 1); __PYX_ERR(0, 629, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "checked_write_fixed") < 0)) __PYX_ERR(0, 629, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_outbuf = values[0]; - __pyx_v_datum = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("checked_write_fixed", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 629, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("spavro.fast_binary.make_fixed_writer.checked_write_fixed", __pyx_clineno, __pyx_lineno, __pyx_filename); + /* "spavro/fast_binary.pyx":696 + * return [6] + * + * def make_long_writer(schema): # <<<<<<<<<<<<<< + * '''Create a long writer, adds a validation step before the actual + * write function to make sure the long value doesn't overflow''' + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spavro.fast_binary.make_long_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6spavro_11fast_binary_17make_fixed_writer_checked_write_fixed(__pyx_self, __pyx_v_outbuf, __pyx_v_datum); + return __pyx_r; +} + +/* "spavro/fast_binary.pyx":701 + * return [7] + * + * def make_byte_writer(schema): # <<<<<<<<<<<<<< + * return [8] + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6spavro_11fast_binary_83make_byte_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_83make_byte_writer = {"make_byte_writer", (PyCFunction)__pyx_pw_6spavro_11fast_binary_83make_byte_writer, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_83make_byte_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("make_byte_writer (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_82make_byte_writer(__pyx_self, ((PyObject *)__pyx_v_schema)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_17make_fixed_writer_checked_write_fixed(PyObject *__pyx_self, PyObject *__pyx_v_outbuf, PyObject *__pyx_v_datum) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer *__pyx_cur_scope; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer *__pyx_outer_scope; +static PyObject *__pyx_pf_6spavro_11fast_binary_82make_byte_writer(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - __Pyx_RefNannySetupContext("checked_write_fixed", 0); - __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; - - /* "spavro/fast_binary.pyx":630 - * # has no such limitation - * def checked_write_fixed(outbuf, datum): - * if len(datum) != size: # <<<<<<<<<<<<<< - * raise TypeError("{} - Size Mismatch ({}) for Fixed data. Schema: {}".format(repr(datum), len(datum), schema)) - * write_fixed(outbuf, datum) - */ - __pyx_t_1 = PyObject_Length(__pyx_v_datum); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 630, __pyx_L1_error) - __pyx_t_2 = ((__pyx_t_1 != __pyx_cur_scope->__pyx_v_size) != 0); - if (unlikely(__pyx_t_2)) { - - /* "spavro/fast_binary.pyx":631 - * def checked_write_fixed(outbuf, datum): - * if len(datum) != size: - * raise TypeError("{} - Size Mismatch ({}) for Fixed data. Schema: {}".format(repr(datum), len(datum), schema)) # <<<<<<<<<<<<<< - * write_fixed(outbuf, datum) - * return checked_write_fixed - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Size_Mismatch_for_Fixed_data_Sc, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 631, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_Repr(__pyx_v_datum); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 631, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyObject_Length(__pyx_v_datum); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 631, __pyx_L1_error) - __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 631, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (unlikely(!__pyx_cur_scope->__pyx_v_schema)) { __Pyx_RaiseClosureNameError("schema"); __PYX_ERR(0, 631, __pyx_L1_error) } - __pyx_t_7 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_8 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_5, __pyx_t_6, __pyx_cur_scope->__pyx_v_schema}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 631, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_5, __pyx_t_6, __pyx_cur_scope->__pyx_v_schema}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 631, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 631, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (__pyx_t_7) { - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; - } - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_6); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); - PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_cur_scope->__pyx_v_schema); - __pyx_t_5 = 0; - __pyx_t_6 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 631, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 631, __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, 631, __pyx_L1_error) + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_byte_writer", 0); - /* "spavro/fast_binary.pyx":630 - * # has no such limitation - * def checked_write_fixed(outbuf, datum): - * if len(datum) != size: # <<<<<<<<<<<<<< - * raise TypeError("{} - Size Mismatch ({}) for Fixed data. Schema: {}".format(repr(datum), len(datum), schema)) - * write_fixed(outbuf, datum) + /* "spavro/fast_binary.pyx":702 + * + * def make_byte_writer(schema): + * return [8] # <<<<<<<<<<<<<< + * + * def make_int_writer(schema): */ - } + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 702, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_int_8); + __Pyx_GIVEREF(__pyx_int_8); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_8); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "spavro/fast_binary.pyx":632 - * if len(datum) != size: - * raise TypeError("{} - Size Mismatch ({}) for Fixed data. Schema: {}".format(repr(datum), len(datum), schema)) - * write_fixed(outbuf, datum) # <<<<<<<<<<<<<< - * return checked_write_fixed + /* "spavro/fast_binary.pyx":701 + * return [7] + * + * def make_byte_writer(schema): # <<<<<<<<<<<<<< + * return [8] * */ - __pyx_f_6spavro_11fast_binary_write_fixed(__pyx_v_outbuf, __pyx_v_datum); - /* "spavro/fast_binary.pyx":629 - * # note: not a char* because those are null terminated and fixed - * # has no such limitation - * def checked_write_fixed(outbuf, datum): # <<<<<<<<<<<<<< - * if len(datum) != size: - * raise TypeError("{} - Size Mismatch ({}) for Fixed data. Schema: {}".format(repr(datum), len(datum), schema)) + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spavro.fast_binary.make_byte_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spavro/fast_binary.pyx":704 + * return [8] + * + * def make_int_writer(schema): # <<<<<<<<<<<<<< + * '''Create a int writer, adds a validation step before the actual + * write function to make sure the int value doesn't overflow''' */ +/* Python wrapper */ +static PyObject *__pyx_pw_6spavro_11fast_binary_85make_int_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ +static char __pyx_doc_6spavro_11fast_binary_84make_int_writer[] = "Create a int writer, adds a validation step before the actual\n write function to make sure the int value doesn't overflow"; +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_85make_int_writer = {"make_int_writer", (PyCFunction)__pyx_pw_6spavro_11fast_binary_85make_int_writer, METH_O, __pyx_doc_6spavro_11fast_binary_84make_int_writer}; +static PyObject *__pyx_pw_6spavro_11fast_binary_85make_int_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("make_int_writer (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_84make_int_writer(__pyx_self, ((PyObject *)__pyx_v_schema)); + /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6spavro_11fast_binary_84make_int_writer(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_int_writer", 0); + + /* "spavro/fast_binary.pyx":707 + * '''Create a int writer, adds a validation step before the actual + * write function to make sure the int value doesn't overflow''' + * return [9] # <<<<<<<<<<<<<< + * + * def make_fixed_writer(schema): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 707, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_int_9); + __Pyx_GIVEREF(__pyx_int_9); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_9); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; + + /* "spavro/fast_binary.pyx":704 + * return [8] + * + * def make_int_writer(schema): # <<<<<<<<<<<<<< + * '''Create a int writer, adds a validation step before the actual + * write function to make sure the int value doesn't overflow''' + */ + + /* function exit code */ __pyx_L1_error:; - __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_9); - __Pyx_AddTraceback("spavro.fast_binary.make_fixed_writer.checked_write_fixed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spavro.fast_binary.make_int_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -16698,73 +15703,78 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17make_fixed_writer_checked_writ return __pyx_r; } -/* "spavro/fast_binary.pyx":624 - * +/* "spavro/fast_binary.pyx":709 + * return [9] * * def make_fixed_writer(schema): # <<<<<<<<<<<<<< * '''A writer that must write X bytes defined by the schema''' * cdef long size = schema['size'] */ -static PyObject *__pyx_pf_6spavro_11fast_binary_78make_fixed_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer *__pyx_cur_scope; - PyObject *__pyx_v_checked_write_fixed = 0; +/* Python wrapper */ +static PyObject *__pyx_pw_6spavro_11fast_binary_87make_fixed_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ +static char __pyx_doc_6spavro_11fast_binary_86make_fixed_writer[] = "A writer that must write X bytes defined by the schema"; +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_87make_fixed_writer = {"make_fixed_writer", (PyCFunction)__pyx_pw_6spavro_11fast_binary_87make_fixed_writer, METH_O, __pyx_doc_6spavro_11fast_binary_86make_fixed_writer}; +static PyObject *__pyx_pw_6spavro_11fast_binary_87make_fixed_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("make_fixed_writer (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_86make_fixed_writer(__pyx_self, ((PyObject *)__pyx_v_schema)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6spavro_11fast_binary_86make_fixed_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema) { + long __pyx_v_size; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; long __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("make_fixed_writer", 0); - __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(0, 624, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } - __pyx_cur_scope->__pyx_v_schema = __pyx_v_schema; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); - /* "spavro/fast_binary.pyx":626 + /* "spavro/fast_binary.pyx":711 * def make_fixed_writer(schema): * '''A writer that must write X bytes defined by the schema''' * cdef long size = schema['size'] # <<<<<<<<<<<<<< * # note: not a char* because those are null terminated and fixed * # has no such limitation */ - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_schema, __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 626, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_schema, __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 711, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 626, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 711, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_cur_scope->__pyx_v_size = __pyx_t_2; + __pyx_v_size = __pyx_t_2; - /* "spavro/fast_binary.pyx":629 + /* "spavro/fast_binary.pyx":714 * # note: not a char* because those are null terminated and fixed * # has no such limitation - * def checked_write_fixed(outbuf, datum): # <<<<<<<<<<<<<< - * if len(datum) != size: - * raise TypeError("{} - Size Mismatch ({}) for Fixed data. Schema: {}".format(repr(datum), len(datum), schema)) - */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17make_fixed_writer_1checked_write_fixed, 0, __pyx_n_s_make_fixed_writer_locals_checked, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__49)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 629, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_checked_write_fixed = __pyx_t_1; - __pyx_t_1 = 0; - - /* "spavro/fast_binary.pyx":633 - * raise TypeError("{} - Size Mismatch ({}) for Fixed data. Schema: {}".format(repr(datum), len(datum), schema)) - * write_fixed(outbuf, datum) - * return checked_write_fixed # <<<<<<<<<<<<<< - * + * return [10, size] # <<<<<<<<<<<<<< * + * def make_enum_writer(schema): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_checked_write_fixed); - __pyx_r = __pyx_v_checked_write_fixed; + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 714, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 714, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_int_10); + __Pyx_GIVEREF(__pyx_int_10); + PyList_SET_ITEM(__pyx_t_3, 0, __pyx_int_10); + __Pyx_GIVEREF(__pyx_t_1); + PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); + __pyx_t_1 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; goto __pyx_L0; - /* "spavro/fast_binary.pyx":624 - * + /* "spavro/fast_binary.pyx":709 + * return [9] * * def make_fixed_writer(schema): # <<<<<<<<<<<<<< * '''A writer that must write X bytes defined by the schema''' @@ -16774,893 +15784,886 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_78make_fixed_writer(CYTHON_UNUSE /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("spavro.fast_binary.make_fixed_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_checked_write_fixed); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":636 - * +/* "spavro/fast_binary.pyx":716 + * return [10, size] * - * def make_int_writer(schema): # <<<<<<<<<<<<<< - * '''Create a int writer, adds a validation step before the actual - * write function to make sure the int value doesn't overflow''' + * def make_enum_writer(schema): # <<<<<<<<<<<<<< + * cdef list symbols = schema['symbols'] + * return [11, symbols] */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_81make_int_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ -static char __pyx_doc_6spavro_11fast_binary_80make_int_writer[] = "Create a int writer, adds a validation step before the actual\n write function to make sure the int value doesn't overflow"; -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_81make_int_writer = {"make_int_writer", (PyCFunction)__pyx_pw_6spavro_11fast_binary_81make_int_writer, METH_O, __pyx_doc_6spavro_11fast_binary_80make_int_writer}; -static PyObject *__pyx_pw_6spavro_11fast_binary_81make_int_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema) { +static PyObject *__pyx_pw_6spavro_11fast_binary_89make_enum_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_89make_enum_writer = {"make_enum_writer", (PyCFunction)__pyx_pw_6spavro_11fast_binary_89make_enum_writer, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_89make_enum_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("make_int_writer (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_80make_int_writer(__pyx_self, ((PyObject *)__pyx_v_schema)); + __Pyx_RefNannySetupContext("make_enum_writer (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_88make_enum_writer(__pyx_self, ((PyObject *)__pyx_v_schema)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":639 - * '''Create a int writer, adds a validation step before the actual - * write function to make sure the int value doesn't overflow''' - * def checked_int_write(outbuf, datum): # <<<<<<<<<<<<<< - * if not isinstance(datum, six.integer_types): - * raise TypeError("Schema violation, {} is not an example of schema {}".format(datum, schema)) +static PyObject *__pyx_pf_6spavro_11fast_binary_88make_enum_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema) { + PyObject *__pyx_v_symbols = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_enum_writer", 0); + + /* "spavro/fast_binary.pyx":717 + * + * def make_enum_writer(schema): + * cdef list symbols = schema['symbols'] # <<<<<<<<<<<<<< + * return [11, symbols] + * */ + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_schema, __pyx_n_s_symbols); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 717, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 717, __pyx_L1_error) + __pyx_v_symbols = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_15make_int_writer_1checked_int_write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_15make_int_writer_1checked_int_write = {"checked_int_write", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_15make_int_writer_1checked_int_write, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_15make_int_writer_1checked_int_write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_outbuf = 0; - PyObject *__pyx_v_datum = 0; + /* "spavro/fast_binary.pyx":718 + * def make_enum_writer(schema): + * cdef list symbols = schema['symbols'] + * return [11, symbols] # <<<<<<<<<<<<<< + * + * def make_array_writer(schema): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 718, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_int_11); + __Pyx_GIVEREF(__pyx_int_11); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_11); + __Pyx_INCREF(__pyx_v_symbols); + __Pyx_GIVEREF(__pyx_v_symbols); + PyList_SET_ITEM(__pyx_t_1, 1, __pyx_v_symbols); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spavro/fast_binary.pyx":716 + * return [10, size] + * + * def make_enum_writer(schema): # <<<<<<<<<<<<<< + * cdef list symbols = schema['symbols'] + * return [11, symbols] + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spavro.fast_binary.make_enum_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_symbols); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spavro/fast_binary.pyx":720 + * return [11, symbols] + * + * def make_array_writer(schema): # <<<<<<<<<<<<<< + * cdef list item_writer = get_writer(schema['items']) + * return [12, item_writer] + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6spavro_11fast_binary_91make_array_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_91make_array_writer = {"make_array_writer", (PyCFunction)__pyx_pw_6spavro_11fast_binary_91make_array_writer, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_91make_array_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("checked_int_write (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_outbuf,&__pyx_n_s_datum,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outbuf)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_datum)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("checked_int_write", 1, 2, 2, 1); __PYX_ERR(0, 639, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "checked_int_write") < 0)) __PYX_ERR(0, 639, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_outbuf = values[0]; - __pyx_v_datum = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("checked_int_write", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 639, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("spavro.fast_binary.make_int_writer.checked_int_write", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6spavro_11fast_binary_15make_int_writer_checked_int_write(__pyx_self, __pyx_v_outbuf, __pyx_v_datum); + __Pyx_RefNannySetupContext("make_array_writer (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_90make_array_writer(__pyx_self, ((PyObject *)__pyx_v_schema)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_15make_int_writer_checked_int_write(PyObject *__pyx_self, PyObject *__pyx_v_outbuf, PyObject *__pyx_v_datum) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer *__pyx_cur_scope; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer *__pyx_outer_scope; +static PyObject *__pyx_pf_6spavro_11fast_binary_90make_array_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema) { + PyObject *__pyx_v_item_writer = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - __Pyx_RefNannySetupContext("checked_int_write", 0); - __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; - - /* "spavro/fast_binary.pyx":640 - * write function to make sure the int value doesn't overflow''' - * def checked_int_write(outbuf, datum): - * if not isinstance(datum, six.integer_types): # <<<<<<<<<<<<<< - * raise TypeError("Schema violation, {} is not an example of schema {}".format(datum, schema)) - * if not INT_MIN_VALUE <= datum <= INT_MAX_VALUE: - */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_six); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 640, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_integer_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 640, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = PyObject_IsInstance(__pyx_v_datum, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 640, __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)) { - - /* "spavro/fast_binary.pyx":641 - * def checked_int_write(outbuf, datum): - * if not isinstance(datum, six.integer_types): - * raise TypeError("Schema violation, {} is not an example of schema {}".format(datum, schema)) # <<<<<<<<<<<<<< - * if not INT_MIN_VALUE <= datum <= INT_MAX_VALUE: - * raise TypeError("Schema violation, value overflow. {} can't be stored in schema: {}".format(datum, schema)) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Schema_violation_is_not_an_examp, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 641, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(!__pyx_cur_scope->__pyx_v_schema)) { __Pyx_RaiseClosureNameError("schema"); __PYX_ERR(0, 641, __pyx_L1_error) } - __pyx_t_5 = NULL; - __pyx_t_6 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_6 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_datum, __pyx_cur_scope->__pyx_v_schema}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 641, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_datum, __pyx_cur_scope->__pyx_v_schema}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 641, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - { - __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 641, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; - } - __Pyx_INCREF(__pyx_v_datum); - __Pyx_GIVEREF(__pyx_v_datum); - PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_datum); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); - PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_cur_scope->__pyx_v_schema); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 641, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 641, __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, 641, __pyx_L1_error) - - /* "spavro/fast_binary.pyx":640 - * write function to make sure the int value doesn't overflow''' - * def checked_int_write(outbuf, datum): - * if not isinstance(datum, six.integer_types): # <<<<<<<<<<<<<< - * raise TypeError("Schema violation, {} is not an example of schema {}".format(datum, schema)) - * if not INT_MIN_VALUE <= datum <= INT_MAX_VALUE: - */ - } - - /* "spavro/fast_binary.pyx":642 - * if not isinstance(datum, six.integer_types): - * raise TypeError("Schema violation, {} is not an example of schema {}".format(datum, schema)) - * if not INT_MIN_VALUE <= datum <= INT_MAX_VALUE: # <<<<<<<<<<<<<< - * raise TypeError("Schema violation, value overflow. {} can't be stored in schema: {}".format(datum, schema)) - * write_long(outbuf, datum) - */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_INT_MIN_VALUE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 642, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_v_datum, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 642, __pyx_L1_error) - if (__Pyx_PyObject_IsTrue(__pyx_t_2)) { - __Pyx_DECREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_INT_MAX_VALUE); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 642, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = PyObject_RichCompare(__pyx_v_datum, __pyx_t_7, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 642, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 642, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = ((!__pyx_t_4) != 0); - if (unlikely(__pyx_t_3)) { - - /* "spavro/fast_binary.pyx":643 - * raise TypeError("Schema violation, {} is not an example of schema {}".format(datum, schema)) - * if not INT_MIN_VALUE <= datum <= INT_MAX_VALUE: - * raise TypeError("Schema violation, value overflow. {} can't be stored in schema: {}".format(datum, schema)) # <<<<<<<<<<<<<< - * write_long(outbuf, datum) - * return checked_int_write - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Schema_violation_value_overflow, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 643, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(!__pyx_cur_scope->__pyx_v_schema)) { __Pyx_RaiseClosureNameError("schema"); __PYX_ERR(0, 643, __pyx_L1_error) } - __pyx_t_7 = NULL; - __pyx_t_6 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_6 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_datum, __pyx_cur_scope->__pyx_v_schema}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 643, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_datum, __pyx_cur_scope->__pyx_v_schema}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 643, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - { - __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 643, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__pyx_t_7) { - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __pyx_t_7 = NULL; - } - __Pyx_INCREF(__pyx_v_datum); - __Pyx_GIVEREF(__pyx_v_datum); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_v_datum); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_cur_scope->__pyx_v_schema); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 643, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 643, __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, 643, __pyx_L1_error) - - /* "spavro/fast_binary.pyx":642 - * if not isinstance(datum, six.integer_types): - * raise TypeError("Schema violation, {} is not an example of schema {}".format(datum, schema)) - * if not INT_MIN_VALUE <= datum <= INT_MAX_VALUE: # <<<<<<<<<<<<<< - * raise TypeError("Schema violation, value overflow. {} can't be stored in schema: {}".format(datum, schema)) - * write_long(outbuf, datum) - */ - } + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_array_writer", 0); - /* "spavro/fast_binary.pyx":644 - * if not INT_MIN_VALUE <= datum <= INT_MAX_VALUE: - * raise TypeError("Schema violation, value overflow. {} can't be stored in schema: {}".format(datum, schema)) - * write_long(outbuf, datum) # <<<<<<<<<<<<<< - * return checked_int_write + /* "spavro/fast_binary.pyx":721 + * + * def make_array_writer(schema): + * cdef list item_writer = get_writer(schema['items']) # <<<<<<<<<<<<<< + * return [12, item_writer] * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_write_long); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 644, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_writer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 721, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = NULL; - __pyx_t_6 = 0; + __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_schema, __pyx_n_s_items); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 721, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { + __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_5); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_6 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_outbuf, __pyx_v_datum}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 644, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 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_5, __pyx_v_outbuf, __pyx_v_datum}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 644, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 644, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; } - __Pyx_INCREF(__pyx_v_outbuf); - __Pyx_GIVEREF(__pyx_v_outbuf); - PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_outbuf); - __Pyx_INCREF(__pyx_v_datum); - __Pyx_GIVEREF(__pyx_v_datum); - PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_datum); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 644, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } + __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 721, __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; + if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 721, __pyx_L1_error) + __pyx_v_item_writer = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":639 - * '''Create a int writer, adds a validation step before the actual - * write function to make sure the int value doesn't overflow''' - * def checked_int_write(outbuf, datum): # <<<<<<<<<<<<<< - * if not isinstance(datum, six.integer_types): - * raise TypeError("Schema violation, {} is not an example of schema {}".format(datum, schema)) + /* "spavro/fast_binary.pyx":722 + * def make_array_writer(schema): + * cdef list item_writer = get_writer(schema['items']) + * return [12, item_writer] # <<<<<<<<<<<<<< + * + * def make_map_writer(schema): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 722, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_int_12); + __Pyx_GIVEREF(__pyx_int_12); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_12); + __Pyx_INCREF(__pyx_v_item_writer); + __Pyx_GIVEREF(__pyx_v_item_writer); + PyList_SET_ITEM(__pyx_t_1, 1, __pyx_v_item_writer); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spavro/fast_binary.pyx":720 + * return [11, symbols] + * + * def make_array_writer(schema): # <<<<<<<<<<<<<< + * cdef list item_writer = get_writer(schema['items']) + * return [12, item_writer] */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("spavro.fast_binary.make_int_writer.checked_int_write", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spavro.fast_binary.make_array_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_item_writer); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":636 +/* "spavro/fast_binary.pyx":724 + * return [12, item_writer] * - * - * def make_int_writer(schema): # <<<<<<<<<<<<<< - * '''Create a int writer, adds a validation step before the actual - * write function to make sure the int value doesn't overflow''' + * def make_map_writer(schema): # <<<<<<<<<<<<<< + * cdef list map_value_writer = get_writer(schema['values']) + * return [13, map_value_writer] */ -static PyObject *__pyx_pf_6spavro_11fast_binary_80make_int_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer *__pyx_cur_scope; - PyObject *__pyx_v_checked_int_write = 0; - PyObject *__pyx_r = NULL; +/* Python wrapper */ +static PyObject *__pyx_pw_6spavro_11fast_binary_93make_map_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_93make_map_writer = {"make_map_writer", (PyCFunction)__pyx_pw_6spavro_11fast_binary_93make_map_writer, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_93make_map_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema) { + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("make_int_writer", 0); - __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(0, 636, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } - __pyx_cur_scope->__pyx_v_schema = __pyx_v_schema; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); + __Pyx_RefNannySetupContext("make_map_writer (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_92make_map_writer(__pyx_self, ((PyObject *)__pyx_v_schema)); - /* "spavro/fast_binary.pyx":639 - * '''Create a int writer, adds a validation step before the actual - * write function to make sure the int value doesn't overflow''' - * def checked_int_write(outbuf, datum): # <<<<<<<<<<<<<< - * if not isinstance(datum, six.integer_types): - * raise TypeError("Schema violation, {} is not an example of schema {}".format(datum, schema)) + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6spavro_11fast_binary_92make_map_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema) { + PyObject *__pyx_v_map_value_writer = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_map_writer", 0); + + /* "spavro/fast_binary.pyx":725 + * + * def make_map_writer(schema): + * cdef list map_value_writer = get_writer(schema['values']) # <<<<<<<<<<<<<< + * return [13, map_value_writer] + * */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_15make_int_writer_1checked_int_write, 0, __pyx_n_s_make_int_writer_locals_checked_i, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__51)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 639, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_writer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 725, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_schema, __pyx_n_s_values); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 725, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + 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_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 725, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_v_checked_int_write = __pyx_t_1; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 725, __pyx_L1_error) + __pyx_v_map_value_writer = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":645 - * raise TypeError("Schema violation, value overflow. {} can't be stored in schema: {}".format(datum, schema)) - * write_long(outbuf, datum) - * return checked_int_write # <<<<<<<<<<<<<< + /* "spavro/fast_binary.pyx":726 + * def make_map_writer(schema): + * cdef list map_value_writer = get_writer(schema['values']) + * return [13, map_value_writer] # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_checked_int_write); - __pyx_r = __pyx_v_checked_int_write; + __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 726, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_int_13); + __Pyx_GIVEREF(__pyx_int_13); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_13); + __Pyx_INCREF(__pyx_v_map_value_writer); + __Pyx_GIVEREF(__pyx_v_map_value_writer); + PyList_SET_ITEM(__pyx_t_1, 1, __pyx_v_map_value_writer); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; - /* "spavro/fast_binary.pyx":636 + /* "spavro/fast_binary.pyx":724 + * return [12, item_writer] * - * - * def make_int_writer(schema): # <<<<<<<<<<<<<< - * '''Create a int writer, adds a validation step before the actual - * write function to make sure the int value doesn't overflow''' + * def make_map_writer(schema): # <<<<<<<<<<<<<< + * cdef list map_value_writer = get_writer(schema['values']) + * return [13, map_value_writer] */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("spavro.fast_binary.make_int_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spavro.fast_binary.make_map_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_checked_int_write); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XDECREF(__pyx_v_map_value_writer); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":648 +/* "spavro/fast_binary.pyx":750 * + * class WriterPlaceholder(object): + * def __init__(self): # <<<<<<<<<<<<<< + * self.writer = None * - * def make_long_writer(schema): # <<<<<<<<<<<<<< - * '''Create a long writer, adds a validation step before the actual - * write function to make sure the long value doesn't overflow''' */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_83make_long_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ -static char __pyx_doc_6spavro_11fast_binary_82make_long_writer[] = "Create a long writer, adds a validation step before the actual\n write function to make sure the long value doesn't overflow"; -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_83make_long_writer = {"make_long_writer", (PyCFunction)__pyx_pw_6spavro_11fast_binary_83make_long_writer, METH_O, __pyx_doc_6spavro_11fast_binary_82make_long_writer}; -static PyObject *__pyx_pw_6spavro_11fast_binary_83make_long_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema) { +static PyObject *__pyx_pw_6spavro_11fast_binary_17WriterPlaceholder_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17WriterPlaceholder_1__init__ = {"__init__", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17WriterPlaceholder_1__init__, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17WriterPlaceholder_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("make_long_writer (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_82make_long_writer(__pyx_self, ((PyObject *)__pyx_v_schema)); + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_17WriterPlaceholder___init__(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":651 - * '''Create a long writer, adds a validation step before the actual - * write function to make sure the long value doesn't overflow''' - * def checked_long_write(outbuf, datum): # <<<<<<<<<<<<<< - * if not (isinstance(datum, six.integer_types) - * and LONG_MIN_VALUE <= datum <= LONG_MAX_VALUE): +static PyObject *__pyx_pf_6spavro_11fast_binary_17WriterPlaceholder___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "spavro/fast_binary.pyx":751 + * class WriterPlaceholder(object): + * def __init__(self): + * self.writer = None # <<<<<<<<<<<<<< + * + * + */ + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_writer, Py_None) < 0) __PYX_ERR(0, 751, __pyx_L1_error) + + /* "spavro/fast_binary.pyx":750 + * + * class WriterPlaceholder(object): + * def __init__(self): # <<<<<<<<<<<<<< + * self.writer = None + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("spavro.fast_binary.WriterPlaceholder.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spavro/fast_binary.pyx":754 + * + * + * def get_writer(schema): # <<<<<<<<<<<<<< + * cdef unicode schema_type = get_type(schema) + * */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_16make_long_writer_1checked_long_write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_16make_long_writer_1checked_long_write = {"checked_long_write", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_16make_long_writer_1checked_long_write, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_16make_long_writer_1checked_long_write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_outbuf = 0; - PyObject *__pyx_v_datum = 0; +static PyObject *__pyx_pw_6spavro_11fast_binary_95get_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_95get_writer = {"get_writer", (PyCFunction)__pyx_pw_6spavro_11fast_binary_95get_writer, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_95get_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("checked_long_write (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_outbuf,&__pyx_n_s_datum,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outbuf)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_datum)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("checked_long_write", 1, 2, 2, 1); __PYX_ERR(0, 651, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "checked_long_write") < 0)) __PYX_ERR(0, 651, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_outbuf = values[0]; - __pyx_v_datum = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("checked_long_write", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 651, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("spavro.fast_binary.make_long_writer.checked_long_write", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6spavro_11fast_binary_16make_long_writer_checked_long_write(__pyx_self, __pyx_v_outbuf, __pyx_v_datum); + __Pyx_RefNannySetupContext("get_writer (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_94get_writer(__pyx_self, ((PyObject *)__pyx_v_schema)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_16make_long_writer_checked_long_write(PyObject *__pyx_self, PyObject *__pyx_v_outbuf, PyObject *__pyx_v_datum) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer *__pyx_cur_scope; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer *__pyx_outer_scope; +static PyObject *__pyx_pf_6spavro_11fast_binary_94get_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema) { + PyObject *__pyx_v_schema_type = 0; + PyObject *__pyx_v_placeholder = NULL; + PyObject *__pyx_v_namespace = NULL; + PyObject *__pyx_v_name = NULL; + PyObject *__pyx_v_fullname = NULL; + PyObject *__pyx_v_writer = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; + PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; + int __pyx_t_3; int __pyx_t_4; 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("checked_long_write", 0); - __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_writer", 0); - /* "spavro/fast_binary.pyx":652 - * write function to make sure the long value doesn't overflow''' - * def checked_long_write(outbuf, datum): - * if not (isinstance(datum, six.integer_types) # <<<<<<<<<<<<<< - * and LONG_MIN_VALUE <= datum <= LONG_MAX_VALUE): - * raise TypeError("{} - Non integer value or overflow. Schema: {}".format(repr(datum), schema)) + /* "spavro/fast_binary.pyx":755 + * + * def get_writer(schema): + * cdef unicode schema_type = get_type(schema) # <<<<<<<<<<<<<< + * + * if schema_type in ('record', 'fixed', 'enum'): */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_six); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 652, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_integer_types); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 652, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = PyObject_IsInstance(__pyx_v_datum, __pyx_t_3); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 652, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_1 = __pyx_f_6spavro_11fast_binary_get_type(__pyx_v_schema, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 755, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_schema_type = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spavro/fast_binary.pyx":757 + * cdef unicode schema_type = get_type(schema) + * + * if schema_type in ('record', 'fixed', 'enum'): # <<<<<<<<<<<<<< + * placeholder = WriterPlaceholder() + * # using a placeholder because this is recursive and the writer isn't defined + */ + __Pyx_INCREF(__pyx_v_schema_type); + __pyx_t_2 = __pyx_v_schema_type; + __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_n_s_record, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 757, __pyx_L1_error) __pyx_t_5 = (__pyx_t_4 != 0); - if (__pyx_t_5) { + if (!__pyx_t_5) { } else { - __pyx_t_1 = __pyx_t_5; + __pyx_t_3 = __pyx_t_5; goto __pyx_L4_bool_binop_done; } - - /* "spavro/fast_binary.pyx":653 - * def checked_long_write(outbuf, datum): - * if not (isinstance(datum, six.integer_types) - * and LONG_MIN_VALUE <= datum <= LONG_MAX_VALUE): # <<<<<<<<<<<<<< - * raise TypeError("{} - Non integer value or overflow. Schema: {}".format(repr(datum), schema)) - * write_long(outbuf, datum) - */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_LONG_MIN_VALUE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 653, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_v_datum, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 653, __pyx_L1_error) - if (__Pyx_PyObject_IsTrue(__pyx_t_2)) { - __Pyx_DECREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_LONG_MAX_VALUE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 653, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = PyObject_RichCompare(__pyx_v_datum, __pyx_t_6, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 653, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_n_s_fixed, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 757, __pyx_L1_error) + __pyx_t_4 = (__pyx_t_5 != 0); + if (!__pyx_t_4) { + } else { + __pyx_t_3 = __pyx_t_4; + goto __pyx_L4_bool_binop_done; } - __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, 653, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_1 = __pyx_t_5; + __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_n_s_enum, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 757, __pyx_L1_error) + __pyx_t_5 = (__pyx_t_4 != 0); + __pyx_t_3 = __pyx_t_5; __pyx_L4_bool_binop_done:; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = (__pyx_t_3 != 0); + if (__pyx_t_5) { - /* "spavro/fast_binary.pyx":652 - * write function to make sure the long value doesn't overflow''' - * def checked_long_write(outbuf, datum): - * if not (isinstance(datum, six.integer_types) # <<<<<<<<<<<<<< - * and LONG_MIN_VALUE <= datum <= LONG_MAX_VALUE): - * raise TypeError("{} - Non integer value or overflow. Schema: {}".format(repr(datum), schema)) - */ - __pyx_t_5 = ((!__pyx_t_1) != 0); - if (unlikely(__pyx_t_5)) { - - /* "spavro/fast_binary.pyx":654 - * if not (isinstance(datum, six.integer_types) - * and LONG_MIN_VALUE <= datum <= LONG_MAX_VALUE): - * raise TypeError("{} - Non integer value or overflow. Schema: {}".format(repr(datum), schema)) # <<<<<<<<<<<<<< - * write_long(outbuf, datum) - * return checked_long_write + /* "spavro/fast_binary.pyx":758 + * + * if schema_type in ('record', 'fixed', 'enum'): + * placeholder = WriterPlaceholder() # <<<<<<<<<<<<<< + * # using a placeholder because this is recursive and the writer isn't defined + * # yet and nested records might refer to this parent schema name */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Non_integer_value_or_overflow_S, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 654, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyObject_Repr(__pyx_v_datum); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 654, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_WriterPlaceholder); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 758, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (unlikely(!__pyx_cur_scope->__pyx_v_schema)) { __Pyx_RaiseClosureNameError("schema"); __PYX_ERR(0, 654, __pyx_L1_error) } __pyx_t_7 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3); + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_8 = 1; + __Pyx_DECREF_SET(__pyx_t_6, function); } } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_cur_scope->__pyx_v_schema}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 654, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_cur_scope->__pyx_v_schema}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 654, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 654, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (__pyx_t_7) { - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; - } - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); - PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_cur_scope->__pyx_v_schema); - __pyx_t_6 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 654, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 654, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 654, __pyx_L1_error) + __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 758, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_placeholder = __pyx_t_1; + __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":652 - * write function to make sure the long value doesn't overflow''' - * def checked_long_write(outbuf, datum): - * if not (isinstance(datum, six.integer_types) # <<<<<<<<<<<<<< - * and LONG_MIN_VALUE <= datum <= LONG_MAX_VALUE): - * raise TypeError("{} - Non integer value or overflow. Schema: {}".format(repr(datum), schema)) + /* "spavro/fast_binary.pyx":761 + * # using a placeholder because this is recursive and the writer isn't defined + * # yet and nested records might refer to this parent schema name + * namespace = schema.get('namespace') # <<<<<<<<<<<<<< + * name = schema.get('name') + * if namespace and "." not in name: */ - } + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_schema, __pyx_n_s_get); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 761, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_n_s_namespace) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_n_s_namespace); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 761, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_namespace = __pyx_t_1; + __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":655 - * and LONG_MIN_VALUE <= datum <= LONG_MAX_VALUE): - * raise TypeError("{} - Non integer value or overflow. Schema: {}".format(repr(datum), schema)) - * write_long(outbuf, datum) # <<<<<<<<<<<<<< - * return checked_long_write - * + /* "spavro/fast_binary.pyx":762 + * # yet and nested records might refer to this parent schema name + * namespace = schema.get('namespace') + * name = schema.get('name') # <<<<<<<<<<<<<< + * if namespace and "." not in name: + * fullname = '.'.join([namespace, name]) */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_write_long); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 655, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_8 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_v_outbuf, __pyx_v_datum}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 655, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_v_outbuf, __pyx_v_datum}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 655, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - { - __pyx_t_6 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 655, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_schema, __pyx_n_s_get); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 762, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (__pyx_t_9) { - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_9); __pyx_t_9 = NULL; + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } } - __Pyx_INCREF(__pyx_v_outbuf); - __Pyx_GIVEREF(__pyx_v_outbuf); - PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_8, __pyx_v_outbuf); - __Pyx_INCREF(__pyx_v_datum); - __Pyx_GIVEREF(__pyx_v_datum); - PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_8, __pyx_v_datum); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 655, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_n_s_name) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_n_s_name); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 762, __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_3); __pyx_t_3 = 0; + __pyx_v_name = __pyx_t_1; + __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":651 - * '''Create a long writer, adds a validation step before the actual - * write function to make sure the long value doesn't overflow''' - * def checked_long_write(outbuf, datum): # <<<<<<<<<<<<<< - * if not (isinstance(datum, six.integer_types) - * and LONG_MIN_VALUE <= datum <= LONG_MAX_VALUE): + /* "spavro/fast_binary.pyx":763 + * namespace = schema.get('namespace') + * name = schema.get('name') + * if namespace and "." not in name: # <<<<<<<<<<<<<< + * fullname = '.'.join([namespace, name]) + * else: */ + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_namespace); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 763, __pyx_L1_error) + if (__pyx_t_3) { + } else { + __pyx_t_5 = __pyx_t_3; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_kp_s__19, __pyx_v_name, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 763, __pyx_L1_error) + __pyx_t_4 = (__pyx_t_3 != 0); + __pyx_t_5 = __pyx_t_4; + __pyx_L8_bool_binop_done:; + if (__pyx_t_5) { - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("spavro.fast_binary.make_long_writer.checked_long_write", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "spavro/fast_binary.pyx":648 - * - * - * def make_long_writer(schema): # <<<<<<<<<<<<<< - * '''Create a long writer, adds a validation step before the actual - * write function to make sure the long value doesn't overflow''' + /* "spavro/fast_binary.pyx":764 + * name = schema.get('name') + * if namespace and "." not in name: + * fullname = '.'.join([namespace, name]) # <<<<<<<<<<<<<< + * else: + * fullname = name */ + __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 764, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_namespace); + __Pyx_GIVEREF(__pyx_v_namespace); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_namespace); + __Pyx_INCREF(__pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + PyList_SET_ITEM(__pyx_t_1, 1, __pyx_v_name); + __pyx_t_6 = __Pyx_PyString_Join(__pyx_kp_s__19, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 764, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_fullname = __pyx_t_6; + __pyx_t_6 = 0; -static PyObject *__pyx_pf_6spavro_11fast_binary_82make_long_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer *__pyx_cur_scope; - PyObject *__pyx_v_checked_long_write = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("make_long_writer", 0); - __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(0, 648, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } - __pyx_cur_scope->__pyx_v_schema = __pyx_v_schema; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); + /* "spavro/fast_binary.pyx":763 + * namespace = schema.get('namespace') + * name = schema.get('name') + * if namespace and "." not in name: # <<<<<<<<<<<<<< + * fullname = '.'.join([namespace, name]) + * else: + */ + goto __pyx_L7; + } - /* "spavro/fast_binary.pyx":651 - * '''Create a long writer, adds a validation step before the actual - * write function to make sure the long value doesn't overflow''' - * def checked_long_write(outbuf, datum): # <<<<<<<<<<<<<< - * if not (isinstance(datum, six.integer_types) - * and LONG_MIN_VALUE <= datum <= LONG_MAX_VALUE): + /* "spavro/fast_binary.pyx":766 + * fullname = '.'.join([namespace, name]) + * else: + * fullname = name # <<<<<<<<<<<<<< + * custom_schema[fullname] = schema + * schema_cache[fullname] = placeholder */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_16make_long_writer_1checked_long_write, 0, __pyx_n_s_make_long_writer_locals_checked, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__53)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 651, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_checked_long_write = __pyx_t_1; - __pyx_t_1 = 0; + /*else*/ { + __Pyx_INCREF(__pyx_v_name); + __pyx_v_fullname = __pyx_v_name; + } + __pyx_L7:; - /* "spavro/fast_binary.pyx":656 - * raise TypeError("{} - Non integer value or overflow. Schema: {}".format(repr(datum), schema)) - * write_long(outbuf, datum) - * return checked_long_write # <<<<<<<<<<<<<< - * - * + /* "spavro/fast_binary.pyx":767 + * else: + * fullname = name + * custom_schema[fullname] = schema # <<<<<<<<<<<<<< + * schema_cache[fullname] = placeholder + * writer = writer_type_map[schema_type](schema) */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_checked_long_write); - __pyx_r = __pyx_v_checked_long_write; - goto __pyx_L0; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_custom_schema); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 767, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(PyObject_SetItem(__pyx_t_6, __pyx_v_fullname, __pyx_v_schema) < 0)) __PYX_ERR(0, 767, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "spavro/fast_binary.pyx":648 - * - * - * def make_long_writer(schema): # <<<<<<<<<<<<<< - * '''Create a long writer, adds a validation step before the actual - * write function to make sure the long value doesn't overflow''' + /* "spavro/fast_binary.pyx":768 + * fullname = name + * custom_schema[fullname] = schema + * schema_cache[fullname] = placeholder # <<<<<<<<<<<<<< + * writer = writer_type_map[schema_type](schema) + * # now that we've returned, assign the writer to the placeholder */ + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_schema_cache); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 768, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(PyObject_SetItem(__pyx_t_6, __pyx_v_fullname, __pyx_v_placeholder) < 0)) __PYX_ERR(0, 768, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("spavro.fast_binary.make_long_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_checked_long_write); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "spavro/fast_binary.pyx":769 + * custom_schema[fullname] = schema + * schema_cache[fullname] = placeholder + * writer = writer_type_map[schema_type](schema) # <<<<<<<<<<<<<< + * # now that we've returned, assign the writer to the placeholder + * # so that the execution will work + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_writer_type_map); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 769, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_v_schema_type); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 769, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + } + } + __pyx_t_6 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_1, __pyx_v_schema) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_schema); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 769, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_writer = __pyx_t_6; + __pyx_t_6 = 0; -/* "spavro/fast_binary.pyx":659 - * - * - * def make_string_writer(schema): # <<<<<<<<<<<<<< - * def checked_string_writer(outbuf, datum): - * if not isinstance(datum, six.string_types): + /* "spavro/fast_binary.pyx":772 + * # now that we've returned, assign the writer to the placeholder + * # so that the execution will work + * placeholder.writer = writer # <<<<<<<<<<<<<< + * return writer + * try: */ + if (__Pyx_PyObject_SetAttrStr(__pyx_v_placeholder, __pyx_n_s_writer, __pyx_v_writer) < 0) __PYX_ERR(0, 772, __pyx_L1_error) -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_85make_string_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_85make_string_writer = {"make_string_writer", (PyCFunction)__pyx_pw_6spavro_11fast_binary_85make_string_writer, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_85make_string_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("make_string_writer (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_84make_string_writer(__pyx_self, ((PyObject *)__pyx_v_schema)); + /* "spavro/fast_binary.pyx":773 + * # so that the execution will work + * placeholder.writer = writer + * return writer # <<<<<<<<<<<<<< + * try: + * writer = writer_type_map[schema_type](schema) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_writer); + __pyx_r = __pyx_v_writer; + goto __pyx_L0; + + /* "spavro/fast_binary.pyx":757 + * cdef unicode schema_type = get_type(schema) + * + * if schema_type in ('record', 'fixed', 'enum'): # <<<<<<<<<<<<<< + * placeholder = WriterPlaceholder() + * # using a placeholder because this is recursive and the writer isn't defined + */ + } + + /* "spavro/fast_binary.pyx":774 + * placeholder.writer = writer + * return writer + * try: # <<<<<<<<<<<<<< + * writer = writer_type_map[schema_type](schema) + * except KeyError: + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + /*try:*/ { + + /* "spavro/fast_binary.pyx":775 + * return writer + * try: + * writer = writer_type_map[schema_type](schema) # <<<<<<<<<<<<<< + * except KeyError: + * # lookup the schema by unique previously defined name, + */ + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_writer_type_map); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 775, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_7, __pyx_v_schema_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 775, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + } + } + __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_7, __pyx_v_schema) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_schema); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 775, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_writer = __pyx_t_6; + __pyx_t_6 = 0; + + /* "spavro/fast_binary.pyx":774 + * placeholder.writer = writer + * return writer + * try: # <<<<<<<<<<<<<< + * writer = writer_type_map[schema_type](schema) + * except KeyError: + */ + } + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L15_try_end; + __pyx_L10_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "spavro/fast_binary.pyx":776 + * try: + * writer = writer_type_map[schema_type](schema) + * except KeyError: # <<<<<<<<<<<<<< + * # lookup the schema by unique previously defined name, + * # i.e. a custom type + */ + __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError); + if (__pyx_t_11) { + __Pyx_AddTraceback("spavro.fast_binary.get_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_1, &__pyx_t_7) < 0) __PYX_ERR(0, 776, __pyx_L12_except_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_7); + + /* "spavro/fast_binary.pyx":779 + * # lookup the schema by unique previously defined name, + * # i.e. a custom type + * writer = schema_cache[schema_type].writer # <<<<<<<<<<<<<< + * + * return writer + */ + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_schema_cache); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 779, __pyx_L12_except_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_13 = __Pyx_PyObject_Dict_GetItem(__pyx_t_12, __pyx_v_schema_type); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 779, __pyx_L12_except_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_writer); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 779, __pyx_L12_except_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_XDECREF_SET(__pyx_v_writer, __pyx_t_12); + __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L11_exception_handled; + } + goto __pyx_L12_except_error; + __pyx_L12_except_error:; + + /* "spavro/fast_binary.pyx":774 + * placeholder.writer = writer + * return writer + * try: # <<<<<<<<<<<<<< + * writer = writer_type_map[schema_type](schema) + * except KeyError: + */ + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10); + goto __pyx_L1_error; + __pyx_L11_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10); + __pyx_L15_try_end:; + } + + /* "spavro/fast_binary.pyx":781 + * writer = schema_cache[schema_type].writer + * + * return writer # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_writer); + __pyx_r = __pyx_v_writer; + goto __pyx_L0; + + /* "spavro/fast_binary.pyx":754 + * + * + * def get_writer(schema): # <<<<<<<<<<<<<< + * cdef unicode schema_type = get_type(schema) + * + */ /* function exit code */ + __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_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_AddTraceback("spavro.fast_binary.get_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_schema_type); + __Pyx_XDECREF(__pyx_v_placeholder); + __Pyx_XDECREF(__pyx_v_namespace); + __Pyx_XDECREF(__pyx_v_name); + __Pyx_XDECREF(__pyx_v_fullname); + __Pyx_XDECREF(__pyx_v_writer); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":660 - * - * def make_string_writer(schema): - * def checked_string_writer(outbuf, datum): # <<<<<<<<<<<<<< - * if not isinstance(datum, six.string_types): - * raise TypeError("{} - is not a string value. Schema: {}".format(repr(datum), schema)) +/* "spavro/fast_binary.pyx":790 + * class FastBinaryEncoder(object): + * """Write leaf values.""" + * def __init__(self, writer): # <<<<<<<<<<<<<< + * """ + * writer is a Python object on which we can call write. */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_18make_string_writer_1checked_string_writer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_18make_string_writer_1checked_string_writer = {"checked_string_writer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_18make_string_writer_1checked_string_writer, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_18make_string_writer_1checked_string_writer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_outbuf = 0; - PyObject *__pyx_v_datum = 0; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6spavro_11fast_binary_17FastBinaryEncoder___init__[] = "\n writer is a Python object on which we can call write.\n "; +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_1__init__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6spavro_11fast_binary_17FastBinaryEncoder___init__}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_writer = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("checked_string_writer (wrapper)", 0); + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_outbuf,&__pyx_n_s_datum,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_writer,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -17676,17 +16679,17 @@ static PyObject *__pyx_pw_6spavro_11fast_binary_18make_string_writer_1checked_st kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outbuf)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_datum)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_writer)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("checked_string_writer", 1, 2, 2, 1); __PYX_ERR(0, 660, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 790, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "checked_string_writer") < 0)) __PYX_ERR(0, 660, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 790, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -17694,293 +16697,190 @@ static PyObject *__pyx_pw_6spavro_11fast_binary_18make_string_writer_1checked_st values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_outbuf = values[0]; - __pyx_v_datum = values[1]; + __pyx_v_self = values[0]; + __pyx_v_writer = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("checked_string_writer", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 660, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 790, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("spavro.fast_binary.make_string_writer.checked_string_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6spavro_11fast_binary_18make_string_writer_checked_string_writer(__pyx_self, __pyx_v_outbuf, __pyx_v_datum); + __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder___init__(__pyx_self, __pyx_v_self, __pyx_v_writer); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_18make_string_writer_checked_string_writer(PyObject *__pyx_self, PyObject *__pyx_v_outbuf, PyObject *__pyx_v_datum) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer *__pyx_cur_scope; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer *__pyx_outer_scope; +static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_writer) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - __Pyx_RefNannySetupContext("checked_string_writer", 0); - __pyx_outer_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); - /* "spavro/fast_binary.pyx":661 - * def make_string_writer(schema): - * def checked_string_writer(outbuf, datum): - * if not isinstance(datum, six.string_types): # <<<<<<<<<<<<<< - * raise TypeError("{} - is not a string value. Schema: {}".format(repr(datum), schema)) - * write_utf8(outbuf, datum) + /* "spavro/fast_binary.pyx":794 + * writer is a Python object on which we can call write. + * """ + * self.writer = writer # <<<<<<<<<<<<<< + * + * def write(self, datum): */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_six); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 661, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_string_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 661, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = PyObject_IsInstance(__pyx_v_datum, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 661, __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)) { + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_writer, __pyx_v_writer) < 0) __PYX_ERR(0, 794, __pyx_L1_error) - /* "spavro/fast_binary.pyx":662 - * def checked_string_writer(outbuf, datum): - * if not isinstance(datum, six.string_types): - * raise TypeError("{} - is not a string value. Schema: {}".format(repr(datum), schema)) # <<<<<<<<<<<<<< - * write_utf8(outbuf, datum) - * return checked_string_writer - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_is_not_a_string_value_Schema, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 662, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyObject_Repr(__pyx_v_datum); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 662, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(!__pyx_cur_scope->__pyx_v_schema)) { __Pyx_RaiseClosureNameError("schema"); __PYX_ERR(0, 662, __pyx_L1_error) } - __pyx_t_6 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_5, __pyx_cur_scope->__pyx_v_schema}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 662, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_5, __pyx_cur_scope->__pyx_v_schema}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 662, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 662, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__pyx_t_6) { - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; - } - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_5); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_cur_scope->__pyx_v_schema); - __pyx_t_5 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 662, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 662, __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, 662, __pyx_L1_error) - - /* "spavro/fast_binary.pyx":661 - * def make_string_writer(schema): - * def checked_string_writer(outbuf, datum): - * if not isinstance(datum, six.string_types): # <<<<<<<<<<<<<< - * raise TypeError("{} - is not a string value. Schema: {}".format(repr(datum), schema)) - * write_utf8(outbuf, datum) - */ - } - - /* "spavro/fast_binary.pyx":663 - * if not isinstance(datum, six.string_types): - * raise TypeError("{} - is not a string value. Schema: {}".format(repr(datum), schema)) - * write_utf8(outbuf, datum) # <<<<<<<<<<<<<< - * return checked_string_writer - * - */ - __pyx_f_6spavro_11fast_binary_write_utf8(__pyx_v_outbuf, __pyx_v_datum); - - /* "spavro/fast_binary.pyx":660 - * - * def make_string_writer(schema): - * def checked_string_writer(outbuf, datum): # <<<<<<<<<<<<<< - * if not isinstance(datum, six.string_types): - * raise TypeError("{} - is not a string value. Schema: {}".format(repr(datum), schema)) + /* "spavro/fast_binary.pyx":790 + * class FastBinaryEncoder(object): + * """Write leaf values.""" + * def __init__(self, writer): # <<<<<<<<<<<<<< + * """ + * writer is a Python object on which we can call write. */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("spavro.fast_binary.make_string_writer.checked_string_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "spavro/fast_binary.pyx":659 - * - * - * def make_string_writer(schema): # <<<<<<<<<<<<<< - * def checked_string_writer(outbuf, datum): - * if not isinstance(datum, six.string_types): - */ - -static PyObject *__pyx_pf_6spavro_11fast_binary_84make_string_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer *__pyx_cur_scope; - PyObject *__pyx_v_checked_string_writer = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("make_string_writer", 0); - __pyx_cur_scope = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer *)__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer(__pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(0, 659, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } - __pyx_cur_scope->__pyx_v_schema = __pyx_v_schema; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema); - - /* "spavro/fast_binary.pyx":660 - * - * def make_string_writer(schema): - * def checked_string_writer(outbuf, datum): # <<<<<<<<<<<<<< - * if not isinstance(datum, six.string_types): - * raise TypeError("{} - is not a string value. Schema: {}".format(repr(datum), schema)) - */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_18make_string_writer_1checked_string_writer, 0, __pyx_n_s_make_string_writer_locals_checke, ((PyObject*)__pyx_cur_scope), __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__55)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_checked_string_writer = __pyx_t_1; - __pyx_t_1 = 0; - - /* "spavro/fast_binary.pyx":664 - * raise TypeError("{} - is not a string value. Schema: {}".format(repr(datum), schema)) - * write_utf8(outbuf, datum) - * return checked_string_writer # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_checked_string_writer); - __pyx_r = __pyx_v_checked_string_writer; - goto __pyx_L0; - - /* "spavro/fast_binary.pyx":659 - * - * - * def make_string_writer(schema): # <<<<<<<<<<<<<< - * def checked_string_writer(outbuf, datum): - * if not isinstance(datum, six.string_types): - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("spavro.fast_binary.make_string_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_checked_string_writer); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":667 - * +/* "spavro/fast_binary.pyx":796 + * self.writer = writer * - * def make_byte_writer(schema): # <<<<<<<<<<<<<< - * return write_bytes + * def write(self, datum): # <<<<<<<<<<<<<< + * self.writer.write(datum) * */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_87make_byte_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_87make_byte_writer = {"make_byte_writer", (PyCFunction)__pyx_pw_6spavro_11fast_binary_87make_byte_writer, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_87make_byte_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema) { +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_3write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_3write = {"write", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_3write, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_3write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_datum = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("make_byte_writer (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_86make_byte_writer(__pyx_self, ((PyObject *)__pyx_v_schema)); + __Pyx_RefNannySetupContext("write (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_datum,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_datum)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("write", 1, 2, 2, 1); __PYX_ERR(0, 796, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write") < 0)) __PYX_ERR(0, 796, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_self = values[0]; + __pyx_v_datum = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("write", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 796, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_2write(__pyx_self, __pyx_v_self, __pyx_v_datum); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_86make_byte_writer(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema) { +static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_2write(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_datum) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("make_byte_writer", 0); + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write", 0); - /* "spavro/fast_binary.pyx":668 - * - * def make_byte_writer(schema): - * return write_bytes # <<<<<<<<<<<<<< + /* "spavro/fast_binary.pyx":797 * + * def write(self, datum): + * self.writer.write(datum) # <<<<<<<<<<<<<< * + * def write_null(self, datum): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_CFunc_void____object____object___to_py(__pyx_f_6spavro_11fast_binary_write_bytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 668, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_writer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 797, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 797, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_datum) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_datum); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 797, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":667 - * + /* "spavro/fast_binary.pyx":796 + * self.writer = writer * - * def make_byte_writer(schema): # <<<<<<<<<<<<<< - * return write_bytes + * def write(self, datum): # <<<<<<<<<<<<<< + * self.writer.write(datum) * */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("spavro.fast_binary.make_byte_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -17988,230 +16888,195 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_86make_byte_writer(CYTHON_UNUSED return __pyx_r; } -/* "spavro/fast_binary.pyx":671 - * +/* "spavro/fast_binary.pyx":799 + * self.writer.write(datum) * - * def make_float_writer(schema): # <<<<<<<<<<<<<< - * return write_float + * def write_null(self, datum): # <<<<<<<<<<<<<< + * pass * */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_89make_float_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_89make_float_writer = {"make_float_writer", (PyCFunction)__pyx_pw_6spavro_11fast_binary_89make_float_writer, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_89make_float_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema) { +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_5write_null(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_5write_null = {"write_null", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_5write_null, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_5write_null(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + CYTHON_UNUSED PyObject *__pyx_v_self = 0; + CYTHON_UNUSED PyObject *__pyx_v_datum = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("make_float_writer (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_88make_float_writer(__pyx_self, ((PyObject *)__pyx_v_schema)); + __Pyx_RefNannySetupContext("write_null (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_datum,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_datum)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("write_null", 1, 2, 2, 1); __PYX_ERR(0, 799, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write_null") < 0)) __PYX_ERR(0, 799, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_self = values[0]; + __pyx_v_datum = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("write_null", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 799, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_null", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_4write_null(__pyx_self, __pyx_v_self, __pyx_v_datum); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_88make_float_writer(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema) { +static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_4write_null(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_datum) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("make_float_writer", 0); + __Pyx_RefNannySetupContext("write_null", 0); - /* "spavro/fast_binary.pyx":672 - * - * def make_float_writer(schema): - * return write_float # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spavro/fast_binary.pyx":802 + * pass * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_CFunc_void____object____float___to_py(__pyx_f_6spavro_11fast_binary_write_float); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 672, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "spavro/fast_binary.pyx":671 - * - * - * def make_float_writer(schema): # <<<<<<<<<<<<<< - * return write_float - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("spavro.fast_binary.make_float_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "spavro/fast_binary.pyx":675 - * - * - * def make_double_writer(schema): # <<<<<<<<<<<<<< - * return write_double + * def write_boolean(self, datum): # <<<<<<<<<<<<<< + * write_boolean(self.writer, datum) * */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_91make_double_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_91make_double_writer = {"make_double_writer", (PyCFunction)__pyx_pw_6spavro_11fast_binary_91make_double_writer, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_91make_double_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema) { +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_7write_boolean(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_7write_boolean = {"write_boolean", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_7write_boolean, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_7write_boolean(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_datum = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("make_double_writer (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_90make_double_writer(__pyx_self, ((PyObject *)__pyx_v_schema)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_6spavro_11fast_binary_90make_double_writer(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("make_double_writer", 0); - - /* "spavro/fast_binary.pyx":676 - * - * def make_double_writer(schema): - * return write_double # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_CFunc_void____object____double___to_py(__pyx_f_6spavro_11fast_binary_write_double); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 676, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "spavro/fast_binary.pyx":675 - * - * - * def make_double_writer(schema): # <<<<<<<<<<<<<< - * return write_double - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("spavro.fast_binary.make_double_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannySetupContext("write_boolean (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_datum,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_datum)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("write_boolean", 1, 2, 2, 1); __PYX_ERR(0, 802, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write_boolean") < 0)) __PYX_ERR(0, 802, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_self = values[0]; + __pyx_v_datum = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("write_boolean", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 802, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_boolean", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "spavro/fast_binary.pyx":679 - * - * - * def make_null_writer(schema): # <<<<<<<<<<<<<< - * return write_null - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_93make_null_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_93make_null_writer = {"make_null_writer", (PyCFunction)__pyx_pw_6spavro_11fast_binary_93make_null_writer, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_93make_null_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("make_null_writer (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_92make_null_writer(__pyx_self, ((PyObject *)__pyx_v_schema)); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_6write_boolean(__pyx_self, __pyx_v_self, __pyx_v_datum); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_92make_null_writer(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_schema) { +static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_6write_boolean(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_datum) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("make_null_writer", 0); + char __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write_boolean", 0); - /* "spavro/fast_binary.pyx":680 - * - * def make_null_writer(schema): - * return write_null # <<<<<<<<<<<<<< + /* "spavro/fast_binary.pyx":803 * + * def write_boolean(self, datum): + * write_boolean(self.writer, datum) # <<<<<<<<<<<<<< * + * def write_int(self, datum): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_CFunc_void____object____object___to_py(__pyx_f_6spavro_11fast_binary_write_null); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 680, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 803, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "spavro/fast_binary.pyx":679 - * - * - * def make_null_writer(schema): # <<<<<<<<<<<<<< - * return write_null - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("spavro.fast_binary.make_null_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "spavro/fast_binary.pyx":704 - * - * class WriterPlaceholder(object): - * def __init__(self): # <<<<<<<<<<<<<< - * self.writer = None - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17WriterPlaceholder_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17WriterPlaceholder_1__init__ = {"__init__", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17WriterPlaceholder_1__init__, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17WriterPlaceholder_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_17WriterPlaceholder___init__(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_6spavro_11fast_binary_17WriterPlaceholder___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__", 0); - - /* "spavro/fast_binary.pyx":705 - * class WriterPlaceholder(object): - * def __init__(self): - * self.writer = None # <<<<<<<<<<<<<< - * - * def __call__(self, fo, val): - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_writer, Py_None) < 0) __PYX_ERR(0, 705, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_As_char(__pyx_v_datum); if (unlikely((__pyx_t_2 == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 803, __pyx_L1_error) + __pyx_t_3 = __pyx_f_6spavro_11fast_binary_write_boolean(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 803, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":704 + /* "spavro/fast_binary.pyx":802 + * pass * - * class WriterPlaceholder(object): - * def __init__(self): # <<<<<<<<<<<<<< - * self.writer = None + * def write_boolean(self, datum): # <<<<<<<<<<<<<< + * write_boolean(self.writer, datum) * */ @@ -18219,7 +17084,9 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17WriterPlaceholder___init__(CYT __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("spavro.fast_binary.WriterPlaceholder.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_boolean", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -18227,33 +17094,33 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17WriterPlaceholder___init__(CYT return __pyx_r; } -/* "spavro/fast_binary.pyx":707 - * self.writer = None +/* "spavro/fast_binary.pyx":805 + * write_boolean(self.writer, datum) * - * def __call__(self, fo, val): # <<<<<<<<<<<<<< - * return self.writer(fo, val) + * def write_int(self, datum): # <<<<<<<<<<<<<< + * write_int(self.writer, datum) * */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17WriterPlaceholder_3__call__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17WriterPlaceholder_3__call__ = {"__call__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17WriterPlaceholder_3__call__, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17WriterPlaceholder_3__call__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_9write_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_9write_int = {"write_int", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_9write_int, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_9write_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_fo = 0; - PyObject *__pyx_v_val = 0; + PyObject *__pyx_v_datum = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__call__ (wrapper)", 0); + __Pyx_RefNannySetupContext("write_int (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_fo,&__pyx_n_s_val,0}; - PyObject* values[3] = {0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_datum,0}; + PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -18268,130 +17135,247 @@ static PyObject *__pyx_pw_6spavro_11fast_binary_17WriterPlaceholder_3__call__(Py else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fo)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__call__", 1, 3, 3, 1); __PYX_ERR(0, 707, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_val)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_datum)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__call__", 1, 3, 3, 2); __PYX_ERR(0, 707, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("write_int", 1, 2, 2, 1); __PYX_ERR(0, 805, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) __PYX_ERR(0, 707, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write_int") < 0)) __PYX_ERR(0, 805, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } __pyx_v_self = values[0]; - __pyx_v_fo = values[1]; - __pyx_v_val = values[2]; + __pyx_v_datum = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__call__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 707, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("write_int", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 805, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("spavro.fast_binary.WriterPlaceholder.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_int", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6spavro_11fast_binary_17WriterPlaceholder_2__call__(__pyx_self, __pyx_v_self, __pyx_v_fo, __pyx_v_val); + __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_8write_int(__pyx_self, __pyx_v_self, __pyx_v_datum); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_17WriterPlaceholder_2__call__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fo, PyObject *__pyx_v_val) { +static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_8write_int(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_datum) { 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; - __Pyx_RefNannySetupContext("__call__", 0); + PY_LONG_LONG __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write_int", 0); - /* "spavro/fast_binary.pyx":708 - * - * def __call__(self, fo, val): - * return self.writer(fo, val) # <<<<<<<<<<<<<< + /* "spavro/fast_binary.pyx":806 * + * def write_int(self, datum): + * write_int(self.writer, datum) # <<<<<<<<<<<<<< * + * def write_long(self, datum): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_writer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 708, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - __pyx_t_4 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 806, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_As_PY_LONG_LONG(__pyx_v_datum); if (unlikely((__pyx_t_2 == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 806, __pyx_L1_error) + __pyx_f_6spavro_11fast_binary_write_int(__pyx_t_1, __pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spavro/fast_binary.pyx":805 + * write_boolean(self.writer, datum) + * + * def write_int(self, datum): # <<<<<<<<<<<<<< + * write_int(self.writer, datum) + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_int", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spavro/fast_binary.pyx":808 + * write_int(self.writer, datum) + * + * def write_long(self, datum): # <<<<<<<<<<<<<< + * write_long(self.writer, datum) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_11write_long(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_11write_long = {"write_long", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_11write_long, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_11write_long(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_datum = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write_long (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_datum,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_datum)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("write_long", 1, 2, 2, 1); __PYX_ERR(0, 808, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write_long") < 0)) __PYX_ERR(0, 808, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_self = values[0]; + __pyx_v_datum = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("write_long", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 808, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_long", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_10write_long(__pyx_self, __pyx_v_self, __pyx_v_datum); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_10write_long(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_datum) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write_long", 0); + + /* "spavro/fast_binary.pyx":809 + * + * def write_long(self, datum): + * write_long(self.writer, datum) # <<<<<<<<<<<<<< + * + * def write_float(self, datum): + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_write_long); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 809, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_writer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 809, __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_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_fo, __pyx_v_val}; - __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, 708, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_v_datum}; + __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, 809, __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_3, __pyx_v_fo, __pyx_v_val}; - __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, 708, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_v_datum}; + __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, 809, __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_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 708, __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_INCREF(__pyx_v_fo); - __Pyx_GIVEREF(__pyx_v_fo); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_fo); - __Pyx_INCREF(__pyx_v_val); - __Pyx_GIVEREF(__pyx_v_val); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_val); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 708, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 809, __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_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_3); + __Pyx_INCREF(__pyx_v_datum); + __Pyx_GIVEREF(__pyx_v_datum); + PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_datum); + __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, 809, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":707 - * self.writer = None + /* "spavro/fast_binary.pyx":808 + * write_int(self.writer, datum) * - * def __call__(self, fo, val): # <<<<<<<<<<<<<< - * return self.writer(fo, val) + * def write_long(self, datum): # <<<<<<<<<<<<<< + * write_long(self.writer, datum) * */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("spavro.fast_binary.WriterPlaceholder.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_long", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -18399,506 +17383,262 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17WriterPlaceholder_2__call__(CY return __pyx_r; } -/* "spavro/fast_binary.pyx":711 - * +/* "spavro/fast_binary.pyx":811 + * write_long(self.writer, datum) * - * def get_writer(schema): # <<<<<<<<<<<<<< - * cdef unicode schema_type = get_type(schema) + * def write_float(self, datum): # <<<<<<<<<<<<<< + * write_float(self.writer, datum) * */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_95get_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_95get_writer = {"get_writer", (PyCFunction)__pyx_pw_6spavro_11fast_binary_95get_writer, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_95get_writer(PyObject *__pyx_self, PyObject *__pyx_v_schema) { +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_13write_float(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_13write_float = {"write_float", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_13write_float, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_13write_float(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_datum = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_writer (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_94get_writer(__pyx_self, ((PyObject *)__pyx_v_schema)); + __Pyx_RefNannySetupContext("write_float (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_datum,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_datum)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("write_float", 1, 2, 2, 1); __PYX_ERR(0, 811, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write_float") < 0)) __PYX_ERR(0, 811, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_self = values[0]; + __pyx_v_datum = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("write_float", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 811, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_float", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_12write_float(__pyx_self, __pyx_v_self, __pyx_v_datum); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_94get_writer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_schema) { - PyObject *__pyx_v_schema_type = 0; - PyObject *__pyx_v_placeholder = NULL; - PyObject *__pyx_v_namespace = NULL; - PyObject *__pyx_v_name = NULL; - PyObject *__pyx_v_fullname = NULL; - PyObject *__pyx_v_writer = NULL; +static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_12write_float(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_datum) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - int __pyx_t_11; - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - __Pyx_RefNannySetupContext("get_writer", 0); + float __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write_float", 0); - /* "spavro/fast_binary.pyx":712 + /* "spavro/fast_binary.pyx":812 * - * def get_writer(schema): - * cdef unicode schema_type = get_type(schema) # <<<<<<<<<<<<<< + * def write_float(self, datum): + * write_float(self.writer, datum) # <<<<<<<<<<<<<< * - * if schema_type in ('record', 'fixed', 'enum'): + * def write_double(self, datum): */ - __pyx_t_1 = __pyx_f_6spavro_11fast_binary_get_type(__pyx_v_schema, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 712, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 812, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_v_schema_type = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "spavro/fast_binary.pyx":714 - * cdef unicode schema_type = get_type(schema) + __pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_v_datum); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 812, __pyx_L1_error) + __pyx_f_6spavro_11fast_binary_write_float(__pyx_t_1, __pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spavro/fast_binary.pyx":811 + * write_long(self.writer, datum) + * + * def write_float(self, datum): # <<<<<<<<<<<<<< + * write_float(self.writer, datum) * - * if schema_type in ('record', 'fixed', 'enum'): # <<<<<<<<<<<<<< - * placeholder = WriterPlaceholder() - * # using a placeholder because this is recursive and the writer isn't defined */ - __Pyx_INCREF(__pyx_v_schema_type); - __pyx_t_2 = __pyx_v_schema_type; - __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_n_s_record, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 714, __pyx_L1_error) - __pyx_t_5 = (__pyx_t_4 != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_n_s_fixed, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 714, __pyx_L1_error) - __pyx_t_4 = (__pyx_t_5 != 0); - if (!__pyx_t_4) { - } else { - __pyx_t_3 = __pyx_t_4; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_n_s_enum, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 714, __pyx_L1_error) - __pyx_t_5 = (__pyx_t_4 != 0); - __pyx_t_3 = __pyx_t_5; - __pyx_L4_bool_binop_done:; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = (__pyx_t_3 != 0); - if (__pyx_t_5) { - /* "spavro/fast_binary.pyx":715 + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_float", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spavro/fast_binary.pyx":814 + * write_float(self.writer, datum) + * + * def write_double(self, datum): # <<<<<<<<<<<<<< + * write_double(self.writer, datum) * - * if schema_type in ('record', 'fixed', 'enum'): - * placeholder = WriterPlaceholder() # <<<<<<<<<<<<<< - * # using a placeholder because this is recursive and the writer isn't defined - * # yet and nested records might refer to this parent schema name */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_WriterPlaceholder); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 715, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 715, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_placeholder = __pyx_t_1; - __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":718 - * # using a placeholder because this is recursive and the writer isn't defined - * # yet and nested records might refer to this parent schema name - * namespace = schema.get('namespace') # <<<<<<<<<<<<<< - * name = schema.get('name') - * if namespace and "." not in name: - */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_schema, __pyx_n_s_get); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 718, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); +/* Python wrapper */ +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_15write_double(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_15write_double = {"write_double", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_15write_double, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_15write_double(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_datum = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write_double (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_datum,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } - __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_n_s_namespace) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_n_s_namespace); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 718, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_namespace = __pyx_t_1; - __pyx_t_1 = 0; - - /* "spavro/fast_binary.pyx":719 - * # yet and nested records might refer to this parent schema name - * namespace = schema.get('namespace') - * name = schema.get('name') # <<<<<<<<<<<<<< - * if namespace and "." not in name: - * fullname = '.'.join([namespace, name]) - */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_schema, __pyx_n_s_get); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 719, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_datum)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("write_double", 1, 2, 2, 1); __PYX_ERR(0, 814, __pyx_L3_error) + } } - } - __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_n_s_name) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_n_s_name); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 719, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_name = __pyx_t_1; - __pyx_t_1 = 0; - - /* "spavro/fast_binary.pyx":720 - * namespace = schema.get('namespace') - * name = schema.get('name') - * if namespace and "." not in name: # <<<<<<<<<<<<<< - * fullname = '.'.join([namespace, name]) - * else: - */ - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_namespace); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 720, __pyx_L1_error) - if (__pyx_t_3) { + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write_double") < 0)) __PYX_ERR(0, 814, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; } else { - __pyx_t_5 = __pyx_t_3; - goto __pyx_L8_bool_binop_done; + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_kp_s__19, __pyx_v_name, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 720, __pyx_L1_error) - __pyx_t_4 = (__pyx_t_3 != 0); - __pyx_t_5 = __pyx_t_4; - __pyx_L8_bool_binop_done:; - if (__pyx_t_5) { - - /* "spavro/fast_binary.pyx":721 - * name = schema.get('name') - * if namespace and "." not in name: - * fullname = '.'.join([namespace, name]) # <<<<<<<<<<<<<< - * else: - * fullname = name - */ - __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 721, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_namespace); - __Pyx_GIVEREF(__pyx_v_namespace); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_namespace); - __Pyx_INCREF(__pyx_v_name); - __Pyx_GIVEREF(__pyx_v_name); - PyList_SET_ITEM(__pyx_t_1, 1, __pyx_v_name); - __pyx_t_6 = __Pyx_PyString_Join(__pyx_kp_s__19, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 721, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_fullname = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_v_self = values[0]; + __pyx_v_datum = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("write_double", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 814, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_double", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_14write_double(__pyx_self, __pyx_v_self, __pyx_v_datum); - /* "spavro/fast_binary.pyx":720 - * namespace = schema.get('namespace') - * name = schema.get('name') - * if namespace and "." not in name: # <<<<<<<<<<<<<< - * fullname = '.'.join([namespace, name]) - * else: - */ - goto __pyx_L7; - } + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "spavro/fast_binary.pyx":723 - * fullname = '.'.join([namespace, name]) - * else: - * fullname = name # <<<<<<<<<<<<<< - * custom_schema[fullname] = schema - * schema_cache[fullname] = placeholder - */ - /*else*/ { - __Pyx_INCREF(__pyx_v_name); - __pyx_v_fullname = __pyx_v_name; - } - __pyx_L7:; +static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_14write_double(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_datum) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + double __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write_double", 0); - /* "spavro/fast_binary.pyx":724 - * else: - * fullname = name - * custom_schema[fullname] = schema # <<<<<<<<<<<<<< - * schema_cache[fullname] = placeholder - * writer = writer_type_map[schema_type](schema) + /* "spavro/fast_binary.pyx":815 + * + * def write_double(self, datum): + * write_double(self.writer, datum) # <<<<<<<<<<<<<< + * + * def write_bytes(self, datum): */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_custom_schema); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (unlikely(PyObject_SetItem(__pyx_t_6, __pyx_v_fullname, __pyx_v_schema) < 0)) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 815, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_datum); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 815, __pyx_L1_error) + __pyx_f_6spavro_11fast_binary_write_double(__pyx_t_1, __pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":725 - * fullname = name - * custom_schema[fullname] = schema - * schema_cache[fullname] = placeholder # <<<<<<<<<<<<<< - * writer = writer_type_map[schema_type](schema) - * # now that we've returned, assign the writer to the placeholder - */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_schema_cache); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 725, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (unlikely(PyObject_SetItem(__pyx_t_6, __pyx_v_fullname, __pyx_v_placeholder) < 0)) __PYX_ERR(0, 725, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "spavro/fast_binary.pyx":726 - * custom_schema[fullname] = schema - * schema_cache[fullname] = placeholder - * writer = writer_type_map[schema_type](schema) # <<<<<<<<<<<<<< - * # now that we've returned, assign the writer to the placeholder - * # so that the execution will work - */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_writer_type_map); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 726, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_v_schema_type); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 726, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - __pyx_t_6 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_1, __pyx_v_schema) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_schema); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 726, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_v_writer = __pyx_t_6; - __pyx_t_6 = 0; - - /* "spavro/fast_binary.pyx":729 - * # now that we've returned, assign the writer to the placeholder - * # so that the execution will work - * placeholder.writer = writer # <<<<<<<<<<<<<< - * return writer - * try: - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_placeholder, __pyx_n_s_writer, __pyx_v_writer) < 0) __PYX_ERR(0, 729, __pyx_L1_error) - - /* "spavro/fast_binary.pyx":730 - * # so that the execution will work - * placeholder.writer = writer - * return writer # <<<<<<<<<<<<<< - * try: - * writer = writer_type_map[schema_type](schema) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_writer); - __pyx_r = __pyx_v_writer; - goto __pyx_L0; - - /* "spavro/fast_binary.pyx":714 - * cdef unicode schema_type = get_type(schema) - * - * if schema_type in ('record', 'fixed', 'enum'): # <<<<<<<<<<<<<< - * placeholder = WriterPlaceholder() - * # using a placeholder because this is recursive and the writer isn't defined - */ - } - - /* "spavro/fast_binary.pyx":731 - * placeholder.writer = writer - * return writer - * try: # <<<<<<<<<<<<<< - * writer = writer_type_map[schema_type](schema) - * except KeyError: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_10); - /*try:*/ { - - /* "spavro/fast_binary.pyx":732 - * return writer - * try: - * writer = writer_type_map[schema_type](schema) # <<<<<<<<<<<<<< - * except KeyError: - * # lookup the schema by unique previously defined name, - */ - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_writer_type_map); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 732, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_7, __pyx_v_schema_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 732, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_7, __pyx_v_schema) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_schema); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 732, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_writer = __pyx_t_6; - __pyx_t_6 = 0; - - /* "spavro/fast_binary.pyx":731 - * placeholder.writer = writer - * return writer - * try: # <<<<<<<<<<<<<< - * writer = writer_type_map[schema_type](schema) - * except KeyError: - */ - } - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - goto __pyx_L15_try_end; - __pyx_L10_error:; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "spavro/fast_binary.pyx":733 - * try: - * writer = writer_type_map[schema_type](schema) - * except KeyError: # <<<<<<<<<<<<<< - * # lookup the schema by unique previously defined name, - * # i.e. a custom type - */ - __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError); - if (__pyx_t_11) { - __Pyx_AddTraceback("spavro.fast_binary.get_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_1, &__pyx_t_7) < 0) __PYX_ERR(0, 733, __pyx_L12_except_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_7); - - /* "spavro/fast_binary.pyx":736 - * # lookup the schema by unique previously defined name, - * # i.e. a custom type - * writer = schema_cache[schema_type] # <<<<<<<<<<<<<< - * - * return writer - */ - __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_schema_cache); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 736, __pyx_L12_except_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_13 = __Pyx_PyObject_Dict_GetItem(__pyx_t_12, __pyx_v_schema_type); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 736, __pyx_L12_except_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_XDECREF_SET(__pyx_v_writer, __pyx_t_13); - __pyx_t_13 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L11_exception_handled; - } - goto __pyx_L12_except_error; - __pyx_L12_except_error:; - - /* "spavro/fast_binary.pyx":731 - * placeholder.writer = writer - * return writer - * try: # <<<<<<<<<<<<<< - * writer = writer_type_map[schema_type](schema) - * except KeyError: - */ - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10); - goto __pyx_L1_error; - __pyx_L11_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10); - __pyx_L15_try_end:; - } - - /* "spavro/fast_binary.pyx":738 - * writer = schema_cache[schema_type] - * - * return writer # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_writer); - __pyx_r = __pyx_v_writer; - goto __pyx_L0; - - /* "spavro/fast_binary.pyx":711 - * - * - * def get_writer(schema): # <<<<<<<<<<<<<< - * cdef unicode schema_type = get_type(schema) - * + /* "spavro/fast_binary.pyx":814 + * write_float(self.writer, datum) + * + * def write_double(self, datum): # <<<<<<<<<<<<<< + * write_double(self.writer, datum) + * */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_AddTraceback("spavro.fast_binary.get_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_double", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_schema_type); - __Pyx_XDECREF(__pyx_v_placeholder); - __Pyx_XDECREF(__pyx_v_namespace); - __Pyx_XDECREF(__pyx_v_name); - __Pyx_XDECREF(__pyx_v_fullname); - __Pyx_XDECREF(__pyx_v_writer); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":747 - * class FastBinaryEncoder(object): - * """Write leaf values.""" - * def __init__(self, writer): # <<<<<<<<<<<<<< - * """ - * writer is a Python object on which we can call write. +/* "spavro/fast_binary.pyx":817 + * write_double(self.writer, datum) + * + * def write_bytes(self, datum): # <<<<<<<<<<<<<< + * write_bytes(self.writer, datum) + * */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6spavro_11fast_binary_17FastBinaryEncoder___init__[] = "\n writer is a Python object on which we can call write.\n "; -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_1__init__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6spavro_11fast_binary_17FastBinaryEncoder___init__}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_17write_bytes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_17write_bytes = {"write_bytes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_17write_bytes, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_17write_bytes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_writer = 0; + PyObject *__pyx_v_datum = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + __Pyx_RefNannySetupContext("write_bytes (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_writer,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_datum,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -18918,13 +17658,13 @@ static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_1__init__(Py else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_writer)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_datum)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 747, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("write_bytes", 1, 2, 2, 1); __PYX_ERR(0, 817, __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, 747, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write_bytes") < 0)) __PYX_ERR(0, 817, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -18933,50 +17673,58 @@ static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_1__init__(Py values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_self = values[0]; - __pyx_v_writer = values[1]; + __pyx_v_datum = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 747, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("write_bytes", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 817, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder___init__(__pyx_self, __pyx_v_self, __pyx_v_writer); + __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_16write_bytes(__pyx_self, __pyx_v_self, __pyx_v_datum); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_writer) { +static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_16write_bytes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_datum) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__", 0); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write_bytes", 0); - /* "spavro/fast_binary.pyx":751 - * writer is a Python object on which we can call write. - * """ - * self.writer = writer # <<<<<<<<<<<<<< + /* "spavro/fast_binary.pyx":818 * - * def write(self, datum): + * def write_bytes(self, datum): + * write_bytes(self.writer, datum) # <<<<<<<<<<<<<< + * + * def write_utf8(self, datum): */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_writer, __pyx_v_writer) < 0) __PYX_ERR(0, 751, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 818, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_f_6spavro_11fast_binary_write_bytes(__pyx_t_1, __pyx_v_datum); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":747 - * class FastBinaryEncoder(object): - * """Write leaf values.""" - * def __init__(self, writer): # <<<<<<<<<<<<<< - * """ - * writer is a Python object on which we can call write. + /* "spavro/fast_binary.pyx":817 + * write_double(self.writer, datum) + * + * def write_bytes(self, datum): # <<<<<<<<<<<<<< + * write_bytes(self.writer, datum) + * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -18984,23 +17732,26 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder___init__(CYT return __pyx_r; } -/* "spavro/fast_binary.pyx":753 - * self.writer = writer +/* "spavro/fast_binary.pyx":820 + * write_bytes(self.writer, datum) * - * def write(self, datum): # <<<<<<<<<<<<<< - * self.writer.write(datum) + * def write_utf8(self, datum): # <<<<<<<<<<<<<< + * write_utf8(self.writer, datum) * */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_3write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_3write = {"write", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_3write, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_3write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_19write_utf8(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_19write_utf8 = {"write_utf8", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_19write_utf8, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_19write_utf8(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; PyObject *__pyx_v_datum = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write (wrapper)", 0); + __Pyx_RefNannySetupContext("write_utf8 (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_datum,0}; PyObject* values[2] = {0,0}; @@ -19024,11 +17775,11 @@ static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_3write(PyObj case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_datum)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("write", 1, 2, 2, 1); __PYX_ERR(0, 753, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("write_utf8", 1, 2, 2, 1); __PYX_ERR(0, 820, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write") < 0)) __PYX_ERR(0, 753, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write_utf8") < 0)) __PYX_ERR(0, 820, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -19041,61 +17792,45 @@ static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_3write(PyObj } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("write", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 753, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("write_utf8", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 820, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_utf8", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_2write(__pyx_self, __pyx_v_self, __pyx_v_datum); + __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_18write_utf8(__pyx_self, __pyx_v_self, __pyx_v_datum); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_2write(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_datum) { +static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_18write_utf8(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_datum) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("write", 0); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write_utf8", 0); - /* "spavro/fast_binary.pyx":754 + /* "spavro/fast_binary.pyx":821 * - * def write(self, datum): - * self.writer.write(datum) # <<<<<<<<<<<<<< + * def write_utf8(self, datum): + * write_utf8(self.writer, datum) # <<<<<<<<<<<<<< * - * def write_null(self, datum): + * def write_crc32(self, bytes): */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_writer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 754, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 754, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_datum) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_datum); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 754, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 821, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_f_6spavro_11fast_binary_write_utf8(__pyx_t_1, __pyx_v_datum); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":753 - * self.writer = writer + /* "spavro/fast_binary.pyx":820 + * write_bytes(self.writer, datum) * - * def write(self, datum): # <<<<<<<<<<<<<< - * self.writer.write(datum) + * def write_utf8(self, datum): # <<<<<<<<<<<<<< + * write_utf8(self.writer, datum) * */ @@ -19104,9 +17839,7 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_2write(CYTHO goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_utf8", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -19114,25 +17847,29 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_2write(CYTHO return __pyx_r; } -/* "spavro/fast_binary.pyx":756 - * self.writer.write(datum) - * - * def write_null(self, datum): # <<<<<<<<<<<<<< - * pass +/* "spavro/fast_binary.pyx":823 + * write_utf8(self.writer, datum) * + * def write_crc32(self, bytes): # <<<<<<<<<<<<<< + * """ + * A 4-byte, big-endian CRC32 checksum */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_5write_null(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_5write_null = {"write_null", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_5write_null, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_5write_null(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - CYTHON_UNUSED PyObject *__pyx_v_self = 0; - CYTHON_UNUSED PyObject *__pyx_v_datum = 0; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_21write_crc32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6spavro_11fast_binary_17FastBinaryEncoder_20write_crc32[] = "\n A 4-byte, big-endian CRC32 checksum\n "; +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_21write_crc32 = {"write_crc32", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_21write_crc32, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6spavro_11fast_binary_17FastBinaryEncoder_20write_crc32}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_21write_crc32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_bytes = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write_null (wrapper)", 0); + __Pyx_RefNannySetupContext("write_crc32 (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_datum,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_bytes,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -19152,13 +17889,13 @@ static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_5write_null( else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_datum)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bytes)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("write_null", 1, 2, 2, 1); __PYX_ERR(0, 756, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("write_crc32", 1, 2, 2, 1); __PYX_ERR(0, 823, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write_null") < 0)) __PYX_ERR(0, 756, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write_crc32") < 0)) __PYX_ERR(0, 823, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -19167,54 +17904,191 @@ static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_5write_null( values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_self = values[0]; - __pyx_v_datum = values[1]; + __pyx_v_bytes = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("write_null", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 756, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("write_crc32", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 823, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_null", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_crc32", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_4write_null(__pyx_self, __pyx_v_self, __pyx_v_datum); + __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_20write_crc32(__pyx_self, __pyx_v_self, __pyx_v_bytes); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_4write_null(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_datum) { +static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_20write_crc32(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_bytes) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write_null", 0); + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write_crc32", 0); + + /* "spavro/fast_binary.pyx":827 + * A 4-byte, big-endian CRC32 checksum + * """ + * self.writer.write(struct.pack("!I", crc32(bytes) & 0xffffffff)) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_writer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 827, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 827, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_struct); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 827, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_pack); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 827, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_crc32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 827, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_bytes) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_bytes); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 827, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyNumber_And(__pyx_t_4, __pyx_int_4294967295); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 827, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + __pyx_t_8 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_8 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_s_I, __pyx_t_6}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 827, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_s_I, __pyx_t_6}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 827, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else + #endif + { + __pyx_t_7 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 827, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__pyx_t_4) { + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL; + } + __Pyx_INCREF(__pyx_kp_s_I); + __Pyx_GIVEREF(__pyx_kp_s_I); + PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_kp_s_I); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 827, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 827, __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; + + /* "spavro/fast_binary.pyx":823 + * write_utf8(self.writer, datum) + * + * def write_crc32(self, bytes): # <<<<<<<<<<<<<< + * """ + * A 4-byte, big-endian CRC32 checksum + */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_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_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_crc32", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":759 - * pass - * - * def write_boolean(self, datum): # <<<<<<<<<<<<<< - * write_boolean(self.writer, datum) - * +/* "spavro/fast_binary.pyx":833 + * class FastBinaryDecoder(object): + * """Read leaf values.""" + * def __init__(self, reader): # <<<<<<<<<<<<<< + * """ + * reader is a Python object on which we can call read, seek, and tell. */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_7write_boolean(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_7write_boolean = {"write_boolean", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_7write_boolean, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_7write_boolean(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6spavro_11fast_binary_17FastBinaryDecoder___init__[] = "\n reader is a Python object on which we can call read, seek, and tell.\n "; +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_1__init__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6spavro_11fast_binary_17FastBinaryDecoder___init__}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_datum = 0; + PyObject *__pyx_v_reader = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write_boolean (wrapper)", 0); + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_datum,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_reader,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -19234,13 +18108,13 @@ static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_7write_boole else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_datum)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reader)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("write_boolean", 1, 2, 2, 1); __PYX_ERR(0, 759, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 833, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write_boolean") < 0)) __PYX_ERR(0, 759, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 833, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -19249,61 +18123,53 @@ static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_7write_boole values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_self = values[0]; - __pyx_v_datum = values[1]; + __pyx_v_reader = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("write_boolean", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 759, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 833, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_boolean", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_6write_boolean(__pyx_self, __pyx_v_self, __pyx_v_datum); + __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder___init__(__pyx_self, __pyx_v_self, __pyx_v_reader); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_6write_boolean(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_datum) { +static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_reader) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - char __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("write_boolean", 0); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); - /* "spavro/fast_binary.pyx":760 - * - * def write_boolean(self, datum): - * write_boolean(self.writer, datum) # <<<<<<<<<<<<<< + /* "spavro/fast_binary.pyx":837 + * reader is a Python object on which we can call read, seek, and tell. + * """ + * self.reader = reader # <<<<<<<<<<<<<< * - * def write_int(self, datum): + * def read(self, n): */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 760, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_As_char(__pyx_v_datum); if (unlikely((__pyx_t_2 == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 760, __pyx_L1_error) - __pyx_t_3 = __pyx_f_6spavro_11fast_binary_write_boolean(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 760, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_reader, __pyx_v_reader) < 0) __PYX_ERR(0, 837, __pyx_L1_error) - /* "spavro/fast_binary.pyx":759 - * pass - * - * def write_boolean(self, datum): # <<<<<<<<<<<<<< - * write_boolean(self.writer, datum) - * + /* "spavro/fast_binary.pyx":833 + * class FastBinaryDecoder(object): + * """Read leaf values.""" + * def __init__(self, reader): # <<<<<<<<<<<<<< + * """ + * reader is a Python object on which we can call read, seek, and tell. */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_boolean", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -19311,25 +18177,28 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_6write_boole return __pyx_r; } -/* "spavro/fast_binary.pyx":762 - * write_boolean(self.writer, datum) +/* "spavro/fast_binary.pyx":839 + * self.reader = reader * - * def write_int(self, datum): # <<<<<<<<<<<<<< - * write_int(self.writer, datum) + * def read(self, n): # <<<<<<<<<<<<<< + * return self.reader.read(n) * */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_9write_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_9write_int = {"write_int", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_9write_int, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_9write_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_3read(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_3read = {"read", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_3read, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_3read(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_datum = 0; + PyObject *__pyx_v_n = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write_int (wrapper)", 0); + __Pyx_RefNannySetupContext("read (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_datum,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_n,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -19349,13 +18218,13 @@ static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_9write_int(P else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_datum)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("write_int", 1, 2, 2, 1); __PYX_ERR(0, 762, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("read", 1, 2, 2, 1); __PYX_ERR(0, 839, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write_int") < 0)) __PYX_ERR(0, 762, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read") < 0)) __PYX_ERR(0, 839, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -19364,57 +18233,80 @@ static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_9write_int(P values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_self = values[0]; - __pyx_v_datum = values[1]; + __pyx_v_n = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("write_int", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 762, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("read", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 839, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_int", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.read", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_8write_int(__pyx_self, __pyx_v_self, __pyx_v_datum); + __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_2read(__pyx_self, __pyx_v_self, __pyx_v_n); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_8write_int(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_datum) { +static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_2read(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_n) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PY_LONG_LONG __pyx_t_2; - __Pyx_RefNannySetupContext("write_int", 0); + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read", 0); - /* "spavro/fast_binary.pyx":763 + /* "spavro/fast_binary.pyx":840 * - * def write_int(self, datum): - * write_int(self.writer, datum) # <<<<<<<<<<<<<< + * def read(self, n): + * return self.reader.read(n) # <<<<<<<<<<<<<< * - * def write_long(self, datum): + * def read_null(self): */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 763, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 840, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_read); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 840, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_n) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_n); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 840, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_As_PY_LONG_LONG(__pyx_v_datum); if (unlikely((__pyx_t_2 == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 763, __pyx_L1_error) - __pyx_f_6spavro_11fast_binary_write_int(__pyx_t_1, __pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "spavro/fast_binary.pyx":762 - * write_boolean(self.writer, datum) + /* "spavro/fast_binary.pyx":839 + * self.reader = reader * - * def write_int(self, datum): # <<<<<<<<<<<<<< - * write_int(self.writer, datum) + * def read(self, n): # <<<<<<<<<<<<<< + * return self.reader.read(n) * */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_int", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.read", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -19422,276 +18314,121 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_8write_int(C return __pyx_r; } -/* "spavro/fast_binary.pyx":765 - * write_int(self.writer, datum) +/* "spavro/fast_binary.pyx":842 + * return self.reader.read(n) * - * def write_long(self, datum): # <<<<<<<<<<<<<< - * write_long(self.writer, datum) + * def read_null(self): # <<<<<<<<<<<<<< + * return None * */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_11write_long(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_11write_long = {"write_long", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_11write_long, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_11write_long(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_datum = 0; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_5read_null(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_5read_null = {"read_null", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_5read_null, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_5read_null(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write_long (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_datum,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_datum)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("write_long", 1, 2, 2, 1); __PYX_ERR(0, 765, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write_long") < 0)) __PYX_ERR(0, 765, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_self = values[0]; - __pyx_v_datum = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("write_long", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 765, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_long", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_10write_long(__pyx_self, __pyx_v_self, __pyx_v_datum); + __Pyx_RefNannySetupContext("read_null (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_4read_null(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_10write_long(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_datum) { +static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_4read_null(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - __Pyx_RefNannySetupContext("write_long", 0); + __Pyx_RefNannySetupContext("read_null", 0); - /* "spavro/fast_binary.pyx":766 + /* "spavro/fast_binary.pyx":843 * - * def write_long(self, datum): - * write_long(self.writer, datum) # <<<<<<<<<<<<<< + * def read_null(self): + * return None # <<<<<<<<<<<<<< * - * def write_float(self, datum): + * def read_boolean(self): */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_write_long); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 766, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_writer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 766, __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_t_3, __pyx_v_datum}; - __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, 766, __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_t_3, __pyx_v_datum}; - __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, 766, __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, 766, __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_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_3); - __Pyx_INCREF(__pyx_v_datum); - __Pyx_GIVEREF(__pyx_v_datum); - PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_datum); - __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, 766, __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_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; - /* "spavro/fast_binary.pyx":765 - * write_int(self.writer, datum) + /* "spavro/fast_binary.pyx":842 + * return self.reader.read(n) * - * def write_long(self, datum): # <<<<<<<<<<<<<< - * write_long(self.writer, datum) + * def read_null(self): # <<<<<<<<<<<<<< + * return None * */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_long", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":768 - * write_long(self.writer, datum) +/* "spavro/fast_binary.pyx":845 + * return None * - * def write_float(self, datum): # <<<<<<<<<<<<<< - * write_float(self.writer, datum) + * def read_boolean(self): # <<<<<<<<<<<<<< + * return read_boolean(self.reader) * */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_13write_float(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_13write_float = {"write_float", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_13write_float, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_13write_float(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_datum = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write_float (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_datum,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_datum)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("write_float", 1, 2, 2, 1); __PYX_ERR(0, 768, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write_float") < 0)) __PYX_ERR(0, 768, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_self = values[0]; - __pyx_v_datum = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("write_float", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 768, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_float", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_12write_float(__pyx_self, __pyx_v_self, __pyx_v_datum); +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_7read_boolean(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_7read_boolean = {"read_boolean", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_7read_boolean, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_7read_boolean(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("read_boolean (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_6read_boolean(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_12write_float(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_datum) { +static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_6read_boolean(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - float __pyx_t_2; - __Pyx_RefNannySetupContext("write_float", 0); + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read_boolean", 0); - /* "spavro/fast_binary.pyx":769 + /* "spavro/fast_binary.pyx":846 * - * def write_float(self, datum): - * write_float(self.writer, datum) # <<<<<<<<<<<<<< + * def read_boolean(self): + * return read_boolean(self.reader) # <<<<<<<<<<<<<< * - * def write_double(self, datum): + * def read_int(self): */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 769, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 846, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_v_datum); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 769, __pyx_L1_error) - __pyx_f_6spavro_11fast_binary_write_float(__pyx_t_1, __pyx_t_2); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_f_6spavro_11fast_binary_read_boolean(__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 846, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "spavro/fast_binary.pyx":768 - * write_long(self.writer, datum) + /* "spavro/fast_binary.pyx":845 + * return None * - * def write_float(self, datum): # <<<<<<<<<<<<<< - * write_float(self.writer, datum) + * def read_boolean(self): # <<<<<<<<<<<<<< + * return read_boolean(self.reader) * */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_float", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.read_boolean", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -19699,110 +18436,68 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_12write_floa return __pyx_r; } -/* "spavro/fast_binary.pyx":771 - * write_float(self.writer, datum) +/* "spavro/fast_binary.pyx":848 + * return read_boolean(self.reader) * - * def write_double(self, datum): # <<<<<<<<<<<<<< - * write_double(self.writer, datum) + * def read_int(self): # <<<<<<<<<<<<<< + * return read_long(self.reader) * */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_15write_double(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_15write_double = {"write_double", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_15write_double, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_15write_double(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_datum = 0; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_9read_int(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_9read_int = {"read_int", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_9read_int, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_9read_int(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write_double (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_datum,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_datum)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("write_double", 1, 2, 2, 1); __PYX_ERR(0, 771, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write_double") < 0)) __PYX_ERR(0, 771, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_self = values[0]; - __pyx_v_datum = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("write_double", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 771, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_double", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_14write_double(__pyx_self, __pyx_v_self, __pyx_v_datum); + __Pyx_RefNannySetupContext("read_int (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_8read_int(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_14write_double(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_datum) { +static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_8read_int(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - double __pyx_t_2; - __Pyx_RefNannySetupContext("write_double", 0); + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read_int", 0); - /* "spavro/fast_binary.pyx":772 + /* "spavro/fast_binary.pyx":849 * - * def write_double(self, datum): - * write_double(self.writer, datum) # <<<<<<<<<<<<<< + * def read_int(self): + * return read_long(self.reader) # <<<<<<<<<<<<<< * - * def write_bytes(self, datum): + * def read_long(self): */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 772, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 849, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_datum); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 772, __pyx_L1_error) - __pyx_f_6spavro_11fast_binary_write_double(__pyx_t_1, __pyx_t_2); + __pyx_t_2 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_f_6spavro_11fast_binary_read_long(__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 849, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "spavro/fast_binary.pyx":771 - * write_float(self.writer, datum) + /* "spavro/fast_binary.pyx":848 + * return read_boolean(self.reader) * - * def write_double(self, datum): # <<<<<<<<<<<<<< - * write_double(self.writer, datum) + * def read_int(self): # <<<<<<<<<<<<<< + * return read_long(self.reader) * */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_double", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.read_int", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -19810,108 +18505,68 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_14write_doub return __pyx_r; } -/* "spavro/fast_binary.pyx":774 - * write_double(self.writer, datum) +/* "spavro/fast_binary.pyx":851 + * return read_long(self.reader) * - * def write_bytes(self, datum): # <<<<<<<<<<<<<< - * write_bytes(self.writer, datum) + * def read_long(self): # <<<<<<<<<<<<<< + * return read_long(self.reader) * */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_17write_bytes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_17write_bytes = {"write_bytes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_17write_bytes, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_17write_bytes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_datum = 0; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_11read_long(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_11read_long = {"read_long", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_11read_long, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_11read_long(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write_bytes (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_datum,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_datum)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("write_bytes", 1, 2, 2, 1); __PYX_ERR(0, 774, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write_bytes") < 0)) __PYX_ERR(0, 774, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_self = values[0]; - __pyx_v_datum = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("write_bytes", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 774, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_16write_bytes(__pyx_self, __pyx_v_self, __pyx_v_datum); + __Pyx_RefNannySetupContext("read_long (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_10read_long(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_16write_bytes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_datum) { +static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_10read_long(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("write_bytes", 0); + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read_long", 0); - /* "spavro/fast_binary.pyx":775 + /* "spavro/fast_binary.pyx":852 * - * def write_bytes(self, datum): - * write_bytes(self.writer, datum) # <<<<<<<<<<<<<< + * def read_long(self): + * return read_long(self.reader) # <<<<<<<<<<<<<< * - * def write_utf8(self, datum): + * def read_float(self): */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 775, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 852, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_f_6spavro_11fast_binary_write_bytes(__pyx_t_1, __pyx_v_datum); + __pyx_t_2 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_f_6spavro_11fast_binary_read_long(__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 852, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "spavro/fast_binary.pyx":774 - * write_double(self.writer, datum) + /* "spavro/fast_binary.pyx":851 + * return read_long(self.reader) * - * def write_bytes(self, datum): # <<<<<<<<<<<<<< - * write_bytes(self.writer, datum) + * def read_long(self): # <<<<<<<<<<<<<< + * return read_long(self.reader) * */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.read_long", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -19919,108 +18574,68 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_16write_byte return __pyx_r; } -/* "spavro/fast_binary.pyx":777 - * write_bytes(self.writer, datum) +/* "spavro/fast_binary.pyx":854 + * return read_long(self.reader) * - * def write_utf8(self, datum): # <<<<<<<<<<<<<< - * write_utf8(self.writer, datum) + * def read_float(self): # <<<<<<<<<<<<<< + * return read_float(self.reader) * */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_19write_utf8(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_19write_utf8 = {"write_utf8", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_19write_utf8, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_19write_utf8(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_datum = 0; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_13read_float(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_13read_float = {"read_float", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_13read_float, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_13read_float(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write_utf8 (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_datum,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_datum)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("write_utf8", 1, 2, 2, 1); __PYX_ERR(0, 777, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write_utf8") < 0)) __PYX_ERR(0, 777, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_self = values[0]; - __pyx_v_datum = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("write_utf8", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 777, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_utf8", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_18write_utf8(__pyx_self, __pyx_v_self, __pyx_v_datum); + __Pyx_RefNannySetupContext("read_float (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_12read_float(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_18write_utf8(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_datum) { +static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_12read_float(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("write_utf8", 0); + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read_float", 0); - /* "spavro/fast_binary.pyx":778 + /* "spavro/fast_binary.pyx":855 * - * def write_utf8(self, datum): - * write_utf8(self.writer, datum) # <<<<<<<<<<<<<< + * def read_float(self): + * return read_float(self.reader) # <<<<<<<<<<<<<< * - * def write_crc32(self, bytes): + * def read_double(self): */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 778, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 855, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_f_6spavro_11fast_binary_write_utf8(__pyx_t_1, __pyx_v_datum); + __pyx_t_2 = PyFloat_FromDouble(__pyx_f_6spavro_11fast_binary_read_float(__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 855, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "spavro/fast_binary.pyx":777 - * write_bytes(self.writer, datum) + /* "spavro/fast_binary.pyx":854 + * return read_long(self.reader) * - * def write_utf8(self, datum): # <<<<<<<<<<<<<< - * write_utf8(self.writer, datum) + * def read_float(self): # <<<<<<<<<<<<<< + * return read_float(self.reader) * */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_utf8", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.read_float", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -20028,212 +18643,137 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_18write_utf8 return __pyx_r; } -/* "spavro/fast_binary.pyx":780 - * write_utf8(self.writer, datum) +/* "spavro/fast_binary.pyx":857 + * return read_float(self.reader) + * + * def read_double(self): # <<<<<<<<<<<<<< + * return read_double(self.reader) * - * def write_crc32(self, bytes): # <<<<<<<<<<<<<< - * """ - * A 4-byte, big-endian CRC32 checksum */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_21write_crc32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6spavro_11fast_binary_17FastBinaryEncoder_20write_crc32[] = "\n A 4-byte, big-endian CRC32 checksum\n "; -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_21write_crc32 = {"write_crc32", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_21write_crc32, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6spavro_11fast_binary_17FastBinaryEncoder_20write_crc32}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryEncoder_21write_crc32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_bytes = 0; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_15read_double(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_15read_double = {"read_double", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_15read_double, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_15read_double(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write_crc32 (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_bytes,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bytes)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("write_crc32", 1, 2, 2, 1); __PYX_ERR(0, 780, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write_crc32") < 0)) __PYX_ERR(0, 780, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_self = values[0]; - __pyx_v_bytes = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("write_crc32", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 780, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_crc32", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannySetupContext("read_double (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_14read_double(__pyx_self, ((PyObject *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_20write_crc32(__pyx_self, __pyx_v_self, __pyx_v_bytes); + return __pyx_r; +} + +static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_14read_double(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read_double", 0); + + /* "spavro/fast_binary.pyx":858 + * + * def read_double(self): + * return read_double(self.reader) # <<<<<<<<<<<<<< + * + * def read_bytes(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 858, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyFloat_FromDouble(__pyx_f_6spavro_11fast_binary_read_double(__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 858, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spavro/fast_binary.pyx":857 + * return read_float(self.reader) + * + * def read_double(self): # <<<<<<<<<<<<<< + * return read_double(self.reader) + * + */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.read_double", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_20write_crc32(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_bytes) { +/* "spavro/fast_binary.pyx":860 + * return read_double(self.reader) + * + * def read_bytes(self): # <<<<<<<<<<<<<< + * return read_bytes(self.reader) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_17read_bytes(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_17read_bytes = {"read_bytes", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_17read_bytes, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_17read_bytes(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("read_bytes (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_16read_bytes(__pyx_self, ((PyObject *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_16read_bytes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - __Pyx_RefNannySetupContext("write_crc32", 0); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read_bytes", 0); - /* "spavro/fast_binary.pyx":784 - * A 4-byte, big-endian CRC32 checksum - * """ - * self.writer.write(struct.pack("!I", crc32(bytes) & 0xffffffff)) # <<<<<<<<<<<<<< + /* "spavro/fast_binary.pyx":861 * + * def read_bytes(self): + * return read_bytes(self.reader) # <<<<<<<<<<<<<< * + * def read_utf8(self): */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_writer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 784, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 861, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_f_6spavro_11fast_binary_read_bytes(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 861, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 784, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_struct); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 784, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_pack); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 784, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_crc32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 784, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_bytes) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_bytes); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 784, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_And(__pyx_t_4, __pyx_int_4294967295); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 784, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_8 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_s_I, __pyx_t_6}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 784, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_s_I, __pyx_t_6}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 784, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_7 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 784, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL; - } - __Pyx_INCREF(__pyx_kp_s_I); - __Pyx_GIVEREF(__pyx_kp_s_I); - PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_kp_s_I); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 784, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 784, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "spavro/fast_binary.pyx":780 - * write_utf8(self.writer, datum) + /* "spavro/fast_binary.pyx":860 + * return read_double(self.reader) + * + * def read_bytes(self): # <<<<<<<<<<<<<< + * return read_bytes(self.reader) * - * def write_crc32(self, bytes): # <<<<<<<<<<<<<< - * """ - * A 4-byte, big-endian CRC32 checksum */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_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_AddTraceback("spavro.fast_binary.FastBinaryEncoder.write_crc32", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.read_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -20241,104 +18781,68 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryEncoder_20write_crc3 return __pyx_r; } -/* "spavro/fast_binary.pyx":790 - * class FastBinaryDecoder(object): - * """Read leaf values.""" - * def __init__(self, reader): # <<<<<<<<<<<<<< - * """ - * reader is a Python object on which we can call read, seek, and tell. +/* "spavro/fast_binary.pyx":863 + * return read_bytes(self.reader) + * + * def read_utf8(self): # <<<<<<<<<<<<<< + * return read_utf8(self.reader) + * */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6spavro_11fast_binary_17FastBinaryDecoder___init__[] = "\n reader is a Python object on which we can call read, seek, and tell.\n "; -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_1__init__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6spavro_11fast_binary_17FastBinaryDecoder___init__}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_reader = 0; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_19read_utf8(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_19read_utf8 = {"read_utf8", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_19read_utf8, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_19read_utf8(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_reader,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reader)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 790, __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, 790, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_self = values[0]; - __pyx_v_reader = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 790, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder___init__(__pyx_self, __pyx_v_self, __pyx_v_reader); + __Pyx_RefNannySetupContext("read_utf8 (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_18read_utf8(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_reader) { +static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_18read_utf8(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__", 0); + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read_utf8", 0); - /* "spavro/fast_binary.pyx":794 - * reader is a Python object on which we can call read, seek, and tell. - * """ - * self.reader = reader # <<<<<<<<<<<<<< + /* "spavro/fast_binary.pyx":864 * - * def read(self, n): + * def read_utf8(self): + * return read_utf8(self.reader) # <<<<<<<<<<<<<< + * + * def check_crc32(self, bytes): */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_reader, __pyx_v_reader) < 0) __PYX_ERR(0, 794, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 864, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_f_6spavro_11fast_binary_read_utf8(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 864, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "spavro/fast_binary.pyx":790 - * class FastBinaryDecoder(object): - * """Read leaf values.""" - * def __init__(self, reader): # <<<<<<<<<<<<<< - * """ - * reader is a Python object on which we can call read, seek, and tell. + /* "spavro/fast_binary.pyx":863 + * return read_bytes(self.reader) + * + * def read_utf8(self): # <<<<<<<<<<<<<< + * return read_utf8(self.reader) + * */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.read_utf8", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -20346,25 +18850,28 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder___init__(CYT return __pyx_r; } -/* "spavro/fast_binary.pyx":796 - * self.reader = reader - * - * def read(self, n): # <<<<<<<<<<<<<< - * return self.reader.read(n) +/* "spavro/fast_binary.pyx":866 + * return read_utf8(self.reader) * + * def check_crc32(self, bytes): # <<<<<<<<<<<<<< + * checksum = struct.unpack("!I", self.reader.read(4))[0] + * if crc32(bytes) & 0xffffffff != checksum: */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_3read(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_3read = {"read", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_3read, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_3read(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_21check_crc32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_21check_crc32 = {"check_crc32", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_21check_crc32, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_21check_crc32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_n = 0; + PyObject *__pyx_v_bytes = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("read (wrapper)", 0); + __Pyx_RefNannySetupContext("check_crc32 (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_n,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_bytes,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -20384,13 +18891,13 @@ static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_3read(PyObje else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bytes)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("read", 1, 2, 2, 1); __PYX_ERR(0, 796, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("check_crc32", 1, 2, 2, 1); __PYX_ERR(0, 866, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read") < 0)) __PYX_ERR(0, 796, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "check_crc32") < 0)) __PYX_ERR(0, 866, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -20399,196 +18906,317 @@ static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_3read(PyObje values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_self = values[0]; - __pyx_v_n = values[1]; + __pyx_v_bytes = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("read", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 796, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("check_crc32", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 866, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.read", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.check_crc32", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_2read(__pyx_self, __pyx_v_self, __pyx_v_n); + __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_20check_crc32(__pyx_self, __pyx_v_self, __pyx_v_bytes); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_2read(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_n) { +static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_20check_crc32(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_bytes) { + PyObject *__pyx_v_checksum = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("read", 0); + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("check_crc32", 0); - /* "spavro/fast_binary.pyx":797 - * - * def read(self, n): - * return self.reader.read(n) # <<<<<<<<<<<<<< + /* "spavro/fast_binary.pyx":867 * - * def read_null(self): + * def check_crc32(self, bytes): + * checksum = struct.unpack("!I", self.reader.read(4))[0] # <<<<<<<<<<<<<< + * if crc32(bytes) & 0xffffffff != checksum: + * raise RuntimeError("Checksum failure") */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 797, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_struct); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 867, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_read); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 797, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_unpack); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 867, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 867, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_read); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 867, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); + __Pyx_DECREF_SET(__pyx_t_5, function); } } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_n) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_n); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 797, __pyx_L1_error) + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_int_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_int_4); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 867, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_6 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_s_I, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 867, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_s_I, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 867, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else + #endif + { + __pyx_t_4 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 867, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__pyx_t_5) { + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL; + } + __Pyx_INCREF(__pyx_kp_s_I); + __Pyx_GIVEREF(__pyx_kp_s_I); + PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_6, __pyx_kp_s_I); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_6, __pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 867, __pyx_L1_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_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 867, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_checksum = __pyx_t_3; + __pyx_t_3 = 0; + + /* "spavro/fast_binary.pyx":868 + * def check_crc32(self, bytes): + * checksum = struct.unpack("!I", self.reader.read(4))[0] + * if crc32(bytes) & 0xffffffff != checksum: # <<<<<<<<<<<<<< + * raise RuntimeError("Checksum failure") + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_crc32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 868, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + } + } + __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_bytes) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_bytes); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 868, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_And(__pyx_t_3, __pyx_int_4294967295); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 868, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_v_checksum, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 868, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 868, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(__pyx_t_7)) { - /* "spavro/fast_binary.pyx":796 - * self.reader = reader + /* "spavro/fast_binary.pyx":869 + * checksum = struct.unpack("!I", self.reader.read(4))[0] + * if crc32(bytes) & 0xffffffff != checksum: + * raise RuntimeError("Checksum failure") # <<<<<<<<<<<<<< * - * def read(self, n): # <<<<<<<<<<<<<< - * return self.reader.read(n) + * def skip_null(self): + */ + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 869, __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, 869, __pyx_L1_error) + + /* "spavro/fast_binary.pyx":868 + * def check_crc32(self, bytes): + * checksum = struct.unpack("!I", self.reader.read(4))[0] + * if crc32(bytes) & 0xffffffff != checksum: # <<<<<<<<<<<<<< + * raise RuntimeError("Checksum failure") + * + */ + } + + /* "spavro/fast_binary.pyx":866 + * return read_utf8(self.reader) * + * def check_crc32(self, bytes): # <<<<<<<<<<<<<< + * checksum = struct.unpack("!I", self.reader.read(4))[0] + * if crc32(bytes) & 0xffffffff != checksum: */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.read", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.check_crc32", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_checksum); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":799 - * return self.reader.read(n) +/* "spavro/fast_binary.pyx":871 + * raise RuntimeError("Checksum failure") * - * def read_null(self): # <<<<<<<<<<<<<< - * return None + * def skip_null(self): # <<<<<<<<<<<<<< + * pass * */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_5read_null(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_5read_null = {"read_null", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_5read_null, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_5read_null(PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_23skip_null(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_23skip_null = {"skip_null", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_23skip_null, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_23skip_null(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("read_null (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_4read_null(__pyx_self, ((PyObject *)__pyx_v_self)); + __Pyx_RefNannySetupContext("skip_null (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_22skip_null(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_4read_null(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_22skip_null(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("read_null", 0); - - /* "spavro/fast_binary.pyx":800 - * - * def read_null(self): - * return None # <<<<<<<<<<<<<< - * - * def read_boolean(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - - /* "spavro/fast_binary.pyx":799 - * return self.reader.read(n) - * - * def read_null(self): # <<<<<<<<<<<<<< - * return None - * - */ + __Pyx_RefNannySetupContext("skip_null", 0); /* function exit code */ - __pyx_L0:; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":802 - * return None +/* "spavro/fast_binary.pyx":874 + * pass * - * def read_boolean(self): # <<<<<<<<<<<<<< - * return read_boolean(self.reader) + * def skip_boolean(self): # <<<<<<<<<<<<<< + * self.reader.read(1) * */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_7read_boolean(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_7read_boolean = {"read_boolean", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_7read_boolean, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_7read_boolean(PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_25skip_boolean(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_25skip_boolean = {"skip_boolean", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_25skip_boolean, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_25skip_boolean(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("read_boolean (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_6read_boolean(__pyx_self, ((PyObject *)__pyx_v_self)); + __Pyx_RefNannySetupContext("skip_boolean (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_24skip_boolean(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_6read_boolean(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_24skip_boolean(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("read_boolean", 0); + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("skip_boolean", 0); - /* "spavro/fast_binary.pyx":803 + /* "spavro/fast_binary.pyx":875 * - * def read_boolean(self): - * return read_boolean(self.reader) # <<<<<<<<<<<<<< + * def skip_boolean(self): + * self.reader.read(1) # <<<<<<<<<<<<<< * - * def read_int(self): + * def skip_int(self): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 803, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_f_6spavro_11fast_binary_read_boolean(__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 803, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 875, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_read); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 875, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_int_1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_int_1); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 875, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - /* "spavro/fast_binary.pyx":802 - * return None + /* "spavro/fast_binary.pyx":874 + * pass * - * def read_boolean(self): # <<<<<<<<<<<<<< - * return read_boolean(self.reader) + * def skip_boolean(self): # <<<<<<<<<<<<<< + * self.reader.read(1) * */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.read_boolean", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.skip_boolean", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -20596,65 +19224,63 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_6read_boolea return __pyx_r; } -/* "spavro/fast_binary.pyx":805 - * return read_boolean(self.reader) +/* "spavro/fast_binary.pyx":877 + * self.reader.read(1) * - * def read_int(self): # <<<<<<<<<<<<<< - * return read_long(self.reader) + * def skip_int(self): # <<<<<<<<<<<<<< + * read_long(self.reader) * */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_9read_int(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_9read_int = {"read_int", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_9read_int, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_9read_int(PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_27skip_int(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_27skip_int = {"skip_int", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_27skip_int, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_27skip_int(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("read_int (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_8read_int(__pyx_self, ((PyObject *)__pyx_v_self)); + __Pyx_RefNannySetupContext("skip_int (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_26skip_int(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_8read_int(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_26skip_int(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("read_int", 0); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("skip_int", 0); - /* "spavro/fast_binary.pyx":806 + /* "spavro/fast_binary.pyx":878 * - * def read_int(self): - * return read_long(self.reader) # <<<<<<<<<<<<<< + * def skip_int(self): + * read_long(self.reader) # <<<<<<<<<<<<<< * - * def read_long(self): + * def skip_long(self): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 806, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 878, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_f_6spavro_11fast_binary_read_long(__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 806, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + (void)(__pyx_f_6spavro_11fast_binary_read_long(__pyx_t_1)); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - /* "spavro/fast_binary.pyx":805 - * return read_boolean(self.reader) + /* "spavro/fast_binary.pyx":877 + * self.reader.read(1) * - * def read_int(self): # <<<<<<<<<<<<<< - * return read_long(self.reader) + * def skip_int(self): # <<<<<<<<<<<<<< + * read_long(self.reader) * */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.read_int", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.skip_int", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -20662,65 +19288,63 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_8read_int(CY return __pyx_r; } -/* "spavro/fast_binary.pyx":808 - * return read_long(self.reader) +/* "spavro/fast_binary.pyx":880 + * read_long(self.reader) * - * def read_long(self): # <<<<<<<<<<<<<< - * return read_long(self.reader) + * def skip_long(self): # <<<<<<<<<<<<<< + * read_long(self.reader) * */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_11read_long(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_11read_long = {"read_long", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_11read_long, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_11read_long(PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_29skip_long(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_29skip_long = {"skip_long", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_29skip_long, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_29skip_long(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("read_long (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_10read_long(__pyx_self, ((PyObject *)__pyx_v_self)); + __Pyx_RefNannySetupContext("skip_long (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_28skip_long(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_10read_long(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_28skip_long(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("read_long", 0); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("skip_long", 0); - /* "spavro/fast_binary.pyx":809 + /* "spavro/fast_binary.pyx":881 * - * def read_long(self): - * return read_long(self.reader) # <<<<<<<<<<<<<< + * def skip_long(self): + * read_long(self.reader) # <<<<<<<<<<<<<< * - * def read_float(self): + * def skip_float(self): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 809, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 881, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_f_6spavro_11fast_binary_read_long(__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 809, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + (void)(__pyx_f_6spavro_11fast_binary_read_long(__pyx_t_1)); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - /* "spavro/fast_binary.pyx":808 - * return read_long(self.reader) + /* "spavro/fast_binary.pyx":880 + * read_long(self.reader) * - * def read_long(self): # <<<<<<<<<<<<<< - * return read_long(self.reader) + * def skip_long(self): # <<<<<<<<<<<<<< + * read_long(self.reader) * */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.read_long", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.skip_long", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -20728,65 +19352,63 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_10read_long( return __pyx_r; } -/* "spavro/fast_binary.pyx":811 - * return read_long(self.reader) +/* "spavro/fast_binary.pyx":883 + * read_long(self.reader) * - * def read_float(self): # <<<<<<<<<<<<<< - * return read_float(self.reader) + * def skip_float(self): # <<<<<<<<<<<<<< + * read_float(self.reader) * */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_13read_float(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_13read_float = {"read_float", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_13read_float, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_13read_float(PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_31skip_float(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_31skip_float = {"skip_float", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_31skip_float, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_31skip_float(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("read_float (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_12read_float(__pyx_self, ((PyObject *)__pyx_v_self)); + __Pyx_RefNannySetupContext("skip_float (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_30skip_float(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_12read_float(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_30skip_float(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("read_float", 0); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("skip_float", 0); - /* "spavro/fast_binary.pyx":812 + /* "spavro/fast_binary.pyx":884 * - * def read_float(self): - * return read_float(self.reader) # <<<<<<<<<<<<<< + * def skip_float(self): + * read_float(self.reader) # <<<<<<<<<<<<<< * - * def read_double(self): + * def skip_double(self): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 812, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 884, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyFloat_FromDouble(__pyx_f_6spavro_11fast_binary_read_float(__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 812, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + (void)(__pyx_f_6spavro_11fast_binary_read_float(__pyx_t_1)); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - /* "spavro/fast_binary.pyx":811 - * return read_long(self.reader) + /* "spavro/fast_binary.pyx":883 + * read_long(self.reader) * - * def read_float(self): # <<<<<<<<<<<<<< - * return read_float(self.reader) + * def skip_float(self): # <<<<<<<<<<<<<< + * read_float(self.reader) * */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.read_float", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.skip_float", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -20794,65 +19416,63 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_12read_float return __pyx_r; } -/* "spavro/fast_binary.pyx":814 - * return read_float(self.reader) +/* "spavro/fast_binary.pyx":886 + * read_float(self.reader) * - * def read_double(self): # <<<<<<<<<<<<<< - * return read_double(self.reader) + * def skip_double(self): # <<<<<<<<<<<<<< + * read_double(self.reader) * */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_15read_double(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_15read_double = {"read_double", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_15read_double, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_15read_double(PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_33skip_double(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_33skip_double = {"skip_double", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_33skip_double, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_33skip_double(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("read_double (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_14read_double(__pyx_self, ((PyObject *)__pyx_v_self)); + __Pyx_RefNannySetupContext("skip_double (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_32skip_double(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_14read_double(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_32skip_double(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("read_double", 0); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("skip_double", 0); - /* "spavro/fast_binary.pyx":815 + /* "spavro/fast_binary.pyx":887 * - * def read_double(self): - * return read_double(self.reader) # <<<<<<<<<<<<<< + * def skip_double(self): + * read_double(self.reader) # <<<<<<<<<<<<<< * - * def read_bytes(self): + * def skip_bytes(self): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 815, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 887, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyFloat_FromDouble(__pyx_f_6spavro_11fast_binary_read_double(__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 815, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + (void)(__pyx_f_6spavro_11fast_binary_read_double(__pyx_t_1)); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - /* "spavro/fast_binary.pyx":814 - * return read_float(self.reader) + /* "spavro/fast_binary.pyx":886 + * read_float(self.reader) * - * def read_double(self): # <<<<<<<<<<<<<< - * return read_double(self.reader) + * def skip_double(self): # <<<<<<<<<<<<<< + * read_double(self.reader) * */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.read_double", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.skip_double", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -20860,65 +19480,67 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_14read_doubl return __pyx_r; } -/* "spavro/fast_binary.pyx":817 - * return read_double(self.reader) +/* "spavro/fast_binary.pyx":889 + * read_double(self.reader) * - * def read_bytes(self): # <<<<<<<<<<<<<< - * return read_bytes(self.reader) + * def skip_bytes(self): # <<<<<<<<<<<<<< + * read_bytes(self.reader) * */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_17read_bytes(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_17read_bytes = {"read_bytes", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_17read_bytes, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_17read_bytes(PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_35skip_bytes(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_35skip_bytes = {"skip_bytes", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_35skip_bytes, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_35skip_bytes(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("read_bytes (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_16read_bytes(__pyx_self, ((PyObject *)__pyx_v_self)); + __Pyx_RefNannySetupContext("skip_bytes (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_34skip_bytes(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_16read_bytes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_34skip_bytes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("read_bytes", 0); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("skip_bytes", 0); - /* "spavro/fast_binary.pyx":818 + /* "spavro/fast_binary.pyx":890 * - * def read_bytes(self): - * return read_bytes(self.reader) # <<<<<<<<<<<<<< + * def skip_bytes(self): + * read_bytes(self.reader) # <<<<<<<<<<<<<< * - * def read_utf8(self): + * def skip_utf8(self): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 818, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 890, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_f_6spavro_11fast_binary_read_bytes(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 818, __pyx_L1_error) + __pyx_t_2 = __pyx_f_6spavro_11fast_binary_read_bytes(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 890, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":817 - * return read_double(self.reader) + /* "spavro/fast_binary.pyx":889 + * read_double(self.reader) * - * def read_bytes(self): # <<<<<<<<<<<<<< - * return read_bytes(self.reader) + * def skip_bytes(self): # <<<<<<<<<<<<<< + * read_bytes(self.reader) * */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.read_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.skip_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -20926,65 +19548,67 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_16read_bytes return __pyx_r; } -/* "spavro/fast_binary.pyx":820 - * return read_bytes(self.reader) +/* "spavro/fast_binary.pyx":892 + * read_bytes(self.reader) * - * def read_utf8(self): # <<<<<<<<<<<<<< - * return read_utf8(self.reader) + * def skip_utf8(self): # <<<<<<<<<<<<<< + * read_utf8(self.reader) * */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_19read_utf8(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_19read_utf8 = {"read_utf8", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_19read_utf8, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_19read_utf8(PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_37skip_utf8(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_37skip_utf8 = {"skip_utf8", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_37skip_utf8, METH_O, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_37skip_utf8(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("read_utf8 (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_18read_utf8(__pyx_self, ((PyObject *)__pyx_v_self)); + __Pyx_RefNannySetupContext("skip_utf8 (wrapper)", 0); + __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_36skip_utf8(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_18read_utf8(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_36skip_utf8(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("read_utf8", 0); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("skip_utf8", 0); - /* "spavro/fast_binary.pyx":821 + /* "spavro/fast_binary.pyx":893 * - * def read_utf8(self): - * return read_utf8(self.reader) # <<<<<<<<<<<<<< + * def skip_utf8(self): + * read_utf8(self.reader) # <<<<<<<<<<<<<< * - * def check_crc32(self, bytes): + * def skip(self, n): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 821, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 893, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_f_6spavro_11fast_binary_read_utf8(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 821, __pyx_L1_error) + __pyx_t_2 = __pyx_f_6spavro_11fast_binary_read_utf8(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 893, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":820 - * return read_bytes(self.reader) + /* "spavro/fast_binary.pyx":892 + * read_bytes(self.reader) * - * def read_utf8(self): # <<<<<<<<<<<<<< - * return read_utf8(self.reader) + * def skip_utf8(self): # <<<<<<<<<<<<<< + * read_utf8(self.reader) * */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.read_utf8", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.skip_utf8", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -20992,25 +19616,28 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_18read_utf8( return __pyx_r; } -/* "spavro/fast_binary.pyx":823 - * return read_utf8(self.reader) +/* "spavro/fast_binary.pyx":895 + * read_utf8(self.reader) + * + * def skip(self, n): # <<<<<<<<<<<<<< + * self.reader.seek(self.reader.tell() + n) * - * def check_crc32(self, bytes): # <<<<<<<<<<<<<< - * checksum = struct.unpack("!I", self.reader.read(4))[0] - * if crc32(bytes) & 0xffffffff != checksum: */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_21check_crc32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_21check_crc32 = {"check_crc32", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_21check_crc32, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_21check_crc32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_39skip(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_39skip = {"skip", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_39skip, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_39skip(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_bytes = 0; + PyObject *__pyx_v_n = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("check_crc32 (wrapper)", 0); + __Pyx_RefNannySetupContext("skip (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_bytes,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_n,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -21030,13 +19657,13 @@ static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_21check_crc3 else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bytes)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("check_crc32", 1, 2, 2, 1); __PYX_ERR(0, 823, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("skip", 1, 2, 2, 1); __PYX_ERR(0, 895, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "check_crc32") < 0)) __PYX_ERR(0, 823, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "skip") < 0)) __PYX_ERR(0, 895, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -21045,25 +19672,24 @@ static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_21check_crc3 values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_self = values[0]; - __pyx_v_bytes = values[1]; + __pyx_v_n = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("check_crc32", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 823, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("skip", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 895, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.check_crc32", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.skip", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_20check_crc32(__pyx_self, __pyx_v_self, __pyx_v_bytes); + __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_38skip(__pyx_self, __pyx_v_self, __pyx_v_n); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_20check_crc32(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_bytes) { - PyObject *__pyx_v_checksum = NULL; +static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_38skip(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_n) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -21071,25 +19697,26 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_20check_crc3 PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - int __pyx_t_7; - __Pyx_RefNannySetupContext("check_crc32", 0); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("skip", 0); - /* "spavro/fast_binary.pyx":824 + /* "spavro/fast_binary.pyx":896 + * + * def skip(self, n): + * self.reader.seek(self.reader.tell() + n) # <<<<<<<<<<<<<< + * * - * def check_crc32(self, bytes): - * checksum = struct.unpack("!I", self.reader.read(4))[0] # <<<<<<<<<<<<<< - * if crc32(bytes) & 0xffffffff != checksum: - * raise RuntimeError("Checksum failure") */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_struct); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 824, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 896, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_unpack); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 824, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_seek); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 896, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 824, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 896, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_read); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 824, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_tell); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 896, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; @@ -21102,125 +19729,38 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_20check_crc3 __Pyx_DECREF_SET(__pyx_t_5, function); } } - __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_int_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_int_4); + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 824, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 896, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - __pyx_t_6 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { + __pyx_t_5 = PyNumber_Add(__pyx_t_2, __pyx_v_n); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 896, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_6 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_s_I, __pyx_t_2}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 824, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_s_I, __pyx_t_2}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 824, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else - #endif - { - __pyx_t_4 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 824, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL; - } - __Pyx_INCREF(__pyx_kp_s_I); - __Pyx_GIVEREF(__pyx_kp_s_I); - PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_6, __pyx_kp_s_I); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_6, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 824, __pyx_L1_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_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 824, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_checksum = __pyx_t_3; - __pyx_t_3 = 0; - - /* "spavro/fast_binary.pyx":825 - * def check_crc32(self, bytes): - * checksum = struct.unpack("!I", self.reader.read(4))[0] - * if crc32(bytes) & 0xffffffff != checksum: # <<<<<<<<<<<<<< - * raise RuntimeError("Checksum failure") - * - */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_crc32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 825, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); } } - __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_bytes) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_bytes); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 825, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_And(__pyx_t_3, __pyx_int_4294967295); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 825, __pyx_L1_error) + __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 896, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_v_checksum, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 825, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 825, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(__pyx_t_7)) { - - /* "spavro/fast_binary.pyx":826 - * checksum = struct.unpack("!I", self.reader.read(4))[0] - * if crc32(bytes) & 0xffffffff != checksum: - * raise RuntimeError("Checksum failure") # <<<<<<<<<<<<<< - * - * def skip_null(self): - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__56, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 826, __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, 826, __pyx_L1_error) - /* "spavro/fast_binary.pyx":825 - * def check_crc32(self, bytes): - * checksum = struct.unpack("!I", self.reader.read(4))[0] - * if crc32(bytes) & 0xffffffff != checksum: # <<<<<<<<<<<<<< - * raise RuntimeError("Checksum failure") + /* "spavro/fast_binary.pyx":895 + * read_utf8(self.reader) * - */ - } - - /* "spavro/fast_binary.pyx":823 - * return read_utf8(self.reader) + * def skip(self, n): # <<<<<<<<<<<<<< + * self.reader.seek(self.reader.tell() + n) * - * def check_crc32(self, bytes): # <<<<<<<<<<<<<< - * checksum = struct.unpack("!I", self.reader.read(4))[0] - * if crc32(bytes) & 0xffffffff != checksum: */ /* function exit code */ @@ -21232,528 +19772,1153 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_20check_crc3 __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.check_crc32", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.skip", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_checksum); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "spavro/fast_binary.pyx":828 - * raise RuntimeError("Checksum failure") +/* "spavro/fast_binary.pyx":899 * - * def skip_null(self): # <<<<<<<<<<<<<< - * pass * + * cdef void write_union_to_array(array.array outbuf, datum, writer_lookup): # <<<<<<<<<<<<<< + * idx, data_writer = writer_lookup(datum) # TODO: cdef int, list = f()? + * write_long_to_array(outbuf, idx) */ -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_23skip_null(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_23skip_null = {"skip_null", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_23skip_null, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_23skip_null(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; +static void __pyx_f_6spavro_11fast_binary_write_union_to_array(arrayobject *__pyx_v_outbuf, PyObject *__pyx_v_datum, PyObject *__pyx_v_writer_lookup) { + PyObject *__pyx_v_idx = NULL; + PyObject *__pyx_v_data_writer = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("skip_null (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_22skip_null(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *(*__pyx_t_5)(PyObject *); + PY_LONG_LONG __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write_union_to_array", 0); -static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_22skip_null(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("skip_null", 0); + /* "spavro/fast_binary.pyx":900 + * + * cdef void write_union_to_array(array.array outbuf, datum, writer_lookup): + * idx, data_writer = writer_lookup(datum) # TODO: cdef int, list = f()? # <<<<<<<<<<<<<< + * write_long_to_array(outbuf, idx) + * execute(outbuf, datum, data_writer) + */ + __Pyx_INCREF(__pyx_v_writer_lookup); + __pyx_t_2 = __pyx_v_writer_lookup; __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_datum) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_datum); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 900, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 900, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_2 = PyList_GET_ITEM(sequence, 0); + __pyx_t_3 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + #else + __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 900, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 900, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 900, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext; + index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed; + __Pyx_GOTREF(__pyx_t_2); + index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 900, __pyx_L1_error) + __pyx_t_5 = NULL; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L4_unpacking_done; + __pyx_L3_unpacking_failed:; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 900, __pyx_L1_error) + __pyx_L4_unpacking_done:; + } + __pyx_v_idx = __pyx_t_2; + __pyx_t_2 = 0; + __pyx_v_data_writer = __pyx_t_3; + __pyx_t_3 = 0; - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "spavro/fast_binary.pyx":901 + * cdef void write_union_to_array(array.array outbuf, datum, writer_lookup): + * idx, data_writer = writer_lookup(datum) # TODO: cdef int, list = f()? + * write_long_to_array(outbuf, idx) # <<<<<<<<<<<<<< + * execute(outbuf, datum, data_writer) + * + */ + __pyx_t_6 = __Pyx_PyInt_As_PY_LONG_LONG(__pyx_v_idx); if (unlikely((__pyx_t_6 == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 901, __pyx_L1_error) + __pyx_f_6spavro_11fast_binary_write_long_to_array(__pyx_v_outbuf, __pyx_t_6); -/* "spavro/fast_binary.pyx":831 - * pass + /* "spavro/fast_binary.pyx":902 + * idx, data_writer = writer_lookup(datum) # TODO: cdef int, list = f()? + * write_long_to_array(outbuf, idx) + * execute(outbuf, datum, data_writer) # <<<<<<<<<<<<<< * - * def skip_boolean(self): # <<<<<<<<<<<<<< - * self.reader.read(1) * */ + if (!(likely(PyList_CheckExact(__pyx_v_data_writer))||((__pyx_v_data_writer) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_data_writer)->tp_name), 0))) __PYX_ERR(0, 902, __pyx_L1_error) + __pyx_f_6spavro_11fast_binary_execute(__pyx_v_outbuf, __pyx_v_datum, ((PyObject*)__pyx_v_data_writer)); -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_25skip_boolean(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_25skip_boolean = {"skip_boolean", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_25skip_boolean, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_25skip_boolean(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("skip_boolean (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_24skip_boolean(__pyx_self, ((PyObject *)__pyx_v_self)); + /* "spavro/fast_binary.pyx":899 + * + * + * cdef void write_union_to_array(array.array outbuf, datum, writer_lookup): # <<<<<<<<<<<<<< + * idx, data_writer = writer_lookup(datum) # TODO: cdef int, list = f()? + * write_long_to_array(outbuf, idx) + */ /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("spavro.fast_binary.write_union_to_array", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_idx); + __Pyx_XDECREF(__pyx_v_data_writer); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_24skip_boolean(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("skip_boolean", 0); +/* "spavro/fast_binary.pyx":905 + * + * + * cdef void write_record_to_array(array.array outbuf, dict datum, list fields): # <<<<<<<<<<<<<< + * for field in fields: + * try: + */ + +static void __pyx_f_6spavro_11fast_binary_write_record_to_array(arrayobject *__pyx_v_outbuf, PyObject *__pyx_v_datum, PyObject *__pyx_v_fields) { + PyObject *__pyx_v_field = NULL; + CYTHON_UNUSED PyObject *__pyx_v_e = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + 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_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write_record_to_array", 0); - /* "spavro/fast_binary.pyx":832 + /* "spavro/fast_binary.pyx":906 * - * def skip_boolean(self): - * self.reader.read(1) # <<<<<<<<<<<<<< + * cdef void write_record_to_array(array.array outbuf, dict datum, list fields): + * for field in fields: # <<<<<<<<<<<<<< + * try: + * execute(outbuf, datum.get(field.name), field.writer) + */ + if (unlikely(__pyx_v_fields == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(0, 906, __pyx_L1_error) + } + __pyx_t_1 = __pyx_v_fields; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + for (;;) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 906, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 906, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_XDECREF_SET(__pyx_v_field, __pyx_t_3); + __pyx_t_3 = 0; + + /* "spavro/fast_binary.pyx":907 + * cdef void write_record_to_array(array.array outbuf, dict datum, list fields): + * for field in fields: + * try: # <<<<<<<<<<<<<< + * execute(outbuf, datum.get(field.name), field.writer) + * except TypeError as e: + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + /*try:*/ { + + /* "spavro/fast_binary.pyx":908 + * for field in fields: + * try: + * execute(outbuf, datum.get(field.name), field.writer) # <<<<<<<<<<<<<< + * except TypeError as e: + * raise TypeError("Error writing record schema at fieldname: '{}', datum: '{}'".format(field.name, repr(datum.get(field.name)))) + */ + if (unlikely(__pyx_v_datum == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); + __PYX_ERR(0, 908, __pyx_L5_error) + } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_field, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 908, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = __Pyx_PyDict_GetItemDefault(__pyx_v_datum, __pyx_t_3, Py_None); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 908, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_field, __pyx_n_s_writer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 908, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyList_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 908, __pyx_L5_error) + __pyx_f_6spavro_11fast_binary_execute(__pyx_v_outbuf, __pyx_t_7, ((PyObject*)__pyx_t_3)); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spavro/fast_binary.pyx":907 + * cdef void write_record_to_array(array.array outbuf, dict datum, list fields): + * for field in fields: + * try: # <<<<<<<<<<<<<< + * execute(outbuf, datum.get(field.name), field.writer) + * except TypeError as e: + */ + } + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L12_try_end; + __pyx_L5_error:; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "spavro/fast_binary.pyx":909 + * try: + * execute(outbuf, datum.get(field.name), field.writer) + * except TypeError as e: # <<<<<<<<<<<<<< + * raise TypeError("Error writing record schema at fieldname: '{}', datum: '{}'".format(field.name, repr(datum.get(field.name)))) * - * def skip_int(self): */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 832, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_read); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 832, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError); + if (__pyx_t_8) { + __Pyx_AddTraceback("spavro.fast_binary.write_record_to_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_7, &__pyx_t_9) < 0) __PYX_ERR(0, 909, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_9); + __Pyx_INCREF(__pyx_t_7); + __pyx_v_e = __pyx_t_7; + + /* "spavro/fast_binary.pyx":910 + * execute(outbuf, datum.get(field.name), field.writer) + * except TypeError as e: + * raise TypeError("Error writing record schema at fieldname: '{}', datum: '{}'".format(field.name, repr(datum.get(field.name)))) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Error_writing_record_schema_at_f, __pyx_n_s_format); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 910, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_field, __pyx_n_s_name); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 910, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_12); + if (unlikely(__pyx_v_datum == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); + __PYX_ERR(0, 910, __pyx_L7_except_error) + } + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_field, __pyx_n_s_name); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 910, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_14 = __Pyx_PyDict_GetItemDefault(__pyx_v_datum, __pyx_t_13, Py_None); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 910, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = PyObject_Repr(__pyx_t_14); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 910, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_14 = NULL; + __pyx_t_8 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_14)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_14); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + __pyx_t_8 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_11)) { + PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_t_12, __pyx_t_13}; + __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 910, __pyx_L7_except_error) + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) { + PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_t_12, __pyx_t_13}; + __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 910, __pyx_L7_except_error) + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + } else + #endif + { + __pyx_t_15 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 910, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_15); + if (__pyx_t_14) { + __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_14); __pyx_t_14 = NULL; + } + __Pyx_GIVEREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_8, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_8, __pyx_t_13); + __pyx_t_12 = 0; + __pyx_t_13 = 0; + __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_15, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 910, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + } + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 910, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_Raise(__pyx_t_11, 0, 0, 0); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __PYX_ERR(0, 910, __pyx_L7_except_error) + } + goto __pyx_L7_except_error; + __pyx_L7_except_error:; + + /* "spavro/fast_binary.pyx":907 + * cdef void write_record_to_array(array.array outbuf, dict datum, list fields): + * for field in fields: + * try: # <<<<<<<<<<<<<< + * execute(outbuf, datum.get(field.name), field.writer) + * except TypeError as e: + */ + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6); + goto __pyx_L1_error; + __pyx_L12_try_end:; } + + /* "spavro/fast_binary.pyx":906 + * + * cdef void write_record_to_array(array.array outbuf, dict datum, list fields): + * for field in fields: # <<<<<<<<<<<<<< + * try: + * execute(outbuf, datum.get(field.name), field.writer) + */ } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_int_1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_int_1); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 832, __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; - /* "spavro/fast_binary.pyx":831 - * pass + /* "spavro/fast_binary.pyx":905 * - * def skip_boolean(self): # <<<<<<<<<<<<<< - * self.reader.read(1) * + * cdef void write_record_to_array(array.array outbuf, dict datum, list fields): # <<<<<<<<<<<<<< + * for field in fields: + * try: */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.skip_boolean", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_WriteUnraisable("spavro.fast_binary.write_record_to_array", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_field); + __Pyx_XDECREF(__pyx_v_e); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "spavro/fast_binary.pyx":834 - * self.reader.read(1) +/* "spavro/fast_binary.pyx":913 * - * def skip_int(self): # <<<<<<<<<<<<<< - * read_long(self.reader) + * + * cdef void execute(array.array outbuf, datum, list writer): # <<<<<<<<<<<<<< + * cdef unsigned int writer_f = writer[0] * */ -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_27skip_int(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_27skip_int = {"skip_int", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_27skip_int, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_27skip_int(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("skip_int (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_26skip_int(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_26skip_int(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; +static void __pyx_f_6spavro_11fast_binary_execute(arrayobject *__pyx_v_outbuf, PyObject *__pyx_v_datum, PyObject *__pyx_v_writer) { + unsigned int __pyx_v_writer_f; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("skip_int", 0); + unsigned int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + char __pyx_t_8; + double __pyx_t_9; + float __pyx_t_10; + int __pyx_t_11; + PY_LONG_LONG __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("execute", 0); - /* "spavro/fast_binary.pyx":835 + /* "spavro/fast_binary.pyx":914 * - * def skip_int(self): - * read_long(self.reader) # <<<<<<<<<<<<<< + * cdef void execute(array.array outbuf, datum, list writer): + * cdef unsigned int writer_f = writer[0] # <<<<<<<<<<<<<< * - * def skip_long(self): + * if writer_f == 0: # make_union_writer */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 835, __pyx_L1_error) + if (unlikely(__pyx_v_writer == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 914, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_writer, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 914, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - (void)(__pyx_f_6spavro_11fast_binary_read_long(__pyx_t_1)); + __pyx_t_2 = __Pyx_PyInt_As_unsigned_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 914, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_writer_f = __pyx_t_2; - /* "spavro/fast_binary.pyx":834 - * self.reader.read(1) + /* "spavro/fast_binary.pyx":916 + * cdef unsigned int writer_f = writer[0] * - * def skip_int(self): # <<<<<<<<<<<<<< - * read_long(self.reader) + * if writer_f == 0: # make_union_writer # <<<<<<<<<<<<<< + * write_union_to_array(outbuf, datum, writer[1]) * */ + switch (__pyx_v_writer_f) { + case 0: - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.skip_int", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "spavro/fast_binary.pyx":837 - * read_long(self.reader) + /* "spavro/fast_binary.pyx":917 * - * def skip_long(self): # <<<<<<<<<<<<<< - * read_long(self.reader) + * if writer_f == 0: # make_union_writer + * write_union_to_array(outbuf, datum, writer[1]) # <<<<<<<<<<<<<< * + * elif writer_f == 1: # make_record_writer */ + if (unlikely(__pyx_v_writer == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 917, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_writer, 1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 917, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_f_6spavro_11fast_binary_write_union_to_array(__pyx_v_outbuf, __pyx_v_datum, __pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_29skip_long(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_29skip_long = {"skip_long", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_29skip_long, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_29skip_long(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("skip_long (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_28skip_long(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_28skip_long(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("skip_long", 0); + /* "spavro/fast_binary.pyx":916 + * cdef unsigned int writer_f = writer[0] + * + * if writer_f == 0: # make_union_writer # <<<<<<<<<<<<<< + * write_union_to_array(outbuf, datum, writer[1]) + * + */ + break; + case 1: - /* "spavro/fast_binary.pyx":838 + /* "spavro/fast_binary.pyx":920 * - * def skip_long(self): - * read_long(self.reader) # <<<<<<<<<<<<<< + * elif writer_f == 1: # make_record_writer + * write_record_to_array(outbuf, datum, writer[1]) # <<<<<<<<<<<<<< * - * def skip_float(self): + * # skip make_null_writer */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 838, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - (void)(__pyx_f_6spavro_11fast_binary_read_long(__pyx_t_1)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(PyDict_CheckExact(__pyx_v_datum))||((__pyx_v_datum) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_datum)->tp_name), 0))) __PYX_ERR(0, 920, __pyx_L1_error) + if (unlikely(__pyx_v_writer == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 920, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_writer, 1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 920, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 920, __pyx_L1_error) + __pyx_f_6spavro_11fast_binary_write_record_to_array(__pyx_v_outbuf, ((PyObject*)__pyx_v_datum), ((PyObject*)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":837 - * read_long(self.reader) + /* "spavro/fast_binary.pyx":919 + * write_union_to_array(outbuf, datum, writer[1]) * - * def skip_long(self): # <<<<<<<<<<<<<< - * read_long(self.reader) + * elif writer_f == 1: # make_record_writer # <<<<<<<<<<<<<< + * write_record_to_array(outbuf, datum, writer[1]) * */ + break; + case 3: - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.skip_long", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "spavro/fast_binary.pyx":840 - * read_long(self.reader) + /* "spavro/fast_binary.pyx":925 * - * def skip_float(self): # <<<<<<<<<<<<<< - * read_float(self.reader) + * elif writer_f == 3: # make_string_writer + * if not isinstance(datum, six.string_types): # <<<<<<<<<<<<<< + * raise TypeError("{} - is not a string value.".format(repr(datum))) + * write_utf8_to_array(outbuf, datum) + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_six); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 925, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_string_types); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 925, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = PyObject_IsInstance(__pyx_v_datum, __pyx_t_3); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 925, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = ((!(__pyx_t_4 != 0)) != 0); + if (unlikely(__pyx_t_5)) { + + /* "spavro/fast_binary.pyx":926 + * elif writer_f == 3: # make_string_writer + * if not isinstance(datum, six.string_types): + * raise TypeError("{} - is not a string value.".format(repr(datum))) # <<<<<<<<<<<<<< + * write_utf8_to_array(outbuf, datum) * */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_is_not_a_string_value, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 926, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyObject_Repr(__pyx_v_datum); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 926, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + } + } + __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 926, __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_TypeError, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 926, __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, 926, __pyx_L1_error) -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_31skip_float(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_31skip_float = {"skip_float", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_31skip_float, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_31skip_float(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("skip_float (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_30skip_float(__pyx_self, ((PyObject *)__pyx_v_self)); + /* "spavro/fast_binary.pyx":925 + * + * elif writer_f == 3: # make_string_writer + * if not isinstance(datum, six.string_types): # <<<<<<<<<<<<<< + * raise TypeError("{} - is not a string value.".format(repr(datum))) + * write_utf8_to_array(outbuf, datum) + */ + } - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "spavro/fast_binary.pyx":927 + * if not isinstance(datum, six.string_types): + * raise TypeError("{} - is not a string value.".format(repr(datum))) + * write_utf8_to_array(outbuf, datum) # <<<<<<<<<<<<<< + * + * elif writer_f == 4: # make_boolean_writer + */ + __pyx_f_6spavro_11fast_binary_write_utf8_to_array(__pyx_v_outbuf, __pyx_v_datum); -static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_30skip_float(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("skip_float", 0); + /* "spavro/fast_binary.pyx":924 + * # skip make_null_writer + * + * elif writer_f == 3: # make_string_writer # <<<<<<<<<<<<<< + * if not isinstance(datum, six.string_types): + * raise TypeError("{} - is not a string value.".format(repr(datum))) + */ + break; + case 4: - /* "spavro/fast_binary.pyx":841 + /* "spavro/fast_binary.pyx":930 * - * def skip_float(self): - * read_float(self.reader) # <<<<<<<<<<<<<< + * elif writer_f == 4: # make_boolean_writer + * if not isinstance(datum, bool): # <<<<<<<<<<<<<< + * raise TypeError("{} - Not a boolean value.".format(repr(datum))) + * write_boolean_to_array(outbuf, datum) + */ + __pyx_t_1 = ((PyObject*)&PyBool_Type); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_5 = PyObject_IsInstance(__pyx_v_datum, __pyx_t_1); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 930, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = ((!(__pyx_t_5 != 0)) != 0); + if (unlikely(__pyx_t_4)) { + + /* "spavro/fast_binary.pyx":931 + * elif writer_f == 4: # make_boolean_writer + * if not isinstance(datum, bool): + * raise TypeError("{} - Not a boolean value.".format(repr(datum))) # <<<<<<<<<<<<<< + * write_boolean_to_array(outbuf, datum) * - * def skip_double(self): */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 841, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - (void)(__pyx_f_6spavro_11fast_binary_read_float(__pyx_t_1)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Not_a_boolean_value, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 931, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyObject_Repr(__pyx_v_datum); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 931, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 931, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 931, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 931, __pyx_L1_error) - /* "spavro/fast_binary.pyx":840 - * read_long(self.reader) + /* "spavro/fast_binary.pyx":930 * - * def skip_float(self): # <<<<<<<<<<<<<< - * read_float(self.reader) + * elif writer_f == 4: # make_boolean_writer + * if not isinstance(datum, bool): # <<<<<<<<<<<<<< + * raise TypeError("{} - Not a boolean value.".format(repr(datum))) + * write_boolean_to_array(outbuf, datum) + */ + } + + /* "spavro/fast_binary.pyx":932 + * if not isinstance(datum, bool): + * raise TypeError("{} - Not a boolean value.".format(repr(datum))) + * write_boolean_to_array(outbuf, datum) # <<<<<<<<<<<<<< * + * elif writer_f == 5: # make_double_writer */ + __pyx_t_8 = __Pyx_PyInt_As_char(__pyx_v_datum); if (unlikely((__pyx_t_8 == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 932, __pyx_L1_error) + __pyx_f_6spavro_11fast_binary_write_boolean_to_array(__pyx_v_outbuf, __pyx_t_8); - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.skip_float", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "spavro/fast_binary.pyx":929 + * write_utf8_to_array(outbuf, datum) + * + * elif writer_f == 4: # make_boolean_writer # <<<<<<<<<<<<<< + * if not isinstance(datum, bool): + * raise TypeError("{} - Not a boolean value.".format(repr(datum))) + */ + break; + case 5: -/* "spavro/fast_binary.pyx":843 - * read_float(self.reader) + /* "spavro/fast_binary.pyx":935 * - * def skip_double(self): # <<<<<<<<<<<<<< - * read_double(self.reader) + * elif writer_f == 5: # make_double_writer + * write_double_to_array(outbuf, datum) # <<<<<<<<<<<<<< * + * elif writer_f == 6: # make_float_writer */ + __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_v_datum); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 935, __pyx_L1_error) + __pyx_f_6spavro_11fast_binary_write_double_to_array(__pyx_v_outbuf, __pyx_t_9); -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_33skip_double(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_33skip_double = {"skip_double", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_33skip_double, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_33skip_double(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("skip_double (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_32skip_double(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_32skip_double(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("skip_double", 0); + /* "spavro/fast_binary.pyx":934 + * write_boolean_to_array(outbuf, datum) + * + * elif writer_f == 5: # make_double_writer # <<<<<<<<<<<<<< + * write_double_to_array(outbuf, datum) + * + */ + break; + case 6: - /* "spavro/fast_binary.pyx":844 + /* "spavro/fast_binary.pyx":938 * - * def skip_double(self): - * read_double(self.reader) # <<<<<<<<<<<<<< + * elif writer_f == 6: # make_float_writer + * write_float_to_array(outbuf, datum) # <<<<<<<<<<<<<< * - * def skip_bytes(self): + * elif writer_f == 7: # make_long_writer */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 844, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - (void)(__pyx_f_6spavro_11fast_binary_read_double(__pyx_t_1)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_10 = __pyx_PyFloat_AsFloat(__pyx_v_datum); if (unlikely((__pyx_t_10 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 938, __pyx_L1_error) + __pyx_f_6spavro_11fast_binary_write_float_to_array(__pyx_v_outbuf, __pyx_t_10); - /* "spavro/fast_binary.pyx":843 - * read_float(self.reader) + /* "spavro/fast_binary.pyx":937 + * write_double_to_array(outbuf, datum) * - * def skip_double(self): # <<<<<<<<<<<<<< - * read_double(self.reader) + * elif writer_f == 6: # make_float_writer # <<<<<<<<<<<<<< + * write_float_to_array(outbuf, datum) * */ + break; + case 7: - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.skip_double", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "spavro/fast_binary.pyx":941 + * + * elif writer_f == 7: # make_long_writer + * if not (isinstance(datum, six.integer_types) # <<<<<<<<<<<<<< + * and LONG_MIN_VALUE <= datum <= LONG_MAX_VALUE): + * raise TypeError("{} - Non integer value or overflow.".format(repr(datum))) + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_six); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 941, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_integer_types); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 941, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = PyObject_IsInstance(__pyx_v_datum, __pyx_t_1); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 941, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_11 = (__pyx_t_5 != 0); + if (__pyx_t_11) { + } else { + __pyx_t_4 = __pyx_t_11; + goto __pyx_L6_bool_binop_done; + } -/* "spavro/fast_binary.pyx":846 - * read_double(self.reader) + /* "spavro/fast_binary.pyx":942 + * elif writer_f == 7: # make_long_writer + * if not (isinstance(datum, six.integer_types) + * and LONG_MIN_VALUE <= datum <= LONG_MAX_VALUE): # <<<<<<<<<<<<<< + * raise TypeError("{} - Non integer value or overflow.".format(repr(datum))) + * write_long_to_array(outbuf, datum) + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_LONG_MIN_VALUE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 942, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_v_datum, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 942, __pyx_L1_error) + if (__Pyx_PyObject_IsTrue(__pyx_t_3)) { + __Pyx_DECREF(__pyx_t_3); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_LONG_MAX_VALUE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 942, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_datum, __pyx_t_6, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 942, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 942, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = __pyx_t_11; + __pyx_L6_bool_binop_done:; + + /* "spavro/fast_binary.pyx":941 * - * def skip_bytes(self): # <<<<<<<<<<<<<< - * read_bytes(self.reader) + * elif writer_f == 7: # make_long_writer + * if not (isinstance(datum, six.integer_types) # <<<<<<<<<<<<<< + * and LONG_MIN_VALUE <= datum <= LONG_MAX_VALUE): + * raise TypeError("{} - Non integer value or overflow.".format(repr(datum))) + */ + __pyx_t_11 = ((!__pyx_t_4) != 0); + if (unlikely(__pyx_t_11)) { + + /* "spavro/fast_binary.pyx":943 + * if not (isinstance(datum, six.integer_types) + * and LONG_MIN_VALUE <= datum <= LONG_MAX_VALUE): + * raise TypeError("{} - Non integer value or overflow.".format(repr(datum))) # <<<<<<<<<<<<<< + * write_long_to_array(outbuf, datum) * */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Non_integer_value_or_overflow, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 943, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyObject_Repr(__pyx_v_datum); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 943, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + } + } + __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 943, __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_TypeError, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 943, __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, 943, __pyx_L1_error) -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_35skip_bytes(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_35skip_bytes = {"skip_bytes", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_35skip_bytes, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_35skip_bytes(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("skip_bytes (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_34skip_bytes(__pyx_self, ((PyObject *)__pyx_v_self)); + /* "spavro/fast_binary.pyx":941 + * + * elif writer_f == 7: # make_long_writer + * if not (isinstance(datum, six.integer_types) # <<<<<<<<<<<<<< + * and LONG_MIN_VALUE <= datum <= LONG_MAX_VALUE): + * raise TypeError("{} - Non integer value or overflow.".format(repr(datum))) + */ + } - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "spavro/fast_binary.pyx":944 + * and LONG_MIN_VALUE <= datum <= LONG_MAX_VALUE): + * raise TypeError("{} - Non integer value or overflow.".format(repr(datum))) + * write_long_to_array(outbuf, datum) # <<<<<<<<<<<<<< + * + * elif writer_f == 8: # make_byte_writer + */ + __pyx_t_12 = __Pyx_PyInt_As_PY_LONG_LONG(__pyx_v_datum); if (unlikely((__pyx_t_12 == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 944, __pyx_L1_error) + __pyx_f_6spavro_11fast_binary_write_long_to_array(__pyx_v_outbuf, __pyx_t_12); -static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_34skip_bytes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("skip_bytes", 0); + /* "spavro/fast_binary.pyx":940 + * write_float_to_array(outbuf, datum) + * + * elif writer_f == 7: # make_long_writer # <<<<<<<<<<<<<< + * if not (isinstance(datum, six.integer_types) + * and LONG_MIN_VALUE <= datum <= LONG_MAX_VALUE): + */ + break; + case 8: - /* "spavro/fast_binary.pyx":847 + /* "spavro/fast_binary.pyx":947 * - * def skip_bytes(self): - * read_bytes(self.reader) # <<<<<<<<<<<<<< + * elif writer_f == 8: # make_byte_writer + * write_bytes_to_array(outbuf, datum) # <<<<<<<<<<<<<< * - * def skip_utf8(self): + * elif writer_f == 9: # make_int_writer */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 847, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_f_6spavro_11fast_binary_read_bytes(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 847, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_f_6spavro_11fast_binary_write_bytes_to_array(__pyx_v_outbuf, __pyx_v_datum); - /* "spavro/fast_binary.pyx":846 - * read_double(self.reader) + /* "spavro/fast_binary.pyx":946 + * write_long_to_array(outbuf, datum) * - * def skip_bytes(self): # <<<<<<<<<<<<<< - * read_bytes(self.reader) + * elif writer_f == 8: # make_byte_writer # <<<<<<<<<<<<<< + * write_bytes_to_array(outbuf, datum) * */ + break; + case 9: - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.skip_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "spavro/fast_binary.pyx":950 + * + * elif writer_f == 9: # make_int_writer + * if not isinstance(datum, six.integer_types): # <<<<<<<<<<<<<< + * raise TypeError("Schema violation, {} is not an example of integer".format(datum)) + * if not INT_MIN_VALUE <= datum <= INT_MAX_VALUE: + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_six); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 950, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_integer_types); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 950, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_11 = PyObject_IsInstance(__pyx_v_datum, __pyx_t_3); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 950, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = ((!(__pyx_t_11 != 0)) != 0); + if (unlikely(__pyx_t_4)) { -/* "spavro/fast_binary.pyx":849 - * read_bytes(self.reader) + /* "spavro/fast_binary.pyx":951 + * elif writer_f == 9: # make_int_writer + * if not isinstance(datum, six.integer_types): + * raise TypeError("Schema violation, {} is not an example of integer".format(datum)) # <<<<<<<<<<<<<< + * if not INT_MIN_VALUE <= datum <= INT_MAX_VALUE: + * raise TypeError("Schema violation, value overflow. {} can't be stored in schema".format(datum)) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Schema_violation_is_not_an_examp, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 951, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + } + } + __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_v_datum) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_datum); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 951, __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_TypeError, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 951, __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, 951, __pyx_L1_error) + + /* "spavro/fast_binary.pyx":950 * - * def skip_utf8(self): # <<<<<<<<<<<<<< - * read_utf8(self.reader) + * elif writer_f == 9: # make_int_writer + * if not isinstance(datum, six.integer_types): # <<<<<<<<<<<<<< + * raise TypeError("Schema violation, {} is not an example of integer".format(datum)) + * if not INT_MIN_VALUE <= datum <= INT_MAX_VALUE: + */ + } + + /* "spavro/fast_binary.pyx":952 + * if not isinstance(datum, six.integer_types): + * raise TypeError("Schema violation, {} is not an example of integer".format(datum)) + * if not INT_MIN_VALUE <= datum <= INT_MAX_VALUE: # <<<<<<<<<<<<<< + * raise TypeError("Schema violation, value overflow. {} can't be stored in schema".format(datum)) + * write_long_to_array(outbuf, datum) + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_INT_MIN_VALUE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 952, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_v_datum, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 952, __pyx_L1_error) + if (__Pyx_PyObject_IsTrue(__pyx_t_3)) { + __Pyx_DECREF(__pyx_t_3); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_INT_MAX_VALUE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 952, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_datum, __pyx_t_6, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 952, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 952, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_11 = ((!__pyx_t_4) != 0); + if (unlikely(__pyx_t_11)) { + + /* "spavro/fast_binary.pyx":953 + * raise TypeError("Schema violation, {} is not an example of integer".format(datum)) + * if not INT_MIN_VALUE <= datum <= INT_MAX_VALUE: + * raise TypeError("Schema violation, value overflow. {} can't be stored in schema".format(datum)) # <<<<<<<<<<<<<< + * write_long_to_array(outbuf, datum) + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Schema_violation_value_overflow, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 953, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + } + } + __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_v_datum) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_datum); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 953, __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_TypeError, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 953, __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, 953, __pyx_L1_error) + + /* "spavro/fast_binary.pyx":952 + * if not isinstance(datum, six.integer_types): + * raise TypeError("Schema violation, {} is not an example of integer".format(datum)) + * if not INT_MIN_VALUE <= datum <= INT_MAX_VALUE: # <<<<<<<<<<<<<< + * raise TypeError("Schema violation, value overflow. {} can't be stored in schema".format(datum)) + * write_long_to_array(outbuf, datum) + */ + } + + /* "spavro/fast_binary.pyx":954 + * if not INT_MIN_VALUE <= datum <= INT_MAX_VALUE: + * raise TypeError("Schema violation, value overflow. {} can't be stored in schema".format(datum)) + * write_long_to_array(outbuf, datum) # <<<<<<<<<<<<<< * + * elif writer_f == 10: # make_fixed_writer */ + __pyx_t_12 = __Pyx_PyInt_As_PY_LONG_LONG(__pyx_v_datum); if (unlikely((__pyx_t_12 == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 954, __pyx_L1_error) + __pyx_f_6spavro_11fast_binary_write_long_to_array(__pyx_v_outbuf, __pyx_t_12); -/* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_37skip_utf8(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_37skip_utf8 = {"skip_utf8", (PyCFunction)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_37skip_utf8, METH_O, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_37skip_utf8(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("skip_utf8 (wrapper)", 0); - __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_36skip_utf8(__pyx_self, ((PyObject *)__pyx_v_self)); + /* "spavro/fast_binary.pyx":949 + * write_bytes_to_array(outbuf, datum) + * + * elif writer_f == 9: # make_int_writer # <<<<<<<<<<<<<< + * if not isinstance(datum, six.integer_types): + * raise TypeError("Schema violation, {} is not an example of integer".format(datum)) + */ + break; + case 10: - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "spavro/fast_binary.pyx":957 + * + * elif writer_f == 10: # make_fixed_writer + * write_fixed_to_array(outbuf, datum) # <<<<<<<<<<<<<< + * + * elif writer_f == 11: # make_enum_writer + */ + __pyx_f_6spavro_11fast_binary_write_fixed_to_array(__pyx_v_outbuf, __pyx_v_datum); -static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_36skip_utf8(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("skip_utf8", 0); + /* "spavro/fast_binary.pyx":956 + * write_long_to_array(outbuf, datum) + * + * elif writer_f == 10: # make_fixed_writer # <<<<<<<<<<<<<< + * write_fixed_to_array(outbuf, datum) + * + */ + break; + case 11: - /* "spavro/fast_binary.pyx":850 + /* "spavro/fast_binary.pyx":960 * - * def skip_utf8(self): - * read_utf8(self.reader) # <<<<<<<<<<<<<< + * elif writer_f == 11: # make_enum_writer + * write_enum_to_array(outbuf, datum, writer[1]) # <<<<<<<<<<<<<< * - * def skip(self, n): + * elif writer_f == 12: # make_union_writer */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 850, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_f_6spavro_11fast_binary_read_utf8(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 850, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_8 = __Pyx_PyInt_As_char(__pyx_v_datum); if (unlikely((__pyx_t_8 == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 960, __pyx_L1_error) + if (unlikely(__pyx_v_writer == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 960, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_writer, 1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 960, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 960, __pyx_L1_error) + __pyx_f_6spavro_11fast_binary_write_enum_to_array(__pyx_v_outbuf, __pyx_t_8, ((PyObject*)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":849 - * read_bytes(self.reader) + /* "spavro/fast_binary.pyx":959 + * write_fixed_to_array(outbuf, datum) + * + * elif writer_f == 11: # make_enum_writer # <<<<<<<<<<<<<< + * write_enum_to_array(outbuf, datum, writer[1]) + * + */ + break; + case 12: + + /* "spavro/fast_binary.pyx":963 + * + * elif writer_f == 12: # make_union_writer + * write_array_to_array(outbuf, datum, writer[1]) # <<<<<<<<<<<<<< + * + * elif writer_f == 13: # make_union_writer + */ + if (!(likely(PyList_CheckExact(__pyx_v_datum))||((__pyx_v_datum) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_datum)->tp_name), 0))) __PYX_ERR(0, 963, __pyx_L1_error) + if (unlikely(__pyx_v_writer == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 963, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_writer, 1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 963, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 963, __pyx_L1_error) + __pyx_f_6spavro_11fast_binary_write_array_to_array(__pyx_v_outbuf, ((PyObject*)__pyx_v_datum), ((PyObject*)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spavro/fast_binary.pyx":962 + * write_enum_to_array(outbuf, datum, writer[1]) + * + * elif writer_f == 12: # make_union_writer # <<<<<<<<<<<<<< + * write_array_to_array(outbuf, datum, writer[1]) + * + */ + break; + case 13: + + /* "spavro/fast_binary.pyx":966 + * + * elif writer_f == 13: # make_union_writer + * write_map_to_array(outbuf, datum, writer[1]) # <<<<<<<<<<<<<< + * + * + */ + if (!(likely(PyDict_CheckExact(__pyx_v_datum))||((__pyx_v_datum) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_datum)->tp_name), 0))) __PYX_ERR(0, 966, __pyx_L1_error) + if (unlikely(__pyx_v_writer == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 966, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_writer, 1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 966, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 966, __pyx_L1_error) + __pyx_f_6spavro_11fast_binary_write_map_to_array(__pyx_v_outbuf, ((PyObject*)__pyx_v_datum), ((PyObject*)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spavro/fast_binary.pyx":965 + * write_array_to_array(outbuf, datum, writer[1]) + * + * elif writer_f == 13: # make_union_writer # <<<<<<<<<<<<<< + * write_map_to_array(outbuf, datum, writer[1]) + * + */ + break; + default: break; + } + + /* "spavro/fast_binary.pyx":913 * - * def skip_utf8(self): # <<<<<<<<<<<<<< - * read_utf8(self.reader) + * + * cdef void execute(array.array outbuf, datum, list writer): # <<<<<<<<<<<<<< + * cdef unsigned int writer_f = writer[0] * */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.skip_utf8", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_WriteUnraisable("spavro.fast_binary.execute", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "spavro/fast_binary.pyx":852 - * read_utf8(self.reader) +/* "spavro/fast_binary.pyx":969 * - * def skip(self, n): # <<<<<<<<<<<<<< - * self.reader.seek(self.reader.tell() + n) + * + * def write(iobuffer, datum, writer, schema): # <<<<<<<<<<<<<< + * cdef array.array outbuf = array.array('B', []) + * execute(outbuf, datum, writer) */ /* Python wrapper */ -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_39skip(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_39skip = {"skip", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_39skip, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_39skip(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_n = 0; +static PyObject *__pyx_pw_6spavro_11fast_binary_97write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_6spavro_11fast_binary_97write = {"write", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6spavro_11fast_binary_97write, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_6spavro_11fast_binary_97write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_iobuffer = 0; + PyObject *__pyx_v_datum = 0; + PyObject *__pyx_v_writer = 0; + CYTHON_UNUSED PyObject *__pyx_v_schema = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("skip (wrapper)", 0); + __Pyx_RefNannySetupContext("write (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_n,0}; - PyObject* values[2] = {0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_iobuffer,&__pyx_n_s_datum,&__pyx_n_s_writer,&__pyx_n_s_schema,0}; + PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -21764,108 +20929,138 @@ static PyObject *__pyx_pw_6spavro_11fast_binary_17FastBinaryDecoder_39skip(PyObj kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_iobuffer)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_datum)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("write", 1, 4, 4, 1); __PYX_ERR(0, 969, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_writer)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("write", 1, 4, 4, 2); __PYX_ERR(0, 969, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_schema)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("skip", 1, 2, 2, 1); __PYX_ERR(0, 852, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("write", 1, 4, 4, 3); __PYX_ERR(0, 969, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "skip") < 0)) __PYX_ERR(0, 852, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write") < 0)) __PYX_ERR(0, 969, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } - __pyx_v_self = values[0]; - __pyx_v_n = values[1]; + __pyx_v_iobuffer = values[0]; + __pyx_v_datum = values[1]; + __pyx_v_writer = values[2]; + __pyx_v_schema = values[3]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("skip", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 852, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("write", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 969, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.skip", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.write", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_38skip(__pyx_self, __pyx_v_self, __pyx_v_n); + __pyx_r = __pyx_pf_6spavro_11fast_binary_96write(__pyx_self, __pyx_v_iobuffer, __pyx_v_datum, __pyx_v_writer, __pyx_v_schema); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_38skip(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_n) { +static PyObject *__pyx_pf_6spavro_11fast_binary_96write(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_iobuffer, PyObject *__pyx_v_datum, PyObject *__pyx_v_writer, CYTHON_UNUSED PyObject *__pyx_v_schema) { + arrayobject *__pyx_v_outbuf = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - __Pyx_RefNannySetupContext("skip", 0); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write", 0); - /* "spavro/fast_binary.pyx":853 + /* "spavro/fast_binary.pyx":970 * - * def skip(self, n): - * self.reader.seek(self.reader.tell() + n) # <<<<<<<<<<<<<< + * def write(iobuffer, datum, writer, schema): + * cdef array.array outbuf = array.array('B', []) # <<<<<<<<<<<<<< + * execute(outbuf, datum, writer) + * iobuffer.write(outbuf.data.as_chars[:len(outbuf)]) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 853, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 970, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 970, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_seek); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 853, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_n_s_B); + __Pyx_GIVEREF(__pyx_n_s_B); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_B); + __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_7cpython_5array_array), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 970, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reader); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 853, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_tell); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 853, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 853, __pyx_L1_error) + __pyx_v_outbuf = ((arrayobject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spavro/fast_binary.pyx":971 + * def write(iobuffer, datum, writer, schema): + * cdef array.array outbuf = array.array('B', []) + * execute(outbuf, datum, writer) # <<<<<<<<<<<<<< + * iobuffer.write(outbuf.data.as_chars[:len(outbuf)]) + */ + if (!(likely(PyList_CheckExact(__pyx_v_writer))||((__pyx_v_writer) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_writer)->tp_name), 0))) __PYX_ERR(0, 971, __pyx_L1_error) + __pyx_f_6spavro_11fast_binary_execute(__pyx_v_outbuf, __pyx_v_datum, ((PyObject*)__pyx_v_writer)); + + /* "spavro/fast_binary.pyx":972 + * cdef array.array outbuf = array.array('B', []) + * execute(outbuf, datum, writer) + * iobuffer.write(outbuf.data.as_chars[:len(outbuf)]) # <<<<<<<<<<<<<< + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_iobuffer, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 972, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Add(__pyx_t_2, __pyx_v_n); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 853, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = Py_SIZE(((PyObject *)__pyx_v_outbuf)); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 972, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_outbuf->data.as_chars + 0, __pyx_t_3 - 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 972, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __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_3, function); + __Pyx_DECREF_SET(__pyx_t_2, function); } } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 853, __pyx_L1_error) + __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 972, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":852 - * read_utf8(self.reader) + /* "spavro/fast_binary.pyx":969 * - * def skip(self, n): # <<<<<<<<<<<<<< - * self.reader.seek(self.reader.tell() + n) + * + * def write(iobuffer, datum, writer, schema): # <<<<<<<<<<<<<< + * cdef array.array outbuf = array.array('B', []) + * execute(outbuf, datum, writer) */ /* function exit code */ @@ -21874,667 +21069,777 @@ static PyObject *__pyx_pf_6spavro_11fast_binary_17FastBinaryDecoder_38skip(CYTHO __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("spavro.fast_binary.FastBinaryDecoder.skip", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("spavro.fast_binary.write", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_outbuf); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_void____object____long__long___to_py") - * cdef object __Pyx_CFunc_void____object____long__long___to_py(void (*f)(object, long long) except *): - * def wrap(object outbuf, long long signed_datum): # <<<<<<<<<<<<<< - * """wrap(outbuf, signed_datum: 'long long') -> 'void'""" - * f(outbuf, signed_datum) +/* "cpython/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 PyObject *__pyx_pw_11cfunc_dot_to_py_48__Pyx_CFunc_void____object____long__long___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11cfunc_dot_to_py_48__Pyx_CFunc_void____object____long__long___to_py_wrap[] = "wrap(outbuf, signed_datum: 'long long') -> 'void'"; -static PyMethodDef __pyx_mdef_11cfunc_dot_to_py_48__Pyx_CFunc_void____object____long__long___to_py_1wrap = {"wrap", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11cfunc_dot_to_py_48__Pyx_CFunc_void____object____long__long___to_py_1wrap, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11cfunc_dot_to_py_48__Pyx_CFunc_void____object____long__long___to_py_wrap}; -static PyObject *__pyx_pw_11cfunc_dot_to_py_48__Pyx_CFunc_void____object____long__long___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_outbuf = 0; - PY_LONG_LONG __pyx_v_signed_datum; - PyObject *__pyx_r = 0; +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("wrap (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_outbuf,&__pyx_n_s_signed_datum,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outbuf)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_signed_datum)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("wrap", 1, 2, 2, 1); __PYX_ERR(1, 65, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "wrap") < 0)) __PYX_ERR(1, 65, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_outbuf = values[0]; - __pyx_v_signed_datum = __Pyx_PyInt_As_PY_LONG_LONG(values[1]); if (unlikely((__pyx_v_signed_datum == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(1, 65, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("wrap", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 65, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_void____object____long__long___to_py.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11cfunc_dot_to_py_48__Pyx_CFunc_void____object____long__long___to_py_wrap(__pyx_self, __pyx_v_outbuf, __pyx_v_signed_datum); + __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 PyObject *__pyx_pf_11cfunc_dot_to_py_48__Pyx_CFunc_void____object____long__long___to_py_wrap(PyObject *__pyx_self, PyObject *__pyx_v_outbuf, PY_LONG_LONG __pyx_v_signed_datum) { - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py *__pyx_cur_scope; - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py *__pyx_outer_scope; - PyObject *__pyx_r = NULL; +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 - __Pyx_RefNannySetupContext("wrap", 0); - __pyx_outer_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; + 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; + char __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + 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); - /* "cfunc.to_py":67 - * def wrap(object outbuf, long long signed_datum): - * """wrap(outbuf, signed_datum: 'long long') -> 'void'""" - * f(outbuf, signed_datum) # <<<<<<<<<<<<<< - * return wrap + /* "cpython/array.pxd":98 + * # In particular strided access is always provided regardless + * # of flags + * item_count = Py_SIZE(self) # <<<<<<<<<<<<<< * + * info.suboffsets = NULL */ - __pyx_cur_scope->__pyx_v_f(__pyx_v_outbuf, __pyx_v_signed_datum); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 67, __pyx_L1_error) + __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; - /* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_void____object____long__long___to_py") - * cdef object __Pyx_CFunc_void____object____long__long___to_py(void (*f)(object, long long) except *): - * def wrap(object outbuf, long long signed_datum): # <<<<<<<<<<<<<< - * """wrap(outbuf, signed_datum: 'long long') -> 'void'""" - * f(outbuf, signed_datum) + /* "cpython/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; - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_void____object____long__long___to_py.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "cpython/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; -/* "cfunc.to_py":64 + /* "cpython/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; + + /* "cpython/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; + + /* "cpython/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 * - * @cname("__Pyx_CFunc_void____object____long__long___to_py") - * cdef object __Pyx_CFunc_void____object____long__long___to_py(void (*f)(object, long long) except *): # <<<<<<<<<<<<<< - * def wrap(object outbuf, long long signed_datum): - * """wrap(outbuf, signed_datum: 'long long') -> 'void'""" */ + __pyx_t_3 = __pyx_v_self->ob_descr->itemsize; + __pyx_v_info->itemsize = __pyx_t_3; -static PyObject *__Pyx_CFunc_void____object____long__long___to_py(void (*__pyx_v_f)(PyObject *, PY_LONG_LONG)) { - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py *__pyx_cur_scope; - PyObject *__pyx_v_wrap = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__Pyx_CFunc_void____object____long__long___to_py", 0); - __pyx_cur_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py *)__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py(__pyx_ptype___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(1, 64, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); + /* "cpython/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; + + /* "cpython/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))); + + /* "cpython/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)) { + + /* "cpython/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) + + /* "cpython/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_cur_scope->__pyx_v_f = __pyx_v_f; - /* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_void____object____long__long___to_py") - * cdef object __Pyx_CFunc_void____object____long__long___to_py(void (*f)(object, long long) except *): - * def wrap(object outbuf, long long signed_datum): # <<<<<<<<<<<<<< - * """wrap(outbuf, signed_datum: 'long long') -> 'void'""" - * f(outbuf, signed_datum) + /* "cpython/array.pxd":110 + * if not info.shape: + * raise MemoryError() + * info.shape[0] = item_count # constant regardless of resizing # <<<<<<<<<<<<<< + * info.strides = &info.itemsize + * */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11cfunc_dot_to_py_48__Pyx_CFunc_void____object____long__long___to_py_1wrap, 0, __pyx_n_s_Pyx_CFunc_void____object____lo, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cfunc_to_py, __pyx_d, ((PyObject *)__pyx_codeobj__58)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_wrap = __pyx_t_1; - __pyx_t_1 = 0; + __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; - /* "cfunc.to_py":68 - * """wrap(outbuf, signed_datum: 'long long') -> 'void'""" - * f(outbuf, signed_datum) - * return wrap # <<<<<<<<<<<<<< + /* "cpython/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); + + /* "cpython/array.pxd":113 + * info.strides = &info.itemsize * + * info.format = (info.shape + 1) # <<<<<<<<<<<<<< + * info.format[0] = self.ob_descr.typecode + * info.format[1] = 0 */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_wrap); - __pyx_r = __pyx_v_wrap; - goto __pyx_L0; + __pyx_v_info->format = ((char *)(__pyx_v_info->shape + 1)); - /* "cfunc.to_py":64 + /* "cpython/array.pxd":114 * - * @cname("__Pyx_CFunc_void____object____long__long___to_py") - * cdef object __Pyx_CFunc_void____object____long__long___to_py(void (*f)(object, long long) except *): # <<<<<<<<<<<<<< - * def wrap(object outbuf, long long signed_datum): - * """wrap(outbuf, signed_datum: 'long long') -> 'void'""" + * info.format = (info.shape + 1) + * info.format[0] = self.ob_descr.typecode # <<<<<<<<<<<<<< + * info.format[1] = 0 + * info.obj = self + */ + __pyx_t_7 = __pyx_v_self->ob_descr->typecode; + (__pyx_v_info->format[0]) = __pyx_t_7; + + /* "cpython/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; + + /* "cpython/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); + + /* "cpython/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_AddTraceback("cfunc.to_py.__Pyx_CFunc_void____object____long__long___to_py", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __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:; - __Pyx_XDECREF(__pyx_v_wrap); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); + 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; } -/* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_object____object___to_py") - * cdef object __Pyx_CFunc_object____object___to_py(object (*f)(object) ): - * def wrap(object fo): # <<<<<<<<<<<<<< - * """wrap(fo)""" - * return f(fo) +/* "cpython/array.pxd":118 + * info.obj = self + * + * def __releasebuffer__(self, Py_buffer* info): # <<<<<<<<<<<<<< + * PyObject_Free(info.shape) + * */ /* Python wrapper */ -static PyObject *__pyx_pw_11cfunc_dot_to_py_36__Pyx_CFunc_object____object___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo); /*proto*/ -static char __pyx_doc_11cfunc_dot_to_py_36__Pyx_CFunc_object____object___to_py_wrap[] = "wrap(fo)"; -static PyMethodDef __pyx_mdef_11cfunc_dot_to_py_36__Pyx_CFunc_object____object___to_py_1wrap = {"wrap", (PyCFunction)__pyx_pw_11cfunc_dot_to_py_36__Pyx_CFunc_object____object___to_py_1wrap, METH_O, __pyx_doc_11cfunc_dot_to_py_36__Pyx_CFunc_object____object___to_py_wrap}; -static PyObject *__pyx_pw_11cfunc_dot_to_py_36__Pyx_CFunc_object____object___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo) { - PyObject *__pyx_r = 0; +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("wrap (wrapper)", 0); - __pyx_r = __pyx_pf_11cfunc_dot_to_py_36__Pyx_CFunc_object____object___to_py_wrap(__pyx_self, ((PyObject *)__pyx_v_fo)); + __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(); - return __pyx_r; } -static PyObject *__pyx_pf_11cfunc_dot_to_py_36__Pyx_CFunc_object____object___to_py_wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo) { - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object___to_py *__pyx_cur_scope; - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object___to_py *__pyx_outer_scope; - PyObject *__pyx_r = NULL; +static void __pyx_pf_7cpython_5array_5array_2__releasebuffer__(CYTHON_UNUSED arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("wrap", 0); - __pyx_outer_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object___to_py *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; + __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "cfunc.to_py":67 - * def wrap(object fo): - * """wrap(fo)""" - * return f(fo) # <<<<<<<<<<<<<< - * return wrap + /* "cpython/array.pxd":119 * + * def __releasebuffer__(self, Py_buffer* info): + * PyObject_Free(info.shape) # <<<<<<<<<<<<<< + * + * array newarrayobject(PyTypeObject* type, Py_ssize_t size, arraydescr *descr) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_cur_scope->__pyx_v_f(__pyx_v_fo); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 67, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + PyObject_Free(__pyx_v_info->shape); - /* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_object____object___to_py") - * cdef object __Pyx_CFunc_object____object___to_py(object (*f)(object) ): - * def wrap(object fo): # <<<<<<<<<<<<<< - * """wrap(fo)""" - * return f(fo) + /* "cpython/array.pxd":118 + * info.obj = self + * + * def __releasebuffer__(self, Py_buffer* info): # <<<<<<<<<<<<<< + * PyObject_Free(info.shape) + * */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_object____object___to_py.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "cfunc.to_py":64 +/* "cpython/array.pxd":130 * - * @cname("__Pyx_CFunc_object____object___to_py") - * cdef object __Pyx_CFunc_object____object___to_py(object (*f)(object) ): # <<<<<<<<<<<<<< - * def wrap(object fo): - * """wrap(fo)""" + * + * 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 PyObject *__Pyx_CFunc_object____object___to_py(PyObject *(*__pyx_v_f)(PyObject *)) { - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object___to_py *__pyx_cur_scope; - PyObject *__pyx_v_wrap = 0; - PyObject *__pyx_r = NULL; +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 = 0; + arrayobject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__Pyx_CFunc_object____object___to_py", 0); - __pyx_cur_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object___to_py *)__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_object____object___to_py(__pyx_ptype___pyx_scope_struct____Pyx_CFunc_object____object___to_py, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object___to_py *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(1, 64, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } - __pyx_cur_scope->__pyx_v_f = __pyx_v_f; - - /* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_object____object___to_py") - * cdef object __Pyx_CFunc_object____object___to_py(object (*f)(object) ): - * def wrap(object fo): # <<<<<<<<<<<<<< - * """wrap(fo)""" - * return f(fo) - */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11cfunc_dot_to_py_36__Pyx_CFunc_object____object___to_py_1wrap, 0, __pyx_n_s_Pyx_CFunc_object____object___t, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cfunc_to_py, __pyx_d, ((PyObject *)__pyx_codeobj__60)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 65, __pyx_L1_error) + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("clone", 0); + + /* "cpython/array.pxd":134 + * type will be same as template. + * if zero is true, new array will be initialized with zeroes.""" + * cdef array 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_wrap = __pyx_t_1; + __pyx_v_op = ((arrayobject *)__pyx_t_1); __pyx_t_1 = 0; - /* "cfunc.to_py":68 - * """wrap(fo)""" - * return f(fo) - * return wrap # <<<<<<<<<<<<<< + /* "cpython/array.pxd":135 + * if zero is true, new array will be initialized with zeroes.""" + * cdef array 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) { + + /* "cpython/array.pxd":136 + * cdef array 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))); + + /* "cpython/array.pxd":135 + * if zero is true, new array will be initialized with zeroes.""" + * cdef array 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 + */ + } + + /* "cpython/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(__pyx_r); - __Pyx_INCREF(__pyx_v_wrap); - __pyx_r = __pyx_v_wrap; + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_op)); + __pyx_r = __pyx_v_op; goto __pyx_L0; - /* "cfunc.to_py":64 + /* "cpython/array.pxd":130 * - * @cname("__Pyx_CFunc_object____object___to_py") - * cdef object __Pyx_CFunc_object____object___to_py(object (*f)(object) ): # <<<<<<<<<<<<<< - * def wrap(object fo): - * """wrap(fo)""" + * + * 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("cfunc.to_py.__Pyx_CFunc_object____object___to_py", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cpython.array.clone", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_wrap); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF((PyObject *)__pyx_v_op); + __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_unicode____object___to_py") - * cdef object __Pyx_CFunc_unicode____object___to_py(unicode (*f)(object) ): - * def wrap(object fo): # <<<<<<<<<<<<<< - * """wrap(fo) -> unicode""" - * return f(fo) +/* "cpython/array.pxd":139 + * return op + * + * cdef inline array copy(array self): # <<<<<<<<<<<<<< + * """ make a copy of an array. """ + * cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr) */ -/* Python wrapper */ -static PyObject *__pyx_pw_11cfunc_dot_to_py_37__Pyx_CFunc_unicode____object___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo); /*proto*/ -static char __pyx_doc_11cfunc_dot_to_py_37__Pyx_CFunc_unicode____object___to_py_wrap[] = "wrap(fo) -> unicode"; -static PyMethodDef __pyx_mdef_11cfunc_dot_to_py_37__Pyx_CFunc_unicode____object___to_py_1wrap = {"wrap", (PyCFunction)__pyx_pw_11cfunc_dot_to_py_37__Pyx_CFunc_unicode____object___to_py_1wrap, METH_O, __pyx_doc_11cfunc_dot_to_py_37__Pyx_CFunc_unicode____object___to_py_wrap}; -static PyObject *__pyx_pw_11cfunc_dot_to_py_37__Pyx_CFunc_unicode____object___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("wrap (wrapper)", 0); - __pyx_r = __pyx_pf_11cfunc_dot_to_py_37__Pyx_CFunc_unicode____object___to_py_wrap(__pyx_self, ((PyObject *)__pyx_v_fo)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11cfunc_dot_to_py_37__Pyx_CFunc_unicode____object___to_py_wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo) { - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py *__pyx_cur_scope; - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py *__pyx_outer_scope; - PyObject *__pyx_r = NULL; +static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_copy(arrayobject *__pyx_v_self) { + arrayobject *__pyx_v_op = 0; + arrayobject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("wrap", 0); - __pyx_outer_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy", 0); + + /* "cpython/array.pxd":141 + * cdef inline array copy(array self): + * """ make a copy of an array. """ + * cdef 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; - /* "cfunc.to_py":67 - * def wrap(object fo): - * """wrap(fo) -> unicode""" - * return f(fo) # <<<<<<<<<<<<<< - * return wrap + /* "cpython/array.pxd":142 + * """ make a copy of an array. """ + * cdef 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_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_cur_scope->__pyx_v_f(__pyx_v_fo); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 67, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + (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))); + + /* "cpython/array.pxd":143 + * cdef 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 # <<<<<<<<<<<<<< + * + * 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; - /* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_unicode____object___to_py") - * cdef object __Pyx_CFunc_unicode____object___to_py(unicode (*f)(object) ): - * def wrap(object fo): # <<<<<<<<<<<<<< - * """wrap(fo) -> unicode""" - * return f(fo) + /* "cpython/array.pxd":139 + * return op + * + * cdef inline array copy(array self): # <<<<<<<<<<<<<< + * """ make a copy of an array. """ + * cdef 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("cfunc.to_py.__Pyx_CFunc_unicode____object___to_py.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("cpython.array.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF((PyObject *)__pyx_v_op); + __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "cfunc.to_py":64 +/* "cpython/array.pxd":145 + * return op * - * @cname("__Pyx_CFunc_unicode____object___to_py") - * cdef object __Pyx_CFunc_unicode____object___to_py(unicode (*f)(object) ): # <<<<<<<<<<<<<< - * def wrap(object fo): - * """wrap(fo) -> unicode""" + * 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 PyObject *__Pyx_CFunc_unicode____object___to_py(PyObject *(*__pyx_v_f)(PyObject *)) { - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py *__pyx_cur_scope; - PyObject *__pyx_v_wrap = 0; - PyObject *__pyx_r = NULL; +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 - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__Pyx_CFunc_unicode____object___to_py", 0); - __pyx_cur_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py *)__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py(__pyx_ptype___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(1, 64, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } - __pyx_cur_scope->__pyx_v_f = __pyx_v_f; + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("extend_buffer", 0); - /* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_unicode____object___to_py") - * cdef object __Pyx_CFunc_unicode____object___to_py(unicode (*f)(object) ): - * def wrap(object fo): # <<<<<<<<<<<<<< - * """wrap(fo) -> unicode""" - * return f(fo) + /* "cpython/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_CyFunction_NewEx(&__pyx_mdef_11cfunc_dot_to_py_37__Pyx_CFunc_unicode____object___to_py_1wrap, 0, __pyx_n_s_Pyx_CFunc_unicode____object, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cfunc_to_py, __pyx_d, ((PyObject *)__pyx_codeobj__62)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_wrap = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_1 = __pyx_v_self->ob_descr->itemsize; + __pyx_v_itemsize = __pyx_t_1; - /* "cfunc.to_py":68 - * """wrap(fo) -> unicode""" - * return f(fo) - * return wrap # <<<<<<<<<<<<<< + /* "cpython/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)); + + /* "cpython/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) + + /* "cpython/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))); + + /* "cpython/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_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_wrap); - __pyx_r = __pyx_v_wrap; + __pyx_r = 0; goto __pyx_L0; - /* "cfunc.to_py":64 + /* "cpython/array.pxd":145 + * return op * - * @cname("__Pyx_CFunc_unicode____object___to_py") - * cdef object __Pyx_CFunc_unicode____object___to_py(unicode (*f)(object) ): # <<<<<<<<<<<<<< - * def wrap(object fo): - * """wrap(fo) -> unicode""" + * 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_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_unicode____object___to_py", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_AddTraceback("cpython.array.extend_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_wrap); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_bint____object___to_py") - * cdef object __Pyx_CFunc_bint____object___to_py(bint (*f)(object) except *): - * def wrap(object fo): # <<<<<<<<<<<<<< - * """wrap(fo) -> bool""" - * return f(fo) +/* "cpython/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: */ -/* Python wrapper */ -static PyObject *__pyx_pw_11cfunc_dot_to_py_34__Pyx_CFunc_bint____object___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo); /*proto*/ -static char __pyx_doc_11cfunc_dot_to_py_34__Pyx_CFunc_bint____object___to_py_wrap[] = "wrap(fo) -> bool"; -static PyMethodDef __pyx_mdef_11cfunc_dot_to_py_34__Pyx_CFunc_bint____object___to_py_1wrap = {"wrap", (PyCFunction)__pyx_pw_11cfunc_dot_to_py_34__Pyx_CFunc_bint____object___to_py_1wrap, METH_O, __pyx_doc_11cfunc_dot_to_py_34__Pyx_CFunc_bint____object___to_py_wrap}; -static PyObject *__pyx_pw_11cfunc_dot_to_py_34__Pyx_CFunc_bint____object___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo) { - PyObject *__pyx_r = 0; +static CYTHON_INLINE int __pyx_f_7cpython_5array_extend(arrayobject *__pyx_v_self, arrayobject *__pyx_v_other) { + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("wrap (wrapper)", 0); - __pyx_r = __pyx_pf_11cfunc_dot_to_py_34__Pyx_CFunc_bint____object___to_py_wrap(__pyx_self, ((PyObject *)__pyx_v_fo)); + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("extend", 0); + + /* "cpython/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) { - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "cpython/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) -static PyObject *__pyx_pf_11cfunc_dot_to_py_34__Pyx_CFunc_bint____object___to_py_wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo) { - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bint____object___to_py *__pyx_cur_scope; - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bint____object___to_py *__pyx_outer_scope; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("wrap", 0); - __pyx_outer_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bint____object___to_py *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; + /* "cpython/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)) + */ + } - /* "cfunc.to_py":67 - * def wrap(object fo): - * """wrap(fo) -> bool""" - * return f(fo) # <<<<<<<<<<<<<< - * return wrap + /* "cpython/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_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_cur_scope->__pyx_v_f(__pyx_v_fo); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(1, 67, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 67, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __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; - __pyx_t_2 = 0; goto __pyx_L0; - /* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_bint____object___to_py") - * cdef object __Pyx_CFunc_bint____object___to_py(bint (*f)(object) except *): - * def wrap(object fo): # <<<<<<<<<<<<<< - * """wrap(fo) -> bool""" - * return f(fo) + /* "cpython/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_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_bint____object___to_py.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("cpython.array.extend", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "cfunc.to_py":64 +/* "cpython/array.pxd":161 + * return extend_buffer(self, other.data.as_chars, Py_SIZE(other)) * - * @cname("__Pyx_CFunc_bint____object___to_py") - * cdef object __Pyx_CFunc_bint____object___to_py(bint (*f)(object) except *): # <<<<<<<<<<<<<< - * def wrap(object fo): - * """wrap(fo) -> bool""" + * 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 PyObject *__Pyx_CFunc_bint____object___to_py(int (*__pyx_v_f)(PyObject *)) { - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bint____object___to_py *__pyx_cur_scope; - PyObject *__pyx_v_wrap = 0; - PyObject *__pyx_r = NULL; +static CYTHON_INLINE void __pyx_f_7cpython_5array_zero(arrayobject *__pyx_v_self) { __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__Pyx_CFunc_bint____object___to_py", 0); - __pyx_cur_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bint____object___to_py *)__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_bint____object___to_py(__pyx_ptype___pyx_scope_struct____Pyx_CFunc_bint____object___to_py, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bint____object___to_py *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(1, 64, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } - __pyx_cur_scope->__pyx_v_f = __pyx_v_f; - - /* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_bint____object___to_py") - * cdef object __Pyx_CFunc_bint____object___to_py(bint (*f)(object) except *): - * def wrap(object fo): # <<<<<<<<<<<<<< - * """wrap(fo) -> bool""" - * return f(fo) - */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11cfunc_dot_to_py_34__Pyx_CFunc_bint____object___to_py_1wrap, 0, __pyx_n_s_Pyx_CFunc_bint____object___to, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cfunc_to_py, __pyx_d, ((PyObject *)__pyx_codeobj__64)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_wrap = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_RefNannySetupContext("zero", 0); - /* "cfunc.to_py":68 - * """wrap(fo) -> bool""" - * return f(fo) - * return wrap # <<<<<<<<<<<<<< - * - * + /* "cpython/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) # <<<<<<<<<<<<<< */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_wrap); - __pyx_r = __pyx_v_wrap; - goto __pyx_L0; + (void)(memset(__pyx_v_self->data.as_chars, 0, (Py_SIZE(((PyObject *)__pyx_v_self)) * __pyx_v_self->ob_descr->itemsize))); - /* "cfunc.to_py":64 + /* "cpython/array.pxd":161 + * return extend_buffer(self, other.data.as_chars, Py_SIZE(other)) * - * @cname("__Pyx_CFunc_bint____object___to_py") - * cdef object __Pyx_CFunc_bint____object___to_py(bint (*f)(object) except *): # <<<<<<<<<<<<<< - * def wrap(object fo): - * """wrap(fo) -> bool""" + * 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_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_bint____object___to_py", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_wrap); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } /* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_double____object___to_py") - * cdef object __Pyx_CFunc_double____object___to_py(double (*f)(object) except *): - * def wrap(object fo): # <<<<<<<<<<<<<< - * """wrap(fo) -> float""" - * return f(fo) + * @cname("__Pyx_CFunc_void____object____long__long___to_py") + * cdef object __Pyx_CFunc_void____object____long__long___to_py(void (*f)(object, long long) except *): + * def wrap(object outbuf, long long signed_datum): # <<<<<<<<<<<<<< + * """wrap(outbuf, signed_datum: 'long long') -> 'void'""" + * f(outbuf, signed_datum) */ /* Python wrapper */ -static PyObject *__pyx_pw_11cfunc_dot_to_py_36__Pyx_CFunc_double____object___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo); /*proto*/ -static char __pyx_doc_11cfunc_dot_to_py_36__Pyx_CFunc_double____object___to_py_wrap[] = "wrap(fo) -> float"; -static PyMethodDef __pyx_mdef_11cfunc_dot_to_py_36__Pyx_CFunc_double____object___to_py_1wrap = {"wrap", (PyCFunction)__pyx_pw_11cfunc_dot_to_py_36__Pyx_CFunc_double____object___to_py_1wrap, METH_O, __pyx_doc_11cfunc_dot_to_py_36__Pyx_CFunc_double____object___to_py_wrap}; -static PyObject *__pyx_pw_11cfunc_dot_to_py_36__Pyx_CFunc_double____object___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo) { +static PyObject *__pyx_pw_11cfunc_dot_to_py_48__Pyx_CFunc_void____object____long__long___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_11cfunc_dot_to_py_48__Pyx_CFunc_void____object____long__long___to_py_wrap[] = "wrap(outbuf, signed_datum: 'long long') -> 'void'"; +static PyMethodDef __pyx_mdef_11cfunc_dot_to_py_48__Pyx_CFunc_void____object____long__long___to_py_1wrap = {"wrap", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11cfunc_dot_to_py_48__Pyx_CFunc_void____object____long__long___to_py_1wrap, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11cfunc_dot_to_py_48__Pyx_CFunc_void____object____long__long___to_py_wrap}; +static PyObject *__pyx_pw_11cfunc_dot_to_py_48__Pyx_CFunc_void____object____long__long___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_outbuf = 0; + PY_LONG_LONG __pyx_v_signed_datum; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("wrap (wrapper)", 0); - __pyx_r = __pyx_pf_11cfunc_dot_to_py_36__Pyx_CFunc_double____object___to_py_wrap(__pyx_self, ((PyObject *)__pyx_v_fo)); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_outbuf,&__pyx_n_s_signed_datum,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outbuf)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_signed_datum)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("wrap", 1, 2, 2, 1); __PYX_ERR(2, 65, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "wrap") < 0)) __PYX_ERR(2, 65, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_outbuf = values[0]; + __pyx_v_signed_datum = __Pyx_PyInt_As_PY_LONG_LONG(values[1]); if (unlikely((__pyx_v_signed_datum == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(2, 65, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("wrap", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 65, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_void____object____long__long___to_py.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11cfunc_dot_to_py_48__Pyx_CFunc_void____object____long__long___to_py_wrap(__pyx_self, __pyx_v_outbuf, __pyx_v_signed_datum); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11cfunc_dot_to_py_36__Pyx_CFunc_double____object___to_py_wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo) { - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_double____object___to_py *__pyx_cur_scope; - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_double____object___to_py *__pyx_outer_scope; +static PyObject *__pyx_pf_11cfunc_dot_to_py_48__Pyx_CFunc_void____object____long__long___to_py_wrap(PyObject *__pyx_self, PyObject *__pyx_v_outbuf, PY_LONG_LONG __pyx_v_signed_datum) { + struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py *__pyx_cur_scope; + struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py *__pyx_outer_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - double __pyx_t_1; - PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("wrap", 0); - __pyx_outer_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_double____object___to_py *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_outer_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py *) __Pyx_CyFunction_GetClosure(__pyx_self); __pyx_cur_scope = __pyx_outer_scope; /* "cfunc.to_py":67 - * def wrap(object fo): - * """wrap(fo) -> float""" - * return f(fo) # <<<<<<<<<<<<<< + * def wrap(object outbuf, long long signed_datum): + * """wrap(outbuf, signed_datum: 'long long') -> 'void'""" + * f(outbuf, signed_datum) # <<<<<<<<<<<<<< * return wrap * */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_cur_scope->__pyx_v_f(__pyx_v_fo); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(1, 67, __pyx_L1_error) - __pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 67, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_cur_scope->__pyx_v_f(__pyx_v_outbuf, __pyx_v_signed_datum); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 67, __pyx_L1_error) /* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_double____object___to_py") - * cdef object __Pyx_CFunc_double____object___to_py(double (*f)(object) except *): - * def wrap(object fo): # <<<<<<<<<<<<<< - * """wrap(fo) -> float""" - * return f(fo) + * @cname("__Pyx_CFunc_void____object____long__long___to_py") + * cdef object __Pyx_CFunc_void____object____long__long___to_py(void (*f)(object, long long) except *): + * def wrap(object outbuf, long long signed_datum): # <<<<<<<<<<<<<< + * """wrap(outbuf, signed_datum: 'long long') -> 'void'""" + * f(outbuf, signed_datum) */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_double____object___to_py.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_void____object____long__long___to_py.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -22544,44 +21849,47 @@ static PyObject *__pyx_pf_11cfunc_dot_to_py_36__Pyx_CFunc_double____object___to_ /* "cfunc.to_py":64 * - * @cname("__Pyx_CFunc_double____object___to_py") - * cdef object __Pyx_CFunc_double____object___to_py(double (*f)(object) except *): # <<<<<<<<<<<<<< - * def wrap(object fo): - * """wrap(fo) -> float""" + * @cname("__Pyx_CFunc_void____object____long__long___to_py") + * cdef object __Pyx_CFunc_void____object____long__long___to_py(void (*f)(object, long long) except *): # <<<<<<<<<<<<<< + * def wrap(object outbuf, long long signed_datum): + * """wrap(outbuf, signed_datum: 'long long') -> 'void'""" */ -static PyObject *__Pyx_CFunc_double____object___to_py(double (*__pyx_v_f)(PyObject *)) { - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_double____object___to_py *__pyx_cur_scope; +static PyObject *__Pyx_CFunc_void____object____long__long___to_py(void (*__pyx_v_f)(PyObject *, PY_LONG_LONG)) { + struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py *__pyx_cur_scope; PyObject *__pyx_v_wrap = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__Pyx_CFunc_double____object___to_py", 0); - __pyx_cur_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_double____object___to_py *)__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_double____object___to_py(__pyx_ptype___pyx_scope_struct____Pyx_CFunc_double____object___to_py, __pyx_empty_tuple, NULL); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_CFunc_void____object____long__long___to_py", 0); + __pyx_cur_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py *)__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py(__pyx_ptype___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_double____object___to_py *)Py_None); + __pyx_cur_scope = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(1, 64, __pyx_L1_error) + __PYX_ERR(2, 64, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } __pyx_cur_scope->__pyx_v_f = __pyx_v_f; /* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_double____object___to_py") - * cdef object __Pyx_CFunc_double____object___to_py(double (*f)(object) except *): - * def wrap(object fo): # <<<<<<<<<<<<<< - * """wrap(fo) -> float""" - * return f(fo) + * @cname("__Pyx_CFunc_void____object____long__long___to_py") + * cdef object __Pyx_CFunc_void____object____long__long___to_py(void (*f)(object, long long) except *): + * def wrap(object outbuf, long long signed_datum): # <<<<<<<<<<<<<< + * """wrap(outbuf, signed_datum: 'long long') -> 'void'""" + * f(outbuf, signed_datum) */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11cfunc_dot_to_py_36__Pyx_CFunc_double____object___to_py_1wrap, 0, __pyx_n_s_Pyx_CFunc_double____object___t, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cfunc_to_py, __pyx_d, ((PyObject *)__pyx_codeobj__66)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 65, __pyx_L1_error) + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_11cfunc_dot_to_py_48__Pyx_CFunc_void____object____long__long___to_py_1wrap, 0, __pyx_n_s_Pyx_CFunc_void____object____lo, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cfunc_to_py, __pyx_d, ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_wrap = __pyx_t_1; __pyx_t_1 = 0; /* "cfunc.to_py":68 - * """wrap(fo) -> float""" - * return f(fo) + * """wrap(outbuf, signed_datum: 'long long') -> 'void'""" + * f(outbuf, signed_datum) * return wrap # <<<<<<<<<<<<<< * * @@ -22593,16 +21901,16 @@ static PyObject *__Pyx_CFunc_double____object___to_py(double (*__pyx_v_f)(PyObje /* "cfunc.to_py":64 * - * @cname("__Pyx_CFunc_double____object___to_py") - * cdef object __Pyx_CFunc_double____object___to_py(double (*f)(object) except *): # <<<<<<<<<<<<<< - * def wrap(object fo): - * """wrap(fo) -> float""" + * @cname("__Pyx_CFunc_void____object____long__long___to_py") + * cdef object __Pyx_CFunc_void____object____long__long___to_py(void (*f)(object, long long) except *): # <<<<<<<<<<<<<< + * def wrap(object outbuf, long long signed_datum): + * """wrap(outbuf, signed_datum: 'long long') -> 'void'""" */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_double____object___to_py", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_void____object____long__long___to_py", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_wrap); @@ -22613,2162 +21921,1015 @@ static PyObject *__Pyx_CFunc_double____object___to_py(double (*__pyx_v_f)(PyObje } /* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_long__long____object___to_py") - * cdef object __Pyx_CFunc_long__long____object___to_py(long long (*f)(object) except *): + * @cname("__Pyx_CFunc_object____object___to_py") + * cdef object __Pyx_CFunc_object____object___to_py(object (*f)(object) ): * def wrap(object fo): # <<<<<<<<<<<<<< - * """wrap(fo) -> 'long long'""" + * """wrap(fo)""" * return f(fo) */ /* Python wrapper */ -static PyObject *__pyx_pw_11cfunc_dot_to_py_40__Pyx_CFunc_long__long____object___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo); /*proto*/ -static char __pyx_doc_11cfunc_dot_to_py_40__Pyx_CFunc_long__long____object___to_py_wrap[] = "wrap(fo) -> 'long long'"; -static PyMethodDef __pyx_mdef_11cfunc_dot_to_py_40__Pyx_CFunc_long__long____object___to_py_1wrap = {"wrap", (PyCFunction)__pyx_pw_11cfunc_dot_to_py_40__Pyx_CFunc_long__long____object___to_py_1wrap, METH_O, __pyx_doc_11cfunc_dot_to_py_40__Pyx_CFunc_long__long____object___to_py_wrap}; -static PyObject *__pyx_pw_11cfunc_dot_to_py_40__Pyx_CFunc_long__long____object___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo) { +static PyObject *__pyx_pw_11cfunc_dot_to_py_36__Pyx_CFunc_object____object___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo); /*proto*/ +static char __pyx_doc_11cfunc_dot_to_py_36__Pyx_CFunc_object____object___to_py_wrap[] = "wrap(fo)"; +static PyMethodDef __pyx_mdef_11cfunc_dot_to_py_36__Pyx_CFunc_object____object___to_py_1wrap = {"wrap", (PyCFunction)__pyx_pw_11cfunc_dot_to_py_36__Pyx_CFunc_object____object___to_py_1wrap, METH_O, __pyx_doc_11cfunc_dot_to_py_36__Pyx_CFunc_object____object___to_py_wrap}; +static PyObject *__pyx_pw_11cfunc_dot_to_py_36__Pyx_CFunc_object____object___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("wrap (wrapper)", 0); - __pyx_r = __pyx_pf_11cfunc_dot_to_py_40__Pyx_CFunc_long__long____object___to_py_wrap(__pyx_self, ((PyObject *)__pyx_v_fo)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11cfunc_dot_to_py_40__Pyx_CFunc_long__long____object___to_py_wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo) { - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py *__pyx_cur_scope; - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py *__pyx_outer_scope; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PY_LONG_LONG __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("wrap", 0); - __pyx_outer_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; - - /* "cfunc.to_py":67 - * def wrap(object fo): - * """wrap(fo) -> 'long long'""" - * return f(fo) # <<<<<<<<<<<<<< - * return wrap - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_cur_scope->__pyx_v_f(__pyx_v_fo); if (unlikely(__pyx_t_1 == ((PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(1, 67, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 67, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_long__long____object___to_py") - * cdef object __Pyx_CFunc_long__long____object___to_py(long long (*f)(object) except *): - * def wrap(object fo): # <<<<<<<<<<<<<< - * """wrap(fo) -> 'long long'""" - * return f(fo) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_long__long____object___to_py.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "cfunc.to_py":64 - * - * @cname("__Pyx_CFunc_long__long____object___to_py") - * cdef object __Pyx_CFunc_long__long____object___to_py(long long (*f)(object) except *): # <<<<<<<<<<<<<< - * def wrap(object fo): - * """wrap(fo) -> 'long long'""" - */ - -static PyObject *__Pyx_CFunc_long__long____object___to_py(PY_LONG_LONG (*__pyx_v_f)(PyObject *)) { - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py *__pyx_cur_scope; - PyObject *__pyx_v_wrap = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__Pyx_CFunc_long__long____object___to_py", 0); - __pyx_cur_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py *)__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py(__pyx_ptype___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(1, 64, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } - __pyx_cur_scope->__pyx_v_f = __pyx_v_f; - - /* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_long__long____object___to_py") - * cdef object __Pyx_CFunc_long__long____object___to_py(long long (*f)(object) except *): - * def wrap(object fo): # <<<<<<<<<<<<<< - * """wrap(fo) -> 'long long'""" - * return f(fo) - */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11cfunc_dot_to_py_40__Pyx_CFunc_long__long____object___to_py_1wrap, 0, __pyx_n_s_Pyx_CFunc_long__long____object, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cfunc_to_py, __pyx_d, ((PyObject *)__pyx_codeobj__68)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_wrap = __pyx_t_1; - __pyx_t_1 = 0; - - /* "cfunc.to_py":68 - * """wrap(fo) -> 'long long'""" - * return f(fo) - * return wrap # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_wrap); - __pyx_r = __pyx_v_wrap; - goto __pyx_L0; - - /* "cfunc.to_py":64 - * - * @cname("__Pyx_CFunc_long__long____object___to_py") - * cdef object __Pyx_CFunc_long__long____object___to_py(long long (*f)(object) except *): # <<<<<<<<<<<<<< - * def wrap(object fo): - * """wrap(fo) -> 'long long'""" - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_long__long____object___to_py", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_wrap); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_bytes____object___to_py") - * cdef object __Pyx_CFunc_bytes____object___to_py(bytes (*f)(object) ): - * def wrap(object fo): # <<<<<<<<<<<<<< - * """wrap(fo) -> bytes""" - * return f(fo) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_11cfunc_dot_to_py_35__Pyx_CFunc_bytes____object___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo); /*proto*/ -static char __pyx_doc_11cfunc_dot_to_py_35__Pyx_CFunc_bytes____object___to_py_wrap[] = "wrap(fo) -> bytes"; -static PyMethodDef __pyx_mdef_11cfunc_dot_to_py_35__Pyx_CFunc_bytes____object___to_py_1wrap = {"wrap", (PyCFunction)__pyx_pw_11cfunc_dot_to_py_35__Pyx_CFunc_bytes____object___to_py_1wrap, METH_O, __pyx_doc_11cfunc_dot_to_py_35__Pyx_CFunc_bytes____object___to_py_wrap}; -static PyObject *__pyx_pw_11cfunc_dot_to_py_35__Pyx_CFunc_bytes____object___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("wrap (wrapper)", 0); - __pyx_r = __pyx_pf_11cfunc_dot_to_py_35__Pyx_CFunc_bytes____object___to_py_wrap(__pyx_self, ((PyObject *)__pyx_v_fo)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11cfunc_dot_to_py_35__Pyx_CFunc_bytes____object___to_py_wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo) { - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py *__pyx_cur_scope; - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py *__pyx_outer_scope; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("wrap", 0); - __pyx_outer_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; - - /* "cfunc.to_py":67 - * def wrap(object fo): - * """wrap(fo) -> bytes""" - * return f(fo) # <<<<<<<<<<<<<< - * return wrap - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_cur_scope->__pyx_v_f(__pyx_v_fo); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 67, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_bytes____object___to_py") - * cdef object __Pyx_CFunc_bytes____object___to_py(bytes (*f)(object) ): - * def wrap(object fo): # <<<<<<<<<<<<<< - * """wrap(fo) -> bytes""" - * return f(fo) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_bytes____object___to_py.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "cfunc.to_py":64 - * - * @cname("__Pyx_CFunc_bytes____object___to_py") - * cdef object __Pyx_CFunc_bytes____object___to_py(bytes (*f)(object) ): # <<<<<<<<<<<<<< - * def wrap(object fo): - * """wrap(fo) -> bytes""" - */ - -static PyObject *__Pyx_CFunc_bytes____object___to_py(PyObject *(*__pyx_v_f)(PyObject *)) { - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py *__pyx_cur_scope; - PyObject *__pyx_v_wrap = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__Pyx_CFunc_bytes____object___to_py", 0); - __pyx_cur_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py *)__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py(__pyx_ptype___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(1, 64, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } - __pyx_cur_scope->__pyx_v_f = __pyx_v_f; - - /* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_bytes____object___to_py") - * cdef object __Pyx_CFunc_bytes____object___to_py(bytes (*f)(object) ): - * def wrap(object fo): # <<<<<<<<<<<<<< - * """wrap(fo) -> bytes""" - * return f(fo) - */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11cfunc_dot_to_py_35__Pyx_CFunc_bytes____object___to_py_1wrap, 0, __pyx_n_s_Pyx_CFunc_bytes____object___to, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cfunc_to_py, __pyx_d, ((PyObject *)__pyx_codeobj__70)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_wrap = __pyx_t_1; - __pyx_t_1 = 0; - - /* "cfunc.to_py":68 - * """wrap(fo) -> bytes""" - * return f(fo) - * return wrap # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_wrap); - __pyx_r = __pyx_v_wrap; - goto __pyx_L0; - - /* "cfunc.to_py":64 - * - * @cname("__Pyx_CFunc_bytes____object___to_py") - * cdef object __Pyx_CFunc_bytes____object___to_py(bytes (*f)(object) ): # <<<<<<<<<<<<<< - * def wrap(object fo): - * """wrap(fo) -> bytes""" - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_bytes____object___to_py", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_wrap); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_float____object___to_py") - * cdef object __Pyx_CFunc_float____object___to_py(float (*f)(object) except *): - * def wrap(object fo): # <<<<<<<<<<<<<< - * """wrap(fo) -> 'float'""" - * return f(fo) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_11cfunc_dot_to_py_35__Pyx_CFunc_float____object___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo); /*proto*/ -static char __pyx_doc_11cfunc_dot_to_py_35__Pyx_CFunc_float____object___to_py_wrap[] = "wrap(fo) -> 'float'"; -static PyMethodDef __pyx_mdef_11cfunc_dot_to_py_35__Pyx_CFunc_float____object___to_py_1wrap = {"wrap", (PyCFunction)__pyx_pw_11cfunc_dot_to_py_35__Pyx_CFunc_float____object___to_py_1wrap, METH_O, __pyx_doc_11cfunc_dot_to_py_35__Pyx_CFunc_float____object___to_py_wrap}; -static PyObject *__pyx_pw_11cfunc_dot_to_py_35__Pyx_CFunc_float____object___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("wrap (wrapper)", 0); - __pyx_r = __pyx_pf_11cfunc_dot_to_py_35__Pyx_CFunc_float____object___to_py_wrap(__pyx_self, ((PyObject *)__pyx_v_fo)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11cfunc_dot_to_py_35__Pyx_CFunc_float____object___to_py_wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo) { - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_float____object___to_py *__pyx_cur_scope; - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_float____object___to_py *__pyx_outer_scope; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - float __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("wrap", 0); - __pyx_outer_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_float____object___to_py *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; - - /* "cfunc.to_py":67 - * def wrap(object fo): - * """wrap(fo) -> 'float'""" - * return f(fo) # <<<<<<<<<<<<<< - * return wrap - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_cur_scope->__pyx_v_f(__pyx_v_fo); if (unlikely(__pyx_t_1 == ((float)-1) && PyErr_Occurred())) __PYX_ERR(1, 67, __pyx_L1_error) - __pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 67, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_float____object___to_py") - * cdef object __Pyx_CFunc_float____object___to_py(float (*f)(object) except *): - * def wrap(object fo): # <<<<<<<<<<<<<< - * """wrap(fo) -> 'float'""" - * return f(fo) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_float____object___to_py.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "cfunc.to_py":64 - * - * @cname("__Pyx_CFunc_float____object___to_py") - * cdef object __Pyx_CFunc_float____object___to_py(float (*f)(object) except *): # <<<<<<<<<<<<<< - * def wrap(object fo): - * """wrap(fo) -> 'float'""" - */ - -static PyObject *__Pyx_CFunc_float____object___to_py(float (*__pyx_v_f)(PyObject *)) { - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_float____object___to_py *__pyx_cur_scope; - PyObject *__pyx_v_wrap = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__Pyx_CFunc_float____object___to_py", 0); - __pyx_cur_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_float____object___to_py *)__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_float____object___to_py(__pyx_ptype___pyx_scope_struct____Pyx_CFunc_float____object___to_py, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_float____object___to_py *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(1, 64, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } - __pyx_cur_scope->__pyx_v_f = __pyx_v_f; - - /* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_float____object___to_py") - * cdef object __Pyx_CFunc_float____object___to_py(float (*f)(object) except *): - * def wrap(object fo): # <<<<<<<<<<<<<< - * """wrap(fo) -> 'float'""" - * return f(fo) - */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11cfunc_dot_to_py_35__Pyx_CFunc_float____object___to_py_1wrap, 0, __pyx_n_s_Pyx_CFunc_float____object___to, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cfunc_to_py, __pyx_d, ((PyObject *)__pyx_codeobj__72)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_wrap = __pyx_t_1; - __pyx_t_1 = 0; - - /* "cfunc.to_py":68 - * """wrap(fo) -> 'float'""" - * return f(fo) - * return wrap # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_wrap); - __pyx_r = __pyx_v_wrap; - goto __pyx_L0; - - /* "cfunc.to_py":64 - * - * @cname("__Pyx_CFunc_float____object___to_py") - * cdef object __Pyx_CFunc_float____object___to_py(float (*f)(object) except *): # <<<<<<<<<<<<<< - * def wrap(object fo): - * """wrap(fo) -> 'float'""" - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_float____object___to_py", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_wrap); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_void____object____object___to_py") - * cdef object __Pyx_CFunc_void____object____object___to_py(void (*f)(object, object) except *): - * def wrap(object outbuf, object datum): # <<<<<<<<<<<<<< - * """wrap(outbuf, datum) -> 'void'""" - * f(outbuf, datum) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_11cfunc_dot_to_py_44__Pyx_CFunc_void____object____object___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11cfunc_dot_to_py_44__Pyx_CFunc_void____object____object___to_py_wrap[] = "wrap(outbuf, datum) -> 'void'"; -static PyMethodDef __pyx_mdef_11cfunc_dot_to_py_44__Pyx_CFunc_void____object____object___to_py_1wrap = {"wrap", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11cfunc_dot_to_py_44__Pyx_CFunc_void____object____object___to_py_1wrap, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11cfunc_dot_to_py_44__Pyx_CFunc_void____object____object___to_py_wrap}; -static PyObject *__pyx_pw_11cfunc_dot_to_py_44__Pyx_CFunc_void____object____object___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_outbuf = 0; - PyObject *__pyx_v_datum = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("wrap (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_outbuf,&__pyx_n_s_datum,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outbuf)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_datum)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("wrap", 1, 2, 2, 1); __PYX_ERR(1, 65, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "wrap") < 0)) __PYX_ERR(1, 65, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_outbuf = values[0]; - __pyx_v_datum = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("wrap", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 65, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_void____object____object___to_py.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11cfunc_dot_to_py_44__Pyx_CFunc_void____object____object___to_py_wrap(__pyx_self, __pyx_v_outbuf, __pyx_v_datum); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11cfunc_dot_to_py_44__Pyx_CFunc_void____object____object___to_py_wrap(PyObject *__pyx_self, PyObject *__pyx_v_outbuf, PyObject *__pyx_v_datum) { - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____object___to_py *__pyx_cur_scope; - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____object___to_py *__pyx_outer_scope; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("wrap", 0); - __pyx_outer_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____object___to_py *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; - - /* "cfunc.to_py":67 - * def wrap(object outbuf, object datum): - * """wrap(outbuf, datum) -> 'void'""" - * f(outbuf, datum) # <<<<<<<<<<<<<< - * return wrap - * - */ - __pyx_cur_scope->__pyx_v_f(__pyx_v_outbuf, __pyx_v_datum); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 67, __pyx_L1_error) - - /* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_void____object____object___to_py") - * cdef object __Pyx_CFunc_void____object____object___to_py(void (*f)(object, object) except *): - * def wrap(object outbuf, object datum): # <<<<<<<<<<<<<< - * """wrap(outbuf, datum) -> 'void'""" - * f(outbuf, datum) - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_void____object____object___to_py.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "cfunc.to_py":64 - * - * @cname("__Pyx_CFunc_void____object____object___to_py") - * cdef object __Pyx_CFunc_void____object____object___to_py(void (*f)(object, object) except *): # <<<<<<<<<<<<<< - * def wrap(object outbuf, object datum): - * """wrap(outbuf, datum) -> 'void'""" - */ - -static PyObject *__Pyx_CFunc_void____object____object___to_py(void (*__pyx_v_f)(PyObject *, PyObject *)) { - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____object___to_py *__pyx_cur_scope; - PyObject *__pyx_v_wrap = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__Pyx_CFunc_void____object____object___to_py", 0); - __pyx_cur_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____object___to_py *)__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_void____object____object___to_py(__pyx_ptype___pyx_scope_struct____Pyx_CFunc_void____object____object___to_py, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____object___to_py *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(1, 64, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } - __pyx_cur_scope->__pyx_v_f = __pyx_v_f; - - /* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_void____object____object___to_py") - * cdef object __Pyx_CFunc_void____object____object___to_py(void (*f)(object, object) except *): - * def wrap(object outbuf, object datum): # <<<<<<<<<<<<<< - * """wrap(outbuf, datum) -> 'void'""" - * f(outbuf, datum) - */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11cfunc_dot_to_py_44__Pyx_CFunc_void____object____object___to_py_1wrap, 0, __pyx_n_s_Pyx_CFunc_void____object____ob, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cfunc_to_py, __pyx_d, ((PyObject *)__pyx_codeobj__74)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_wrap = __pyx_t_1; - __pyx_t_1 = 0; - - /* "cfunc.to_py":68 - * """wrap(outbuf, datum) -> 'void'""" - * f(outbuf, datum) - * return wrap # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_wrap); - __pyx_r = __pyx_v_wrap; - goto __pyx_L0; - - /* "cfunc.to_py":64 - * - * @cname("__Pyx_CFunc_void____object____object___to_py") - * cdef object __Pyx_CFunc_void____object____object___to_py(void (*f)(object, object) except *): # <<<<<<<<<<<<<< - * def wrap(object outbuf, object datum): - * """wrap(outbuf, datum) -> 'void'""" - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_void____object____object___to_py", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_wrap); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_void____object____float___to_py") - * cdef object __Pyx_CFunc_void____object____float___to_py(void (*f)(object, float) except *): - * def wrap(object outbuf, float datum): # <<<<<<<<<<<<<< - * """wrap(outbuf, datum: 'float') -> 'void'""" - * f(outbuf, datum) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_11cfunc_dot_to_py_43__Pyx_CFunc_void____object____float___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11cfunc_dot_to_py_43__Pyx_CFunc_void____object____float___to_py_wrap[] = "wrap(outbuf, datum: 'float') -> 'void'"; -static PyMethodDef __pyx_mdef_11cfunc_dot_to_py_43__Pyx_CFunc_void____object____float___to_py_1wrap = {"wrap", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11cfunc_dot_to_py_43__Pyx_CFunc_void____object____float___to_py_1wrap, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11cfunc_dot_to_py_43__Pyx_CFunc_void____object____float___to_py_wrap}; -static PyObject *__pyx_pw_11cfunc_dot_to_py_43__Pyx_CFunc_void____object____float___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_outbuf = 0; - float __pyx_v_datum; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("wrap (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_outbuf,&__pyx_n_s_datum,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outbuf)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_datum)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("wrap", 1, 2, 2, 1); __PYX_ERR(1, 65, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "wrap") < 0)) __PYX_ERR(1, 65, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_outbuf = values[0]; - __pyx_v_datum = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_datum == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 65, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("wrap", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 65, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_void____object____float___to_py.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11cfunc_dot_to_py_43__Pyx_CFunc_void____object____float___to_py_wrap(__pyx_self, __pyx_v_outbuf, __pyx_v_datum); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11cfunc_dot_to_py_43__Pyx_CFunc_void____object____float___to_py_wrap(PyObject *__pyx_self, PyObject *__pyx_v_outbuf, float __pyx_v_datum) { - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____float___to_py *__pyx_cur_scope; - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____float___to_py *__pyx_outer_scope; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("wrap", 0); - __pyx_outer_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____float___to_py *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; - - /* "cfunc.to_py":67 - * def wrap(object outbuf, float datum): - * """wrap(outbuf, datum: 'float') -> 'void'""" - * f(outbuf, datum) # <<<<<<<<<<<<<< - * return wrap - * - */ - __pyx_cur_scope->__pyx_v_f(__pyx_v_outbuf, __pyx_v_datum); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 67, __pyx_L1_error) - - /* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_void____object____float___to_py") - * cdef object __Pyx_CFunc_void____object____float___to_py(void (*f)(object, float) except *): - * def wrap(object outbuf, float datum): # <<<<<<<<<<<<<< - * """wrap(outbuf, datum: 'float') -> 'void'""" - * f(outbuf, datum) - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_void____object____float___to_py.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "cfunc.to_py":64 - * - * @cname("__Pyx_CFunc_void____object____float___to_py") - * cdef object __Pyx_CFunc_void____object____float___to_py(void (*f)(object, float) except *): # <<<<<<<<<<<<<< - * def wrap(object outbuf, float datum): - * """wrap(outbuf, datum: 'float') -> 'void'""" - */ - -static PyObject *__Pyx_CFunc_void____object____float___to_py(void (*__pyx_v_f)(PyObject *, float)) { - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____float___to_py *__pyx_cur_scope; - PyObject *__pyx_v_wrap = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__Pyx_CFunc_void____object____float___to_py", 0); - __pyx_cur_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____float___to_py *)__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_void____object____float___to_py(__pyx_ptype___pyx_scope_struct____Pyx_CFunc_void____object____float___to_py, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____float___to_py *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(1, 64, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } - __pyx_cur_scope->__pyx_v_f = __pyx_v_f; - - /* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_void____object____float___to_py") - * cdef object __Pyx_CFunc_void____object____float___to_py(void (*f)(object, float) except *): - * def wrap(object outbuf, float datum): # <<<<<<<<<<<<<< - * """wrap(outbuf, datum: 'float') -> 'void'""" - * f(outbuf, datum) - */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11cfunc_dot_to_py_43__Pyx_CFunc_void____object____float___to_py_1wrap, 0, __pyx_n_s_Pyx_CFunc_void____object____fl, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cfunc_to_py, __pyx_d, ((PyObject *)__pyx_codeobj__76)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_wrap = __pyx_t_1; - __pyx_t_1 = 0; - - /* "cfunc.to_py":68 - * """wrap(outbuf, datum: 'float') -> 'void'""" - * f(outbuf, datum) - * return wrap # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_wrap); - __pyx_r = __pyx_v_wrap; - goto __pyx_L0; - - /* "cfunc.to_py":64 - * - * @cname("__Pyx_CFunc_void____object____float___to_py") - * cdef object __Pyx_CFunc_void____object____float___to_py(void (*f)(object, float) except *): # <<<<<<<<<<<<<< - * def wrap(object outbuf, float datum): - * """wrap(outbuf, datum: 'float') -> 'void'""" - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_void____object____float___to_py", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_wrap); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_void____object____double___to_py") - * cdef object __Pyx_CFunc_void____object____double___to_py(void (*f)(object, double) except *): - * def wrap(object outbuf, double datum): # <<<<<<<<<<<<<< - * """wrap(outbuf, datum: float) -> 'void'""" - * f(outbuf, datum) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_11cfunc_dot_to_py_44__Pyx_CFunc_void____object____double___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11cfunc_dot_to_py_44__Pyx_CFunc_void____object____double___to_py_wrap[] = "wrap(outbuf, datum: float) -> 'void'"; -static PyMethodDef __pyx_mdef_11cfunc_dot_to_py_44__Pyx_CFunc_void____object____double___to_py_1wrap = {"wrap", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11cfunc_dot_to_py_44__Pyx_CFunc_void____object____double___to_py_1wrap, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11cfunc_dot_to_py_44__Pyx_CFunc_void____object____double___to_py_wrap}; -static PyObject *__pyx_pw_11cfunc_dot_to_py_44__Pyx_CFunc_void____object____double___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_outbuf = 0; - double __pyx_v_datum; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("wrap (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_outbuf,&__pyx_n_s_datum,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outbuf)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_datum)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("wrap", 1, 2, 2, 1); __PYX_ERR(1, 65, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "wrap") < 0)) __PYX_ERR(1, 65, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_outbuf = values[0]; - __pyx_v_datum = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_datum == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 65, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("wrap", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 65, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_void____object____double___to_py.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11cfunc_dot_to_py_44__Pyx_CFunc_void____object____double___to_py_wrap(__pyx_self, __pyx_v_outbuf, __pyx_v_datum); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11cfunc_dot_to_py_44__Pyx_CFunc_void____object____double___to_py_wrap(PyObject *__pyx_self, PyObject *__pyx_v_outbuf, double __pyx_v_datum) { - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____double___to_py *__pyx_cur_scope; - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____double___to_py *__pyx_outer_scope; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("wrap", 0); - __pyx_outer_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____double___to_py *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; - - /* "cfunc.to_py":67 - * def wrap(object outbuf, double datum): - * """wrap(outbuf, datum: float) -> 'void'""" - * f(outbuf, datum) # <<<<<<<<<<<<<< - * return wrap - * - */ - __pyx_cur_scope->__pyx_v_f(__pyx_v_outbuf, __pyx_v_datum); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 67, __pyx_L1_error) - - /* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_void____object____double___to_py") - * cdef object __Pyx_CFunc_void____object____double___to_py(void (*f)(object, double) except *): - * def wrap(object outbuf, double datum): # <<<<<<<<<<<<<< - * """wrap(outbuf, datum: float) -> 'void'""" - * f(outbuf, datum) - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_void____object____double___to_py.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "cfunc.to_py":64 - * - * @cname("__Pyx_CFunc_void____object____double___to_py") - * cdef object __Pyx_CFunc_void____object____double___to_py(void (*f)(object, double) except *): # <<<<<<<<<<<<<< - * def wrap(object outbuf, double datum): - * """wrap(outbuf, datum: float) -> 'void'""" - */ - -static PyObject *__Pyx_CFunc_void____object____double___to_py(void (*__pyx_v_f)(PyObject *, double)) { - struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____double___to_py *__pyx_cur_scope; - PyObject *__pyx_v_wrap = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__Pyx_CFunc_void____object____double___to_py", 0); - __pyx_cur_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____double___to_py *)__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_void____object____double___to_py(__pyx_ptype___pyx_scope_struct____Pyx_CFunc_void____object____double___to_py, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____double___to_py *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(1, 64, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } - __pyx_cur_scope->__pyx_v_f = __pyx_v_f; - - /* "cfunc.to_py":65 - * @cname("__Pyx_CFunc_void____object____double___to_py") - * cdef object __Pyx_CFunc_void____object____double___to_py(void (*f)(object, double) except *): - * def wrap(object outbuf, double datum): # <<<<<<<<<<<<<< - * """wrap(outbuf, datum: float) -> 'void'""" - * f(outbuf, datum) - */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11cfunc_dot_to_py_44__Pyx_CFunc_void____object____double___to_py_1wrap, 0, __pyx_n_s_Pyx_CFunc_void____object____do, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cfunc_to_py, __pyx_d, ((PyObject *)__pyx_codeobj__78)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_wrap = __pyx_t_1; - __pyx_t_1 = 0; - - /* "cfunc.to_py":68 - * """wrap(outbuf, datum: float) -> 'void'""" - * f(outbuf, datum) - * return wrap # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_wrap); - __pyx_r = __pyx_v_wrap; - goto __pyx_L0; - - /* "cfunc.to_py":64 - * - * @cname("__Pyx_CFunc_void____object____double___to_py") - * cdef object __Pyx_CFunc_void____object____double___to_py(void (*f)(object, double) except *): # <<<<<<<<<<<<<< - * def wrap(object outbuf, double datum): - * """wrap(outbuf, datum: float) -> 'void'""" - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_void____object____double___to_py", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_wrap); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct__make_union_reader *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct__make_union_reader[8]; -static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct__make_union_reader = 0; - -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct__make_union_reader(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct__make_union_reader > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct__make_union_reader)))) { - o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct__make_union_reader[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct__make_union_reader]; - memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct__make_union_reader)); - (void) PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - return o; -} - -static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct__make_union_reader(PyObject *o) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct__make_union_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct__make_union_reader *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_readers); - Py_CLEAR(p->__pyx_v_union_schema); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct__make_union_reader < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct__make_union_reader)))) { - __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct__make_union_reader[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct__make_union_reader++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct__make_union_reader *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); - } -} - -static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct__make_union_reader(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct__make_union_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct__make_union_reader *)o; - if (p->__pyx_v_readers) { - e = (*v)(p->__pyx_v_readers, a); if (e) return e; - } - if (p->__pyx_v_union_schema) { - e = (*v)(p->__pyx_v_union_schema, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct__make_union_reader(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct__make_union_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct__make_union_reader *)o; - tmp = ((PyObject*)p->__pyx_v_readers); - p->__pyx_v_readers = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_union_schema); - p->__pyx_v_union_schema = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct__make_union_reader = { - PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct__make_union_reader", /*tp_name*/ - sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct__make_union_reader), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct__make_union_reader, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct__make_union_reader, /*tp_traverse*/ - __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct__make_union_reader, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct__make_union_reader, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; - -static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader[8]; -static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader = 0; - -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader)))) { - o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader]; - memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader)); - (void) PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - return o; -} - -static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader(PyObject *o) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_field); - Py_CLEAR(p->__pyx_v_fields); - Py_CLEAR(p->__pyx_v_schema); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader)))) { - __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); - } -} - -static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader *)o; - if (p->__pyx_v_field) { - e = (*v)(p->__pyx_v_field, a); if (e) return e; - } - if (p->__pyx_v_fields) { - e = (*v)(p->__pyx_v_fields, a); if (e) return e; - } - if (p->__pyx_v_schema) { - e = (*v)(p->__pyx_v_schema, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader *)o; - tmp = ((PyObject*)p->__pyx_v_field); - p->__pyx_v_field = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_fields); - p->__pyx_v_fields = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_schema); - p->__pyx_v_schema = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader = { - PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct_1_make_record_reader", /*tp_name*/ - sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader, /*tp_traverse*/ - __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; - -static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader[8]; -static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader = 0; - -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader)))) { - o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader]; - memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader)); - (void) PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - return o; -} - -static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader(PyObject *o) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_schema); - Py_CLEAR(p->__pyx_v_symbols); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader)))) { - __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); - } -} - -static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader *)o; - if (p->__pyx_v_schema) { - e = (*v)(p->__pyx_v_schema, a); if (e) return e; - } - if (p->__pyx_v_symbols) { - e = (*v)(p->__pyx_v_symbols, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader *)o; - tmp = ((PyObject*)p->__pyx_v_schema); - p->__pyx_v_schema = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_symbols); - p->__pyx_v_symbols = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader = { - PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct_2_make_enum_reader", /*tp_name*/ - sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader, /*tp_traverse*/ - __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; + __pyx_r = __pyx_pf_11cfunc_dot_to_py_36__Pyx_CFunc_object____object___to_py_wrap(__pyx_self, ((PyObject *)__pyx_v_fo)); -static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader[8]; -static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader = 0; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader)))) { - o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader]; - memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader)); - (void) PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - return o; +static PyObject *__pyx_pf_11cfunc_dot_to_py_36__Pyx_CFunc_object____object___to_py_wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo) { + struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object___to_py *__pyx_cur_scope; + struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object___to_py *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("wrap", 0); + __pyx_outer_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object___to_py *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + + /* "cfunc.to_py":67 + * def wrap(object fo): + * """wrap(fo)""" + * return f(fo) # <<<<<<<<<<<<<< + * return wrap + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_cur_scope->__pyx_v_f(__pyx_v_fo); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 67, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "cfunc.to_py":65 + * @cname("__Pyx_CFunc_object____object___to_py") + * cdef object __Pyx_CFunc_object____object___to_py(object (*f)(object) ): + * def wrap(object fo): # <<<<<<<<<<<<<< + * """wrap(fo)""" + * return f(fo) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_object____object___to_py.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader(PyObject *o) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_item_reader); - Py_CLEAR(p->__pyx_v_schema); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader)))) { - __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader *)o); +/* "cfunc.to_py":64 + * + * @cname("__Pyx_CFunc_object____object___to_py") + * cdef object __Pyx_CFunc_object____object___to_py(object (*f)(object) ): # <<<<<<<<<<<<<< + * def wrap(object fo): + * """wrap(fo)""" + */ + +static PyObject *__Pyx_CFunc_object____object___to_py(PyObject *(*__pyx_v_f)(PyObject *)) { + struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object___to_py *__pyx_cur_scope; + PyObject *__pyx_v_wrap = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_CFunc_object____object___to_py", 0); + __pyx_cur_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object___to_py *)__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_object____object___to_py(__pyx_ptype___pyx_scope_struct____Pyx_CFunc_object____object___to_py, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object___to_py *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(2, 64, __pyx_L1_error) } else { - (*Py_TYPE(o)->tp_free)(o); + __Pyx_GOTREF(__pyx_cur_scope); } -} + __pyx_cur_scope->__pyx_v_f = __pyx_v_f; -static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader *)o; - if (p->__pyx_v_item_reader) { - e = (*v)(p->__pyx_v_item_reader, a); if (e) return e; - } - if (p->__pyx_v_schema) { - e = (*v)(p->__pyx_v_schema, a); if (e) return e; - } - return 0; + /* "cfunc.to_py":65 + * @cname("__Pyx_CFunc_object____object___to_py") + * cdef object __Pyx_CFunc_object____object___to_py(object (*f)(object) ): + * def wrap(object fo): # <<<<<<<<<<<<<< + * """wrap(fo)""" + * return f(fo) + */ + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_11cfunc_dot_to_py_36__Pyx_CFunc_object____object___to_py_1wrap, 0, __pyx_n_s_Pyx_CFunc_object____object___t, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cfunc_to_py, __pyx_d, ((PyObject *)__pyx_codeobj__40)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_wrap = __pyx_t_1; + __pyx_t_1 = 0; + + /* "cfunc.to_py":68 + * """wrap(fo)""" + * return f(fo) + * return wrap # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_wrap); + __pyx_r = __pyx_v_wrap; + goto __pyx_L0; + + /* "cfunc.to_py":64 + * + * @cname("__Pyx_CFunc_object____object___to_py") + * cdef object __Pyx_CFunc_object____object___to_py(object (*f)(object) ): # <<<<<<<<<<<<<< + * def wrap(object fo): + * """wrap(fo)""" + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_object____object___to_py", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_wrap); + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader *)o; - tmp = ((PyObject*)p->__pyx_v_item_reader); - p->__pyx_v_item_reader = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_schema); - p->__pyx_v_schema = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; +/* "cfunc.to_py":65 + * @cname("__Pyx_CFunc_unicode____object___to_py") + * cdef object __Pyx_CFunc_unicode____object___to_py(unicode (*f)(object) ): + * def wrap(object fo): # <<<<<<<<<<<<<< + * """wrap(fo) -> unicode""" + * return f(fo) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_11cfunc_dot_to_py_37__Pyx_CFunc_unicode____object___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo); /*proto*/ +static char __pyx_doc_11cfunc_dot_to_py_37__Pyx_CFunc_unicode____object___to_py_wrap[] = "wrap(fo) -> unicode"; +static PyMethodDef __pyx_mdef_11cfunc_dot_to_py_37__Pyx_CFunc_unicode____object___to_py_1wrap = {"wrap", (PyCFunction)__pyx_pw_11cfunc_dot_to_py_37__Pyx_CFunc_unicode____object___to_py_1wrap, METH_O, __pyx_doc_11cfunc_dot_to_py_37__Pyx_CFunc_unicode____object___to_py_wrap}; +static PyObject *__pyx_pw_11cfunc_dot_to_py_37__Pyx_CFunc_unicode____object___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("wrap (wrapper)", 0); + __pyx_r = __pyx_pf_11cfunc_dot_to_py_37__Pyx_CFunc_unicode____object___to_py_wrap(__pyx_self, ((PyObject *)__pyx_v_fo)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader = { - PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct_3_make_array_reader", /*tp_name*/ - sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader, /*tp_traverse*/ - __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; +static PyObject *__pyx_pf_11cfunc_dot_to_py_37__Pyx_CFunc_unicode____object___to_py_wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo) { + struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py *__pyx_cur_scope; + struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("wrap", 0); + __pyx_outer_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; -static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader[8]; -static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader = 0; + /* "cfunc.to_py":67 + * def wrap(object fo): + * """wrap(fo) -> unicode""" + * return f(fo) # <<<<<<<<<<<<<< + * return wrap + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_cur_scope->__pyx_v_f(__pyx_v_fo); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 67, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "cfunc.to_py":65 + * @cname("__Pyx_CFunc_unicode____object___to_py") + * cdef object __Pyx_CFunc_unicode____object___to_py(unicode (*f)(object) ): + * def wrap(object fo): # <<<<<<<<<<<<<< + * """wrap(fo) -> unicode""" + * return f(fo) + */ -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader)))) { - o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader]; - memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader)); - (void) PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - return o; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_unicode____object___to_py.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader(PyObject *o) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_schema); - Py_CLEAR(p->__pyx_v_value_reader); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader)))) { - __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader *)o); +/* "cfunc.to_py":64 + * + * @cname("__Pyx_CFunc_unicode____object___to_py") + * cdef object __Pyx_CFunc_unicode____object___to_py(unicode (*f)(object) ): # <<<<<<<<<<<<<< + * def wrap(object fo): + * """wrap(fo) -> unicode""" + */ + +static PyObject *__Pyx_CFunc_unicode____object___to_py(PyObject *(*__pyx_v_f)(PyObject *)) { + struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py *__pyx_cur_scope; + PyObject *__pyx_v_wrap = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_CFunc_unicode____object___to_py", 0); + __pyx_cur_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py *)__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py(__pyx_ptype___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(2, 64, __pyx_L1_error) } else { - (*Py_TYPE(o)->tp_free)(o); + __Pyx_GOTREF(__pyx_cur_scope); } -} + __pyx_cur_scope->__pyx_v_f = __pyx_v_f; -static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader *)o; - if (p->__pyx_v_schema) { - e = (*v)(p->__pyx_v_schema, a); if (e) return e; - } - if (p->__pyx_v_value_reader) { - e = (*v)(p->__pyx_v_value_reader, a); if (e) return e; - } - return 0; + /* "cfunc.to_py":65 + * @cname("__Pyx_CFunc_unicode____object___to_py") + * cdef object __Pyx_CFunc_unicode____object___to_py(unicode (*f)(object) ): + * def wrap(object fo): # <<<<<<<<<<<<<< + * """wrap(fo) -> unicode""" + * return f(fo) + */ + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_11cfunc_dot_to_py_37__Pyx_CFunc_unicode____object___to_py_1wrap, 0, __pyx_n_s_Pyx_CFunc_unicode____object, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cfunc_to_py, __pyx_d, ((PyObject *)__pyx_codeobj__42)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_wrap = __pyx_t_1; + __pyx_t_1 = 0; + + /* "cfunc.to_py":68 + * """wrap(fo) -> unicode""" + * return f(fo) + * return wrap # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_wrap); + __pyx_r = __pyx_v_wrap; + goto __pyx_L0; + + /* "cfunc.to_py":64 + * + * @cname("__Pyx_CFunc_unicode____object___to_py") + * cdef object __Pyx_CFunc_unicode____object___to_py(unicode (*f)(object) ): # <<<<<<<<<<<<<< + * def wrap(object fo): + * """wrap(fo) -> unicode""" + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_unicode____object___to_py", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_wrap); + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader *)o; - tmp = ((PyObject*)p->__pyx_v_schema); - p->__pyx_v_schema = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_value_reader); - p->__pyx_v_value_reader = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; +/* "cfunc.to_py":65 + * @cname("__Pyx_CFunc_bint____object___to_py") + * cdef object __Pyx_CFunc_bint____object___to_py(bint (*f)(object) except *): + * def wrap(object fo): # <<<<<<<<<<<<<< + * """wrap(fo) -> bool""" + * return f(fo) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_11cfunc_dot_to_py_34__Pyx_CFunc_bint____object___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo); /*proto*/ +static char __pyx_doc_11cfunc_dot_to_py_34__Pyx_CFunc_bint____object___to_py_wrap[] = "wrap(fo) -> bool"; +static PyMethodDef __pyx_mdef_11cfunc_dot_to_py_34__Pyx_CFunc_bint____object___to_py_1wrap = {"wrap", (PyCFunction)__pyx_pw_11cfunc_dot_to_py_34__Pyx_CFunc_bint____object___to_py_1wrap, METH_O, __pyx_doc_11cfunc_dot_to_py_34__Pyx_CFunc_bint____object___to_py_wrap}; +static PyObject *__pyx_pw_11cfunc_dot_to_py_34__Pyx_CFunc_bint____object___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("wrap (wrapper)", 0); + __pyx_r = __pyx_pf_11cfunc_dot_to_py_34__Pyx_CFunc_bint____object___to_py_wrap(__pyx_self, ((PyObject *)__pyx_v_fo)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader = { - PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct_4_make_map_reader", /*tp_name*/ - sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader, /*tp_traverse*/ - __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; +static PyObject *__pyx_pf_11cfunc_dot_to_py_34__Pyx_CFunc_bint____object___to_py_wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo) { + struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bint____object___to_py *__pyx_cur_scope; + struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bint____object___to_py *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("wrap", 0); + __pyx_outer_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bint____object___to_py *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; -static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader[8]; -static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader = 0; + /* "cfunc.to_py":67 + * def wrap(object fo): + * """wrap(fo) -> bool""" + * return f(fo) # <<<<<<<<<<<<<< + * return wrap + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_cur_scope->__pyx_v_f(__pyx_v_fo); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(2, 67, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 67, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader)))) { - o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader]; - memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader)); - (void) PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - return o; + /* "cfunc.to_py":65 + * @cname("__Pyx_CFunc_bint____object___to_py") + * cdef object __Pyx_CFunc_bint____object___to_py(bint (*f)(object) except *): + * def wrap(object fo): # <<<<<<<<<<<<<< + * """wrap(fo) -> bool""" + * return f(fo) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_bint____object___to_py.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader(PyObject *o) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_schema); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader)))) { - __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader *)o); +/* "cfunc.to_py":64 + * + * @cname("__Pyx_CFunc_bint____object___to_py") + * cdef object __Pyx_CFunc_bint____object___to_py(bint (*f)(object) except *): # <<<<<<<<<<<<<< + * def wrap(object fo): + * """wrap(fo) -> bool""" + */ + +static PyObject *__Pyx_CFunc_bint____object___to_py(int (*__pyx_v_f)(PyObject *)) { + struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bint____object___to_py *__pyx_cur_scope; + PyObject *__pyx_v_wrap = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_CFunc_bint____object___to_py", 0); + __pyx_cur_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bint____object___to_py *)__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_bint____object___to_py(__pyx_ptype___pyx_scope_struct____Pyx_CFunc_bint____object___to_py, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bint____object___to_py *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(2, 64, __pyx_L1_error) } else { - (*Py_TYPE(o)->tp_free)(o); + __Pyx_GOTREF(__pyx_cur_scope); } -} + __pyx_cur_scope->__pyx_v_f = __pyx_v_f; -static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader *)o; - if (p->__pyx_v_schema) { - e = (*v)(p->__pyx_v_schema, a); if (e) return e; - } - return 0; + /* "cfunc.to_py":65 + * @cname("__Pyx_CFunc_bint____object___to_py") + * cdef object __Pyx_CFunc_bint____object___to_py(bint (*f)(object) except *): + * def wrap(object fo): # <<<<<<<<<<<<<< + * """wrap(fo) -> bool""" + * return f(fo) + */ + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_11cfunc_dot_to_py_34__Pyx_CFunc_bint____object___to_py_1wrap, 0, __pyx_n_s_Pyx_CFunc_bint____object___to, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cfunc_to_py, __pyx_d, ((PyObject *)__pyx_codeobj__44)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_wrap = __pyx_t_1; + __pyx_t_1 = 0; + + /* "cfunc.to_py":68 + * """wrap(fo) -> bool""" + * return f(fo) + * return wrap # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_wrap); + __pyx_r = __pyx_v_wrap; + goto __pyx_L0; + + /* "cfunc.to_py":64 + * + * @cname("__Pyx_CFunc_bint____object___to_py") + * cdef object __Pyx_CFunc_bint____object___to_py(bint (*f)(object) except *): # <<<<<<<<<<<<<< + * def wrap(object fo): + * """wrap(fo) -> bool""" + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_bint____object___to_py", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_wrap); + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader *)o; - tmp = ((PyObject*)p->__pyx_v_schema); - p->__pyx_v_schema = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; +/* "cfunc.to_py":65 + * @cname("__Pyx_CFunc_double____object___to_py") + * cdef object __Pyx_CFunc_double____object___to_py(double (*f)(object) except *): + * def wrap(object fo): # <<<<<<<<<<<<<< + * """wrap(fo) -> float""" + * return f(fo) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_11cfunc_dot_to_py_36__Pyx_CFunc_double____object___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo); /*proto*/ +static char __pyx_doc_11cfunc_dot_to_py_36__Pyx_CFunc_double____object___to_py_wrap[] = "wrap(fo) -> float"; +static PyMethodDef __pyx_mdef_11cfunc_dot_to_py_36__Pyx_CFunc_double____object___to_py_1wrap = {"wrap", (PyCFunction)__pyx_pw_11cfunc_dot_to_py_36__Pyx_CFunc_double____object___to_py_1wrap, METH_O, __pyx_doc_11cfunc_dot_to_py_36__Pyx_CFunc_double____object___to_py_wrap}; +static PyObject *__pyx_pw_11cfunc_dot_to_py_36__Pyx_CFunc_double____object___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("wrap (wrapper)", 0); + __pyx_r = __pyx_pf_11cfunc_dot_to_py_36__Pyx_CFunc_double____object___to_py_wrap(__pyx_self, ((PyObject *)__pyx_v_fo)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader = { - PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct_5_make_fixed_reader", /*tp_name*/ - sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader, /*tp_traverse*/ - __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; +static PyObject *__pyx_pf_11cfunc_dot_to_py_36__Pyx_CFunc_double____object___to_py_wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo) { + struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_double____object___to_py *__pyx_cur_scope; + struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_double____object___to_py *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + double __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("wrap", 0); + __pyx_outer_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_double____object___to_py *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; -static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader[8]; -static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader = 0; + /* "cfunc.to_py":67 + * def wrap(object fo): + * """wrap(fo) -> float""" + * return f(fo) # <<<<<<<<<<<<<< + * return wrap + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_cur_scope->__pyx_v_f(__pyx_v_fo); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(2, 67, __pyx_L1_error) + __pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 67, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader)))) { - o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader]; - memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader)); - (void) PyObject_INIT(o, t); - PyObject_GC_Track(o); + /* "cfunc.to_py":65 + * @cname("__Pyx_CFunc_double____object___to_py") + * cdef object __Pyx_CFunc_double____object___to_py(double (*f)(object) except *): + * def wrap(object fo): # <<<<<<<<<<<<<< + * """wrap(fo) -> float""" + * return f(fo) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_double____object___to_py.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cfunc.to_py":64 + * + * @cname("__Pyx_CFunc_double____object___to_py") + * cdef object __Pyx_CFunc_double____object___to_py(double (*f)(object) except *): # <<<<<<<<<<<<<< + * def wrap(object fo): + * """wrap(fo) -> float""" + */ + +static PyObject *__Pyx_CFunc_double____object___to_py(double (*__pyx_v_f)(PyObject *)) { + struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_double____object___to_py *__pyx_cur_scope; + PyObject *__pyx_v_wrap = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_CFunc_double____object___to_py", 0); + __pyx_cur_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_double____object___to_py *)__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_double____object___to_py(__pyx_ptype___pyx_scope_struct____Pyx_CFunc_double____object___to_py, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_double____object___to_py *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(2, 64, __pyx_L1_error) } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; + __Pyx_GOTREF(__pyx_cur_scope); } - return o; -} + __pyx_cur_scope->__pyx_v_f = __pyx_v_f; + + /* "cfunc.to_py":65 + * @cname("__Pyx_CFunc_double____object___to_py") + * cdef object __Pyx_CFunc_double____object___to_py(double (*f)(object) except *): + * def wrap(object fo): # <<<<<<<<<<<<<< + * """wrap(fo) -> float""" + * return f(fo) + */ + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_11cfunc_dot_to_py_36__Pyx_CFunc_double____object___to_py_1wrap, 0, __pyx_n_s_Pyx_CFunc_double____object___t, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cfunc_to_py, __pyx_d, ((PyObject *)__pyx_codeobj__46)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_wrap = __pyx_t_1; + __pyx_t_1 = 0; + + /* "cfunc.to_py":68 + * """wrap(fo) -> float""" + * return f(fo) + * return wrap # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_wrap); + __pyx_r = __pyx_v_wrap; + goto __pyx_L0; + + /* "cfunc.to_py":64 + * + * @cname("__Pyx_CFunc_double____object___to_py") + * cdef object __Pyx_CFunc_double____object___to_py(double (*f)(object) except *): # <<<<<<<<<<<<<< + * def wrap(object fo): + * """wrap(fo) -> float""" + */ -static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader(PyObject *o) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_schema); - Py_CLEAR(p->__pyx_v_value_reader); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader)))) { - __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); - } + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_double____object___to_py", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_wrap); + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader *)o; - if (p->__pyx_v_schema) { - e = (*v)(p->__pyx_v_schema, a); if (e) return e; - } - if (p->__pyx_v_value_reader) { - e = (*v)(p->__pyx_v_value_reader, a); if (e) return e; - } - return 0; -} +/* "cfunc.to_py":65 + * @cname("__Pyx_CFunc_long__long____object___to_py") + * cdef object __Pyx_CFunc_long__long____object___to_py(long long (*f)(object) except *): + * def wrap(object fo): # <<<<<<<<<<<<<< + * """wrap(fo) -> 'long long'""" + * return f(fo) + */ -static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader *)o; - tmp = ((PyObject*)p->__pyx_v_schema); - p->__pyx_v_schema = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_value_reader); - p->__pyx_v_value_reader = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; +/* Python wrapper */ +static PyObject *__pyx_pw_11cfunc_dot_to_py_40__Pyx_CFunc_long__long____object___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo); /*proto*/ +static char __pyx_doc_11cfunc_dot_to_py_40__Pyx_CFunc_long__long____object___to_py_wrap[] = "wrap(fo) -> 'long long'"; +static PyMethodDef __pyx_mdef_11cfunc_dot_to_py_40__Pyx_CFunc_long__long____object___to_py_1wrap = {"wrap", (PyCFunction)__pyx_pw_11cfunc_dot_to_py_40__Pyx_CFunc_long__long____object___to_py_1wrap, METH_O, __pyx_doc_11cfunc_dot_to_py_40__Pyx_CFunc_long__long____object___to_py_wrap}; +static PyObject *__pyx_pw_11cfunc_dot_to_py_40__Pyx_CFunc_long__long____object___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("wrap (wrapper)", 0); + __pyx_r = __pyx_pf_11cfunc_dot_to_py_40__Pyx_CFunc_long__long____object___to_py_wrap(__pyx_self, ((PyObject *)__pyx_v_fo)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader = { - PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct_6_make_skip_reader", /*tp_name*/ - sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader, /*tp_traverse*/ - __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; +static PyObject *__pyx_pf_11cfunc_dot_to_py_40__Pyx_CFunc_long__long____object___to_py_wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo) { + struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py *__pyx_cur_scope; + struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PY_LONG_LONG __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("wrap", 0); + __pyx_outer_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; -static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader[8]; -static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader = 0; + /* "cfunc.to_py":67 + * def wrap(object fo): + * """wrap(fo) -> 'long long'""" + * return f(fo) # <<<<<<<<<<<<<< + * return wrap + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_cur_scope->__pyx_v_f(__pyx_v_fo); if (unlikely(__pyx_t_1 == ((PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(2, 67, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 67, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader)))) { - o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader]; - memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader)); - (void) PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - return o; + /* "cfunc.to_py":65 + * @cname("__Pyx_CFunc_long__long____object___to_py") + * cdef object __Pyx_CFunc_long__long____object___to_py(long long (*f)(object) except *): + * def wrap(object fo): # <<<<<<<<<<<<<< + * """wrap(fo) -> 'long long'""" + * return f(fo) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_long__long____object___to_py.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader(PyObject *o) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_schema); - Py_CLEAR(p->__pyx_v_value); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader)))) { - __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader *)o); +/* "cfunc.to_py":64 + * + * @cname("__Pyx_CFunc_long__long____object___to_py") + * cdef object __Pyx_CFunc_long__long____object___to_py(long long (*f)(object) except *): # <<<<<<<<<<<<<< + * def wrap(object fo): + * """wrap(fo) -> 'long long'""" + */ + +static PyObject *__Pyx_CFunc_long__long____object___to_py(PY_LONG_LONG (*__pyx_v_f)(PyObject *)) { + struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py *__pyx_cur_scope; + PyObject *__pyx_v_wrap = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_CFunc_long__long____object___to_py", 0); + __pyx_cur_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py *)__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py(__pyx_ptype___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(2, 64, __pyx_L1_error) } else { - (*Py_TYPE(o)->tp_free)(o); + __Pyx_GOTREF(__pyx_cur_scope); } -} + __pyx_cur_scope->__pyx_v_f = __pyx_v_f; -static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader *)o; - if (p->__pyx_v_schema) { - e = (*v)(p->__pyx_v_schema, a); if (e) return e; - } - if (p->__pyx_v_value) { - e = (*v)(p->__pyx_v_value, a); if (e) return e; - } - return 0; + /* "cfunc.to_py":65 + * @cname("__Pyx_CFunc_long__long____object___to_py") + * cdef object __Pyx_CFunc_long__long____object___to_py(long long (*f)(object) except *): + * def wrap(object fo): # <<<<<<<<<<<<<< + * """wrap(fo) -> 'long long'""" + * return f(fo) + */ + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_11cfunc_dot_to_py_40__Pyx_CFunc_long__long____object___to_py_1wrap, 0, __pyx_n_s_Pyx_CFunc_long__long____object, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cfunc_to_py, __pyx_d, ((PyObject *)__pyx_codeobj__48)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_wrap = __pyx_t_1; + __pyx_t_1 = 0; + + /* "cfunc.to_py":68 + * """wrap(fo) -> 'long long'""" + * return f(fo) + * return wrap # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_wrap); + __pyx_r = __pyx_v_wrap; + goto __pyx_L0; + + /* "cfunc.to_py":64 + * + * @cname("__Pyx_CFunc_long__long____object___to_py") + * cdef object __Pyx_CFunc_long__long____object___to_py(long long (*f)(object) except *): # <<<<<<<<<<<<<< + * def wrap(object fo): + * """wrap(fo) -> 'long long'""" + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_long__long____object___to_py", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_wrap); + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader *)o; - tmp = ((PyObject*)p->__pyx_v_schema); - p->__pyx_v_schema = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_value); - p->__pyx_v_value = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; +/* "cfunc.to_py":65 + * @cname("__Pyx_CFunc_bytes____object___to_py") + * cdef object __Pyx_CFunc_bytes____object___to_py(bytes (*f)(object) ): + * def wrap(object fo): # <<<<<<<<<<<<<< + * """wrap(fo) -> bytes""" + * return f(fo) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_11cfunc_dot_to_py_35__Pyx_CFunc_bytes____object___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo); /*proto*/ +static char __pyx_doc_11cfunc_dot_to_py_35__Pyx_CFunc_bytes____object___to_py_wrap[] = "wrap(fo) -> bytes"; +static PyMethodDef __pyx_mdef_11cfunc_dot_to_py_35__Pyx_CFunc_bytes____object___to_py_1wrap = {"wrap", (PyCFunction)__pyx_pw_11cfunc_dot_to_py_35__Pyx_CFunc_bytes____object___to_py_1wrap, METH_O, __pyx_doc_11cfunc_dot_to_py_35__Pyx_CFunc_bytes____object___to_py_wrap}; +static PyObject *__pyx_pw_11cfunc_dot_to_py_35__Pyx_CFunc_bytes____object___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("wrap (wrapper)", 0); + __pyx_r = __pyx_pf_11cfunc_dot_to_py_35__Pyx_CFunc_bytes____object___to_py_wrap(__pyx_self, ((PyObject *)__pyx_v_fo)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader = { - PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct_7_make_default_reader", /*tp_name*/ - sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader, /*tp_traverse*/ - __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; +static PyObject *__pyx_pf_11cfunc_dot_to_py_35__Pyx_CFunc_bytes____object___to_py_wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo) { + struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py *__pyx_cur_scope; + struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("wrap", 0); + __pyx_outer_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; -static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check[8]; -static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check = 0; + /* "cfunc.to_py":67 + * def wrap(object fo): + * """wrap(fo) -> bytes""" + * return f(fo) # <<<<<<<<<<<<<< + * return wrap + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_cur_scope->__pyx_v_f(__pyx_v_fo); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 67, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check)))) { - o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check]; - memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check)); - (void) PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - return o; -} + /* "cfunc.to_py":65 + * @cname("__Pyx_CFunc_bytes____object___to_py") + * cdef object __Pyx_CFunc_bytes____object___to_py(bytes (*f)(object) ): + * def wrap(object fo): # <<<<<<<<<<<<<< + * """wrap(fo) -> bytes""" + * return f(fo) + */ -static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check(PyObject *o) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_fields); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check)))) { - __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); - } + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_bytes____object___to_py.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check *)o; - if (p->__pyx_v_fields) { - e = (*v)(p->__pyx_v_fields, a); if (e) return e; +/* "cfunc.to_py":64 + * + * @cname("__Pyx_CFunc_bytes____object___to_py") + * cdef object __Pyx_CFunc_bytes____object___to_py(bytes (*f)(object) ): # <<<<<<<<<<<<<< + * def wrap(object fo): + * """wrap(fo) -> bytes""" + */ + +static PyObject *__Pyx_CFunc_bytes____object___to_py(PyObject *(*__pyx_v_f)(PyObject *)) { + struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py *__pyx_cur_scope; + PyObject *__pyx_v_wrap = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_CFunc_bytes____object___to_py", 0); + __pyx_cur_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py *)__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py(__pyx_ptype___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(2, 64, __pyx_L1_error) + } else { + __Pyx_GOTREF(__pyx_cur_scope); } - return 0; -} + __pyx_cur_scope->__pyx_v_f = __pyx_v_f; -static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check *)o; - tmp = ((PyObject*)p->__pyx_v_fields); - p->__pyx_v_fields = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} + /* "cfunc.to_py":65 + * @cname("__Pyx_CFunc_bytes____object___to_py") + * cdef object __Pyx_CFunc_bytes____object___to_py(bytes (*f)(object) ): + * def wrap(object fo): # <<<<<<<<<<<<<< + * """wrap(fo) -> bytes""" + * return f(fo) + */ + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_11cfunc_dot_to_py_35__Pyx_CFunc_bytes____object___to_py_1wrap, 0, __pyx_n_s_Pyx_CFunc_bytes____object___to, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cfunc_to_py, __pyx_d, ((PyObject *)__pyx_codeobj__50)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_wrap = __pyx_t_1; + __pyx_t_1 = 0; -static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check = { - PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct_8_make_record_check", /*tp_name*/ - sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check, /*tp_traverse*/ - __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; + /* "cfunc.to_py":68 + * """wrap(fo) -> bytes""" + * return f(fo) + * return wrap # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_wrap); + __pyx_r = __pyx_v_wrap; + goto __pyx_L0; -static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check[8]; -static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check = 0; + /* "cfunc.to_py":64 + * + * @cname("__Pyx_CFunc_bytes____object___to_py") + * cdef object __Pyx_CFunc_bytes____object___to_py(bytes (*f)(object) ): # <<<<<<<<<<<<<< + * def wrap(object fo): + * """wrap(fo) -> bytes""" + */ -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check)))) { - o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check]; - memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check)); - (void) PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - return o; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_bytes____object___to_py", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_wrap); + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check(PyObject *o) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_symbols); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check)))) { - __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); - } -} +/* "cfunc.to_py":65 + * @cname("__Pyx_CFunc_float____object___to_py") + * cdef object __Pyx_CFunc_float____object___to_py(float (*f)(object) except *): + * def wrap(object fo): # <<<<<<<<<<<<<< + * """wrap(fo) -> 'float'""" + * return f(fo) + */ -static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check *)o; - if (p->__pyx_v_symbols) { - e = (*v)(p->__pyx_v_symbols, a); if (e) return e; - } - return 0; -} +/* Python wrapper */ +static PyObject *__pyx_pw_11cfunc_dot_to_py_35__Pyx_CFunc_float____object___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo); /*proto*/ +static char __pyx_doc_11cfunc_dot_to_py_35__Pyx_CFunc_float____object___to_py_wrap[] = "wrap(fo) -> 'float'"; +static PyMethodDef __pyx_mdef_11cfunc_dot_to_py_35__Pyx_CFunc_float____object___to_py_1wrap = {"wrap", (PyCFunction)__pyx_pw_11cfunc_dot_to_py_35__Pyx_CFunc_float____object___to_py_1wrap, METH_O, __pyx_doc_11cfunc_dot_to_py_35__Pyx_CFunc_float____object___to_py_wrap}; +static PyObject *__pyx_pw_11cfunc_dot_to_py_35__Pyx_CFunc_float____object___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("wrap (wrapper)", 0); + __pyx_r = __pyx_pf_11cfunc_dot_to_py_35__Pyx_CFunc_float____object___to_py_wrap(__pyx_self, ((PyObject *)__pyx_v_fo)); -static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check *)o; - tmp = ((PyObject*)p->__pyx_v_symbols); - p->__pyx_v_symbols = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check = { - PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct_9_make_enum_check", /*tp_name*/ - sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check, /*tp_traverse*/ - __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; +static PyObject *__pyx_pf_11cfunc_dot_to_py_35__Pyx_CFunc_float____object___to_py_wrap(PyObject *__pyx_self, PyObject *__pyx_v_fo) { + struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_float____object___to_py *__pyx_cur_scope; + struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_float____object___to_py *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + float __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("wrap", 0); + __pyx_outer_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_float____object___to_py *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; -static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check[8]; -static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check = 0; + /* "cfunc.to_py":67 + * def wrap(object fo): + * """wrap(fo) -> 'float'""" + * return f(fo) # <<<<<<<<<<<<<< + * return wrap + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_cur_scope->__pyx_v_f(__pyx_v_fo); if (unlikely(__pyx_t_1 == ((float)-1) && PyErr_Occurred())) __PYX_ERR(2, 67, __pyx_L1_error) + __pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 67, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check)))) { - o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check]; - memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check)); - (void) PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - return o; + /* "cfunc.to_py":65 + * @cname("__Pyx_CFunc_float____object___to_py") + * cdef object __Pyx_CFunc_float____object___to_py(float (*f)(object) except *): + * def wrap(object fo): # <<<<<<<<<<<<<< + * """wrap(fo) -> 'float'""" + * return f(fo) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_float____object___to_py.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check(PyObject *o) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_item_check); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check)))) { - __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check *)o); +/* "cfunc.to_py":64 + * + * @cname("__Pyx_CFunc_float____object___to_py") + * cdef object __Pyx_CFunc_float____object___to_py(float (*f)(object) except *): # <<<<<<<<<<<<<< + * def wrap(object fo): + * """wrap(fo) -> 'float'""" + */ + +static PyObject *__Pyx_CFunc_float____object___to_py(float (*__pyx_v_f)(PyObject *)) { + struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_float____object___to_py *__pyx_cur_scope; + PyObject *__pyx_v_wrap = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_CFunc_float____object___to_py", 0); + __pyx_cur_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_float____object___to_py *)__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_float____object___to_py(__pyx_ptype___pyx_scope_struct____Pyx_CFunc_float____object___to_py, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_float____object___to_py *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(2, 64, __pyx_L1_error) } else { - (*Py_TYPE(o)->tp_free)(o); + __Pyx_GOTREF(__pyx_cur_scope); } -} + __pyx_cur_scope->__pyx_v_f = __pyx_v_f; -static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check *)o; - if (p->__pyx_v_item_check) { - e = (*v)(p->__pyx_v_item_check, a); if (e) return e; - } - return 0; -} + /* "cfunc.to_py":65 + * @cname("__Pyx_CFunc_float____object___to_py") + * cdef object __Pyx_CFunc_float____object___to_py(float (*f)(object) except *): + * def wrap(object fo): # <<<<<<<<<<<<<< + * """wrap(fo) -> 'float'""" + * return f(fo) + */ + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_11cfunc_dot_to_py_35__Pyx_CFunc_float____object___to_py_1wrap, 0, __pyx_n_s_Pyx_CFunc_float____object___to, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cfunc_to_py, __pyx_d, ((PyObject *)__pyx_codeobj__52)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_wrap = __pyx_t_1; + __pyx_t_1 = 0; + + /* "cfunc.to_py":68 + * """wrap(fo) -> 'float'""" + * return f(fo) + * return wrap # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_wrap); + __pyx_r = __pyx_v_wrap; + goto __pyx_L0; -static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check *)o; - tmp = ((PyObject*)p->__pyx_v_item_check); - p->__pyx_v_item_check = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} + /* "cfunc.to_py":64 + * + * @cname("__Pyx_CFunc_float____object___to_py") + * cdef object __Pyx_CFunc_float____object___to_py(float (*f)(object) except *): # <<<<<<<<<<<<<< + * def wrap(object fo): + * """wrap(fo) -> 'float'""" + */ -static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check = { - PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct_10_make_array_check", /*tp_name*/ - sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check, /*tp_traverse*/ - __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_float____object___to_py", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_wrap); + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} -static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check[8]; -static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check = 0; +static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct__make_union_reader *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct__make_union_reader[8]; +static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct__make_union_reader = 0; -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct__make_union_reader(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check)))) { - o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check]; - memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct__make_union_reader > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct__make_union_reader)))) { + o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct__make_union_reader[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct__make_union_reader]; + memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct__make_union_reader)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -24778,42 +22939,54 @@ static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_11_make_u return o; } -static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check(PyObject *o) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check *)o; +static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct__make_union_reader(PyObject *o) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct__make_union_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct__make_union_reader *)o; PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_union_checks); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check)))) { - __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check *)o); + Py_CLEAR(p->__pyx_v_readers); + Py_CLEAR(p->__pyx_v_union_schema); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct__make_union_reader < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct__make_union_reader)))) { + __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct__make_union_reader[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct__make_union_reader++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct__make_union_reader *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct__make_union_reader(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check *)o; - if (p->__pyx_v_union_checks) { - e = (*v)(p->__pyx_v_union_checks, a); if (e) return e; + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct__make_union_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct__make_union_reader *)o; + if (p->__pyx_v_readers) { + e = (*v)(p->__pyx_v_readers, a); if (e) return e; + } + if (p->__pyx_v_union_schema) { + e = (*v)(p->__pyx_v_union_schema, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check(PyObject *o) { +static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct__make_union_reader(PyObject *o) { PyObject* tmp; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check *)o; - tmp = ((PyObject*)p->__pyx_v_union_checks); - p->__pyx_v_union_checks = ((PyObject*)Py_None); Py_INCREF(Py_None); + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct__make_union_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct__make_union_reader *)o; + tmp = ((PyObject*)p->__pyx_v_readers); + p->__pyx_v_readers = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_union_schema); + p->__pyx_v_union_schema = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check = { +static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct__make_union_reader = { PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct_11_make_union_check", /*tp_name*/ - sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check), /*tp_basicsize*/ + "spavro.fast_binary.__pyx_scope_struct__make_union_reader", /*tp_name*/ + sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct__make_union_reader), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check, /*tp_dealloc*/ + __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct__make_union_reader, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 @@ -24834,8 +23007,8 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_11_make_ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check, /*tp_traverse*/ - __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check, /*tp_clear*/ + __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct__make_union_reader, /*tp_traverse*/ + __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct__make_union_reader, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -24850,7 +23023,7 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_11_make_ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check, /*tp_new*/ + __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct__make_union_reader, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -24863,98 +23036,25 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_11_make_ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif -}; - -static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check[8]; -static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check = 0; - -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check)))) { - o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check]; - memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check)); - (void) PyObject_INIT(o, t); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - return o; -} - -static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check(PyObject *o) { - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check)))) { - __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); - } -} - -static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check = { - PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct_12_make_fixed_check", /*tp_name*/ - sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ #endif }; -static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check[8]; -static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check = 0; +static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader[8]; +static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader = 0; -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check)))) { - o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check]; - memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader)))) { + o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader]; + memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -24964,42 +23064,61 @@ static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_13_make_m return o; } -static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check(PyObject *o) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check *)o; +static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader(PyObject *o) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader *)o; PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_map_value_check); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check)))) { - __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check *)o); + Py_CLEAR(p->__pyx_v_field); + Py_CLEAR(p->__pyx_v_fields); + Py_CLEAR(p->__pyx_v_schema); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader)))) { + __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check *)o; - if (p->__pyx_v_map_value_check) { - e = (*v)(p->__pyx_v_map_value_check, a); if (e) return e; + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader *)o; + if (p->__pyx_v_field) { + e = (*v)(p->__pyx_v_field, a); if (e) return e; + } + if (p->__pyx_v_fields) { + e = (*v)(p->__pyx_v_fields, a); if (e) return e; + } + if (p->__pyx_v_schema) { + e = (*v)(p->__pyx_v_schema, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check(PyObject *o) { +static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader(PyObject *o) { PyObject* tmp; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check *)o; - tmp = ((PyObject*)p->__pyx_v_map_value_check); - p->__pyx_v_map_value_check = Py_None; Py_INCREF(Py_None); + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader *)o; + tmp = ((PyObject*)p->__pyx_v_field); + p->__pyx_v_field = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_fields); + p->__pyx_v_fields = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_schema); + p->__pyx_v_schema = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check = { +static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader = { PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct_13_make_map_check", /*tp_name*/ - sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check), /*tp_basicsize*/ + "spavro.fast_binary.__pyx_scope_struct_1_make_record_reader", /*tp_name*/ + sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check, /*tp_dealloc*/ + __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 @@ -25020,8 +23139,8 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_13_make_ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check, /*tp_traverse*/ - __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check, /*tp_clear*/ + __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader, /*tp_traverse*/ + __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -25036,7 +23155,7 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_13_make_ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check, /*tp_new*/ + __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -25049,16 +23168,25 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_13_make_ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif }; -static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union[8]; -static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union = 0; +static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader[8]; +static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader = 0; -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union)))) { - o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union]; - memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader)))) { + o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader]; + memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -25068,42 +23196,54 @@ static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_14___pyx_ return o; } -static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union(PyObject *o) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *)o; +static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader(PyObject *o) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader *)o; PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_writer_lookup_dict); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union)))) { - __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *)o); + Py_CLEAR(p->__pyx_v_schema); + Py_CLEAR(p->__pyx_v_symbols); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader)))) { + __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *)o; - if (p->__pyx_v_writer_lookup_dict) { - e = (*v)(p->__pyx_v_writer_lookup_dict, a); if (e) return e; + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader *)o; + if (p->__pyx_v_schema) { + e = (*v)(p->__pyx_v_schema, a); if (e) return e; + } + if (p->__pyx_v_symbols) { + e = (*v)(p->__pyx_v_symbols, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union(PyObject *o) { +static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader(PyObject *o) { PyObject* tmp; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *)o; - tmp = ((PyObject*)p->__pyx_v_writer_lookup_dict); - p->__pyx_v_writer_lookup_dict = ((PyObject*)Py_None); Py_INCREF(Py_None); + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader *)o; + tmp = ((PyObject*)p->__pyx_v_schema); + p->__pyx_v_schema = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_symbols); + p->__pyx_v_symbols = ((PyObject*)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union = { +static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader = { PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union", /*tp_name*/ - sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union), /*tp_basicsize*/ + "spavro.fast_binary.__pyx_scope_struct_2_make_enum_reader", /*tp_name*/ + sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union, /*tp_dealloc*/ + __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 @@ -25124,8 +23264,8 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_14___pyx 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union, /*tp_traverse*/ - __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union, /*tp_clear*/ + __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader, /*tp_traverse*/ + __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -25140,7 +23280,7 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_14___pyx 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union, /*tp_new*/ + __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -25153,16 +23293,25 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_14___pyx #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif }; -static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer[8]; -static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer = 0; +static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader[8]; +static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader = 0; -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer)))) { - o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer]; - memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader)))) { + o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader]; + memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -25172,56 +23321,54 @@ static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_15_make_u return o; } -static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer(PyObject *o) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *)o; +static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader(PyObject *o) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader *)o; PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_union_schema); - Py_CLEAR(p->__pyx_v_writer_lookup); - Py_CLEAR(p->__pyx_v_writer_lookup_dict); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer)))) { - __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *)o); + Py_CLEAR(p->__pyx_v_item_reader); + Py_CLEAR(p->__pyx_v_schema); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader)))) { + __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *)o; - if (p->__pyx_v_union_schema) { - e = (*v)(p->__pyx_v_union_schema, a); if (e) return e; - } - if (p->__pyx_v_writer_lookup) { - e = (*v)(p->__pyx_v_writer_lookup, a); if (e) return e; + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader *)o; + if (p->__pyx_v_item_reader) { + e = (*v)(p->__pyx_v_item_reader, a); if (e) return e; } - if (p->__pyx_v_writer_lookup_dict) { - e = (*v)(p->__pyx_v_writer_lookup_dict, a); if (e) return e; + if (p->__pyx_v_schema) { + e = (*v)(p->__pyx_v_schema, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer(PyObject *o) { +static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader(PyObject *o) { PyObject* tmp; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *)o; - tmp = ((PyObject*)p->__pyx_v_union_schema); - p->__pyx_v_union_schema = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_writer_lookup); - p->__pyx_v_writer_lookup = Py_None; Py_INCREF(Py_None); + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader *)o; + tmp = ((PyObject*)p->__pyx_v_item_reader); + p->__pyx_v_item_reader = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_writer_lookup_dict); - p->__pyx_v_writer_lookup_dict = ((PyObject*)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_v_schema); + p->__pyx_v_schema = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer = { +static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader = { PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct_15_make_union_writer", /*tp_name*/ - sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer), /*tp_basicsize*/ + "spavro.fast_binary.__pyx_scope_struct_3_make_array_reader", /*tp_name*/ + sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer, /*tp_dealloc*/ + __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 @@ -25242,8 +23389,8 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_15_make_ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer, /*tp_traverse*/ - __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer, /*tp_clear*/ + __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader, /*tp_traverse*/ + __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -25258,7 +23405,7 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_15_make_ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer, /*tp_new*/ + __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -25271,16 +23418,25 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_15_make_ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif }; -static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer[8]; -static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer = 0; +static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader[8]; +static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader = 0; -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer)))) { - o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer]; - memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader)))) { + o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader]; + memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -25290,49 +23446,54 @@ static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_16_make_e return o; } -static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer(PyObject *o) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer *)o; +static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader(PyObject *o) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_schema); - Py_CLEAR(p->__pyx_v_symbols); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer)))) { - __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer *)o); + Py_CLEAR(p->__pyx_v_value_reader); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader)))) { + __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer *)o; + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader *)o; if (p->__pyx_v_schema) { e = (*v)(p->__pyx_v_schema, a); if (e) return e; } - if (p->__pyx_v_symbols) { - e = (*v)(p->__pyx_v_symbols, a); if (e) return e; + if (p->__pyx_v_value_reader) { + e = (*v)(p->__pyx_v_value_reader, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer(PyObject *o) { +static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader(PyObject *o) { PyObject* tmp; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer *)o; + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader *)o; tmp = ((PyObject*)p->__pyx_v_schema); p->__pyx_v_schema = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_symbols); - p->__pyx_v_symbols = ((PyObject*)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_v_value_reader); + p->__pyx_v_value_reader = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer = { +static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader = { PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct_16_make_enum_writer", /*tp_name*/ - sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer), /*tp_basicsize*/ + "spavro.fast_binary.__pyx_scope_struct_4_make_map_reader", /*tp_name*/ + sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer, /*tp_dealloc*/ + __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 @@ -25353,8 +23514,8 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_16_make_ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer, /*tp_traverse*/ - __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer, /*tp_clear*/ + __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader, /*tp_traverse*/ + __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -25369,7 +23530,7 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_16_make_ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer, /*tp_new*/ + __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -25382,16 +23543,25 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_16_make_ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif }; -static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer[8]; -static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer = 0; +static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader[8]; +static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader = 0; -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer)))) { - o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer]; - memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader)))) { + o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader]; + memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -25401,49 +23571,47 @@ static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_17_make_r return o; } -static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer(PyObject *o) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer *)o; +static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader(PyObject *o) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader *)o; PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_fields); Py_CLEAR(p->__pyx_v_schema); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer)))) { - __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer *)o); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader)))) { + __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer *)o; - if (p->__pyx_v_fields) { - e = (*v)(p->__pyx_v_fields, a); if (e) return e; - } + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader *)o; if (p->__pyx_v_schema) { e = (*v)(p->__pyx_v_schema, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer(PyObject *o) { +static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader(PyObject *o) { PyObject* tmp; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer *)o; - tmp = ((PyObject*)p->__pyx_v_fields); - p->__pyx_v_fields = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader *)o; tmp = ((PyObject*)p->__pyx_v_schema); p->__pyx_v_schema = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer = { +static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader = { PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct_17_make_record_writer", /*tp_name*/ - sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer), /*tp_basicsize*/ + "spavro.fast_binary.__pyx_scope_struct_5_make_fixed_reader", /*tp_name*/ + sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer, /*tp_dealloc*/ + __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 @@ -25464,8 +23632,8 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_17_make_ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer, /*tp_traverse*/ - __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer, /*tp_clear*/ + __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader, /*tp_traverse*/ + __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -25480,7 +23648,7 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_17_make_ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer, /*tp_new*/ + __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -25493,16 +23661,25 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_17_make_ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif }; -static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer[8]; -static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer = 0; +static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader[8]; +static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader = 0; -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer)))) { - o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer]; - memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader)))) { + o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader]; + memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -25512,49 +23689,54 @@ static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_18_make_a return o; } -static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer(PyObject *o) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer *)o; +static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader(PyObject *o) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader *)o; PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_item_writer); Py_CLEAR(p->__pyx_v_schema); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer)))) { - __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer *)o); + Py_CLEAR(p->__pyx_v_value_reader); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader)))) { + __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer *)o; - if (p->__pyx_v_item_writer) { - e = (*v)(p->__pyx_v_item_writer, a); if (e) return e; - } + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader *)o; if (p->__pyx_v_schema) { e = (*v)(p->__pyx_v_schema, a); if (e) return e; } + if (p->__pyx_v_value_reader) { + e = (*v)(p->__pyx_v_value_reader, a); if (e) return e; + } return 0; } -static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer(PyObject *o) { +static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader(PyObject *o) { PyObject* tmp; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer *)o; - tmp = ((PyObject*)p->__pyx_v_item_writer); - p->__pyx_v_item_writer = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader *)o; tmp = ((PyObject*)p->__pyx_v_schema); p->__pyx_v_schema = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_value_reader); + p->__pyx_v_value_reader = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer = { +static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader = { PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct_18_make_array_writer", /*tp_name*/ - sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer), /*tp_basicsize*/ + "spavro.fast_binary.__pyx_scope_struct_6_make_skip_reader", /*tp_name*/ + sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer, /*tp_dealloc*/ + __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 @@ -25575,8 +23757,8 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_18_make_ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer, /*tp_traverse*/ - __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer, /*tp_clear*/ + __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader, /*tp_traverse*/ + __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -25591,7 +23773,7 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_18_make_ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer, /*tp_new*/ + __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -25604,16 +23786,25 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_18_make_ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif }; -static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer[8]; -static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer = 0; +static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader[8]; +static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader = 0; -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer)))) { - o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer]; - memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader)))) { + o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader]; + memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -25623,49 +23814,54 @@ static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_19_make_m return o; } -static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer(PyObject *o) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer *)o; +static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader(PyObject *o) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader *)o; PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_map_value_writer); Py_CLEAR(p->__pyx_v_schema); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer)))) { - __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer *)o); + Py_CLEAR(p->__pyx_v_value); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader)))) { + __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer *)o; - if (p->__pyx_v_map_value_writer) { - e = (*v)(p->__pyx_v_map_value_writer, a); if (e) return e; - } + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader *)o; if (p->__pyx_v_schema) { e = (*v)(p->__pyx_v_schema, a); if (e) return e; } + if (p->__pyx_v_value) { + e = (*v)(p->__pyx_v_value, a); if (e) return e; + } return 0; } -static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer(PyObject *o) { +static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader(PyObject *o) { PyObject* tmp; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer *)o; - tmp = ((PyObject*)p->__pyx_v_map_value_writer); - p->__pyx_v_map_value_writer = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader *)o; tmp = ((PyObject*)p->__pyx_v_schema); p->__pyx_v_schema = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_value); + p->__pyx_v_value = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer = { +static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader = { PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct_19_make_map_writer", /*tp_name*/ - sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer), /*tp_basicsize*/ + "spavro.fast_binary.__pyx_scope_struct_7_make_default_reader", /*tp_name*/ + sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer, /*tp_dealloc*/ + __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 @@ -25686,8 +23882,8 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_19_make_ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer, /*tp_traverse*/ - __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer, /*tp_clear*/ + __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader, /*tp_traverse*/ + __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -25702,7 +23898,7 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_19_make_ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer, /*tp_new*/ + __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -25715,16 +23911,25 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_19_make_ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif }; -static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer[8]; -static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer = 0; +static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check[8]; +static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check = 0; -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer)))) { - o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer]; - memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check)))) { + o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check]; + memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -25734,42 +23939,47 @@ static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_20_make_b return o; } -static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer(PyObject *o) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer *)o; +static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check(PyObject *o) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check *)o; PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_schema); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer)))) { - __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer *)o); + Py_CLEAR(p->__pyx_v_fields); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check)))) { + __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer *)o; - if (p->__pyx_v_schema) { - e = (*v)(p->__pyx_v_schema, a); if (e) return e; + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check *)o; + if (p->__pyx_v_fields) { + e = (*v)(p->__pyx_v_fields, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer(PyObject *o) { +static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check(PyObject *o) { PyObject* tmp; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer *)o; - tmp = ((PyObject*)p->__pyx_v_schema); - p->__pyx_v_schema = Py_None; Py_INCREF(Py_None); + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check *)o; + tmp = ((PyObject*)p->__pyx_v_fields); + p->__pyx_v_fields = ((PyObject*)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer = { +static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check = { PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct_20_make_boolean_writer", /*tp_name*/ - sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer), /*tp_basicsize*/ + "spavro.fast_binary.__pyx_scope_struct_8_make_record_check", /*tp_name*/ + sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer, /*tp_dealloc*/ + __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 @@ -25790,8 +24000,8 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_20_make_ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer, /*tp_traverse*/ - __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer, /*tp_clear*/ + __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check, /*tp_traverse*/ + __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -25806,7 +24016,7 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_20_make_ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer, /*tp_new*/ + __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -25819,16 +24029,25 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_20_make_ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif }; -static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer[8]; -static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer = 0; +static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check[8]; +static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check = 0; -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer)))) { - o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer]; - memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check)))) { + o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check]; + memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -25838,42 +24057,47 @@ static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_21_make_f return o; } -static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer(PyObject *o) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer *)o; +static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check(PyObject *o) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check *)o; PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_schema); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer)))) { - __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer *)o); + Py_CLEAR(p->__pyx_v_symbols); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check)))) { + __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer *)o; - if (p->__pyx_v_schema) { - e = (*v)(p->__pyx_v_schema, a); if (e) return e; + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check *)o; + if (p->__pyx_v_symbols) { + e = (*v)(p->__pyx_v_symbols, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer(PyObject *o) { +static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check(PyObject *o) { PyObject* tmp; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer *)o; - tmp = ((PyObject*)p->__pyx_v_schema); - p->__pyx_v_schema = Py_None; Py_INCREF(Py_None); + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check *)o; + tmp = ((PyObject*)p->__pyx_v_symbols); + p->__pyx_v_symbols = ((PyObject*)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer = { +static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check = { PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct_21_make_fixed_writer", /*tp_name*/ - sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer), /*tp_basicsize*/ + "spavro.fast_binary.__pyx_scope_struct_9_make_enum_check", /*tp_name*/ + sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer, /*tp_dealloc*/ + __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 @@ -25894,8 +24118,8 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_21_make_ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer, /*tp_traverse*/ - __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer, /*tp_clear*/ + __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check, /*tp_traverse*/ + __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -25910,7 +24134,7 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_21_make_ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer, /*tp_new*/ + __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -25923,16 +24147,25 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_21_make_ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif }; -static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer[8]; -static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer = 0; +static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check[8]; +static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check = 0; -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer)))) { - o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer]; - memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check)))) { + o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check]; + memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -25942,42 +24175,47 @@ static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_22_make_i return o; } -static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer(PyObject *o) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer *)o; +static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check(PyObject *o) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check *)o; PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_schema); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer)))) { - __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer *)o); + Py_CLEAR(p->__pyx_v_item_check); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check)))) { + __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer *)o; - if (p->__pyx_v_schema) { - e = (*v)(p->__pyx_v_schema, a); if (e) return e; + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check *)o; + if (p->__pyx_v_item_check) { + e = (*v)(p->__pyx_v_item_check, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer(PyObject *o) { +static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check(PyObject *o) { PyObject* tmp; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer *)o; - tmp = ((PyObject*)p->__pyx_v_schema); - p->__pyx_v_schema = Py_None; Py_INCREF(Py_None); + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check *)o; + tmp = ((PyObject*)p->__pyx_v_item_check); + p->__pyx_v_item_check = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer = { +static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check = { PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct_22_make_int_writer", /*tp_name*/ - sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer), /*tp_basicsize*/ + "spavro.fast_binary.__pyx_scope_struct_10_make_array_check", /*tp_name*/ + sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer, /*tp_dealloc*/ + __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 @@ -25998,8 +24236,8 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_22_make_ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer, /*tp_traverse*/ - __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer, /*tp_clear*/ + __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check, /*tp_traverse*/ + __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -26014,7 +24252,7 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_22_make_ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer, /*tp_new*/ + __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -26027,16 +24265,25 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_22_make_ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif }; -static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer[8]; -static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer = 0; +static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check[8]; +static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check = 0; -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer)))) { - o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer]; - memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check)))) { + o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check]; + memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -26046,42 +24293,47 @@ static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_23_make_l return o; } -static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer(PyObject *o) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer *)o; +static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check(PyObject *o) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check *)o; PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_schema); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer)))) { - __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer *)o); + Py_CLEAR(p->__pyx_v_union_checks); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check)))) { + __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer *)o; - if (p->__pyx_v_schema) { - e = (*v)(p->__pyx_v_schema, a); if (e) return e; + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check *)o; + if (p->__pyx_v_union_checks) { + e = (*v)(p->__pyx_v_union_checks, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer(PyObject *o) { +static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check(PyObject *o) { PyObject* tmp; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer *)o; - tmp = ((PyObject*)p->__pyx_v_schema); - p->__pyx_v_schema = Py_None; Py_INCREF(Py_None); + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check *)o; + tmp = ((PyObject*)p->__pyx_v_union_checks); + p->__pyx_v_union_checks = ((PyObject*)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer = { +static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check = { PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct_23_make_long_writer", /*tp_name*/ - sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer), /*tp_basicsize*/ + "spavro.fast_binary.__pyx_scope_struct_11_make_union_check", /*tp_name*/ + sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer, /*tp_dealloc*/ + __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 @@ -26102,8 +24354,8 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_23_make_ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer, /*tp_traverse*/ - __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer, /*tp_clear*/ + __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check, /*tp_traverse*/ + __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -26118,7 +24370,7 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_23_make_ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer, /*tp_new*/ + __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -26131,18 +24383,26 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_23_make_ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif }; -static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer[8]; -static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer = 0; +static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check[8]; +static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check = 0; -static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer)))) { - o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer]; - memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check)))) { + o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check]; + memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check)); (void) PyObject_INIT(o, t); - PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; @@ -26150,42 +24410,26 @@ static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_24_make_s return o; } -static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer(PyObject *o) { - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_schema); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer)))) { - __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer *)o); +static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check(PyObject *o) { + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check)))) { + __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer *)o; - if (p->__pyx_v_schema) { - e = (*v)(p->__pyx_v_schema, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer *)o; - tmp = ((PyObject*)p->__pyx_v_schema); - p->__pyx_v_schema = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer = { +static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check = { PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct_24_make_string_writer", /*tp_name*/ - sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer), /*tp_basicsize*/ + "spavro.fast_binary.__pyx_scope_struct_12_make_fixed_check", /*tp_name*/ + sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer, /*tp_dealloc*/ + __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 @@ -26204,10 +24448,10 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_24_make_ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer, /*tp_traverse*/ - __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer, /*tp_clear*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -26222,7 +24466,7 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_24_make_ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer, /*tp_new*/ + __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -26235,17 +24479,27 @@ static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_24_make_ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif }; -static struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py *__pyx_freelist___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py[8]; -static int __pyx_freecount___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py = 0; +static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check[8]; +static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check = 0; -static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py)))) { - o = (PyObject*)__pyx_freelist___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py[--__pyx_freecount___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py]; - memset(o, 0, sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check)))) { + o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check]; + memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check)); (void) PyObject_INIT(o, t); + PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; @@ -26253,21 +24507,47 @@ static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_void____object____ return o; } -static void __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py(PyObject *o) { - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py)))) { - __pyx_freelist___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py[__pyx_freecount___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py++] = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py *)o); +static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check(PyObject *o) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_map_value_check); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check)))) { + __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static PyTypeObject __pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py = { +static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check *)o; + if (p->__pyx_v_map_value_check) { + e = (*v)(p->__pyx_v_map_value_check, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check *)o; + tmp = ((PyObject*)p->__pyx_v_map_value_check); + p->__pyx_v_map_value_check = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check = { PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py", /*tp_name*/ - sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py), /*tp_basicsize*/ + "spavro.fast_binary.__pyx_scope_struct_13_make_map_check", /*tp_name*/ + sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py, /*tp_dealloc*/ + __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 @@ -26286,10 +24566,10 @@ static PyTypeObject __pyx_scope_struct____Pyx_CFunc_void____object____long__long 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ + __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check, /*tp_traverse*/ + __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -26304,7 +24584,7 @@ static PyTypeObject __pyx_scope_struct____Pyx_CFunc_void____object____long__long 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py, /*tp_new*/ + __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -26317,17 +24597,27 @@ static PyTypeObject __pyx_scope_struct____Pyx_CFunc_void____object____long__long #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif }; -static struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object___to_py *__pyx_freelist___pyx_scope_struct____Pyx_CFunc_object____object___to_py[8]; -static int __pyx_freecount___pyx_scope_struct____Pyx_CFunc_object____object___to_py = 0; +static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union[8]; +static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union = 0; -static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_object____object___to_py(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_object____object___to_py > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object___to_py)))) { - o = (PyObject*)__pyx_freelist___pyx_scope_struct____Pyx_CFunc_object____object___to_py[--__pyx_freecount___pyx_scope_struct____Pyx_CFunc_object____object___to_py]; - memset(o, 0, sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object___to_py)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union)))) { + o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union]; + memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union)); (void) PyObject_INIT(o, t); + PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; @@ -26335,21 +24625,47 @@ static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_object____object__ return o; } -static void __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_object____object___to_py(PyObject *o) { - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_object____object___to_py < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object___to_py)))) { - __pyx_freelist___pyx_scope_struct____Pyx_CFunc_object____object___to_py[__pyx_freecount___pyx_scope_struct____Pyx_CFunc_object____object___to_py++] = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object___to_py *)o); +static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union(PyObject *o) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_writer_lookup_dict); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union)))) { + __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static PyTypeObject __pyx_scope_struct____Pyx_CFunc_object____object___to_py = { +static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *)o; + if (p->__pyx_v_writer_lookup_dict) { + e = (*v)(p->__pyx_v_writer_lookup_dict, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union *)o; + tmp = ((PyObject*)p->__pyx_v_writer_lookup_dict); + p->__pyx_v_writer_lookup_dict = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union = { PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct____Pyx_CFunc_object____object___to_py", /*tp_name*/ - sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object___to_py), /*tp_basicsize*/ + "spavro.fast_binary.__pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union", /*tp_name*/ + sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_object____object___to_py, /*tp_dealloc*/ + __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 @@ -26368,10 +24684,10 @@ static PyTypeObject __pyx_scope_struct____Pyx_CFunc_object____object___to_py = { 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ + __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union, /*tp_traverse*/ + __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -26386,7 +24702,7 @@ static PyTypeObject __pyx_scope_struct____Pyx_CFunc_object____object___to_py = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new___pyx_scope_struct____Pyx_CFunc_object____object___to_py, /*tp_new*/ + __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -26399,17 +24715,27 @@ static PyTypeObject __pyx_scope_struct____Pyx_CFunc_object____object___to_py = { #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif }; -static struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py *__pyx_freelist___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py[8]; -static int __pyx_freecount___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py = 0; +static struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer[8]; +static int __pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer = 0; -static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py)))) { - o = (PyObject*)__pyx_freelist___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py[--__pyx_freecount___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py]; - memset(o, 0, sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer)))) { + o = (PyObject*)__pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer[--__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer]; + memset(o, 0, sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer)); (void) PyObject_INIT(o, t); + PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; @@ -26417,21 +24743,54 @@ static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_unicode____object_ return o; } -static void __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py(PyObject *o) { - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py)))) { - __pyx_freelist___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py[__pyx_freecount___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py++] = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py *)o); +static void __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer(PyObject *o) { + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_union_schema); + Py_CLEAR(p->__pyx_v_writer_lookup_dict); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer)))) { + __pyx_freelist_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer[__pyx_freecount_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer++] = ((struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static PyTypeObject __pyx_scope_struct____Pyx_CFunc_unicode____object___to_py = { +static int __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *)o; + if (p->__pyx_v_union_schema) { + e = (*v)(p->__pyx_v_union_schema, a); if (e) return e; + } + if (p->__pyx_v_writer_lookup_dict) { + e = (*v)(p->__pyx_v_writer_lookup_dict, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *p = (struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer *)o; + tmp = ((PyObject*)p->__pyx_v_union_schema); + p->__pyx_v_union_schema = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_writer_lookup_dict); + p->__pyx_v_writer_lookup_dict = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyTypeObject __pyx_type_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer = { PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct____Pyx_CFunc_unicode____object___to_py", /*tp_name*/ - sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py), /*tp_basicsize*/ + "spavro.fast_binary.__pyx_scope_struct_15_make_union_writer", /*tp_name*/ + sizeof(struct __pyx_obj_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py, /*tp_dealloc*/ + __pyx_tp_dealloc_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 @@ -26450,10 +24809,10 @@ static PyTypeObject __pyx_scope_struct____Pyx_CFunc_unicode____object___to_py = 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ + __pyx_tp_traverse_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer, /*tp_traverse*/ + __pyx_tp_clear_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -26468,7 +24827,7 @@ static PyTypeObject __pyx_scope_struct____Pyx_CFunc_unicode____object___to_py = 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py, /*tp_new*/ + __pyx_tp_new_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -26481,16 +24840,25 @@ static PyTypeObject __pyx_scope_struct____Pyx_CFunc_unicode____object___to_py = #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif }; -static struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bint____object___to_py *__pyx_freelist___pyx_scope_struct____Pyx_CFunc_bint____object___to_py[8]; -static int __pyx_freecount___pyx_scope_struct____Pyx_CFunc_bint____object___to_py = 0; +static struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py *__pyx_freelist___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py[8]; +static int __pyx_freecount___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py = 0; -static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_bint____object___to_py(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_bint____object___to_py > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bint____object___to_py)))) { - o = (PyObject*)__pyx_freelist___pyx_scope_struct____Pyx_CFunc_bint____object___to_py[--__pyx_freecount___pyx_scope_struct____Pyx_CFunc_bint____object___to_py]; - memset(o, 0, sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bint____object___to_py)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py)))) { + o = (PyObject*)__pyx_freelist___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py[--__pyx_freecount___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py]; + memset(o, 0, sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py)); (void) PyObject_INIT(o, t); } else { o = (*t->tp_alloc)(t, 0); @@ -26499,21 +24867,26 @@ static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_bint____object___t return o; } -static void __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_bint____object___to_py(PyObject *o) { - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_bint____object___to_py < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bint____object___to_py)))) { - __pyx_freelist___pyx_scope_struct____Pyx_CFunc_bint____object___to_py[__pyx_freecount___pyx_scope_struct____Pyx_CFunc_bint____object___to_py++] = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bint____object___to_py *)o); +static void __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py(PyObject *o) { + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py)))) { + __pyx_freelist___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py[__pyx_freecount___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py++] = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static PyTypeObject __pyx_scope_struct____Pyx_CFunc_bint____object___to_py = { +static PyTypeObject __pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py = { PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct____Pyx_CFunc_bint____object___to_py", /*tp_name*/ - sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bint____object___to_py), /*tp_basicsize*/ + "spavro.fast_binary.__pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py", /*tp_name*/ + sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_bint____object___to_py, /*tp_dealloc*/ + __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 @@ -26550,7 +24923,7 @@ static PyTypeObject __pyx_scope_struct____Pyx_CFunc_bint____object___to_py = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new___pyx_scope_struct____Pyx_CFunc_bint____object___to_py, /*tp_new*/ + __pyx_tp_new___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -26563,16 +24936,25 @@ static PyTypeObject __pyx_scope_struct____Pyx_CFunc_bint____object___to_py = { #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif }; -static struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_double____object___to_py *__pyx_freelist___pyx_scope_struct____Pyx_CFunc_double____object___to_py[8]; -static int __pyx_freecount___pyx_scope_struct____Pyx_CFunc_double____object___to_py = 0; +static struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object___to_py *__pyx_freelist___pyx_scope_struct____Pyx_CFunc_object____object___to_py[8]; +static int __pyx_freecount___pyx_scope_struct____Pyx_CFunc_object____object___to_py = 0; -static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_double____object___to_py(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_object____object___to_py(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_double____object___to_py > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_double____object___to_py)))) { - o = (PyObject*)__pyx_freelist___pyx_scope_struct____Pyx_CFunc_double____object___to_py[--__pyx_freecount___pyx_scope_struct____Pyx_CFunc_double____object___to_py]; - memset(o, 0, sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_double____object___to_py)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_object____object___to_py > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object___to_py)))) { + o = (PyObject*)__pyx_freelist___pyx_scope_struct____Pyx_CFunc_object____object___to_py[--__pyx_freecount___pyx_scope_struct____Pyx_CFunc_object____object___to_py]; + memset(o, 0, sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object___to_py)); (void) PyObject_INIT(o, t); } else { o = (*t->tp_alloc)(t, 0); @@ -26581,21 +24963,26 @@ static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_double____object__ return o; } -static void __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_double____object___to_py(PyObject *o) { - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_double____object___to_py < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_double____object___to_py)))) { - __pyx_freelist___pyx_scope_struct____Pyx_CFunc_double____object___to_py[__pyx_freecount___pyx_scope_struct____Pyx_CFunc_double____object___to_py++] = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_double____object___to_py *)o); +static void __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_object____object___to_py(PyObject *o) { + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_object____object___to_py < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object___to_py)))) { + __pyx_freelist___pyx_scope_struct____Pyx_CFunc_object____object___to_py[__pyx_freecount___pyx_scope_struct____Pyx_CFunc_object____object___to_py++] = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object___to_py *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static PyTypeObject __pyx_scope_struct____Pyx_CFunc_double____object___to_py = { +static PyTypeObject __pyx_scope_struct____Pyx_CFunc_object____object___to_py = { PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct____Pyx_CFunc_double____object___to_py", /*tp_name*/ - sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_double____object___to_py), /*tp_basicsize*/ + "spavro.fast_binary.__pyx_scope_struct____Pyx_CFunc_object____object___to_py", /*tp_name*/ + sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object___to_py), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_double____object___to_py, /*tp_dealloc*/ + __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_object____object___to_py, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 @@ -26632,7 +25019,7 @@ static PyTypeObject __pyx_scope_struct____Pyx_CFunc_double____object___to_py = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new___pyx_scope_struct____Pyx_CFunc_double____object___to_py, /*tp_new*/ + __pyx_tp_new___pyx_scope_struct____Pyx_CFunc_object____object___to_py, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -26645,16 +25032,25 @@ static PyTypeObject __pyx_scope_struct____Pyx_CFunc_double____object___to_py = { #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif }; -static struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py *__pyx_freelist___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py[8]; -static int __pyx_freecount___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py = 0; +static struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py *__pyx_freelist___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py[8]; +static int __pyx_freecount___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py = 0; -static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py)))) { - o = (PyObject*)__pyx_freelist___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py[--__pyx_freecount___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py]; - memset(o, 0, sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py)))) { + o = (PyObject*)__pyx_freelist___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py[--__pyx_freecount___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py]; + memset(o, 0, sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py)); (void) PyObject_INIT(o, t); } else { o = (*t->tp_alloc)(t, 0); @@ -26663,21 +25059,26 @@ static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_long__long____obje return o; } -static void __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py(PyObject *o) { - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py)))) { - __pyx_freelist___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py[__pyx_freecount___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py++] = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py *)o); +static void __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py(PyObject *o) { + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py)))) { + __pyx_freelist___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py[__pyx_freecount___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py++] = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static PyTypeObject __pyx_scope_struct____Pyx_CFunc_long__long____object___to_py = { +static PyTypeObject __pyx_scope_struct____Pyx_CFunc_unicode____object___to_py = { PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct____Pyx_CFunc_long__long____object___to_py", /*tp_name*/ - sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py), /*tp_basicsize*/ + "spavro.fast_binary.__pyx_scope_struct____Pyx_CFunc_unicode____object___to_py", /*tp_name*/ + sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py, /*tp_dealloc*/ + __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 @@ -26714,7 +25115,7 @@ static PyTypeObject __pyx_scope_struct____Pyx_CFunc_long__long____object___to_py 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py, /*tp_new*/ + __pyx_tp_new___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -26727,16 +25128,25 @@ static PyTypeObject __pyx_scope_struct____Pyx_CFunc_long__long____object___to_py #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif }; -static struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py *__pyx_freelist___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py[8]; -static int __pyx_freecount___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py = 0; +static struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bint____object___to_py *__pyx_freelist___pyx_scope_struct____Pyx_CFunc_bint____object___to_py[8]; +static int __pyx_freecount___pyx_scope_struct____Pyx_CFunc_bint____object___to_py = 0; -static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_bint____object___to_py(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py)))) { - o = (PyObject*)__pyx_freelist___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py[--__pyx_freecount___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py]; - memset(o, 0, sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_bint____object___to_py > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bint____object___to_py)))) { + o = (PyObject*)__pyx_freelist___pyx_scope_struct____Pyx_CFunc_bint____object___to_py[--__pyx_freecount___pyx_scope_struct____Pyx_CFunc_bint____object___to_py]; + memset(o, 0, sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bint____object___to_py)); (void) PyObject_INIT(o, t); } else { o = (*t->tp_alloc)(t, 0); @@ -26745,21 +25155,26 @@ static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_bytes____object___ return o; } -static void __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py(PyObject *o) { - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py)))) { - __pyx_freelist___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py[__pyx_freecount___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py++] = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py *)o); +static void __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_bint____object___to_py(PyObject *o) { + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_bint____object___to_py < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bint____object___to_py)))) { + __pyx_freelist___pyx_scope_struct____Pyx_CFunc_bint____object___to_py[__pyx_freecount___pyx_scope_struct____Pyx_CFunc_bint____object___to_py++] = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bint____object___to_py *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static PyTypeObject __pyx_scope_struct____Pyx_CFunc_bytes____object___to_py = { +static PyTypeObject __pyx_scope_struct____Pyx_CFunc_bint____object___to_py = { PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct____Pyx_CFunc_bytes____object___to_py", /*tp_name*/ - sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py), /*tp_basicsize*/ + "spavro.fast_binary.__pyx_scope_struct____Pyx_CFunc_bint____object___to_py", /*tp_name*/ + sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bint____object___to_py), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py, /*tp_dealloc*/ + __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_bint____object___to_py, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 @@ -26796,7 +25211,7 @@ static PyTypeObject __pyx_scope_struct____Pyx_CFunc_bytes____object___to_py = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py, /*tp_new*/ + __pyx_tp_new___pyx_scope_struct____Pyx_CFunc_bint____object___to_py, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -26809,16 +25224,25 @@ static PyTypeObject __pyx_scope_struct____Pyx_CFunc_bytes____object___to_py = { #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif }; -static struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_float____object___to_py *__pyx_freelist___pyx_scope_struct____Pyx_CFunc_float____object___to_py[8]; -static int __pyx_freecount___pyx_scope_struct____Pyx_CFunc_float____object___to_py = 0; +static struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_double____object___to_py *__pyx_freelist___pyx_scope_struct____Pyx_CFunc_double____object___to_py[8]; +static int __pyx_freecount___pyx_scope_struct____Pyx_CFunc_double____object___to_py = 0; -static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_float____object___to_py(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_double____object___to_py(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_float____object___to_py > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_float____object___to_py)))) { - o = (PyObject*)__pyx_freelist___pyx_scope_struct____Pyx_CFunc_float____object___to_py[--__pyx_freecount___pyx_scope_struct____Pyx_CFunc_float____object___to_py]; - memset(o, 0, sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_float____object___to_py)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_double____object___to_py > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_double____object___to_py)))) { + o = (PyObject*)__pyx_freelist___pyx_scope_struct____Pyx_CFunc_double____object___to_py[--__pyx_freecount___pyx_scope_struct____Pyx_CFunc_double____object___to_py]; + memset(o, 0, sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_double____object___to_py)); (void) PyObject_INIT(o, t); } else { o = (*t->tp_alloc)(t, 0); @@ -26827,21 +25251,26 @@ static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_float____object___ return o; } -static void __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_float____object___to_py(PyObject *o) { - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_float____object___to_py < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_float____object___to_py)))) { - __pyx_freelist___pyx_scope_struct____Pyx_CFunc_float____object___to_py[__pyx_freecount___pyx_scope_struct____Pyx_CFunc_float____object___to_py++] = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_float____object___to_py *)o); +static void __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_double____object___to_py(PyObject *o) { + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_double____object___to_py < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_double____object___to_py)))) { + __pyx_freelist___pyx_scope_struct____Pyx_CFunc_double____object___to_py[__pyx_freecount___pyx_scope_struct____Pyx_CFunc_double____object___to_py++] = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_double____object___to_py *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static PyTypeObject __pyx_scope_struct____Pyx_CFunc_float____object___to_py = { +static PyTypeObject __pyx_scope_struct____Pyx_CFunc_double____object___to_py = { PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct____Pyx_CFunc_float____object___to_py", /*tp_name*/ - sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_float____object___to_py), /*tp_basicsize*/ + "spavro.fast_binary.__pyx_scope_struct____Pyx_CFunc_double____object___to_py", /*tp_name*/ + sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_double____object___to_py), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_float____object___to_py, /*tp_dealloc*/ + __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_double____object___to_py, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 @@ -26878,7 +25307,7 @@ static PyTypeObject __pyx_scope_struct____Pyx_CFunc_float____object___to_py = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new___pyx_scope_struct____Pyx_CFunc_float____object___to_py, /*tp_new*/ + __pyx_tp_new___pyx_scope_struct____Pyx_CFunc_double____object___to_py, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -26891,16 +25320,25 @@ static PyTypeObject __pyx_scope_struct____Pyx_CFunc_float____object___to_py = { #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif }; -static struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____object___to_py *__pyx_freelist___pyx_scope_struct____Pyx_CFunc_void____object____object___to_py[8]; -static int __pyx_freecount___pyx_scope_struct____Pyx_CFunc_void____object____object___to_py = 0; +static struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py *__pyx_freelist___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py[8]; +static int __pyx_freecount___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py = 0; -static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_void____object____object___to_py(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_void____object____object___to_py > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____object___to_py)))) { - o = (PyObject*)__pyx_freelist___pyx_scope_struct____Pyx_CFunc_void____object____object___to_py[--__pyx_freecount___pyx_scope_struct____Pyx_CFunc_void____object____object___to_py]; - memset(o, 0, sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____object___to_py)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py)))) { + o = (PyObject*)__pyx_freelist___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py[--__pyx_freecount___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py]; + memset(o, 0, sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py)); (void) PyObject_INIT(o, t); } else { o = (*t->tp_alloc)(t, 0); @@ -26909,21 +25347,26 @@ static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_void____object____ return o; } -static void __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_void____object____object___to_py(PyObject *o) { - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_void____object____object___to_py < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____object___to_py)))) { - __pyx_freelist___pyx_scope_struct____Pyx_CFunc_void____object____object___to_py[__pyx_freecount___pyx_scope_struct____Pyx_CFunc_void____object____object___to_py++] = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____object___to_py *)o); +static void __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py(PyObject *o) { + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py)))) { + __pyx_freelist___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py[__pyx_freecount___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py++] = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static PyTypeObject __pyx_scope_struct____Pyx_CFunc_void____object____object___to_py = { +static PyTypeObject __pyx_scope_struct____Pyx_CFunc_long__long____object___to_py = { PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct____Pyx_CFunc_void____object____object___to_py", /*tp_name*/ - sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____object___to_py), /*tp_basicsize*/ + "spavro.fast_binary.__pyx_scope_struct____Pyx_CFunc_long__long____object___to_py", /*tp_name*/ + sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_void____object____object___to_py, /*tp_dealloc*/ + __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 @@ -26960,7 +25403,7 @@ static PyTypeObject __pyx_scope_struct____Pyx_CFunc_void____object____object___t 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new___pyx_scope_struct____Pyx_CFunc_void____object____object___to_py, /*tp_new*/ + __pyx_tp_new___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -26973,16 +25416,25 @@ static PyTypeObject __pyx_scope_struct____Pyx_CFunc_void____object____object___t #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif }; -static struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____float___to_py *__pyx_freelist___pyx_scope_struct____Pyx_CFunc_void____object____float___to_py[8]; -static int __pyx_freecount___pyx_scope_struct____Pyx_CFunc_void____object____float___to_py = 0; +static struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py *__pyx_freelist___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py[8]; +static int __pyx_freecount___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py = 0; -static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_void____object____float___to_py(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_void____object____float___to_py > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____float___to_py)))) { - o = (PyObject*)__pyx_freelist___pyx_scope_struct____Pyx_CFunc_void____object____float___to_py[--__pyx_freecount___pyx_scope_struct____Pyx_CFunc_void____object____float___to_py]; - memset(o, 0, sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____float___to_py)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py)))) { + o = (PyObject*)__pyx_freelist___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py[--__pyx_freecount___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py]; + memset(o, 0, sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py)); (void) PyObject_INIT(o, t); } else { o = (*t->tp_alloc)(t, 0); @@ -26991,21 +25443,26 @@ static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_void____object____ return o; } -static void __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_void____object____float___to_py(PyObject *o) { - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_void____object____float___to_py < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____float___to_py)))) { - __pyx_freelist___pyx_scope_struct____Pyx_CFunc_void____object____float___to_py[__pyx_freecount___pyx_scope_struct____Pyx_CFunc_void____object____float___to_py++] = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____float___to_py *)o); +static void __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py(PyObject *o) { + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py)))) { + __pyx_freelist___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py[__pyx_freecount___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py++] = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static PyTypeObject __pyx_scope_struct____Pyx_CFunc_void____object____float___to_py = { +static PyTypeObject __pyx_scope_struct____Pyx_CFunc_bytes____object___to_py = { PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct____Pyx_CFunc_void____object____float___to_py", /*tp_name*/ - sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____float___to_py), /*tp_basicsize*/ + "spavro.fast_binary.__pyx_scope_struct____Pyx_CFunc_bytes____object___to_py", /*tp_name*/ + sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_void____object____float___to_py, /*tp_dealloc*/ + __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 @@ -27042,7 +25499,7 @@ static PyTypeObject __pyx_scope_struct____Pyx_CFunc_void____object____float___to 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new___pyx_scope_struct____Pyx_CFunc_void____object____float___to_py, /*tp_new*/ + __pyx_tp_new___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -27055,16 +25512,25 @@ static PyTypeObject __pyx_scope_struct____Pyx_CFunc_void____object____float___to #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif }; -static struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____double___to_py *__pyx_freelist___pyx_scope_struct____Pyx_CFunc_void____object____double___to_py[8]; -static int __pyx_freecount___pyx_scope_struct____Pyx_CFunc_void____object____double___to_py = 0; +static struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_float____object___to_py *__pyx_freelist___pyx_scope_struct____Pyx_CFunc_float____object___to_py[8]; +static int __pyx_freecount___pyx_scope_struct____Pyx_CFunc_float____object___to_py = 0; -static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_void____object____double___to_py(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_float____object___to_py(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_void____object____double___to_py > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____double___to_py)))) { - o = (PyObject*)__pyx_freelist___pyx_scope_struct____Pyx_CFunc_void____object____double___to_py[--__pyx_freecount___pyx_scope_struct____Pyx_CFunc_void____object____double___to_py]; - memset(o, 0, sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____double___to_py)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_float____object___to_py > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_float____object___to_py)))) { + o = (PyObject*)__pyx_freelist___pyx_scope_struct____Pyx_CFunc_float____object___to_py[--__pyx_freecount___pyx_scope_struct____Pyx_CFunc_float____object___to_py]; + memset(o, 0, sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_float____object___to_py)); (void) PyObject_INIT(o, t); } else { o = (*t->tp_alloc)(t, 0); @@ -27073,21 +25539,26 @@ static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_void____object____ return o; } -static void __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_void____object____double___to_py(PyObject *o) { - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_void____object____double___to_py < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____double___to_py)))) { - __pyx_freelist___pyx_scope_struct____Pyx_CFunc_void____object____double___to_py[__pyx_freecount___pyx_scope_struct____Pyx_CFunc_void____object____double___to_py++] = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____double___to_py *)o); +static void __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_float____object___to_py(PyObject *o) { + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_float____object___to_py < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_float____object___to_py)))) { + __pyx_freelist___pyx_scope_struct____Pyx_CFunc_float____object___to_py[__pyx_freecount___pyx_scope_struct____Pyx_CFunc_float____object___to_py++] = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_float____object___to_py *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static PyTypeObject __pyx_scope_struct____Pyx_CFunc_void____object____double___to_py = { +static PyTypeObject __pyx_scope_struct____Pyx_CFunc_float____object___to_py = { PyVarObject_HEAD_INIT(0, 0) - "spavro.fast_binary.__pyx_scope_struct____Pyx_CFunc_void____object____double___to_py", /*tp_name*/ - sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_void____object____double___to_py), /*tp_basicsize*/ + "spavro.fast_binary.__pyx_scope_struct____Pyx_CFunc_float____object___to_py", /*tp_name*/ + sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_float____object___to_py), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_void____object____double___to_py, /*tp_dealloc*/ + __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_float____object___to_py, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 @@ -27124,7 +25595,7 @@ static PyTypeObject __pyx_scope_struct____Pyx_CFunc_void____object____double___t 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new___pyx_scope_struct____Pyx_CFunc_void____object____double___to_py, /*tp_new*/ + __pyx_tp_new___pyx_scope_struct____Pyx_CFunc_float____object___to_py, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -27137,6 +25608,15 @@ static PyTypeObject __pyx_scope_struct____Pyx_CFunc_void____object____double___t #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif }; static PyMethodDef __pyx_methods[] = { @@ -27187,6 +25667,7 @@ static struct PyModuleDef __pyx_moduledef = { static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_b_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 0, 0}, + {&__pyx_n_s_B, __pyx_k_B, sizeof(__pyx_k_B), 0, 0, 1, 1}, {&__pyx_n_s_CheckField, __pyx_k_CheckField, sizeof(__pyx_k_CheckField), 0, 0, 1, 1}, {&__pyx_kp_s_Checksum_failure, __pyx_k_Checksum_failure, sizeof(__pyx_k_Checksum_failure), 0, 0, 1, 0}, {&__pyx_kp_s_Error_writing_record_schema_at_f, __pyx_k_Error_writing_record_schema_at_f, sizeof(__pyx_k_Error_writing_record_schema_at_f), 0, 0, 1, 0}, @@ -27231,9 +25712,10 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1}, {&__pyx_n_s_LONG_MAX_VALUE, __pyx_k_LONG_MAX_VALUE, sizeof(__pyx_k_LONG_MAX_VALUE), 0, 0, 1, 1}, {&__pyx_n_s_LONG_MIN_VALUE, __pyx_k_LONG_MIN_VALUE, sizeof(__pyx_k_LONG_MIN_VALUE), 0, 0, 1, 1}, + {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, {&__pyx_kp_s_No_matching_schema_for_datum, __pyx_k_No_matching_schema_for_datum, sizeof(__pyx_k_No_matching_schema_for_datum), 0, 0, 1, 0}, - {&__pyx_kp_s_Non_integer_value_or_overflow_S, __pyx_k_Non_integer_value_or_overflow_S, sizeof(__pyx_k_Non_integer_value_or_overflow_S), 0, 0, 1, 0}, - {&__pyx_kp_s_Not_a_boolean_value_Schema, __pyx_k_Not_a_boolean_value_Schema, sizeof(__pyx_k_Not_a_boolean_value_Schema), 0, 0, 1, 0}, + {&__pyx_kp_s_Non_integer_value_or_overflow, __pyx_k_Non_integer_value_or_overflow, sizeof(__pyx_k_Non_integer_value_or_overflow), 0, 0, 1, 0}, + {&__pyx_kp_s_Not_a_boolean_value, __pyx_k_Not_a_boolean_value, sizeof(__pyx_k_Not_a_boolean_value), 0, 0, 1, 0}, {&__pyx_n_s_Pyx_CFunc_bint____object___to, __pyx_k_Pyx_CFunc_bint____object___to, sizeof(__pyx_k_Pyx_CFunc_bint____object___to), 0, 0, 1, 1}, {&__pyx_n_s_Pyx_CFunc_bytes____object___to, __pyx_k_Pyx_CFunc_bytes____object___to, sizeof(__pyx_k_Pyx_CFunc_bytes____object___to), 0, 0, 1, 1}, {&__pyx_n_s_Pyx_CFunc_double____object___t, __pyx_k_Pyx_CFunc_double____object___t, sizeof(__pyx_k_Pyx_CFunc_double____object___t), 0, 0, 1, 1}, @@ -27241,10 +25723,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_Pyx_CFunc_long__long____object, __pyx_k_Pyx_CFunc_long__long____object, sizeof(__pyx_k_Pyx_CFunc_long__long____object), 0, 0, 1, 1}, {&__pyx_n_s_Pyx_CFunc_object____object___t, __pyx_k_Pyx_CFunc_object____object___t, sizeof(__pyx_k_Pyx_CFunc_object____object___t), 0, 0, 1, 1}, {&__pyx_n_s_Pyx_CFunc_unicode____object, __pyx_k_Pyx_CFunc_unicode____object, sizeof(__pyx_k_Pyx_CFunc_unicode____object), 0, 0, 1, 1}, - {&__pyx_n_s_Pyx_CFunc_void____object____do, __pyx_k_Pyx_CFunc_void____object____do, sizeof(__pyx_k_Pyx_CFunc_void____object____do), 0, 0, 1, 1}, - {&__pyx_n_s_Pyx_CFunc_void____object____fl, __pyx_k_Pyx_CFunc_void____object____fl, sizeof(__pyx_k_Pyx_CFunc_void____object____fl), 0, 0, 1, 1}, {&__pyx_n_s_Pyx_CFunc_void____object____lo, __pyx_k_Pyx_CFunc_void____object____lo, sizeof(__pyx_k_Pyx_CFunc_void____object____lo), 0, 0, 1, 1}, - {&__pyx_n_s_Pyx_CFunc_void____object____ob, __pyx_k_Pyx_CFunc_void____object____ob, sizeof(__pyx_k_Pyx_CFunc_void____object____ob), 0, 0, 1, 1}, {&__pyx_n_s_ReadField, __pyx_k_ReadField, sizeof(__pyx_k_ReadField), 0, 0, 1, 1}, {&__pyx_kp_s_Read_leaf_values, __pyx_k_Read_leaf_values, sizeof(__pyx_k_Read_leaf_values), 0, 0, 1, 0}, {&__pyx_n_s_ReaderPlaceholder, __pyx_k_ReaderPlaceholder, sizeof(__pyx_k_ReaderPlaceholder), 0, 0, 1, 1}, @@ -27253,13 +25732,11 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1}, {&__pyx_kp_s_Schema_violation_is_not_an_examp, __pyx_k_Schema_violation_is_not_an_examp, sizeof(__pyx_k_Schema_violation_is_not_an_examp), 0, 0, 1, 0}, {&__pyx_kp_s_Schema_violation_value_overflow, __pyx_k_Schema_violation_value_overflow, sizeof(__pyx_k_Schema_violation_value_overflow), 0, 0, 1, 0}, - {&__pyx_kp_s_Size_Mismatch_for_Fixed_data_Sc, __pyx_k_Size_Mismatch_for_Fixed_data_Sc, sizeof(__pyx_k_Size_Mismatch_for_Fixed_data_Sc), 0, 0, 1, 0}, {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, {&__pyx_kp_s_Unable_to_process_union_schema_u, __pyx_k_Unable_to_process_union_schema_u, sizeof(__pyx_k_Unable_to_process_union_schema_u), 0, 0, 1, 0}, {&__pyx_n_s_WriteField, __pyx_k_WriteField, sizeof(__pyx_k_WriteField), 0, 0, 1, 1}, {&__pyx_kp_s_Write_leaf_values, __pyx_k_Write_leaf_values, sizeof(__pyx_k_Write_leaf_values), 0, 0, 1, 0}, {&__pyx_n_s_WriterPlaceholder, __pyx_k_WriterPlaceholder, sizeof(__pyx_k_WriterPlaceholder), 0, 0, 1, 1}, - {&__pyx_n_s_WriterPlaceholder___call, __pyx_k_WriterPlaceholder___call, sizeof(__pyx_k_WriterPlaceholder___call), 0, 0, 1, 1}, {&__pyx_n_s_WriterPlaceholder___init, __pyx_k_WriterPlaceholder___init, sizeof(__pyx_k_WriterPlaceholder___init), 0, 0, 1, 1}, {&__pyx_n_s__10, __pyx_k__10, sizeof(__pyx_k__10), 0, 0, 1, 1}, {&__pyx_kp_s__19, __pyx_k__19, sizeof(__pyx_k__19), 0, 0, 1, 0}, @@ -27284,11 +25761,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_check_string, __pyx_k_check_string, sizeof(__pyx_k_check_string), 0, 0, 1, 1}, {&__pyx_n_s_check_type, __pyx_k_check_type, sizeof(__pyx_k_check_type), 0, 0, 1, 1}, {&__pyx_n_s_check_type_map, __pyx_k_check_type_map, sizeof(__pyx_k_check_type_map), 0, 0, 1, 1}, - {&__pyx_n_s_checked_boolean_writer, __pyx_k_checked_boolean_writer, sizeof(__pyx_k_checked_boolean_writer), 0, 0, 1, 1}, - {&__pyx_n_s_checked_int_write, __pyx_k_checked_int_write, sizeof(__pyx_k_checked_int_write), 0, 0, 1, 1}, - {&__pyx_n_s_checked_long_write, __pyx_k_checked_long_write, sizeof(__pyx_k_checked_long_write), 0, 0, 1, 1}, - {&__pyx_n_s_checked_string_writer, __pyx_k_checked_string_writer, sizeof(__pyx_k_checked_string_writer), 0, 0, 1, 1}, - {&__pyx_n_s_checked_write_fixed, __pyx_k_checked_write_fixed, sizeof(__pyx_k_checked_write_fixed), 0, 0, 1, 1}, {&__pyx_n_s_checksum, __pyx_k_checksum, sizeof(__pyx_k_checksum), 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_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1}, @@ -27297,18 +25769,15 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_crc32, __pyx_k_crc32, sizeof(__pyx_k_crc32), 0, 0, 1, 1}, {&__pyx_n_s_create_promotions_for_union_loca, __pyx_k_create_promotions_for_union_loca, sizeof(__pyx_k_create_promotions_for_union_loca), 0, 0, 1, 1}, {&__pyx_n_s_custom_schema, __pyx_k_custom_schema, sizeof(__pyx_k_custom_schema), 0, 0, 1, 1}, - {&__pyx_n_s_data_writer, __pyx_k_data_writer, sizeof(__pyx_k_data_writer), 0, 0, 1, 1}, {&__pyx_n_s_datum, __pyx_k_datum, sizeof(__pyx_k_datum), 0, 0, 1, 1}, {&__pyx_n_s_default, __pyx_k_default, sizeof(__pyx_k_default), 0, 0, 1, 1}, {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, {&__pyx_n_s_double, __pyx_k_double, sizeof(__pyx_k_double), 0, 0, 1, 1}, {&__pyx_n_u_double, __pyx_k_double, sizeof(__pyx_k_double), 0, 1, 0, 1}, - {&__pyx_n_s_e, __pyx_k_e, sizeof(__pyx_k_e), 0, 0, 1, 1}, {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, {&__pyx_n_s_enum, __pyx_k_enum, sizeof(__pyx_k_enum), 0, 0, 1, 1}, {&__pyx_n_u_enum, __pyx_k_enum, sizeof(__pyx_k_enum), 0, 1, 0, 1}, {&__pyx_n_s_enum_check, __pyx_k_enum_check, sizeof(__pyx_k_enum_check), 0, 0, 1, 1}, - {&__pyx_n_s_enum_index, __pyx_k_enum_index, sizeof(__pyx_k_enum_index), 0, 0, 1, 1}, {&__pyx_n_s_enum_reader, __pyx_k_enum_reader, sizeof(__pyx_k_enum_reader), 0, 0, 1, 1}, {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, {&__pyx_n_s_field, __pyx_k_field, sizeof(__pyx_k_field), 0, 0, 1, 1}, @@ -27334,10 +25803,10 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_int, __pyx_k_int, sizeof(__pyx_k_int), 0, 0, 1, 1}, {&__pyx_n_u_int, __pyx_k_int, sizeof(__pyx_k_int), 0, 1, 0, 1}, {&__pyx_n_s_integer_types, __pyx_k_integer_types, sizeof(__pyx_k_integer_types), 0, 0, 1, 1}, - {&__pyx_kp_s_is_not_a_string_value_Schema, __pyx_k_is_not_a_string_value_Schema, sizeof(__pyx_k_is_not_a_string_value_Schema), 0, 0, 1, 0}, + {&__pyx_n_s_iobuffer, __pyx_k_iobuffer, sizeof(__pyx_k_iobuffer), 0, 0, 1, 1}, + {&__pyx_kp_s_is_not_a_string_value, __pyx_k_is_not_a_string_value, sizeof(__pyx_k_is_not_a_string_value), 0, 0, 1, 0}, {&__pyx_n_s_item, __pyx_k_item, sizeof(__pyx_k_item), 0, 0, 1, 1}, {&__pyx_n_s_item_check, __pyx_k_item_check, sizeof(__pyx_k_item_check), 0, 0, 1, 1}, - {&__pyx_n_s_item_count, __pyx_k_item_count, sizeof(__pyx_k_item_count), 0, 0, 1, 1}, {&__pyx_n_s_item_reader, __pyx_k_item_reader, sizeof(__pyx_k_item_reader), 0, 0, 1, 1}, {&__pyx_n_s_item_writer, __pyx_k_item_writer, sizeof(__pyx_k_item_writer), 0, 0, 1, 1}, {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1}, @@ -27355,13 +25824,10 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_make_array_reader_locals_array_r, __pyx_k_make_array_reader_locals_array_r, sizeof(__pyx_k_make_array_reader_locals_array_r), 0, 0, 1, 1}, {&__pyx_n_s_make_array_reader_locals_lambda, __pyx_k_make_array_reader_locals_lambda, sizeof(__pyx_k_make_array_reader_locals_lambda), 0, 0, 1, 1}, {&__pyx_n_s_make_array_writer, __pyx_k_make_array_writer, sizeof(__pyx_k_make_array_writer), 0, 0, 1, 1}, - {&__pyx_n_s_make_array_writer_locals_lambda, __pyx_k_make_array_writer_locals_lambda, sizeof(__pyx_k_make_array_writer_locals_lambda), 0, 0, 1, 1}, - {&__pyx_n_s_make_array_writer_locals_write_a, __pyx_k_make_array_writer_locals_write_a, sizeof(__pyx_k_make_array_writer_locals_write_a), 0, 0, 1, 1}, {&__pyx_n_s_make_boolean_check, __pyx_k_make_boolean_check, sizeof(__pyx_k_make_boolean_check), 0, 0, 1, 1}, {&__pyx_n_s_make_boolean_check_locals_lambda, __pyx_k_make_boolean_check_locals_lambda, sizeof(__pyx_k_make_boolean_check_locals_lambda), 0, 0, 1, 1}, {&__pyx_n_s_make_boolean_reader, __pyx_k_make_boolean_reader, sizeof(__pyx_k_make_boolean_reader), 0, 0, 1, 1}, {&__pyx_n_s_make_boolean_writer, __pyx_k_make_boolean_writer, sizeof(__pyx_k_make_boolean_writer), 0, 0, 1, 1}, - {&__pyx_n_s_make_boolean_writer_locals_check, __pyx_k_make_boolean_writer_locals_check, sizeof(__pyx_k_make_boolean_writer_locals_check), 0, 0, 1, 1}, {&__pyx_n_s_make_byte_check, __pyx_k_make_byte_check, sizeof(__pyx_k_make_byte_check), 0, 0, 1, 1}, {&__pyx_n_s_make_byte_check_locals_lambda, __pyx_k_make_byte_check_locals_lambda, sizeof(__pyx_k_make_byte_check_locals_lambda), 0, 0, 1, 1}, {&__pyx_n_s_make_byte_reader, __pyx_k_make_byte_reader, sizeof(__pyx_k_make_byte_reader), 0, 0, 1, 1}, @@ -27379,34 +25845,27 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_make_enum_reader_locals_enum_rea, __pyx_k_make_enum_reader_locals_enum_rea, sizeof(__pyx_k_make_enum_reader_locals_enum_rea), 0, 0, 1, 1}, {&__pyx_n_s_make_enum_reader_locals_lambda, __pyx_k_make_enum_reader_locals_lambda, sizeof(__pyx_k_make_enum_reader_locals_lambda), 0, 0, 1, 1}, {&__pyx_n_s_make_enum_writer, __pyx_k_make_enum_writer, sizeof(__pyx_k_make_enum_writer), 0, 0, 1, 1}, - {&__pyx_n_s_make_enum_writer_locals_lambda, __pyx_k_make_enum_writer_locals_lambda, sizeof(__pyx_k_make_enum_writer_locals_lambda), 0, 0, 1, 1}, - {&__pyx_n_s_make_enum_writer_locals_write_en, __pyx_k_make_enum_writer_locals_write_en, sizeof(__pyx_k_make_enum_writer_locals_write_en), 0, 0, 1, 1}, {&__pyx_n_s_make_fixed_check, __pyx_k_make_fixed_check, sizeof(__pyx_k_make_fixed_check), 0, 0, 1, 1}, {&__pyx_n_s_make_fixed_check_locals_fixed_ch, __pyx_k_make_fixed_check_locals_fixed_ch, sizeof(__pyx_k_make_fixed_check_locals_fixed_ch), 0, 0, 1, 1}, {&__pyx_n_s_make_fixed_reader, __pyx_k_make_fixed_reader, sizeof(__pyx_k_make_fixed_reader), 0, 0, 1, 1}, {&__pyx_n_s_make_fixed_reader_locals_fixed_r, __pyx_k_make_fixed_reader_locals_fixed_r, sizeof(__pyx_k_make_fixed_reader_locals_fixed_r), 0, 0, 1, 1}, {&__pyx_n_s_make_fixed_reader_locals_lambda, __pyx_k_make_fixed_reader_locals_lambda, sizeof(__pyx_k_make_fixed_reader_locals_lambda), 0, 0, 1, 1}, {&__pyx_n_s_make_fixed_writer, __pyx_k_make_fixed_writer, sizeof(__pyx_k_make_fixed_writer), 0, 0, 1, 1}, - {&__pyx_n_s_make_fixed_writer_locals_checked, __pyx_k_make_fixed_writer_locals_checked, sizeof(__pyx_k_make_fixed_writer_locals_checked), 0, 0, 1, 1}, {&__pyx_n_s_make_float_check, __pyx_k_make_float_check, sizeof(__pyx_k_make_float_check), 0, 0, 1, 1}, {&__pyx_n_s_make_float_check_locals_lambda, __pyx_k_make_float_check_locals_lambda, sizeof(__pyx_k_make_float_check_locals_lambda), 0, 0, 1, 1}, {&__pyx_n_s_make_float_reader, __pyx_k_make_float_reader, sizeof(__pyx_k_make_float_reader), 0, 0, 1, 1}, {&__pyx_n_s_make_float_writer, __pyx_k_make_float_writer, sizeof(__pyx_k_make_float_writer), 0, 0, 1, 1}, {&__pyx_n_s_make_int_writer, __pyx_k_make_int_writer, sizeof(__pyx_k_make_int_writer), 0, 0, 1, 1}, - {&__pyx_n_s_make_int_writer_locals_checked_i, __pyx_k_make_int_writer_locals_checked_i, sizeof(__pyx_k_make_int_writer_locals_checked_i), 0, 0, 1, 1}, {&__pyx_n_s_make_long_check, __pyx_k_make_long_check, sizeof(__pyx_k_make_long_check), 0, 0, 1, 1}, {&__pyx_n_s_make_long_check_locals_lambda, __pyx_k_make_long_check_locals_lambda, sizeof(__pyx_k_make_long_check_locals_lambda), 0, 0, 1, 1}, {&__pyx_n_s_make_long_reader, __pyx_k_make_long_reader, sizeof(__pyx_k_make_long_reader), 0, 0, 1, 1}, {&__pyx_n_s_make_long_writer, __pyx_k_make_long_writer, sizeof(__pyx_k_make_long_writer), 0, 0, 1, 1}, - {&__pyx_n_s_make_long_writer_locals_checked, __pyx_k_make_long_writer_locals_checked, sizeof(__pyx_k_make_long_writer_locals_checked), 0, 0, 1, 1}, {&__pyx_n_s_make_map_check, __pyx_k_make_map_check, sizeof(__pyx_k_make_map_check), 0, 0, 1, 1}, {&__pyx_n_s_make_map_check_locals_map_check, __pyx_k_make_map_check_locals_map_check, sizeof(__pyx_k_make_map_check_locals_map_check), 0, 0, 1, 1}, {&__pyx_n_s_make_map_reader, __pyx_k_make_map_reader, sizeof(__pyx_k_make_map_reader), 0, 0, 1, 1}, {&__pyx_n_s_make_map_reader_locals_lambda, __pyx_k_make_map_reader_locals_lambda, sizeof(__pyx_k_make_map_reader_locals_lambda), 0, 0, 1, 1}, {&__pyx_n_s_make_map_reader_locals_map_reade, __pyx_k_make_map_reader_locals_map_reade, sizeof(__pyx_k_make_map_reader_locals_map_reade), 0, 0, 1, 1}, {&__pyx_n_s_make_map_writer, __pyx_k_make_map_writer, sizeof(__pyx_k_make_map_writer), 0, 0, 1, 1}, - {&__pyx_n_s_make_map_writer_locals_lambda, __pyx_k_make_map_writer_locals_lambda, sizeof(__pyx_k_make_map_writer_locals_lambda), 0, 0, 1, 1}, - {&__pyx_n_s_make_map_writer_locals_write_map, __pyx_k_make_map_writer_locals_write_map, sizeof(__pyx_k_make_map_writer_locals_write_map), 0, 0, 1, 1}, {&__pyx_n_s_make_null_check, __pyx_k_make_null_check, sizeof(__pyx_k_make_null_check), 0, 0, 1, 1}, {&__pyx_n_s_make_null_check_locals_lambda, __pyx_k_make_null_check_locals_lambda, sizeof(__pyx_k_make_null_check_locals_lambda), 0, 0, 1, 1}, {&__pyx_n_s_make_null_reader, __pyx_k_make_null_reader, sizeof(__pyx_k_make_null_reader), 0, 0, 1, 1}, @@ -27417,15 +25876,12 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_make_record_reader_locals_lambda, __pyx_k_make_record_reader_locals_lambda, sizeof(__pyx_k_make_record_reader_locals_lambda), 0, 0, 1, 1}, {&__pyx_n_s_make_record_reader_locals_record, __pyx_k_make_record_reader_locals_record, sizeof(__pyx_k_make_record_reader_locals_record), 0, 0, 1, 1}, {&__pyx_n_s_make_record_writer, __pyx_k_make_record_writer, sizeof(__pyx_k_make_record_writer), 0, 0, 1, 1}, - {&__pyx_n_s_make_record_writer_locals_lambda, __pyx_k_make_record_writer_locals_lambda, sizeof(__pyx_k_make_record_writer_locals_lambda), 0, 0, 1, 1}, - {&__pyx_n_s_make_record_writer_locals_write, __pyx_k_make_record_writer_locals_write, sizeof(__pyx_k_make_record_writer_locals_write), 0, 0, 1, 1}, {&__pyx_n_s_make_skip_reader, __pyx_k_make_skip_reader, sizeof(__pyx_k_make_skip_reader), 0, 0, 1, 1}, {&__pyx_n_s_make_skip_reader_locals_lambda, __pyx_k_make_skip_reader_locals_lambda, sizeof(__pyx_k_make_skip_reader_locals_lambda), 0, 0, 1, 1}, {&__pyx_n_s_make_skip_reader_locals_read_ski, __pyx_k_make_skip_reader_locals_read_ski, sizeof(__pyx_k_make_skip_reader_locals_read_ski), 0, 0, 1, 1}, {&__pyx_n_s_make_string_check, __pyx_k_make_string_check, sizeof(__pyx_k_make_string_check), 0, 0, 1, 1}, {&__pyx_n_s_make_string_reader, __pyx_k_make_string_reader, sizeof(__pyx_k_make_string_reader), 0, 0, 1, 1}, {&__pyx_n_s_make_string_writer, __pyx_k_make_string_writer, sizeof(__pyx_k_make_string_writer), 0, 0, 1, 1}, - {&__pyx_n_s_make_string_writer_locals_checke, __pyx_k_make_string_writer_locals_checke, sizeof(__pyx_k_make_string_writer_locals_checke), 0, 0, 1, 1}, {&__pyx_n_s_make_union_check, __pyx_k_make_union_check, sizeof(__pyx_k_make_union_check), 0, 0, 1, 1}, {&__pyx_n_s_make_union_check_locals_union_ch, __pyx_k_make_union_check_locals_union_ch, sizeof(__pyx_k_make_union_check_locals_union_ch), 0, 0, 1, 1}, {&__pyx_n_s_make_union_reader, __pyx_k_make_union_reader, sizeof(__pyx_k_make_union_reader), 0, 0, 1, 1}, @@ -27433,9 +25889,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_make_union_reader_locals_union_r, __pyx_k_make_union_reader_locals_union_r, sizeof(__pyx_k_make_union_reader_locals_union_r), 0, 0, 1, 1}, {&__pyx_n_s_make_union_writer, __pyx_k_make_union_writer, sizeof(__pyx_k_make_union_writer), 0, 0, 1, 1}, {&__pyx_n_s_make_union_writer_locals_complex, __pyx_k_make_union_writer_locals_complex, sizeof(__pyx_k_make_union_writer_locals_complex), 0, 0, 1, 1}, - {&__pyx_n_s_make_union_writer_locals_lambda, __pyx_k_make_union_writer_locals_lambda, sizeof(__pyx_k_make_union_writer_locals_lambda), 0, 0, 1, 1}, {&__pyx_n_s_make_union_writer_locals_simple, __pyx_k_make_union_writer_locals_simple, sizeof(__pyx_k_make_union_writer_locals_simple), 0, 0, 1, 1}, - {&__pyx_n_s_make_union_writer_locals_write_u, __pyx_k_make_union_writer_locals_write_u, sizeof(__pyx_k_make_union_writer_locals_write_u), 0, 0, 1, 1}, {&__pyx_n_s_map, __pyx_k_map, sizeof(__pyx_k_map), 0, 0, 1, 1}, {&__pyx_n_u_map, __pyx_k_map, sizeof(__pyx_k_map), 0, 1, 0, 1}, {&__pyx_n_s_map_check, __pyx_k_map_check, sizeof(__pyx_k_map_check), 0, 0, 1, 1}, @@ -27526,19 +25980,14 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1}, {&__pyx_n_s_wrap, __pyx_k_wrap, sizeof(__pyx_k_wrap), 0, 0, 1, 1}, {&__pyx_n_s_write, __pyx_k_write, sizeof(__pyx_k_write), 0, 0, 1, 1}, - {&__pyx_n_s_write_array, __pyx_k_write_array, sizeof(__pyx_k_write_array), 0, 0, 1, 1}, {&__pyx_n_s_write_boolean, __pyx_k_write_boolean, sizeof(__pyx_k_write_boolean), 0, 0, 1, 1}, {&__pyx_n_s_write_bytes, __pyx_k_write_bytes, sizeof(__pyx_k_write_bytes), 0, 0, 1, 1}, {&__pyx_n_s_write_crc32, __pyx_k_write_crc32, sizeof(__pyx_k_write_crc32), 0, 0, 1, 1}, {&__pyx_n_s_write_double, __pyx_k_write_double, sizeof(__pyx_k_write_double), 0, 0, 1, 1}, - {&__pyx_n_s_write_enum, __pyx_k_write_enum, sizeof(__pyx_k_write_enum), 0, 0, 1, 1}, {&__pyx_n_s_write_float, __pyx_k_write_float, sizeof(__pyx_k_write_float), 0, 0, 1, 1}, {&__pyx_n_s_write_int, __pyx_k_write_int, sizeof(__pyx_k_write_int), 0, 0, 1, 1}, {&__pyx_n_s_write_long, __pyx_k_write_long, sizeof(__pyx_k_write_long), 0, 0, 1, 1}, - {&__pyx_n_s_write_map, __pyx_k_write_map, sizeof(__pyx_k_write_map), 0, 0, 1, 1}, {&__pyx_n_s_write_null, __pyx_k_write_null, sizeof(__pyx_k_write_null), 0, 0, 1, 1}, - {&__pyx_n_s_write_record, __pyx_k_write_record, sizeof(__pyx_k_write_record), 0, 0, 1, 1}, - {&__pyx_n_s_write_union, __pyx_k_write_union, sizeof(__pyx_k_write_union), 0, 0, 1, 1}, {&__pyx_n_s_write_utf8, __pyx_k_write_utf8, sizeof(__pyx_k_write_utf8), 0, 0, 1, 1}, {&__pyx_n_s_writer, __pyx_k_writer, sizeof(__pyx_k_writer), 0, 0, 1, 1}, {&__pyx_n_s_writer_lookup, __pyx_k_writer_lookup, sizeof(__pyx_k_writer_lookup), 0, 0, 1, 1}, @@ -27547,15 +25996,16 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 239, __pyx_L1_error) - __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(0, 111, __pyx_L1_error) - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 112, __pyx_L1_error) - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 144, __pyx_L1_error) - __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 266, __pyx_L1_error) - __pyx_builtin_all = __Pyx_GetBuiltinName(__pyx_n_s_all); if (!__pyx_builtin_all) __PYX_ERR(0, 369, __pyx_L1_error) - __pyx_builtin_any = __Pyx_GetBuiltinName(__pyx_n_s_any); if (!__pyx_builtin_any) __PYX_ERR(0, 413, __pyx_L1_error) - __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 514, __pyx_L1_error) - __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 826, __pyx_L1_error) + __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 242, __pyx_L1_error) + __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(0, 114, __pyx_L1_error) + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 115, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 147, __pyx_L1_error) + __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 269, __pyx_L1_error) + __pyx_builtin_all = __Pyx_GetBuiltinName(__pyx_n_s_all); if (!__pyx_builtin_all) __PYX_ERR(0, 488, __pyx_L1_error) + __pyx_builtin_any = __Pyx_GetBuiltinName(__pyx_n_s_any); if (!__pyx_builtin_any) __PYX_ERR(0, 532, __pyx_L1_error) + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 633, __pyx_L1_error) + __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 869, __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; @@ -27565,1407 +26015,1276 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "spavro/fast_binary.pyx":106 + /* "spavro/fast_binary.pyx":109 * cdef list readers = [get_reader(schema) for schema in union_schema] * * def union_reader(fo): # <<<<<<<<<<<<<< * '''Read the long index for which schema to process, then use that''' * cdef long long union_index = read_long(fo) */ - __pyx_tuple__2 = PyTuple_Pack(2, __pyx_n_s_fo, __pyx_n_s_union_index); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 106, __pyx_L1_error) + __pyx_tuple__2 = PyTuple_Pack(2, __pyx_n_s_fo, __pyx_n_s_union_index); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); - __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__2, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_union_reader, 106, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(0, 106, __pyx_L1_error) + __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__2, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_union_reader, 109, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(0, 109, __pyx_L1_error) - /* "spavro/fast_binary.pyx":120 + /* "spavro/fast_binary.pyx":123 * cdef list fields = [ReadField(field['name'], get_reader(field['type']), get_type(field['type']) == 'skip') for field in schema['fields']] * * def record_reader(fo): # <<<<<<<<<<<<<< * return {field.name: field.reader(fo) for field in fields if not (field.skip and field.reader(fo) is None)} * record_reader.__reduce__ = lambda: (make_record_reader, (schema,)) */ - __pyx_tuple__4 = PyTuple_Pack(2, __pyx_n_s_fo, __pyx_n_s_field); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 120, __pyx_L1_error) + __pyx_tuple__4 = PyTuple_Pack(2, __pyx_n_s_fo, __pyx_n_s_field); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); __Pyx_GIVEREF(__pyx_tuple__4); - __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__4, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_record_reader, 120, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 120, __pyx_L1_error) + __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__4, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_record_reader, 123, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 123, __pyx_L1_error) - /* "spavro/fast_binary.pyx":129 + /* "spavro/fast_binary.pyx":132 * cdef list symbols = schema['symbols'] * * def enum_reader(fo): # <<<<<<<<<<<<<< * return symbols[read_long(fo)] * enum_reader.__reduce__ = lambda: (make_enum_reader, (schema,)) */ - __pyx_tuple__6 = PyTuple_Pack(1, __pyx_n_s_fo); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 129, __pyx_L1_error) + __pyx_tuple__6 = PyTuple_Pack(1, __pyx_n_s_fo); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__6); __Pyx_GIVEREF(__pyx_tuple__6); - __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_src_spavro_fast_binary_pyx, __pyx_n_s_enum_reader, 129, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 129, __pyx_L1_error) + __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_src_spavro_fast_binary_pyx, __pyx_n_s_enum_reader, 132, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 132, __pyx_L1_error) - /* "spavro/fast_binary.pyx":136 + /* "spavro/fast_binary.pyx":139 * def make_array_reader(schema): * item_reader = get_reader(schema['items']) * def array_reader(fo): # <<<<<<<<<<<<<< * cdef long block_count * cdef list read_items = [] */ - __pyx_tuple__8 = PyTuple_Pack(5, __pyx_n_s_fo, __pyx_n_s_block_count, __pyx_n_s_read_items, __pyx_n_s_block_size, __pyx_n_s_i); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 136, __pyx_L1_error) + __pyx_tuple__8 = PyTuple_Pack(5, __pyx_n_s_fo, __pyx_n_s_block_count, __pyx_n_s_read_items, __pyx_n_s_block_size, __pyx_n_s_i); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 139, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8); - __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 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_src_spavro_fast_binary_pyx, __pyx_n_s_array_reader, 136, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 136, __pyx_L1_error) + __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 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_src_spavro_fast_binary_pyx, __pyx_n_s_array_reader, 139, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 139, __pyx_L1_error) - /* "spavro/fast_binary.pyx":154 + /* "spavro/fast_binary.pyx":157 * value_reader = get_reader(schema['values']) * * def map_reader(fo): # <<<<<<<<<<<<<< * cdef long block_count = read_long(fo) * cdef dict read_items = {} */ - __pyx_tuple__11 = PyTuple_Pack(6, __pyx_n_s_fo, __pyx_n_s_block_count, __pyx_n_s_read_items, __pyx_n_s_block_size, __pyx_n_s__10, __pyx_n_s_key); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 154, __pyx_L1_error) + __pyx_tuple__11 = PyTuple_Pack(6, __pyx_n_s_fo, __pyx_n_s_block_count, __pyx_n_s_read_items, __pyx_n_s_block_size, __pyx_n_s__10, __pyx_n_s_key); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 157, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__11); __Pyx_GIVEREF(__pyx_tuple__11); - __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 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_src_spavro_fast_binary_pyx, __pyx_n_s_map_reader, 154, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 154, __pyx_L1_error) + __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 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_src_spavro_fast_binary_pyx, __pyx_n_s_map_reader, 157, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 157, __pyx_L1_error) - /* "spavro/fast_binary.pyx":172 + /* "spavro/fast_binary.pyx":175 * cdef long size = schema['size'] * * def fixed_reader(fo): # <<<<<<<<<<<<<< * return fo.read(size) * fixed_reader.__reduce__ = lambda: (make_fixed_reader, (schema,)) */ - __pyx_tuple__13 = PyTuple_Pack(1, __pyx_n_s_fo); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 172, __pyx_L1_error) + __pyx_tuple__13 = PyTuple_Pack(1, __pyx_n_s_fo); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__13); __Pyx_GIVEREF(__pyx_tuple__13); - __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_fixed_reader, 172, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 172, __pyx_L1_error) + __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_fixed_reader, 175, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 175, __pyx_L1_error) - /* "spavro/fast_binary.pyx":203 + /* "spavro/fast_binary.pyx":206 * # in the avro stream properly * value_reader = get_reader(schema['value']) * def read_skip(fo): # <<<<<<<<<<<<<< * value_reader(fo) * return None */ - __pyx_tuple__15 = PyTuple_Pack(1, __pyx_n_s_fo); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 203, __pyx_L1_error) + __pyx_tuple__15 = PyTuple_Pack(1, __pyx_n_s_fo); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__15); __Pyx_GIVEREF(__pyx_tuple__15); - __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_src_spavro_fast_binary_pyx, __pyx_n_s_read_skip, 203, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 203, __pyx_L1_error) + __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_src_spavro_fast_binary_pyx, __pyx_n_s_read_skip, 206, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 206, __pyx_L1_error) - /* "spavro/fast_binary.pyx":212 + /* "spavro/fast_binary.pyx":215 * def make_default_reader(schema): * value = schema["value"] * def read_default(fo): # <<<<<<<<<<<<<< * return value * read_default.__reduce__ = lambda: (make_default_reader, (schema,)) */ - __pyx_tuple__17 = PyTuple_Pack(1, __pyx_n_s_fo); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 212, __pyx_L1_error) + __pyx_tuple__17 = PyTuple_Pack(1, __pyx_n_s_fo); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 215, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__17); __Pyx_GIVEREF(__pyx_tuple__17); - __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_src_spavro_fast_binary_pyx, __pyx_n_s_read_default, 212, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 212, __pyx_L1_error) + __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_src_spavro_fast_binary_pyx, __pyx_n_s_read_default, 215, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 215, __pyx_L1_error) - /* "spavro/fast_binary.pyx":368 + /* "spavro/fast_binary.pyx":487 * def make_record_check(schema): * cdef list fields = [CheckField(field['name'], get_check(field['type'])) for field in schema['fields']] * def record_check(datum): # <<<<<<<<<<<<<< * return isinstance(datum, dict) and all([field.check(datum.get(field.name)) for field in fields]) * return record_check */ - __pyx_tuple__20 = PyTuple_Pack(2, __pyx_n_s_datum, __pyx_n_s_field); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 368, __pyx_L1_error) + __pyx_tuple__20 = PyTuple_Pack(2, __pyx_n_s_datum, __pyx_n_s_field); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 487, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__20); __Pyx_GIVEREF(__pyx_tuple__20); - __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 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_src_spavro_fast_binary_pyx, __pyx_n_s_record_check, 368, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 368, __pyx_L1_error) + __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 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_src_spavro_fast_binary_pyx, __pyx_n_s_record_check, 487, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 487, __pyx_L1_error) - /* "spavro/fast_binary.pyx":375 + /* "spavro/fast_binary.pyx":494 * def make_enum_check(schema): * cdef list symbols = schema['symbols'] * def enum_check(datum): # <<<<<<<<<<<<<< * return datum in symbols * return enum_check */ - __pyx_tuple__22 = PyTuple_Pack(1, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 375, __pyx_L1_error) + __pyx_tuple__22 = PyTuple_Pack(1, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 494, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__22); __Pyx_GIVEREF(__pyx_tuple__22); - __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_src_spavro_fast_binary_pyx, __pyx_n_s_enum_check, 375, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 375, __pyx_L1_error) + __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_src_spavro_fast_binary_pyx, __pyx_n_s_enum_check, 494, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 494, __pyx_L1_error) - /* "spavro/fast_binary.pyx":406 + /* "spavro/fast_binary.pyx":525 * def make_array_check(schema): * item_check = get_check(schema['items']) * def array_check(datum): # <<<<<<<<<<<<<< * return isinstance(datum, list) and all([item_check(item) for item in datum]) * return array_check */ - __pyx_tuple__24 = PyTuple_Pack(2, __pyx_n_s_datum, __pyx_n_s_item); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 406, __pyx_L1_error) + __pyx_tuple__24 = PyTuple_Pack(2, __pyx_n_s_datum, __pyx_n_s_item); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 525, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__24); __Pyx_GIVEREF(__pyx_tuple__24); - __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 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_src_spavro_fast_binary_pyx, __pyx_n_s_array_check, 406, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 406, __pyx_L1_error) + __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 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_src_spavro_fast_binary_pyx, __pyx_n_s_array_check, 525, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 525, __pyx_L1_error) - /* "spavro/fast_binary.pyx":412 + /* "spavro/fast_binary.pyx":531 * def make_union_check(union_schema): * cdef list union_checks = [get_check(schema) for schema in union_schema] * def union_check(datum): # <<<<<<<<<<<<<< * return any([check(datum) for check in union_checks]) * return union_check */ - __pyx_tuple__26 = PyTuple_Pack(2, __pyx_n_s_datum, __pyx_n_s_check); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 412, __pyx_L1_error) + __pyx_tuple__26 = PyTuple_Pack(2, __pyx_n_s_datum, __pyx_n_s_check); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 531, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__26); __Pyx_GIVEREF(__pyx_tuple__26); - __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(1, 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_src_spavro_fast_binary_pyx, __pyx_n_s_union_check, 412, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 412, __pyx_L1_error) + __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(1, 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_src_spavro_fast_binary_pyx, __pyx_n_s_union_check, 531, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 531, __pyx_L1_error) - /* "spavro/fast_binary.pyx":418 + /* "spavro/fast_binary.pyx":537 * def make_fixed_check(schema): * cdef int size = schema['size'] * def fixed_check(datum): # <<<<<<<<<<<<<< * return (isinstance(datum, str) or isinstance(datum, bytes)) and len(datum) == size * return fixed_check */ - __pyx_tuple__28 = PyTuple_Pack(1, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 418, __pyx_L1_error) + __pyx_tuple__28 = PyTuple_Pack(1, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 537, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__28); __Pyx_GIVEREF(__pyx_tuple__28); - __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_src_spavro_fast_binary_pyx, __pyx_n_s_fixed_check, 418, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 418, __pyx_L1_error) + __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_src_spavro_fast_binary_pyx, __pyx_n_s_fixed_check, 537, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 537, __pyx_L1_error) - /* "spavro/fast_binary.pyx":424 + /* "spavro/fast_binary.pyx":543 * def make_map_check(schema): * map_value_check = get_check(schema['values']) * def map_check(datum): # <<<<<<<<<<<<<< * return isinstance(datum, dict) and all([check_string(key) and map_value_check(value) for key, value in datum.items()]) * return map_check */ - __pyx_tuple__30 = PyTuple_Pack(3, __pyx_n_s_datum, __pyx_n_s_key, __pyx_n_s_value); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 424, __pyx_L1_error) + __pyx_tuple__30 = PyTuple_Pack(3, __pyx_n_s_datum, __pyx_n_s_key, __pyx_n_s_value); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 543, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__30); __Pyx_GIVEREF(__pyx_tuple__30); - __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 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_src_spavro_fast_binary_pyx, __pyx_n_s_map_check, 424, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 424, __pyx_L1_error) + __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 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_src_spavro_fast_binary_pyx, __pyx_n_s_map_check, 543, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 543, __pyx_L1_error) - /* "spavro/fast_binary.pyx":505 + /* "spavro/fast_binary.pyx":624 * # or a float and a double in a union (which is valid but nonsensical * # in python but valid in avro) * def simple_writer_lookup(datum): # <<<<<<<<<<<<<< * try: * return writer_lookup_dict[type(datum)] */ - __pyx_tuple__32 = PyTuple_Pack(1, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 505, __pyx_L1_error) + __pyx_tuple__32 = PyTuple_Pack(1, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 624, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__32); __Pyx_GIVEREF(__pyx_tuple__32); - __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_src_spavro_fast_binary_pyx, __pyx_n_s_simple_writer_lookup, 505, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 505, __pyx_L1_error) + __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_src_spavro_fast_binary_pyx, __pyx_n_s_simple_writer_lookup, 624, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 624, __pyx_L1_error) - /* "spavro/fast_binary.pyx":534 + /* "spavro/fast_binary.pyx":653 * * * def complex_writer_lookup(datum): # <<<<<<<<<<<<<< * cdef: * long idx */ - __pyx_tuple__34 = PyTuple_Pack(5, __pyx_n_s_datum, __pyx_n_s_idx, __pyx_n_s_lookup_result, __pyx_n_s_get_check, __pyx_n_s_writer); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 534, __pyx_L1_error) + __pyx_tuple__34 = PyTuple_Pack(5, __pyx_n_s_datum, __pyx_n_s_idx, __pyx_n_s_lookup_result, __pyx_n_s_get_check, __pyx_n_s_writer); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 653, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__34); __Pyx_GIVEREF(__pyx_tuple__34); - __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_complex_writer_lookup, 534, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 534, __pyx_L1_error) - - /* "spavro/fast_binary.pyx":554 - * writer_lookup = complex_writer_lookup - * - * def write_union(outbuf, datum): # <<<<<<<<<<<<<< - * idx, data_writer = writer_lookup(datum) - * write_long(outbuf, idx) - */ - __pyx_tuple__36 = PyTuple_Pack(4, __pyx_n_s_outbuf, __pyx_n_s_datum, __pyx_n_s_idx, __pyx_n_s_data_writer); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 554, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__36); - __Pyx_GIVEREF(__pyx_tuple__36); - __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_write_union, 554, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 554, __pyx_L1_error) - - /* "spavro/fast_binary.pyx":565 - * - * # the datum can be str or unicode? - * def write_enum(outbuf, basestring datum): # <<<<<<<<<<<<<< - * cdef int enum_index = symbols.index(datum) - * write_int(outbuf, enum_index) - */ - __pyx_tuple__38 = PyTuple_Pack(3, __pyx_n_s_outbuf, __pyx_n_s_datum, __pyx_n_s_enum_index); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 565, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__38); - __Pyx_GIVEREF(__pyx_tuple__38); - __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 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_src_spavro_fast_binary_pyx, __pyx_n_s_write_enum, 565, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 565, __pyx_L1_error) + __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_complex_writer_lookup, 653, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 653, __pyx_L1_error) - /* "spavro/fast_binary.pyx":575 - * cdef list fields = [WriteField(field['name'], get_writer(field['type'])) for field in schema['fields']] - * - * def write_record(outbuf, datum): # <<<<<<<<<<<<<< - * for field in fields: - * try: - */ - __pyx_tuple__40 = PyTuple_Pack(4, __pyx_n_s_outbuf, __pyx_n_s_datum, __pyx_n_s_field, __pyx_n_s_e); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 575, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__40); - __Pyx_GIVEREF(__pyx_tuple__40); - __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 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_src_spavro_fast_binary_pyx, __pyx_n_s_write_record, 575, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 575, __pyx_L1_error) - - /* "spavro/fast_binary.pyx":588 - * item_writer = get_writer(schema['items']) - * - * def write_array(outbuf, list datum): # <<<<<<<<<<<<<< - * cdef long item_count = len(datum) - * if item_count > 0: - */ - __pyx_tuple__42 = PyTuple_Pack(4, __pyx_n_s_outbuf, __pyx_n_s_datum, __pyx_n_s_item_count, __pyx_n_s_item); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 588, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__42); - __Pyx_GIVEREF(__pyx_tuple__42); - __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_write_array, 588, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 588, __pyx_L1_error) - - /* "spavro/fast_binary.pyx":602 - * map_value_writer = get_writer(schema['values']) - * - * def write_map(outbuf, datum): # <<<<<<<<<<<<<< - * cdef long item_count = len(datum) - * if item_count > 0: - */ - __pyx_tuple__44 = PyTuple_Pack(5, __pyx_n_s_outbuf, __pyx_n_s_datum, __pyx_n_s_item_count, __pyx_n_s_key, __pyx_n_s_val); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 602, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__44); - __Pyx_GIVEREF(__pyx_tuple__44); - __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_write_map, 602, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 602, __pyx_L1_error) - - /* "spavro/fast_binary.pyx":617 - * '''Create a boolean writer, adds a validation step before the actual - * write function''' - * def checked_boolean_writer(outbuf, datum): # <<<<<<<<<<<<<< - * if not isinstance(datum, bool): - * raise TypeError("{} - Not a boolean value. Schema: {}".format(repr(datum), schema)) - */ - __pyx_tuple__46 = PyTuple_Pack(2, __pyx_n_s_outbuf, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__46); - __Pyx_GIVEREF(__pyx_tuple__46); - __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_checked_boolean_writer, 617, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 617, __pyx_L1_error) - - /* "spavro/fast_binary.pyx":629 - * # note: not a char* because those are null terminated and fixed - * # has no such limitation - * def checked_write_fixed(outbuf, datum): # <<<<<<<<<<<<<< - * if len(datum) != size: - * raise TypeError("{} - Size Mismatch ({}) for Fixed data. Schema: {}".format(repr(datum), len(datum), schema)) - */ - __pyx_tuple__48 = PyTuple_Pack(2, __pyx_n_s_outbuf, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 629, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__48); - __Pyx_GIVEREF(__pyx_tuple__48); - __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_checked_write_fixed, 629, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 629, __pyx_L1_error) - - /* "spavro/fast_binary.pyx":639 - * '''Create a int writer, adds a validation step before the actual - * write function to make sure the int value doesn't overflow''' - * def checked_int_write(outbuf, datum): # <<<<<<<<<<<<<< - * if not isinstance(datum, six.integer_types): - * raise TypeError("Schema violation, {} is not an example of schema {}".format(datum, schema)) - */ - __pyx_tuple__50 = PyTuple_Pack(2, __pyx_n_s_outbuf, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 639, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__50); - __Pyx_GIVEREF(__pyx_tuple__50); - __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_checked_int_write, 639, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 639, __pyx_L1_error) - - /* "spavro/fast_binary.pyx":651 - * '''Create a long writer, adds a validation step before the actual - * write function to make sure the long value doesn't overflow''' - * def checked_long_write(outbuf, datum): # <<<<<<<<<<<<<< - * if not (isinstance(datum, six.integer_types) - * and LONG_MIN_VALUE <= datum <= LONG_MAX_VALUE): - */ - __pyx_tuple__52 = PyTuple_Pack(2, __pyx_n_s_outbuf, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 651, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__52); - __Pyx_GIVEREF(__pyx_tuple__52); - __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_checked_long_write, 651, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 651, __pyx_L1_error) - - /* "spavro/fast_binary.pyx":660 - * - * def make_string_writer(schema): - * def checked_string_writer(outbuf, datum): # <<<<<<<<<<<<<< - * if not isinstance(datum, six.string_types): - * raise TypeError("{} - is not a string value. Schema: {}".format(repr(datum), schema)) - */ - __pyx_tuple__54 = PyTuple_Pack(2, __pyx_n_s_outbuf, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__54); - __Pyx_GIVEREF(__pyx_tuple__54); - __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_checked_string_writer, 660, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 660, __pyx_L1_error) - - /* "spavro/fast_binary.pyx":826 + /* "spavro/fast_binary.pyx":869 * checksum = struct.unpack("!I", self.reader.read(4))[0] * if crc32(bytes) & 0xffffffff != checksum: * raise RuntimeError("Checksum failure") # <<<<<<<<<<<<<< * * def skip_null(self): */ - __pyx_tuple__56 = PyTuple_Pack(1, __pyx_kp_s_Checksum_failure); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 826, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__56); - __Pyx_GIVEREF(__pyx_tuple__56); + __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_s_Checksum_failure); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 869, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__36); + __Pyx_GIVEREF(__pyx_tuple__36); /* "cfunc.to_py":65 * @cname("__Pyx_CFunc_void____object____long__long___to_py") * cdef object __Pyx_CFunc_void____object____long__long___to_py(void (*f)(object, long long) except *): - * def wrap(object outbuf, long long signed_datum): # <<<<<<<<<<<<<< - * """wrap(outbuf, signed_datum: 'long long') -> 'void'""" - * f(outbuf, signed_datum) - */ - __pyx_tuple__57 = PyTuple_Pack(2, __pyx_n_s_outbuf, __pyx_n_s_signed_datum); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(1, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__57); - __Pyx_GIVEREF(__pyx_tuple__57); - __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_wrap, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) __PYX_ERR(1, 65, __pyx_L1_error) - __pyx_tuple__59 = PyTuple_Pack(1, __pyx_n_s_fo); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(1, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__59); - __Pyx_GIVEREF(__pyx_tuple__59); - __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_wrap, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__60)) __PYX_ERR(1, 65, __pyx_L1_error) - __pyx_tuple__61 = PyTuple_Pack(1, __pyx_n_s_fo); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(1, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__61); - __Pyx_GIVEREF(__pyx_tuple__61); - __pyx_codeobj__62 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__61, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_wrap, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__62)) __PYX_ERR(1, 65, __pyx_L1_error) - __pyx_tuple__63 = PyTuple_Pack(1, __pyx_n_s_fo); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(1, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__63); - __Pyx_GIVEREF(__pyx_tuple__63); - __pyx_codeobj__64 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_wrap, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) __PYX_ERR(1, 65, __pyx_L1_error) - __pyx_tuple__65 = PyTuple_Pack(1, __pyx_n_s_fo); if (unlikely(!__pyx_tuple__65)) __PYX_ERR(1, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__65); - __Pyx_GIVEREF(__pyx_tuple__65); - __pyx_codeobj__66 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__65, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_wrap, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__66)) __PYX_ERR(1, 65, __pyx_L1_error) - __pyx_tuple__67 = PyTuple_Pack(1, __pyx_n_s_fo); if (unlikely(!__pyx_tuple__67)) __PYX_ERR(1, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__67); - __Pyx_GIVEREF(__pyx_tuple__67); - __pyx_codeobj__68 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__67, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_wrap, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__68)) __PYX_ERR(1, 65, __pyx_L1_error) - __pyx_tuple__69 = PyTuple_Pack(1, __pyx_n_s_fo); if (unlikely(!__pyx_tuple__69)) __PYX_ERR(1, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__69); - __Pyx_GIVEREF(__pyx_tuple__69); - __pyx_codeobj__70 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__69, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_wrap, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__70)) __PYX_ERR(1, 65, __pyx_L1_error) - __pyx_tuple__71 = PyTuple_Pack(1, __pyx_n_s_fo); if (unlikely(!__pyx_tuple__71)) __PYX_ERR(1, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__71); - __Pyx_GIVEREF(__pyx_tuple__71); - __pyx_codeobj__72 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_wrap, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__72)) __PYX_ERR(1, 65, __pyx_L1_error) - __pyx_tuple__73 = PyTuple_Pack(2, __pyx_n_s_outbuf, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__73)) __PYX_ERR(1, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__73); - __Pyx_GIVEREF(__pyx_tuple__73); - __pyx_codeobj__74 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__73, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_wrap, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__74)) __PYX_ERR(1, 65, __pyx_L1_error) - __pyx_tuple__75 = PyTuple_Pack(2, __pyx_n_s_outbuf, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__75)) __PYX_ERR(1, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__75); - __Pyx_GIVEREF(__pyx_tuple__75); - __pyx_codeobj__76 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__75, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_wrap, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__76)) __PYX_ERR(1, 65, __pyx_L1_error) - __pyx_tuple__77 = PyTuple_Pack(2, __pyx_n_s_outbuf, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__77)) __PYX_ERR(1, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__77); - __Pyx_GIVEREF(__pyx_tuple__77); - __pyx_codeobj__78 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__77, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_wrap, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__78)) __PYX_ERR(1, 65, __pyx_L1_error) + * def wrap(object outbuf, long long signed_datum): # <<<<<<<<<<<<<< + * """wrap(outbuf, signed_datum: 'long long') -> 'void'""" + * f(outbuf, signed_datum) + */ + __pyx_tuple__37 = PyTuple_Pack(2, __pyx_n_s_outbuf, __pyx_n_s_signed_datum); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(2, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__37); + __Pyx_GIVEREF(__pyx_tuple__37); + __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_wrap, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(2, 65, __pyx_L1_error) + __pyx_tuple__39 = PyTuple_Pack(1, __pyx_n_s_fo); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(2, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__39); + __Pyx_GIVEREF(__pyx_tuple__39); + __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_wrap, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(2, 65, __pyx_L1_error) + __pyx_tuple__41 = PyTuple_Pack(1, __pyx_n_s_fo); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(2, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__41); + __Pyx_GIVEREF(__pyx_tuple__41); + __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_wrap, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(2, 65, __pyx_L1_error) + __pyx_tuple__43 = PyTuple_Pack(1, __pyx_n_s_fo); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(2, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__43); + __Pyx_GIVEREF(__pyx_tuple__43); + __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_stringsource, __pyx_n_s_wrap, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(2, 65, __pyx_L1_error) + __pyx_tuple__45 = PyTuple_Pack(1, __pyx_n_s_fo); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(2, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__45); + __Pyx_GIVEREF(__pyx_tuple__45); + __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_stringsource, __pyx_n_s_wrap, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(2, 65, __pyx_L1_error) + __pyx_tuple__47 = PyTuple_Pack(1, __pyx_n_s_fo); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(2, 65, __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_stringsource, __pyx_n_s_wrap, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) __PYX_ERR(2, 65, __pyx_L1_error) + __pyx_tuple__49 = PyTuple_Pack(1, __pyx_n_s_fo); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(2, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__49); + __Pyx_GIVEREF(__pyx_tuple__49); + __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_stringsource, __pyx_n_s_wrap, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(2, 65, __pyx_L1_error) + __pyx_tuple__51 = PyTuple_Pack(1, __pyx_n_s_fo); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(2, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__51); + __Pyx_GIVEREF(__pyx_tuple__51); + __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_stringsource, __pyx_n_s_wrap, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) __PYX_ERR(2, 65, __pyx_L1_error) - /* "spavro/fast_binary.pyx":103 + /* "spavro/fast_binary.pyx":106 * * * def make_union_reader(union_schema): # <<<<<<<<<<<<<< * cdef list readers = [get_reader(schema) for schema in union_schema] * */ - __pyx_tuple__79 = PyTuple_Pack(5, __pyx_n_s_union_schema, __pyx_n_s_readers, __pyx_n_s_union_reader, __pyx_n_s_union_reader, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__79)) __PYX_ERR(0, 103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__79); - __Pyx_GIVEREF(__pyx_tuple__79); - __pyx_codeobj__80 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__79, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_union_reader, 103, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__80)) __PYX_ERR(0, 103, __pyx_L1_error) + __pyx_tuple__53 = PyTuple_Pack(5, __pyx_n_s_union_schema, __pyx_n_s_readers, __pyx_n_s_union_reader, __pyx_n_s_union_reader, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(0, 106, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__53); + __Pyx_GIVEREF(__pyx_tuple__53); + __pyx_codeobj__54 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__53, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_union_reader, 106, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__54)) __PYX_ERR(0, 106, __pyx_L1_error) - /* "spavro/fast_binary.pyx":117 + /* "spavro/fast_binary.pyx":120 * * * def make_record_reader(schema): # <<<<<<<<<<<<<< * cdef list fields = [ReadField(field['name'], get_reader(field['type']), get_type(field['type']) == 'skip') for field in schema['fields']] * */ - __pyx_tuple__81 = PyTuple_Pack(5, __pyx_n_s_schema, __pyx_n_s_fields, __pyx_n_s_record_reader, __pyx_n_s_record_reader, __pyx_n_s_field); if (unlikely(!__pyx_tuple__81)) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__81); - __Pyx_GIVEREF(__pyx_tuple__81); - __pyx_codeobj__82 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__81, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_record_reader, 117, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__82)) __PYX_ERR(0, 117, __pyx_L1_error) + __pyx_tuple__55 = PyTuple_Pack(5, __pyx_n_s_schema, __pyx_n_s_fields, __pyx_n_s_record_reader, __pyx_n_s_record_reader, __pyx_n_s_field); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(0, 120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__55); + __Pyx_GIVEREF(__pyx_tuple__55); + __pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_record_reader, 120, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) __PYX_ERR(0, 120, __pyx_L1_error) - /* "spavro/fast_binary.pyx":126 + /* "spavro/fast_binary.pyx":129 * * * def make_enum_reader(schema): # <<<<<<<<<<<<<< * cdef list symbols = schema['symbols'] * */ - __pyx_tuple__83 = PyTuple_Pack(4, __pyx_n_s_schema, __pyx_n_s_symbols, __pyx_n_s_enum_reader, __pyx_n_s_enum_reader); if (unlikely(!__pyx_tuple__83)) __PYX_ERR(0, 126, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__83); - __Pyx_GIVEREF(__pyx_tuple__83); - __pyx_codeobj__84 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__83, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_enum_reader, 126, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__84)) __PYX_ERR(0, 126, __pyx_L1_error) + __pyx_tuple__57 = PyTuple_Pack(4, __pyx_n_s_schema, __pyx_n_s_symbols, __pyx_n_s_enum_reader, __pyx_n_s_enum_reader); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__57); + __Pyx_GIVEREF(__pyx_tuple__57); + __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_enum_reader, 129, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) __PYX_ERR(0, 129, __pyx_L1_error) - /* "spavro/fast_binary.pyx":134 + /* "spavro/fast_binary.pyx":137 * return enum_reader * * def make_array_reader(schema): # <<<<<<<<<<<<<< * item_reader = get_reader(schema['items']) * def array_reader(fo): */ - __pyx_tuple__85 = PyTuple_Pack(4, __pyx_n_s_schema, __pyx_n_s_item_reader, __pyx_n_s_array_reader, __pyx_n_s_array_reader); if (unlikely(!__pyx_tuple__85)) __PYX_ERR(0, 134, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__85); - __Pyx_GIVEREF(__pyx_tuple__85); - __pyx_codeobj__86 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__85, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_array_reader, 134, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__86)) __PYX_ERR(0, 134, __pyx_L1_error) + __pyx_tuple__59 = PyTuple_Pack(4, __pyx_n_s_schema, __pyx_n_s_item_reader, __pyx_n_s_array_reader, __pyx_n_s_array_reader); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__59); + __Pyx_GIVEREF(__pyx_tuple__59); + __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_array_reader, 137, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__60)) __PYX_ERR(0, 137, __pyx_L1_error) - /* "spavro/fast_binary.pyx":151 + /* "spavro/fast_binary.pyx":154 * return array_reader * * def make_map_reader(schema): # <<<<<<<<<<<<<< * value_reader = get_reader(schema['values']) * */ - __pyx_tuple__87 = PyTuple_Pack(4, __pyx_n_s_schema, __pyx_n_s_value_reader, __pyx_n_s_map_reader, __pyx_n_s_map_reader); if (unlikely(!__pyx_tuple__87)) __PYX_ERR(0, 151, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__87); - __Pyx_GIVEREF(__pyx_tuple__87); - __pyx_codeobj__88 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__87, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_map_reader, 151, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__88)) __PYX_ERR(0, 151, __pyx_L1_error) + __pyx_tuple__61 = PyTuple_Pack(4, __pyx_n_s_schema, __pyx_n_s_value_reader, __pyx_n_s_map_reader, __pyx_n_s_map_reader); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(0, 154, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__61); + __Pyx_GIVEREF(__pyx_tuple__61); + __pyx_codeobj__62 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__61, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_map_reader, 154, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__62)) __PYX_ERR(0, 154, __pyx_L1_error) - /* "spavro/fast_binary.pyx":169 + /* "spavro/fast_binary.pyx":172 * return map_reader * * def make_fixed_reader(schema): # <<<<<<<<<<<<<< * cdef long size = schema['size'] * */ - __pyx_tuple__89 = PyTuple_Pack(4, __pyx_n_s_schema, __pyx_n_s_size, __pyx_n_s_fixed_reader, __pyx_n_s_fixed_reader); if (unlikely(!__pyx_tuple__89)) __PYX_ERR(0, 169, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__89); - __Pyx_GIVEREF(__pyx_tuple__89); - __pyx_codeobj__90 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__89, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_fixed_reader, 169, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__90)) __PYX_ERR(0, 169, __pyx_L1_error) + __pyx_tuple__63 = PyTuple_Pack(4, __pyx_n_s_schema, __pyx_n_s_size, __pyx_n_s_fixed_reader, __pyx_n_s_fixed_reader); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(0, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__63); + __Pyx_GIVEREF(__pyx_tuple__63); + __pyx_codeobj__64 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_fixed_reader, 172, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) __PYX_ERR(0, 172, __pyx_L1_error) - /* "spavro/fast_binary.pyx":177 + /* "spavro/fast_binary.pyx":180 * return fixed_reader * * def make_null_reader(schema): # <<<<<<<<<<<<<< * return read_null * */ - __pyx_tuple__91 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__91)) __PYX_ERR(0, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__91); - __Pyx_GIVEREF(__pyx_tuple__91); - __pyx_codeobj__92 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__91, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_null_reader, 177, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__92)) __PYX_ERR(0, 177, __pyx_L1_error) + __pyx_tuple__65 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__65)) __PYX_ERR(0, 180, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__65); + __Pyx_GIVEREF(__pyx_tuple__65); + __pyx_codeobj__66 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__65, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_null_reader, 180, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__66)) __PYX_ERR(0, 180, __pyx_L1_error) - /* "spavro/fast_binary.pyx":180 + /* "spavro/fast_binary.pyx":183 * return read_null * * def make_string_reader(schema): # <<<<<<<<<<<<<< * return read_utf8 * */ - __pyx_tuple__93 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__93)) __PYX_ERR(0, 180, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__93); - __Pyx_GIVEREF(__pyx_tuple__93); - __pyx_codeobj__94 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__93, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_string_reader, 180, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__94)) __PYX_ERR(0, 180, __pyx_L1_error) + __pyx_tuple__67 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__67)) __PYX_ERR(0, 183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__67); + __Pyx_GIVEREF(__pyx_tuple__67); + __pyx_codeobj__68 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__67, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_string_reader, 183, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__68)) __PYX_ERR(0, 183, __pyx_L1_error) - /* "spavro/fast_binary.pyx":183 + /* "spavro/fast_binary.pyx":186 * return read_utf8 * * def make_boolean_reader(schema): # <<<<<<<<<<<<<< * return read_boolean * */ - __pyx_tuple__95 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__95)) __PYX_ERR(0, 183, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__95); - __Pyx_GIVEREF(__pyx_tuple__95); - __pyx_codeobj__96 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__95, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_boolean_reader, 183, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__96)) __PYX_ERR(0, 183, __pyx_L1_error) + __pyx_tuple__69 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__69)) __PYX_ERR(0, 186, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__69); + __Pyx_GIVEREF(__pyx_tuple__69); + __pyx_codeobj__70 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__69, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_boolean_reader, 186, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__70)) __PYX_ERR(0, 186, __pyx_L1_error) - /* "spavro/fast_binary.pyx":186 + /* "spavro/fast_binary.pyx":189 * return read_boolean * * def make_double_reader(schema): # <<<<<<<<<<<<<< * return read_double * */ - __pyx_tuple__97 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__97)) __PYX_ERR(0, 186, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__97); - __Pyx_GIVEREF(__pyx_tuple__97); - __pyx_codeobj__98 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__97, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_double_reader, 186, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__98)) __PYX_ERR(0, 186, __pyx_L1_error) + __pyx_tuple__71 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__71)) __PYX_ERR(0, 189, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__71); + __Pyx_GIVEREF(__pyx_tuple__71); + __pyx_codeobj__72 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_double_reader, 189, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__72)) __PYX_ERR(0, 189, __pyx_L1_error) - /* "spavro/fast_binary.pyx":189 + /* "spavro/fast_binary.pyx":192 * return read_double * * def make_long_reader(schema): # <<<<<<<<<<<<<< * return read_long * */ - __pyx_tuple__99 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__99)) __PYX_ERR(0, 189, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__99); - __Pyx_GIVEREF(__pyx_tuple__99); - __pyx_codeobj__100 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__99, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_long_reader, 189, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__100)) __PYX_ERR(0, 189, __pyx_L1_error) + __pyx_tuple__73 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__73)) __PYX_ERR(0, 192, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__73); + __Pyx_GIVEREF(__pyx_tuple__73); + __pyx_codeobj__74 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__73, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_long_reader, 192, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__74)) __PYX_ERR(0, 192, __pyx_L1_error) - /* "spavro/fast_binary.pyx":192 + /* "spavro/fast_binary.pyx":195 * return read_long * * def make_byte_reader(schema): # <<<<<<<<<<<<<< * return read_bytes * */ - __pyx_tuple__101 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__101)) __PYX_ERR(0, 192, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__101); - __Pyx_GIVEREF(__pyx_tuple__101); - __pyx_codeobj__102 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__101, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_byte_reader, 192, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__102)) __PYX_ERR(0, 192, __pyx_L1_error) + __pyx_tuple__75 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__75)) __PYX_ERR(0, 195, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__75); + __Pyx_GIVEREF(__pyx_tuple__75); + __pyx_codeobj__76 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__75, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_byte_reader, 195, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__76)) __PYX_ERR(0, 195, __pyx_L1_error) - /* "spavro/fast_binary.pyx":195 + /* "spavro/fast_binary.pyx":198 * return read_bytes * * def make_float_reader(schema): # <<<<<<<<<<<<<< * return read_float * */ - __pyx_tuple__103 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__103)) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__103); - __Pyx_GIVEREF(__pyx_tuple__103); - __pyx_codeobj__104 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__103, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_float_reader, 195, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__104)) __PYX_ERR(0, 195, __pyx_L1_error) + __pyx_tuple__77 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__77)) __PYX_ERR(0, 198, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__77); + __Pyx_GIVEREF(__pyx_tuple__77); + __pyx_codeobj__78 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__77, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_float_reader, 198, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__78)) __PYX_ERR(0, 198, __pyx_L1_error) - /* "spavro/fast_binary.pyx":199 + /* "spavro/fast_binary.pyx":202 * * * def make_skip_reader(schema): # <<<<<<<<<<<<<< * # this will create a regular reader that will iterate the bytes * # in the avro stream properly */ - __pyx_tuple__105 = PyTuple_Pack(4, __pyx_n_s_schema, __pyx_n_s_value_reader, __pyx_n_s_read_skip, __pyx_n_s_read_skip); if (unlikely(!__pyx_tuple__105)) __PYX_ERR(0, 199, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__105); - __Pyx_GIVEREF(__pyx_tuple__105); - __pyx_codeobj__106 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__105, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_skip_reader, 199, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__106)) __PYX_ERR(0, 199, __pyx_L1_error) + __pyx_tuple__79 = PyTuple_Pack(4, __pyx_n_s_schema, __pyx_n_s_value_reader, __pyx_n_s_read_skip, __pyx_n_s_read_skip); if (unlikely(!__pyx_tuple__79)) __PYX_ERR(0, 202, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__79); + __Pyx_GIVEREF(__pyx_tuple__79); + __pyx_codeobj__80 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__79, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_skip_reader, 202, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__80)) __PYX_ERR(0, 202, __pyx_L1_error) - /* "spavro/fast_binary.pyx":210 + /* "spavro/fast_binary.pyx":213 * * * def make_default_reader(schema): # <<<<<<<<<<<<<< * value = schema["value"] * def read_default(fo): */ - __pyx_tuple__107 = PyTuple_Pack(4, __pyx_n_s_schema, __pyx_n_s_value, __pyx_n_s_read_default, __pyx_n_s_read_default); if (unlikely(!__pyx_tuple__107)) __PYX_ERR(0, 210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__107); - __Pyx_GIVEREF(__pyx_tuple__107); - __pyx_codeobj__108 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__107, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_default_reader, 210, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__108)) __PYX_ERR(0, 210, __pyx_L1_error) + __pyx_tuple__81 = PyTuple_Pack(4, __pyx_n_s_schema, __pyx_n_s_value, __pyx_n_s_read_default, __pyx_n_s_read_default); if (unlikely(!__pyx_tuple__81)) __PYX_ERR(0, 213, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__81); + __Pyx_GIVEREF(__pyx_tuple__81); + __pyx_codeobj__82 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__81, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_default_reader, 213, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__82)) __PYX_ERR(0, 213, __pyx_L1_error) - /* "spavro/fast_binary.pyx":239 + /* "spavro/fast_binary.pyx":242 * schema_cache = {} * * class ReaderPlaceholder(object): # <<<<<<<<<<<<<< * def __init__(self): * self.reader = None */ - __pyx_tuple__109 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__109)) __PYX_ERR(0, 239, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__109); - __Pyx_GIVEREF(__pyx_tuple__109); + __pyx_tuple__83 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__83)) __PYX_ERR(0, 242, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__83); + __Pyx_GIVEREF(__pyx_tuple__83); - /* "spavro/fast_binary.pyx":240 + /* "spavro/fast_binary.pyx":243 * * class ReaderPlaceholder(object): * def __init__(self): # <<<<<<<<<<<<<< * self.reader = None * */ - __pyx_tuple__110 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__110)) __PYX_ERR(0, 240, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__110); - __Pyx_GIVEREF(__pyx_tuple__110); - __pyx_codeobj__111 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__110, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_init, 240, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__111)) __PYX_ERR(0, 240, __pyx_L1_error) + __pyx_tuple__84 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__84)) __PYX_ERR(0, 243, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__84); + __Pyx_GIVEREF(__pyx_tuple__84); + __pyx_codeobj__85 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__84, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_init, 243, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__85)) __PYX_ERR(0, 243, __pyx_L1_error) - /* "spavro/fast_binary.pyx":243 + /* "spavro/fast_binary.pyx":246 * self.reader = None * * def __call__(self, fo): # <<<<<<<<<<<<<< * return self.reader(fo) * */ - __pyx_tuple__112 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_fo); if (unlikely(!__pyx_tuple__112)) __PYX_ERR(0, 243, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__112); - __Pyx_GIVEREF(__pyx_tuple__112); - __pyx_codeobj__113 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__112, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_call, 243, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__113)) __PYX_ERR(0, 243, __pyx_L1_error) + __pyx_tuple__86 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_fo); if (unlikely(!__pyx_tuple__86)) __PYX_ERR(0, 246, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__86); + __Pyx_GIVEREF(__pyx_tuple__86); + __pyx_codeobj__87 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__86, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_call, 246, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__87)) __PYX_ERR(0, 246, __pyx_L1_error) - /* "spavro/fast_binary.pyx":246 + /* "spavro/fast_binary.pyx":249 * return self.reader(fo) * * def get_reader(schema): # <<<<<<<<<<<<<< * cdef unicode schema_type = get_type(schema) * if schema_type in ('record', 'fixed', 'enum'): */ - __pyx_tuple__114 = PyTuple_Pack(7, __pyx_n_s_schema, __pyx_n_s_schema_type, __pyx_n_s_placeholder, __pyx_n_s_namespace, __pyx_n_s_name, __pyx_n_s_fullname, __pyx_n_s_reader); if (unlikely(!__pyx_tuple__114)) __PYX_ERR(0, 246, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__114); - __Pyx_GIVEREF(__pyx_tuple__114); - __pyx_codeobj__115 = (PyObject*)__Pyx_PyCode_New(1, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__114, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_get_reader, 246, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__115)) __PYX_ERR(0, 246, __pyx_L1_error) + __pyx_tuple__88 = PyTuple_Pack(7, __pyx_n_s_schema, __pyx_n_s_schema_type, __pyx_n_s_placeholder, __pyx_n_s_namespace, __pyx_n_s_name, __pyx_n_s_fullname, __pyx_n_s_reader); if (unlikely(!__pyx_tuple__88)) __PYX_ERR(0, 249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__88); + __Pyx_GIVEREF(__pyx_tuple__88); + __pyx_codeobj__89 = (PyObject*)__Pyx_PyCode_New(1, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__88, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_get_reader, 249, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__89)) __PYX_ERR(0, 249, __pyx_L1_error) - /* "spavro/fast_binary.pyx":360 + /* "spavro/fast_binary.pyx":479 * CheckField = namedtuple('CheckField', ['name', 'check']) * * def get_check(schema): # <<<<<<<<<<<<<< * schema = lookup_schema(schema) * cdef unicode schema_type = get_type(schema) */ - __pyx_tuple__116 = PyTuple_Pack(2, __pyx_n_s_schema, __pyx_n_s_schema_type); if (unlikely(!__pyx_tuple__116)) __PYX_ERR(0, 360, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__116); - __Pyx_GIVEREF(__pyx_tuple__116); - __pyx_codeobj__117 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__116, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_get_check, 360, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__117)) __PYX_ERR(0, 360, __pyx_L1_error) + __pyx_tuple__90 = PyTuple_Pack(2, __pyx_n_s_schema, __pyx_n_s_schema_type); if (unlikely(!__pyx_tuple__90)) __PYX_ERR(0, 479, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__90); + __Pyx_GIVEREF(__pyx_tuple__90); + __pyx_codeobj__91 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__90, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_get_check, 479, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__91)) __PYX_ERR(0, 479, __pyx_L1_error) - /* "spavro/fast_binary.pyx":366 + /* "spavro/fast_binary.pyx":485 * * * def make_record_check(schema): # <<<<<<<<<<<<<< * cdef list fields = [CheckField(field['name'], get_check(field['type'])) for field in schema['fields']] * def record_check(datum): */ - __pyx_tuple__118 = PyTuple_Pack(5, __pyx_n_s_schema, __pyx_n_s_fields, __pyx_n_s_record_check, __pyx_n_s_record_check, __pyx_n_s_field); if (unlikely(!__pyx_tuple__118)) __PYX_ERR(0, 366, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__118); - __Pyx_GIVEREF(__pyx_tuple__118); - __pyx_codeobj__119 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__118, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_record_check, 366, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__119)) __PYX_ERR(0, 366, __pyx_L1_error) + __pyx_tuple__92 = PyTuple_Pack(5, __pyx_n_s_schema, __pyx_n_s_fields, __pyx_n_s_record_check, __pyx_n_s_record_check, __pyx_n_s_field); if (unlikely(!__pyx_tuple__92)) __PYX_ERR(0, 485, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__92); + __Pyx_GIVEREF(__pyx_tuple__92); + __pyx_codeobj__93 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__92, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_record_check, 485, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__93)) __PYX_ERR(0, 485, __pyx_L1_error) - /* "spavro/fast_binary.pyx":373 + /* "spavro/fast_binary.pyx":492 * * * def make_enum_check(schema): # <<<<<<<<<<<<<< * cdef list symbols = schema['symbols'] * def enum_check(datum): */ - __pyx_tuple__120 = PyTuple_Pack(4, __pyx_n_s_schema, __pyx_n_s_symbols, __pyx_n_s_enum_check, __pyx_n_s_enum_check); if (unlikely(!__pyx_tuple__120)) __PYX_ERR(0, 373, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__120); - __Pyx_GIVEREF(__pyx_tuple__120); - __pyx_codeobj__121 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__120, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_enum_check, 373, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__121)) __PYX_ERR(0, 373, __pyx_L1_error) + __pyx_tuple__94 = PyTuple_Pack(4, __pyx_n_s_schema, __pyx_n_s_symbols, __pyx_n_s_enum_check, __pyx_n_s_enum_check); if (unlikely(!__pyx_tuple__94)) __PYX_ERR(0, 492, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__94); + __Pyx_GIVEREF(__pyx_tuple__94); + __pyx_codeobj__95 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__94, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_enum_check, 492, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__95)) __PYX_ERR(0, 492, __pyx_L1_error) - /* "spavro/fast_binary.pyx":380 + /* "spavro/fast_binary.pyx":499 * * * def make_null_check(schema): # <<<<<<<<<<<<<< * return lambda datum: datum is None * */ - __pyx_tuple__122 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__122)) __PYX_ERR(0, 380, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__122); - __Pyx_GIVEREF(__pyx_tuple__122); - __pyx_codeobj__123 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__122, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_null_check, 380, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__123)) __PYX_ERR(0, 380, __pyx_L1_error) + __pyx_tuple__96 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__96)) __PYX_ERR(0, 499, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__96); + __Pyx_GIVEREF(__pyx_tuple__96); + __pyx_codeobj__97 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__96, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_null_check, 499, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__97)) __PYX_ERR(0, 499, __pyx_L1_error) - /* "spavro/fast_binary.pyx":383 + /* "spavro/fast_binary.pyx":502 * return lambda datum: datum is None * * def check_string(datum): # <<<<<<<<<<<<<< * return isinstance(datum, basestring) * */ - __pyx_tuple__124 = PyTuple_Pack(1, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__124)) __PYX_ERR(0, 383, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__124); - __Pyx_GIVEREF(__pyx_tuple__124); - __pyx_codeobj__125 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__124, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_check_string, 383, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__125)) __PYX_ERR(0, 383, __pyx_L1_error) + __pyx_tuple__98 = PyTuple_Pack(1, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__98)) __PYX_ERR(0, 502, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__98); + __Pyx_GIVEREF(__pyx_tuple__98); + __pyx_codeobj__99 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__98, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_check_string, 502, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__99)) __PYX_ERR(0, 502, __pyx_L1_error) - /* "spavro/fast_binary.pyx":386 + /* "spavro/fast_binary.pyx":505 * return isinstance(datum, basestring) * * def make_string_check(schema): # <<<<<<<<<<<<<< * return check_string * */ - __pyx_tuple__126 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__126)) __PYX_ERR(0, 386, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__126); - __Pyx_GIVEREF(__pyx_tuple__126); - __pyx_codeobj__127 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__126, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_string_check, 386, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__127)) __PYX_ERR(0, 386, __pyx_L1_error) + __pyx_tuple__100 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__100)) __PYX_ERR(0, 505, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__100); + __Pyx_GIVEREF(__pyx_tuple__100); + __pyx_codeobj__101 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__100, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_string_check, 505, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__101)) __PYX_ERR(0, 505, __pyx_L1_error) - /* "spavro/fast_binary.pyx":389 + /* "spavro/fast_binary.pyx":508 * return check_string * * def make_long_check(schema): # <<<<<<<<<<<<<< * return lambda datum: isinstance(datum, int) or isinstance(datum, long) * */ - __pyx_tuple__128 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__128)) __PYX_ERR(0, 389, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__128); - __Pyx_GIVEREF(__pyx_tuple__128); - __pyx_codeobj__129 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__128, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_long_check, 389, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__129)) __PYX_ERR(0, 389, __pyx_L1_error) + __pyx_tuple__102 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__102)) __PYX_ERR(0, 508, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__102); + __Pyx_GIVEREF(__pyx_tuple__102); + __pyx_codeobj__103 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__102, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_long_check, 508, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__103)) __PYX_ERR(0, 508, __pyx_L1_error) - /* "spavro/fast_binary.pyx":392 + /* "spavro/fast_binary.pyx":511 * return lambda datum: isinstance(datum, int) or isinstance(datum, long) * * def make_boolean_check(schema): # <<<<<<<<<<<<<< * return lambda datum: isinstance(datum, bool) * */ - __pyx_tuple__130 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__130)) __PYX_ERR(0, 392, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__130); - __Pyx_GIVEREF(__pyx_tuple__130); - __pyx_codeobj__131 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__130, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_boolean_check, 392, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__131)) __PYX_ERR(0, 392, __pyx_L1_error) + __pyx_tuple__104 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__104)) __PYX_ERR(0, 511, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__104); + __Pyx_GIVEREF(__pyx_tuple__104); + __pyx_codeobj__105 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__104, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_boolean_check, 511, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__105)) __PYX_ERR(0, 511, __pyx_L1_error) - /* "spavro/fast_binary.pyx":395 + /* "spavro/fast_binary.pyx":514 * return lambda datum: isinstance(datum, bool) * * def make_float_check(schema): # <<<<<<<<<<<<<< * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) * */ - __pyx_tuple__132 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__132)) __PYX_ERR(0, 395, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__132); - __Pyx_GIVEREF(__pyx_tuple__132); - __pyx_codeobj__133 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__132, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_float_check, 395, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__133)) __PYX_ERR(0, 395, __pyx_L1_error) + __pyx_tuple__106 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__106)) __PYX_ERR(0, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__106); + __Pyx_GIVEREF(__pyx_tuple__106); + __pyx_codeobj__107 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__106, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_float_check, 514, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__107)) __PYX_ERR(0, 514, __pyx_L1_error) - /* "spavro/fast_binary.pyx":398 + /* "spavro/fast_binary.pyx":517 * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) * * def make_double_check(schema): # <<<<<<<<<<<<<< * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) * */ - __pyx_tuple__134 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__134)) __PYX_ERR(0, 398, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__134); - __Pyx_GIVEREF(__pyx_tuple__134); - __pyx_codeobj__135 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__134, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_double_check, 398, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__135)) __PYX_ERR(0, 398, __pyx_L1_error) + __pyx_tuple__108 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__108)) __PYX_ERR(0, 517, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__108); + __Pyx_GIVEREF(__pyx_tuple__108); + __pyx_codeobj__109 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__108, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_double_check, 517, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__109)) __PYX_ERR(0, 517, __pyx_L1_error) - /* "spavro/fast_binary.pyx":401 + /* "spavro/fast_binary.pyx":520 * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) * * def make_byte_check(schema): # <<<<<<<<<<<<<< * return lambda datum: isinstance(datum, str) or isinstance(datum, bytes) * */ - __pyx_tuple__136 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__136)) __PYX_ERR(0, 401, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__136); - __Pyx_GIVEREF(__pyx_tuple__136); - __pyx_codeobj__137 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__136, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_byte_check, 401, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__137)) __PYX_ERR(0, 401, __pyx_L1_error) + __pyx_tuple__110 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__110)) __PYX_ERR(0, 520, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__110); + __Pyx_GIVEREF(__pyx_tuple__110); + __pyx_codeobj__111 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__110, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_byte_check, 520, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__111)) __PYX_ERR(0, 520, __pyx_L1_error) - /* "spavro/fast_binary.pyx":404 + /* "spavro/fast_binary.pyx":523 * return lambda datum: isinstance(datum, str) or isinstance(datum, bytes) * * def make_array_check(schema): # <<<<<<<<<<<<<< * item_check = get_check(schema['items']) * def array_check(datum): */ - __pyx_tuple__138 = PyTuple_Pack(4, __pyx_n_s_schema, __pyx_n_s_item_check, __pyx_n_s_array_check, __pyx_n_s_array_check); if (unlikely(!__pyx_tuple__138)) __PYX_ERR(0, 404, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__138); - __Pyx_GIVEREF(__pyx_tuple__138); - __pyx_codeobj__139 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__138, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_array_check, 404, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__139)) __PYX_ERR(0, 404, __pyx_L1_error) + __pyx_tuple__112 = PyTuple_Pack(4, __pyx_n_s_schema, __pyx_n_s_item_check, __pyx_n_s_array_check, __pyx_n_s_array_check); if (unlikely(!__pyx_tuple__112)) __PYX_ERR(0, 523, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__112); + __Pyx_GIVEREF(__pyx_tuple__112); + __pyx_codeobj__113 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__112, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_array_check, 523, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__113)) __PYX_ERR(0, 523, __pyx_L1_error) - /* "spavro/fast_binary.pyx":410 + /* "spavro/fast_binary.pyx":529 * return array_check * * def make_union_check(union_schema): # <<<<<<<<<<<<<< * cdef list union_checks = [get_check(schema) for schema in union_schema] * def union_check(datum): */ - __pyx_tuple__140 = PyTuple_Pack(5, __pyx_n_s_union_schema, __pyx_n_s_union_checks, __pyx_n_s_union_check, __pyx_n_s_union_check, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__140)) __PYX_ERR(0, 410, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__140); - __Pyx_GIVEREF(__pyx_tuple__140); - __pyx_codeobj__141 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__140, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_union_check, 410, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__141)) __PYX_ERR(0, 410, __pyx_L1_error) + __pyx_tuple__114 = PyTuple_Pack(5, __pyx_n_s_union_schema, __pyx_n_s_union_checks, __pyx_n_s_union_check, __pyx_n_s_union_check, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__114)) __PYX_ERR(0, 529, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__114); + __Pyx_GIVEREF(__pyx_tuple__114); + __pyx_codeobj__115 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__114, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_union_check, 529, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__115)) __PYX_ERR(0, 529, __pyx_L1_error) - /* "spavro/fast_binary.pyx":416 + /* "spavro/fast_binary.pyx":535 * return union_check * * def make_fixed_check(schema): # <<<<<<<<<<<<<< * cdef int size = schema['size'] * def fixed_check(datum): */ - __pyx_tuple__142 = PyTuple_Pack(4, __pyx_n_s_schema, __pyx_n_s_size, __pyx_n_s_fixed_check, __pyx_n_s_fixed_check); if (unlikely(!__pyx_tuple__142)) __PYX_ERR(0, 416, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__142); - __Pyx_GIVEREF(__pyx_tuple__142); - __pyx_codeobj__143 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__142, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_fixed_check, 416, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__143)) __PYX_ERR(0, 416, __pyx_L1_error) + __pyx_tuple__116 = PyTuple_Pack(4, __pyx_n_s_schema, __pyx_n_s_size, __pyx_n_s_fixed_check, __pyx_n_s_fixed_check); if (unlikely(!__pyx_tuple__116)) __PYX_ERR(0, 535, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__116); + __Pyx_GIVEREF(__pyx_tuple__116); + __pyx_codeobj__117 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__116, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_fixed_check, 535, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__117)) __PYX_ERR(0, 535, __pyx_L1_error) - /* "spavro/fast_binary.pyx":422 + /* "spavro/fast_binary.pyx":541 * return fixed_check * * def make_map_check(schema): # <<<<<<<<<<<<<< * map_value_check = get_check(schema['values']) * def map_check(datum): */ - __pyx_tuple__144 = PyTuple_Pack(4, __pyx_n_s_schema, __pyx_n_s_map_value_check, __pyx_n_s_map_check, __pyx_n_s_map_check); if (unlikely(!__pyx_tuple__144)) __PYX_ERR(0, 422, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__144); - __Pyx_GIVEREF(__pyx_tuple__144); - __pyx_codeobj__145 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__144, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_map_check, 422, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__145)) __PYX_ERR(0, 422, __pyx_L1_error) + __pyx_tuple__118 = PyTuple_Pack(4, __pyx_n_s_schema, __pyx_n_s_map_value_check, __pyx_n_s_map_check, __pyx_n_s_map_check); if (unlikely(!__pyx_tuple__118)) __PYX_ERR(0, 541, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__118); + __Pyx_GIVEREF(__pyx_tuple__118); + __pyx_codeobj__119 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__118, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_map_check, 541, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__119)) __PYX_ERR(0, 541, __pyx_L1_error) - /* "spavro/fast_binary.pyx":447 + /* "spavro/fast_binary.pyx":566 * # ==================== * * def lookup_schema(schema): # <<<<<<<<<<<<<< * '''Check if a schema is a standard type, if not, lookup in the custom * schema dictionary and replace the custom name with the expanded original */ - __pyx_tuple__146 = PyTuple_Pack(2, __pyx_n_s_schema, __pyx_n_s_check_type); if (unlikely(!__pyx_tuple__146)) __PYX_ERR(0, 447, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__146); - __Pyx_GIVEREF(__pyx_tuple__146); - __pyx_codeobj__147 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__146, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_lookup_schema, 447, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__147)) __PYX_ERR(0, 447, __pyx_L1_error) + __pyx_tuple__120 = PyTuple_Pack(2, __pyx_n_s_schema, __pyx_n_s_check_type); if (unlikely(!__pyx_tuple__120)) __PYX_ERR(0, 566, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__120); + __Pyx_GIVEREF(__pyx_tuple__120); + __pyx_codeobj__121 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__120, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_lookup_schema, 566, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__121)) __PYX_ERR(0, 566, __pyx_L1_error) - /* "spavro/fast_binary.pyx":477 + /* "spavro/fast_binary.pyx":596 * * * def make_union_writer(union_schema): # <<<<<<<<<<<<<< * cdef list type_list = [get_type(lookup_schema(schema)) for schema in union_schema] * # cdef dict writer_lookup */ - __pyx_tuple__148 = PyTuple_Pack(17, __pyx_n_s_union_schema, __pyx_n_s_type_list, __pyx_n_s_writer_lookup_dict, __pyx_n_s_simple_union, __pyx_n_s_lookup_result, __pyx_n_s_idx, __pyx_n_s_simple_writer_lookup, __pyx_n_s_simple_writer_lookup, __pyx_n_s_writer_lookup, __pyx_n_s_schema, __pyx_n_s_python_type, __pyx_n_s_complex_writer_lookup, __pyx_n_s_complex_writer_lookup, __pyx_n_s_write_union, __pyx_n_s_write_union, __pyx_n_s_idx, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__148)) __PYX_ERR(0, 477, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__148); - __Pyx_GIVEREF(__pyx_tuple__148); - __pyx_codeobj__149 = (PyObject*)__Pyx_PyCode_New(1, 0, 17, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__148, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_union_writer, 477, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__149)) __PYX_ERR(0, 477, __pyx_L1_error) - - /* "spavro/fast_binary.pyx":561 - * return write_union - * - * def make_enum_writer(schema): # <<<<<<<<<<<<<< - * cdef list symbols = schema['symbols'] - * - */ - __pyx_tuple__150 = PyTuple_Pack(4, __pyx_n_s_schema, __pyx_n_s_symbols, __pyx_n_s_write_enum, __pyx_n_s_write_enum); if (unlikely(!__pyx_tuple__150)) __PYX_ERR(0, 561, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__150); - __Pyx_GIVEREF(__pyx_tuple__150); - __pyx_codeobj__151 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__150, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_enum_writer, 561, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__151)) __PYX_ERR(0, 561, __pyx_L1_error) + __pyx_tuple__122 = PyTuple_Pack(15, __pyx_n_s_union_schema, __pyx_n_s_type_list, __pyx_n_s_writer_lookup_dict, __pyx_n_s_simple_union, __pyx_n_s_lookup_result, __pyx_n_s_idx, __pyx_n_s_simple_writer_lookup, __pyx_n_s_simple_writer_lookup, __pyx_n_s_writer_lookup, __pyx_n_s_schema, __pyx_n_s_python_type, __pyx_n_s_complex_writer_lookup, __pyx_n_s_complex_writer_lookup, __pyx_n_s_idx, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__122)) __PYX_ERR(0, 596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__122); + __Pyx_GIVEREF(__pyx_tuple__122); + __pyx_codeobj__123 = (PyObject*)__Pyx_PyCode_New(1, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__122, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_union_writer, 596, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__123)) __PYX_ERR(0, 596, __pyx_L1_error) - /* "spavro/fast_binary.pyx":572 - * + /* "spavro/fast_binary.pyx":675 + * return [0, writer_lookup] * * def make_record_writer(schema): # <<<<<<<<<<<<<< * cdef list fields = [WriteField(field['name'], get_writer(field['type'])) for field in schema['fields']] - * + * return [1, fields] */ - __pyx_tuple__152 = PyTuple_Pack(5, __pyx_n_s_schema, __pyx_n_s_fields, __pyx_n_s_write_record, __pyx_n_s_write_record, __pyx_n_s_field); if (unlikely(!__pyx_tuple__152)) __PYX_ERR(0, 572, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__152); - __Pyx_GIVEREF(__pyx_tuple__152); - __pyx_codeobj__153 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__152, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_record_writer, 572, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__153)) __PYX_ERR(0, 572, __pyx_L1_error) + __pyx_tuple__124 = PyTuple_Pack(3, __pyx_n_s_schema, __pyx_n_s_fields, __pyx_n_s_field); if (unlikely(!__pyx_tuple__124)) __PYX_ERR(0, 675, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__124); + __Pyx_GIVEREF(__pyx_tuple__124); + __pyx_codeobj__125 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__124, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_record_writer, 675, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__125)) __PYX_ERR(0, 675, __pyx_L1_error) - /* "spavro/fast_binary.pyx":585 - * + /* "spavro/fast_binary.pyx":679 + * return [1, fields] * - * def make_array_writer(schema): # <<<<<<<<<<<<<< - * item_writer = get_writer(schema['items']) + * def make_null_writer(schema): # <<<<<<<<<<<<<< + * return [2] * */ - __pyx_tuple__154 = PyTuple_Pack(4, __pyx_n_s_schema, __pyx_n_s_item_writer, __pyx_n_s_write_array, __pyx_n_s_write_array); if (unlikely(!__pyx_tuple__154)) __PYX_ERR(0, 585, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__154); - __Pyx_GIVEREF(__pyx_tuple__154); - __pyx_codeobj__155 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__154, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_array_writer, 585, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__155)) __PYX_ERR(0, 585, __pyx_L1_error) + __pyx_tuple__126 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__126)) __PYX_ERR(0, 679, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__126); + __Pyx_GIVEREF(__pyx_tuple__126); + __pyx_codeobj__127 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__126, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_null_writer, 679, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__127)) __PYX_ERR(0, 679, __pyx_L1_error) - /* "spavro/fast_binary.pyx":599 - * + /* "spavro/fast_binary.pyx":682 + * return [2] * - * def make_map_writer(schema): # <<<<<<<<<<<<<< - * map_value_writer = get_writer(schema['values']) + * def make_string_writer(schema): # <<<<<<<<<<<<<< + * return [3] * */ - __pyx_tuple__156 = PyTuple_Pack(4, __pyx_n_s_schema, __pyx_n_s_map_value_writer, __pyx_n_s_write_map, __pyx_n_s_write_map); if (unlikely(!__pyx_tuple__156)) __PYX_ERR(0, 599, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__156); - __Pyx_GIVEREF(__pyx_tuple__156); - __pyx_codeobj__157 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__156, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_map_writer, 599, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__157)) __PYX_ERR(0, 599, __pyx_L1_error) + __pyx_tuple__128 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__128)) __PYX_ERR(0, 682, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__128); + __Pyx_GIVEREF(__pyx_tuple__128); + __pyx_codeobj__129 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__128, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_string_writer, 682, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__129)) __PYX_ERR(0, 682, __pyx_L1_error) - /* "spavro/fast_binary.pyx":614 - * + /* "spavro/fast_binary.pyx":685 + * return [3] * * def make_boolean_writer(schema): # <<<<<<<<<<<<<< * '''Create a boolean writer, adds a validation step before the actual * write function''' */ - __pyx_tuple__158 = PyTuple_Pack(3, __pyx_n_s_schema, __pyx_n_s_checked_boolean_writer, __pyx_n_s_checked_boolean_writer); if (unlikely(!__pyx_tuple__158)) __PYX_ERR(0, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__158); - __Pyx_GIVEREF(__pyx_tuple__158); - __pyx_codeobj__159 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__158, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_boolean_writer, 614, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__159)) __PYX_ERR(0, 614, __pyx_L1_error) + __pyx_tuple__130 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__130)) __PYX_ERR(0, 685, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__130); + __Pyx_GIVEREF(__pyx_tuple__130); + __pyx_codeobj__131 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__130, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_boolean_writer, 685, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__131)) __PYX_ERR(0, 685, __pyx_L1_error) - /* "spavro/fast_binary.pyx":624 + /* "spavro/fast_binary.pyx":690 + * return [4] * + * def make_double_writer(schema): # <<<<<<<<<<<<<< + * return [5] * - * def make_fixed_writer(schema): # <<<<<<<<<<<<<< - * '''A writer that must write X bytes defined by the schema''' - * cdef long size = schema['size'] */ - __pyx_tuple__160 = PyTuple_Pack(4, __pyx_n_s_schema, __pyx_n_s_size, __pyx_n_s_checked_write_fixed, __pyx_n_s_checked_write_fixed); if (unlikely(!__pyx_tuple__160)) __PYX_ERR(0, 624, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__160); - __Pyx_GIVEREF(__pyx_tuple__160); - __pyx_codeobj__161 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__160, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_fixed_writer, 624, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__161)) __PYX_ERR(0, 624, __pyx_L1_error) + __pyx_tuple__132 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__132)) __PYX_ERR(0, 690, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__132); + __Pyx_GIVEREF(__pyx_tuple__132); + __pyx_codeobj__133 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__132, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_double_writer, 690, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__133)) __PYX_ERR(0, 690, __pyx_L1_error) - /* "spavro/fast_binary.pyx":636 + /* "spavro/fast_binary.pyx":693 + * return [5] * + * def make_float_writer(schema): # <<<<<<<<<<<<<< + * return [6] * - * def make_int_writer(schema): # <<<<<<<<<<<<<< - * '''Create a int writer, adds a validation step before the actual - * write function to make sure the int value doesn't overflow''' */ - __pyx_tuple__162 = PyTuple_Pack(3, __pyx_n_s_schema, __pyx_n_s_checked_int_write, __pyx_n_s_checked_int_write); if (unlikely(!__pyx_tuple__162)) __PYX_ERR(0, 636, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__162); - __Pyx_GIVEREF(__pyx_tuple__162); - __pyx_codeobj__163 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__162, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_int_writer, 636, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__163)) __PYX_ERR(0, 636, __pyx_L1_error) + __pyx_tuple__134 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__134)) __PYX_ERR(0, 693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__134); + __Pyx_GIVEREF(__pyx_tuple__134); + __pyx_codeobj__135 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__134, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_float_writer, 693, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__135)) __PYX_ERR(0, 693, __pyx_L1_error) - /* "spavro/fast_binary.pyx":648 - * + /* "spavro/fast_binary.pyx":696 + * return [6] * * def make_long_writer(schema): # <<<<<<<<<<<<<< * '''Create a long writer, adds a validation step before the actual * write function to make sure the long value doesn't overflow''' */ - __pyx_tuple__164 = PyTuple_Pack(3, __pyx_n_s_schema, __pyx_n_s_checked_long_write, __pyx_n_s_checked_long_write); if (unlikely(!__pyx_tuple__164)) __PYX_ERR(0, 648, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__164); - __Pyx_GIVEREF(__pyx_tuple__164); - __pyx_codeobj__165 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__164, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_long_writer, 648, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__165)) __PYX_ERR(0, 648, __pyx_L1_error) + __pyx_tuple__136 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__136)) __PYX_ERR(0, 696, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__136); + __Pyx_GIVEREF(__pyx_tuple__136); + __pyx_codeobj__137 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__136, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_long_writer, 696, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__137)) __PYX_ERR(0, 696, __pyx_L1_error) - /* "spavro/fast_binary.pyx":659 + /* "spavro/fast_binary.pyx":701 + * return [7] * + * def make_byte_writer(schema): # <<<<<<<<<<<<<< + * return [8] * - * def make_string_writer(schema): # <<<<<<<<<<<<<< - * def checked_string_writer(outbuf, datum): - * if not isinstance(datum, six.string_types): */ - __pyx_tuple__166 = PyTuple_Pack(3, __pyx_n_s_schema, __pyx_n_s_checked_string_writer, __pyx_n_s_checked_string_writer); if (unlikely(!__pyx_tuple__166)) __PYX_ERR(0, 659, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__166); - __Pyx_GIVEREF(__pyx_tuple__166); - __pyx_codeobj__167 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__166, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_string_writer, 659, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__167)) __PYX_ERR(0, 659, __pyx_L1_error) + __pyx_tuple__138 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__138)) __PYX_ERR(0, 701, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__138); + __Pyx_GIVEREF(__pyx_tuple__138); + __pyx_codeobj__139 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__138, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_byte_writer, 701, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__139)) __PYX_ERR(0, 701, __pyx_L1_error) - /* "spavro/fast_binary.pyx":667 - * - * - * def make_byte_writer(schema): # <<<<<<<<<<<<<< - * return write_bytes + /* "spavro/fast_binary.pyx":704 + * return [8] * + * def make_int_writer(schema): # <<<<<<<<<<<<<< + * '''Create a int writer, adds a validation step before the actual + * write function to make sure the int value doesn't overflow''' */ - __pyx_tuple__168 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__168)) __PYX_ERR(0, 667, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__168); - __Pyx_GIVEREF(__pyx_tuple__168); - __pyx_codeobj__169 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__168, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_byte_writer, 667, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__169)) __PYX_ERR(0, 667, __pyx_L1_error) + __pyx_tuple__140 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__140)) __PYX_ERR(0, 704, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__140); + __Pyx_GIVEREF(__pyx_tuple__140); + __pyx_codeobj__141 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__140, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_int_writer, 704, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__141)) __PYX_ERR(0, 704, __pyx_L1_error) - /* "spavro/fast_binary.pyx":671 - * - * - * def make_float_writer(schema): # <<<<<<<<<<<<<< - * return write_float + /* "spavro/fast_binary.pyx":709 + * return [9] * + * def make_fixed_writer(schema): # <<<<<<<<<<<<<< + * '''A writer that must write X bytes defined by the schema''' + * cdef long size = schema['size'] */ - __pyx_tuple__170 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__170)) __PYX_ERR(0, 671, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__170); - __Pyx_GIVEREF(__pyx_tuple__170); - __pyx_codeobj__171 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__170, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_float_writer, 671, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__171)) __PYX_ERR(0, 671, __pyx_L1_error) + __pyx_tuple__142 = PyTuple_Pack(2, __pyx_n_s_schema, __pyx_n_s_size); if (unlikely(!__pyx_tuple__142)) __PYX_ERR(0, 709, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__142); + __Pyx_GIVEREF(__pyx_tuple__142); + __pyx_codeobj__143 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__142, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_fixed_writer, 709, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__143)) __PYX_ERR(0, 709, __pyx_L1_error) - /* "spavro/fast_binary.pyx":675 - * - * - * def make_double_writer(schema): # <<<<<<<<<<<<<< - * return write_double + /* "spavro/fast_binary.pyx":716 + * return [10, size] * + * def make_enum_writer(schema): # <<<<<<<<<<<<<< + * cdef list symbols = schema['symbols'] + * return [11, symbols] */ - __pyx_tuple__172 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__172)) __PYX_ERR(0, 675, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__172); - __Pyx_GIVEREF(__pyx_tuple__172); - __pyx_codeobj__173 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__172, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_double_writer, 675, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__173)) __PYX_ERR(0, 675, __pyx_L1_error) + __pyx_tuple__144 = PyTuple_Pack(2, __pyx_n_s_schema, __pyx_n_s_symbols); if (unlikely(!__pyx_tuple__144)) __PYX_ERR(0, 716, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__144); + __Pyx_GIVEREF(__pyx_tuple__144); + __pyx_codeobj__145 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__144, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_enum_writer, 716, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__145)) __PYX_ERR(0, 716, __pyx_L1_error) - /* "spavro/fast_binary.pyx":679 + /* "spavro/fast_binary.pyx":720 + * return [11, symbols] * + * def make_array_writer(schema): # <<<<<<<<<<<<<< + * cdef list item_writer = get_writer(schema['items']) + * return [12, item_writer] + */ + __pyx_tuple__146 = PyTuple_Pack(2, __pyx_n_s_schema, __pyx_n_s_item_writer); if (unlikely(!__pyx_tuple__146)) __PYX_ERR(0, 720, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__146); + __Pyx_GIVEREF(__pyx_tuple__146); + __pyx_codeobj__147 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__146, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_array_writer, 720, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__147)) __PYX_ERR(0, 720, __pyx_L1_error) + + /* "spavro/fast_binary.pyx":724 + * return [12, item_writer] * - * def make_null_writer(schema): # <<<<<<<<<<<<<< - * return write_null - * + * def make_map_writer(schema): # <<<<<<<<<<<<<< + * cdef list map_value_writer = get_writer(schema['values']) + * return [13, map_value_writer] */ - __pyx_tuple__174 = PyTuple_Pack(1, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__174)) __PYX_ERR(0, 679, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__174); - __Pyx_GIVEREF(__pyx_tuple__174); - __pyx_codeobj__175 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__174, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_null_writer, 679, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__175)) __PYX_ERR(0, 679, __pyx_L1_error) + __pyx_tuple__148 = PyTuple_Pack(2, __pyx_n_s_schema, __pyx_n_s_map_value_writer); if (unlikely(!__pyx_tuple__148)) __PYX_ERR(0, 724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__148); + __Pyx_GIVEREF(__pyx_tuple__148); + __pyx_codeobj__149 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__148, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_make_map_writer, 724, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__149)) __PYX_ERR(0, 724, __pyx_L1_error) - /* "spavro/fast_binary.pyx":703 + /* "spavro/fast_binary.pyx":749 * custom_schema = {} * * class WriterPlaceholder(object): # <<<<<<<<<<<<<< * def __init__(self): * self.writer = None */ - __pyx_tuple__176 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__176)) __PYX_ERR(0, 703, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__176); - __Pyx_GIVEREF(__pyx_tuple__176); + __pyx_tuple__150 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__150)) __PYX_ERR(0, 749, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__150); + __Pyx_GIVEREF(__pyx_tuple__150); - /* "spavro/fast_binary.pyx":704 + /* "spavro/fast_binary.pyx":750 * * class WriterPlaceholder(object): * def __init__(self): # <<<<<<<<<<<<<< * self.writer = None * */ - __pyx_tuple__177 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__177)) __PYX_ERR(0, 704, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__177); - __Pyx_GIVEREF(__pyx_tuple__177); - __pyx_codeobj__178 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__177, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_init, 704, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__178)) __PYX_ERR(0, 704, __pyx_L1_error) - - /* "spavro/fast_binary.pyx":707 - * self.writer = None - * - * def __call__(self, fo, val): # <<<<<<<<<<<<<< - * return self.writer(fo, val) - * - */ - __pyx_tuple__179 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_fo, __pyx_n_s_val); if (unlikely(!__pyx_tuple__179)) __PYX_ERR(0, 707, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__179); - __Pyx_GIVEREF(__pyx_tuple__179); - __pyx_codeobj__180 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__179, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_call, 707, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__180)) __PYX_ERR(0, 707, __pyx_L1_error) + __pyx_tuple__151 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__151)) __PYX_ERR(0, 750, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__151); + __Pyx_GIVEREF(__pyx_tuple__151); + __pyx_codeobj__152 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__151, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_init, 750, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__152)) __PYX_ERR(0, 750, __pyx_L1_error) - /* "spavro/fast_binary.pyx":711 + /* "spavro/fast_binary.pyx":754 * * * def get_writer(schema): # <<<<<<<<<<<<<< * cdef unicode schema_type = get_type(schema) * */ - __pyx_tuple__181 = PyTuple_Pack(7, __pyx_n_s_schema, __pyx_n_s_schema_type, __pyx_n_s_placeholder, __pyx_n_s_namespace, __pyx_n_s_name, __pyx_n_s_fullname, __pyx_n_s_writer); if (unlikely(!__pyx_tuple__181)) __PYX_ERR(0, 711, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__181); - __Pyx_GIVEREF(__pyx_tuple__181); - __pyx_codeobj__182 = (PyObject*)__Pyx_PyCode_New(1, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__181, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_get_writer, 711, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__182)) __PYX_ERR(0, 711, __pyx_L1_error) + __pyx_tuple__153 = PyTuple_Pack(7, __pyx_n_s_schema, __pyx_n_s_schema_type, __pyx_n_s_placeholder, __pyx_n_s_namespace, __pyx_n_s_name, __pyx_n_s_fullname, __pyx_n_s_writer); if (unlikely(!__pyx_tuple__153)) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__153); + __Pyx_GIVEREF(__pyx_tuple__153); + __pyx_codeobj__154 = (PyObject*)__Pyx_PyCode_New(1, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__153, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_get_writer, 754, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__154)) __PYX_ERR(0, 754, __pyx_L1_error) - /* "spavro/fast_binary.pyx":745 + /* "spavro/fast_binary.pyx":788 * * * class FastBinaryEncoder(object): # <<<<<<<<<<<<<< * """Write leaf values.""" * def __init__(self, writer): */ - __pyx_tuple__183 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__183)) __PYX_ERR(0, 745, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__183); - __Pyx_GIVEREF(__pyx_tuple__183); + __pyx_tuple__155 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__155)) __PYX_ERR(0, 788, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__155); + __Pyx_GIVEREF(__pyx_tuple__155); - /* "spavro/fast_binary.pyx":747 + /* "spavro/fast_binary.pyx":790 * class FastBinaryEncoder(object): * """Write leaf values.""" * def __init__(self, writer): # <<<<<<<<<<<<<< * """ * writer is a Python object on which we can call write. */ - __pyx_tuple__184 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_writer); if (unlikely(!__pyx_tuple__184)) __PYX_ERR(0, 747, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__184); - __Pyx_GIVEREF(__pyx_tuple__184); - __pyx_codeobj__185 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__184, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_init, 747, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__185)) __PYX_ERR(0, 747, __pyx_L1_error) + __pyx_tuple__156 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_writer); if (unlikely(!__pyx_tuple__156)) __PYX_ERR(0, 790, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__156); + __Pyx_GIVEREF(__pyx_tuple__156); + __pyx_codeobj__157 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__156, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_init, 790, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__157)) __PYX_ERR(0, 790, __pyx_L1_error) - /* "spavro/fast_binary.pyx":753 + /* "spavro/fast_binary.pyx":796 * self.writer = writer * * def write(self, datum): # <<<<<<<<<<<<<< * self.writer.write(datum) * */ - __pyx_tuple__186 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__186)) __PYX_ERR(0, 753, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__186); - __Pyx_GIVEREF(__pyx_tuple__186); - __pyx_codeobj__187 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__186, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_write, 753, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__187)) __PYX_ERR(0, 753, __pyx_L1_error) + __pyx_tuple__158 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__158)) __PYX_ERR(0, 796, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__158); + __Pyx_GIVEREF(__pyx_tuple__158); + __pyx_codeobj__159 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__158, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_write, 796, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__159)) __PYX_ERR(0, 796, __pyx_L1_error) - /* "spavro/fast_binary.pyx":756 + /* "spavro/fast_binary.pyx":799 * self.writer.write(datum) * * def write_null(self, datum): # <<<<<<<<<<<<<< * pass * */ - __pyx_tuple__188 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__188)) __PYX_ERR(0, 756, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__188); - __Pyx_GIVEREF(__pyx_tuple__188); - __pyx_codeobj__189 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__188, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_write_null, 756, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__189)) __PYX_ERR(0, 756, __pyx_L1_error) + __pyx_tuple__160 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__160)) __PYX_ERR(0, 799, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__160); + __Pyx_GIVEREF(__pyx_tuple__160); + __pyx_codeobj__161 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__160, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_write_null, 799, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__161)) __PYX_ERR(0, 799, __pyx_L1_error) - /* "spavro/fast_binary.pyx":759 + /* "spavro/fast_binary.pyx":802 * pass * * def write_boolean(self, datum): # <<<<<<<<<<<<<< * write_boolean(self.writer, datum) * */ - __pyx_tuple__190 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__190)) __PYX_ERR(0, 759, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__190); - __Pyx_GIVEREF(__pyx_tuple__190); - __pyx_codeobj__191 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__190, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_write_boolean, 759, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__191)) __PYX_ERR(0, 759, __pyx_L1_error) + __pyx_tuple__162 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__162)) __PYX_ERR(0, 802, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__162); + __Pyx_GIVEREF(__pyx_tuple__162); + __pyx_codeobj__163 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__162, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_write_boolean, 802, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__163)) __PYX_ERR(0, 802, __pyx_L1_error) - /* "spavro/fast_binary.pyx":762 + /* "spavro/fast_binary.pyx":805 * write_boolean(self.writer, datum) * * def write_int(self, datum): # <<<<<<<<<<<<<< * write_int(self.writer, datum) * */ - __pyx_tuple__192 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__192)) __PYX_ERR(0, 762, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__192); - __Pyx_GIVEREF(__pyx_tuple__192); - __pyx_codeobj__193 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__192, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_write_int, 762, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__193)) __PYX_ERR(0, 762, __pyx_L1_error) + __pyx_tuple__164 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__164)) __PYX_ERR(0, 805, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__164); + __Pyx_GIVEREF(__pyx_tuple__164); + __pyx_codeobj__165 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__164, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_write_int, 805, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__165)) __PYX_ERR(0, 805, __pyx_L1_error) - /* "spavro/fast_binary.pyx":765 + /* "spavro/fast_binary.pyx":808 * write_int(self.writer, datum) * * def write_long(self, datum): # <<<<<<<<<<<<<< * write_long(self.writer, datum) * */ - __pyx_tuple__194 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__194)) __PYX_ERR(0, 765, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__194); - __Pyx_GIVEREF(__pyx_tuple__194); - __pyx_codeobj__195 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__194, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_write_long, 765, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__195)) __PYX_ERR(0, 765, __pyx_L1_error) + __pyx_tuple__166 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__166)) __PYX_ERR(0, 808, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__166); + __Pyx_GIVEREF(__pyx_tuple__166); + __pyx_codeobj__167 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__166, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_write_long, 808, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__167)) __PYX_ERR(0, 808, __pyx_L1_error) - /* "spavro/fast_binary.pyx":768 + /* "spavro/fast_binary.pyx":811 * write_long(self.writer, datum) * * def write_float(self, datum): # <<<<<<<<<<<<<< * write_float(self.writer, datum) * */ - __pyx_tuple__196 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__196)) __PYX_ERR(0, 768, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__196); - __Pyx_GIVEREF(__pyx_tuple__196); - __pyx_codeobj__197 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__196, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_write_float, 768, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__197)) __PYX_ERR(0, 768, __pyx_L1_error) + __pyx_tuple__168 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__168)) __PYX_ERR(0, 811, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__168); + __Pyx_GIVEREF(__pyx_tuple__168); + __pyx_codeobj__169 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__168, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_write_float, 811, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__169)) __PYX_ERR(0, 811, __pyx_L1_error) - /* "spavro/fast_binary.pyx":771 + /* "spavro/fast_binary.pyx":814 * write_float(self.writer, datum) * * def write_double(self, datum): # <<<<<<<<<<<<<< * write_double(self.writer, datum) * */ - __pyx_tuple__198 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__198)) __PYX_ERR(0, 771, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__198); - __Pyx_GIVEREF(__pyx_tuple__198); - __pyx_codeobj__199 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__198, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_write_double, 771, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__199)) __PYX_ERR(0, 771, __pyx_L1_error) + __pyx_tuple__170 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__170)) __PYX_ERR(0, 814, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__170); + __Pyx_GIVEREF(__pyx_tuple__170); + __pyx_codeobj__171 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__170, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_write_double, 814, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__171)) __PYX_ERR(0, 814, __pyx_L1_error) - /* "spavro/fast_binary.pyx":774 + /* "spavro/fast_binary.pyx":817 * write_double(self.writer, datum) * * def write_bytes(self, datum): # <<<<<<<<<<<<<< * write_bytes(self.writer, datum) * */ - __pyx_tuple__200 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__200)) __PYX_ERR(0, 774, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__200); - __Pyx_GIVEREF(__pyx_tuple__200); - __pyx_codeobj__201 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__200, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_write_bytes, 774, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__201)) __PYX_ERR(0, 774, __pyx_L1_error) + __pyx_tuple__172 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__172)) __PYX_ERR(0, 817, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__172); + __Pyx_GIVEREF(__pyx_tuple__172); + __pyx_codeobj__173 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__172, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_write_bytes, 817, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__173)) __PYX_ERR(0, 817, __pyx_L1_error) - /* "spavro/fast_binary.pyx":777 + /* "spavro/fast_binary.pyx":820 * write_bytes(self.writer, datum) * * def write_utf8(self, datum): # <<<<<<<<<<<<<< * write_utf8(self.writer, datum) * */ - __pyx_tuple__202 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__202)) __PYX_ERR(0, 777, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__202); - __Pyx_GIVEREF(__pyx_tuple__202); - __pyx_codeobj__203 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__202, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_write_utf8, 777, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__203)) __PYX_ERR(0, 777, __pyx_L1_error) + __pyx_tuple__174 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_datum); if (unlikely(!__pyx_tuple__174)) __PYX_ERR(0, 820, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__174); + __Pyx_GIVEREF(__pyx_tuple__174); + __pyx_codeobj__175 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__174, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_write_utf8, 820, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__175)) __PYX_ERR(0, 820, __pyx_L1_error) - /* "spavro/fast_binary.pyx":780 + /* "spavro/fast_binary.pyx":823 * write_utf8(self.writer, datum) * * def write_crc32(self, bytes): # <<<<<<<<<<<<<< * """ * A 4-byte, big-endian CRC32 checksum */ - __pyx_tuple__204 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_bytes); if (unlikely(!__pyx_tuple__204)) __PYX_ERR(0, 780, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__204); - __Pyx_GIVEREF(__pyx_tuple__204); - __pyx_codeobj__205 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__204, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_write_crc32, 780, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__205)) __PYX_ERR(0, 780, __pyx_L1_error) + __pyx_tuple__176 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_bytes); if (unlikely(!__pyx_tuple__176)) __PYX_ERR(0, 823, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__176); + __Pyx_GIVEREF(__pyx_tuple__176); + __pyx_codeobj__177 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__176, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_write_crc32, 823, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__177)) __PYX_ERR(0, 823, __pyx_L1_error) - /* "spavro/fast_binary.pyx":788 + /* "spavro/fast_binary.pyx":831 * * * class FastBinaryDecoder(object): # <<<<<<<<<<<<<< * """Read leaf values.""" * def __init__(self, reader): */ - __pyx_tuple__206 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__206)) __PYX_ERR(0, 788, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__206); - __Pyx_GIVEREF(__pyx_tuple__206); + __pyx_tuple__178 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__178)) __PYX_ERR(0, 831, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__178); + __Pyx_GIVEREF(__pyx_tuple__178); - /* "spavro/fast_binary.pyx":790 + /* "spavro/fast_binary.pyx":833 * class FastBinaryDecoder(object): * """Read leaf values.""" * def __init__(self, reader): # <<<<<<<<<<<<<< * """ * reader is a Python object on which we can call read, seek, and tell. */ - __pyx_tuple__207 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_reader); if (unlikely(!__pyx_tuple__207)) __PYX_ERR(0, 790, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__207); - __Pyx_GIVEREF(__pyx_tuple__207); - __pyx_codeobj__208 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__207, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_init, 790, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__208)) __PYX_ERR(0, 790, __pyx_L1_error) + __pyx_tuple__179 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_reader); if (unlikely(!__pyx_tuple__179)) __PYX_ERR(0, 833, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__179); + __Pyx_GIVEREF(__pyx_tuple__179); + __pyx_codeobj__180 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__179, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_init, 833, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__180)) __PYX_ERR(0, 833, __pyx_L1_error) - /* "spavro/fast_binary.pyx":796 + /* "spavro/fast_binary.pyx":839 * self.reader = reader * * def read(self, n): # <<<<<<<<<<<<<< * return self.reader.read(n) * */ - __pyx_tuple__209 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_n); if (unlikely(!__pyx_tuple__209)) __PYX_ERR(0, 796, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__209); - __Pyx_GIVEREF(__pyx_tuple__209); - __pyx_codeobj__210 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__209, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_read, 796, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__210)) __PYX_ERR(0, 796, __pyx_L1_error) + __pyx_tuple__181 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_n); if (unlikely(!__pyx_tuple__181)) __PYX_ERR(0, 839, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__181); + __Pyx_GIVEREF(__pyx_tuple__181); + __pyx_codeobj__182 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__181, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_read, 839, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__182)) __PYX_ERR(0, 839, __pyx_L1_error) - /* "spavro/fast_binary.pyx":799 + /* "spavro/fast_binary.pyx":842 * return self.reader.read(n) * * def read_null(self): # <<<<<<<<<<<<<< * return None * */ - __pyx_tuple__211 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__211)) __PYX_ERR(0, 799, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__211); - __Pyx_GIVEREF(__pyx_tuple__211); - __pyx_codeobj__212 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__211, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_read_null, 799, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__212)) __PYX_ERR(0, 799, __pyx_L1_error) + __pyx_tuple__183 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__183)) __PYX_ERR(0, 842, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__183); + __Pyx_GIVEREF(__pyx_tuple__183); + __pyx_codeobj__184 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__183, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_read_null, 842, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__184)) __PYX_ERR(0, 842, __pyx_L1_error) - /* "spavro/fast_binary.pyx":802 + /* "spavro/fast_binary.pyx":845 * return None * * def read_boolean(self): # <<<<<<<<<<<<<< * return read_boolean(self.reader) * */ - __pyx_tuple__213 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__213)) __PYX_ERR(0, 802, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__213); - __Pyx_GIVEREF(__pyx_tuple__213); - __pyx_codeobj__214 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__213, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_read_boolean, 802, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__214)) __PYX_ERR(0, 802, __pyx_L1_error) + __pyx_tuple__185 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__185)) __PYX_ERR(0, 845, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__185); + __Pyx_GIVEREF(__pyx_tuple__185); + __pyx_codeobj__186 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__185, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_read_boolean, 845, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__186)) __PYX_ERR(0, 845, __pyx_L1_error) - /* "spavro/fast_binary.pyx":805 + /* "spavro/fast_binary.pyx":848 * return read_boolean(self.reader) * * def read_int(self): # <<<<<<<<<<<<<< * return read_long(self.reader) * */ - __pyx_tuple__215 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__215)) __PYX_ERR(0, 805, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__215); - __Pyx_GIVEREF(__pyx_tuple__215); - __pyx_codeobj__216 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__215, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_read_int, 805, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__216)) __PYX_ERR(0, 805, __pyx_L1_error) + __pyx_tuple__187 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__187)) __PYX_ERR(0, 848, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__187); + __Pyx_GIVEREF(__pyx_tuple__187); + __pyx_codeobj__188 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__187, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_read_int, 848, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__188)) __PYX_ERR(0, 848, __pyx_L1_error) - /* "spavro/fast_binary.pyx":808 + /* "spavro/fast_binary.pyx":851 * return read_long(self.reader) * * def read_long(self): # <<<<<<<<<<<<<< * return read_long(self.reader) * */ - __pyx_tuple__217 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__217)) __PYX_ERR(0, 808, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__217); - __Pyx_GIVEREF(__pyx_tuple__217); - __pyx_codeobj__218 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__217, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_read_long, 808, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__218)) __PYX_ERR(0, 808, __pyx_L1_error) + __pyx_tuple__189 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__189)) __PYX_ERR(0, 851, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__189); + __Pyx_GIVEREF(__pyx_tuple__189); + __pyx_codeobj__190 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__189, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_read_long, 851, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__190)) __PYX_ERR(0, 851, __pyx_L1_error) - /* "spavro/fast_binary.pyx":811 + /* "spavro/fast_binary.pyx":854 * return read_long(self.reader) * * def read_float(self): # <<<<<<<<<<<<<< * return read_float(self.reader) * */ - __pyx_tuple__219 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__219)) __PYX_ERR(0, 811, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__219); - __Pyx_GIVEREF(__pyx_tuple__219); - __pyx_codeobj__220 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__219, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_read_float, 811, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__220)) __PYX_ERR(0, 811, __pyx_L1_error) + __pyx_tuple__191 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__191)) __PYX_ERR(0, 854, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__191); + __Pyx_GIVEREF(__pyx_tuple__191); + __pyx_codeobj__192 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__191, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_read_float, 854, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__192)) __PYX_ERR(0, 854, __pyx_L1_error) - /* "spavro/fast_binary.pyx":814 + /* "spavro/fast_binary.pyx":857 * return read_float(self.reader) * * def read_double(self): # <<<<<<<<<<<<<< * return read_double(self.reader) * */ - __pyx_tuple__221 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__221)) __PYX_ERR(0, 814, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__221); - __Pyx_GIVEREF(__pyx_tuple__221); - __pyx_codeobj__222 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__221, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_read_double, 814, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__222)) __PYX_ERR(0, 814, __pyx_L1_error) + __pyx_tuple__193 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__193)) __PYX_ERR(0, 857, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__193); + __Pyx_GIVEREF(__pyx_tuple__193); + __pyx_codeobj__194 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__193, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_read_double, 857, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__194)) __PYX_ERR(0, 857, __pyx_L1_error) - /* "spavro/fast_binary.pyx":817 + /* "spavro/fast_binary.pyx":860 * return read_double(self.reader) * * def read_bytes(self): # <<<<<<<<<<<<<< * return read_bytes(self.reader) * */ - __pyx_tuple__223 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__223)) __PYX_ERR(0, 817, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__223); - __Pyx_GIVEREF(__pyx_tuple__223); - __pyx_codeobj__224 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__223, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_read_bytes, 817, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__224)) __PYX_ERR(0, 817, __pyx_L1_error) + __pyx_tuple__195 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__195)) __PYX_ERR(0, 860, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__195); + __Pyx_GIVEREF(__pyx_tuple__195); + __pyx_codeobj__196 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__195, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_read_bytes, 860, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__196)) __PYX_ERR(0, 860, __pyx_L1_error) - /* "spavro/fast_binary.pyx":820 + /* "spavro/fast_binary.pyx":863 * return read_bytes(self.reader) * * def read_utf8(self): # <<<<<<<<<<<<<< * return read_utf8(self.reader) * */ - __pyx_tuple__225 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__225)) __PYX_ERR(0, 820, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__225); - __Pyx_GIVEREF(__pyx_tuple__225); - __pyx_codeobj__226 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__225, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_read_utf8, 820, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__226)) __PYX_ERR(0, 820, __pyx_L1_error) + __pyx_tuple__197 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__197)) __PYX_ERR(0, 863, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__197); + __Pyx_GIVEREF(__pyx_tuple__197); + __pyx_codeobj__198 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__197, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_read_utf8, 863, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__198)) __PYX_ERR(0, 863, __pyx_L1_error) - /* "spavro/fast_binary.pyx":823 + /* "spavro/fast_binary.pyx":866 * return read_utf8(self.reader) * * def check_crc32(self, bytes): # <<<<<<<<<<<<<< * checksum = struct.unpack("!I", self.reader.read(4))[0] * if crc32(bytes) & 0xffffffff != checksum: */ - __pyx_tuple__227 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_bytes, __pyx_n_s_checksum); if (unlikely(!__pyx_tuple__227)) __PYX_ERR(0, 823, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__227); - __Pyx_GIVEREF(__pyx_tuple__227); - __pyx_codeobj__228 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__227, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_check_crc32, 823, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__228)) __PYX_ERR(0, 823, __pyx_L1_error) + __pyx_tuple__199 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_bytes, __pyx_n_s_checksum); if (unlikely(!__pyx_tuple__199)) __PYX_ERR(0, 866, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__199); + __Pyx_GIVEREF(__pyx_tuple__199); + __pyx_codeobj__200 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__199, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_check_crc32, 866, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__200)) __PYX_ERR(0, 866, __pyx_L1_error) - /* "spavro/fast_binary.pyx":828 + /* "spavro/fast_binary.pyx":871 * raise RuntimeError("Checksum failure") * * def skip_null(self): # <<<<<<<<<<<<<< * pass * */ - __pyx_tuple__229 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__229)) __PYX_ERR(0, 828, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__229); - __Pyx_GIVEREF(__pyx_tuple__229); - __pyx_codeobj__230 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__229, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_skip_null, 828, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__230)) __PYX_ERR(0, 828, __pyx_L1_error) + __pyx_tuple__201 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__201)) __PYX_ERR(0, 871, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__201); + __Pyx_GIVEREF(__pyx_tuple__201); + __pyx_codeobj__202 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__201, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_skip_null, 871, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__202)) __PYX_ERR(0, 871, __pyx_L1_error) - /* "spavro/fast_binary.pyx":831 + /* "spavro/fast_binary.pyx":874 * pass * * def skip_boolean(self): # <<<<<<<<<<<<<< * self.reader.read(1) * */ - __pyx_tuple__231 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__231)) __PYX_ERR(0, 831, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__231); - __Pyx_GIVEREF(__pyx_tuple__231); - __pyx_codeobj__232 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__231, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_skip_boolean, 831, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__232)) __PYX_ERR(0, 831, __pyx_L1_error) + __pyx_tuple__203 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__203)) __PYX_ERR(0, 874, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__203); + __Pyx_GIVEREF(__pyx_tuple__203); + __pyx_codeobj__204 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__203, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_skip_boolean, 874, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__204)) __PYX_ERR(0, 874, __pyx_L1_error) - /* "spavro/fast_binary.pyx":834 + /* "spavro/fast_binary.pyx":877 * self.reader.read(1) * * def skip_int(self): # <<<<<<<<<<<<<< * read_long(self.reader) * */ - __pyx_tuple__233 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__233)) __PYX_ERR(0, 834, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__233); - __Pyx_GIVEREF(__pyx_tuple__233); - __pyx_codeobj__234 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__233, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_skip_int, 834, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__234)) __PYX_ERR(0, 834, __pyx_L1_error) + __pyx_tuple__205 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__205)) __PYX_ERR(0, 877, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__205); + __Pyx_GIVEREF(__pyx_tuple__205); + __pyx_codeobj__206 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__205, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_skip_int, 877, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__206)) __PYX_ERR(0, 877, __pyx_L1_error) - /* "spavro/fast_binary.pyx":837 + /* "spavro/fast_binary.pyx":880 * read_long(self.reader) * * def skip_long(self): # <<<<<<<<<<<<<< * read_long(self.reader) * */ - __pyx_tuple__235 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__235)) __PYX_ERR(0, 837, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__235); - __Pyx_GIVEREF(__pyx_tuple__235); - __pyx_codeobj__236 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__235, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_skip_long, 837, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__236)) __PYX_ERR(0, 837, __pyx_L1_error) + __pyx_tuple__207 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__207)) __PYX_ERR(0, 880, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__207); + __Pyx_GIVEREF(__pyx_tuple__207); + __pyx_codeobj__208 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__207, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_skip_long, 880, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__208)) __PYX_ERR(0, 880, __pyx_L1_error) - /* "spavro/fast_binary.pyx":840 + /* "spavro/fast_binary.pyx":883 * read_long(self.reader) * * def skip_float(self): # <<<<<<<<<<<<<< * read_float(self.reader) * */ - __pyx_tuple__237 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__237)) __PYX_ERR(0, 840, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__237); - __Pyx_GIVEREF(__pyx_tuple__237); - __pyx_codeobj__238 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__237, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_skip_float, 840, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__238)) __PYX_ERR(0, 840, __pyx_L1_error) + __pyx_tuple__209 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__209)) __PYX_ERR(0, 883, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__209); + __Pyx_GIVEREF(__pyx_tuple__209); + __pyx_codeobj__210 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__209, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_skip_float, 883, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__210)) __PYX_ERR(0, 883, __pyx_L1_error) - /* "spavro/fast_binary.pyx":843 + /* "spavro/fast_binary.pyx":886 * read_float(self.reader) * * def skip_double(self): # <<<<<<<<<<<<<< * read_double(self.reader) * */ - __pyx_tuple__239 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__239)) __PYX_ERR(0, 843, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__239); - __Pyx_GIVEREF(__pyx_tuple__239); - __pyx_codeobj__240 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__239, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_skip_double, 843, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__240)) __PYX_ERR(0, 843, __pyx_L1_error) + __pyx_tuple__211 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__211)) __PYX_ERR(0, 886, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__211); + __Pyx_GIVEREF(__pyx_tuple__211); + __pyx_codeobj__212 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__211, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_skip_double, 886, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__212)) __PYX_ERR(0, 886, __pyx_L1_error) - /* "spavro/fast_binary.pyx":846 + /* "spavro/fast_binary.pyx":889 * read_double(self.reader) * * def skip_bytes(self): # <<<<<<<<<<<<<< * read_bytes(self.reader) * */ - __pyx_tuple__241 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__241)) __PYX_ERR(0, 846, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__241); - __Pyx_GIVEREF(__pyx_tuple__241); - __pyx_codeobj__242 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__241, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_skip_bytes, 846, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__242)) __PYX_ERR(0, 846, __pyx_L1_error) + __pyx_tuple__213 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__213)) __PYX_ERR(0, 889, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__213); + __Pyx_GIVEREF(__pyx_tuple__213); + __pyx_codeobj__214 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__213, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_skip_bytes, 889, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__214)) __PYX_ERR(0, 889, __pyx_L1_error) - /* "spavro/fast_binary.pyx":849 + /* "spavro/fast_binary.pyx":892 * read_bytes(self.reader) * * def skip_utf8(self): # <<<<<<<<<<<<<< * read_utf8(self.reader) * */ - __pyx_tuple__243 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__243)) __PYX_ERR(0, 849, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__243); - __Pyx_GIVEREF(__pyx_tuple__243); - __pyx_codeobj__244 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__243, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_skip_utf8, 849, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__244)) __PYX_ERR(0, 849, __pyx_L1_error) + __pyx_tuple__215 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__215)) __PYX_ERR(0, 892, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__215); + __Pyx_GIVEREF(__pyx_tuple__215); + __pyx_codeobj__216 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__215, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_skip_utf8, 892, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__216)) __PYX_ERR(0, 892, __pyx_L1_error) - /* "spavro/fast_binary.pyx":852 + /* "spavro/fast_binary.pyx":895 * read_utf8(self.reader) * * def skip(self, n): # <<<<<<<<<<<<<< * self.reader.seek(self.reader.tell() + n) + * */ - __pyx_tuple__245 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_n); if (unlikely(!__pyx_tuple__245)) __PYX_ERR(0, 852, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__245); - __Pyx_GIVEREF(__pyx_tuple__245); - __pyx_codeobj__246 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__245, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_skip, 852, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__246)) __PYX_ERR(0, 852, __pyx_L1_error) + __pyx_tuple__217 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_n); if (unlikely(!__pyx_tuple__217)) __PYX_ERR(0, 895, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__217); + __Pyx_GIVEREF(__pyx_tuple__217); + __pyx_codeobj__218 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__217, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_skip, 895, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__218)) __PYX_ERR(0, 895, __pyx_L1_error) + + /* "spavro/fast_binary.pyx":969 + * + * + * def write(iobuffer, datum, writer, schema): # <<<<<<<<<<<<<< + * cdef array.array outbuf = array.array('B', []) + * execute(outbuf, datum, writer) + */ + __pyx_tuple__219 = PyTuple_Pack(5, __pyx_n_s_iobuffer, __pyx_n_s_datum, __pyx_n_s_writer, __pyx_n_s_schema, __pyx_n_s_outbuf); if (unlikely(!__pyx_tuple__219)) __PYX_ERR(0, 969, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__219); + __Pyx_GIVEREF(__pyx_tuple__219); + __pyx_codeobj__220 = (PyObject*)__Pyx_PyCode_New(4, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__219, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_spavro_fast_binary_pyx, __pyx_n_s_write, 969, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__220)) __PYX_ERR(0, 969, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -28974,13 +27293,24 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { } static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { + __pyx_umethod_PyDict_Type_get.type = (PyObject*)&PyDict_Type; __pyx_umethod_PyList_Type_count.type = (PyObject*)&PyList_Type; __pyx_umethod_PyList_Type_index.type = (PyObject*)&PyList_Type; - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __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_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_7 = PyInt_FromLong(7); if (unlikely(!__pyx_int_7)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_9 = PyInt_FromLong(9); if (unlikely(!__pyx_int_9)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_11 = PyInt_FromLong(11); if (unlikely(!__pyx_int_11)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_12 = PyInt_FromLong(12); if (unlikely(!__pyx_int_12)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_13 = PyInt_FromLong(13); if (unlikely(!__pyx_int_13)) __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_4294967295 = PyInt_FromString((char *)"4294967295", 0, 0); if (unlikely(!__pyx_int_4294967295)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_9223372036854775807 = PyInt_FromString((char *)"9223372036854775807", 0, 0); if (unlikely(!__pyx_int_9223372036854775807)) __PYX_ERR(0, 1, __pyx_L1_error) @@ -29025,224 +27355,203 @@ static int __Pyx_modinit_function_export_code(void) { static int __Pyx_modinit_type_init_code(void) { __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); /*--- Type init code ---*/ - if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct__make_union_reader) < 0) __PYX_ERR(0, 103, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct__make_union_reader) < 0) __PYX_ERR(0, 106, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6spavro_11fast_binary___pyx_scope_struct__make_union_reader.tp_print = 0; + #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6spavro_11fast_binary___pyx_scope_struct__make_union_reader.tp_dictoffset && __pyx_type_6spavro_11fast_binary___pyx_scope_struct__make_union_reader.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6spavro_11fast_binary___pyx_scope_struct__make_union_reader.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_6spavro_11fast_binary___pyx_scope_struct__make_union_reader = &__pyx_type_6spavro_11fast_binary___pyx_scope_struct__make_union_reader; - if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader) < 0) __PYX_ERR(0, 117, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader) < 0) __PYX_ERR(0, 120, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader.tp_print = 0; + #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader.tp_dictoffset && __pyx_type_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader = &__pyx_type_6spavro_11fast_binary___pyx_scope_struct_1_make_record_reader; - if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader) < 0) __PYX_ERR(0, 126, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader) < 0) __PYX_ERR(0, 129, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader.tp_print = 0; + #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader.tp_dictoffset && __pyx_type_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader = &__pyx_type_6spavro_11fast_binary___pyx_scope_struct_2_make_enum_reader; - if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader) < 0) __PYX_ERR(0, 134, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader) < 0) __PYX_ERR(0, 137, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader.tp_print = 0; + #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader.tp_dictoffset && __pyx_type_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader = &__pyx_type_6spavro_11fast_binary___pyx_scope_struct_3_make_array_reader; - if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader) < 0) __PYX_ERR(0, 151, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader) < 0) __PYX_ERR(0, 154, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader.tp_print = 0; + #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader.tp_dictoffset && __pyx_type_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader = &__pyx_type_6spavro_11fast_binary___pyx_scope_struct_4_make_map_reader; - if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader) < 0) __PYX_ERR(0, 169, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader) < 0) __PYX_ERR(0, 172, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader.tp_print = 0; + #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader.tp_dictoffset && __pyx_type_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader = &__pyx_type_6spavro_11fast_binary___pyx_scope_struct_5_make_fixed_reader; - if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader) < 0) __PYX_ERR(0, 199, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader) < 0) __PYX_ERR(0, 202, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader.tp_print = 0; + #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader.tp_dictoffset && __pyx_type_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader = &__pyx_type_6spavro_11fast_binary___pyx_scope_struct_6_make_skip_reader; - if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader) < 0) __PYX_ERR(0, 210, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader) < 0) __PYX_ERR(0, 213, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader.tp_print = 0; + #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader.tp_dictoffset && __pyx_type_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader = &__pyx_type_6spavro_11fast_binary___pyx_scope_struct_7_make_default_reader; - if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check) < 0) __PYX_ERR(0, 366, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check) < 0) __PYX_ERR(0, 485, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check.tp_print = 0; + #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check.tp_dictoffset && __pyx_type_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check = &__pyx_type_6spavro_11fast_binary___pyx_scope_struct_8_make_record_check; - if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check) < 0) __PYX_ERR(0, 373, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check) < 0) __PYX_ERR(0, 492, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check.tp_print = 0; + #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check.tp_dictoffset && __pyx_type_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check = &__pyx_type_6spavro_11fast_binary___pyx_scope_struct_9_make_enum_check; - if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check) < 0) __PYX_ERR(0, 404, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check) < 0) __PYX_ERR(0, 523, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check.tp_print = 0; + #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check.tp_dictoffset && __pyx_type_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check = &__pyx_type_6spavro_11fast_binary___pyx_scope_struct_10_make_array_check; - if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check) < 0) __PYX_ERR(0, 410, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check) < 0) __PYX_ERR(0, 529, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check.tp_print = 0; + #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check.tp_dictoffset && __pyx_type_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check = &__pyx_type_6spavro_11fast_binary___pyx_scope_struct_11_make_union_check; - if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check) < 0) __PYX_ERR(0, 416, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check) < 0) __PYX_ERR(0, 535, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check.tp_print = 0; + #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check.tp_dictoffset && __pyx_type_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check = &__pyx_type_6spavro_11fast_binary___pyx_scope_struct_12_make_fixed_check; - if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check) < 0) __PYX_ERR(0, 422, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check) < 0) __PYX_ERR(0, 541, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check.tp_print = 0; + #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check.tp_dictoffset && __pyx_type_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check = &__pyx_type_6spavro_11fast_binary___pyx_scope_struct_13_make_map_check; - if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union) < 0) __PYX_ERR(0, 457, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union) < 0) __PYX_ERR(0, 576, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union.tp_print = 0; + #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union.tp_dictoffset && __pyx_type_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union = &__pyx_type_6spavro_11fast_binary___pyx_scope_struct_14___pyx_f_6spavro_11fast_binary_create_promotions_for_union; - if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer) < 0) __PYX_ERR(0, 477, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer) < 0) __PYX_ERR(0, 596, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer.tp_print = 0; + #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer.tp_dictoffset && __pyx_type_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer = &__pyx_type_6spavro_11fast_binary___pyx_scope_struct_15_make_union_writer; - if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer) < 0) __PYX_ERR(0, 561, __pyx_L1_error) - __pyx_type_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer.tp_print = 0; - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer.tp_dictoffset && __pyx_type_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; - } - __pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer = &__pyx_type_6spavro_11fast_binary___pyx_scope_struct_16_make_enum_writer; - if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer) < 0) __PYX_ERR(0, 572, __pyx_L1_error) - __pyx_type_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer.tp_print = 0; - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer.tp_dictoffset && __pyx_type_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; - } - __pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer = &__pyx_type_6spavro_11fast_binary___pyx_scope_struct_17_make_record_writer; - if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer) < 0) __PYX_ERR(0, 585, __pyx_L1_error) - __pyx_type_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer.tp_print = 0; - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer.tp_dictoffset && __pyx_type_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; - } - __pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer = &__pyx_type_6spavro_11fast_binary___pyx_scope_struct_18_make_array_writer; - if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer) < 0) __PYX_ERR(0, 599, __pyx_L1_error) - __pyx_type_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer.tp_print = 0; - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer.tp_dictoffset && __pyx_type_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; - } - __pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer = &__pyx_type_6spavro_11fast_binary___pyx_scope_struct_19_make_map_writer; - if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer) < 0) __PYX_ERR(0, 614, __pyx_L1_error) - __pyx_type_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer.tp_print = 0; - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer.tp_dictoffset && __pyx_type_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; - } - __pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer = &__pyx_type_6spavro_11fast_binary___pyx_scope_struct_20_make_boolean_writer; - if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer) < 0) __PYX_ERR(0, 624, __pyx_L1_error) - __pyx_type_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer.tp_print = 0; - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer.tp_dictoffset && __pyx_type_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; - } - __pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer = &__pyx_type_6spavro_11fast_binary___pyx_scope_struct_21_make_fixed_writer; - if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer) < 0) __PYX_ERR(0, 636, __pyx_L1_error) - __pyx_type_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer.tp_print = 0; - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer.tp_dictoffset && __pyx_type_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; - } - __pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer = &__pyx_type_6spavro_11fast_binary___pyx_scope_struct_22_make_int_writer; - if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer) < 0) __PYX_ERR(0, 648, __pyx_L1_error) - __pyx_type_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer.tp_print = 0; - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer.tp_dictoffset && __pyx_type_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; - } - __pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer = &__pyx_type_6spavro_11fast_binary___pyx_scope_struct_23_make_long_writer; - if (PyType_Ready(&__pyx_type_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer) < 0) __PYX_ERR(0, 659, __pyx_L1_error) - __pyx_type_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer.tp_print = 0; - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer.tp_dictoffset && __pyx_type_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; - } - __pyx_ptype_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer = &__pyx_type_6spavro_11fast_binary___pyx_scope_struct_24_make_string_writer; - if (PyType_Ready(&__pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py) < 0) __PYX_ERR(1, 64, __pyx_L1_error) + if (PyType_Ready(&__pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py) < 0) __PYX_ERR(2, 64, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 __pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py.tp_print = 0; + #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py.tp_dictoffset && __pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py.tp_getattro == PyObject_GenericGetAttr)) { __pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype___pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py = &__pyx_scope_struct____Pyx_CFunc_void____object____long__long___to_py; - if (PyType_Ready(&__pyx_scope_struct____Pyx_CFunc_object____object___to_py) < 0) __PYX_ERR(1, 64, __pyx_L1_error) + if (PyType_Ready(&__pyx_scope_struct____Pyx_CFunc_object____object___to_py) < 0) __PYX_ERR(2, 64, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 __pyx_scope_struct____Pyx_CFunc_object____object___to_py.tp_print = 0; + #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_scope_struct____Pyx_CFunc_object____object___to_py.tp_dictoffset && __pyx_scope_struct____Pyx_CFunc_object____object___to_py.tp_getattro == PyObject_GenericGetAttr)) { __pyx_scope_struct____Pyx_CFunc_object____object___to_py.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype___pyx_scope_struct____Pyx_CFunc_object____object___to_py = &__pyx_scope_struct____Pyx_CFunc_object____object___to_py; - if (PyType_Ready(&__pyx_scope_struct____Pyx_CFunc_unicode____object___to_py) < 0) __PYX_ERR(1, 64, __pyx_L1_error) + if (PyType_Ready(&__pyx_scope_struct____Pyx_CFunc_unicode____object___to_py) < 0) __PYX_ERR(2, 64, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 __pyx_scope_struct____Pyx_CFunc_unicode____object___to_py.tp_print = 0; + #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_scope_struct____Pyx_CFunc_unicode____object___to_py.tp_dictoffset && __pyx_scope_struct____Pyx_CFunc_unicode____object___to_py.tp_getattro == PyObject_GenericGetAttr)) { __pyx_scope_struct____Pyx_CFunc_unicode____object___to_py.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype___pyx_scope_struct____Pyx_CFunc_unicode____object___to_py = &__pyx_scope_struct____Pyx_CFunc_unicode____object___to_py; - if (PyType_Ready(&__pyx_scope_struct____Pyx_CFunc_bint____object___to_py) < 0) __PYX_ERR(1, 64, __pyx_L1_error) + if (PyType_Ready(&__pyx_scope_struct____Pyx_CFunc_bint____object___to_py) < 0) __PYX_ERR(2, 64, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 __pyx_scope_struct____Pyx_CFunc_bint____object___to_py.tp_print = 0; + #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_scope_struct____Pyx_CFunc_bint____object___to_py.tp_dictoffset && __pyx_scope_struct____Pyx_CFunc_bint____object___to_py.tp_getattro == PyObject_GenericGetAttr)) { __pyx_scope_struct____Pyx_CFunc_bint____object___to_py.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype___pyx_scope_struct____Pyx_CFunc_bint____object___to_py = &__pyx_scope_struct____Pyx_CFunc_bint____object___to_py; - if (PyType_Ready(&__pyx_scope_struct____Pyx_CFunc_double____object___to_py) < 0) __PYX_ERR(1, 64, __pyx_L1_error) + if (PyType_Ready(&__pyx_scope_struct____Pyx_CFunc_double____object___to_py) < 0) __PYX_ERR(2, 64, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 __pyx_scope_struct____Pyx_CFunc_double____object___to_py.tp_print = 0; + #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_scope_struct____Pyx_CFunc_double____object___to_py.tp_dictoffset && __pyx_scope_struct____Pyx_CFunc_double____object___to_py.tp_getattro == PyObject_GenericGetAttr)) { __pyx_scope_struct____Pyx_CFunc_double____object___to_py.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype___pyx_scope_struct____Pyx_CFunc_double____object___to_py = &__pyx_scope_struct____Pyx_CFunc_double____object___to_py; - if (PyType_Ready(&__pyx_scope_struct____Pyx_CFunc_long__long____object___to_py) < 0) __PYX_ERR(1, 64, __pyx_L1_error) + if (PyType_Ready(&__pyx_scope_struct____Pyx_CFunc_long__long____object___to_py) < 0) __PYX_ERR(2, 64, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 __pyx_scope_struct____Pyx_CFunc_long__long____object___to_py.tp_print = 0; + #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_scope_struct____Pyx_CFunc_long__long____object___to_py.tp_dictoffset && __pyx_scope_struct____Pyx_CFunc_long__long____object___to_py.tp_getattro == PyObject_GenericGetAttr)) { __pyx_scope_struct____Pyx_CFunc_long__long____object___to_py.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype___pyx_scope_struct____Pyx_CFunc_long__long____object___to_py = &__pyx_scope_struct____Pyx_CFunc_long__long____object___to_py; - if (PyType_Ready(&__pyx_scope_struct____Pyx_CFunc_bytes____object___to_py) < 0) __PYX_ERR(1, 64, __pyx_L1_error) + if (PyType_Ready(&__pyx_scope_struct____Pyx_CFunc_bytes____object___to_py) < 0) __PYX_ERR(2, 64, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 __pyx_scope_struct____Pyx_CFunc_bytes____object___to_py.tp_print = 0; + #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_scope_struct____Pyx_CFunc_bytes____object___to_py.tp_dictoffset && __pyx_scope_struct____Pyx_CFunc_bytes____object___to_py.tp_getattro == PyObject_GenericGetAttr)) { __pyx_scope_struct____Pyx_CFunc_bytes____object___to_py.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype___pyx_scope_struct____Pyx_CFunc_bytes____object___to_py = &__pyx_scope_struct____Pyx_CFunc_bytes____object___to_py; - if (PyType_Ready(&__pyx_scope_struct____Pyx_CFunc_float____object___to_py) < 0) __PYX_ERR(1, 64, __pyx_L1_error) + if (PyType_Ready(&__pyx_scope_struct____Pyx_CFunc_float____object___to_py) < 0) __PYX_ERR(2, 64, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 __pyx_scope_struct____Pyx_CFunc_float____object___to_py.tp_print = 0; + #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_scope_struct____Pyx_CFunc_float____object___to_py.tp_dictoffset && __pyx_scope_struct____Pyx_CFunc_float____object___to_py.tp_getattro == PyObject_GenericGetAttr)) { __pyx_scope_struct____Pyx_CFunc_float____object___to_py.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype___pyx_scope_struct____Pyx_CFunc_float____object___to_py = &__pyx_scope_struct____Pyx_CFunc_float____object___to_py; - if (PyType_Ready(&__pyx_scope_struct____Pyx_CFunc_void____object____object___to_py) < 0) __PYX_ERR(1, 64, __pyx_L1_error) - __pyx_scope_struct____Pyx_CFunc_void____object____object___to_py.tp_print = 0; - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_scope_struct____Pyx_CFunc_void____object____object___to_py.tp_dictoffset && __pyx_scope_struct____Pyx_CFunc_void____object____object___to_py.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_scope_struct____Pyx_CFunc_void____object____object___to_py.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; - } - __pyx_ptype___pyx_scope_struct____Pyx_CFunc_void____object____object___to_py = &__pyx_scope_struct____Pyx_CFunc_void____object____object___to_py; - if (PyType_Ready(&__pyx_scope_struct____Pyx_CFunc_void____object____float___to_py) < 0) __PYX_ERR(1, 64, __pyx_L1_error) - __pyx_scope_struct____Pyx_CFunc_void____object____float___to_py.tp_print = 0; - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_scope_struct____Pyx_CFunc_void____object____float___to_py.tp_dictoffset && __pyx_scope_struct____Pyx_CFunc_void____object____float___to_py.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_scope_struct____Pyx_CFunc_void____object____float___to_py.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; - } - __pyx_ptype___pyx_scope_struct____Pyx_CFunc_void____object____float___to_py = &__pyx_scope_struct____Pyx_CFunc_void____object____float___to_py; - if (PyType_Ready(&__pyx_scope_struct____Pyx_CFunc_void____object____double___to_py) < 0) __PYX_ERR(1, 64, __pyx_L1_error) - __pyx_scope_struct____Pyx_CFunc_void____object____double___to_py.tp_print = 0; - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_scope_struct____Pyx_CFunc_void____object____double___to_py.tp_dictoffset && __pyx_scope_struct____Pyx_CFunc_void____object____double___to_py.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_scope_struct____Pyx_CFunc_void____object____double___to_py.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; - } - __pyx_ptype___pyx_scope_struct____Pyx_CFunc_void____object____double___to_py = &__pyx_scope_struct____Pyx_CFunc_void____object____double___to_py; __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -29252,10 +27561,35 @@ static int __Pyx_modinit_type_init_code(void) { static int __Pyx_modinit_type_import_code(void) { __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); /*--- Type import code ---*/ + __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error) + __Pyx_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), __PYX_GET_STRUCT_ALIGNMENT(PyTypeObject), + #else + sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT(PyHeapTypeObject), + #endif + __Pyx_ImportType_CheckSize_Warn); + if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("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_GET_STRUCT_ALIGNMENT(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_RefNannyFinishContext(); return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; } static int __Pyx_modinit_variable_import_code(void) { @@ -29275,17 +27609,19 @@ static int __Pyx_modinit_function_import_code(void) { } -#if PY_MAJOR_VERSION < 3 -#ifdef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC void -#else +#ifndef CYTHON_NO_PYINIT_EXPORT #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#elif PY_MAJOR_VERSION < 3 +#ifdef __cplusplus +#define __Pyx_PyMODINIT_FUNC extern "C" void +#else +#define __Pyx_PyMODINIT_FUNC void #endif #else -#ifdef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC PyObject * +#ifdef __cplusplus +#define __Pyx_PyMODINIT_FUNC extern "C" PyObject * #else -#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#define __Pyx_PyMODINIT_FUNC PyObject * #endif #endif @@ -29369,6 +27705,9 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec_fast_binary(PyObject *__pyx_pyinit PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannyDeclarations #if CYTHON_PEP489_MULTI_PHASE_INIT if (__pyx_m) { @@ -29416,11 +27755,9 @@ if (!__Pyx_RefNanny) { #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ - #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - #ifdef WITH_THREAD /* Python build with threading support? */ + #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS PyEval_InitThreads(); #endif - #endif /*--- Module creation code ---*/ #if CYTHON_PEP489_MULTI_PHASE_INIT __pyx_m = __pyx_pyinit_module; @@ -29436,11 +27773,10 @@ if (!__Pyx_RefNanny) { __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) Py_INCREF(__pyx_d); __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) - #if CYTHON_COMPILING_IN_PYPY Py_INCREF(__pyx_b); - #endif - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_cython_runtime); + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Initialize various global constants etc. ---*/ if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) @@ -29465,8 +27801,8 @@ if (!__Pyx_RefNanny) { (void)__Pyx_modinit_global_init_code(); (void)__Pyx_modinit_variable_export_code(); (void)__Pyx_modinit_function_export_code(); - if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error; - (void)__Pyx_modinit_type_import_code(); + if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) (void)__Pyx_modinit_variable_import_code(); (void)__Pyx_modinit_function_import_code(); /*--- Execution code ---*/ @@ -29474,85 +27810,85 @@ if (!__Pyx_RefNanny) { if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif - /* "spavro/fast_binary.pyx":8 - * no longer consult the schema saving lookups.''' + /* "spavro/fast_binary.pyx":11 + * from libc.string cimport memcpy * * import six # <<<<<<<<<<<<<< * INT_MIN_VALUE = -(1 << 31) * INT_MAX_VALUE = (1 << 31) - 1 */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_six, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error) + __pyx_t_1 = __Pyx_Import(__pyx_n_s_six, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_six, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_six, __pyx_t_1) < 0) __PYX_ERR(0, 11, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":9 + /* "spavro/fast_binary.pyx":12 * * import six * INT_MIN_VALUE = -(1 << 31) # <<<<<<<<<<<<<< * INT_MAX_VALUE = (1 << 31) - 1 * LONG_MIN_VALUE = -(1 << 63) */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_INT_MIN_VALUE, __pyx_int_neg_2147483648) < 0) __PYX_ERR(0, 9, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_INT_MIN_VALUE, __pyx_int_neg_2147483648) < 0) __PYX_ERR(0, 12, __pyx_L1_error) - /* "spavro/fast_binary.pyx":10 + /* "spavro/fast_binary.pyx":13 * import six * INT_MIN_VALUE = -(1 << 31) * INT_MAX_VALUE = (1 << 31) - 1 # <<<<<<<<<<<<<< * LONG_MIN_VALUE = -(1 << 63) * LONG_MAX_VALUE = (1 << 63) - 1 */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_INT_MAX_VALUE, __pyx_int_2147483647) < 0) __PYX_ERR(0, 10, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_INT_MAX_VALUE, __pyx_int_2147483647) < 0) __PYX_ERR(0, 13, __pyx_L1_error) - /* "spavro/fast_binary.pyx":11 + /* "spavro/fast_binary.pyx":14 * INT_MIN_VALUE = -(1 << 31) * INT_MAX_VALUE = (1 << 31) - 1 * LONG_MIN_VALUE = -(1 << 63) # <<<<<<<<<<<<<< * LONG_MAX_VALUE = (1 << 63) - 1 * */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LONG_MIN_VALUE, __pyx_int_neg_9223372036854775808) < 0) __PYX_ERR(0, 11, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LONG_MIN_VALUE, __pyx_int_neg_9223372036854775808) < 0) __PYX_ERR(0, 14, __pyx_L1_error) - /* "spavro/fast_binary.pyx":12 + /* "spavro/fast_binary.pyx":15 * INT_MAX_VALUE = (1 << 31) - 1 * LONG_MIN_VALUE = -(1 << 63) * LONG_MAX_VALUE = (1 << 63) - 1 # <<<<<<<<<<<<<< * * */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LONG_MAX_VALUE, __pyx_int_9223372036854775807) < 0) __PYX_ERR(0, 12, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LONG_MAX_VALUE, __pyx_int_9223372036854775807) < 0) __PYX_ERR(0, 15, __pyx_L1_error) - /* "spavro/fast_binary.pyx":90 + /* "spavro/fast_binary.pyx":93 * * # ====================================================================== * from collections import namedtuple # <<<<<<<<<<<<<< * ReadField = namedtuple('ReadField', ['name', 'reader', 'skip']) * WriteField = namedtuple('WriteField', ['name', 'writer']) */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error) + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_namedtuple); __Pyx_GIVEREF(__pyx_n_s_namedtuple); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_namedtuple); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_collections, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error) + __pyx_t_2 = __Pyx_Import(__pyx_n_s_collections, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 93, __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_namedtuple); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error) + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_namedtuple); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_namedtuple, __pyx_t_1) < 0) __PYX_ERR(0, 90, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_namedtuple, __pyx_t_1) < 0) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":91 + /* "spavro/fast_binary.pyx":94 * # ====================================================================== * from collections import namedtuple * ReadField = namedtuple('ReadField', ['name', 'reader', 'skip']) # <<<<<<<<<<<<<< * WriteField = namedtuple('WriteField', ['name', 'writer']) * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_namedtuple); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_namedtuple); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error) + __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_name); __Pyx_GIVEREF(__pyx_n_s_name); @@ -29563,7 +27899,7 @@ if (!__Pyx_RefNanny) { __Pyx_INCREF(__pyx_n_s_skip); __Pyx_GIVEREF(__pyx_n_s_skip); PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_skip); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_n_s_ReadField); __Pyx_GIVEREF(__pyx_n_s_ReadField); @@ -29571,23 +27907,23 @@ if (!__Pyx_RefNanny) { __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __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; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_ReadField, __pyx_t_1) < 0) __PYX_ERR(0, 91, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ReadField, __pyx_t_1) < 0) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":92 + /* "spavro/fast_binary.pyx":95 * from collections import namedtuple * ReadField = namedtuple('ReadField', ['name', 'reader', 'skip']) * WriteField = namedtuple('WriteField', ['name', 'writer']) # <<<<<<<<<<<<<< * * cpdef unicode get_type(schema): */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_namedtuple); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_namedtuple); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_n_s_name); __Pyx_GIVEREF(__pyx_n_s_name); @@ -29595,7 +27931,7 @@ if (!__Pyx_RefNanny) { __Pyx_INCREF(__pyx_n_s_writer); __Pyx_GIVEREF(__pyx_n_s_writer); PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_writer); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_WriteField); __Pyx_GIVEREF(__pyx_n_s_WriteField); @@ -29603,606 +27939,606 @@ if (!__Pyx_RefNanny) { __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_WriteField, __pyx_t_3) < 0) __PYX_ERR(0, 92, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_WriteField, __pyx_t_3) < 0) __PYX_ERR(0, 95, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":103 + /* "spavro/fast_binary.pyx":106 * * * def make_union_reader(union_schema): # <<<<<<<<<<<<<< * cdef list readers = [get_reader(schema) for schema in union_schema] * */ - __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_3make_union_reader, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 103, __pyx_L1_error) + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_3make_union_reader, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_union_reader, __pyx_t_3) < 0) __PYX_ERR(0, 103, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_union_reader, __pyx_t_3) < 0) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":117 + /* "spavro/fast_binary.pyx":120 * * * def make_record_reader(schema): # <<<<<<<<<<<<<< * cdef list fields = [ReadField(field['name'], get_reader(field['type']), get_type(field['type']) == 'skip') for field in schema['fields']] * */ - __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_5make_record_reader, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 117, __pyx_L1_error) + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_5make_record_reader, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_record_reader, __pyx_t_3) < 0) __PYX_ERR(0, 117, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_record_reader, __pyx_t_3) < 0) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":126 + /* "spavro/fast_binary.pyx":129 * * * def make_enum_reader(schema): # <<<<<<<<<<<<<< * cdef list symbols = schema['symbols'] * */ - __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_7make_enum_reader, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 126, __pyx_L1_error) + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_7make_enum_reader, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 129, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_enum_reader, __pyx_t_3) < 0) __PYX_ERR(0, 126, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_enum_reader, __pyx_t_3) < 0) __PYX_ERR(0, 129, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":134 + /* "spavro/fast_binary.pyx":137 * return enum_reader * * def make_array_reader(schema): # <<<<<<<<<<<<<< * item_reader = get_reader(schema['items']) * def array_reader(fo): */ - __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_9make_array_reader, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 134, __pyx_L1_error) + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_9make_array_reader, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 137, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_array_reader, __pyx_t_3) < 0) __PYX_ERR(0, 134, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_array_reader, __pyx_t_3) < 0) __PYX_ERR(0, 137, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":151 + /* "spavro/fast_binary.pyx":154 * return array_reader * * def make_map_reader(schema): # <<<<<<<<<<<<<< * value_reader = get_reader(schema['values']) * */ - __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_11make_map_reader, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 151, __pyx_L1_error) + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_11make_map_reader, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 154, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_map_reader, __pyx_t_3) < 0) __PYX_ERR(0, 151, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_map_reader, __pyx_t_3) < 0) __PYX_ERR(0, 154, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":169 + /* "spavro/fast_binary.pyx":172 * return map_reader * * def make_fixed_reader(schema): # <<<<<<<<<<<<<< * cdef long size = schema['size'] * */ - __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_13make_fixed_reader, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 169, __pyx_L1_error) + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_13make_fixed_reader, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 172, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_fixed_reader, __pyx_t_3) < 0) __PYX_ERR(0, 169, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_fixed_reader, __pyx_t_3) < 0) __PYX_ERR(0, 172, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":177 + /* "spavro/fast_binary.pyx":180 * return fixed_reader * * def make_null_reader(schema): # <<<<<<<<<<<<<< * return read_null * */ - __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_15make_null_reader, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 177, __pyx_L1_error) + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_15make_null_reader, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_null_reader, __pyx_t_3) < 0) __PYX_ERR(0, 177, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_null_reader, __pyx_t_3) < 0) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":180 + /* "spavro/fast_binary.pyx":183 * return read_null * * def make_string_reader(schema): # <<<<<<<<<<<<<< * return read_utf8 * */ - __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17make_string_reader, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 180, __pyx_L1_error) + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17make_string_reader, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_string_reader, __pyx_t_3) < 0) __PYX_ERR(0, 180, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_string_reader, __pyx_t_3) < 0) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":183 + /* "spavro/fast_binary.pyx":186 * return read_utf8 * * def make_boolean_reader(schema): # <<<<<<<<<<<<<< * return read_boolean * */ - __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_19make_boolean_reader, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 183, __pyx_L1_error) + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_19make_boolean_reader, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 186, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_boolean_reader, __pyx_t_3) < 0) __PYX_ERR(0, 183, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_boolean_reader, __pyx_t_3) < 0) __PYX_ERR(0, 186, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":186 + /* "spavro/fast_binary.pyx":189 * return read_boolean * * def make_double_reader(schema): # <<<<<<<<<<<<<< * return read_double * */ - __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_21make_double_reader, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 186, __pyx_L1_error) + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_21make_double_reader, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 189, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_double_reader, __pyx_t_3) < 0) __PYX_ERR(0, 186, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_double_reader, __pyx_t_3) < 0) __PYX_ERR(0, 189, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":189 + /* "spavro/fast_binary.pyx":192 * return read_double * * def make_long_reader(schema): # <<<<<<<<<<<<<< * return read_long * */ - __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_23make_long_reader, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 189, __pyx_L1_error) + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_23make_long_reader, NULL, __pyx_n_s_spavro_fast_binary); 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_make_long_reader, __pyx_t_3) < 0) __PYX_ERR(0, 189, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_long_reader, __pyx_t_3) < 0) __PYX_ERR(0, 192, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":192 + /* "spavro/fast_binary.pyx":195 * return read_long * * def make_byte_reader(schema): # <<<<<<<<<<<<<< * return read_bytes * */ - __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_25make_byte_reader, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 192, __pyx_L1_error) + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_25make_byte_reader, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 195, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_byte_reader, __pyx_t_3) < 0) __PYX_ERR(0, 192, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_byte_reader, __pyx_t_3) < 0) __PYX_ERR(0, 195, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":195 + /* "spavro/fast_binary.pyx":198 * return read_bytes * * def make_float_reader(schema): # <<<<<<<<<<<<<< * return read_float * */ - __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_27make_float_reader, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 195, __pyx_L1_error) + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_27make_float_reader, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 198, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_float_reader, __pyx_t_3) < 0) __PYX_ERR(0, 195, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_float_reader, __pyx_t_3) < 0) __PYX_ERR(0, 198, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":199 + /* "spavro/fast_binary.pyx":202 * * * def make_skip_reader(schema): # <<<<<<<<<<<<<< * # this will create a regular reader that will iterate the bytes * # in the avro stream properly */ - __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_29make_skip_reader, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 199, __pyx_L1_error) + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_29make_skip_reader, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_skip_reader, __pyx_t_3) < 0) __PYX_ERR(0, 199, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_skip_reader, __pyx_t_3) < 0) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":210 + /* "spavro/fast_binary.pyx":213 * * * def make_default_reader(schema): # <<<<<<<<<<<<<< * value = schema["value"] * def read_default(fo): */ - __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_31make_default_reader, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 210, __pyx_L1_error) + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_31make_default_reader, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_default_reader, __pyx_t_3) < 0) __PYX_ERR(0, 210, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_default_reader, __pyx_t_3) < 0) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":219 + /* "spavro/fast_binary.pyx":222 * * reader_type_map = { * 'union': make_union_reader, # <<<<<<<<<<<<<< * 'record': make_record_reader, * 'null': make_null_reader, */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(16); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 219, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(16); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_union_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 219, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_union_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_union, __pyx_t_2) < 0) __PYX_ERR(0, 219, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_union, __pyx_t_2) < 0) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":220 + /* "spavro/fast_binary.pyx":223 * reader_type_map = { * 'union': make_union_reader, * 'record': make_record_reader, # <<<<<<<<<<<<<< * 'null': make_null_reader, * 'string': make_string_reader, */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_record_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 220, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_record_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_record, __pyx_t_2) < 0) __PYX_ERR(0, 219, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_record, __pyx_t_2) < 0) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":221 + /* "spavro/fast_binary.pyx":224 * 'union': make_union_reader, * 'record': make_record_reader, * 'null': make_null_reader, # <<<<<<<<<<<<<< * 'string': make_string_reader, * 'boolean': make_boolean_reader, */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_null_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_null_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_null, __pyx_t_2) < 0) __PYX_ERR(0, 219, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_null, __pyx_t_2) < 0) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":222 + /* "spavro/fast_binary.pyx":225 * 'record': make_record_reader, * 'null': make_null_reader, * 'string': make_string_reader, # <<<<<<<<<<<<<< * 'boolean': make_boolean_reader, * 'double': make_double_reader, */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_string_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 222, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_string_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_string, __pyx_t_2) < 0) __PYX_ERR(0, 219, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_string, __pyx_t_2) < 0) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":223 + /* "spavro/fast_binary.pyx":226 * 'null': make_null_reader, * 'string': make_string_reader, * 'boolean': make_boolean_reader, # <<<<<<<<<<<<<< * 'double': make_double_reader, * 'float': make_float_reader, */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_boolean_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 223, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_boolean_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_boolean, __pyx_t_2) < 0) __PYX_ERR(0, 219, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_boolean, __pyx_t_2) < 0) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":224 + /* "spavro/fast_binary.pyx":227 * 'string': make_string_reader, * 'boolean': make_boolean_reader, * 'double': make_double_reader, # <<<<<<<<<<<<<< * 'float': make_float_reader, * 'long': make_long_reader, */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_double_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_double_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 227, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_double, __pyx_t_2) < 0) __PYX_ERR(0, 219, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_double, __pyx_t_2) < 0) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":225 + /* "spavro/fast_binary.pyx":228 * 'boolean': make_boolean_reader, * 'double': make_double_reader, * 'float': make_float_reader, # <<<<<<<<<<<<<< * 'long': make_long_reader, * 'bytes': make_byte_reader, */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_float_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_float_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_float, __pyx_t_2) < 0) __PYX_ERR(0, 219, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_float, __pyx_t_2) < 0) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":226 + /* "spavro/fast_binary.pyx":229 * 'double': make_double_reader, * 'float': make_float_reader, * 'long': make_long_reader, # <<<<<<<<<<<<<< * 'bytes': make_byte_reader, * 'int': make_long_reader, */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_long_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 226, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_long_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_long, __pyx_t_2) < 0) __PYX_ERR(0, 219, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_long, __pyx_t_2) < 0) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":227 + /* "spavro/fast_binary.pyx":230 * 'float': make_float_reader, * 'long': make_long_reader, * 'bytes': make_byte_reader, # <<<<<<<<<<<<<< * 'int': make_long_reader, * 'fixed': make_fixed_reader, */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_byte_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 227, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_byte_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 230, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_bytes, __pyx_t_2) < 0) __PYX_ERR(0, 219, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_bytes, __pyx_t_2) < 0) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":228 + /* "spavro/fast_binary.pyx":231 * 'long': make_long_reader, * 'bytes': make_byte_reader, * 'int': make_long_reader, # <<<<<<<<<<<<<< * 'fixed': make_fixed_reader, * 'enum': make_enum_reader, */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_long_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 228, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_long_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 231, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_int, __pyx_t_2) < 0) __PYX_ERR(0, 219, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_int, __pyx_t_2) < 0) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":229 + /* "spavro/fast_binary.pyx":232 * 'bytes': make_byte_reader, * 'int': make_long_reader, * 'fixed': make_fixed_reader, # <<<<<<<<<<<<<< * 'enum': make_enum_reader, * 'array': make_array_reader, */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_fixed_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 229, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_fixed_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 232, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_fixed, __pyx_t_2) < 0) __PYX_ERR(0, 219, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_fixed, __pyx_t_2) < 0) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":230 + /* "spavro/fast_binary.pyx":233 * 'int': make_long_reader, * 'fixed': make_fixed_reader, * 'enum': make_enum_reader, # <<<<<<<<<<<<<< * 'array': make_array_reader, * 'map': make_map_reader, */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_enum_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 230, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_enum_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 233, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_enum, __pyx_t_2) < 0) __PYX_ERR(0, 219, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_enum, __pyx_t_2) < 0) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":231 + /* "spavro/fast_binary.pyx":234 * 'fixed': make_fixed_reader, * 'enum': make_enum_reader, * 'array': make_array_reader, # <<<<<<<<<<<<<< * 'map': make_map_reader, * 'skip': make_skip_reader, */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_array_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 231, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_array_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 234, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_array, __pyx_t_2) < 0) __PYX_ERR(0, 219, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_array, __pyx_t_2) < 0) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":232 + /* "spavro/fast_binary.pyx":235 * 'enum': make_enum_reader, * 'array': make_array_reader, * 'map': make_map_reader, # <<<<<<<<<<<<<< * 'skip': make_skip_reader, * 'default': make_default_reader */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_map_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 232, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_map_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 235, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_map, __pyx_t_2) < 0) __PYX_ERR(0, 219, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_map, __pyx_t_2) < 0) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":233 + /* "spavro/fast_binary.pyx":236 * 'array': make_array_reader, * 'map': make_map_reader, * 'skip': make_skip_reader, # <<<<<<<<<<<<<< * 'default': make_default_reader * } */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_skip_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 233, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_skip_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 236, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_skip, __pyx_t_2) < 0) __PYX_ERR(0, 219, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_skip, __pyx_t_2) < 0) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":234 + /* "spavro/fast_binary.pyx":237 * 'map': make_map_reader, * 'skip': make_skip_reader, * 'default': make_default_reader # <<<<<<<<<<<<<< * } * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_default_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 234, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_default_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 237, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_default, __pyx_t_2) < 0) __PYX_ERR(0, 219, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_default, __pyx_t_2) < 0) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_reader_type_map, __pyx_t_3) < 0) __PYX_ERR(0, 218, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_reader_type_map, __pyx_t_3) < 0) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":237 + /* "spavro/fast_binary.pyx":240 * } * * schema_cache = {} # <<<<<<<<<<<<<< * * class ReaderPlaceholder(object): */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 240, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_schema_cache, __pyx_t_3) < 0) __PYX_ERR(0, 237, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_schema_cache, __pyx_t_3) < 0) __PYX_ERR(0, 240, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":239 + /* "spavro/fast_binary.pyx":242 * schema_cache = {} * * class ReaderPlaceholder(object): # <<<<<<<<<<<<<< * def __init__(self): * self.reader = None */ - __pyx_t_3 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__109); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 239, __pyx_L1_error) + __pyx_t_3 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__83); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 242, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_3, __pyx_tuple__109, __pyx_n_s_ReaderPlaceholder, __pyx_n_s_ReaderPlaceholder, (PyObject *) NULL, __pyx_n_s_spavro_fast_binary, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 239, __pyx_L1_error) + __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_3, __pyx_tuple__83, __pyx_n_s_ReaderPlaceholder, __pyx_n_s_ReaderPlaceholder, (PyObject *) NULL, __pyx_n_s_spavro_fast_binary, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 242, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - /* "spavro/fast_binary.pyx":240 + /* "spavro/fast_binary.pyx":243 * * class ReaderPlaceholder(object): * def __init__(self): # <<<<<<<<<<<<<< * self.reader = None * */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17ReaderPlaceholder_1__init__, 0, __pyx_n_s_ReaderPlaceholder___init, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__111)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __pyx_L1_error) + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17ReaderPlaceholder_1__init__, 0, __pyx_n_s_ReaderPlaceholder___init, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__85)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_1) < 0) __PYX_ERR(0, 240, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_1) < 0) __PYX_ERR(0, 243, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":243 + /* "spavro/fast_binary.pyx":246 * self.reader = None * * def __call__(self, fo): # <<<<<<<<<<<<<< * return self.reader(fo) * */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17ReaderPlaceholder_3__call__, 0, __pyx_n_s_ReaderPlaceholder___call, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__113)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __pyx_L1_error) + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17ReaderPlaceholder_3__call__, 0, __pyx_n_s_ReaderPlaceholder___call, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__87)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 246, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_call, __pyx_t_1) < 0) __PYX_ERR(0, 243, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_call, __pyx_t_1) < 0) __PYX_ERR(0, 246, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":239 + /* "spavro/fast_binary.pyx":242 * schema_cache = {} * * class ReaderPlaceholder(object): # <<<<<<<<<<<<<< * def __init__(self): * self.reader = None */ - __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_3, __pyx_n_s_ReaderPlaceholder, __pyx_tuple__109, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 239, __pyx_L1_error) + __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_3, __pyx_n_s_ReaderPlaceholder, __pyx_tuple__83, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 242, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_ReaderPlaceholder, __pyx_t_1) < 0) __PYX_ERR(0, 239, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ReaderPlaceholder, __pyx_t_1) < 0) __PYX_ERR(0, 242, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":246 + /* "spavro/fast_binary.pyx":249 * return self.reader(fo) * * def get_reader(schema): # <<<<<<<<<<<<<< * cdef unicode schema_type = get_type(schema) * if schema_type in ('record', 'fixed', 'enum'): */ - __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_33get_reader, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 246, __pyx_L1_error) + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_33get_reader, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_reader, __pyx_t_3) < 0) __PYX_ERR(0, 246, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_reader, __pyx_t_3) < 0) __PYX_ERR(0, 249, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":287 + /* "spavro/fast_binary.pyx":290 * outbuf.write((&datum)[:sizeof(char)]) * * write_long = write_int # <<<<<<<<<<<<<< * * */ - __pyx_t_3 = __Pyx_CFunc_void____object____long__long___to_py(__pyx_f_6spavro_11fast_binary_write_int); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 287, __pyx_L1_error) + __pyx_t_3 = __Pyx_CFunc_void____object____long__long___to_py(__pyx_f_6spavro_11fast_binary_write_int); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 290, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_write_long, __pyx_t_3) < 0) __PYX_ERR(0, 287, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_write_long, __pyx_t_3) < 0) __PYX_ERR(0, 290, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":341 + /* "spavro/fast_binary.pyx":460 * * avro_to_py = { * u"string": unicode, # <<<<<<<<<<<<<< * u"int": int, * u"long": int, */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 341, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 460, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_string, ((PyObject *)(&PyUnicode_Type))) < 0) __PYX_ERR(0, 341, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_string, ((PyObject *)(&PyUnicode_Type))) < 0) __PYX_ERR(0, 460, __pyx_L1_error) - /* "spavro/fast_binary.pyx":342 + /* "spavro/fast_binary.pyx":461 * avro_to_py = { * u"string": unicode, * u"int": int, # <<<<<<<<<<<<<< * u"long": int, * u"boolean": bool, */ - if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_int, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 341, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_int, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 460, __pyx_L1_error) - /* "spavro/fast_binary.pyx":343 + /* "spavro/fast_binary.pyx":462 * u"string": unicode, * u"int": int, * u"long": int, # <<<<<<<<<<<<<< * u"boolean": bool, * u"null": type(None), */ - if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_long, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 341, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_long, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 460, __pyx_L1_error) - /* "spavro/fast_binary.pyx":344 + /* "spavro/fast_binary.pyx":463 * u"int": int, * u"long": int, * u"boolean": bool, # <<<<<<<<<<<<<< * u"null": type(None), * u"float": float, */ - if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_boolean, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 341, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_boolean, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 460, __pyx_L1_error) - /* "spavro/fast_binary.pyx":345 + /* "spavro/fast_binary.pyx":464 * u"long": int, * u"boolean": bool, * u"null": type(None), # <<<<<<<<<<<<<< * u"float": float, * u"double": float, */ - if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_null, ((PyObject *)Py_TYPE(Py_None))) < 0) __PYX_ERR(0, 341, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_null, ((PyObject *)Py_TYPE(Py_None))) < 0) __PYX_ERR(0, 460, __pyx_L1_error) - /* "spavro/fast_binary.pyx":346 + /* "spavro/fast_binary.pyx":465 * u"boolean": bool, * u"null": type(None), * u"float": float, # <<<<<<<<<<<<<< * u"double": float, * u"array": list, */ - if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_float, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 341, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_float, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 460, __pyx_L1_error) - /* "spavro/fast_binary.pyx":347 + /* "spavro/fast_binary.pyx":466 * u"null": type(None), * u"float": float, * u"double": float, # <<<<<<<<<<<<<< * u"array": list, * u"record": dict, */ - if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_double, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 341, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_double, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 460, __pyx_L1_error) - /* "spavro/fast_binary.pyx":348 + /* "spavro/fast_binary.pyx":467 * u"float": float, * u"double": float, * u"array": list, # <<<<<<<<<<<<<< * u"record": dict, * u"enum": unicode, */ - if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_array, ((PyObject *)(&PyList_Type))) < 0) __PYX_ERR(0, 341, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_array, ((PyObject *)(&PyList_Type))) < 0) __PYX_ERR(0, 460, __pyx_L1_error) - /* "spavro/fast_binary.pyx":349 + /* "spavro/fast_binary.pyx":468 * u"double": float, * u"array": list, * u"record": dict, # <<<<<<<<<<<<<< * u"enum": unicode, * u"fixed": bytes, */ - if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_record, ((PyObject *)(&PyDict_Type))) < 0) __PYX_ERR(0, 341, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_record, ((PyObject *)(&PyDict_Type))) < 0) __PYX_ERR(0, 460, __pyx_L1_error) - /* "spavro/fast_binary.pyx":350 + /* "spavro/fast_binary.pyx":469 * u"array": list, * u"record": dict, * u"enum": unicode, # <<<<<<<<<<<<<< * u"fixed": bytes, * u"bytes": bytes, */ - if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_enum, ((PyObject *)(&PyUnicode_Type))) < 0) __PYX_ERR(0, 341, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_enum, ((PyObject *)(&PyUnicode_Type))) < 0) __PYX_ERR(0, 460, __pyx_L1_error) - /* "spavro/fast_binary.pyx":351 + /* "spavro/fast_binary.pyx":470 * u"record": dict, * u"enum": unicode, * u"fixed": bytes, # <<<<<<<<<<<<<< * u"bytes": bytes, * u"map": dict */ - if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_fixed, ((PyObject *)(&PyBytes_Type))) < 0) __PYX_ERR(0, 341, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_fixed, ((PyObject *)(&PyBytes_Type))) < 0) __PYX_ERR(0, 460, __pyx_L1_error) - /* "spavro/fast_binary.pyx":352 + /* "spavro/fast_binary.pyx":471 * u"enum": unicode, * u"fixed": bytes, * u"bytes": bytes, # <<<<<<<<<<<<<< * u"map": dict * } */ - if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_bytes, ((PyObject *)(&PyBytes_Type))) < 0) __PYX_ERR(0, 341, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_bytes, ((PyObject *)(&PyBytes_Type))) < 0) __PYX_ERR(0, 460, __pyx_L1_error) - /* "spavro/fast_binary.pyx":353 + /* "spavro/fast_binary.pyx":472 * u"fixed": bytes, * u"bytes": bytes, * u"map": dict # <<<<<<<<<<<<<< * } * */ - if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_map, ((PyObject *)(&PyDict_Type))) < 0) __PYX_ERR(0, 341, __pyx_L1_error) - if (PyDict_SetItem(__pyx_d, __pyx_n_s_avro_to_py, __pyx_t_3) < 0) __PYX_ERR(0, 340, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_map, ((PyObject *)(&PyDict_Type))) < 0) __PYX_ERR(0, 460, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_avro_to_py, __pyx_t_3) < 0) __PYX_ERR(0, 459, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":358 + /* "spavro/fast_binary.pyx":477 * * # =============================== * CheckField = namedtuple('CheckField', ['name', 'check']) # <<<<<<<<<<<<<< * * def get_check(schema): */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_namedtuple); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 358, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_namedtuple); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 477, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 358, __pyx_L1_error) + __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 477, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_name); __Pyx_GIVEREF(__pyx_n_s_name); @@ -30210,7 +28546,7 @@ if (!__Pyx_RefNanny) { __Pyx_INCREF(__pyx_n_s_check); __Pyx_GIVEREF(__pyx_n_s_check); PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_check); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 358, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 477, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_CheckField); __Pyx_GIVEREF(__pyx_n_s_CheckField); @@ -30218,1247 +28554,1248 @@ if (!__Pyx_RefNanny) { __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 358, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 477, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_CheckField, __pyx_t_2) < 0) __PYX_ERR(0, 358, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_CheckField, __pyx_t_2) < 0) __PYX_ERR(0, 477, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":360 + /* "spavro/fast_binary.pyx":479 * CheckField = namedtuple('CheckField', ['name', 'check']) * * def get_check(schema): # <<<<<<<<<<<<<< * schema = lookup_schema(schema) * cdef unicode schema_type = get_type(schema) */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_35get_check, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 360, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_35get_check, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 479, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_check, __pyx_t_2) < 0) __PYX_ERR(0, 360, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_check, __pyx_t_2) < 0) __PYX_ERR(0, 479, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":366 + /* "spavro/fast_binary.pyx":485 * * * def make_record_check(schema): # <<<<<<<<<<<<<< * cdef list fields = [CheckField(field['name'], get_check(field['type'])) for field in schema['fields']] * def record_check(datum): */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_37make_record_check, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 366, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_37make_record_check, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 485, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_record_check, __pyx_t_2) < 0) __PYX_ERR(0, 366, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_record_check, __pyx_t_2) < 0) __PYX_ERR(0, 485, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":373 + /* "spavro/fast_binary.pyx":492 * * * def make_enum_check(schema): # <<<<<<<<<<<<<< * cdef list symbols = schema['symbols'] * def enum_check(datum): */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_39make_enum_check, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 373, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_39make_enum_check, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 492, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_enum_check, __pyx_t_2) < 0) __PYX_ERR(0, 373, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_enum_check, __pyx_t_2) < 0) __PYX_ERR(0, 492, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":380 + /* "spavro/fast_binary.pyx":499 * * * def make_null_check(schema): # <<<<<<<<<<<<<< * return lambda datum: datum is None * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_41make_null_check, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 380, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_41make_null_check, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 499, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_null_check, __pyx_t_2) < 0) __PYX_ERR(0, 380, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_null_check, __pyx_t_2) < 0) __PYX_ERR(0, 499, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":383 + /* "spavro/fast_binary.pyx":502 * return lambda datum: datum is None * * def check_string(datum): # <<<<<<<<<<<<<< * return isinstance(datum, basestring) * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_43check_string, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 383, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_43check_string, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_string, __pyx_t_2) < 0) __PYX_ERR(0, 383, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_string, __pyx_t_2) < 0) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":386 + /* "spavro/fast_binary.pyx":505 * return isinstance(datum, basestring) * * def make_string_check(schema): # <<<<<<<<<<<<<< * return check_string * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_45make_string_check, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 386, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_45make_string_check, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 505, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_string_check, __pyx_t_2) < 0) __PYX_ERR(0, 386, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_string_check, __pyx_t_2) < 0) __PYX_ERR(0, 505, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":389 + /* "spavro/fast_binary.pyx":508 * return check_string * * def make_long_check(schema): # <<<<<<<<<<<<<< * return lambda datum: isinstance(datum, int) or isinstance(datum, long) * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_47make_long_check, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 389, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_47make_long_check, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 508, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_long_check, __pyx_t_2) < 0) __PYX_ERR(0, 389, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_long_check, __pyx_t_2) < 0) __PYX_ERR(0, 508, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":392 + /* "spavro/fast_binary.pyx":511 * return lambda datum: isinstance(datum, int) or isinstance(datum, long) * * def make_boolean_check(schema): # <<<<<<<<<<<<<< * return lambda datum: isinstance(datum, bool) * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_49make_boolean_check, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 392, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_49make_boolean_check, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 511, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_boolean_check, __pyx_t_2) < 0) __PYX_ERR(0, 392, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_boolean_check, __pyx_t_2) < 0) __PYX_ERR(0, 511, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":395 + /* "spavro/fast_binary.pyx":514 * return lambda datum: isinstance(datum, bool) * * def make_float_check(schema): # <<<<<<<<<<<<<< * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_51make_float_check, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 395, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_51make_float_check, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 514, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_float_check, __pyx_t_2) < 0) __PYX_ERR(0, 395, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_float_check, __pyx_t_2) < 0) __PYX_ERR(0, 514, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":398 + /* "spavro/fast_binary.pyx":517 * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) * * def make_double_check(schema): # <<<<<<<<<<<<<< * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_53make_double_check, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 398, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_53make_double_check, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 517, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_double_check, __pyx_t_2) < 0) __PYX_ERR(0, 398, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_double_check, __pyx_t_2) < 0) __PYX_ERR(0, 517, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":401 + /* "spavro/fast_binary.pyx":520 * return lambda datum: isinstance(datum, int) or isinstance(datum, long) or isinstance(datum, float) * * def make_byte_check(schema): # <<<<<<<<<<<<<< * return lambda datum: isinstance(datum, str) or isinstance(datum, bytes) * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_55make_byte_check, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 401, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_55make_byte_check, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 520, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_byte_check, __pyx_t_2) < 0) __PYX_ERR(0, 401, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_byte_check, __pyx_t_2) < 0) __PYX_ERR(0, 520, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":404 + /* "spavro/fast_binary.pyx":523 * return lambda datum: isinstance(datum, str) or isinstance(datum, bytes) * * def make_array_check(schema): # <<<<<<<<<<<<<< * item_check = get_check(schema['items']) * def array_check(datum): */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_57make_array_check, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 404, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_57make_array_check, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 523, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_array_check, __pyx_t_2) < 0) __PYX_ERR(0, 404, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_array_check, __pyx_t_2) < 0) __PYX_ERR(0, 523, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":410 + /* "spavro/fast_binary.pyx":529 * return array_check * * def make_union_check(union_schema): # <<<<<<<<<<<<<< * cdef list union_checks = [get_check(schema) for schema in union_schema] * def union_check(datum): */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_59make_union_check, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 410, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_59make_union_check, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 529, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_union_check, __pyx_t_2) < 0) __PYX_ERR(0, 410, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_union_check, __pyx_t_2) < 0) __PYX_ERR(0, 529, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":416 + /* "spavro/fast_binary.pyx":535 * return union_check * * def make_fixed_check(schema): # <<<<<<<<<<<<<< * cdef int size = schema['size'] * def fixed_check(datum): */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_61make_fixed_check, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 416, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_61make_fixed_check, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 535, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_fixed_check, __pyx_t_2) < 0) __PYX_ERR(0, 416, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_fixed_check, __pyx_t_2) < 0) __PYX_ERR(0, 535, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":422 + /* "spavro/fast_binary.pyx":541 * return fixed_check * * def make_map_check(schema): # <<<<<<<<<<<<<< * map_value_check = get_check(schema['values']) * def map_check(datum): */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_63make_map_check, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 422, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_63make_map_check, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 541, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_map_check, __pyx_t_2) < 0) __PYX_ERR(0, 422, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_map_check, __pyx_t_2) < 0) __PYX_ERR(0, 541, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":429 + /* "spavro/fast_binary.pyx":548 * * check_type_map = { * 'union': make_union_check, # <<<<<<<<<<<<<< * 'record': make_record_check, * 'null': make_null_check, */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(14); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 429, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(14); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 548, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_union_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 429, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_union_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 548, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_union, __pyx_t_1) < 0) __PYX_ERR(0, 429, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_union, __pyx_t_1) < 0) __PYX_ERR(0, 548, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":430 + /* "spavro/fast_binary.pyx":549 * check_type_map = { * 'union': make_union_check, * 'record': make_record_check, # <<<<<<<<<<<<<< * 'null': make_null_check, * 'string': make_string_check, */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_record_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 430, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_record_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 549, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_record, __pyx_t_1) < 0) __PYX_ERR(0, 429, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_record, __pyx_t_1) < 0) __PYX_ERR(0, 548, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":431 + /* "spavro/fast_binary.pyx":550 * 'union': make_union_check, * 'record': make_record_check, * 'null': make_null_check, # <<<<<<<<<<<<<< * 'string': make_string_check, * 'boolean': make_boolean_check, */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_null_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 431, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_null_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 550, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_null, __pyx_t_1) < 0) __PYX_ERR(0, 429, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_null, __pyx_t_1) < 0) __PYX_ERR(0, 548, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":432 + /* "spavro/fast_binary.pyx":551 * 'record': make_record_check, * 'null': make_null_check, * 'string': make_string_check, # <<<<<<<<<<<<<< * 'boolean': make_boolean_check, * 'double': make_double_check, */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_string_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 432, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_string_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 551, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_string, __pyx_t_1) < 0) __PYX_ERR(0, 429, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_string, __pyx_t_1) < 0) __PYX_ERR(0, 548, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":433 + /* "spavro/fast_binary.pyx":552 * 'null': make_null_check, * 'string': make_string_check, * 'boolean': make_boolean_check, # <<<<<<<<<<<<<< * 'double': make_double_check, * 'float': make_float_check, */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_boolean_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 433, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_boolean_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 552, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_boolean, __pyx_t_1) < 0) __PYX_ERR(0, 429, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_boolean, __pyx_t_1) < 0) __PYX_ERR(0, 548, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":434 + /* "spavro/fast_binary.pyx":553 * 'string': make_string_check, * 'boolean': make_boolean_check, * 'double': make_double_check, # <<<<<<<<<<<<<< * 'float': make_float_check, * 'long': make_long_check, */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_double_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 434, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_double_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 553, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_double, __pyx_t_1) < 0) __PYX_ERR(0, 429, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_double, __pyx_t_1) < 0) __PYX_ERR(0, 548, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":435 + /* "spavro/fast_binary.pyx":554 * 'boolean': make_boolean_check, * 'double': make_double_check, * 'float': make_float_check, # <<<<<<<<<<<<<< * 'long': make_long_check, * 'bytes': make_byte_check, */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_float_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 435, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_float_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_float, __pyx_t_1) < 0) __PYX_ERR(0, 429, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_float, __pyx_t_1) < 0) __PYX_ERR(0, 548, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":436 + /* "spavro/fast_binary.pyx":555 * 'double': make_double_check, * 'float': make_float_check, * 'long': make_long_check, # <<<<<<<<<<<<<< * 'bytes': make_byte_check, * 'int': make_long_check, */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_long_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 436, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_long_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 555, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_long, __pyx_t_1) < 0) __PYX_ERR(0, 429, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_long, __pyx_t_1) < 0) __PYX_ERR(0, 548, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":437 + /* "spavro/fast_binary.pyx":556 * 'float': make_float_check, * 'long': make_long_check, * 'bytes': make_byte_check, # <<<<<<<<<<<<<< * 'int': make_long_check, * 'fixed': make_fixed_check, */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_byte_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 437, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_byte_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 556, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_bytes, __pyx_t_1) < 0) __PYX_ERR(0, 429, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_bytes, __pyx_t_1) < 0) __PYX_ERR(0, 548, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":438 + /* "spavro/fast_binary.pyx":557 * 'long': make_long_check, * 'bytes': make_byte_check, * 'int': make_long_check, # <<<<<<<<<<<<<< * 'fixed': make_fixed_check, * 'enum': make_enum_check, */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_long_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 438, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_long_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_int, __pyx_t_1) < 0) __PYX_ERR(0, 429, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_int, __pyx_t_1) < 0) __PYX_ERR(0, 548, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":439 + /* "spavro/fast_binary.pyx":558 * 'bytes': make_byte_check, * 'int': make_long_check, * 'fixed': make_fixed_check, # <<<<<<<<<<<<<< * 'enum': make_enum_check, * 'array': make_array_check, */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_fixed_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_fixed_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 558, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_fixed, __pyx_t_1) < 0) __PYX_ERR(0, 429, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_fixed, __pyx_t_1) < 0) __PYX_ERR(0, 548, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":440 + /* "spavro/fast_binary.pyx":559 * 'int': make_long_check, * 'fixed': make_fixed_check, * 'enum': make_enum_check, # <<<<<<<<<<<<<< * 'array': make_array_check, * 'map': make_map_check */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_enum_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 440, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_enum_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 559, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_enum, __pyx_t_1) < 0) __PYX_ERR(0, 429, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_enum, __pyx_t_1) < 0) __PYX_ERR(0, 548, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":441 + /* "spavro/fast_binary.pyx":560 * 'fixed': make_fixed_check, * 'enum': make_enum_check, * 'array': make_array_check, # <<<<<<<<<<<<<< * 'map': make_map_check * } */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_array_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 441, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_array_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 560, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_array, __pyx_t_1) < 0) __PYX_ERR(0, 429, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_array, __pyx_t_1) < 0) __PYX_ERR(0, 548, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":442 + /* "spavro/fast_binary.pyx":561 * 'enum': make_enum_check, * 'array': make_array_check, * 'map': make_map_check # <<<<<<<<<<<<<< * } * */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_map_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 442, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_map_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 561, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_map, __pyx_t_1) < 0) __PYX_ERR(0, 429, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_map, __pyx_t_1) < 0) __PYX_ERR(0, 548, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_type_map, __pyx_t_2) < 0) __PYX_ERR(0, 428, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_type_map, __pyx_t_2) < 0) __PYX_ERR(0, 547, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":447 + /* "spavro/fast_binary.pyx":566 * # ==================== * * def lookup_schema(schema): # <<<<<<<<<<<<<< * '''Check if a schema is a standard type, if not, lookup in the custom * schema dictionary and replace the custom name with the expanded original */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_65lookup_schema, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 447, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_65lookup_schema, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 566, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_lookup_schema, __pyx_t_2) < 0) __PYX_ERR(0, 447, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_lookup_schema, __pyx_t_2) < 0) __PYX_ERR(0, 566, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":477 + /* "spavro/fast_binary.pyx":596 * * * def make_union_writer(union_schema): # <<<<<<<<<<<<<< * cdef list type_list = [get_type(lookup_schema(schema)) for schema in union_schema] * # cdef dict writer_lookup */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_67make_union_writer, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 477, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_union_writer, __pyx_t_2) < 0) __PYX_ERR(0, 477, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "spavro/fast_binary.pyx":561 - * return write_union - * - * def make_enum_writer(schema): # <<<<<<<<<<<<<< - * cdef list symbols = schema['symbols'] - * - */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_69make_enum_writer, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 561, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_67make_union_writer, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 596, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_enum_writer, __pyx_t_2) < 0) __PYX_ERR(0, 561, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_union_writer, __pyx_t_2) < 0) __PYX_ERR(0, 596, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":572 - * + /* "spavro/fast_binary.pyx":675 + * return [0, writer_lookup] * * def make_record_writer(schema): # <<<<<<<<<<<<<< * cdef list fields = [WriteField(field['name'], get_writer(field['type'])) for field in schema['fields']] - * + * return [1, fields] */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_71make_record_writer, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 572, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_69make_record_writer, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 675, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_record_writer, __pyx_t_2) < 0) __PYX_ERR(0, 572, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_record_writer, __pyx_t_2) < 0) __PYX_ERR(0, 675, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":585 - * + /* "spavro/fast_binary.pyx":679 + * return [1, fields] * - * def make_array_writer(schema): # <<<<<<<<<<<<<< - * item_writer = get_writer(schema['items']) + * def make_null_writer(schema): # <<<<<<<<<<<<<< + * return [2] * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_73make_array_writer, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 585, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_71make_null_writer, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 679, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_array_writer, __pyx_t_2) < 0) __PYX_ERR(0, 585, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_null_writer, __pyx_t_2) < 0) __PYX_ERR(0, 679, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":599 - * + /* "spavro/fast_binary.pyx":682 + * return [2] * - * def make_map_writer(schema): # <<<<<<<<<<<<<< - * map_value_writer = get_writer(schema['values']) + * def make_string_writer(schema): # <<<<<<<<<<<<<< + * return [3] * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_75make_map_writer, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 599, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_73make_string_writer, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 682, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_map_writer, __pyx_t_2) < 0) __PYX_ERR(0, 599, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_string_writer, __pyx_t_2) < 0) __PYX_ERR(0, 682, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":614 - * + /* "spavro/fast_binary.pyx":685 + * return [3] * * def make_boolean_writer(schema): # <<<<<<<<<<<<<< * '''Create a boolean writer, adds a validation step before the actual * write function''' */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_77make_boolean_writer, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 614, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_75make_boolean_writer, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 685, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_boolean_writer, __pyx_t_2) < 0) __PYX_ERR(0, 614, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_boolean_writer, __pyx_t_2) < 0) __PYX_ERR(0, 685, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":624 + /* "spavro/fast_binary.pyx":690 + * return [4] * + * def make_double_writer(schema): # <<<<<<<<<<<<<< + * return [5] * - * def make_fixed_writer(schema): # <<<<<<<<<<<<<< - * '''A writer that must write X bytes defined by the schema''' - * cdef long size = schema['size'] */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_79make_fixed_writer, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 624, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_77make_double_writer, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 690, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_fixed_writer, __pyx_t_2) < 0) __PYX_ERR(0, 624, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_double_writer, __pyx_t_2) < 0) __PYX_ERR(0, 690, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":636 + /* "spavro/fast_binary.pyx":693 + * return [5] * + * def make_float_writer(schema): # <<<<<<<<<<<<<< + * return [6] * - * def make_int_writer(schema): # <<<<<<<<<<<<<< - * '''Create a int writer, adds a validation step before the actual - * write function to make sure the int value doesn't overflow''' */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_81make_int_writer, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 636, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_79make_float_writer, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 693, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_int_writer, __pyx_t_2) < 0) __PYX_ERR(0, 636, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_float_writer, __pyx_t_2) < 0) __PYX_ERR(0, 693, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":648 - * + /* "spavro/fast_binary.pyx":696 + * return [6] * * def make_long_writer(schema): # <<<<<<<<<<<<<< * '''Create a long writer, adds a validation step before the actual * write function to make sure the long value doesn't overflow''' */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_83make_long_writer, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 648, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_81make_long_writer, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 696, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_long_writer, __pyx_t_2) < 0) __PYX_ERR(0, 648, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_long_writer, __pyx_t_2) < 0) __PYX_ERR(0, 696, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":659 + /* "spavro/fast_binary.pyx":701 + * return [7] * + * def make_byte_writer(schema): # <<<<<<<<<<<<<< + * return [8] * - * def make_string_writer(schema): # <<<<<<<<<<<<<< - * def checked_string_writer(outbuf, datum): - * if not isinstance(datum, six.string_types): */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_85make_string_writer, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 659, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_83make_byte_writer, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 701, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_string_writer, __pyx_t_2) < 0) __PYX_ERR(0, 659, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_byte_writer, __pyx_t_2) < 0) __PYX_ERR(0, 701, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":667 - * - * - * def make_byte_writer(schema): # <<<<<<<<<<<<<< - * return write_bytes + /* "spavro/fast_binary.pyx":704 + * return [8] * + * def make_int_writer(schema): # <<<<<<<<<<<<<< + * '''Create a int writer, adds a validation step before the actual + * write function to make sure the int value doesn't overflow''' */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_87make_byte_writer, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 667, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_85make_int_writer, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 704, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_byte_writer, __pyx_t_2) < 0) __PYX_ERR(0, 667, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_int_writer, __pyx_t_2) < 0) __PYX_ERR(0, 704, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":671 - * - * - * def make_float_writer(schema): # <<<<<<<<<<<<<< - * return write_float + /* "spavro/fast_binary.pyx":709 + * return [9] * + * def make_fixed_writer(schema): # <<<<<<<<<<<<<< + * '''A writer that must write X bytes defined by the schema''' + * cdef long size = schema['size'] */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_89make_float_writer, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 671, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_87make_fixed_writer, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 709, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_float_writer, __pyx_t_2) < 0) __PYX_ERR(0, 671, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_fixed_writer, __pyx_t_2) < 0) __PYX_ERR(0, 709, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":675 - * - * - * def make_double_writer(schema): # <<<<<<<<<<<<<< - * return write_double + /* "spavro/fast_binary.pyx":716 + * return [10, size] * + * def make_enum_writer(schema): # <<<<<<<<<<<<<< + * cdef list symbols = schema['symbols'] + * return [11, symbols] */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_91make_double_writer, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 675, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_89make_enum_writer, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 716, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_double_writer, __pyx_t_2) < 0) __PYX_ERR(0, 675, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_enum_writer, __pyx_t_2) < 0) __PYX_ERR(0, 716, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":679 + /* "spavro/fast_binary.pyx":720 + * return [11, symbols] * + * def make_array_writer(schema): # <<<<<<<<<<<<<< + * cdef list item_writer = get_writer(schema['items']) + * return [12, item_writer] + */ + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_91make_array_writer, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 720, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_array_writer, __pyx_t_2) < 0) __PYX_ERR(0, 720, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spavro/fast_binary.pyx":724 + * return [12, item_writer] * - * def make_null_writer(schema): # <<<<<<<<<<<<<< - * return write_null - * + * def make_map_writer(schema): # <<<<<<<<<<<<<< + * cdef list map_value_writer = get_writer(schema['values']) + * return [13, map_value_writer] */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_93make_null_writer, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 679, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_93make_map_writer, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_null_writer, __pyx_t_2) < 0) __PYX_ERR(0, 679, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_map_writer, __pyx_t_2) < 0) __PYX_ERR(0, 724, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":685 + /* "spavro/fast_binary.pyx":731 * # writer * writer_type_map = { * 'union': make_union_writer, # <<<<<<<<<<<<<< * 'record': make_record_writer, * 'null': make_null_writer, */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(14); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 685, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(14); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 731, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_union_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 685, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_union_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 731, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_union, __pyx_t_1) < 0) __PYX_ERR(0, 685, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_union, __pyx_t_1) < 0) __PYX_ERR(0, 731, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":686 + /* "spavro/fast_binary.pyx":732 * writer_type_map = { * 'union': make_union_writer, * 'record': make_record_writer, # <<<<<<<<<<<<<< * 'null': make_null_writer, * 'string': make_string_writer, */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_record_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 686, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_record_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 732, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_record, __pyx_t_1) < 0) __PYX_ERR(0, 685, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_record, __pyx_t_1) < 0) __PYX_ERR(0, 731, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":687 + /* "spavro/fast_binary.pyx":733 * 'union': make_union_writer, * 'record': make_record_writer, * 'null': make_null_writer, # <<<<<<<<<<<<<< * 'string': make_string_writer, * 'boolean': make_boolean_writer, */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_null_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 687, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_null_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 733, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_null, __pyx_t_1) < 0) __PYX_ERR(0, 685, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_null, __pyx_t_1) < 0) __PYX_ERR(0, 731, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":688 + /* "spavro/fast_binary.pyx":734 * 'record': make_record_writer, * 'null': make_null_writer, * 'string': make_string_writer, # <<<<<<<<<<<<<< * 'boolean': make_boolean_writer, * 'double': make_double_writer, */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_string_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 688, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_string_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 734, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_string, __pyx_t_1) < 0) __PYX_ERR(0, 685, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_string, __pyx_t_1) < 0) __PYX_ERR(0, 731, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":689 + /* "spavro/fast_binary.pyx":735 * 'null': make_null_writer, * 'string': make_string_writer, * 'boolean': make_boolean_writer, # <<<<<<<<<<<<<< * 'double': make_double_writer, * 'float': make_float_writer, */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_boolean_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 689, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_boolean_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 735, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_boolean, __pyx_t_1) < 0) __PYX_ERR(0, 685, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_boolean, __pyx_t_1) < 0) __PYX_ERR(0, 731, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":690 + /* "spavro/fast_binary.pyx":736 * 'string': make_string_writer, * 'boolean': make_boolean_writer, * 'double': make_double_writer, # <<<<<<<<<<<<<< * 'float': make_float_writer, * 'long': make_long_writer, */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_double_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 690, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_double_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 736, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_double, __pyx_t_1) < 0) __PYX_ERR(0, 685, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_double, __pyx_t_1) < 0) __PYX_ERR(0, 731, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":691 + /* "spavro/fast_binary.pyx":737 * 'boolean': make_boolean_writer, * 'double': make_double_writer, * 'float': make_float_writer, # <<<<<<<<<<<<<< * 'long': make_long_writer, * 'bytes': make_byte_writer, */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_float_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 691, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_float_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 737, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_float, __pyx_t_1) < 0) __PYX_ERR(0, 685, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_float, __pyx_t_1) < 0) __PYX_ERR(0, 731, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":692 + /* "spavro/fast_binary.pyx":738 * 'double': make_double_writer, * 'float': make_float_writer, * 'long': make_long_writer, # <<<<<<<<<<<<<< * 'bytes': make_byte_writer, * 'int': make_int_writer, */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_long_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 692, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_long_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 738, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_long, __pyx_t_1) < 0) __PYX_ERR(0, 685, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_long, __pyx_t_1) < 0) __PYX_ERR(0, 731, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":693 + /* "spavro/fast_binary.pyx":739 * 'float': make_float_writer, * 'long': make_long_writer, * 'bytes': make_byte_writer, # <<<<<<<<<<<<<< * 'int': make_int_writer, * 'fixed': make_fixed_writer, */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_byte_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 693, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_byte_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 739, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_bytes, __pyx_t_1) < 0) __PYX_ERR(0, 685, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_bytes, __pyx_t_1) < 0) __PYX_ERR(0, 731, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":694 + /* "spavro/fast_binary.pyx":740 * 'long': make_long_writer, * 'bytes': make_byte_writer, * 'int': make_int_writer, # <<<<<<<<<<<<<< * 'fixed': make_fixed_writer, * 'enum': make_enum_writer, */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_int_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 694, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_int_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 740, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_int, __pyx_t_1) < 0) __PYX_ERR(0, 685, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_int, __pyx_t_1) < 0) __PYX_ERR(0, 731, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":695 + /* "spavro/fast_binary.pyx":741 * 'bytes': make_byte_writer, * 'int': make_int_writer, * 'fixed': make_fixed_writer, # <<<<<<<<<<<<<< * 'enum': make_enum_writer, * 'array': make_array_writer, */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_fixed_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 695, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_fixed_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 741, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_fixed, __pyx_t_1) < 0) __PYX_ERR(0, 685, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_fixed, __pyx_t_1) < 0) __PYX_ERR(0, 731, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":696 + /* "spavro/fast_binary.pyx":742 * 'int': make_int_writer, * 'fixed': make_fixed_writer, * 'enum': make_enum_writer, # <<<<<<<<<<<<<< * 'array': make_array_writer, * 'map': make_map_writer */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_enum_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 696, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_enum_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 742, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_enum, __pyx_t_1) < 0) __PYX_ERR(0, 685, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_enum, __pyx_t_1) < 0) __PYX_ERR(0, 731, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":697 + /* "spavro/fast_binary.pyx":743 * 'fixed': make_fixed_writer, * 'enum': make_enum_writer, * 'array': make_array_writer, # <<<<<<<<<<<<<< * 'map': make_map_writer * } */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_array_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 697, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_array_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 743, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_array, __pyx_t_1) < 0) __PYX_ERR(0, 685, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_array, __pyx_t_1) < 0) __PYX_ERR(0, 731, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":698 + /* "spavro/fast_binary.pyx":744 * 'enum': make_enum_writer, * 'array': make_array_writer, * 'map': make_map_writer # <<<<<<<<<<<<<< * } * */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_map_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 698, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_make_map_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 744, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_map, __pyx_t_1) < 0) __PYX_ERR(0, 685, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_map, __pyx_t_1) < 0) __PYX_ERR(0, 731, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_writer_type_map, __pyx_t_2) < 0) __PYX_ERR(0, 684, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_writer_type_map, __pyx_t_2) < 0) __PYX_ERR(0, 730, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":701 + /* "spavro/fast_binary.pyx":747 * } * * custom_schema = {} # <<<<<<<<<<<<<< * * class WriterPlaceholder(object): */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 701, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 747, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_custom_schema, __pyx_t_2) < 0) __PYX_ERR(0, 701, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_custom_schema, __pyx_t_2) < 0) __PYX_ERR(0, 747, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":703 + /* "spavro/fast_binary.pyx":749 * custom_schema = {} * * class WriterPlaceholder(object): # <<<<<<<<<<<<<< * def __init__(self): * self.writer = None */ - __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__176); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 703, __pyx_L1_error) + __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__150); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 749, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_tuple__176, __pyx_n_s_WriterPlaceholder, __pyx_n_s_WriterPlaceholder, (PyObject *) NULL, __pyx_n_s_spavro_fast_binary, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 703, __pyx_L1_error) + __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_tuple__150, __pyx_n_s_WriterPlaceholder, __pyx_n_s_WriterPlaceholder, (PyObject *) NULL, __pyx_n_s_spavro_fast_binary, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 749, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - /* "spavro/fast_binary.pyx":704 + /* "spavro/fast_binary.pyx":750 * * class WriterPlaceholder(object): * def __init__(self): # <<<<<<<<<<<<<< * self.writer = None * */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17WriterPlaceholder_1__init__, 0, __pyx_n_s_WriterPlaceholder___init, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__178)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 704, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 704, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "spavro/fast_binary.pyx":707 - * self.writer = None - * - * def __call__(self, fo, val): # <<<<<<<<<<<<<< - * return self.writer(fo, val) - * - */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17WriterPlaceholder_3__call__, 0, __pyx_n_s_WriterPlaceholder___call, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__180)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 707, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17WriterPlaceholder_1__init__, 0, __pyx_n_s_WriterPlaceholder___init, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__152)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 750, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_call, __pyx_t_3) < 0) __PYX_ERR(0, 707, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 750, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":703 + /* "spavro/fast_binary.pyx":749 * custom_schema = {} * * class WriterPlaceholder(object): # <<<<<<<<<<<<<< * def __init__(self): * self.writer = None */ - __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_WriterPlaceholder, __pyx_tuple__176, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 703, __pyx_L1_error) + __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_WriterPlaceholder, __pyx_tuple__150, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 749, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_WriterPlaceholder, __pyx_t_3) < 0) __PYX_ERR(0, 703, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_WriterPlaceholder, __pyx_t_3) < 0) __PYX_ERR(0, 749, __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; - /* "spavro/fast_binary.pyx":711 + /* "spavro/fast_binary.pyx":754 * * * def get_writer(schema): # <<<<<<<<<<<<<< * cdef unicode schema_type = get_type(schema) * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_95get_writer, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 711, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_95get_writer, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 754, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_writer, __pyx_t_2) < 0) __PYX_ERR(0, 711, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_writer, __pyx_t_2) < 0) __PYX_ERR(0, 754, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":741 + /* "spavro/fast_binary.pyx":784 * * * import struct # <<<<<<<<<<<<<< * from binascii import crc32 * */ - __pyx_t_2 = __Pyx_Import(__pyx_n_s_struct, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 741, __pyx_L1_error) + __pyx_t_2 = __Pyx_Import(__pyx_n_s_struct, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 784, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_struct, __pyx_t_2) < 0) __PYX_ERR(0, 741, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_struct, __pyx_t_2) < 0) __PYX_ERR(0, 784, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "spavro/fast_binary.pyx":742 + /* "spavro/fast_binary.pyx":785 * * import struct * from binascii import crc32 # <<<<<<<<<<<<<< * * */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 742, __pyx_L1_error) + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 785, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_crc32); __Pyx_GIVEREF(__pyx_n_s_crc32); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_crc32); - __pyx_t_1 = __Pyx_Import(__pyx_n_s_binascii, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 742, __pyx_L1_error) + __pyx_t_1 = __Pyx_Import(__pyx_n_s_binascii, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 785, __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_crc32); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 742, __pyx_L1_error) + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_crc32); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 785, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_crc32, __pyx_t_2) < 0) __PYX_ERR(0, 742, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_crc32, __pyx_t_2) < 0) __PYX_ERR(0, 785, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "spavro/fast_binary.pyx":745 + /* "spavro/fast_binary.pyx":788 * * * class FastBinaryEncoder(object): # <<<<<<<<<<<<<< * """Write leaf values.""" * def __init__(self, writer): */ - __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__183); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 745, __pyx_L1_error) + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__155); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 788, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__183, __pyx_n_s_FastBinaryEncoder, __pyx_n_s_FastBinaryEncoder, (PyObject *) NULL, __pyx_n_s_spavro_fast_binary, __pyx_kp_s_Write_leaf_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 745, __pyx_L1_error) + __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__155, __pyx_n_s_FastBinaryEncoder, __pyx_n_s_FastBinaryEncoder, (PyObject *) NULL, __pyx_n_s_spavro_fast_binary, __pyx_kp_s_Write_leaf_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 788, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - /* "spavro/fast_binary.pyx":747 + /* "spavro/fast_binary.pyx":790 * class FastBinaryEncoder(object): * """Write leaf values.""" * def __init__(self, writer): # <<<<<<<<<<<<<< * """ * writer is a Python object on which we can call write. */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_1__init__, 0, __pyx_n_s_FastBinaryEncoder___init, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__185)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 747, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_1__init__, 0, __pyx_n_s_FastBinaryEncoder___init, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__157)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 790, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 747, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 790, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":753 + /* "spavro/fast_binary.pyx":796 * self.writer = writer * * def write(self, datum): # <<<<<<<<<<<<<< * self.writer.write(datum) * */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_3write, 0, __pyx_n_s_FastBinaryEncoder_write, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__187)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 753, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_3write, 0, __pyx_n_s_FastBinaryEncoder_write, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__159)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 796, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_write, __pyx_t_3) < 0) __PYX_ERR(0, 753, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_write, __pyx_t_3) < 0) __PYX_ERR(0, 796, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":756 + /* "spavro/fast_binary.pyx":799 * self.writer.write(datum) * * def write_null(self, datum): # <<<<<<<<<<<<<< * pass * */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_5write_null, 0, __pyx_n_s_FastBinaryEncoder_write_null, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__189)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 756, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_5write_null, 0, __pyx_n_s_FastBinaryEncoder_write_null, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__161)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 799, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_write_null, __pyx_t_3) < 0) __PYX_ERR(0, 756, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_write_null, __pyx_t_3) < 0) __PYX_ERR(0, 799, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":759 + /* "spavro/fast_binary.pyx":802 * pass * * def write_boolean(self, datum): # <<<<<<<<<<<<<< * write_boolean(self.writer, datum) * */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_7write_boolean, 0, __pyx_n_s_FastBinaryEncoder_write_boolean, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__191)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 759, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_7write_boolean, 0, __pyx_n_s_FastBinaryEncoder_write_boolean, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__163)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 802, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_write_boolean, __pyx_t_3) < 0) __PYX_ERR(0, 759, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_write_boolean, __pyx_t_3) < 0) __PYX_ERR(0, 802, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":762 + /* "spavro/fast_binary.pyx":805 * write_boolean(self.writer, datum) * * def write_int(self, datum): # <<<<<<<<<<<<<< * write_int(self.writer, datum) * */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_9write_int, 0, __pyx_n_s_FastBinaryEncoder_write_int, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__193)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 762, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_9write_int, 0, __pyx_n_s_FastBinaryEncoder_write_int, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__165)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 805, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_write_int, __pyx_t_3) < 0) __PYX_ERR(0, 762, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_write_int, __pyx_t_3) < 0) __PYX_ERR(0, 805, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":765 + /* "spavro/fast_binary.pyx":808 * write_int(self.writer, datum) * * def write_long(self, datum): # <<<<<<<<<<<<<< * write_long(self.writer, datum) * */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_11write_long, 0, __pyx_n_s_FastBinaryEncoder_write_long, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__195)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 765, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_11write_long, 0, __pyx_n_s_FastBinaryEncoder_write_long, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__167)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 808, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_write_long, __pyx_t_3) < 0) __PYX_ERR(0, 765, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_write_long, __pyx_t_3) < 0) __PYX_ERR(0, 808, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":768 + /* "spavro/fast_binary.pyx":811 * write_long(self.writer, datum) * * def write_float(self, datum): # <<<<<<<<<<<<<< * write_float(self.writer, datum) * */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_13write_float, 0, __pyx_n_s_FastBinaryEncoder_write_float, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__197)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 768, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_13write_float, 0, __pyx_n_s_FastBinaryEncoder_write_float, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__169)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 811, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_write_float, __pyx_t_3) < 0) __PYX_ERR(0, 768, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_write_float, __pyx_t_3) < 0) __PYX_ERR(0, 811, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":771 + /* "spavro/fast_binary.pyx":814 * write_float(self.writer, datum) * * def write_double(self, datum): # <<<<<<<<<<<<<< * write_double(self.writer, datum) * */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_15write_double, 0, __pyx_n_s_FastBinaryEncoder_write_double, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__199)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 771, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_15write_double, 0, __pyx_n_s_FastBinaryEncoder_write_double, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__171)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 814, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_write_double, __pyx_t_3) < 0) __PYX_ERR(0, 771, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_write_double, __pyx_t_3) < 0) __PYX_ERR(0, 814, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":774 + /* "spavro/fast_binary.pyx":817 * write_double(self.writer, datum) * * def write_bytes(self, datum): # <<<<<<<<<<<<<< * write_bytes(self.writer, datum) * */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_17write_bytes, 0, __pyx_n_s_FastBinaryEncoder_write_bytes, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__201)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 774, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_17write_bytes, 0, __pyx_n_s_FastBinaryEncoder_write_bytes, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__173)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 817, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_write_bytes, __pyx_t_3) < 0) __PYX_ERR(0, 774, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_write_bytes, __pyx_t_3) < 0) __PYX_ERR(0, 817, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":777 + /* "spavro/fast_binary.pyx":820 * write_bytes(self.writer, datum) * * def write_utf8(self, datum): # <<<<<<<<<<<<<< * write_utf8(self.writer, datum) * */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_19write_utf8, 0, __pyx_n_s_FastBinaryEncoder_write_utf8, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__203)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 777, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_19write_utf8, 0, __pyx_n_s_FastBinaryEncoder_write_utf8, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__175)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 820, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_write_utf8, __pyx_t_3) < 0) __PYX_ERR(0, 777, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_write_utf8, __pyx_t_3) < 0) __PYX_ERR(0, 820, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":780 + /* "spavro/fast_binary.pyx":823 * write_utf8(self.writer, datum) * * def write_crc32(self, bytes): # <<<<<<<<<<<<<< * """ * A 4-byte, big-endian CRC32 checksum */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_21write_crc32, 0, __pyx_n_s_FastBinaryEncoder_write_crc32, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__205)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 780, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryEncoder_21write_crc32, 0, __pyx_n_s_FastBinaryEncoder_write_crc32, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__177)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 823, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_write_crc32, __pyx_t_3) < 0) __PYX_ERR(0, 780, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_write_crc32, __pyx_t_3) < 0) __PYX_ERR(0, 823, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":745 + /* "spavro/fast_binary.pyx":788 * * * class FastBinaryEncoder(object): # <<<<<<<<<<<<<< * """Write leaf values.""" * def __init__(self, writer): */ - __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_FastBinaryEncoder, __pyx_tuple__183, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 745, __pyx_L1_error) + __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_FastBinaryEncoder, __pyx_tuple__155, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 788, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_FastBinaryEncoder, __pyx_t_3) < 0) __PYX_ERR(0, 745, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_FastBinaryEncoder, __pyx_t_3) < 0) __PYX_ERR(0, 788, __pyx_L1_error) __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; - /* "spavro/fast_binary.pyx":788 + /* "spavro/fast_binary.pyx":831 * * * class FastBinaryDecoder(object): # <<<<<<<<<<<<<< * """Read leaf values.""" * def __init__(self, reader): */ - __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__206); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 788, __pyx_L1_error) + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__178); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 831, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__206, __pyx_n_s_FastBinaryDecoder, __pyx_n_s_FastBinaryDecoder, (PyObject *) NULL, __pyx_n_s_spavro_fast_binary, __pyx_kp_s_Read_leaf_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 788, __pyx_L1_error) + __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__178, __pyx_n_s_FastBinaryDecoder, __pyx_n_s_FastBinaryDecoder, (PyObject *) NULL, __pyx_n_s_spavro_fast_binary, __pyx_kp_s_Read_leaf_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 831, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - /* "spavro/fast_binary.pyx":790 + /* "spavro/fast_binary.pyx":833 * class FastBinaryDecoder(object): * """Read leaf values.""" * def __init__(self, reader): # <<<<<<<<<<<<<< * """ * reader is a Python object on which we can call read, seek, and tell. */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_1__init__, 0, __pyx_n_s_FastBinaryDecoder___init, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__208)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 790, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_1__init__, 0, __pyx_n_s_FastBinaryDecoder___init, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__180)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 833, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 790, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 833, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":796 + /* "spavro/fast_binary.pyx":839 * self.reader = reader * * def read(self, n): # <<<<<<<<<<<<<< * return self.reader.read(n) * */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_3read, 0, __pyx_n_s_FastBinaryDecoder_read, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__210)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 796, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_3read, 0, __pyx_n_s_FastBinaryDecoder_read, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__182)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 839, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_read, __pyx_t_3) < 0) __PYX_ERR(0, 796, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_read, __pyx_t_3) < 0) __PYX_ERR(0, 839, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":799 + /* "spavro/fast_binary.pyx":842 * return self.reader.read(n) * * def read_null(self): # <<<<<<<<<<<<<< * return None * */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_5read_null, 0, __pyx_n_s_FastBinaryDecoder_read_null, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__212)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 799, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_5read_null, 0, __pyx_n_s_FastBinaryDecoder_read_null, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__184)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 842, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_read_null, __pyx_t_3) < 0) __PYX_ERR(0, 799, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_read_null, __pyx_t_3) < 0) __PYX_ERR(0, 842, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":802 + /* "spavro/fast_binary.pyx":845 * return None * * def read_boolean(self): # <<<<<<<<<<<<<< * return read_boolean(self.reader) * */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_7read_boolean, 0, __pyx_n_s_FastBinaryDecoder_read_boolean, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__214)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 802, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_7read_boolean, 0, __pyx_n_s_FastBinaryDecoder_read_boolean, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__186)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 845, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_read_boolean, __pyx_t_3) < 0) __PYX_ERR(0, 802, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_read_boolean, __pyx_t_3) < 0) __PYX_ERR(0, 845, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":805 + /* "spavro/fast_binary.pyx":848 * return read_boolean(self.reader) * * def read_int(self): # <<<<<<<<<<<<<< * return read_long(self.reader) * */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_9read_int, 0, __pyx_n_s_FastBinaryDecoder_read_int, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__216)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 805, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_9read_int, 0, __pyx_n_s_FastBinaryDecoder_read_int, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__188)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 848, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_read_int, __pyx_t_3) < 0) __PYX_ERR(0, 805, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_read_int, __pyx_t_3) < 0) __PYX_ERR(0, 848, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":808 + /* "spavro/fast_binary.pyx":851 * return read_long(self.reader) * * def read_long(self): # <<<<<<<<<<<<<< * return read_long(self.reader) * */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_11read_long, 0, __pyx_n_s_FastBinaryDecoder_read_long, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__218)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 808, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_11read_long, 0, __pyx_n_s_FastBinaryDecoder_read_long, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__190)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 851, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_read_long, __pyx_t_3) < 0) __PYX_ERR(0, 808, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_read_long, __pyx_t_3) < 0) __PYX_ERR(0, 851, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":811 + /* "spavro/fast_binary.pyx":854 * return read_long(self.reader) * * def read_float(self): # <<<<<<<<<<<<<< * return read_float(self.reader) * */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_13read_float, 0, __pyx_n_s_FastBinaryDecoder_read_float, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__220)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 811, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_13read_float, 0, __pyx_n_s_FastBinaryDecoder_read_float, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__192)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 854, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_read_float, __pyx_t_3) < 0) __PYX_ERR(0, 811, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_read_float, __pyx_t_3) < 0) __PYX_ERR(0, 854, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":814 + /* "spavro/fast_binary.pyx":857 * return read_float(self.reader) * * def read_double(self): # <<<<<<<<<<<<<< * return read_double(self.reader) * */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_15read_double, 0, __pyx_n_s_FastBinaryDecoder_read_double, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__222)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 814, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_15read_double, 0, __pyx_n_s_FastBinaryDecoder_read_double, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__194)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 857, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_read_double, __pyx_t_3) < 0) __PYX_ERR(0, 814, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_read_double, __pyx_t_3) < 0) __PYX_ERR(0, 857, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":817 + /* "spavro/fast_binary.pyx":860 * return read_double(self.reader) * * def read_bytes(self): # <<<<<<<<<<<<<< * return read_bytes(self.reader) * */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_17read_bytes, 0, __pyx_n_s_FastBinaryDecoder_read_bytes, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__224)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 817, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_17read_bytes, 0, __pyx_n_s_FastBinaryDecoder_read_bytes, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__196)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 860, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_read_bytes, __pyx_t_3) < 0) __PYX_ERR(0, 817, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_read_bytes, __pyx_t_3) < 0) __PYX_ERR(0, 860, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":820 + /* "spavro/fast_binary.pyx":863 * return read_bytes(self.reader) * * def read_utf8(self): # <<<<<<<<<<<<<< * return read_utf8(self.reader) * */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_19read_utf8, 0, __pyx_n_s_FastBinaryDecoder_read_utf8, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__226)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 820, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_19read_utf8, 0, __pyx_n_s_FastBinaryDecoder_read_utf8, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__198)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 863, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_read_utf8, __pyx_t_3) < 0) __PYX_ERR(0, 820, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_read_utf8, __pyx_t_3) < 0) __PYX_ERR(0, 863, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":823 + /* "spavro/fast_binary.pyx":866 * return read_utf8(self.reader) * * def check_crc32(self, bytes): # <<<<<<<<<<<<<< * checksum = struct.unpack("!I", self.reader.read(4))[0] * if crc32(bytes) & 0xffffffff != checksum: */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_21check_crc32, 0, __pyx_n_s_FastBinaryDecoder_check_crc32, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__228)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 823, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_21check_crc32, 0, __pyx_n_s_FastBinaryDecoder_check_crc32, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__200)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 866, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_check_crc32, __pyx_t_3) < 0) __PYX_ERR(0, 823, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_check_crc32, __pyx_t_3) < 0) __PYX_ERR(0, 866, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":828 + /* "spavro/fast_binary.pyx":871 * raise RuntimeError("Checksum failure") * * def skip_null(self): # <<<<<<<<<<<<<< * pass * */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_23skip_null, 0, __pyx_n_s_FastBinaryDecoder_skip_null, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__230)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 828, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_23skip_null, 0, __pyx_n_s_FastBinaryDecoder_skip_null, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__202)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 871, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_skip_null, __pyx_t_3) < 0) __PYX_ERR(0, 828, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_skip_null, __pyx_t_3) < 0) __PYX_ERR(0, 871, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":831 + /* "spavro/fast_binary.pyx":874 * pass * * def skip_boolean(self): # <<<<<<<<<<<<<< * self.reader.read(1) * */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_25skip_boolean, 0, __pyx_n_s_FastBinaryDecoder_skip_boolean, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__232)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 831, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_25skip_boolean, 0, __pyx_n_s_FastBinaryDecoder_skip_boolean, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__204)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 874, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_skip_boolean, __pyx_t_3) < 0) __PYX_ERR(0, 831, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_skip_boolean, __pyx_t_3) < 0) __PYX_ERR(0, 874, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":834 + /* "spavro/fast_binary.pyx":877 * self.reader.read(1) * * def skip_int(self): # <<<<<<<<<<<<<< * read_long(self.reader) * */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_27skip_int, 0, __pyx_n_s_FastBinaryDecoder_skip_int, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__234)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 834, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_27skip_int, 0, __pyx_n_s_FastBinaryDecoder_skip_int, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__206)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 877, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_skip_int, __pyx_t_3) < 0) __PYX_ERR(0, 834, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_skip_int, __pyx_t_3) < 0) __PYX_ERR(0, 877, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":837 + /* "spavro/fast_binary.pyx":880 * read_long(self.reader) * * def skip_long(self): # <<<<<<<<<<<<<< * read_long(self.reader) * */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_29skip_long, 0, __pyx_n_s_FastBinaryDecoder_skip_long, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__236)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 837, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_29skip_long, 0, __pyx_n_s_FastBinaryDecoder_skip_long, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__208)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 880, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_skip_long, __pyx_t_3) < 0) __PYX_ERR(0, 837, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_skip_long, __pyx_t_3) < 0) __PYX_ERR(0, 880, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":840 + /* "spavro/fast_binary.pyx":883 * read_long(self.reader) * * def skip_float(self): # <<<<<<<<<<<<<< * read_float(self.reader) * */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_31skip_float, 0, __pyx_n_s_FastBinaryDecoder_skip_float, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__238)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 840, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_31skip_float, 0, __pyx_n_s_FastBinaryDecoder_skip_float, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__210)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 883, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_skip_float, __pyx_t_3) < 0) __PYX_ERR(0, 840, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_skip_float, __pyx_t_3) < 0) __PYX_ERR(0, 883, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":843 + /* "spavro/fast_binary.pyx":886 * read_float(self.reader) * * def skip_double(self): # <<<<<<<<<<<<<< * read_double(self.reader) * */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_33skip_double, 0, __pyx_n_s_FastBinaryDecoder_skip_double, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__240)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 843, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_33skip_double, 0, __pyx_n_s_FastBinaryDecoder_skip_double, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__212)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 886, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_skip_double, __pyx_t_3) < 0) __PYX_ERR(0, 843, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_skip_double, __pyx_t_3) < 0) __PYX_ERR(0, 886, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":846 + /* "spavro/fast_binary.pyx":889 * read_double(self.reader) * * def skip_bytes(self): # <<<<<<<<<<<<<< * read_bytes(self.reader) * */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_35skip_bytes, 0, __pyx_n_s_FastBinaryDecoder_skip_bytes, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__242)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 846, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_35skip_bytes, 0, __pyx_n_s_FastBinaryDecoder_skip_bytes, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__214)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 889, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_skip_bytes, __pyx_t_3) < 0) __PYX_ERR(0, 846, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_skip_bytes, __pyx_t_3) < 0) __PYX_ERR(0, 889, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":849 + /* "spavro/fast_binary.pyx":892 * read_bytes(self.reader) * * def skip_utf8(self): # <<<<<<<<<<<<<< * read_utf8(self.reader) * */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_37skip_utf8, 0, __pyx_n_s_FastBinaryDecoder_skip_utf8, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__244)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 849, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_37skip_utf8, 0, __pyx_n_s_FastBinaryDecoder_skip_utf8, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__216)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 892, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_skip_utf8, __pyx_t_3) < 0) __PYX_ERR(0, 849, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_skip_utf8, __pyx_t_3) < 0) __PYX_ERR(0, 892, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":852 + /* "spavro/fast_binary.pyx":895 * read_utf8(self.reader) * * def skip(self, n): # <<<<<<<<<<<<<< * self.reader.seek(self.reader.tell() + n) + * */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_39skip, 0, __pyx_n_s_FastBinaryDecoder_skip, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__246)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 852, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6spavro_11fast_binary_17FastBinaryDecoder_39skip, 0, __pyx_n_s_FastBinaryDecoder_skip, NULL, __pyx_n_s_spavro_fast_binary, __pyx_d, ((PyObject *)__pyx_codeobj__218)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 895, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_skip, __pyx_t_3) < 0) __PYX_ERR(0, 852, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_skip, __pyx_t_3) < 0) __PYX_ERR(0, 895, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "spavro/fast_binary.pyx":788 + /* "spavro/fast_binary.pyx":831 * * * class FastBinaryDecoder(object): # <<<<<<<<<<<<<< * """Read leaf values.""" * def __init__(self, reader): */ - __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_FastBinaryDecoder, __pyx_tuple__206, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 788, __pyx_L1_error) + __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_FastBinaryDecoder, __pyx_tuple__178, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 831, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_FastBinaryDecoder, __pyx_t_3) < 0) __PYX_ERR(0, 788, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_FastBinaryDecoder, __pyx_t_3) < 0) __PYX_ERR(0, 831, __pyx_L1_error) __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; + /* "spavro/fast_binary.pyx":969 + * + * + * def write(iobuffer, datum, writer, schema): # <<<<<<<<<<<<<< + * cdef array.array outbuf = array.array('B', []) + * execute(outbuf, datum, writer) + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6spavro_11fast_binary_97write, NULL, __pyx_n_s_spavro_fast_binary); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 969, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_write, __pyx_t_1) < 0) __PYX_ERR(0, 969, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /* "spavro/fast_binary.pyx":1 * # Copyright (C) 2018 Pluralsight LLC # <<<<<<<<<<<<<< * '''Fast Cython extension for reading / writing and validating AVRO records. @@ -31471,10 +29808,10 @@ if (!__Pyx_RefNanny) { /* "cfunc.to_py":64 * - * @cname("__Pyx_CFunc_void____object____double___to_py") - * cdef object __Pyx_CFunc_void____object____double___to_py(void (*f)(object, double) except *): # <<<<<<<<<<<<<< - * def wrap(object outbuf, double datum): - * """wrap(outbuf, datum: float) -> 'void'""" + * @cname("__Pyx_CFunc_float____object___to_py") + * cdef object __Pyx_CFunc_float____object___to_py(float (*f)(object) except *): # <<<<<<<<<<<<<< + * def wrap(object fo): + * """wrap(fo) -> 'float'""" */ /*--- Wrapped vars code ---*/ @@ -31603,7 +29940,7 @@ static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args return result; } #if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) { +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); PyObject *globals = PyFunction_GET_GLOBALS(func); PyObject *argdefs = PyFunction_GET_DEFAULTS(func); @@ -31674,12 +30011,12 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, } #if PY_MAJOR_VERSION >= 3 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, - args, nargs, + args, (int)nargs, k, (int)nk, d, (int)nd, kwdefs, closure); #else result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, - args, nargs, + args, (int)nargs, k, (int)nk, d, (int)nd, closure); #endif @@ -31695,7 +30032,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #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; + ternaryfunc call = Py_TYPE(func)->tp_call; if (unlikely(!call)) return PyObject_Call(func, arg, kw); if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) @@ -31782,7 +30119,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObjec if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { return __Pyx_PyObject_CallMethO(func, arg); #if CYTHON_FAST_PYCCALL - } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { + } else if (__Pyx_PyFastCFunction_Check(func)) { return __Pyx_PyCFunction_FastCall(func, &arg, 1); #endif } @@ -31835,9 +30172,7 @@ static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, PyGILState_STATE state; if (nogil) state = PyGILState_Ensure(); -#ifdef _MSC_VER - else state = (PyGILState_STATE)-1; -#endif + else state = (PyGILState_STATE)0; #endif __Pyx_PyThreadState_assign __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); @@ -32274,13 +30609,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } PyErr_SetObject(type, value); if (tb) { -#if CYTHON_COMPILING_IN_PYPY - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); - Py_INCREF(tb); - PyErr_Restore(tmp_type, tmp_value, tb); - Py_XDECREF(tmp_tb); -#else +#if CYTHON_FAST_THREAD_STATE PyThreadState *tstate = __Pyx_PyThreadState_Current; PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { @@ -32288,6 +30617,12 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); + Py_INCREF(tb); + PyErr_Restore(tmp_type, tmp_value, tb); + Py_XDECREF(tmp_tb); #endif } bad: @@ -32396,7 +30731,7 @@ static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { goto done; } -/* CythonFunction */ +/* CythonFunctionShared */ #include static PyObject * __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) @@ -32689,7 +31024,8 @@ static PyObject * __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args) { #if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(m->func.m_ml->ml_name); + Py_INCREF(m->func_qualname); + return m->func_qualname; #else return PyString_FromString(m->func.m_ml->ml_name); #endif @@ -32703,10 +31039,9 @@ static PyMethodDef __pyx_CyFunction_methods[] = { #else #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist) #endif -static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname, - PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { - __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type); - if (op == NULL) +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + if (unlikely(op == NULL)) return NULL; op->flags = flags; __Pyx_CyFunction_weakreflist(op) = NULL; @@ -32727,12 +31062,12 @@ static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int f Py_XINCREF(code); op->func_code = code; op->defaults_pyobjects = 0; + op->defaults_size = 0; op->defaults = NULL; op->defaults_tuple = NULL; op->defaults_kwdict = NULL; op->defaults_getter = NULL; op->func_annotations = NULL; - PyObject_GC_Track(op); return (PyObject *) op; } static int @@ -32795,6 +31130,7 @@ static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, } static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) { +#if PY_MAJOR_VERSION < 3 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { Py_INCREF(func); @@ -32807,6 +31143,7 @@ static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObj } if (obj == Py_None) obj = NULL; +#endif return __Pyx_PyMethod_New(func, obj, type); } static PyObject* @@ -32891,6 +31228,14 @@ static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, P self = PyTuple_GetItem(args, 0); if (unlikely(!self)) { Py_DECREF(new_args); +#if PY_MAJOR_VERSION > 2 + PyErr_Format(PyExc_TypeError, + "unbound method %.200S() needs an argument", + cyfunc->func_qualname); +#else + PyErr_SetString(PyExc_TypeError, + "unbound method needs an argument"); +#endif return NULL; } result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); @@ -32959,6 +31304,15 @@ static PyTypeObject __pyx_CyFunctionType_type = { #if PY_VERSION_HEX >= 0x030400a1 0, #endif +#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, +#endif +#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, +#endif +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, +#endif }; static int __pyx_CyFunction_init(void) { __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); @@ -32974,6 +31328,7 @@ static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t return PyErr_NoMemory(); memset(m->defaults, 0, size); m->defaults_pyobjects = pyobjects; + m->defaults_size = size; return m->defaults; } static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { @@ -32992,6 +31347,19 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, Py Py_INCREF(dict); } +/* CythonFunction */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + PyObject *op = __Pyx_CyFunction_Init( + PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType), + ml, flags, qualname, closure, module, globals, code + ); + if (likely(op)) { + PyObject_GC_Track(op); + } + return op; +} + /* PyObjectSetAttrStr */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { @@ -33026,7 +31394,7 @@ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int eq return (equals == Py_EQ); } else { int result; -#if CYTHON_USE_UNICODE_INTERNALS +#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) Py_hash_t hash1, hash2; hash1 = ((PyBytesObject*)s1)->ob_shash; hash2 = ((PyBytesObject*)s2)->ob_shash; @@ -33217,7 +31585,7 @@ static int __Pyx_ParseOptionalKeywords( } name = first_kw_arg; #if PY_MAJOR_VERSION < 3 - if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + if (likely(PyString_Check(key))) { while (*name) { if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) && _PyString_Eq(**name, key)) { @@ -33244,7 +31612,7 @@ static int __Pyx_ParseOptionalKeywords( while (*name) { int cmp = (**name == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : #endif PyUnicode_Compare(**name, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; @@ -33260,7 +31628,7 @@ static int __Pyx_ParseOptionalKeywords( while (argname != first_kw_arg) { int cmp = (**argname == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : #endif PyUnicode_Compare(**argname, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; @@ -33301,90 +31669,30 @@ static int __Pyx_ParseOptionalKeywords( #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 - -/* StringJoin */ -#if !CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) { - return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL); -} -#endif - -/* RaiseTooManyValuesToUnpack */ -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { - PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); -} - -/* RaiseNeedMoreValuesToUnpack */ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, - "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", - index, (index == 1) ? "" : "s"); -} - -/* IterFinish */ -static CYTHON_INLINE int __Pyx_IterFinish(void) { -#if CYTHON_FAST_THREAD_STATE - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject* exc_type = tstate->curexc_type; - if (unlikely(exc_type)) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) { - PyObject *exc_value, *exc_tb; - exc_value = tstate->curexc_value; - exc_tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; - Py_DECREF(exc_type); - Py_XDECREF(exc_value); - Py_XDECREF(exc_tb); - return 0; - } else { - return -1; - } - } - return 0; -#else - if (unlikely(PyErr_Occurred())) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { - PyErr_Clear(); - return 0; - } else { - return -1; - } + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCall(func, NULL, 0); } - return 0; #endif +#if defined(__Pyx_CyFunction_USED) && defined(NDEBUG) + 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 -/* UnpackItemEndCheck */ -static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { - if (unlikely(retval)) { - Py_DECREF(retval); - __Pyx_RaiseTooManyValuesError(expected); - return -1; - } else { - return __Pyx_IterFinish(); - } - return 0; +/* StringJoin */ +#if !CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) { + return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL); } +#endif /* UnpackUnboundCMethod */ static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { @@ -33414,11 +31722,11 @@ static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* if (flag == METH_O) { return (*(cfunc->func))(self, arg); } else if (PY_VERSION_HEX >= 0x030600B1 && flag == METH_FASTCALL) { - if (PY_VERSION_HEX >= 0x030700A0) { + #if PY_VERSION_HEX >= 0x030700A0 return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, &arg, 1); - } else { + #else return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL); - } + #endif } else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) { return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL); } @@ -33458,25 +31766,39 @@ static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObje return result; } -/* ArgTypeTest */ -static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) -{ - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - else if (exact) { - #if PY_MAJOR_VERSION == 2 - if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; - #endif +/* IterFinish */ +static CYTHON_INLINE int __Pyx_IterFinish(void) { +#if CYTHON_FAST_THREAD_STATE + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject* exc_type = tstate->curexc_type; + if (unlikely(exc_type)) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) { + PyObject *exc_value, *exc_tb; + exc_value = tstate->curexc_value; + exc_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + Py_DECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_tb); + return 0; + } else { + return -1; + } } - else { - if (likely(__Pyx_TypeCheck(obj, type))) return 1; + return 0; +#else + if (unlikely(PyErr_Occurred())) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } } - PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); return 0; +#endif } /* PyObjectGetMethod */ @@ -33591,6 +31913,29 @@ static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name return result; } +/* RaiseNeedMoreValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", + index, (index == 1) ? "" : "s"); +} + +/* RaiseTooManyValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +/* UnpackItemEndCheck */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } + return __Pyx_IterFinish(); +} + /* RaiseNoneIterError */ static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); @@ -33772,6 +32117,92 @@ static CYTHON_INLINE int __Pyx_dict_iter_next( return 1; } +/* CallUnboundCMethod2 */ +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1 +static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) { + if (likely(cfunc->func)) { + PyObject *args[2] = {arg1, arg2}; + if (cfunc->flag == METH_FASTCALL) { + #if PY_VERSION_HEX >= 0x030700A0 + return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, args, 2); + #else + return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL); + #endif + } + #if PY_VERSION_HEX >= 0x030700A0 + if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS)) + return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL); + #endif + } + return __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2); +} +#endif +static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){ + PyObject *args, *result = NULL; + if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; +#if CYTHON_COMPILING_IN_CPYTHON + if (cfunc->func && (cfunc->flag & METH_VARARGS)) { + args = PyTuple_New(2); + if (unlikely(!args)) goto bad; + Py_INCREF(arg1); + PyTuple_SET_ITEM(args, 0, arg1); + Py_INCREF(arg2); + PyTuple_SET_ITEM(args, 1, arg2); + if (cfunc->flag & METH_KEYWORDS) + result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL); + else + result = (*cfunc->func)(self, args); + } else { + args = PyTuple_New(3); + if (unlikely(!args)) goto bad; + Py_INCREF(self); + PyTuple_SET_ITEM(args, 0, self); + Py_INCREF(arg1); + PyTuple_SET_ITEM(args, 1, arg1); + Py_INCREF(arg2); + PyTuple_SET_ITEM(args, 2, arg2); + result = __Pyx_PyObject_Call(cfunc->method, args, NULL); + } +#else + args = PyTuple_Pack(3, self, arg1, arg2); + if (unlikely(!args)) goto bad; + result = __Pyx_PyObject_Call(cfunc->method, args, NULL); +#endif +bad: + Py_XDECREF(args); + return result; +} + +/* dict_getitem_default */ +static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) { + PyObject* value; +#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY + value = PyDict_GetItemWithError(d, key); + if (unlikely(!value)) { + if (unlikely(PyErr_Occurred())) + return NULL; + value = default_value; + } + Py_INCREF(value); + if ((1)); +#else + if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) { + value = PyDict_GetItem(d, key); + if (unlikely(!value)) { + value = default_value; + } + Py_INCREF(value); + } +#endif + else { + if (default_value == Py_None) + value = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_get, d, key); + else + value = __Pyx_CallUnboundCMethod2(&__pyx_umethod_PyDict_Type_get, d, key, default_value); + } + return value; +} + /* PyObject_GenericGetAttrNoDict */ #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { @@ -33812,6 +32243,85 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj } #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, size_t alignment, enum __Pyx_ImportType_CheckSize check_size) +{ + PyObject *result = 0; + char warning[200]; + Py_ssize_t basicsize; + Py_ssize_t itemsize; +#ifdef Py_LIMITED_API + PyObject *py_basicsize; + PyObject *py_itemsize; +#endif + result = PyObject_GetAttrString(module, class_name); + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%.200s.%.200s is not a type object", + module_name, class_name); + goto bad; + } +#ifndef Py_LIMITED_API + basicsize = ((PyTypeObject *)result)->tp_basicsize; + itemsize = ((PyTypeObject *)result)->tp_itemsize; +#else + py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); + if (!py_basicsize) + goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; + py_itemsize = PyObject_GetAttrString(result, "__itemsize__"); + if (!py_itemsize) + goto bad; + itemsize = PyLong_AsSsize_t(py_itemsize); + Py_DECREF(py_itemsize); + py_itemsize = 0; + if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; +#endif + if (itemsize) { + if (size % alignment) { + alignment = size % alignment; + } + if (itemsize < (Py_ssize_t)alignment) + itemsize = (Py_ssize_t)alignment; + } + if ((size_t)(basicsize + itemsize) < size) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize); + 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 + /* Import */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *empty_list = 0; @@ -33842,7 +32352,7 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { { #if PY_MAJOR_VERSION >= 3 if (level == -1) { - if (strchr(__Pyx_MODULE_NAME, '.')) { + if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, 1); if (!module) { @@ -33999,7 +32509,7 @@ static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObj /* CLineInTraceback */ #ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { +static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) { PyObject *use_cline; PyObject *ptype, *pvalue, *ptraceback; #if CYTHON_COMPILING_IN_CPYTHON @@ -34029,7 +32539,7 @@ static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { } if (!use_cline) { c_line = 0; - PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); + (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); } else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { c_line = 0; @@ -34103,7 +32613,7 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { if (__pyx_code_cache.count == __pyx_code_cache.max_count) { int new_max = __pyx_code_cache.max_count + 64; entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( - __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); if (unlikely(!entries)) { return; } @@ -34123,33 +32633,40 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { #include "compile.h" #include "frameobject.h" #include "traceback.h" +#if PY_VERSION_HEX >= 0x030b00a6 + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; + PyCodeObject *py_code = NULL; + PyObject *py_funcname = NULL; #if PY_MAJOR_VERSION < 3 + PyObject *py_srcfile = NULL; py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif if (!py_srcfile) goto bad; + #endif if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + funcname = PyUnicode_AsUTF8(py_funcname); + if (!funcname) goto bad; #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); + if (!py_funcname) goto bad; #endif } - if (!py_funcname) goto bad; + #if PY_MAJOR_VERSION < 3 py_code = __Pyx_PyCode_New( 0, 0, @@ -34168,11 +32685,16 @@ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); + #else + py_code = PyCode_NewEmpty(filename, funcname, py_line); + #endif + Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline return py_code; bad: - Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_srcfile); + #endif return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, @@ -34180,14 +32702,24 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject *ptype, *pvalue, *ptraceback; if (c_line) { c_line = __Pyx_CLineForTraceback(tstate, c_line); } py_code = __pyx_find_code_object(c_line ? -c_line : py_line); if (!py_code) { + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); - if (!py_code) goto bad; + if (!py_code) { + /* If the code object creation fails, then we should clear the + fetched exception references and propagate the new exception */ + Py_XDECREF(ptype); + Py_XDECREF(pvalue); + Py_XDECREF(ptraceback); + goto bad; + } + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); } py_frame = PyFrame_New( @@ -34207,90 +32739,35 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, /* CIntFromPyVerify */ #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) -#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ - {\ - func_type value = func_value;\ - if (sizeof(target_type) < sizeof(func_type)) {\ - if (unlikely(value != (func_type) (target_type) value)) {\ - func_type zero = 0;\ - if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ - return (target_type) -1;\ - if (is_unsigned && unlikely(value < zero))\ - goto raise_neg_overflow;\ - else\ - goto raise_overflow;\ - }\ - }\ - return (target_type) value;\ - } - -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PY_LONG_LONG(PY_LONG_LONG value) { - const PY_LONG_LONG neg_one = (PY_LONG_LONG) ((PY_LONG_LONG) 0 - (PY_LONG_LONG) 1), const_zero = (PY_LONG_LONG) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(PY_LONG_LONG) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(PY_LONG_LONG) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(PY_LONG_LONG) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(PY_LONG_LONG) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(PY_LONG_LONG) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(PY_LONG_LONG), - little, !is_unsigned); - } -} - -/* CIntToPy */ -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)) { - return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(long) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(long), - little, !is_unsigned); +#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) +#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ + {\ + func_type value = func_value;\ + if (sizeof(target_type) < sizeof(func_type)) {\ + if (unlikely(value != (func_type) (target_type) value)) {\ + func_type zero = 0;\ + if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ + return (target_type) -1;\ + if (is_unsigned && unlikely(value < zero))\ + goto raise_neg_overflow;\ + else\ + goto raise_overflow;\ + }\ + }\ + return (target_type) value;\ } -} /* CIntFromPy */ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_As_PY_LONG_LONG(PyObject *x) { - const PY_LONG_LONG neg_one = (PY_LONG_LONG) ((PY_LONG_LONG) 0 - (PY_LONG_LONG) 1), const_zero = (PY_LONG_LONG) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const PY_LONG_LONG neg_one = (PY_LONG_LONG) -1, const_zero = (PY_LONG_LONG) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -34477,9 +32954,92 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_As_PY_LONG_LONG(PyObject *x) { return (PY_LONG_LONG) -1; } +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PY_LONG_LONG(PY_LONG_LONG value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const PY_LONG_LONG neg_one = (PY_LONG_LONG) -1, const_zero = (PY_LONG_LONG) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(PY_LONG_LONG) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(PY_LONG_LONG) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(PY_LONG_LONG) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(PY_LONG_LONG) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(PY_LONG_LONG) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(PY_LONG_LONG), + little, !is_unsigned); + } +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(long) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(long) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(long), + little, !is_unsigned); + } +} + /* CIntFromPy */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { - const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -34666,9 +33226,54 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { return (long) -1; } +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_char(char value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const char neg_one = (char) -1, const_zero = (char) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(char) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(char) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(char) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(char), + little, !is_unsigned); + } +} + /* CIntFromPy */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { - const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -34857,7 +33462,14 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { /* CIntFromPy */ static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) { - const char neg_one = (char) ((char) 0 - (char) 1), const_zero = (char) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const char neg_one = (char) -1, const_zero = (char) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -35044,6 +33656,202 @@ static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) { return (char) -1; } +/* CIntFromPy */ +static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(unsigned int) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(unsigned int, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (unsigned int) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (unsigned int) 0; + case 1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, digits[0]) + case 2: + if (8 * sizeof(unsigned int) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(unsigned int) >= 2 * PyLong_SHIFT) { + return (unsigned int) (((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])); + } + } + break; + case 3: + if (8 * sizeof(unsigned int) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(unsigned int) >= 3 * PyLong_SHIFT) { + return (unsigned int) (((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])); + } + } + break; + case 4: + if (8 * sizeof(unsigned int) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(unsigned int) >= 4 * PyLong_SHIFT) { + return (unsigned int) (((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])); + } + } + break; + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (unsigned int) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if (sizeof(unsigned int) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned long, PyLong_AsUnsignedLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) +#endif + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (unsigned int) 0; + case -1: __PYX_VERIFY_RETURN_INT(unsigned int, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, +digits[0]) + case -2: + if (8 * sizeof(unsigned int) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) { + return (unsigned int) (((unsigned int)-1)*(((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); + } + } + break; + case 2: + if (8 * sizeof(unsigned int) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) { + return (unsigned int) ((((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); + } + } + break; + case -3: + if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) { + return (unsigned int) (((unsigned int)-1)*(((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); + } + } + break; + case 3: + if (8 * sizeof(unsigned int) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) { + return (unsigned int) ((((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); + } + } + break; + case -4: + if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT) { + return (unsigned int) (((unsigned int)-1)*(((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); + } + } + break; + case 4: + if (8 * sizeof(unsigned int) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT) { + return (unsigned int) ((((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); + } + } + break; + } +#endif + if (sizeof(unsigned int) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(unsigned int, long, PyLong_AsLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(unsigned int, PY_LONG_LONG, PyLong_AsLongLong(x)) +#endif + } + } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + unsigned int val; + PyObject *v = __Pyx_PyNumber_IntOrLong(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } +#endif + return (unsigned int) -1; + } + } else { + unsigned int val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (unsigned int) -1; + val = __Pyx_PyInt_As_unsigned_int(tmp); + Py_DECREF(tmp); + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to unsigned int"); + return (unsigned int) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned int"); + return (unsigned int) -1; +} + /* FastTypeChecks */ #if CYTHON_COMPILING_IN_CPYTHON static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { @@ -35146,11 +33954,33 @@ static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObj /* CheckBinaryVersion */ static int __Pyx_check_binary_version(void) { - char ctversion[4], rtversion[4]; - PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); - PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); - if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char ctversion[5]; + int same=1, i, found_dot; + const char* rt_from_call = Py_GetVersion(); + PyOS_snprintf(ctversion, 5, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + found_dot = 0; + for (i = 0; i < 4; i++) { + if (!ctversion[i]) { + same = (rt_from_call[i] < '0' || rt_from_call[i] > '9'); + break; + } + if (rt_from_call[i] != ctversion[i]) { + same = 0; + break; + } + } + if (!same) { + char rtversion[5] = {'\0'}; char message[200]; + for (i=0; i<4; ++i) { + if (rt_from_call[i] == '.') { + if (found_dot) break; + found_dot = 1; + } else if (rt_from_call[i] < '0' || rt_from_call[i] > '9') { + break; + } + rtversion[i] = rt_from_call[i]; + } PyOS_snprintf(message, sizeof(message), "compiletime version %s of module '%.100s' " "does not match runtime version %s", @@ -35408,6 +34238,23 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_DECREF(x); return ival; } +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { + if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { + return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); +#if PY_MAJOR_VERSION < 3 + } else if (likely(PyInt_CheckExact(o))) { + return PyInt_AS_LONG(o); +#endif + } else { + Py_ssize_t ival; + PyObject *x; + x = PyNumber_Index(o); + if (!x) return -1; + ival = PyInt_AsLong(x); + Py_DECREF(x); + return ival; + } +} static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); } diff --git a/src/spavro/fast_binary.pyx b/src/spavro/fast_binary.pyx index f16f6e0..76faef7 100644 --- a/src/spavro/fast_binary.pyx +++ b/src/spavro/fast_binary.pyx @@ -5,6 +5,9 @@ The main edge this code has is that it parses the schema only once and creates a reader/writer call tree from the schema shape. All reads and writes then no longer consult the schema saving lookups.''' +cimport cpython.array as array +from libc.string cimport memcpy + import six INT_MIN_VALUE = -(1 << 31) INT_MAX_VALUE = (1 << 31) - 1 @@ -321,20 +324,136 @@ cdef void write_double(outbuf, double datum): outbuf.write((&datum)[:sizeof(double)]) -cdef void write_null(outbuf, datum): - pass +cdef write_boolean(outbuf, char datum): + """A boolean is written as a single byte whose value is either 0 (false) or + 1 (true).""" + cdef char x = 1 if datum else 0 + outbuf.write((&x)[:sizeof(char)]) + + +cdef void write_int_to_array(array.array outbuf, long long signed_datum): + """int and long values are written using variable-length, zig-zag coding. + """ + cdef: + unsigned long long datum + char temp_datum + size_t size = len(outbuf) + datum = (signed_datum << 1) ^ (signed_datum >> 63) + while datum > 127: + temp_datum = (datum & 0x7f) | 0x80 + array.resize_smart(outbuf, size + 1) + outbuf.data.as_uchars[size] = temp_datum + size += 1 + datum >>= 7 + array.resize_smart(outbuf, size + 1) + outbuf.data.as_uchars[size] = datum + +cdef void write_long_to_array(array.array outbuf, long long signed_datum): + """int and long values are written using variable-length, zig-zag coding. + """ + cdef: + unsigned long long datum + char temp_datum + size_t size = len(outbuf) + datum = (signed_datum << 1) ^ (signed_datum >> 63) + while datum > 127: + temp_datum = (datum & 0x7f) | 0x80 + array.resize_smart(outbuf, size + 1) + outbuf.data.as_uchars[size] = temp_datum + size += 1 + datum >>= 7 + array.resize_smart(outbuf, size + 1) + outbuf.data.as_uchars[size] = datum + + +cdef void write_bytes_to_array(array.array outbuf, datum): + """ + Bytes are encoded as a long followed by that many bytes of data. + """ + cdef: + size_t datum_size = len(datum) + size_t size = 0 + write_long_to_array(outbuf, datum_size) + size = len(outbuf) + array.resize_smart(outbuf, size + datum_size) + memcpy(outbuf.data.as_chars + size, datum, datum_size) -cdef void write_fixed(outbuf, datum): +cdef void write_utf8_to_array(array.array outbuf, datum): + """ + Unicode are encoded as write_bytes_to_array of the utf-8 encoded data. + """ + write_bytes_to_array(outbuf, datum.encode("utf-8")) + + +cdef void write_float_to_array(array.array outbuf, float datum): + """ + A float is written as 4 bytes. + The float is converted into a 32-bit integer using a method equivalent to + Java's floatToIntBits and then encoded in little-endian format. + """ + cdef: + size_t datum_size = sizeof(float) + size_t size = len(outbuf) + array.resize_smart(outbuf, size + datum_size) + memcpy(outbuf.data.as_chars + size, &datum, datum_size) + +cdef void write_double_to_array(array.array outbuf, double datum): + """ + A double is written as 8 bytes. + The double is converted into a 64-bit integer using a method equivalent to + Java's doubleToLongBits and then encoded in little-endian format. + """ + cdef: + size_t datum_size = sizeof(double) + size_t size = len(outbuf) + array.resize_smart(outbuf, size + datum_size) + memcpy(outbuf.data.as_chars + size, &datum, datum_size) + + +cdef void write_fixed_to_array(array.array outbuf, datum): """A fixed writer writes out exactly the bytes up to a count""" - outbuf.write(datum) + cdef: + size_t datum_size = len(datum) + size_t size = len(outbuf) + array.resize_smart(outbuf, size + datum_size) + memcpy(outbuf.data.as_chars + size, datum, datum_size) -cdef write_boolean(outbuf, char datum): +cdef void write_boolean_to_array(array.array outbuf, char datum): """A boolean is written as a single byte whose value is either 0 (false) or 1 (true).""" - cdef char x = 1 if datum else 0 - outbuf.write((&x)[:sizeof(char)]) + cdef: + char x = 1 if datum else 0 + size_t size = len(outbuf) + array.resize_smart(outbuf, size + 1) + outbuf.data.as_uchars[size] = x + + +cdef void write_enum_to_array(array.array outbuf, char datum, list symbols): + cdef int enum_index = symbols.index(datum) + write_int_to_array(outbuf, enum_index) + + +cdef void write_array_to_array(array.array outbuf, list datum, list item_writer): + cdef: + size_t item_count = len(datum) + if item_count > 0: + write_long_to_array(outbuf, item_count) + for item in datum: + execute(outbuf, item, item_writer) + write_long_to_array(outbuf, 0) + + +cdef void write_map_to_array(array.array outbuf, dict datum, list map_value_writer): + cdef: + size_t item_count = len(datum) + if item_count > 0: + write_long_to_array(outbuf, item_count) + for key, val in datum.iteritems(): + write_utf8_to_array(outbuf, key) + execute(outbuf, val, map_value_writer) + write_long_to_array(outbuf, 0) avro_to_py = { @@ -551,133 +670,60 @@ def make_union_writer(union_schema): writer_lookup = complex_writer_lookup - def write_union(outbuf, datum): - idx, data_writer = writer_lookup(datum) - write_long(outbuf, idx) - data_writer(outbuf, datum) - write_union.__reduce__ = lambda: (make_union_writer, (union_schema,)) - return write_union - -def make_enum_writer(schema): - cdef list symbols = schema['symbols'] - - # the datum can be str or unicode? - def write_enum(outbuf, basestring datum): - cdef int enum_index = symbols.index(datum) - write_int(outbuf, enum_index) - write_enum.__reduce__ = lambda: (make_enum_writer, (schema,)) - return write_enum - + return [0, writer_lookup] def make_record_writer(schema): cdef list fields = [WriteField(field['name'], get_writer(field['type'])) for field in schema['fields']] + return [1, fields] - def write_record(outbuf, datum): - for field in fields: - try: - field.writer(outbuf, datum.get(field.name)) - except TypeError as e: - raise TypeError("Error writing record schema at fieldname: '{}', datum: '{}'".format(field.name, repr(datum.get(field.name)))) - write_record.__reduce__ = lambda: (make_record_writer, (schema,)) - return write_record - - -def make_array_writer(schema): - item_writer = get_writer(schema['items']) - - def write_array(outbuf, list datum): - cdef long item_count = len(datum) - if item_count > 0: - write_long(outbuf, item_count) - for item in datum: - item_writer(outbuf, item) - write_long(outbuf, 0) - write_array.__reduce__ = lambda: (make_array_writer, (schema,)) - return write_array - - -def make_map_writer(schema): - map_value_writer = get_writer(schema['values']) - - def write_map(outbuf, datum): - cdef long item_count = len(datum) - if item_count > 0: - write_long(outbuf, item_count) - for key, val in datum.iteritems(): - write_utf8(outbuf, key) - map_value_writer(outbuf, val) - write_long(outbuf, 0) - write_map.__reduce__ = lambda: (make_map_writer, (schema,)) - return write_map +def make_null_writer(schema): + return [2] +def make_string_writer(schema): + return [3] def make_boolean_writer(schema): '''Create a boolean writer, adds a validation step before the actual write function''' - def checked_boolean_writer(outbuf, datum): - if not isinstance(datum, bool): - raise TypeError("{} - Not a boolean value. Schema: {}".format(repr(datum), schema)) - write_boolean(outbuf, datum) - return checked_boolean_writer - + return [4] -def make_fixed_writer(schema): - '''A writer that must write X bytes defined by the schema''' - cdef long size = schema['size'] - # note: not a char* because those are null terminated and fixed - # has no such limitation - def checked_write_fixed(outbuf, datum): - if len(datum) != size: - raise TypeError("{} - Size Mismatch ({}) for Fixed data. Schema: {}".format(repr(datum), len(datum), schema)) - write_fixed(outbuf, datum) - return checked_write_fixed - - -def make_int_writer(schema): - '''Create a int writer, adds a validation step before the actual - write function to make sure the int value doesn't overflow''' - def checked_int_write(outbuf, datum): - if not isinstance(datum, six.integer_types): - raise TypeError("Schema violation, {} is not an example of schema {}".format(datum, schema)) - if not INT_MIN_VALUE <= datum <= INT_MAX_VALUE: - raise TypeError("Schema violation, value overflow. {} can't be stored in schema: {}".format(datum, schema)) - write_long(outbuf, datum) - return checked_int_write +def make_double_writer(schema): + return [5] +def make_float_writer(schema): + return [6] def make_long_writer(schema): '''Create a long writer, adds a validation step before the actual write function to make sure the long value doesn't overflow''' - def checked_long_write(outbuf, datum): - if not (isinstance(datum, six.integer_types) - and LONG_MIN_VALUE <= datum <= LONG_MAX_VALUE): - raise TypeError("{} - Non integer value or overflow. Schema: {}".format(repr(datum), schema)) - write_long(outbuf, datum) - return checked_long_write - - -def make_string_writer(schema): - def checked_string_writer(outbuf, datum): - if not isinstance(datum, six.string_types): - raise TypeError("{} - is not a string value. Schema: {}".format(repr(datum), schema)) - write_utf8(outbuf, datum) - return checked_string_writer - + return [7] def make_byte_writer(schema): - return write_bytes + return [8] +def make_int_writer(schema): + '''Create a int writer, adds a validation step before the actual + write function to make sure the int value doesn't overflow''' + return [9] -def make_float_writer(schema): - return write_float - +def make_fixed_writer(schema): + '''A writer that must write X bytes defined by the schema''' + cdef long size = schema['size'] + # note: not a char* because those are null terminated and fixed + # has no such limitation + return [10, size] -def make_double_writer(schema): - return write_double +def make_enum_writer(schema): + cdef list symbols = schema['symbols'] + return [11, symbols] +def make_array_writer(schema): + cdef list item_writer = get_writer(schema['items']) + return [12, item_writer] -def make_null_writer(schema): - return write_null +def make_map_writer(schema): + cdef list map_value_writer = get_writer(schema['values']) + return [13, map_value_writer] # writer @@ -704,9 +750,6 @@ class WriterPlaceholder(object): def __init__(self): self.writer = None - def __call__(self, fo, val): - return self.writer(fo, val) - def get_writer(schema): cdef unicode schema_type = get_type(schema) @@ -733,7 +776,7 @@ def get_writer(schema): except KeyError: # lookup the schema by unique previously defined name, # i.e. a custom type - writer = schema_cache[schema_type] + writer = schema_cache[schema_type].writer return writer @@ -851,3 +894,79 @@ class FastBinaryDecoder(object): def skip(self, n): self.reader.seek(self.reader.tell() + n) + + +cdef void write_union_to_array(array.array outbuf, datum, writer_lookup): + idx, data_writer = writer_lookup(datum) # TODO: cdef int, list = f()? + write_long_to_array(outbuf, idx) + execute(outbuf, datum, data_writer) + + +cdef void write_record_to_array(array.array outbuf, dict datum, list fields): + for field in fields: + try: + execute(outbuf, datum.get(field.name), field.writer) + except TypeError as e: + raise TypeError("Error writing record schema at fieldname: '{}', datum: '{}'".format(field.name, repr(datum.get(field.name)))) + + +cdef void execute(array.array outbuf, datum, list writer): + cdef unsigned int writer_f = writer[0] + + if writer_f == 0: # make_union_writer + write_union_to_array(outbuf, datum, writer[1]) + + elif writer_f == 1: # make_record_writer + write_record_to_array(outbuf, datum, writer[1]) + + # skip make_null_writer + + elif writer_f == 3: # make_string_writer + if not isinstance(datum, six.string_types): + raise TypeError("{} - is not a string value.".format(repr(datum))) + write_utf8_to_array(outbuf, datum) + + elif writer_f == 4: # make_boolean_writer + if not isinstance(datum, bool): + raise TypeError("{} - Not a boolean value.".format(repr(datum))) + write_boolean_to_array(outbuf, datum) + + elif writer_f == 5: # make_double_writer + write_double_to_array(outbuf, datum) + + elif writer_f == 6: # make_float_writer + write_float_to_array(outbuf, datum) + + elif writer_f == 7: # make_long_writer + if not (isinstance(datum, six.integer_types) + and LONG_MIN_VALUE <= datum <= LONG_MAX_VALUE): + raise TypeError("{} - Non integer value or overflow.".format(repr(datum))) + write_long_to_array(outbuf, datum) + + elif writer_f == 8: # make_byte_writer + write_bytes_to_array(outbuf, datum) + + elif writer_f == 9: # make_int_writer + if not isinstance(datum, six.integer_types): + raise TypeError("Schema violation, {} is not an example of integer".format(datum)) + if not INT_MIN_VALUE <= datum <= INT_MAX_VALUE: + raise TypeError("Schema violation, value overflow. {} can't be stored in schema".format(datum)) + write_long_to_array(outbuf, datum) + + elif writer_f == 10: # make_fixed_writer + write_fixed_to_array(outbuf, datum) + + elif writer_f == 11: # make_enum_writer + write_enum_to_array(outbuf, datum, writer[1]) + + elif writer_f == 12: # make_union_writer + write_array_to_array(outbuf, datum, writer[1]) + + elif writer_f == 13: # make_union_writer + write_map_to_array(outbuf, datum, writer[1]) + + +def write(iobuffer, datum, writer, schema): + cdef array.array outbuf = array.array('B', []) + execute(outbuf, datum, writer) + iobuffer.write(outbuf.data.as_chars[:len(outbuf)]) diff --git a/src/spavro/io.py b/src/spavro/io.py index 466da21..50cea41 100755 --- a/src/spavro/io.py +++ b/src/spavro/io.py @@ -143,7 +143,7 @@ def validate(expected_schema, datum): log = logging.getLogger(__name__) use_fast = False try: - from spavro.fast_binary import get_reader, get_writer + from spavro.fast_binary import get_reader, get_writer, write from spavro.fast_binary import FastBinaryEncoder, FastBinaryDecoder use_fast = True except ImportError: @@ -817,12 +817,13 @@ def writers_schema(self, parsed_writer_schema): if parsed_writer_schema: # to_json is a terrible method name for something # that returns a python dict! :/ - self.write_datum = get_writer(parsed_writer_schema.to_json()) + self.schema = parsed_writer_schema.to_json() + self.write_datum = get_writer(self.schema) def write(self, datum, encoder): # validate datum try: - self.write_datum(encoder.writer, datum) + write(encoder.writer, datum, self.write_datum, self.schema) except TypeError as ex: log.error(self.write_datum) log.exception("type error")