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 mark.dickinson
Recipients mark.dickinson, meador.inge
Date 2010-04-04.08:34:31
SpamBayes Score 1.2512917e-06
Marked as misclassified No
Message-id <>
Probably both those conditions can't be satisfied;  I'm wasn't sure what happened if something's __index__ method returned something other than an int or long.

But now I bother to look at the source (in Objects/abstract.c) I see that there *is* already an explicit check for the result of nb_index being int or long (with TypeError being raised if the result isn't one of those).  Mea culpa.  I'll remove those lines (though I may leave an assert, just to be on the safe side).

The 2.x behaviour isn't ideal:  I'd prefer to just stop if the __index__ method is present and raises TypeError, rather than going on to check __int__ in that case.  But that presents problems with old-style classes, where PyIndex_Check is true even when no __index__ method is explicitly defined.

Thanks for the extra tests!
Date User Action Args
2010-04-04 08:34:34mark.dickinsonsetrecipients: + mark.dickinson, meador.inge
2010-04-04 08:34:34mark.dickinsonsetmessageid: <>
2010-04-04 08:34:32mark.dickinsonlinkissue8300 messages
2010-04-04 08:34:31mark.dickinsoncreate