From: Lisandro Dalcin Date: Fri, 6 Feb 2009 19:29:28 +0000 (-0200) Subject: raise OverflowError when converting negative value to unsigned long long X-Git-Tag: 0.11.rc~93^2~1 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8f897fa44eb02f86fa8261b13b17416d16f34865;p=cython.git raise OverflowError when converting negative value to unsigned long long --- diff --git a/Cython/Compiler/PyrexTypes.py b/Cython/Compiler/PyrexTypes.py index aa48d03a..145efec4 100644 --- a/Cython/Compiler/PyrexTypes.py +++ b/Cython/Compiler/PyrexTypes.py @@ -1426,7 +1426,7 @@ static INLINE unsigned PY_LONG_LONG __pyx_PyInt_AsUnsignedLongLong(PyObject* x) if (PyInt_CheckExact(x)) { long val = PyInt_AS_LONG(x); 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 val;