Commit 8f897fa4 authored by Lisandro Dalcin's avatar Lisandro Dalcin

raise OverflowError when converting negative value to unsigned long long

parent f1751da1
...@@ -1426,7 +1426,7 @@ static INLINE unsigned PY_LONG_LONG __pyx_PyInt_AsUnsignedLongLong(PyObject* x) ...@@ -1426,7 +1426,7 @@ static INLINE unsigned PY_LONG_LONG __pyx_PyInt_AsUnsignedLongLong(PyObject* x)
if (PyInt_CheckExact(x)) { if (PyInt_CheckExact(x)) {
long val = PyInt_AS_LONG(x); long val = PyInt_AS_LONG(x);
if (unlikely(val < 0)) { if (unlikely(val < 0)) {
PyErr_SetString(PyExc_TypeError, "Negative assignment to unsigned type."); PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long long");
return (unsigned PY_LONG_LONG)-1; return (unsigned PY_LONG_LONG)-1;
} }
return val; return val;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment