[pypy-dev] A very easy bug for newcomers

Maciej Fijalkowski fijall at gmail.com
Wed Jun 20 12:38:41 CEST 2012


On Tue, Jun 19, 2012 at 9:18 PM, Костя Лопухин <kostia.lopuhin at gmail.com>wrote:

> 2012/6/19 Amaury Forgeot d'Arc <amauryfa at gmail.com>:
> >
> > Actually I think I found the cause:
> > bool.__format__ will correctly call format__Int_ANY(),
> > but the object is coerced into a int!
> >
> > Adding a format__Bool_ANY fixes the problem (with the same
> implementation)1
> > but shouldn't we have W_BoolObject inherit from W_IntObject,
> > and remove delegate_Bool2IntObject?
> >
>
> I tried inheriting W_BoolObject from W_IntObject, removing
> delegate_Bool2IntObject and removing format__Bool_ANY - but then there
> is no format implementation for bool. And as I read in multimethod.py,
> it does not really interact with subclassing, so inheriting from
> W_IntObject will gain nothing here?
> Is it better to submit an easy fix first
> https://bitbucket.org/kostialopuhin/pypy-fix1180/compare/..pypy/pypy ?
> I just don't see what are the benefits of inhering from W_IntObject,
> cause I know too little yet)
> _______________________________________________
> pypy-dev mailing list
> pypy-dev at python.org
> http://mail.python.org/mailman/listinfo/pypy-dev
>

bool inherits frmo int, just not W_BoolObject from W_IntObject. We should
and we should remove multimethods alltogether (they're a mess), but it's
quite a bit of effort.

Cheers,
fijal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20120620/0e8548e4/attachment.html>


More information about the pypy-dev mailing list