[issue15490] Correct __sizeof__ support for StringIO

Martin v. Löwis report at bugs.python.org
Mon Sep 17 13:18:29 CEST 2012


Martin v. Löwis added the comment:

I disagree that sizeof cannot work well for variable-sized types. It works very well for strings, lists, tuple, dicts, and other "regular" containers. I agree that it is not important that it is absolutely correct (in some sense) for every object, but it shouldn't lose "big" chunks of data. A bug where it misses four bytes is much less important than a bug where it misses N bytes (for an object-specific value N that can grow indefinitely).

As for the specific patch, I don't think any action should be taken before the 3.3 release. I would personally prefer if the computations where done in Py_ssize_t, not PyObject* (i.e. the result of the recursive call should be unwrapped).

----------

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


More information about the Python-bugs-list mailing list