From 245b9532b979c22a7b301f51506f94107cefa9a6 Mon Sep 17 00:00:00 2001 From: foefl Date: Fri, 28 Nov 2025 15:40:09 +0100 Subject: [PATCH] experiments with Cython --- pdm.lock | 19 +- pyproject.toml | 2 +- src/polluck_blockchain/placeholder.c | 4625 ++++++++++++++++++------- src/polluck_blockchain/placeholder.py | 118 +- 4 files changed, 3469 insertions(+), 1295 deletions(-) diff --git a/pdm.lock b/pdm.lock index 6d7e1b5..ce94e02 100644 --- a/pdm.lock +++ b/pdm.lock @@ -5,7 +5,7 @@ groups = ["default", "dev", "lint", "nb", "tests"] strategy = ["inherit_metadata"] lock_version = "4.5.0" -content_hash = "sha256:71768c573eb20af8acecbc83c097fa086cd4b05e483dd1da4671252ec7d16329" +content_hash = "sha256:c0680aa00cf7474d542ab72daaea39fe9f3c23b3b68f724f49da67b2d74ff588" [[metadata.targets]] requires_python = ">=3.11" @@ -759,6 +759,20 @@ files = [ {file = "distlib-0.4.0.tar.gz", hash = "sha256:feec40075be03a04501a973d81f633735b4b69f98b05450592310c0f401a4e0d"}, ] +[[package]] +name = "dopt-basics" +version = "0.2.4" +requires_python = ">=3.11" +summary = "basic cross-project tools for Python-based d-opt projects" +groups = ["default"] +dependencies = [ + "tzdata>=2025.1", +] +files = [ + {file = "dopt_basics-0.2.4-py3-none-any.whl", hash = "sha256:b7d05b80dde1f856b352580aeac500fc7505e4513ed162791d8735cdc182ebc1"}, + {file = "dopt_basics-0.2.4.tar.gz", hash = "sha256:c21fbe183bec5eab4cfd1404e10baca670035801596960822d0019e6e885983f"}, +] + [[package]] name = "execnet" version = "2.1.2" @@ -2530,8 +2544,7 @@ name = "tzdata" version = "2025.2" requires_python = ">=2" summary = "Provider of IANA time zone data" -groups = ["nb"] -marker = "python_version >= \"3.9\"" +groups = ["default", "nb"] files = [ {file = "tzdata-2025.2-py2.py3-none-any.whl", hash = "sha256:1a403fada01ff9221ca8044d701868fa132215d84beb92242d9acd2147f667a8"}, {file = "tzdata-2025.2.tar.gz", hash = "sha256:b60a638fcc0daffadf82fe0f57e53d06bdec2f36c4df66280ae79bce6bd6f2b9"}, diff --git a/pyproject.toml b/pyproject.toml index 8bccb54..e8c8a37 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ description = "blockchain module of the research project >Polluck<" authors = [ {name = "d-opt GmbH, resp. Florian Foerster", email = "f.foerster@d-opt.com"}, ] -dependencies = [] +dependencies = ["dopt-basics>=0.2.4"] requires-python = ">=3.11" readme = "README.md" license = {text = "LicenseRef-Proprietary"} diff --git a/src/polluck_blockchain/placeholder.c b/src/polluck_blockchain/placeholder.c index ec22610..89ed345 100644 --- a/src/polluck_blockchain/placeholder.c +++ b/src/polluck_blockchain/placeholder.c @@ -3,7 +3,6 @@ /* BEGIN: Cython Metadata { "distutils": { - "depends": [], "name": "polluck_blockchain.placeholder", "sources": [ "src/polluck_blockchain/placeholder.py" @@ -1130,8 +1129,6 @@ static int __Pyx_init_co_variables(void) { #define __PYX_HAVE__polluck_blockchain__placeholder #define __PYX_HAVE_API__polluck_blockchain__placeholder /* Early includes */ -#include -#include #ifdef _OPENMP #include #endif /* _OPENMP */ @@ -1341,7 +1338,6 @@ static const char *__pyx_filename; static const char* const __pyx_f[] = { "src/polluck_blockchain/placeholder.py", "", - "cpython/type.pxd", }; /* #### Code section: utility_code_proto_before_types ### */ /* Atomics.proto (used by UnpackUnboundCMethod) */ @@ -1519,28 +1515,51 @@ static const char* const __pyx_f[] = { /*--- Type declarations ---*/ struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder; +struct __pyx_obj_18polluck_blockchain_11placeholder_Block; +struct __pyx_t_18polluck_blockchain_11placeholder_PyStringC; -/* "polluck_blockchain/placeholder.py":10 +/* "polluck_blockchain/placeholder.py":12 + * # from cython.cimports.cpython.ref import Py_INCREF, PyObject + * + * PyStringC = cython.struct( # <<<<<<<<<<<<<< + * ptr=cython.p_char, + * length=cython.Py_ssize_t, +*/ +struct __pyx_t_18polluck_blockchain_11placeholder_PyStringC { + char *ptr; + Py_ssize_t length; +}; + +/* "polluck_blockchain/placeholder.py":40 * * @cython.cclass * class StringHolder: # <<<<<<<<<<<<<< - * _data = cython.declare(cython.p_char, visibility="private") - * _length = cython.declare(cython.Py_ssize_t, visibility="readonly") + * c = cython.declare(PyStringC, visibility="readonly") + * _py_data = cython.declare(object, visibility="private") */ struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder { PyObject_HEAD - struct __pyx_vtabstruct_18polluck_blockchain_11placeholder_StringHolder *__pyx_vtab; - char *_data; - Py_ssize_t _length; - PyObject *_py_cache; + struct __pyx_t_18polluck_blockchain_11placeholder_PyStringC c; + PyObject *_py_data; }; - -struct __pyx_vtabstruct_18polluck_blockchain_11placeholder_StringHolder { - PyObject *(*_bytes_to_str)(struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder *); +/* "polluck_blockchain/placeholder.py":77 + * + * @cython.cclass + * class Block: # <<<<<<<<<<<<<< + * _index = cython.declare(cython.ulong, visibility="private") + * _timestamp = cython.declare(cython.double, visibility="private") +*/ +struct __pyx_obj_18polluck_blockchain_11placeholder_Block { + PyObject_HEAD + unsigned long _index; + double _timestamp; + struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder *_data; + struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder *_prev_hash; + unsigned long _nonce; }; -static struct __pyx_vtabstruct_18polluck_blockchain_11placeholder_StringHolder *__pyx_vtabptr_18polluck_blockchain_11placeholder_StringHolder; + /* #### Code section: utility_code_proto ### */ /* --- Runtime support code (head) --- */ @@ -1617,6 +1636,163 @@ static struct __pyx_vtabstruct_18polluck_blockchain_11placeholder_StringHolder * #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) +/* IncludeStringH.proto (used by decode_c_string) */ +#include + +/* decode_c_string_utf16.proto (used by decode_c_string) */ +static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) { + int byteorder = 0; + return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); +} +static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) { + int byteorder = -1; + return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); +} +static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) { + int byteorder = 1; + return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); +} + +/* decode_c_string.proto */ +static CYTHON_INLINE PyObject* __Pyx_decode_c_string( + const char* cstring, Py_ssize_t start, Py_ssize_t stop, + const char* encoding, const char* errors, + PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); + +/* PyErrExceptionMatches.proto (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); +#else +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) +#endif + +/* PyThreadStateGet.proto (used by PyErrFetchRestore) */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; +#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; +#if PY_VERSION_HEX >= 0x030C00A6 +#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) +#else +#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) +#endif +#else +#define __Pyx_PyThreadState_declare +#define __Pyx_PyThreadState_assign +#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) +#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() +#endif + +/* PyErrFetchRestore.proto (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) +#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 +#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) +#else +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#endif +#else +#define __Pyx_PyErr_Clear() PyErr_Clear() +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) +#endif + +/* PyObjectGetAttrStr.proto (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +/* PyObjectGetAttrStrNoError.proto (used by GetBuiltinName) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + +/* GetBuiltinName.proto (used by GetModuleGlobalName) */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name); + +/* PyDictVersioning.proto (used by GetModuleGlobalName) */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) +#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ + (version_var) = __PYX_GET_DICT_VERSION(dict);\ + (cache_var) = (value); +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ + (VAR) = __Pyx_XNewRef(__pyx_dict_cached_value);\ + } else {\ + (VAR) = __pyx_dict_cached_value = (LOOKUP);\ + __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ + }\ +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); +#else +#define __PYX_GET_DICT_VERSION(dict) (0) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); +#endif + +/* GetModuleGlobalName.proto */ +#if CYTHON_USE_DICT_VERSIONS +#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_mstate_global->__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);\ +} 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) +#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); +#endif + +/* PyObjectCall.proto (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +#else +#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) +#endif + +/* PyObjectCallMethO.proto (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +#endif + +/* PyObjectFastCall.proto (used by PyObjectFastCallMethod) */ +#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs); + +/* PyObjectFastCallMethod.proto */ +#if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000 +#define __Pyx_PyObject_FastCallMethod(name, args, nargsf) PyObject_VectorcallMethod(name, args, nargsf, NULL) +#else +static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf); +#endif + /* TupleAndListFromArray.proto (used by fastcall) */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); @@ -1625,9 +1801,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_s static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); #endif -/* IncludeStringH.proto (used by BytesEquals) */ -#include - /* BytesEquals.proto (used by UnicodeEquals) */ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); @@ -1683,32 +1856,9 @@ static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d); #define __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, nargs, kwnames)\ ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs, kwnames) -/* PyObjectCall.proto (used by PyObjectFastCall) */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); -#else -#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) -#endif - -/* PyObjectCallMethO.proto (used by PyObjectFastCall) */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); -#endif - -/* PyObjectFastCall.proto (used by PyObjectCallOneArg) */ -#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) -static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs); - /* PyObjectCallOneArg.proto (used by CallUnboundCMethod0) */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); -/* PyObjectGetAttrStr.proto (used by UnpackUnboundCMethod) */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); -#else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) -#endif - /* UnpackUnboundCMethod.proto (used by CallUnboundCMethod0) */ typedef struct { PyObject *type; @@ -1828,125 +1978,23 @@ static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *nam /* PyTypeError_Check.proto */ #define __Pyx_PyExc_TypeError_Check(obj) __Pyx_TypeCheck(obj, PyExc_TypeError) -/* PyThreadStateGet.proto (used by PyErrFetchRestore) */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; -#if PY_VERSION_HEX >= 0x030C00A6 -#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) -#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) -#else -#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) -#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) -#endif -#else -#define __Pyx_PyThreadState_declare -#define __Pyx_PyThreadState_assign -#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) -#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() -#endif - -/* PyErrFetchRestore.proto (used by RaiseException) */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) -#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 -#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) -#else -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#endif -#else -#define __Pyx_PyErr_Clear() PyErr_Clear() -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) -#endif - /* RaiseException.export */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); -/* PyErrExceptionMatches.proto (used by PyObjectGetAttrStrNoError) */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) -static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); -#else -#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) -#endif +/* RejectKeywords.export */ +static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds); -/* PyObjectGetAttrStrNoError.proto (used by GetBuiltinName) */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); +/* pyint_simplify.proto */ +static CYTHON_INLINE int __Pyx_PyInt_FromNumber(PyObject **number_var, const char *argname, int accept_none); -/* GetBuiltinName.proto (used by GetModuleGlobalName) */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name); - -/* PyDictVersioning.proto (used by GetModuleGlobalName) */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) -#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ - (version_var) = __PYX_GET_DICT_VERSION(dict);\ - (cache_var) = (value); -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ - static PY_UINT64_T __pyx_dict_version = 0;\ - static PyObject *__pyx_dict_cached_value = NULL;\ - if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ - (VAR) = __Pyx_XNewRef(__pyx_dict_cached_value);\ - } else {\ - (VAR) = __pyx_dict_cached_value = (LOOKUP);\ - __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ - }\ -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); -#else -#define __PYX_GET_DICT_VERSION(dict) (0) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); -#endif - -/* GetModuleGlobalName.proto */ -#if CYTHON_USE_DICT_VERSIONS -#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_mstate_global->__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);\ -} 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) -#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); -#endif - -/* PyObjectFastCallMethod.proto */ -#if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000 -#define __Pyx_PyObject_FastCallMethod(name, args, nargsf) PyObject_VectorcallMethod(name, args, nargsf, NULL) -#else -static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf); -#endif +/* GetAttr3.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); /* RaiseUnexpectedTypeError.proto */ static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj); -/* RejectKeywords.export */ -static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds); +/* ExtTypeTest.proto */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /* AllocateExtensionType.proto */ static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final); @@ -1989,15 +2037,6 @@ static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffs /* PyType_Ready.proto */ CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t); -/* SetVTable.proto */ -static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable); - -/* GetVTable.proto (used by MergeVTables) */ -static void* __Pyx_GetVtable(PyTypeObject *type); - -/* MergeVTables.proto */ -static int __Pyx_MergeVtables(PyTypeObject *type); - /* DelItemOnTypeDict.proto (used by SetupReduce) */ static int __Pyx__DelItemOnTypeDict(PyTypeObject *tp, PyObject *k); #define __Pyx_DelItemOnTypeDict(tp, k) __Pyx__DelItemOnTypeDict((PyTypeObject*)tp, k) @@ -2005,25 +2044,6 @@ static int __Pyx__DelItemOnTypeDict(PyTypeObject *tp, PyObject *k); /* SetupReduce.proto */ static int __Pyx_setup_reduce(PyObject* type_obj); -/* TypeImport.proto */ -#ifndef __PYX_HAVE_RT_ImportType_proto_3_2_1 -#define __PYX_HAVE_RT_ImportType_proto_3_2_1 -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L -#include -#endif -#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L -#define __PYX_GET_STRUCT_ALIGNMENT_3_2_1(s) alignof(s) -#else -#define __PYX_GET_STRUCT_ALIGNMENT_3_2_1(s) sizeof(void*) -#endif -enum __Pyx_ImportType_CheckSize_3_2_1 { - __Pyx_ImportType_CheckSize_Error_3_2_1 = 0, - __Pyx_ImportType_CheckSize_Warn_3_2_1 = 1, - __Pyx_ImportType_CheckSize_Ignore_3_2_1 = 2 -}; -static PyTypeObject *__Pyx_ImportType_3_2_1(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_1 check_size); -#endif - /* HasAttr.proto (used by ImportImpl) */ #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 #define __Pyx_HasAttr(o, n) PyObject_HasAttrWithError(o, n) @@ -2196,28 +2216,16 @@ static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); -/* FormatTypeName.proto */ -#if CYTHON_COMPILING_IN_LIMITED_API -typedef PyObject *__Pyx_TypeName; -#define __Pyx_FMT_TYPENAME "%U" -#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) -#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 -#define __Pyx_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName -#else -static __Pyx_TypeName __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp); -#endif -#else // !LIMITED_API -typedef const char *__Pyx_TypeName; -#define __Pyx_FMT_TYPENAME "%.200s" -#define __Pyx_PyType_GetFullyQualifiedName(tp) ((tp)->tp_name) -#define __Pyx_DECREF_TypeName(obj) -#endif - -/* GCCDiagnostics.proto (used by CIntToPy) */ +/* GCCDiagnostics.proto */ #if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) #define __Pyx_HAS_GCC_DIAGNOSTIC #endif +/* CheckUnpickleChecksum.proto */ +static CYTHON_INLINE int __Pyx_CheckUnpickleChecksum(long checksum, long checksum1, long checksum2, long checksum3, const char *members); + +struct __pyx_t_18polluck_blockchain_11placeholder_PyStringC; +static PyObject* __pyx_convert__to_py_struct____pyx_t_18polluck_blockchain_11placeholder_PyStringC(struct __pyx_t_18polluck_blockchain_11placeholder_PyStringC s); /* PyObjectVectorCallKwBuilder.proto (used by CIntToPy) */ CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n); #if CYTHON_VECTORCALL @@ -2237,11 +2245,43 @@ static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, P #endif /* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value); +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_unsigned_long(unsigned long value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE unsigned long __Pyx_PyLong_As_unsigned_long(PyObject *); /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *); +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value); + +/* PyObjectCall2Args.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); + +/* PyObjectCallMethod1.proto */ +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); + +/* UpdateUnpickledDict.proto */ +static int __Pyx_UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index); + +/* FormatTypeName.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%U" +#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 +#define __Pyx_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName +#else +static __Pyx_TypeName __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp); +#endif +#else // !LIMITED_API +typedef const char *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%.200s" +#define __Pyx_PyType_GetFullyQualifiedName(tp) ((tp)->tp_name) +#define __Pyx_DECREF_TypeName(obj) +#endif + /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *); @@ -2331,25 +2371,14 @@ static int __Pyx_State_RemoveModule(void*); #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." -static PyObject *__pyx_f_18polluck_blockchain_11placeholder_12StringHolder__bytes_to_str(struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder *__pyx_v_self); /* proto*/ /* Module declarations from "cython" */ -/* Module declarations from "libc.string" */ - -/* Module declarations from "libc.stdio" */ - -/* Module declarations from "__builtin__" */ - -/* Module declarations from "cpython.type" */ - -/* Module declarations from "cpython" */ - -/* Module declarations from "cpython.object" */ - -/* Module declarations from "cpython.ref" */ - /* Module declarations from "polluck_blockchain.placeholder" */ +static PyObject *__pyx_f_18polluck_blockchain_11placeholder_PyStringC_to_unicode(struct __pyx_t_18polluck_blockchain_11placeholder_PyStringC); /*proto*/ +static PyObject *__pyx_f_18polluck_blockchain_11placeholder_PyStringC_to_bytes(struct __pyx_t_18polluck_blockchain_11placeholder_PyStringC); /*proto*/ +static PyObject *__pyx_f_18polluck_blockchain_11placeholder_timestamp_to_datetime(double); /*proto*/ +static PyObject *__pyx_f_18polluck_blockchain_11placeholder___pyx_unpickle_Block__set_state(struct __pyx_obj_18polluck_blockchain_11placeholder_Block *, PyObject *); /*proto*/ /* #### Code section: typeinfo ### */ /* #### Code section: before_global_var ### */ #define __Pyx_MODULE_NAME "polluck_blockchain.placeholder" @@ -2363,10 +2392,21 @@ int __pyx_module_is_main_polluck_blockchain__placeholder = 0; static int __pyx_pf_18polluck_blockchain_11placeholder_12StringHolder___cinit__(struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder *__pyx_v_self, PyObject *__pyx_v_data); /* proto */ static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_12StringHolder_9py_string___get__(struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_12StringHolder_8py_bytes___get__(struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_12StringHolder_7_length___get__(struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_12StringHolder_1c___get__(struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_12StringHolder_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_12StringHolder_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_pf_18polluck_blockchain_11placeholder_5Block___init__(struct __pyx_obj_18polluck_blockchain_11placeholder_Block *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_data, PyObject *__pyx_v_previous_hash, PyObject *__pyx_v_nonce); /* proto */ +static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_5Block_5index___get__(struct __pyx_obj_18polluck_blockchain_11placeholder_Block *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_5Block_9timestamp___get__(struct __pyx_obj_18polluck_blockchain_11placeholder_Block *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_5Block_4data___get__(struct __pyx_obj_18polluck_blockchain_11placeholder_Block *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_5Block_9prev_hash___get__(struct __pyx_obj_18polluck_blockchain_11placeholder_Block *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_5Block_5nonce___get__(struct __pyx_obj_18polluck_blockchain_11placeholder_Block *__pyx_v_self); /* proto */ +static int __pyx_pf_18polluck_blockchain_11placeholder_5Block_5nonce_2__set__(struct __pyx_obj_18polluck_blockchain_11placeholder_Block *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_5Block_2__reduce_cython__(struct __pyx_obj_18polluck_blockchain_11placeholder_Block *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_5Block_4__setstate_cython__(struct __pyx_obj_18polluck_blockchain_11placeholder_Block *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_18polluck_blockchain_11placeholder___pyx_unpickle_Block(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_tp_new_18polluck_blockchain_11placeholder_StringHolder(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_18polluck_blockchain_11placeholder_Block(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ /* #### Code section: late_includes ### */ /* #### Code section: module_state ### */ /* SmallCodeConfig */ @@ -2387,14 +2427,17 @@ typedef struct { PyObject *__pyx_empty_tuple; PyObject *__pyx_empty_bytes; PyObject *__pyx_empty_unicode; - PyTypeObject *__pyx_ptype_7cpython_4type_type; PyObject *__pyx_type_18polluck_blockchain_11placeholder_StringHolder; + PyObject *__pyx_type_18polluck_blockchain_11placeholder_Block; PyTypeObject *__pyx_ptype_18polluck_blockchain_11placeholder_StringHolder; + PyTypeObject *__pyx_ptype_18polluck_blockchain_11placeholder_Block; __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items; __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop; __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values; - PyObject *__pyx_codeobj_tab[2]; - PyObject *__pyx_string_tab[45]; + PyObject *__pyx_tuple[1]; + PyObject *__pyx_codeobj_tab[5]; + PyObject *__pyx_string_tab[69]; + PyObject *__pyx_number_tab[1]; /* #### Code section: module_state_contents ### */ /* CommonTypesMetaclass.module_state_decls */ PyTypeObject *__pyx_CommonTypesMetaclassType; @@ -2444,42 +2487,67 @@ static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_stati #define __pyx_kp_u_gc __pyx_string_tab[6] #define __pyx_kp_u_isenabled __pyx_string_tab[7] #define __pyx_kp_u_no_default___reduce___due_to_non __pyx_string_tab[8] -#define __pyx_kp_u_stringsource __pyx_string_tab[9] -#define __pyx_kp_u_utf_8 __pyx_string_tab[10] -#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[11] -#define __pyx_n_u_StringHolder __pyx_string_tab[12] -#define __pyx_n_u_StringHolder___reduce_cython __pyx_string_tab[13] -#define __pyx_n_u_StringHolder___setstate_cython __pyx_string_tab[14] -#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[15] -#define __pyx_n_u_cast __pyx_string_tab[16] -#define __pyx_n_u_cline_in_traceback __pyx_string_tab[17] -#define __pyx_n_u_data __pyx_string_tab[18] -#define __pyx_n_u_decode __pyx_string_tab[19] -#define __pyx_n_u_func __pyx_string_tab[20] -#define __pyx_n_u_getstate __pyx_string_tab[21] -#define __pyx_n_u_is_coroutine __pyx_string_tab[22] -#define __pyx_n_u_items __pyx_string_tab[23] -#define __pyx_n_u_main __pyx_string_tab[24] -#define __pyx_n_u_module __pyx_string_tab[25] -#define __pyx_n_u_name __pyx_string_tab[26] -#define __pyx_n_u_polluck_blockchain_placeholder __pyx_string_tab[27] -#define __pyx_n_u_pop __pyx_string_tab[28] -#define __pyx_n_u_pyx_state __pyx_string_tab[29] -#define __pyx_n_u_pyx_vtable __pyx_string_tab[30] -#define __pyx_n_u_qualname __pyx_string_tab[31] -#define __pyx_n_u_reduce __pyx_string_tab[32] -#define __pyx_n_u_reduce_cython __pyx_string_tab[33] -#define __pyx_n_u_reduce_ex __pyx_string_tab[34] -#define __pyx_n_u_self __pyx_string_tab[35] -#define __pyx_n_u_set_name __pyx_string_tab[36] -#define __pyx_n_u_setdefault __pyx_string_tab[37] -#define __pyx_n_u_setstate __pyx_string_tab[38] -#define __pyx_n_u_setstate_cython __pyx_string_tab[39] -#define __pyx_n_u_t __pyx_string_tab[40] -#define __pyx_n_u_test __pyx_string_tab[41] -#define __pyx_n_u_typing __pyx_string_tab[42] -#define __pyx_n_u_values __pyx_string_tab[43] -#define __pyx_kp_b_iso88591_Q __pyx_string_tab[44] +#define __pyx_kp_u_self__data_is_not_None_or_self __pyx_string_tab[9] +#define __pyx_kp_u_stringsource __pyx_string_tab[10] +#define __pyx_n_u_Block __pyx_string_tab[11] +#define __pyx_n_u_Block___reduce_cython __pyx_string_tab[12] +#define __pyx_n_u_Block___setstate_cython __pyx_string_tab[13] +#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[14] +#define __pyx_n_u_StringHolder __pyx_string_tab[15] +#define __pyx_n_u_StringHolder___reduce_cython __pyx_string_tab[16] +#define __pyx_n_u_StringHolder___setstate_cython __pyx_string_tab[17] +#define __pyx_n_u_TIMEZONE_UTC __pyx_string_tab[18] +#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[19] +#define __pyx_n_u_cline_in_traceback __pyx_string_tab[20] +#define __pyx_n_u_current_time_tz __pyx_string_tab[21] +#define __pyx_n_u_data __pyx_string_tab[22] +#define __pyx_n_u_datetime __pyx_string_tab[23] +#define __pyx_n_u_dict __pyx_string_tab[24] +#define __pyx_n_u_dict_2 __pyx_string_tab[25] +#define __pyx_n_u_dopt_basics __pyx_string_tab[26] +#define __pyx_n_u_dopt_basics_datetime __pyx_string_tab[27] +#define __pyx_n_u_fromtimestamp __pyx_string_tab[28] +#define __pyx_n_u_func __pyx_string_tab[29] +#define __pyx_n_u_getstate __pyx_string_tab[30] +#define __pyx_n_u_index __pyx_string_tab[31] +#define __pyx_n_u_is_coroutine __pyx_string_tab[32] +#define __pyx_n_u_items __pyx_string_tab[33] +#define __pyx_n_u_length __pyx_string_tab[34] +#define __pyx_n_u_main __pyx_string_tab[35] +#define __pyx_n_u_module __pyx_string_tab[36] +#define __pyx_n_u_name __pyx_string_tab[37] +#define __pyx_n_u_new __pyx_string_tab[38] +#define __pyx_n_u_nonce __pyx_string_tab[39] +#define __pyx_n_u_polluck_blockchain_placeholder __pyx_string_tab[40] +#define __pyx_n_u_pop __pyx_string_tab[41] +#define __pyx_n_u_previous_hash __pyx_string_tab[42] +#define __pyx_n_u_ptr __pyx_string_tab[43] +#define __pyx_n_u_py_string __pyx_string_tab[44] +#define __pyx_n_u_pyx_checksum __pyx_string_tab[45] +#define __pyx_n_u_pyx_result __pyx_string_tab[46] +#define __pyx_n_u_pyx_state __pyx_string_tab[47] +#define __pyx_n_u_pyx_type __pyx_string_tab[48] +#define __pyx_n_u_pyx_unpickle_Block __pyx_string_tab[49] +#define __pyx_n_u_qualname __pyx_string_tab[50] +#define __pyx_n_u_reduce __pyx_string_tab[51] +#define __pyx_n_u_reduce_cython __pyx_string_tab[52] +#define __pyx_n_u_reduce_ex __pyx_string_tab[53] +#define __pyx_n_u_self __pyx_string_tab[54] +#define __pyx_n_u_set_name __pyx_string_tab[55] +#define __pyx_n_u_setdefault __pyx_string_tab[56] +#define __pyx_n_u_setstate __pyx_string_tab[57] +#define __pyx_n_u_setstate_cython __pyx_string_tab[58] +#define __pyx_n_u_state __pyx_string_tab[59] +#define __pyx_n_u_test __pyx_string_tab[60] +#define __pyx_n_u_timestamp __pyx_string_tab[61] +#define __pyx_n_u_update __pyx_string_tab[62] +#define __pyx_n_u_use_setstate __pyx_string_tab[63] +#define __pyx_n_u_values __pyx_string_tab[64] +#define __pyx_kp_b_iso88591_1F __pyx_string_tab[65] +#define __pyx_kp_b_iso88591_Q __pyx_string_tab[66] +#define __pyx_kp_b_iso88591_T_Yd_4_D_G1F_a_vWE_Q_q_q_d_7_WA __pyx_string_tab[67] +#define __pyx_kp_b_iso88591_q_0_kQR_5_7_q_a_1 __pyx_string_tab[68] +#define __pyx_int_73771738 __pyx_number_tab[0] /* #### Code section: module_state_clear ### */ #if CYTHON_USE_MODULE_STATE static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) { @@ -2494,11 +2562,14 @@ static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) { #if CYTHON_PEP489_MULTI_PHASE_INIT __Pyx_State_RemoveModule(NULL); #endif - Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type); Py_CLEAR(clear_module_state->__pyx_ptype_18polluck_blockchain_11placeholder_StringHolder); Py_CLEAR(clear_module_state->__pyx_type_18polluck_blockchain_11placeholder_StringHolder); - for (int i=0; i<2; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } - for (int i=0; i<45; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } + Py_CLEAR(clear_module_state->__pyx_ptype_18polluck_blockchain_11placeholder_Block); + Py_CLEAR(clear_module_state->__pyx_type_18polluck_blockchain_11placeholder_Block); + for (int i=0; i<1; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); } + for (int i=0; i<5; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<69; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } + for (int i=0; i<1; ++i) { Py_CLEAR(clear_module_state->__pyx_number_tab[i]); } /* #### Code section: module_state_clear_contents ### */ /* CommonTypesMetaclass.module_state_clear */ Py_CLEAR(clear_module_state->__pyx_CommonTypesMetaclassType); @@ -2521,11 +2592,14 @@ static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_tuple); __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_bytes); __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_unicode); - Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type); Py_VISIT(traverse_module_state->__pyx_ptype_18polluck_blockchain_11placeholder_StringHolder); Py_VISIT(traverse_module_state->__pyx_type_18polluck_blockchain_11placeholder_StringHolder); - for (int i=0; i<2; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } - for (int i=0; i<45; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } + Py_VISIT(traverse_module_state->__pyx_ptype_18polluck_blockchain_11placeholder_Block); + Py_VISIT(traverse_module_state->__pyx_type_18polluck_blockchain_11placeholder_Block); + for (int i=0; i<1; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); } + for (int i=0; i<5; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<69; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } + for (int i=0; i<1; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_number_tab[i]); } /* #### Code section: module_state_traverse_contents ### */ /* CommonTypesMetaclass.module_state_traverse */ Py_VISIT(traverse_module_state->__pyx_CommonTypesMetaclassType); @@ -2539,10 +2613,198 @@ return 0; #endif /* #### Code section: module_code ### */ -/* "polluck_blockchain/placeholder.py":15 - * _py_cache = cython.declare(object, visibility="private") +/* "polluck_blockchain/placeholder.py":18 * - * def __cinit__(self, data: str) -> None: # <<<<<<<<<<<<<< + * + * @cython.cfunc # <<<<<<<<<<<<<< + * def PyStringC_to_unicode( + * string: PyStringC, +*/ + +static PyObject *__pyx_f_18polluck_blockchain_11placeholder_PyStringC_to_unicode(struct __pyx_t_18polluck_blockchain_11placeholder_PyStringC __pyx_v_string) { + 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("PyStringC_to_unicode", 0); + + /* "polluck_blockchain/placeholder.py":22 + * string: PyStringC, + * ) -> str: + * return string.ptr[: string.length].decode("UTF-8", "strict") # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_decode_c_string(__pyx_v_string.ptr, 0, __pyx_v_string.length, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "polluck_blockchain/placeholder.py":18 + * + * + * @cython.cfunc # <<<<<<<<<<<<<< + * def PyStringC_to_unicode( + * string: PyStringC, +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("polluck_blockchain.placeholder.PyStringC_to_unicode", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "polluck_blockchain/placeholder.py":25 + * + * + * @cython.cfunc # <<<<<<<<<<<<<< + * def PyStringC_to_bytes( + * string: PyStringC, +*/ + +static PyObject *__pyx_f_18polluck_blockchain_11placeholder_PyStringC_to_bytes(struct __pyx_t_18polluck_blockchain_11placeholder_PyStringC __pyx_v_string) { + 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("PyStringC_to_bytes", 0); + + /* "polluck_blockchain/placeholder.py":29 + * string: PyStringC, + * ) -> bytes: + * return cython.cast(bytes, string.ptr[: string.length]) # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_string.ptr + 0, __pyx_v_string.length - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject*)__pyx_t_1)); + __pyx_r = ((PyObject*)__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + + /* "polluck_blockchain/placeholder.py":25 + * + * + * @cython.cfunc # <<<<<<<<<<<<<< + * def PyStringC_to_bytes( + * string: PyStringC, +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("polluck_blockchain.placeholder.PyStringC_to_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "polluck_blockchain/placeholder.py":32 + * + * + * @cython.cfunc # <<<<<<<<<<<<<< + * def timestamp_to_datetime( + * ts: cython.double, +*/ + +static PyObject *__pyx_f_18polluck_blockchain_11placeholder_timestamp_to_datetime(double __pyx_v_ts) { + 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; + size_t __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("timestamp_to_datetime", 0); + + /* "polluck_blockchain/placeholder.py":36 + * ts: cython.double, + * ) -> datetime.datetime: + * return datetime.datetime.fromtimestamp(ts, dopt_basics.datetime.TIMEZONE_UTC) # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_datetime); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_datetime); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __pyx_t_4; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_ts); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_dopt_basics); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_datetime); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_TIMEZONE_UTC); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_3, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_fromtimestamp, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "polluck_blockchain/placeholder.py":32 + * + * + * @cython.cfunc # <<<<<<<<<<<<<< + * def timestamp_to_datetime( + * ts: cython.double, +*/ + + /* 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_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("polluck_blockchain.placeholder.timestamp_to_datetime", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "polluck_blockchain/placeholder.py":44 + * _py_data = cython.declare(object, visibility="private") + * + * def __cinit__(self, data: str): # <<<<<<<<<<<<<< * """accepting Python str * */ @@ -2569,32 +2831,32 @@ static int __pyx_pw_18polluck_blockchain_11placeholder_12StringHolder_1__cinit__ { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_data,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 15, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 44, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 15, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 44, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(0, 15, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(0, 44, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, i); __PYX_ERR(0, 15, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, i); __PYX_ERR(0, 44, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 15, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 44, __pyx_L3_error) } __pyx_v_data = ((PyObject*)values[0]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 15, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 44, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -2605,7 +2867,7 @@ static int __pyx_pw_18polluck_blockchain_11placeholder_12StringHolder_1__cinit__ __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), (&PyUnicode_Type), 0, "data", 2))) __PYX_ERR(0, 15, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), (&PyUnicode_Type), 0, "data", 2))) __PYX_ERR(0, 44, __pyx_L1_error) __pyx_r = __pyx_pf_18polluck_blockchain_11placeholder_12StringHolder___cinit__(((struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder *)__pyx_v_self), __pyx_v_data); /* function exit code */ @@ -2626,7 +2888,6 @@ static int __pyx_pw_18polluck_blockchain_11placeholder_12StringHolder_1__cinit__ } static int __pyx_pf_18polluck_blockchain_11placeholder_12StringHolder___cinit__(struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder *__pyx_v_self, PyObject *__pyx_v_data) { - PyObject *__pyx_v_tmp = NULL; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -2634,14 +2895,15 @@ static int __pyx_pf_18polluck_blockchain_11placeholder_12StringHolder___cinit__( PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; - char *__pyx_t_6; - Py_ssize_t __pyx_t_7; + struct __pyx_t_18polluck_blockchain_11placeholder_PyStringC __pyx_t_6; + char *__pyx_t_7; + Py_ssize_t __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "polluck_blockchain/placeholder.py":23 + /* "polluck_blockchain/placeholder.py":52 * _description_ * """ * if not isinstance(data, str): # <<<<<<<<<<<<<< @@ -2652,12 +2914,12 @@ static int __pyx_pf_18polluck_blockchain_11placeholder_12StringHolder___cinit__( __pyx_t_2 = (!__pyx_t_1); if (unlikely(__pyx_t_2)) { - /* "polluck_blockchain/placeholder.py":24 + /* "polluck_blockchain/placeholder.py":53 * """ * if not isinstance(data, str): * raise TypeError("Data not 'str'") # <<<<<<<<<<<<<< * - * tmp = data.encode("utf-8") + * self._py_data = data.encode("UTF-8") */ __pyx_t_4 = NULL; __pyx_t_5 = 1; @@ -2665,14 +2927,14 @@ static int __pyx_pf_18polluck_blockchain_11placeholder_12StringHolder___cinit__( PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Data_not_str}; __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 24, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 53, __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, 24, __pyx_L1_error) + __PYX_ERR(0, 53, __pyx_L1_error) - /* "polluck_blockchain/placeholder.py":23 + /* "polluck_blockchain/placeholder.py":52 * _description_ * """ * if not isinstance(data, str): # <<<<<<<<<<<<<< @@ -2681,64 +2943,41 @@ static int __pyx_pf_18polluck_blockchain_11placeholder_12StringHolder___cinit__( */ } - /* "polluck_blockchain/placeholder.py":26 + /* "polluck_blockchain/placeholder.py":55 * raise TypeError("Data not 'str'") * - * tmp = data.encode("utf-8") # <<<<<<<<<<<<<< - * Py_INCREF(tmp) - * self._data = tmp + * self._py_data = data.encode("UTF-8") # <<<<<<<<<<<<<< + * self.c = PyStringC(self._py_data, len(self._py_data)) + * */ - __pyx_t_3 = PyUnicode_AsUTF8String(__pyx_v_data); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 26, __pyx_L1_error) + __pyx_t_3 = PyUnicode_AsUTF8String(__pyx_v_data); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_v_tmp = ((PyObject*)__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_self->_py_data); + __Pyx_DECREF(__pyx_v_self->_py_data); + __pyx_v_self->_py_data = __pyx_t_3; __pyx_t_3 = 0; - /* "polluck_blockchain/placeholder.py":27 + /* "polluck_blockchain/placeholder.py":56 * - * tmp = data.encode("utf-8") - * Py_INCREF(tmp) # <<<<<<<<<<<<<< - * self._data = tmp - * self._length = len(tmp) -*/ - Py_INCREF(__pyx_v_tmp); - - /* "polluck_blockchain/placeholder.py":28 - * tmp = data.encode("utf-8") - * Py_INCREF(tmp) - * self._data = tmp # <<<<<<<<<<<<<< - * self._length = len(tmp) - * self._py_cache = None -*/ - __pyx_t_6 = __Pyx_PyBytes_AsWritableString(__pyx_v_tmp); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 28, __pyx_L1_error) - __pyx_v_self->_data = __pyx_t_6; - - /* "polluck_blockchain/placeholder.py":29 - * Py_INCREF(tmp) - * self._data = tmp - * self._length = len(tmp) # <<<<<<<<<<<<<< - * self._py_cache = None + * self._py_data = data.encode("UTF-8") + * self.c = PyStringC(self._py_data, len(self._py_data)) # <<<<<<<<<<<<<< * + * @property */ - __pyx_t_7 = __Pyx_PyBytes_GET_SIZE(__pyx_v_tmp); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 29, __pyx_L1_error) - __pyx_v_self->_length = __pyx_t_7; + __pyx_t_7 = __Pyx_PyObject_AsWritableString(__pyx_v_self->_py_data); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 56, __pyx_L1_error) + __pyx_t_6.ptr = __pyx_t_7; + __pyx_t_3 = __pyx_v_self->_py_data; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_8 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6.length = __pyx_t_8; + __pyx_v_self->c = __pyx_t_6; - /* "polluck_blockchain/placeholder.py":30 - * self._data = tmp - * self._length = len(tmp) - * self._py_cache = None # <<<<<<<<<<<<<< + /* "polluck_blockchain/placeholder.py":44 + * _py_data = cython.declare(object, visibility="private") * - * @cython.cfunc -*/ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->_py_cache); - __Pyx_DECREF(__pyx_v_self->_py_cache); - __pyx_v_self->_py_cache = Py_None; - - /* "polluck_blockchain/placeholder.py":15 - * _py_cache = cython.declare(object, visibility="private") - * - * def __cinit__(self, data: str) -> None: # <<<<<<<<<<<<<< + * def __cinit__(self, data: str): # <<<<<<<<<<<<<< * """accepting Python str * */ @@ -2752,124 +2991,16 @@ static int __pyx_pf_18polluck_blockchain_11placeholder_12StringHolder___cinit__( __Pyx_AddTraceback("polluck_blockchain.placeholder.StringHolder.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_tmp); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "polluck_blockchain/placeholder.py":32 - * self._py_cache = None - * - * @cython.cfunc # <<<<<<<<<<<<<< - * def _bytes_to_str(self) -> str: - * tmp = t.cast(bytes, self._data[: self._length]) -*/ - -static PyObject *__pyx_f_18polluck_blockchain_11placeholder_12StringHolder__bytes_to_str(struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder *__pyx_v_self) { - PyObject *__pyx_v_tmp = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - size_t __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_bytes_to_str", 0); - - /* "polluck_blockchain/placeholder.py":34 - * @cython.cfunc - * def _bytes_to_str(self) -> str: - * tmp = t.cast(bytes, self._data[: self._length]) # <<<<<<<<<<<<<< - * return tmp.decode("utf-8") - * -*/ - __pyx_t_2 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_self->_data + 0, __pyx_v_self->_length - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = 1; - #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); - assert(__pyx_t_2); - PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx__function); - __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); - __pyx_t_5 = 0; - } - #endif - { - PyObject *__pyx_callargs[3] = {__pyx_t_2, ((PyObject *)(&PyBytes_Type)), __pyx_t_3}; - __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } - __pyx_v_tmp = __pyx_t_1; - __pyx_t_1 = 0; - - /* "polluck_blockchain/placeholder.py":35 - * def _bytes_to_str(self) -> str: - * tmp = t.cast(bytes, self._data[: self._length]) - * return tmp.decode("utf-8") # <<<<<<<<<<<<<< - * - * @property -*/ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __pyx_v_tmp; - __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = 0; - { - PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_utf_8}; - __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_decode, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } - if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(0, 35, __pyx_L1_error) - __pyx_r = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "polluck_blockchain/placeholder.py":32 - * self._py_cache = None - * - * @cython.cfunc # <<<<<<<<<<<<<< - * def _bytes_to_str(self) -> str: - * tmp = t.cast(bytes, self._data[: self._length]) -*/ - - /* 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("polluck_blockchain.placeholder.StringHolder._bytes_to_str", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_tmp); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "polluck_blockchain/placeholder.py":37 - * return tmp.decode("utf-8") +/* "polluck_blockchain/placeholder.py":58 + * self.c = PyStringC(self._py_data, len(self._py_data)) * * @property # <<<<<<<<<<<<<< - * def py_string(self) -> str: - * if self._py_cache is None: + * def py_string(self): + * return PyStringC_to_unicode(self.c) */ /* Python wrapper */ @@ -2890,103 +3021,37 @@ static PyObject *__pyx_pw_18polluck_blockchain_11placeholder_12StringHolder_9py_ static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_12StringHolder_9py_string___get__(struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - size_t __pyx_t_6; + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "polluck_blockchain/placeholder.py":39 + /* "polluck_blockchain/placeholder.py":60 * @property - * def py_string(self) -> str: - * if self._py_cache is None: # <<<<<<<<<<<<<< - * self._py_cache = self._bytes_to_str() - * return t.cast(str, self._py_cache) -*/ - __pyx_t_1 = (__pyx_v_self->_py_cache == Py_None); - if (__pyx_t_1) { - - /* "polluck_blockchain/placeholder.py":40 - * def py_string(self) -> str: - * if self._py_cache is None: - * self._py_cache = self._bytes_to_str() # <<<<<<<<<<<<<< - * return t.cast(str, self._py_cache) - * -*/ - __pyx_t_2 = ((struct __pyx_vtabstruct_18polluck_blockchain_11placeholder_StringHolder *)__pyx_v_self->__pyx_vtab)->_bytes_to_str(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_self->_py_cache); - __Pyx_DECREF(__pyx_v_self->_py_cache); - __pyx_v_self->_py_cache = __pyx_t_2; - __pyx_t_2 = 0; - - /* "polluck_blockchain/placeholder.py":39 - * @property - * def py_string(self) -> str: - * if self._py_cache is None: # <<<<<<<<<<<<<< - * self._py_cache = self._bytes_to_str() - * return t.cast(str, self._py_cache) -*/ - } - - /* "polluck_blockchain/placeholder.py":41 - * if self._py_cache is None: - * self._py_cache = self._bytes_to_str() - * return t.cast(str, self._py_cache) # <<<<<<<<<<<<<< + * def py_string(self): + * return PyStringC_to_unicode(self.c) # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_t); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = 1; - #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); - assert(__pyx_t_3); - PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(__pyx__function); - __Pyx_DECREF_SET(__pyx_t_5, __pyx__function); - __pyx_t_6 = 0; - } - #endif - { - PyObject *__pyx_callargs[3] = {__pyx_t_3, ((PyObject *)(&PyUnicode_Type)), __pyx_v_self->_py_cache}; - __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - } - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_1 = __pyx_f_18polluck_blockchain_11placeholder_PyStringC_to_unicode(__pyx_v_self->c); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; - /* "polluck_blockchain/placeholder.py":37 - * return tmp.decode("utf-8") + /* "polluck_blockchain/placeholder.py":58 + * self.c = PyStringC(self._py_data, len(self._py_data)) * * @property # <<<<<<<<<<<<<< - * def py_string(self) -> str: - * if self._py_cache is None: + * def py_string(self): + * return PyStringC_to_unicode(self.c) */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("polluck_blockchain.placeholder.StringHolder.py_string.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -2995,12 +3060,12 @@ static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_12StringHolder_9py_ return __pyx_r; } -/* "polluck_blockchain/placeholder.py":43 - * return t.cast(str, self._py_cache) +/* "polluck_blockchain/placeholder.py":62 + * return PyStringC_to_unicode(self.c) * * @property # <<<<<<<<<<<<<< - * def py_bytes(self) -> bytes: - * return t.cast(bytes, self._data[: self._length]) + * def py_bytes(self): + * return PyStringC_to_bytes(self.c) */ /* Python wrapper */ @@ -3022,68 +3087,36 @@ static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_12StringHolder_8py_ 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; - size_t __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "polluck_blockchain/placeholder.py":45 + /* "polluck_blockchain/placeholder.py":64 * @property - * def py_bytes(self) -> bytes: - * return t.cast(bytes, self._data[: self._length]) # <<<<<<<<<<<<<< + * def py_bytes(self): + * return PyStringC_to_bytes(self.c) # <<<<<<<<<<<<<< + * + * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_self->_data + 0, __pyx_v_self->_length - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = 1; - #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); - assert(__pyx_t_2); - PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx__function); - __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); - __pyx_t_5 = 0; - } - #endif - { - PyObject *__pyx_callargs[3] = {__pyx_t_2, ((PyObject *)(&PyBytes_Type)), __pyx_t_3}; - __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } + __pyx_t_1 = __pyx_f_18polluck_blockchain_11placeholder_PyStringC_to_bytes(__pyx_v_self->c); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "polluck_blockchain/placeholder.py":43 - * return t.cast(str, self._py_cache) + /* "polluck_blockchain/placeholder.py":62 + * return PyStringC_to_unicode(self.c) * * @property # <<<<<<<<<<<<<< - * def py_bytes(self) -> bytes: - * return t.cast(bytes, self._data[: self._length]) + * def py_bytes(self): + * return PyStringC_to_bytes(self.c) */ /* 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("polluck_blockchain.placeholder.StringHolder.py_bytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -3092,30 +3125,30 @@ static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_12StringHolder_8py_ return __pyx_r; } -/* "polluck_blockchain/placeholder.py":12 +/* "polluck_blockchain/placeholder.py":41 + * @cython.cclass * class StringHolder: - * _data = cython.declare(cython.p_char, visibility="private") - * _length = cython.declare(cython.Py_ssize_t, visibility="readonly") # <<<<<<<<<<<<<< - * _py_cache = cython.declare(object, visibility="private") + * c = cython.declare(PyStringC, visibility="readonly") # <<<<<<<<<<<<<< + * _py_data = cython.declare(object, visibility="private") * */ /* Python wrapper */ -static PyObject *__pyx_pw_18polluck_blockchain_11placeholder_12StringHolder_7_length_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_18polluck_blockchain_11placeholder_12StringHolder_7_length_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_18polluck_blockchain_11placeholder_12StringHolder_1c_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_18polluck_blockchain_11placeholder_12StringHolder_1c_1__get__(PyObject *__pyx_v_self) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - __pyx_r = __pyx_pf_18polluck_blockchain_11placeholder_12StringHolder_7_length___get__(((struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder *)__pyx_v_self)); + __pyx_r = __pyx_pf_18polluck_blockchain_11placeholder_12StringHolder_1c___get__(((struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_12StringHolder_7_length___get__(struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder *__pyx_v_self) { +static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_12StringHolder_1c___get__(struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3124,7 +3157,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_12StringHolder_7_le int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_self->_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error) + __pyx_t_1 = __pyx_convert__to_py_struct____pyx_t_18polluck_blockchain_11placeholder_PyStringC(__pyx_v_self->c); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3133,7 +3166,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_12StringHolder_7_le /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("polluck_blockchain.placeholder.StringHolder._length.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("polluck_blockchain.placeholder.StringHolder.c.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3344,8 +3377,1390 @@ static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_12StringHolder_4__s __Pyx_RefNannyFinishContext(); return __pyx_r; } + +/* "polluck_blockchain/placeholder.py":84 + * _nonce = cython.declare(cython.ulong, visibility="private") + * + * def __init__( # <<<<<<<<<<<<<< + * self, + * index: int, +*/ + +/* Python wrapper */ +static int __pyx_pw_18polluck_blockchain_11placeholder_5Block_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_18polluck_blockchain_11placeholder_5Block_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_index = 0; + PyObject *__pyx_v_data = 0; + PyObject *__pyx_v_previous_hash = 0; + PyObject *__pyx_v_nonce = 0; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[4] = {0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1; + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_index,&__pyx_mstate_global->__pyx_n_u_data,&__pyx_mstate_global->__pyx_n_u_previous_hash,&__pyx_mstate_global->__pyx_n_u_nonce,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 84, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 4: + values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 84, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 84, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 84, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 84, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 84, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 4; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, i); __PYX_ERR(0, 84, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 4)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 84, __pyx_L3_error) + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 84, __pyx_L3_error) + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 84, __pyx_L3_error) + values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 84, __pyx_L3_error) + } + if (__Pyx_PyInt_FromNumber(&values[0], "index", 0) < (0)) __PYX_ERR(0, 86, __pyx_L3_error) + __pyx_v_index = ((PyObject*)values[0]); + __pyx_v_data = ((PyObject*)values[1]); + __pyx_v_previous_hash = ((PyObject*)values[2]); + if (__Pyx_PyInt_FromNumber(&values[3], "nonce", 0) < (0)) __PYX_ERR(0, 89, __pyx_L3_error) + __pyx_v_nonce = ((PyObject*)values[3]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 84, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("polluck_blockchain.placeholder.Block.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), (&PyLong_Type), 0, "index", 2))) __PYX_ERR(0, 86, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), (&PyUnicode_Type), 0, "data", 2))) __PYX_ERR(0, 87, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_previous_hash), (&PyUnicode_Type), 0, "previous_hash", 2))) __PYX_ERR(0, 88, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nonce), (&PyLong_Type), 0, "nonce", 2))) __PYX_ERR(0, 89, __pyx_L1_error) + __pyx_r = __pyx_pf_18polluck_blockchain_11placeholder_5Block___init__(((struct __pyx_obj_18polluck_blockchain_11placeholder_Block *)__pyx_v_self), __pyx_v_index, __pyx_v_data, __pyx_v_previous_hash, __pyx_v_nonce); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + goto __pyx_L7_cleaned_up; + __pyx_L0:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __pyx_L7_cleaned_up:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_18polluck_blockchain_11placeholder_5Block___init__(struct __pyx_obj_18polluck_blockchain_11placeholder_Block *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_data, PyObject *__pyx_v_previous_hash, PyObject *__pyx_v_nonce) { + int __pyx_r; + __Pyx_RefNannyDeclarations + unsigned long __pyx_t_1; + 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; + size_t __pyx_t_8; + double __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "polluck_blockchain/placeholder.py":91 + * nonce: int, + * ): + * self._index = index # <<<<<<<<<<<<<< + * self._timestamp = dopt_basics.datetime.current_time_tz().timestamp() + * self._data = StringHolder.__new__(StringHolder, data) +*/ + __pyx_t_1 = __Pyx_PyLong_As_unsigned_long(__pyx_v_index); if (unlikely((__pyx_t_1 == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 91, __pyx_L1_error) + __pyx_v_self->_index = __pyx_t_1; + + /* "polluck_blockchain/placeholder.py":92 + * ): + * self._index = index + * self._timestamp = dopt_basics.datetime.current_time_tz().timestamp() # <<<<<<<<<<<<<< + * self._data = StringHolder.__new__(StringHolder, data) + * self._prev_hash = StringHolder.__new__(StringHolder, previous_hash) +*/ + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_dopt_basics); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 92, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_datetime); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 92, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_5 = __pyx_t_7; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_current_time_tz, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 92, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_3 = __pyx_t_4; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_timestamp, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_9 = __Pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 92, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_self->_timestamp = __pyx_t_9; + + /* "polluck_blockchain/placeholder.py":93 + * self._index = index + * self._timestamp = dopt_basics.datetime.current_time_tz().timestamp() + * self._data = StringHolder.__new__(StringHolder, data) # <<<<<<<<<<<<<< + * self._prev_hash = StringHolder.__new__(StringHolder, previous_hash) + * self._nonce = nonce +*/ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 93, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_data); + __Pyx_GIVEREF(__pyx_v_data); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_data) != (0)) __PYX_ERR(0, 93, __pyx_L1_error); + __pyx_t_4 = ((PyObject *)__pyx_tp_new_18polluck_blockchain_11placeholder_StringHolder(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_18polluck_blockchain_11placeholder_StringHolder), __pyx_t_2, NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 93, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __Pyx_GOTREF((PyObject *)__pyx_v_self->_data); + __Pyx_DECREF((PyObject *)__pyx_v_self->_data); + __pyx_v_self->_data = ((struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "polluck_blockchain/placeholder.py":94 + * self._timestamp = dopt_basics.datetime.current_time_tz().timestamp() + * self._data = StringHolder.__new__(StringHolder, data) + * self._prev_hash = StringHolder.__new__(StringHolder, previous_hash) # <<<<<<<<<<<<<< + * self._nonce = nonce + * +*/ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 94, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_previous_hash); + __Pyx_GIVEREF(__pyx_v_previous_hash); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_previous_hash) != (0)) __PYX_ERR(0, 94, __pyx_L1_error); + __pyx_t_2 = ((PyObject *)__pyx_tp_new_18polluck_blockchain_11placeholder_StringHolder(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_18polluck_blockchain_11placeholder_StringHolder), __pyx_t_4, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GIVEREF((PyObject *)__pyx_t_2); + __Pyx_GOTREF((PyObject *)__pyx_v_self->_prev_hash); + __Pyx_DECREF((PyObject *)__pyx_v_self->_prev_hash); + __pyx_v_self->_prev_hash = ((struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "polluck_blockchain/placeholder.py":95 + * self._data = StringHolder.__new__(StringHolder, data) + * self._prev_hash = StringHolder.__new__(StringHolder, previous_hash) + * self._nonce = nonce # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_t_1 = __Pyx_PyLong_As_unsigned_long(__pyx_v_nonce); if (unlikely((__pyx_t_1 == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 95, __pyx_L1_error) + __pyx_v_self->_nonce = __pyx_t_1; + + /* "polluck_blockchain/placeholder.py":84 + * _nonce = cython.declare(cython.ulong, visibility="private") + * + * def __init__( # <<<<<<<<<<<<<< + * self, + * index: int, +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("polluck_blockchain.placeholder.Block.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "polluck_blockchain/placeholder.py":97 + * self._nonce = nonce + * + * @property # <<<<<<<<<<<<<< + * def index(self): + * return self._index +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_18polluck_blockchain_11placeholder_5Block_5index_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_18polluck_blockchain_11placeholder_5Block_5index_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_18polluck_blockchain_11placeholder_5Block_5index___get__(((struct __pyx_obj_18polluck_blockchain_11placeholder_Block *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_5Block_5index___get__(struct __pyx_obj_18polluck_blockchain_11placeholder_Block *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "polluck_blockchain/placeholder.py":99 + * @property + * def index(self): + * return self._index # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_unsigned_long(__pyx_v_self->_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "polluck_blockchain/placeholder.py":97 + * self._nonce = nonce + * + * @property # <<<<<<<<<<<<<< + * def index(self): + * return self._index +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("polluck_blockchain.placeholder.Block.index.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "polluck_blockchain/placeholder.py":101 + * return self._index + * + * @property # <<<<<<<<<<<<<< + * def timestamp(self): + * return timestamp_to_datetime(self._timestamp) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_18polluck_blockchain_11placeholder_5Block_9timestamp_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_18polluck_blockchain_11placeholder_5Block_9timestamp_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_18polluck_blockchain_11placeholder_5Block_9timestamp___get__(((struct __pyx_obj_18polluck_blockchain_11placeholder_Block *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_5Block_9timestamp___get__(struct __pyx_obj_18polluck_blockchain_11placeholder_Block *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "polluck_blockchain/placeholder.py":103 + * @property + * def timestamp(self): + * return timestamp_to_datetime(self._timestamp) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_18polluck_blockchain_11placeholder_timestamp_to_datetime(__pyx_v_self->_timestamp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "polluck_blockchain/placeholder.py":101 + * return self._index + * + * @property # <<<<<<<<<<<<<< + * def timestamp(self): + * return timestamp_to_datetime(self._timestamp) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("polluck_blockchain.placeholder.Block.timestamp.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "polluck_blockchain/placeholder.py":105 + * return timestamp_to_datetime(self._timestamp) + * + * @property # <<<<<<<<<<<<<< + * def data(self): + * return self._data.py_string +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_18polluck_blockchain_11placeholder_5Block_4data_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_18polluck_blockchain_11placeholder_5Block_4data_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_18polluck_blockchain_11placeholder_5Block_4data___get__(((struct __pyx_obj_18polluck_blockchain_11placeholder_Block *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_5Block_4data___get__(struct __pyx_obj_18polluck_blockchain_11placeholder_Block *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "polluck_blockchain/placeholder.py":107 + * @property + * def data(self): + * return self._data.py_string # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_data), __pyx_mstate_global->__pyx_n_u_py_string); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "polluck_blockchain/placeholder.py":105 + * return timestamp_to_datetime(self._timestamp) + * + * @property # <<<<<<<<<<<<<< + * def data(self): + * return self._data.py_string +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("polluck_blockchain.placeholder.Block.data.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "polluck_blockchain/placeholder.py":109 + * return self._data.py_string + * + * @property # <<<<<<<<<<<<<< + * def prev_hash(self): + * return self._prev_hash.py_string +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_18polluck_blockchain_11placeholder_5Block_9prev_hash_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_18polluck_blockchain_11placeholder_5Block_9prev_hash_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_18polluck_blockchain_11placeholder_5Block_9prev_hash___get__(((struct __pyx_obj_18polluck_blockchain_11placeholder_Block *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_5Block_9prev_hash___get__(struct __pyx_obj_18polluck_blockchain_11placeholder_Block *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "polluck_blockchain/placeholder.py":111 + * @property + * def prev_hash(self): + * return self._prev_hash.py_string # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_prev_hash), __pyx_mstate_global->__pyx_n_u_py_string); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "polluck_blockchain/placeholder.py":109 + * return self._data.py_string + * + * @property # <<<<<<<<<<<<<< + * def prev_hash(self): + * return self._prev_hash.py_string +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("polluck_blockchain.placeholder.Block.prev_hash.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "polluck_blockchain/placeholder.py":113 + * return self._prev_hash.py_string + * + * @property # <<<<<<<<<<<<<< + * def nonce(self): + * return self._nonce +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_18polluck_blockchain_11placeholder_5Block_5nonce_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_18polluck_blockchain_11placeholder_5Block_5nonce_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_18polluck_blockchain_11placeholder_5Block_5nonce___get__(((struct __pyx_obj_18polluck_blockchain_11placeholder_Block *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_5Block_5nonce___get__(struct __pyx_obj_18polluck_blockchain_11placeholder_Block *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "polluck_blockchain/placeholder.py":115 + * @property + * def nonce(self): + * return self._nonce # <<<<<<<<<<<<<< + * + * @nonce.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_unsigned_long(__pyx_v_self->_nonce); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 115, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "polluck_blockchain/placeholder.py":113 + * return self._prev_hash.py_string + * + * @property # <<<<<<<<<<<<<< + * def nonce(self): + * return self._nonce +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("polluck_blockchain.placeholder.Block.nonce.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "polluck_blockchain/placeholder.py":117 + * return self._nonce + * + * @nonce.setter # <<<<<<<<<<<<<< + * def nonce(self, value: int): + * self._nonce = value +*/ + +/* Python wrapper */ +static int __pyx_pw_18polluck_blockchain_11placeholder_5Block_5nonce_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_18polluck_blockchain_11placeholder_5Block_5nonce_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_value), (&PyLong_Type), 0, "value", 2))) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_r = __pyx_pf_18polluck_blockchain_11placeholder_5Block_5nonce_2__set__(((struct __pyx_obj_18polluck_blockchain_11placeholder_Block *)__pyx_v_self), ((PyObject*)__pyx_v_value)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + goto __pyx_L5_cleaned_up; + __pyx_L0:; + __pyx_L5_cleaned_up:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_18polluck_blockchain_11placeholder_5Block_5nonce_2__set__(struct __pyx_obj_18polluck_blockchain_11placeholder_Block *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + unsigned long __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "polluck_blockchain/placeholder.py":119 + * @nonce.setter + * def nonce(self, value: int): + * self._nonce = value # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __Pyx_PyLong_As_unsigned_long(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 119, __pyx_L1_error) + __pyx_v_self->_nonce = __pyx_t_1; + + /* "polluck_blockchain/placeholder.py":117 + * return self._nonce + * + * @nonce.setter # <<<<<<<<<<<<<< + * def nonce(self, value: int): + * self._nonce = value +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("polluck_blockchain.placeholder.Block.nonce.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_18polluck_blockchain_11placeholder_5Block_3__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_18polluck_blockchain_11placeholder_5Block_3__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_11placeholder_5Block_3__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_18polluck_blockchain_11placeholder_5Block_3__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_18polluck_blockchain_11placeholder_5Block_2__reduce_cython__(((struct __pyx_obj_18polluck_blockchain_11placeholder_Block *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_5Block_2__reduce_cython__(struct __pyx_obj_18polluck_blockchain_11placeholder_Block *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = (self._data, self._index, self._nonce, self._prev_hash, self._timestamp) # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: +*/ + __pyx_t_1 = __Pyx_PyLong_From_unsigned_long(__pyx_v_self->_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyLong_From_unsigned_long(__pyx_v_self->_nonce); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->_timestamp); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF((PyObject *)__pyx_v_self->_data); + __Pyx_GIVEREF((PyObject *)__pyx_v_self->_data); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self->_data)) != (0)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2) != (0)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_INCREF((PyObject *)__pyx_v_self->_prev_hash); + __Pyx_GIVEREF((PyObject *)__pyx_v_self->_prev_hash); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 3, ((PyObject *)__pyx_v_self->_prev_hash)) != (0)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_t_3) != (0)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_v_state = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = (self._data, self._index, self._nonce, self._prev_hash, self._timestamp) + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None and _dict: + * state += (_dict,) +*/ + __pyx_t_4 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_v__dict = __pyx_t_4; + __pyx_t_4 = 0; + + /* "(tree fragment)":7 + * state = (self._data, self._index, self._nonce, self._prev_hash, self._timestamp) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + __pyx_t_6 = (__pyx_v__dict != Py_None); + if (__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(1, 7, __pyx_L1_error) + __pyx_t_5 = __pyx_t_6; + __pyx_L4_bool_binop_done:; + if (__pyx_t_5) { + + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: +*/ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v__dict) != (0)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_3)); + __pyx_t_3 = 0; + + /* "(tree fragment)":9 + * if _dict is not None and _dict: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = ('self._data is not None or self._prev_hash is not None',) +*/ + __pyx_v_use_setstate = 1; + + /* "(tree fragment)":7 + * state = (self._data, self._index, self._nonce, self._prev_hash, self._timestamp) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + goto __pyx_L3; + } + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('self._data is not None or self._prev_hash is not None',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Block, (type(self), 0x465aada, None), state +*/ + /*else*/ { + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_mstate_global->__pyx_tuple[0]); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 11, __pyx_L1_error) + __pyx_v_use_setstate = __pyx_t_5; + } + __pyx_L3:; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('self._data is not None or self._prev_hash is not None',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Block, (type(self), 0x465aada, None), state + * else: +*/ + if (__pyx_v_use_setstate) { + + /* "(tree fragment)":13 + * use_setstate = ('self._data is not None or self._prev_hash is not None',) + * if use_setstate: + * return __pyx_unpickle_Block, (type(self), 0x465aada, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_Block, (type(self), 0x465aada, state) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Block); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_73771738); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_73771738); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_mstate_global->__pyx_int_73771738) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, Py_None) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('self._data is not None or self._prev_hash is not None',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Block, (type(self), 0x465aada, None), state + * else: +*/ + } + + /* "(tree fragment)":15 + * return __pyx_unpickle_Block, (type(self), 0x465aada, None), state + * else: + * return __pyx_unpickle_Block, (type(self), 0x465aada, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Block__set_state(self, __pyx_state) +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Block); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_73771738); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_73771738); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_mstate_global->__pyx_int_73771738) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_4 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + } + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("polluck_blockchain.placeholder.Block.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Block, (type(self), 0x465aada, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Block__set_state(self, __pyx_state) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_18polluck_blockchain_11placeholder_5Block_5__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_18polluck_blockchain_11placeholder_5Block_5__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_11placeholder_5Block_5__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_18polluck_blockchain_11placeholder_5Block_5__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 16, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 16, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 16, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 16, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 16, __pyx_L3_error) + } + __pyx_v___pyx_state = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 16, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("polluck_blockchain.placeholder.Block.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_18polluck_blockchain_11placeholder_5Block_4__setstate_cython__(((struct __pyx_obj_18polluck_blockchain_11placeholder_Block *)__pyx_v_self), __pyx_v___pyx_state); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_5Block_4__setstate_cython__(struct __pyx_obj_18polluck_blockchain_11placeholder_Block *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + 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("__setstate_cython__", 0); + + /* "(tree fragment)":17 + * return __pyx_unpickle_Block, (type(self), 0x465aada, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Block__set_state(self, __pyx_state) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __pyx_v___pyx_state; + __Pyx_INCREF(__pyx_t_1); + if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(1, 17, __pyx_L1_error) + if (unlikely(__pyx_t_1 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'"); + __PYX_ERR(1, 17, __pyx_L1_error) + } + __pyx_t_2 = __pyx_f_18polluck_blockchain_11placeholder___pyx_unpickle_Block__set_state(__pyx_v_self, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Block, (type(self), 0x465aada, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Block__set_state(self, __pyx_state) +*/ + + /* 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("polluck_blockchain.placeholder.Block.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Block(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x465aada, 0x15c3ac3, 0x19f7ebd, b'_data, _index, _nonce, _prev_hash, _timestamp') +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_18polluck_blockchain_11placeholder_1__pyx_unpickle_Block(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_18polluck_blockchain_11placeholder_1__pyx_unpickle_Block = {"__pyx_unpickle_Block", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_11placeholder_1__pyx_unpickle_Block, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_18polluck_blockchain_11placeholder_1__pyx_unpickle_Block(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__pyx_unpickle_Block (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__pyx_mstate_global->__pyx_n_u_pyx_state,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 4, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 3: + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 4, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__pyx_unpickle_Block", 0) < (0)) __PYX_ERR(1, 4, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Block", 1, 3, 3, i); __PYX_ERR(1, 4, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 4, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error) + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error) + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 4, __pyx_L3_error) + __pyx_v___pyx_state = ((PyObject*)values[2]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Block", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 4, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("polluck_blockchain.placeholder.__pyx_unpickle_Block", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(1, 4, __pyx_L1_error) + __pyx_r = __pyx_pf_18polluck_blockchain_11placeholder___pyx_unpickle_Block(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + goto __pyx_L7_cleaned_up; + __pyx_L0:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __pyx_L7_cleaned_up:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_18polluck_blockchain_11placeholder___pyx_unpickle_Block(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Block", 0); + + /* "(tree fragment)":6 + * def __pyx_unpickle_Block(__pyx_type, long __pyx_checksum, tuple __pyx_state): + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x465aada, 0x15c3ac3, 0x19f7ebd, b'_data, _index, _nonce, _prev_hash, _timestamp') # <<<<<<<<<<<<<< + * __pyx_result = Block.__new__(__pyx_type) + * if __pyx_state is not None: +*/ + __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0x465aada, 0x15c3ac3, 0x19f7ebd, ((char const *)"_data, _index, _nonce, _prev_hash, _timestamp")); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 6, __pyx_L1_error) + + /* "(tree fragment)":7 + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x465aada, 0x15c3ac3, 0x19f7ebd, b'_data, _index, _nonce, _prev_hash, _timestamp') + * __pyx_result = Block.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_Block__set_state( __pyx_result, __pyx_state) +*/ + __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_18polluck_blockchain_11placeholder_Block); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v___pyx_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x465aada, 0x15c3ac3, 0x19f7ebd, b'_data, _index, _nonce, _prev_hash, _timestamp') + * __pyx_result = Block.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Block__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None)); + if (__pyx_t_5) { + + /* "(tree fragment)":9 + * __pyx_result = Block.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_Block__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_Block__set_state(Block __pyx_result, __pyx_state: tuple): +*/ + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'"); + __PYX_ERR(1, 9, __pyx_L1_error) + } + __pyx_t_2 = __pyx_f_18polluck_blockchain_11placeholder___pyx_unpickle_Block__set_state(((struct __pyx_obj_18polluck_blockchain_11placeholder_Block *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x465aada, 0x15c3ac3, 0x19f7ebd, b'_data, _index, _nonce, _prev_hash, _timestamp') + * __pyx_result = Block.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Block__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + } + + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_Block__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_Block__set_state(Block __pyx_result, __pyx_state: tuple): + * __pyx_result._data = __pyx_state[0]; __pyx_result._index = __pyx_state[1]; __pyx_result._nonce = __pyx_state[2]; __pyx_result._prev_hash = __pyx_state[3]; __pyx_result._timestamp = __pyx_state[4] +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; + goto __pyx_L0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Block(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x465aada, 0x15c3ac3, 0x19f7ebd, b'_data, _index, _nonce, _prev_hash, _timestamp') +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("polluck_blockchain.placeholder.__pyx_unpickle_Block", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":11 + * __pyx_unpickle_Block__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Block__set_state(Block __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __pyx_result._data = __pyx_state[0]; __pyx_result._index = __pyx_state[1]; __pyx_result._nonce = __pyx_state[2]; __pyx_result._prev_hash = __pyx_state[3]; __pyx_result._timestamp = __pyx_state[4] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 5) +*/ + +static PyObject *__pyx_f_18polluck_blockchain_11placeholder___pyx_unpickle_Block__set_state(struct __pyx_obj_18polluck_blockchain_11placeholder_Block *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + unsigned long __pyx_t_2; + double __pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Block__set_state", 0); + + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_Block__set_state(Block __pyx_result, __pyx_state: tuple): + * __pyx_result._data = __pyx_state[0]; __pyx_result._index = __pyx_state[1]; __pyx_result._nonce = __pyx_state[2]; __pyx_result._prev_hash = __pyx_state[3]; __pyx_result._timestamp = __pyx_state[4] # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 5) +*/ + __pyx_t_1 = __Pyx_PyTuple_GET_ITEM(__pyx_v___pyx_state, 0); + __Pyx_INCREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_18polluck_blockchain_11placeholder_StringHolder))))) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v___pyx_result->_data); + __Pyx_DECREF((PyObject *)__pyx_v___pyx_result->_data); + __pyx_v___pyx_result->_data = ((struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder *)__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyLong_As_unsigned_long(__Pyx_PyTuple_GET_ITEM(__pyx_v___pyx_state, 1)); if (unlikely((__pyx_t_2 == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_v___pyx_result->_index = __pyx_t_2; + __pyx_t_2 = __Pyx_PyLong_As_unsigned_long(__Pyx_PyTuple_GET_ITEM(__pyx_v___pyx_state, 2)); if (unlikely((__pyx_t_2 == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_v___pyx_result->_nonce = __pyx_t_2; + __pyx_t_1 = __Pyx_PyTuple_GET_ITEM(__pyx_v___pyx_state, 3); + __Pyx_INCREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_18polluck_blockchain_11placeholder_StringHolder))))) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v___pyx_result->_prev_hash); + __Pyx_DECREF((PyObject *)__pyx_v___pyx_result->_prev_hash); + __pyx_v___pyx_result->_prev_hash = ((struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder *)__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyFloat_AsDouble(__Pyx_PyTuple_GET_ITEM(__pyx_v___pyx_state, 4)); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_v___pyx_result->_timestamp = __pyx_t_3; + + /* "(tree fragment)":13 + * cdef __pyx_unpickle_Block__set_state(Block __pyx_result, __pyx_state: tuple): + * __pyx_result._data = __pyx_state[0]; __pyx_result._index = __pyx_state[1]; __pyx_result._nonce = __pyx_state[2]; __pyx_result._prev_hash = __pyx_state[3]; __pyx_result._timestamp = __pyx_state[4] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 5) # <<<<<<<<<<<<<< +*/ + __pyx_t_4 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 5); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + + /* "(tree fragment)":11 + * __pyx_unpickle_Block__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Block__set_state(Block __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __pyx_result._data = __pyx_state[0]; __pyx_result._index = __pyx_state[1]; __pyx_result._nonce = __pyx_state[2]; __pyx_result._prev_hash = __pyx_state[3]; __pyx_result._timestamp = __pyx_state[4] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 5) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("polluck_blockchain.placeholder.__pyx_unpickle_Block__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} /* #### Code section: module_exttypes ### */ -static struct __pyx_vtabstruct_18polluck_blockchain_11placeholder_StringHolder __pyx_vtable_18polluck_blockchain_11placeholder_StringHolder; static PyObject *__pyx_tp_new_18polluck_blockchain_11placeholder_StringHolder(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder *p; @@ -3353,8 +4768,7 @@ static PyObject *__pyx_tp_new_18polluck_blockchain_11placeholder_StringHolder(Py o = __Pyx_AllocateExtensionType(t, 0); if (unlikely(!o)) return 0; p = ((struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder *)o); - p->__pyx_vtab = __pyx_vtabptr_18polluck_blockchain_11placeholder_StringHolder; - p->_py_cache = Py_None; Py_INCREF(Py_None); + p->_py_data = Py_None; Py_INCREF(Py_None); if (unlikely(__pyx_pw_18polluck_blockchain_11placeholder_12StringHolder_1__cinit__(o, a, k) < 0)) goto bad; return o; bad: @@ -3372,7 +4786,7 @@ static void __pyx_tp_dealloc_18polluck_blockchain_11placeholder_StringHolder(PyO } #endif PyObject_GC_UnTrack(o); - Py_CLEAR(p->_py_cache); + Py_CLEAR(p->_py_data); PyTypeObject *tp = Py_TYPE(o); #if CYTHON_USE_TYPE_SLOTS (*tp->tp_free)(o); @@ -3394,8 +4808,8 @@ static int __pyx_tp_traverse_18polluck_blockchain_11placeholder_StringHolder(PyO e = __Pyx_call_type_traverse(o, 1, v, a); if (e) return e; } - if (p->_py_cache) { - e = (*v)(p->_py_cache, a); if (e) return e; + if (p->_py_data) { + e = (*v)(p->_py_data, a); if (e) return e; } return 0; } @@ -3403,8 +4817,8 @@ static int __pyx_tp_traverse_18polluck_blockchain_11placeholder_StringHolder(PyO static int __pyx_tp_clear_18polluck_blockchain_11placeholder_StringHolder(PyObject *o) { PyObject* tmp; struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder *p = (struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder *)o; - tmp = ((PyObject*)p->_py_cache); - p->_py_cache = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->_py_data); + p->_py_data = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } @@ -3417,8 +4831,8 @@ static PyObject *__pyx_getprop_18polluck_blockchain_11placeholder_12StringHolder return __pyx_pw_18polluck_blockchain_11placeholder_12StringHolder_8py_bytes_1__get__(o); } -static PyObject *__pyx_getprop_18polluck_blockchain_11placeholder_12StringHolder__length(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_18polluck_blockchain_11placeholder_12StringHolder_7_length_1__get__(o); +static PyObject *__pyx_getprop_18polluck_blockchain_11placeholder_12StringHolder_c(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_18polluck_blockchain_11placeholder_12StringHolder_1c_1__get__(o); } static PyMethodDef __pyx_methods_18polluck_blockchain_11placeholder_StringHolder[] = { @@ -3430,7 +4844,7 @@ static PyMethodDef __pyx_methods_18polluck_blockchain_11placeholder_StringHolder static struct PyGetSetDef __pyx_getsets_18polluck_blockchain_11placeholder_StringHolder[] = { {"py_string", __pyx_getprop_18polluck_blockchain_11placeholder_12StringHolder_py_string, 0, 0, 0}, {"py_bytes", __pyx_getprop_18polluck_blockchain_11placeholder_12StringHolder_py_bytes, 0, 0, 0}, - {"_length", __pyx_getprop_18polluck_blockchain_11placeholder_12StringHolder__length, 0, 0, 0}, + {"c", __pyx_getprop_18polluck_blockchain_11placeholder_12StringHolder_c, 0, 0, 0}, {0, 0, 0, 0, 0} }; #if CYTHON_USE_TYPE_SPECS @@ -3525,6 +4939,208 @@ static PyTypeObject __pyx_type_18polluck_blockchain_11placeholder_StringHolder = }; #endif +static PyObject *__pyx_tp_new_18polluck_blockchain_11placeholder_Block(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_18polluck_blockchain_11placeholder_Block *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_18polluck_blockchain_11placeholder_Block *)o); + p->_data = ((struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder *)Py_None); Py_INCREF(Py_None); + p->_prev_hash = ((struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder *)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_18polluck_blockchain_11placeholder_Block(PyObject *o) { + struct __pyx_obj_18polluck_blockchain_11placeholder_Block *p = (struct __pyx_obj_18polluck_blockchain_11placeholder_Block *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_18polluck_blockchain_11placeholder_Block) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->_data); + Py_CLEAR(p->_prev_hash); + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif +} + +static int __pyx_tp_traverse_18polluck_blockchain_11placeholder_Block(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_18polluck_blockchain_11placeholder_Block *p = (struct __pyx_obj_18polluck_blockchain_11placeholder_Block *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->_data) { + e = (*v)(((PyObject *)p->_data), a); if (e) return e; + } + if (p->_prev_hash) { + e = (*v)(((PyObject *)p->_prev_hash), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_18polluck_blockchain_11placeholder_Block(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_18polluck_blockchain_11placeholder_Block *p = (struct __pyx_obj_18polluck_blockchain_11placeholder_Block *)o; + tmp = ((PyObject*)p->_data); + p->_data = ((struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_prev_hash); + p->_prev_hash = ((struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_18polluck_blockchain_11placeholder_5Block_index(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_18polluck_blockchain_11placeholder_5Block_5index_1__get__(o); +} + +static PyObject *__pyx_getprop_18polluck_blockchain_11placeholder_5Block_timestamp(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_18polluck_blockchain_11placeholder_5Block_9timestamp_1__get__(o); +} + +static PyObject *__pyx_getprop_18polluck_blockchain_11placeholder_5Block_data(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_18polluck_blockchain_11placeholder_5Block_4data_1__get__(o); +} + +static PyObject *__pyx_getprop_18polluck_blockchain_11placeholder_5Block_prev_hash(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_18polluck_blockchain_11placeholder_5Block_9prev_hash_1__get__(o); +} + +static PyObject *__pyx_getprop_18polluck_blockchain_11placeholder_5Block_nonce(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_18polluck_blockchain_11placeholder_5Block_5nonce_1__get__(o); +} + +static int __pyx_setprop_18polluck_blockchain_11placeholder_5Block_nonce(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_18polluck_blockchain_11placeholder_5Block_5nonce_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyMethodDef __pyx_methods_18polluck_blockchain_11placeholder_Block[] = { + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_11placeholder_5Block_3__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_11placeholder_5Block_5__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_18polluck_blockchain_11placeholder_Block[] = { + {"index", __pyx_getprop_18polluck_blockchain_11placeholder_5Block_index, 0, 0, 0}, + {"timestamp", __pyx_getprop_18polluck_blockchain_11placeholder_5Block_timestamp, 0, 0, 0}, + {"data", __pyx_getprop_18polluck_blockchain_11placeholder_5Block_data, 0, 0, 0}, + {"prev_hash", __pyx_getprop_18polluck_blockchain_11placeholder_5Block_prev_hash, 0, 0, 0}, + {"nonce", __pyx_getprop_18polluck_blockchain_11placeholder_5Block_nonce, __pyx_setprop_18polluck_blockchain_11placeholder_5Block_nonce, 0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_18polluck_blockchain_11placeholder_Block_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_18polluck_blockchain_11placeholder_Block}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_18polluck_blockchain_11placeholder_Block}, + {Py_tp_clear, (void *)__pyx_tp_clear_18polluck_blockchain_11placeholder_Block}, + {Py_tp_methods, (void *)__pyx_methods_18polluck_blockchain_11placeholder_Block}, + {Py_tp_getset, (void *)__pyx_getsets_18polluck_blockchain_11placeholder_Block}, + {Py_tp_init, (void *)__pyx_pw_18polluck_blockchain_11placeholder_5Block_1__init__}, + {Py_tp_new, (void *)__pyx_tp_new_18polluck_blockchain_11placeholder_Block}, + {0, 0}, +}; +static PyType_Spec __pyx_type_18polluck_blockchain_11placeholder_Block_spec = { + "polluck_blockchain.placeholder.Block", + sizeof(struct __pyx_obj_18polluck_blockchain_11placeholder_Block), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type_18polluck_blockchain_11placeholder_Block_slots, +}; +#else + +static PyTypeObject __pyx_type_18polluck_blockchain_11placeholder_Block = { + PyVarObject_HEAD_INIT(0, 0) + "polluck_blockchain.placeholder.""Block", /*tp_name*/ + sizeof(struct __pyx_obj_18polluck_blockchain_11placeholder_Block), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_18polluck_blockchain_11placeholder_Block, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_18polluck_blockchain_11placeholder_Block, /*tp_traverse*/ + __pyx_tp_clear_18polluck_blockchain_11placeholder_Block, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_18polluck_blockchain_11placeholder_Block, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_18polluck_blockchain_11placeholder_Block, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + __pyx_pw_18polluck_blockchain_11placeholder_5Block_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_18polluck_blockchain_11placeholder_Block, /*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 CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; @@ -3578,18 +5194,16 @@ static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); /*--- Type init code ---*/ - __pyx_vtabptr_18polluck_blockchain_11placeholder_StringHolder = &__pyx_vtable_18polluck_blockchain_11placeholder_StringHolder; - __pyx_vtable_18polluck_blockchain_11placeholder_StringHolder._bytes_to_str = (PyObject *(*)(struct __pyx_obj_18polluck_blockchain_11placeholder_StringHolder *))__pyx_f_18polluck_blockchain_11placeholder_12StringHolder__bytes_to_str; #if CYTHON_USE_TYPE_SPECS - __pyx_mstate->__pyx_ptype_18polluck_blockchain_11placeholder_StringHolder = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_18polluck_blockchain_11placeholder_StringHolder_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_18polluck_blockchain_11placeholder_StringHolder)) __PYX_ERR(0, 10, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_18polluck_blockchain_11placeholder_StringHolder_spec, __pyx_mstate->__pyx_ptype_18polluck_blockchain_11placeholder_StringHolder) < (0)) __PYX_ERR(0, 10, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_18polluck_blockchain_11placeholder_StringHolder = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_18polluck_blockchain_11placeholder_StringHolder_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_18polluck_blockchain_11placeholder_StringHolder)) __PYX_ERR(0, 40, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_18polluck_blockchain_11placeholder_StringHolder_spec, __pyx_mstate->__pyx_ptype_18polluck_blockchain_11placeholder_StringHolder) < (0)) __PYX_ERR(0, 40, __pyx_L1_error) #else __pyx_mstate->__pyx_ptype_18polluck_blockchain_11placeholder_StringHolder = &__pyx_type_18polluck_blockchain_11placeholder_StringHolder; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_18polluck_blockchain_11placeholder_StringHolder) < (0)) __PYX_ERR(0, 10, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_18polluck_blockchain_11placeholder_StringHolder) < (0)) __PYX_ERR(0, 40, __pyx_L1_error) #endif #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_18polluck_blockchain_11placeholder_StringHolder); @@ -3599,10 +5213,29 @@ static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { __pyx_mstate->__pyx_ptype_18polluck_blockchain_11placeholder_StringHolder->tp_getattro = PyObject_GenericGetAttr; } #endif - if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_18polluck_blockchain_11placeholder_StringHolder, __pyx_vtabptr_18polluck_blockchain_11placeholder_StringHolder) < (0)) __PYX_ERR(0, 10, __pyx_L1_error) - if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_18polluck_blockchain_11placeholder_StringHolder) < (0)) __PYX_ERR(0, 10, __pyx_L1_error) - if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_StringHolder, (PyObject *) __pyx_mstate->__pyx_ptype_18polluck_blockchain_11placeholder_StringHolder) < (0)) __PYX_ERR(0, 10, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_18polluck_blockchain_11placeholder_StringHolder) < (0)) __PYX_ERR(0, 10, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_StringHolder, (PyObject *) __pyx_mstate->__pyx_ptype_18polluck_blockchain_11placeholder_StringHolder) < (0)) __PYX_ERR(0, 40, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_18polluck_blockchain_11placeholder_StringHolder) < (0)) __PYX_ERR(0, 40, __pyx_L1_error) + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_18polluck_blockchain_11placeholder_Block = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_18polluck_blockchain_11placeholder_Block_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_18polluck_blockchain_11placeholder_Block)) __PYX_ERR(0, 77, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_18polluck_blockchain_11placeholder_Block_spec, __pyx_mstate->__pyx_ptype_18polluck_blockchain_11placeholder_Block) < (0)) __PYX_ERR(0, 77, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_18polluck_blockchain_11placeholder_Block = &__pyx_type_18polluck_blockchain_11placeholder_Block; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_18polluck_blockchain_11placeholder_Block) < (0)) __PYX_ERR(0, 77, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_18polluck_blockchain_11placeholder_Block); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_18polluck_blockchain_11placeholder_Block->tp_dictoffset && __pyx_mstate->__pyx_ptype_18polluck_blockchain_11placeholder_Block->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_18polluck_blockchain_11placeholder_Block->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Block, (PyObject *) __pyx_mstate->__pyx_ptype_18polluck_blockchain_11placeholder_Block) < (0)) __PYX_ERR(0, 77, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_18polluck_blockchain_11placeholder_Block) < (0)) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -3613,30 +5246,10 @@ static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { static int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); - 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(2, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_mstate->__pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_2_1(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", - #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 - sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyTypeObject), - #elif CYTHON_COMPILING_IN_LIMITED_API - 0, 0, - #else - sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyHeapTypeObject), - #endif - __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __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(__pyx_mstatetype *__pyx_mstate) { @@ -3918,22 +5531,35 @@ __Pyx_RefNannySetupContext("PyInit_placeholder", 0); (void)__Pyx_modinit_variable_export_code(__pyx_mstate); (void)__Pyx_modinit_function_export_code(__pyx_mstate); if (unlikely((__Pyx_modinit_type_init_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) - if (unlikely((__Pyx_modinit_type_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + (void)__Pyx_modinit_type_import_code(__pyx_mstate); (void)__Pyx_modinit_variable_import_code(__pyx_mstate); (void)__Pyx_modinit_function_import_code(__pyx_mstate); /*--- Execution code ---*/ - /* "polluck_blockchain/placeholder.py":3 - * """placeholder module for compilation""" + /* "polluck_blockchain/placeholder.py":5 + * from __future__ import annotations * - * import typing as t # <<<<<<<<<<<<<< + * import datetime # <<<<<<<<<<<<<< * * import cython */ - __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_typing, 0, 0, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error) + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_datetime, 0, 0, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error) __pyx_t_2 = __pyx_t_1; __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_t, __pyx_t_2) < (0)) __PYX_ERR(0, 3, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_datetime, __pyx_t_2) < (0)) __PYX_ERR(0, 5, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "polluck_blockchain/placeholder.py":8 + * + * import cython + * import dopt_basics.datetime # <<<<<<<<<<<<<< + * + * # from cython.cimports.cpython.ref import Py_INCREF, PyObject +*/ + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_dopt_basics_datetime, 0, 0, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error) + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_dopt_basics, __pyx_t_2) < (0)) __PYX_ERR(0, 8, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "(tree fragment)":1 @@ -3963,10 +5589,52 @@ __Pyx_RefNannySetupContext("PyInit_placeholder", 0); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_2) < (0)) __PYX_ERR(1, 3, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_18polluck_blockchain_11placeholder_5Block_3__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Block___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_polluck_blockchain_placeholder, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_18polluck_blockchain_11placeholder_Block, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_2) < (0)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Block, (type(self), 0x465aada, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Block__set_state(self, __pyx_state) +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_18polluck_blockchain_11placeholder_5Block_5__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Block___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_polluck_blockchain_placeholder, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_18polluck_blockchain_11placeholder_Block, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_2) < (0)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Block(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x465aada, 0x15c3ac3, 0x19f7ebd, b'_data, _index, _nonce, _prev_hash, _timestamp') +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_18polluck_blockchain_11placeholder_1__pyx_unpickle_Block, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Block, NULL, __pyx_mstate_global->__pyx_n_u_polluck_blockchain_placeholder, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); + #endif + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Block, __pyx_t_2) < (0)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + /* "polluck_blockchain/placeholder.py":1 * """placeholder module for compilation""" # <<<<<<<<<<<<<< * - * import typing as t + * from __future__ import annotations */ __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); @@ -4025,39 +5693,65 @@ static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('self._data is not None or self._prev_hash is not None',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Block, (type(self), 0x465aada, None), state +*/ + __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_kp_u_self__data_is_not_None_or_self); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(1, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]); + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = __pyx_mstate->__pyx_tuple; + for (Py_ssize_t i=0; i<1; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif __Pyx_RefNannyFinishContext(); return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; } /* #### Code section: init_constants ### */ static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) { CYTHON_UNUSED_VAR(__pyx_mstate); { - const struct { const unsigned int length: 8; } index[] = {{1},{14},{179},{8},{7},{6},{2},{9},{50},{14},{5},{20},{12},{30},{32},{18},{4},{18},{4},{6},{8},{12},{13},{5},{8},{10},{8},{30},{3},{11},{14},{12},{10},{17},{13},{4},{12},{10},{12},{19},{1},{8},{6},{6},{9}}; - #if (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (484 bytes) */ -const char* const cstring = "BZh91AY&SYhv\301\020\000\000 \337\342d\020@\213\004E\217ax\000\277\377\377`@@@\000\000@@\001\247[\272\232\341\250\232mI\247\246&I\211\243C@h\320h\321\352\r\023Sh)\232@\320\321\220\000\000\000ja4Dy@\320h\000\000\000\002T\364\246iM\222\231\246\215L\232d\006\200\000\364\213\000\031A7b;\263\276\021\273\231b\345\346\366\236E\025\351\373\030\370\325\242 E6\022V?tIJBY\243\266\332\016\362\275w=\210\234\307\222\236(@\205.E\007\006\010\204@\301\210s\343\000yi\002B\243G\026\311G}+\032\306\326-\375Tx\014\221\035\314@\265\023\023D \216\315\230\250\275\375\313\177\230(\305E\224\254T\362\365\241\246\017=b\251\303\271\001\235\263\325\236C\005\031\034\2667b\326%C\353\220@\200E\227g\204N\230\236\020\r\304F\334\r\307M\372\204\005f\302Hd\200\301L\226\257\263h\253\204\017\344\001\305_K\340$\224\"\272\371(\256/\317\020\330\214r\325\224\356\275\017@ov4\270E@\306{\365h\226\322\257a\245\301P%\334P5\224\232&\256\246\203\026\300\263P\014\025YI\343\034\322\0227\\C\211\261\221%\004\230y<\370\346\315z\2005\366\027\316\366C\323>\351\345\016\214\025\2503Y2&\305\237n&\272\306\034/\2225\343\202\202X\350\224\222-r\024&\352\312\261\204F\325m\222\036\200C.\"|CL&\207z0\213C'MuJk\222WXhB\0073\020\201\233\237=5\rp+a7\224)5\312\013\326W\003\271w\364\316\020.K\251\2568\317\2226`\024\366\034\035X-\272M\007\200\233\201~\204?\213\271\"\234(H4;`\210\000"; - PyObject *data = __Pyx_DecompressString(cstring, 484, 2); + const struct { const unsigned int length: 8; } index[] = {{1},{14},{179},{8},{7},{6},{2},{9},{50},{53},{14},{5},{23},{25},{20},{12},{30},{32},{12},{18},{18},{15},{4},{8},{8},{5},{11},{20},{13},{8},{12},{5},{13},{5},{6},{8},{10},{8},{7},{5},{30},{3},{13},{3},{9},{14},{12},{11},{10},{20},{12},{10},{17},{13},{4},{12},{10},{12},{19},{5},{8},{9},{6},{12},{6},{11},{9},{107},{55}}; + #if (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (821 bytes) */ +const char* const cstring = "BZh91AY&SYx\253\001\376\000\000I\377\377\346\335\274\300\351\257f\315\277\343\376\260\277\377\377\366@@@@@@@@@@@@@\000@\000@\002\275\020j\2240\210\023D`(\364\217(f\240z\201\241\246\200\006\200\320\001\344\237\252=OSjz\230\323(4SM\242d\247\221\2424\365\001\240\0004\003 \320\000\000\000\000\000\340\321\243@\320h\014\230\200\310\320\310\000\r4\310\000\000`\200\003M\020\231\004e<\223&$\310\321\240h\000\320\000\000\320\000\036\246\217FSG\367P\r\375\374\334%4\242\177\214gN'9\t\233\205\343A\274\274B\360\250\276`\243Kof\230\307\260@\217\350\226\242=\373/)\356\211S*b`\250\225L\007\002\235\202\220\016u\336\023\231U\265\0025\255\003\312c\316\n\236\313\265~\250\r\220m\304\216\272\255\330\350\345d\300\320W\241p\271Ko\366\217\345\256\347\323v\030\232LnV\256%R\212\363\005\rY!)\255\355:\306\226\262 R\010\311\2221\324Qs\010Ab\254\345\003\014@\006\201\025\000?\262\300\023\013\025\371\327\247\243\037\004^92\353\207^\266\014\341S2M\n\267\036\022f\nt9\231\346c\325\231P\007\024G\252\355\230\031\334^\256\r\023\213\261\235\363\333g\006\356k(H\211\256\332Q@\305P\375;\006c$K\025\024b\034\335\2148\205\242\356\3426\245\264\300#\303d\200\\\273\240@\302S\340\031%\221\341\036(pJ\033Q\264\317\034K]\307\020\023\3044\342\250(F\277ra\2141\333'l\322N\270Y\224\213\352\254\010$\276\016ia\321~3\270$\227>\000\3459h\362F\207\251\315F\243\n\334\330-\034\267\206\310\205\0109\314\010!3JqV\247\227|VJBd\013\270\242\212,0\004)\201Dv\010\330\303b\360\277dBk\nD\230I\010F\024\370\247&\300\271$c`\204\200\316\215\352\023\001w-B\232 \021\033\354\002@\302\275\244\321u\214\036H\030\024>JU\312H\004\202T:hL\375\270\305\201\270\210\220\222/\271\362)r\3175\316\"4\240\307\034\351\227\006\025\221\t\025\310\037xG\000x\0176\352\305\3026\320@\303\253E\226\264\245\200Pz\326\n\256>\355f\272\241\221\234\264b\234\301\211\243T\241\244[s\211\332y\321\232\345\032\256yf\326t\364\230L\031\220Tq\201o!R\204\244<\0209\221o\342\207\354\314\265\251\027\333\237`j\315v\210e\2228 \223\242\256D&-S\001]@eD\213\316\242\325p\214\242\224\300\360!""\036\n\341@HLE\3751\034p\225\023\264\2658\234q\246T\232H\"\320u\315\244\222\001\253\267\032+\310\235\032BB\010\035?\207\357.\310\336Oo\273\337\016\347M\354H\243\037\214\322~a\272LWe\017\324K2\330p\005\034\333\252\333\026\200N\263!<\231\371`\373\324\321\35305\326\357%\004 \342\032V\\\002\322b\177\213\271\"\234(H\010\365\2219\265}\353\202\274 \237\2629\030\250F\005\304\302\276:F\004_\027\211\224\323\332\034\035\002E\253\272\220\202\"\3366\223i+\271\026\307\357\253\016\353\033\304\315|\264\357\316\314\343#\037\365+\017\337\026\326\347\034=\227K\334\235\307\270%C\304\277\252fP\314\327k\235dN.\344\316\345\222\253\245\305\342H\324EC\030\314|!\307=\271\235\267\267\362\354\2627\007CM\016mm\377\210!\006\301\263BP\336\013\342\236\254\337\326>\373\032\033\007\023\355\355\234r\214\325\355\260\217\331\355\334h\254n\2126e\\\3568\345\311(f\370\244\334\340A[\232M\341\271R|Qy\315\363\037\313\347\037|l\206\343\260\330>M7tz\222\2130\360?\301X]Y\332\276\274\377\201be\371\376\346\327\325\333\037\357~~\371\r\214\306\020i"; - PyObject *data = __Pyx_DecompressString(cstring, 408, 1); + #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (719 bytes) */ +const char* const cstring = "x\332mR;ocE\024\306R\020\326\006%ZX\211t;\021\022\026\312\306\"RPV\332\325\"\310\003R\020\222\020\024As4\2369\366\235\365x\346z\036&F \245tyK\227.]\272L\231\2222\245\313\374\204\375\t{\346:6\206P\334\231\357\316y\177\337\371\346\200\007\316\214\r\254\346\203\253\235\330\200,d<\260\375~\310\254a\3123\211Z5\320\361\200\272\317\310I\211\200.9\031vzx\272\275\373r\227q#\231\303\267(\202g>6\204\346\336\243g\266\311\032Q\351\240\014\013\375\034}\235\0357Y\337Ff\020%\013\226\345\344\267\034\02024\314cH\200\325\270\241\276xP\326\000\205+\323\2521\251\034\025Q=L\321G\\{\254s)\201\374P*\317\033\032\321\244\263%\224\237!i,M\320\344Q\007\006\340PF\201\000L\3062\205\261f\233&\352)\256\311*\224Q\001\300\243n\326A&bh\374\304\315\2115\310\254c3K\356\260\007\031\367\331\262\371ub\306\264\274\215N\340\233\357\264\025\355\362\250/\212\212\222Q\200\3713\315\351i\274\177\014\000\247\375+\372\016\210a8\301\253p\216\315\237\313\254?X-\321-\343\307i\377c}\224\375\342\370\307\303\337~:9\204_.\366\271\357\033\241l]Xg#\311\203^h:A\021\323\216\013lp\321\026\32194\001\202\352 \204?\022\035\364a\371\0132\2658\273\244\315\0034\270W\302/\301\372\334\267\351l'\335\324L'\007hF#\322\244\255y{TS\342\025(\017\213fT\300\216\327hZ!\003\350pUR\323\2612jL\310\360\316\354\306\337\351\260F`n\265\216\242\r\215\304\254\310(\242\236k\032#+\311\310m\236\024S6\372R\265<\270\274\0173\271\000r\242\\d(\332>vf\177\016=-\313\014?\364\230`\332\340\031\212&W\242M\315\224J\002t#\327\363\246\346\013\366H\236\305\003\r[nX)\321\3030\204\036vtI8\370\037\021\037,\201\350\004X\320\032\363\304v\364\270\010\350q\035\321_W\246+\237\217vFG\343\315\004\237\014\266\212\263\353\312\273\352\007\037\256\r.\212\215\341\263\341\257#9\376r\262;\371\353\366\340o\362\370x\360}\261S\034\r_\214\370t\345\243\353\336\340\2628$\257\263i\365\223bsZ\375\254\350\336W7\206\225d\353N\253\353w\353_P\374\346xo\262usy\373\355\375\277_\250\324\375\312\363a\367\216}5Y\275yu\333\276;;\237\256|Z|=\254\216*\243\247)\311\237\305\336\220\362\326F\335qu\262vCEW""\007;\357\001\202\234\312z"; + PyObject *data = __Pyx_DecompressString(cstring, 719, 1); if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) const char* const bytes = __Pyx_PyBytes_AsString(data); #if !CYTHON_ASSUME_SAFE_MACROS if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } #endif - #else /* compression: none (700 bytes) */ -const char* const bytes = "?Data not 'str'Note that Cython is deliberately stricter than PEP-484 and rejects subclasses of builtin types. If you need to pass subclasses then set the 'annotation_typing' directive to False.add_notedisableenablegcisenabledno default __reduce__ due to non-trivial __cinit__utf-8__Pyx_PyDict_NextRefStringHolderStringHolder.__reduce_cython__StringHolder.__setstate_cython__asyncio.coroutinescastcline_in_tracebackdatadecode__func____getstate___is_coroutineitems__main____module____name__polluck_blockchain.placeholderpop__pyx_state__pyx_vtable____qualname____reduce____reduce_cython____reduce_ex__self__set_name__setdefault__setstate____setstate_cython__t__test__typingvalues\200\001\330\004\n\210+\220Q"; + #else /* compression: none (1171 bytes) */ +const char* const bytes = "?Data not 'str'Note that Cython is deliberately stricter than PEP-484 and rejects subclasses of builtin types. If you need to pass subclasses then set the 'annotation_typing' directive to False.add_notedisableenablegcisenabledno default __reduce__ due to non-trivial __cinit__self._data is not None or self._prev_hash is not NoneBlockBlock.__reduce_cython__Block.__setstate_cython____Pyx_PyDict_NextRefStringHolderStringHolder.__reduce_cython__StringHolder.__setstate_cython__TIMEZONE_UTCasyncio.coroutinescline_in_tracebackcurrent_time_tzdatadatetime__dict___dictdopt_basicsdopt_basics.datetimefromtimestamp__func____getstate__index_is_coroutineitemslength__main____module____name____new__noncepolluck_blockchain.placeholderpopprevious_hashptrpy_string__pyx_checksum__pyx_result__pyx_state__pyx_type__pyx_unpickle_Block__qualname____reduce____reduce_cython____reduce_ex__self__set_name__setdefault__setstate____setstate_cython__state__test__timestampupdateuse_setstatevalues\200\001\330\004#\2401\240F\250!\200\001\330\004\n\210+\220Q\200\001\360\010\000\005\016\210T\220\030\230\024\230Y\240d\250)\2604\260}\300D\310\001\330\004\014\210G\2201\220F\230,\240a\330\004\007\200v\210W\220E\230\024\230Q\330\010\022\220!\330\010\027\220q\340\010\030\230\001\330\004\007\200q\330\010\017\320\017&\240d\250!\2507\260+\270W\300A\340\010\017\320\017&\240d\250!\2507\260+\270Q\200\001\340\004\037\230q\320 0\260\013\270;\300k\320QR\330\004\023\2205\230\010\240\001\240\021\330\004\007\200|\2207\230!\330\010'\240q\250\010\260\016\270a\330\004\013\2101"; PyObject *data = NULL; CYTHON_UNUSED_VAR(__Pyx_DecompressString); #endif PyObject **stringtab = __pyx_mstate->__pyx_string_tab; Py_ssize_t pos = 0; - for (int i = 0; i < 44; i++) { + for (int i = 0; i < 65; i++) { Py_ssize_t bytes_length = index[i].length; PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL); if (likely(string) && i >= 11) PyUnicode_InternInPlace(&string); @@ -4068,7 +5762,7 @@ const char* const bytes = "?Data not 'str'Note that Cython is deliberately stric stringtab[i] = string; pos += bytes_length; } - for (int i = 44; i < 45; i++) { + for (int i = 65; i < 69; i++) { Py_ssize_t bytes_length = index[i].length; PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length); stringtab[i] = string; @@ -4079,15 +5773,15 @@ const char* const bytes = "?Data not 'str'Note that Cython is deliberately stric } } Py_XDECREF(data); - for (Py_ssize_t i = 0; i < 45; i++) { + for (Py_ssize_t i = 0; i < 69; i++) { if (unlikely(PyObject_Hash(stringtab[i]) == -1)) { __PYX_ERR(0, 1, __pyx_L1_error) } } #if CYTHON_IMMORTAL_CONSTANTS { - PyObject **table = stringtab + 44; - for (Py_ssize_t i=0; i<1; ++i) { + PyObject **table = stringtab + 65; + for (Py_ssize_t i=0; i<4; ++i) { #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); #else @@ -4097,6 +5791,26 @@ const char* const bytes = "?Data not 'str'Note that Cython is deliberately stric } #endif } + { + PyObject **numbertab = __pyx_mstate->__pyx_number_tab + 0; + int32_t const cint_constants_4[] = {73771738L}; + for (int i = 0; i < 1; i++) { + numbertab[i] = PyLong_FromLong(cint_constants_4[i - 0]); + if (unlikely(!numbertab[i])) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = __pyx_mstate->__pyx_number_tab; + for (Py_ssize_t i=0; i<1; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif return 0; __pyx_L1_error:; return -1; @@ -4106,9 +5820,9 @@ typedef struct { unsigned int argcount : 2; unsigned int num_posonly_args : 1; unsigned int num_kwonly_args : 1; - unsigned int nlocals : 2; + unsigned int nlocals : 3; unsigned int flags : 10; - unsigned int first_line : 2; + unsigned int first_line : 5; } __Pyx_PyCode_New_function_description; /* NewCodeObj.proto */ static PyObject* __Pyx_PyCode_New( @@ -4134,6 +5848,21 @@ static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) { PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state}; __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad; } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_dict_2, __pyx_mstate->__pyx_n_u_use_setstate}; + __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_T_Yd_4_D_G1F_a_vWE_Q_q_q_d_7_WA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 16}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state}; + __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_1F, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 4}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_type, __pyx_mstate->__pyx_n_u_pyx_checksum, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_pyx_result}; + __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_Block, __pyx_mstate->__pyx_kp_b_iso88591_q_0_kQR_5_7_q_a_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad; + } Py_DECREF(tuple_dedup_map); return 0; bad: @@ -4211,6 +5940,380 @@ end: } #endif +/* decode_c_string */ +static CYTHON_INLINE PyObject* __Pyx_decode_c_string( + const char* cstring, Py_ssize_t start, Py_ssize_t stop, + const char* encoding, const char* errors, + PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { + Py_ssize_t length; + if (unlikely((start < 0) | (stop < 0))) { + size_t slen = strlen(cstring); + if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) { + PyErr_SetString(PyExc_OverflowError, + "c-string too long to convert to Python"); + return NULL; + } + length = (Py_ssize_t) slen; + if (start < 0) { + start += length; + if (start < 0) + start = 0; + } + if (stop < 0) + stop += length; + } + if (unlikely(stop <= start)) + return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_unicode); + length = stop - start; + cstring += start; + if (decode_func) { + return decode_func(cstring, length, errors); + } else { + return PyUnicode_Decode(cstring, length, encoding, errors); + } +} + +/* PyErrExceptionMatches (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); + for (i=0; i= 0x030C00A6 + PyObject *current_exception = tstate->current_exception; + if (unlikely(!current_exception)) return 0; + exc_type = (PyObject*) Py_TYPE(current_exception); + if (exc_type == err) return 1; +#else + exc_type = tstate->curexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; +#endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(exc_type); + #endif + if (unlikely(PyTuple_Check(err))) { + result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + } else { + result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(exc_type); + #endif + return result; +} +#endif + +/* PyErrFetchRestore (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject *tmp_value; + assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); + if (value) { + #if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) + #endif + PyException_SetTraceback(value, tb); + } + tmp_value = tstate->current_exception; + tstate->current_exception = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject* exc_value; + exc_value = tstate->current_exception; + tstate->current_exception = 0; + *value = exc_value; + *type = NULL; + *tb = NULL; + if (exc_value) { + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + #if CYTHON_COMPILING_IN_CPYTHON + *tb = ((PyBaseExceptionObject*) exc_value)->traceback; + Py_XINCREF(*tb); + #else + *tb = PyException_GetTraceback(exc_value); + #endif + } +#else + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#endif +} +#endif + +/* PyObjectGetAttrStr (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); + return PyObject_GetAttr(obj, attr_name); +} +#endif + +/* PyObjectGetAttrStrNoError (used by GetBuiltinName) */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +#endif +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + (void) PyObject_GetOptionalAttr(obj, attr_name, &result); + return result; +#else +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +#endif +} + +/* GetBuiltinName (used by GetModuleGlobalName) */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_mstate_global->__pyx_b, name); + if (unlikely(!result) && !PyErr_Occurred()) { + PyErr_Format(PyExc_NameError, + "name '%U' is not defined", name); + } + return result; +} + +/* PyDictVersioning (used by GetModuleGlobalName) */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { +#if CYTHON_COMPILING_IN_CPYTHON + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); +#endif + } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; +} +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); +} +#endif + +/* GetModuleGlobalName */ +#if CYTHON_USE_DICT_VERSIONS +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) +#else +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) +#endif +{ + PyObject *result; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!__pyx_m)) { + if (!PyErr_Occurred()) + PyErr_SetNone(PyExc_NameError); + return NULL; + } + result = PyObject_GetAttr(__pyx_m, name); + if (likely(result)) { + return result; + } + PyErr_Clear(); +#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + if (unlikely(__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, name, &result) == -1)) PyErr_Clear(); + __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return result; + } +#else + result = _PyDict_GetItem_KnownHash(__pyx_mstate_global->__pyx_d, name, ((PyASCIIObject *) name)->hash); + __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } + PyErr_Clear(); +#endif + return __Pyx_GetBuiltinName(name); +} + +/* PyObjectCall (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *result; + ternaryfunc call = Py_TYPE(func)->tp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) + return NULL; + result = (*call)(func, arg, kw); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectCallMethO (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func); + self = __Pyx_CyOrPyCFunction_GET_SELF(func); + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) + return NULL; + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectFastCall (used by PyObjectFastCallMethod) */ +#if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API +static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs) { + PyObject *argstuple; + PyObject *result = 0; + size_t i; + argstuple = PyTuple_New((Py_ssize_t)nargs); + if (unlikely(!argstuple)) return NULL; + for (i = 0; i < nargs; i++) { + Py_INCREF(args[i]); + if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) != (0)) goto bad; + } + result = __Pyx_PyObject_Call(func, argstuple, kwargs); + bad: + Py_DECREF(argstuple); + return result; +} +#endif +#if CYTHON_VECTORCALL && !CYTHON_COMPILING_IN_LIMITED_API + #if PY_VERSION_HEX < 0x03090000 + #define __Pyx_PyVectorcall_Function(callable) _PyVectorcall_Function(callable) + #elif CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE vectorcallfunc __Pyx_PyVectorcall_Function(PyObject *callable) { + PyTypeObject *tp = Py_TYPE(callable); + #if defined(__Pyx_CyFunction_USED) + if (__Pyx_CyFunction_CheckExact(callable)) { + return __Pyx_CyFunction_func_vectorcall(callable); + } + #endif + if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_VECTORCALL)) { + return NULL; + } + assert(PyCallable_Check(callable)); + Py_ssize_t offset = tp->tp_vectorcall_offset; + assert(offset > 0); + vectorcallfunc ptr; + memcpy(&ptr, (char *) callable + offset, sizeof(ptr)); + return ptr; +} + #else + #define __Pyx_PyVectorcall_Function(callable) PyVectorcall_Function(callable) + #endif +#endif +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject *const *args, size_t _nargs, PyObject *kwargs) { + Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); +#if CYTHON_COMPILING_IN_CPYTHON + if (nargs == 0 && kwargs == NULL) { + if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS)) + return __Pyx_PyObject_CallMethO(func, NULL); + } + else if (nargs == 1 && kwargs == NULL) { + if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O)) + return __Pyx_PyObject_CallMethO(func, args[0]); + } +#endif + if (kwargs == NULL) { + #if CYTHON_VECTORCALL + #if CYTHON_COMPILING_IN_LIMITED_API + return PyObject_Vectorcall(func, args, _nargs, NULL); + #else + vectorcallfunc f = __Pyx_PyVectorcall_Function(func); + if (f) { + return f(func, args, _nargs, NULL); + } + #endif + #endif + } + if (nargs == 0) { + return __Pyx_PyObject_Call(func, __pyx_mstate_global->__pyx_empty_tuple, kwargs); + } + #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API + return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs); + #else + return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); + #endif +} + +/* PyObjectFastCallMethod */ +#if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000 +static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf) { + PyObject *result; + PyObject *attr = PyObject_GetAttr(args[0], name); + if (unlikely(!attr)) + return NULL; + result = __Pyx_PyObject_FastCall(attr, args+1, nargsf - 1); + Py_DECREF(attr); + return result; +} +#endif + /* TupleAndListFromArray (used by fastcall) */ #if !CYTHON_COMPILING_IN_CPYTHON && CYTHON_METH_FASTCALL static CYTHON_INLINE PyObject * @@ -4450,139 +6553,12 @@ bad: #endif #endif -/* PyObjectCall (used by PyObjectFastCall) */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = Py_TYPE(func)->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) - return NULL; - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCallMethO (used by PyObjectFastCall) */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func); - self = __Pyx_CyOrPyCFunction_GET_SELF(func); - if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) - return NULL; - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectFastCall (used by PyObjectCallOneArg) */ -#if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API -static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs) { - PyObject *argstuple; - PyObject *result = 0; - size_t i; - argstuple = PyTuple_New((Py_ssize_t)nargs); - if (unlikely(!argstuple)) return NULL; - for (i = 0; i < nargs; i++) { - Py_INCREF(args[i]); - if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) != (0)) goto bad; - } - result = __Pyx_PyObject_Call(func, argstuple, kwargs); - bad: - Py_DECREF(argstuple); - return result; -} -#endif -#if CYTHON_VECTORCALL && !CYTHON_COMPILING_IN_LIMITED_API - #if PY_VERSION_HEX < 0x03090000 - #define __Pyx_PyVectorcall_Function(callable) _PyVectorcall_Function(callable) - #elif CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE vectorcallfunc __Pyx_PyVectorcall_Function(PyObject *callable) { - PyTypeObject *tp = Py_TYPE(callable); - #if defined(__Pyx_CyFunction_USED) - if (__Pyx_CyFunction_CheckExact(callable)) { - return __Pyx_CyFunction_func_vectorcall(callable); - } - #endif - if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_VECTORCALL)) { - return NULL; - } - assert(PyCallable_Check(callable)); - Py_ssize_t offset = tp->tp_vectorcall_offset; - assert(offset > 0); - vectorcallfunc ptr; - memcpy(&ptr, (char *) callable + offset, sizeof(ptr)); - return ptr; -} - #else - #define __Pyx_PyVectorcall_Function(callable) PyVectorcall_Function(callable) - #endif -#endif -static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject *const *args, size_t _nargs, PyObject *kwargs) { - Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); -#if CYTHON_COMPILING_IN_CPYTHON - if (nargs == 0 && kwargs == NULL) { - if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS)) - return __Pyx_PyObject_CallMethO(func, NULL); - } - else if (nargs == 1 && kwargs == NULL) { - if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O)) - return __Pyx_PyObject_CallMethO(func, args[0]); - } -#endif - if (kwargs == NULL) { - #if CYTHON_VECTORCALL - #if CYTHON_COMPILING_IN_LIMITED_API - return PyObject_Vectorcall(func, args, _nargs, NULL); - #else - vectorcallfunc f = __Pyx_PyVectorcall_Function(func); - if (f) { - return f(func, args, _nargs, NULL); - } - #endif - #endif - } - if (nargs == 0) { - return __Pyx_PyObject_Call(func, __pyx_mstate_global->__pyx_empty_tuple, kwargs); - } - #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API - return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs); - #else - return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); - #endif -} - /* PyObjectCallOneArg (used by CallUnboundCMethod0) */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { PyObject *args[2] = {NULL, arg}; return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); } -/* PyObjectGetAttrStr (used by UnpackUnboundCMethod) */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); - return PyObject_GetAttr(obj, attr_name); -} -#endif - /* UnpackUnboundCMethod (used by CallUnboundCMethod0) */ #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000 static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) { @@ -5298,65 +7274,6 @@ static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *nam return 0; } -/* PyErrFetchRestore (used by RaiseException) */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { -#if PY_VERSION_HEX >= 0x030C00A6 - PyObject *tmp_value; - assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); - if (value) { - #if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) - #endif - PyException_SetTraceback(value, tb); - } - tmp_value = tstate->current_exception; - tstate->current_exception = value; - Py_XDECREF(tmp_value); - Py_XDECREF(type); - Py_XDECREF(tb); -#else - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -#endif -} -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { -#if PY_VERSION_HEX >= 0x030C00A6 - PyObject* exc_value; - exc_value = tstate->current_exception; - tstate->current_exception = 0; - *value = exc_value; - *type = NULL; - *tb = NULL; - if (exc_value) { - *type = (PyObject*) Py_TYPE(exc_value); - Py_INCREF(*type); - #if CYTHON_COMPILING_IN_CPYTHON - *tb = ((PyBaseExceptionObject*) exc_value)->traceback; - Py_XINCREF(*tb); - #else - *tb = PyException_GetTraceback(exc_value); - #endif - } -#else - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -#endif -} -#endif - /* RaiseException */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { PyObject* owned_instance = NULL; @@ -5465,172 +7382,6 @@ bad: return; } -/* PyErrExceptionMatches (used by PyObjectGetAttrStrNoError) */ -#if CYTHON_FAST_THREAD_STATE -static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(tuple); - for (i=0; i= 0x030C00A6 - PyObject *current_exception = tstate->current_exception; - if (unlikely(!current_exception)) return 0; - exc_type = (PyObject*) Py_TYPE(current_exception); - if (exc_type == err) return 1; -#else - exc_type = tstate->curexc_type; - if (exc_type == err) return 1; - if (unlikely(!exc_type)) return 0; -#endif - #if CYTHON_AVOID_BORROWED_REFS - Py_INCREF(exc_type); - #endif - if (unlikely(PyTuple_Check(err))) { - result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); - } else { - result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); - } - #if CYTHON_AVOID_BORROWED_REFS - Py_DECREF(exc_type); - #endif - return result; -} -#endif - -/* PyObjectGetAttrStrNoError (used by GetBuiltinName) */ -#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 -static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) - __Pyx_PyErr_Clear(); -} -#endif -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { - PyObject *result; -#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 - (void) PyObject_GetOptionalAttr(obj, attr_name, &result); - return result; -#else -#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { - return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); - } -#endif - result = __Pyx_PyObject_GetAttrStr(obj, attr_name); - if (unlikely(!result)) { - __Pyx_PyObject_GetAttrStr_ClearAttributeError(); - } - return result; -#endif -} - -/* GetBuiltinName (used by GetModuleGlobalName) */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_mstate_global->__pyx_b, name); - if (unlikely(!result) && !PyErr_Occurred()) { - PyErr_Format(PyExc_NameError, - "name '%U' is not defined", name); - } - return result; -} - -/* PyDictVersioning (used by GetModuleGlobalName) */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { - PyObject **dictptr = NULL; - Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; - if (offset) { -#if CYTHON_COMPILING_IN_CPYTHON - dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); -#else - dictptr = _PyObject_GetDictPtr(obj); -#endif - } - return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; -} -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) - return 0; - return obj_dict_version == __Pyx_get_object_dict_version(obj); -} -#endif - -/* GetModuleGlobalName */ -#if CYTHON_USE_DICT_VERSIONS -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) -#else -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) -#endif -{ - PyObject *result; -#if CYTHON_COMPILING_IN_LIMITED_API - if (unlikely(!__pyx_m)) { - if (!PyErr_Occurred()) - PyErr_SetNone(PyExc_NameError); - return NULL; - } - result = PyObject_GetAttr(__pyx_m, name); - if (likely(result)) { - return result; - } - PyErr_Clear(); -#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS - if (unlikely(__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, name, &result) == -1)) PyErr_Clear(); - __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return result; - } -#else - result = _PyDict_GetItem_KnownHash(__pyx_mstate_global->__pyx_d, name, ((PyASCIIObject *) name)->hash); - __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } - PyErr_Clear(); -#endif - return __Pyx_GetBuiltinName(name); -} - -/* PyObjectFastCallMethod */ -#if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000 -static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf) { - PyObject *result; - PyObject *attr = PyObject_GetAttr(args[0], name); - if (unlikely(!attr)) - return NULL; - result = __Pyx_PyObject_FastCall(attr, args+1, nargsf - 1); - Py_DECREF(attr); - return result; -} -#endif - -/* RaiseUnexpectedTypeError */ -static int -__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) -{ - __Pyx_TypeName obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); - PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, - expected, obj_type_name); - __Pyx_DECREF_TypeName(obj_type_name); - return 0; -} - /* RejectKeywords */ static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds) { PyObject *key = NULL; @@ -5658,6 +7409,109 @@ static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds) { } } +/* pybuiltin_invalid (used by pyint_simplify) */ +static void __Pyx_PyBuiltin_Invalid(PyObject *obj, const char *type_name, const char *argname) { + __Pyx_TypeName obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + if (argname) { + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected %.200s, got " __Pyx_FMT_TYPENAME ")", + argname, type_name, obj_type_name + ); + } else { + PyErr_Format(PyExc_TypeError, + "Expected %.200s, got " __Pyx_FMT_TYPENAME, + type_name, obj_type_name + ); + } + __Pyx_DECREF_TypeName(obj_type_name); +} + +/* pyint_simplify */ +static CYTHON_INLINE int __Pyx_PyInt_FromNumber(PyObject **number_var, const char *argname, int accept_none) { + PyObject *number = *number_var; + if (likely((accept_none && number == Py_None) || PyLong_CheckExact(number))) { + return 0; + } + PyObject *int_object; + if (likely(PyNumber_Check(number))) { + int_object = PyNumber_Long(number); + if (unlikely(!int_object)) goto bad; + } else { + __Pyx_PyBuiltin_Invalid(number, "int", argname); + goto bad; + } + *number_var = int_object; + Py_DECREF(number); + return 0; +bad: + *number_var = NULL; + Py_DECREF(number); + return -1; +} + +/* GetAttr3 */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static PyObject *__Pyx_GetAttr3Default(PyObject *d) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + return NULL; + __Pyx_PyErr_Clear(); + Py_INCREF(d); + return d; +} +#endif +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { + PyObject *r; +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + int res = PyObject_GetOptionalAttr(o, n, &r); + return (res != 0) ? r : __Pyx_NewRef(d); +#else + #if CYTHON_USE_TYPE_SLOTS + if (likely(PyUnicode_Check(n))) { + r = __Pyx_PyObject_GetAttrStrNoError(o, n); + if (unlikely(!r) && likely(!PyErr_Occurred())) { + r = __Pyx_NewRef(d); + } + return r; + } + #endif + r = PyObject_GetAttr(o, n); + return (likely(r)) ? r : __Pyx_GetAttr3Default(d); +#endif +} + +/* RaiseUnexpectedTypeError */ +static int +__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) +{ + __Pyx_TypeName obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, + expected, obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* ExtTypeTest */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + __Pyx_TypeName obj_type_name; + __Pyx_TypeName type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(__Pyx_TypeCheck(obj, type))) + return 1; + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + type_name = __Pyx_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_TypeError, + "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME, + obj_type_name, type_name); + __Pyx_DECREF_TypeName(obj_type_name); + __Pyx_DECREF_TypeName(type_name); + return 0; +} + /* AllocateExtensionType */ static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final) { if (is_final || likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { @@ -6149,138 +8003,6 @@ static int __Pyx_PyType_Ready(PyTypeObject *t) { #endif } -/* SetVTable */ -static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) { - PyObject *ob = PyCapsule_New(vtable, 0, 0); - if (unlikely(!ob)) - goto bad; -#if CYTHON_COMPILING_IN_LIMITED_API - if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0)) -#else - if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0)) -#endif - goto bad; - Py_DECREF(ob); - return 0; -bad: - Py_XDECREF(ob); - return -1; -} - -/* GetVTable (used by MergeVTables) */ -static void* __Pyx_GetVtable(PyTypeObject *type) { - void* ptr; -#if CYTHON_COMPILING_IN_LIMITED_API - PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_mstate_global->__pyx_n_u_pyx_vtable); -#else - PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable); -#endif - if (!ob) - goto bad; - ptr = PyCapsule_GetPointer(ob, 0); - if (!ptr && !PyErr_Occurred()) - PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); - Py_DECREF(ob); - return ptr; -bad: - Py_XDECREF(ob); - return NULL; -} - -/* MergeVTables */ -static int __Pyx_MergeVtables(PyTypeObject *type) { - int i=0; - Py_ssize_t size; - void** base_vtables; - __Pyx_TypeName tp_base_name = NULL; - __Pyx_TypeName base_name = NULL; - void* unknown = (void*)-1; - PyObject* bases = __Pyx_PyType_GetSlot(type, tp_bases, PyObject*); - int base_depth = 0; - { - PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); - while (base) { - base_depth += 1; - base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*); - } - } - base_vtables = (void**) PyMem_Malloc(sizeof(void*) * (size_t)(base_depth + 1)); - base_vtables[0] = unknown; -#if CYTHON_COMPILING_IN_LIMITED_API - size = PyTuple_Size(bases); - if (size < 0) goto other_failure; -#else - size = PyTuple_GET_SIZE(bases); -#endif - for (i = 1; i < size; i++) { - PyObject *basei; - void* base_vtable; -#if CYTHON_AVOID_BORROWED_REFS - basei = PySequence_GetItem(bases, i); - if (unlikely(!basei)) goto other_failure; -#elif !CYTHON_ASSUME_SAFE_MACROS - basei = PyTuple_GetItem(bases, i); - if (unlikely(!basei)) goto other_failure; -#else - basei = PyTuple_GET_ITEM(bases, i); -#endif - base_vtable = __Pyx_GetVtable((PyTypeObject*)basei); -#if CYTHON_AVOID_BORROWED_REFS - Py_DECREF(basei); -#endif - if (base_vtable != NULL) { - int j; - PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); - for (j = 0; j < base_depth; j++) { - if (base_vtables[j] == unknown) { - base_vtables[j] = __Pyx_GetVtable(base); - base_vtables[j + 1] = unknown; - } - if (base_vtables[j] == base_vtable) { - break; - } else if (base_vtables[j] == NULL) { - goto bad; - } - base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*); - } - } - } - PyErr_Clear(); - PyMem_Free(base_vtables); - return 0; -bad: - { - PyTypeObject* basei = NULL; - PyTypeObject* tp_base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); - tp_base_name = __Pyx_PyType_GetFullyQualifiedName(tp_base); -#if CYTHON_AVOID_BORROWED_REFS - basei = (PyTypeObject*)PySequence_GetItem(bases, i); - if (unlikely(!basei)) goto really_bad; -#elif !CYTHON_ASSUME_SAFE_MACROS - basei = (PyTypeObject*)PyTuple_GetItem(bases, i); - if (unlikely(!basei)) goto really_bad; -#else - basei = (PyTypeObject*)PyTuple_GET_ITEM(bases, i); -#endif - base_name = __Pyx_PyType_GetFullyQualifiedName(basei); -#if CYTHON_AVOID_BORROWED_REFS - Py_DECREF(basei); -#endif - } - PyErr_Format(PyExc_TypeError, - "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name); -#if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS -really_bad: // bad has failed! -#endif - __Pyx_DECREF_TypeName(tp_base_name); - __Pyx_DECREF_TypeName(base_name); -#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS -other_failure: -#endif - PyMem_Free(base_vtables); - return -1; -} - /* DelItemOnTypeDict (used by SetupReduce) */ static int __Pyx__DelItemOnTypeDict(PyTypeObject *tp, PyObject *k) { int result; @@ -6405,89 +8127,6 @@ __PYX_GOOD: return ret; } -/* TypeImport */ -#ifndef __PYX_HAVE_RT_ImportType_3_2_1 -#define __PYX_HAVE_RT_ImportType_3_2_1 -static PyTypeObject *__Pyx_ImportType_3_2_1(PyObject *module, const char *module_name, const char *class_name, - size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_1 check_size) -{ - PyObject *result = 0; - Py_ssize_t basicsize; - Py_ssize_t itemsize; -#if defined(Py_LIMITED_API) || (defined(CYTHON_COMPILING_IN_LIMITED_API) && CYTHON_COMPILING_IN_LIMITED_API) - PyObject *py_basicsize; - PyObject *py_itemsize; -#endif - result = PyObject_GetAttrString(module, class_name); - if (!result) - goto bad; - if (!PyType_Check(result)) { - PyErr_Format(PyExc_TypeError, - "%.200s.%.200s is not a type object", - module_name, class_name); - goto bad; - } -#if !( defined(Py_LIMITED_API) || (defined(CYTHON_COMPILING_IN_LIMITED_API) && CYTHON_COMPILING_IN_LIMITED_API) ) - basicsize = ((PyTypeObject *)result)->tp_basicsize; - itemsize = ((PyTypeObject *)result)->tp_itemsize; -#else - if (size == 0) { - return (PyTypeObject *)result; - } - 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+itemsize); - goto bad; - } - if (check_size == __Pyx_ImportType_CheckSize_Error_3_2_1 && - ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) { - PyErr_Format(PyExc_ValueError, - "%.200s.%.200s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd-%zd from PyObject", - module_name, class_name, size, basicsize, basicsize+itemsize); - goto bad; - } - else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_2_1 && (size_t)basicsize > size) { - if (PyErr_WarnFormat(NULL, 0, - "%.200s.%.200s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize) < 0) { - goto bad; - } - } - return (PyTypeObject *)result; -bad: - Py_XDECREF(result); - return NULL; -} -#endif - /* HasAttr (used by ImportImpl) */ #if __PYX_LIMITED_VERSION_HEX < 0x030d0000 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { @@ -8281,45 +9920,74 @@ bad: } #endif -/* FormatTypeName */ -#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000 -static __Pyx_TypeName -__Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp) -{ - PyObject *module = NULL, *name = NULL, *result = NULL; - #if __PYX_LIMITED_VERSION_HEX < 0x030b0000 - name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, - __pyx_mstate_global->__pyx_n_u_qualname); - #else - name = PyType_GetQualName(tp); - #endif - if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) goto bad; - module = __Pyx_PyObject_GetAttrStr((PyObject *)tp, - __pyx_mstate_global->__pyx_n_u_module); - if (unlikely(module == NULL) || unlikely(!PyUnicode_Check(module))) goto bad; - if (PyUnicode_CompareWithASCIIString(module, "builtins") == 0) { - result = name; - name = NULL; - goto done; +/* 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;\ } - result = PyUnicode_FromFormat("%U.%U", module, name); - if (unlikely(result == NULL)) goto bad; - done: - Py_XDECREF(name); - Py_XDECREF(module); - return result; - bad: - PyErr_Clear(); - if (name) { - result = name; - name = NULL; - } else { - result = __Pyx_NewRef(__pyx_mstate_global->__pyx_kp_u_); - } - goto done; -} -#endif +/* CheckUnpickleChecksum */ +static void __Pyx_RaiseUnpickleChecksumError(long checksum, long checksum1, long checksum2, long checksum3, const char *members) { + PyObject *pickle_module = PyImport_ImportModule("pickle"); + if (unlikely(!pickle_module)) return; + PyObject *pickle_error = PyObject_GetAttrString(pickle_module, "PickleError"); + Py_DECREF(pickle_module); + if (unlikely(!pickle_error)) return; + if (checksum2 == checksum1) { + PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x) = (%s))", + checksum, checksum1, members); + } else if (checksum3 == checksum2) { + PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x, 0x%x) = (%s))", + checksum, checksum1, checksum2, members); + } else { + PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x, 0x%x, 0x%x) = (%s))", + checksum, checksum1, checksum2, checksum3, members); + } + Py_DECREF(pickle_error); +} +static int __Pyx_CheckUnpickleChecksum(long checksum, long checksum1, long checksum2, long checksum3, const char *members) { + int found = 0; + found |= checksum1 == checksum; + found |= checksum2 == checksum; + found |= checksum3 == checksum; + if (likely(found)) + return 0; + __Pyx_RaiseUnpickleChecksumError(checksum, checksum1, checksum2, checksum3, members); + return -1; +} + +static PyObject* __pyx_convert__to_py_struct____pyx_t_18polluck_blockchain_11placeholder_PyStringC(struct __pyx_t_18polluck_blockchain_11placeholder_PyStringC s) { + PyObject* res; + PyObject* member; + res = __Pyx_PyDict_NewPresized(2); if (unlikely(!res)) return NULL; + member = __Pyx_PyObject_FromString(s.ptr); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_ptr, member) < 0)) goto bad; + Py_DECREF(member); + member = PyLong_FromSsize_t(s.length); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_length, member) < 0)) goto bad; + Py_DECREF(member); + return res; + bad: + Py_XDECREF(member); + Py_DECREF(res); + return NULL; +} /* PyObjectVectorCallKwBuilder (used by CIntToPy) */ #if CYTHON_VECTORCALL static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { @@ -8353,30 +10021,30 @@ CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyO #endif /* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value) { +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_unsigned_long(unsigned 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; + const unsigned long neg_one = (unsigned long) -1, const_zero = (unsigned 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)) { + if (sizeof(unsigned long) < sizeof(long)) { return PyLong_FromLong((long) value); - } else if (sizeof(long) <= sizeof(unsigned long)) { + } else if (sizeof(unsigned long) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #if !CYTHON_COMPILING_IN_PYPY - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + } else if (sizeof(unsigned long) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { - if (sizeof(long) <= sizeof(long)) { + if (sizeof(unsigned long) <= sizeof(long)) { return PyLong_FromLong((long) value); - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + } else if (sizeof(unsigned long) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); } } @@ -8390,7 +10058,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value) { } #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 int one = 1; int little = (int)*(unsigned char *)&one; - return _PyLong_FromByteArray(bytes, sizeof(long), + return _PyLong_FromByteArray(bytes, sizeof(unsigned long), little, !is_unsigned); #else int one = 1; int little = (int)*(unsigned char *)&one; @@ -8398,7 +10066,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value) { PyObject *py_bytes = NULL, *order_str = NULL; from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); if (!from_bytes) return NULL; - py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long)); + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(unsigned long)); if (!py_bytes) goto limited_bad; order_str = PyUnicode_FromString(little ? "little" : "big"); if (!order_str) goto limited_bad; @@ -8421,27 +10089,255 @@ static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value) { } } -/* CIntFromPyVerify (used by CIntFromPy) */ -#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;\ +/* CIntFromPy */ +static CYTHON_INLINE unsigned long __Pyx_PyLong_As_unsigned_long(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const unsigned long neg_one = (unsigned long) -1, const_zero = (unsigned long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (unsigned long) -1; + val = __Pyx_PyLong_As_unsigned_long(tmp); + Py_DECREF(tmp); + return val; } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(unsigned long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(unsigned long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(unsigned long) >= 2 * PyLong_SHIFT)) { + return (unsigned long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(unsigned long) >= 3 * PyLong_SHIFT)) { + return (unsigned long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(unsigned long) >= 4 * PyLong_SHIFT)) { + return (unsigned long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + 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 long) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(unsigned long) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(unsigned long, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(unsigned long) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(unsigned long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(unsigned long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(unsigned long) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(unsigned long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(unsigned long) - 1 > 2 * PyLong_SHIFT)) { + return (unsigned long) (((unsigned long)-1)*(((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(unsigned long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(unsigned long) - 1 > 2 * PyLong_SHIFT)) { + return (unsigned long) ((((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(unsigned long) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(unsigned long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(unsigned long) - 1 > 3 * PyLong_SHIFT)) { + return (unsigned long) (((unsigned long)-1)*(((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(unsigned long) - 1 > 3 * PyLong_SHIFT)) { + return (unsigned long) ((((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(unsigned long) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(unsigned long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(unsigned long) - 1 > 4 * PyLong_SHIFT)) { + return (unsigned long) (((unsigned long)-1)*(((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(unsigned long) - 1 > 4 * PyLong_SHIFT)) { + return (unsigned long) ((((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(unsigned long) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(unsigned long, long, PyLong_AsLong(x)) + } else if ((sizeof(unsigned long) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(unsigned long, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + unsigned long val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (unsigned long) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (unsigned long) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (unsigned long) -1; + } else { + stepval = v; + } + v = NULL; + val = (unsigned long) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(unsigned long) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((unsigned long) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(unsigned long) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((unsigned long) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((unsigned long) 1) << (sizeof(unsigned long) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (unsigned long) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to unsigned long"); + return (unsigned long) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long) -1; +} /* CIntFromPy */ static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *x) { @@ -8693,6 +10589,197 @@ raise_neg_overflow: return (long) -1; } +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_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 PyLong_FromLong((long) value); + } else if (sizeof(long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } 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 PyLong_FromLong((long) value); + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(long), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL, *kwds = NULL; + PyObject *py_bytes = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + { + PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; + if (!is_unsigned) { + kwds = __Pyx_MakeVectorcallBuilderKwds(1); + if (!kwds) goto limited_bad; + if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; + } + result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); + } + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* PyObjectCall2Args */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { + PyObject *args[3] = {NULL, arg1, arg2}; + return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* PyObjectCallMethod1 */ +#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))) +static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) { + PyObject *result = __Pyx_PyObject_CallOneArg(method, arg); + Py_DECREF(method); + return result; +} +#endif +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { +#if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)) + PyObject *args[2] = {obj, arg}; + (void) __Pyx_PyObject_CallOneArg; + (void) __Pyx_PyObject_Call2Args; + return PyObject_VectorcallMethod(method_name, args, 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); +#else + PyObject *method = NULL, *result; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_Call2Args(method, obj, arg); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) return NULL; + return __Pyx__PyObject_CallMethod1(method, arg); +#endif +} + +/* UpdateUnpickledDict */ +static int __Pyx__UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index) { + PyObject *state_dict = __Pyx_PySequence_ITEM(state, index); + if (unlikely(!state_dict)) { + return -1; + } + int non_empty = PyObject_IsTrue(state_dict); + if (non_empty == 0) { + Py_DECREF(state_dict); + return 0; + } else if (unlikely(non_empty == -1)) { + return -1; + } + PyObject *dict; + #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + dict = PyObject_GetAttrString(obj, "__dict__"); + #else + dict = PyObject_GenericGetDict(obj, NULL); + #endif + if (unlikely(!dict)) { + Py_DECREF(state_dict); + return -1; + } + int result; + if (likely(PyDict_CheckExact(dict))) { + result = PyDict_Update(dict, state_dict); + } else { + PyObject *obj_result = __Pyx_PyObject_CallMethod1(dict, __pyx_mstate_global->__pyx_n_u_update, state_dict); + if (likely(obj_result)) { + Py_DECREF(obj_result); + result = 0; + } else { + result = -1; + } + } + Py_DECREF(state_dict); + Py_DECREF(dict); + return result; +} +static int __Pyx_UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index) { + Py_ssize_t state_size = __Pyx_PyTuple_GET_SIZE(state); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(state_size == -1)) return -1; + #endif + if (state_size <= index) { + return 0; + } + return __Pyx__UpdateUnpickledDict(obj, state, index); +} + +/* FormatTypeName */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static __Pyx_TypeName +__Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp) +{ + PyObject *module = NULL, *name = NULL, *result = NULL; + #if __PYX_LIMITED_VERSION_HEX < 0x030b0000 + name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_mstate_global->__pyx_n_u_qualname); + #else + name = PyType_GetQualName(tp); + #endif + if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) goto bad; + module = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_mstate_global->__pyx_n_u_module); + if (unlikely(module == NULL) || unlikely(!PyUnicode_Check(module))) goto bad; + if (PyUnicode_CompareWithASCIIString(module, "builtins") == 0) { + result = name; + name = NULL; + goto done; + } + result = PyUnicode_FromFormat("%U.%U", module, name); + if (unlikely(result == NULL)) goto bad; + done: + Py_XDECREF(name); + Py_XDECREF(module); + return result; + bad: + PyErr_Clear(); + if (name) { + result = name; + name = NULL; + } else { + result = __Pyx_NewRef(__pyx_mstate_global->__pyx_kp_u_); + } + goto done; +} +#endif + /* CIntFromPy */ static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC diff --git a/src/polluck_blockchain/placeholder.py b/src/polluck_blockchain/placeholder.py index ca2e625..5a6aa75 100644 --- a/src/polluck_blockchain/placeholder.py +++ b/src/polluck_blockchain/placeholder.py @@ -1,18 +1,47 @@ """placeholder module for compilation""" -import typing as t +from __future__ import annotations + +import datetime import cython -from cython.cimports.cpython.ref import Py_INCREF +import dopt_basics.datetime + +# from cython.cimports.cpython.ref import Py_INCREF, PyObject + +PyStringC = cython.struct( + ptr=cython.p_char, + length=cython.Py_ssize_t, +) + + +@cython.cfunc +def PyStringC_to_unicode( + string: PyStringC, +) -> str: + return string.ptr[: string.length].decode("UTF-8", "strict") + + +@cython.cfunc +def PyStringC_to_bytes( + string: PyStringC, +) -> bytes: + return cython.cast(bytes, string.ptr[: string.length]) + + +@cython.cfunc +def timestamp_to_datetime( + ts: cython.double, +) -> datetime.datetime: + return datetime.datetime.fromtimestamp(ts, dopt_basics.datetime.TIMEZONE_UTC) @cython.cclass class StringHolder: - _data = cython.declare(cython.p_char, visibility="private") - _length = cython.declare(cython.Py_ssize_t, visibility="readonly") - _py_cache = cython.declare(object, visibility="private") + c = cython.declare(PyStringC, visibility="readonly") + _py_data = cython.declare(object, visibility="private") - def __cinit__(self, data: str) -> None: + def __cinit__(self, data: str): """accepting Python str Parameters @@ -23,23 +52,68 @@ class StringHolder: if not isinstance(data, str): raise TypeError("Data not 'str'") - tmp = data.encode("utf-8") - Py_INCREF(tmp) - self._data = tmp - self._length = len(tmp) - self._py_cache = None - - @cython.cfunc - def _bytes_to_str(self) -> str: - tmp = t.cast(bytes, self._data[: self._length]) - return tmp.decode("utf-8") + self._py_data = data.encode("UTF-8") + self.c = PyStringC(self._py_data, len(self._py_data)) @property - def py_string(self) -> str: - if self._py_cache is None: - self._py_cache = self._bytes_to_str() - return t.cast(str, self._py_cache) + def py_string(self): + return PyStringC_to_unicode(self.c) @property - def py_bytes(self) -> bytes: - return t.cast(bytes, self._data[: self._length]) + def py_bytes(self): + return PyStringC_to_bytes(self.c) + + +# BlockC = cython.struct( +# index=cython.ulonglong, +# timestamp=cython.double, +# data=PyStringC, +# previous_hash=PyStringC, +# nonce=cython.ulonglong, +# ) + + +@cython.cclass +class Block: + _index = cython.declare(cython.ulong, visibility="private") + _timestamp = cython.declare(cython.double, visibility="private") + _data = cython.declare(StringHolder, visibility="private") + _prev_hash = cython.declare(StringHolder, visibility="private") + _nonce = cython.declare(cython.ulong, visibility="private") + + def __init__( + self, + index: int, + data: str, + previous_hash: str, + nonce: int, + ): + self._index = index + self._timestamp = dopt_basics.datetime.current_time_tz().timestamp() + self._data = StringHolder.__new__(StringHolder, data) + self._prev_hash = StringHolder.__new__(StringHolder, previous_hash) + self._nonce = nonce + + @property + def index(self): + return self._index + + @property + def timestamp(self): + return timestamp_to_datetime(self._timestamp) + + @property + def data(self): + return self._data.py_string + + @property + def prev_hash(self): + return self._prev_hash.py_string + + @property + def nonce(self): + return self._nonce + + @nonce.setter + def nonce(self, value: int): + self._nonce = value