Jean Brouwers <[EMAIL PROTECTED]> added the comment:
Three questions on the sizeof.patch:
1) In the first line of function dict_sizeof()
+ res = sizeof(PyDictObject) + sizeof(mp->ma_table);
is the sizeof(mp->ma_table) counted twice?
2) Since functions list_sizeof and dict_sizeof return the allocated
size, including the over-allocation, should function string_sizeof not
include the sentinel null character?
3) Are tuples left out on purpose? If not, here is an implementation
for Objects/tupleobject.c:
....
static PyObject *
tuple_sizeof(PyTupleObject *v)
{
Py_ssize_t res;
res = _PyObject_SIZE(&PyTuple_Type) + Py_SIZE(v) *
sizeof(void*);
return PyInt_FromSsize_t(res);
}
PyDoc_STRVAR(sizeof_doc,
"T.__sizeof__() -- size of T in bytes");
....
static PyMethodDef tuple_methods[] = {
{"__getnewargs__", (PyCFunction)tuple_getnewargs,
METH_NOARGS},
{"__sizeof__", (PyCFunction)tuple_sizeof, METH_NOARGS,
sizeof_doc},
....
/Jean Brouwers
----------
nosy: +MrJean1
_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2898>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com