[docs] [issue17576] PyNumber_Index() is not int-subclass friendly (or operator.index() docos lie)

Serhiy Storchaka report at bugs.python.org
Sun Jun 2 07:11:49 EDT 2019


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

I am not sure that raising an error is the best option. We can just convert an integer subclass to an exact int using _PyLong_Copy().

I am not sure that converting to an exact int in low-level C API functions is the best option. In many cases we use only the content of the resulting object ignoring its type (when convert it to the C integer or float, to bytes array, to new instance of int subclass). Creating a new exact int is a waste of time.

This is why I withdrawn my patches and this issue is still open.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue17576>
_______________________________________


More information about the docs mailing list