Author amaury.forgeotdarc
Recipients amaury.forgeotdarc, benjamin.peterson, facundobatista, schuppenies
Date 2008-06-26.22:08:15
SpamBayes Score 0.0473882
Marked as misclassified No
Message-id <1214518176.81.0.454257762399.issue3122@psf.upfronthosting.co.za>
In-reply-to
Content
I wondered why getsizeof fails for _sre.SRE_Pattern objects when it
succeeds for _socket.socket or struct.Struct.

It turns out that _sre.SRE_Pattern defines the tp_getattr slot, and this
prevents attribute lookup from searching the base class (object).
This is a pity, because the base implementation (which use tp_basicsize)
does the right thing for many objects.

So I borrowed some code from the __format__ method, and here is a patch.
Now classes are not handled specially any more; the distinction is
between old-style instances, and all other objects.

All tests pass, but I may have missed something important...
History
Date User Action Args
2008-06-26 22:09:37amaury.forgeotdarcsetspambayes_score: 0.0473882 -> 0.0473882
recipients: + amaury.forgeotdarc, facundobatista, benjamin.peterson, schuppenies
2008-06-26 22:09:36amaury.forgeotdarcsetspambayes_score: 0.0473882 -> 0.0473882
messageid: <1214518176.81.0.454257762399.issue3122@psf.upfronthosting.co.za>
2008-06-26 22:08:16amaury.forgeotdarclinkissue3122 messages
2008-06-26 22:08:16amaury.forgeotdarccreate