@@ -4812,6 +4812,14 @@ BlockIndex_length(BlockIndexObject *self){
48124812}
48134813
48144814
4815+ static PyObject *
4816+ BlockIndex_sizeof (BlockIndexObject * self ) {
4817+ return PyLong_FromSsize_t (
4818+ Py_TYPE (self )-> tp_basicsize
4819+ + (self -> bir_capacity ) * sizeof (BlockIndexRecord )
4820+ );
4821+ }
4822+
48154823
48164824// Given an index, return just the block index.
48174825static PyObject *
@@ -4864,6 +4872,7 @@ static PyMethodDef BlockIndex_methods[] = {
48644872 {"register" , (PyCFunction )BlockIndex_register , METH_O , NULL },
48654873 {"__getstate__" , (PyCFunction ) BlockIndex_getstate , METH_NOARGS , NULL },
48664874 {"__setstate__" , (PyCFunction ) BlockIndex_setstate , METH_O , NULL },
4875+ {"__sizeof__" , (PyCFunction ) BlockIndex_sizeof , METH_NOARGS , NULL },
48674876 {"to_list" , (PyCFunction )BlockIndex_to_list , METH_NOARGS , NULL },
48684877 {"to_bytes" , (PyCFunction )BlockIndex_to_bytes , METH_NOARGS , NULL },
48694878 {"copy" , (PyCFunction )BlockIndex_copy , METH_NOARGS , NULL },
0 commit comments