Author MrJean1
Recipients MrJean1, facundobatista, georg.brandl, gvanrossum, jcea, loewis, rhettinger, schuppenies
Date 2008-06-18.19:49:14
SpamBayes Score 0.0527979
Marked as misclassified No
Message-id <1213818560.06.0.492034634025.issue2898@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2008-06-18 19:49:20MrJean1setspambayes_score: 0.0527979 -> 0.0527979
recipients: + MrJean1, gvanrossum, loewis, georg.brandl, rhettinger, facundobatista, jcea, schuppenies
2008-06-18 19:49:20MrJean1setspambayes_score: 0.0527979 -> 0.0527979
messageid: <1213818560.06.0.492034634025.issue2898@psf.upfronthosting.co.za>
2008-06-18 19:49:18MrJean1linkissue2898 messages
2008-06-18 19:49:16MrJean1create