[issue3147] tests for sys.getsizeof fail on win64

Amaury Forgeot d'Arc report at bugs.python.org
Thu Jun 26 11:00:32 CEST 2008


Amaury Forgeot d'Arc <amauryfa at gmail.com> added the comment:

> long's structure is 'lP PP l H'
No, it's a VAR-sized object, and ob_size is a Py_ssize_t, which is best
represented as a 'P' as you already did for other types. I suggest 'lP
PP P H'.

> the function size which is 'lp PP 9l'
According to Include/funcobject.h, there are nine PyObject*, the
description should end with "9P".

I think there are some other inconsistencies. For example, the tests for
'list' should be
        self.check_sizeof([], size(h + 'PPP'))
        self.check_sizeof([1, 2, 3], size(h + 'PPP') + 3*self.P)
for the same reasons as for the 'long' type (ob_size is a Py_ssize_t),
even if the total is the same thanks to alignment.

I agree it's very difficult to get it right...

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3147>
_______________________________________


More information about the Python-bugs-list mailing list