Serhiy Storchaka added the comment:

The code restored by 29159-index-fallback.patch is slightly different from the 
code before issue27704, but the patch LGTM except that arguments of assertEqual 
are in reversed order.

> Can you explain what your patch does?  I don't understand why you single out 
> the OverflowError.  When is __index__ expected to raise it?

PyNumber_AsSsize_t(arg, PyExc_OverflowError) raises an OverflowError when the 
result of __index__ don't fit in Py_ssize_t.

> I wonder if we could check for buffer protocol support before detecting an 
> integer argument?

This would fix an issue with NumPy arrays, but it is much harder to implement.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29159>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to