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 Oren Milman
Recipients Oren Milman, mark.dickinson, meador.inge, serhiy.storchaka
Date 2016-09-29.12:48:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
You are right about the terminology of course. My bad.

Anyway, the bug is not related to __index__ (or nb_index), because the three aforementioned functions are using (in case '!PyLong_Check(v)') PyArg_Parse with the formats 'l' or 'L'.
Ultimately, convertsimple (in Python/getargs.c) would call PyLong_AsLong or PyLong_AsLongLong (respectively).
These two (in case '!PyLong_Check(v)') only try to use nb_int, as documented:

But just in case, I ran the following:
    import array
    class LikeInt:
        def __init__(self, intVal):
            self.intVal = intVal
        def __index__(self):
            return self.intVal
and got a 'TypeError: an integer is required (got type LikeInt)'
Date User Action Args
2016-09-29 12:48:44Oren Milmansetrecipients: + Oren Milman, mark.dickinson, meador.inge, serhiy.storchaka
2016-09-29 12:48:44Oren Milmansetmessageid: <>
2016-09-29 12:48:44Oren Milmanlinkissue28298 messages
2016-09-29 12:48:44Oren Milmancreate