[issue29834] Raise ValueError rather of OverflowError in PyLong_AsUnsignedLong()

Oren Milman report at bugs.python.org
Fri Mar 17 05:46:30 EDT 2017


Oren Milman added the comment:

note that there are functions that rely on the fact that
PyLong_AsUnsignedLong currently raises OverflowError for both cases.

such functions would probably use
PyErr_ExceptionMatches(PyExc_OverflowError)
or something like
PyErr_GivenExceptionMatches(err, PyExc_OverflowError)

_Py_Uid_Converter() (in Modules/posixmodule.c) is an example, but
ISTM there aren't many such functions.

however, this is only in cpython's C code. I don't know how many
functions in cpython's python code rely on this.

also, maybe there is a lot of user code that rely on this?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29834>
_______________________________________


More information about the Python-bugs-list mailing list