From 898174f22ed61b3a1929db2e6ec07ed4d329819d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Robert?= Date: Thu, 11 Apr 2024 16:03:59 +0200 Subject: [PATCH] BLD: reintroduce compatibility shim for compiling against numpy 1.x --- erfa/ufunc.c.templ | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/erfa/ufunc.c.templ b/erfa/ufunc.c.templ index b9d5e2f..ba2fc2b 100644 --- a/erfa/ufunc.c.templ +++ b/erfa/ufunc.c.templ @@ -17,6 +17,11 @@ #include "erfa.h" #include "erfaextra.h" +// Backported NumPy 2 API (can be removed if numpy 2 is required) +#if NPY_ABI_VERSION < 0x02000000 +#define PyDataType_ELSIZE(descr) ((descr)->elsize) +#endif + // On gcc<10 we can run into the following: // // error: dereferencing pointer to incomplete type 'PyTypeObject'