[Python-checkins] r63761 - in python/branches/okkoto-sizeof: Lib/test/test_sys.py Objects/typeobject.c Python/sysmodule.c

Georg Brandl g.brandl at gmx.net
Thu May 29 16:30:52 CEST 2008


Robert Schuppenies schrieb:
> Nick Coghlan wrote:
>> The way to avoid this confusion is to invoke type(obj).__sizeof__(obj)
>> rather than attempting to invoke obj.__sizeof__() directly.
>> 
>> I'd suggest seeing how you go with changing __sizeof__ back to a normal
>> method and implementing the C equivalent of type(obj).__sizeof__(obj) to
>> actually make the method call in sys_getsizeof (see PyObject_Format in
>> Objects/abstract.c for an example of how to do this).
> 
> Works like a charm, thanks for the hint.

And I'd like to apologize for the wrong hints I gave you, I should have
thought better about it before.

> Also for pointing me to this list, I wasn't aware that somebody is
> watching my moves. I'll try to adapt my submit policy to this fact.

It's like builtin code review. Great, isn't it? :)

Georg



More information about the Python-checkins mailing list