From 5ef198d8cbc5d1a653bd895b54fa762f8d11f817 Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Sat, 21 Sep 2013 21:02:42 -0700 Subject: [PATCH] Get rid of "comparison of unsigned expression < 0 is always false" warning. --- Cython/Utility/TypeConversion.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Cython/Utility/TypeConversion.c b/Cython/Utility/TypeConversion.c index eba0a6a..b627469 100644 --- a/Cython/Utility/TypeConversion.c +++ b/Cython/Utility/TypeConversion.c @@ -455,8 +455,9 @@ static CYTHON_INLINE PyObject* {{TO_PY_FUNCTION}}({{TYPE}} value) { value_type value = func(x); \ if (sizeof(type) < sizeof(value_type)) { \ if (unlikely(value != (value_type) (type) value)) { \ + const value_type zero = 0; \ PyErr_SetString(PyExc_OverflowError, \ - (is_unsigned && unlikely(value < 0)) ? \ + (is_unsigned && unlikely(value < zero)) ? \ "can't convert negative value to " #type : \ "value too large to convert to " #type); \ return (type) -1; \ -- 2.7.4