[issue29159] Regression in bytes constructor
Serhiy Storchaka
report at bugs.python.org
Thu Jan 5 17:04:54 EST 2017
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 <report at bugs.python.org>
<http://bugs.python.org/issue29159>
_______________________________________
More information about the Python-bugs-list
mailing list