Martin v. Löwis <mar...@v.loewis.de> added the comment: > I do not think that the purpose of testing is a testing of object.__sizeof__. > Memory consumption consists of two parts -- memory for C structure (and the > base object implementation works for this)
Note that object.__sizeof__ does something slightly different, though: it uses basicsize (which may or may not contain the sizeof() invocation of the correct C structure), and it considers tp_itemsize (which may or may not have a correct value). > >> 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. > > Such tests is too fragile. They force the programmer to write unnecessary > code > in cases when it can be done automatically. That's not the definition of "fragile", though. What you describe is that writing the test this way is "tedious" (утомительный); it isn't (necessarily) "fragile" (хрупкий). I (clearly) disagree that this approach is "too tedious". ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue15402> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com