raise OverflowError when converting negative value to unsigned long long
authorLisandro Dalcin <dalcinl@gmail.com>
Fri, 6 Feb 2009 19:29:28 +0000 (17:29 -0200)
committerLisandro Dalcin <dalcinl@gmail.com>
Fri, 6 Feb 2009 19:29:28 +0000 (17:29 -0200)
Cython/Compiler/PyrexTypes.py

index aa48d03a3253350051f591640931ebf8c370c1c9..145efec4c972e3b777dec85aff975192b8468930 100644 (file)
@@ -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;