This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author loewis
Recipients asvetlov, gregory.p.smith, jcea, loewis, mark.dickinson, meador.inge, serhiy.storchaka, skrah
Date 2012-07-26.14:41:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1343313671.58.0.550720284108.issue15402@psf.upfronthosting.co.za>
In-reply-to
Content
> What if use totalsize = object.__sizeof__(struct_obj) ?

That would defeat the purpose of the test. We want to test whether __sizeof__ is correct, so we shouldn't use __sizeof__ in the test to compute the expected result. I understand that object.__sizeof__ is actually a different implementation, but still: there might be errors e.g. in the type definition that cancel out errors in the sizeof implementation. The more "directly" the expected result is computed, the better.

I also realize that such tests will be fragile if the the structures change. This is a good thing, IMO: anybody changing the layout of some object should *have* to verify that the size computation is still correct, so it's good that the test breaks if the structures change.
History
Date User Action Args
2012-07-26 14:41:11loewissetrecipients: + loewis, gregory.p.smith, jcea, mark.dickinson, asvetlov, skrah, meador.inge, serhiy.storchaka
2012-07-26 14:41:11loewissetmessageid: <1343313671.58.0.550720284108.issue15402@psf.upfronthosting.co.za>
2012-07-26 14:41:11loewislinkissue15402 messages
2012-07-26 14:41:10loewiscreate