How to check the version of the python API at compile time from a C extension module?
Yes, patchlevel.h
in the Python include dir defines what you are looking for:
#define PY_MAJOR_VERSION 2
#define PY_MINOR_VERSION 5
#define PY_MICRO_VERSION 2
I think what you need is PY_VERSION_HEX
there is one line in c code generated by cython
PY_VERSION_HEX < 0x02040000
#ifndef Py_PYTHON_H
#error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02040000
#error Cython requires Python 2.4+.
#else