From e6c7a826d9617bafb24ac05e05cd8e1e7ad1f9cc Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Sat, 8 Jan 2011 17:00:18 +0100 Subject: Fix compile for Python >= 3.0. Python docs tells us more about string functions: "These functions have been renamed to PyBytes_* in Python 3.x. Unless otherwise noted, the PyBytes functions available in 3.x are aliased to their PyString_* equivalents to help porting." (http://docs.python.org/c-api/string.html) Use #defines to map the new names and fix the compile for Python >= 3.0. Thanks Olivier Fauchon for the patch. --- decode.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/decode.c b/decode.c index 1b12c9e..a745873 100644 --- a/decode.c +++ b/decode.c @@ -22,6 +22,13 @@ #include #include +/* Re-define some string functions for Python >= 3.0. */ +#if PY_VERSION_HEX >= 0x03000000 +#define PyString_AsString PyBytes_AsString +#define PyString_FromString PyBytes_FromString +#define PyString_Check PyBytes_Check +#endif + /** * Initialize libsigrokdecode. * -- cgit v1.2.3-70-g09d2