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

Serhiy Storchaka report at bugs.python.org
Wed Jun 5 03:39:45 EDT 2019


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

Mark, I think you can reopen the PR and merge it in 3.9 now.

As for my proposition to use the FutureWarning first, I think it is not necessary. The behavior change is very subtle and will affects only int subclasses with overridden __index__. Similar changes (preferring __index__ over __int__) have been made in 3.8 without preceding FutureWarning. And similar minor changes were made in the past.

On other hand, I am not sure that __index__ should be used for int subclasses. We already have the int content, so we can create an exact int with _PyLong_Copy().

----------

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


More information about the docs mailing list