[Python-Dev] [Python-checkins] cpython (merge 3.2 -> default): MERGE: Better test for Issue #15402: Add a __sizeof__ method to struct.Struct

Jesus Cea jcea at jcea.es
Mon Jul 23 20:35:53 CEST 2012

Hash: SHA1

On 23/07/12 20:19, Meador Inge wrote:
> self.assertGreaterEqual(sys.getsizeof(struct.Struct('123B')),
> and while they didn't fail without the patch I felt they were still
> useful in documenting that there is nothing that guarantees
> 'sizeof("123B") > sizeof("B")' 'sizeof("B" * 123) >
> sizeof("123B")', or 'sizeof("123xB") > sizeof("B")'.

No garantee, but I would find "interesting" that

If someday we implement some clever idea here (like the repeat counter
optimization discussed), we can simply change "sizeof("123B")" to
"sizeof("12345B")", or to "sizeof("BHBHBHBH"), etc.

> It isn't that big of a deal.  We can just leave the tests as you
> changed them. In the future it would probably be better to hash
> this stuff out in the tracker. The patch was out for review for
> several days ...

I agree. I should have raised this issue in the tracker. The fact is
that I was checking the patch carefully today, when we collided
mid-air working in the same issue both of us :-). I disliked the
proposed tests at that time.

Thanks for raising the issue. I will try to be more careful.

- -- 
Jesus Cea Avion                         _/_/      _/_/_/        _/_/_/
jcea at jcea.es - http://www.jcea.es/     _/_/    _/_/  _/_/    _/_/  _/_/
jabber / xmpp:jcea at jabber.org         _/_/    _/_/          _/_/_/_/_/
.                              _/_/  _/_/    _/_/          _/_/  _/_/
"Things are not so easy"      _/_/  _/_/    _/_/  _/_/    _/_/  _/_/
"My name is Dump, Core Dump"   _/_/_/        _/_/_/      _/_/  _/_/
"El amor es poner tu felicidad en la felicidad de otro" - Leibniz
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/


More information about the Python-Dev mailing list