From e4996f02d7573cec9033acb65176196a370710c8 Mon Sep 17 00:00:00 2001 From: Hernan Grecco Date: Mon, 4 Mar 2013 23:47:54 -0300 Subject: [PATCH] Fix for Python 3.2 --- llvmpy/include/python3adapt.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/llvmpy/include/python3adapt.h b/llvmpy/include/python3adapt.h index 5b19ebe..a60153f 100644 --- a/llvmpy/include/python3adapt.h +++ b/llvmpy/include/python3adapt.h @@ -9,13 +9,10 @@ #define PyBytes_FromStringAndSize PyString_FromStringAndSize #define PyBytes_FromString PyString_FromString -#endif - -#if (PY_VERSION_HEX >= 0x03000000) +#else #define PyString_Check PyUnicode_Check #define PyString_Size PyUnicode_GET_SIZE -#define PyString_AsString PyUnicode_AsUTF8 #define PyString_FromStringAndSize PyUnicode_FromStringAndSize #define PyString_FromString PyUnicode_FromString @@ -27,6 +24,12 @@ #define PyFile_Check(x) (1) +#if (PY_VERSION_HEX < 0x03030000) +#define PyString_AsString(x) PyBytes_AsString(PyUnicode_AsUTF8String(x)) +#else +#define PyString_AsString PyUnicode_AsUTF8 #endif -#endif //PYTHON3ADAPT_H \ No newline at end of file +#endif // (PY_VERSION_HEX < 0x03000000) + +#endif //PYTHON3ADAPT_H