From fa4f1412302a80bff83332d12de3b185f9df24a2 Mon Sep 17 00:00:00 2001 From: foefl Date: Mon, 1 Dec 2025 16:38:24 +0100 Subject: [PATCH] change visibility --- src/polluck_blockchain/placeholder.c | 135 +++++++++++++++++++++++++- src/polluck_blockchain/placeholder.py | 2 +- 2 files changed, 134 insertions(+), 3 deletions(-) diff --git a/src/polluck_blockchain/placeholder.c b/src/polluck_blockchain/placeholder.c index ed74a9d..d62f28c 100644 --- a/src/polluck_blockchain/placeholder.c +++ b/src/polluck_blockchain/placeholder.c @@ -2559,6 +2559,9 @@ static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_10Blockchain_10diff static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_10Blockchain_4create_genesis_block(struct __pyx_obj_18polluck_blockchain_11placeholder_Blockchain *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_10Blockchain_6proof_of_work(struct __pyx_obj_18polluck_blockchain_11placeholder_Blockchain *__pyx_v_self, struct __pyx_obj_18polluck_blockchain_11placeholder_Block *__pyx_v_block); /* proto */ static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_10Blockchain_8add_block(struct __pyx_obj_18polluck_blockchain_11placeholder_Blockchain *__pyx_v_self, PyObject *__pyx_v_data); /* proto */ +static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_10Blockchain_5chain___get__(struct __pyx_obj_18polluck_blockchain_11placeholder_Blockchain *__pyx_v_self); /* proto */ +static int __pyx_pf_18polluck_blockchain_11placeholder_10Blockchain_5chain_2__set__(struct __pyx_obj_18polluck_blockchain_11placeholder_Blockchain *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_18polluck_blockchain_11placeholder_10Blockchain_5chain_4__del__(struct __pyx_obj_18polluck_blockchain_11placeholder_Blockchain *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_10Blockchain_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_18polluck_blockchain_11placeholder_Blockchain *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_10Blockchain_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_18polluck_blockchain_11placeholder_Blockchain *__pyx_v_self, CYTHON_UNUSED 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 */ @@ -5492,7 +5495,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_5Block_10__setstate } /* "polluck_blockchain/placeholder.py":167 - * chain = cython.declare(list[Block]) + * chain = cython.declare(list[Block], visibility="public") * * def __cinit__(self): # <<<<<<<<<<<<<< * self._index = 0 @@ -5537,7 +5540,7 @@ static int __pyx_pf_18polluck_blockchain_11placeholder_10Blockchain___cinit__(st __pyx_v_self->_index = 0; /* "polluck_blockchain/placeholder.py":167 - * chain = cython.declare(list[Block]) + * chain = cython.declare(list[Block], visibility="public") * * def __cinit__(self): # <<<<<<<<<<<<<< * self._index = 0 @@ -6792,6 +6795,120 @@ static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_10Blockchain_8add_b return __pyx_r; } +/* "polluck_blockchain/placeholder.py":165 + * _difficulty = cython.declare(cython.int, visibility="private") + * _index = cython.declare(cython.Py_ssize_t, visibility="private") + * chain = cython.declare(list[Block], visibility="public") # <<<<<<<<<<<<<< + * + * def __cinit__(self): +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_18polluck_blockchain_11placeholder_10Blockchain_5chain_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_18polluck_blockchain_11placeholder_10Blockchain_5chain_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_10Blockchain_5chain___get__(((struct __pyx_obj_18polluck_blockchain_11placeholder_Blockchain *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_18polluck_blockchain_11placeholder_10Blockchain_5chain___get__(struct __pyx_obj_18polluck_blockchain_11placeholder_Blockchain *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->chain); + __pyx_r = __pyx_v_self->chain; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_18polluck_blockchain_11placeholder_10Blockchain_5chain_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_18polluck_blockchain_11placeholder_10Blockchain_5chain_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_18polluck_blockchain_11placeholder_10Blockchain_5chain_2__set__(((struct __pyx_obj_18polluck_blockchain_11placeholder_Blockchain *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_18polluck_blockchain_11placeholder_10Blockchain_5chain_2__set__(struct __pyx_obj_18polluck_blockchain_11placeholder_Blockchain *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + __pyx_t_1 = __pyx_v_value; + __Pyx_INCREF(__pyx_t_1); + if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_1))) __PYX_ERR(0, 165, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->chain); + __Pyx_DECREF(__pyx_v_self->chain); + __pyx_v_self->chain = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("polluck_blockchain.placeholder.Blockchain.chain.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_18polluck_blockchain_11placeholder_10Blockchain_5chain_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_18polluck_blockchain_11placeholder_10Blockchain_5chain_5__del__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_18polluck_blockchain_11placeholder_10Blockchain_5chain_4__del__(((struct __pyx_obj_18polluck_blockchain_11placeholder_Blockchain *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_18polluck_blockchain_11placeholder_10Blockchain_5chain_4__del__(struct __pyx_obj_18polluck_blockchain_11placeholder_Blockchain *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->chain); + __Pyx_DECREF(__pyx_v_self->chain); + __pyx_v_self->chain = ((PyObject*)Py_None); + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" @@ -7788,6 +7905,19 @@ static PyObject *__pyx_getprop_18polluck_blockchain_11placeholder_10Blockchain_d return __pyx_pw_18polluck_blockchain_11placeholder_10Blockchain_10difficulty_1__get__(o); } +static PyObject *__pyx_getprop_18polluck_blockchain_11placeholder_10Blockchain_chain(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_18polluck_blockchain_11placeholder_10Blockchain_5chain_1__get__(o); +} + +static int __pyx_setprop_18polluck_blockchain_11placeholder_10Blockchain_chain(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_18polluck_blockchain_11placeholder_10Blockchain_5chain_3__set__(o, v); + } + else { + return __pyx_pw_18polluck_blockchain_11placeholder_10Blockchain_5chain_5__del__(o); + } +} + static PyMethodDef __pyx_methods_18polluck_blockchain_11placeholder_Blockchain[] = { {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_11placeholder_10Blockchain_11__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_11placeholder_10Blockchain_13__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, @@ -7797,6 +7927,7 @@ static PyMethodDef __pyx_methods_18polluck_blockchain_11placeholder_Blockchain[] static struct PyGetSetDef __pyx_getsets_18polluck_blockchain_11placeholder_Blockchain[] = { {"index", __pyx_getprop_18polluck_blockchain_11placeholder_10Blockchain_index, 0, 0, 0}, {"difficulty", __pyx_getprop_18polluck_blockchain_11placeholder_10Blockchain_difficulty, 0, 0, 0}, + {"chain", __pyx_getprop_18polluck_blockchain_11placeholder_10Blockchain_chain, __pyx_setprop_18polluck_blockchain_11placeholder_10Blockchain_chain, 0, 0}, {0, 0, 0, 0, 0} }; #if CYTHON_USE_TYPE_SPECS diff --git a/src/polluck_blockchain/placeholder.py b/src/polluck_blockchain/placeholder.py index 5c788b2..1000e3e 100644 --- a/src/polluck_blockchain/placeholder.py +++ b/src/polluck_blockchain/placeholder.py @@ -162,7 +162,7 @@ class Block: class Blockchain: _difficulty = cython.declare(cython.int, visibility="private") _index = cython.declare(cython.Py_ssize_t, visibility="private") - chain = cython.declare(list[Block]) + chain = cython.declare(list[Block], visibility="public") def __cinit__(self): self._index = 0