[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


-----BEGIN PGP SIGNED MESSAGE-----
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
"sizeof("1234B")==sizeof("B")".

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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQCVAwUBUA2ZiZlgi5GaxT1NAQKwLQP/RqrP5qbvUtZ9MCuyTaT45l8+7QzqlJrx
Nyh2t98jWVxiso0FDyT2vw839lX0CwssuKyNPFkXzKicNiX4mW0rC1uxNajCk0kG
aVHKL6aC+65iJhA7+9uOW1yfRFyhqQbUc3aRlvg7UJMj4YEfB82Okk/2Wu0hgyiU
4Ti5VvFuOZ8=
=G/WJ
-----END PGP SIGNATURE-----


More information about the Python-Dev mailing list