Commit ebb29b0e authored by Stefan Behnel's avatar Stefan Behnel

minor code cleanups

parent 1f07ff33
...@@ -560,13 +560,13 @@ static CYTHON_INLINE {{TYPE}} {{FROM_PY_FUNCTION}}(PyObject *x) { ...@@ -560,13 +560,13 @@ static CYTHON_INLINE {{TYPE}} {{FROM_PY_FUNCTION}}(PyObject *x) {
if (unlikely(Py_SIZE(x) < 0)) { if (unlikely(Py_SIZE(x) < 0)) {
goto raise_neg_overflow; goto raise_neg_overflow;
} }
#endif #elif CYTHON_COMPILING_IN_PYPY
#if CYTHON_COMPILING_IN_PYPY
{ {
int result = PyObject_RichCompareBool(x, Py_False, Py_LT); // misuse Py_False as a quick way to compare to a '0' int object in PyPy
if (unlikely(result < 0)) int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
return -1; if (unlikely(result < 0))
if (unlikely(result == 1)) return ({{TYPE}}) -1;
if (unlikely(result == 1))
goto raise_neg_overflow; goto raise_neg_overflow;
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment