From: Stefan Behnel Date: Fri, 20 Feb 2009 22:44:21 +0000 (+0100) Subject: Py3 compile fixes X-Git-Tag: 0.11.rc~71^2^2~1 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e09f67fb786376f72788a746fad28541d39ff3cd;p=cython.git Py3 compile fixes --- 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; }