I am writing a python module in C.
The module needs to be compiled for python version 2.4, 2.5, 2.6 and 2.7.
Now I ran in to the problem that in python 2.5 they defined Py_ssize_t for the size of lists, but in 2.4 they just used int.
So my question is:
Is there an easy way to check if I’m using the API of version 2.4 or 2.5 at compile time so I can write a little macro?
e.g:
#if PY_MINOR < 5
typedef int Py_ssize_t;
#endif
Yes,
patchlevel.hin the Python include dir defines what you are looking for: