From 8f897fa44eb02f86fa8261b13b17416d16f34865 Mon Sep 17 00:00:00 2001 From: Lisandro Dalcin Date: Fri, 6 Feb 2009 17:29:28 -0200 Subject: [PATCH] raise OverflowError when converting negative value to unsigned long long --- Cython/Compiler/PyrexTypes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.26.2