Adjust macros and typedefs for Numpy C API
- Define
Py_LIMITED_API
andNPY_TARGET_VERSION
macros in setup.py rather than in the C source code. - Don't define Numpy's
struct _typeobject
if we are building for PyPy because PyPy doesn't implement Python's limited C API (see https://github.com/liberfa/pyerfa/pull/120). - Define
struct _typeobject
workaround after including Python.h, not before, because on PyPy, Python.h defines the macros that we depend on to detect whether we are building under PyPy. - Use
NPY_TARGET_VERSION
for builds that are backwards-compatible with old versions of Numpy. - Build with any version of Numpy >=1.25 and <2 (see https://github.com/liberfa/pyerfa/pull/121).
Edited by Leo P. Singer