From 990ea054a38c672e28cc223240ed1929fb1458d2 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Tue, 6 Nov 2012 20:26:42 +0100 Subject: [PATCH] PyPy compile fix for PyLong conversion --HG-- extra : transplant_source : %B2%2Cy%7D%FD%EBA%B6t%E7%99%FE%8D%B0f%9BN%98%C7%0C --- Cython/Compiler/PyrexTypes.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Cython/Compiler/PyrexTypes.py b/Cython/Compiler/PyrexTypes.py index 2b70b16..a3f5c25 100755 --- a/Cython/Compiler/PyrexTypes.py +++ b/Cython/Compiler/PyrexTypes.py @@ -1396,6 +1396,10 @@ static CYTHON_INLINE %(type)s __Pyx_PyInt_from_py_%(TypeName)s(PyObject* x) { else return (%(type)s)__Pyx_PyInt_AsSignedLongLong(x); } else { + #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); + #else %(type)s val; PyObject *v = __Pyx_PyNumber_Int(x); #if PY_VERSION_HEX < 0x03000000 @@ -1415,6 +1419,7 @@ static CYTHON_INLINE %(type)s __Pyx_PyInt_from_py_%(TypeName)s(PyObject* x) { if (likely(!ret)) return val; } + #endif return (%(type)s)-1; } } -- 2.7.4