From e09f67fb786376f72788a746fad28541d39ff3cd Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Fri, 20 Feb 2009 23:44:21 +0100 Subject: [PATCH] Py3 compile fixes --- Cython/Compiler/PyrexTypes.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Cython/Compiler/PyrexTypes.py b/Cython/Compiler/PyrexTypes.py index c118e15e..abb3d18c 100644 --- a/Cython/Compiler/PyrexTypes.py +++ b/Cython/Compiler/PyrexTypes.py @@ -1492,8 +1492,13 @@ static INLINE PY_LONG_LONG __pyx_PyInt_AsLongLong(PyObject* x) { } else { PY_LONG_LONG val; - PyObject* tmp = PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; +#if PY_VERSION_HEX < 0x03000000 + PyObject* tmp = PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; val = __pyx_PyInt_AsLongLong(tmp); +#else + PyObject* tmp = PyNumber_Long(x); if (!tmp) return (PY_LONG_LONG)-1; + val = PyLong_AsLongLong(tmp); +#endif Py_DECREF(tmp); return val; } @@ -1516,8 +1521,13 @@ static INLINE unsigned PY_LONG_LONG __pyx_PyInt_AsUnsignedLongLong(PyObject* x) } else { unsigned PY_LONG_LONG val; - PyObject* tmp = PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; +#if PY_VERSION_HEX < 0x03000000 + PyObject* tmp = PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; val = __pyx_PyInt_AsUnsignedLongLong(tmp); +#else + PyObject* tmp = PyNumber_Long(x); if (!tmp) return (PY_LONG_LONG)-1; + val = PyLong_AsUnsignedLongLong(tmp); +#endif Py_DECREF(tmp); return val; } -- 2.26.2