Get rid of "comparison of unsigned expression < 0 is always false" warning.
authorRobert Bradshaw <robertwb@gmail.com>
Sun, 22 Sep 2013 04:02:42 +0000 (21:02 -0700)
committerRobert Bradshaw <robertwb@gmail.com>
Sun, 22 Sep 2013 04:02:42 +0000 (21:02 -0700)
Cython/Utility/TypeConversion.c

index eba0a6a..b627469 100644 (file)
@@ -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;                                   \