[issue42665] Should PyLong_AsLongAndOverflow raise exception on overflow?

Ganesh Kathiresan report at bugs.python.org
Fri Dec 18 23:20:07 EST 2020


Ganesh Kathiresan <ganesh3597 at gmail.com> added the comment:

Hi All, thanks for the input. Yeah, the current behavior makes sense, if overflow exception is needed, we can use PyLong_AsLong. I guess my confusion was from the doc: 
> set *overflow to 1 or -1, respectively, and return -1;
> Returns -1 on error. Use PyErr_Occurred() to disambiguate.

It's not particularly clear if overflow is an `error` here, but again a quick compile and run will give you the answer. You can take a call if we have to have an explicit statement saying: no exception raised on overflow

----------

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


More information about the Python-bugs-list mailing list