Skip to content

Commit f9c9757

Browse files
committed
[compat] numpy 1.x and 2.x compatibility macros try 2
1 parent 46f6060 commit f9c9757

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/decoder.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,10 @@
3030
/* NumPy 1.x/2.x compatibility macros */
3131
/******************************************************************************/
3232

33-
#ifndef PyDataType_ELSIZE
34-
#define PyDataType_ELSIZE(d) ((d)->elsize)
35-
#endif
33+
#include <numpy/npy_common.h>
3634

37-
#ifndef PyDataType_TYPE_NUM
35+
#if NPY_ABI_VERSION < 0x02000000
36+
#define PyDataType_ELSIZE(d) ((d)->elsize)
3837
#define PyDataType_TYPE_NUM(d) ((d)->type_num)
3938
#endif
4039

src/encoder.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,10 @@
3131
/* NumPy 1.x/2.x compatibility macros */
3232
/******************************************************************************/
3333

34-
#ifndef PyDataType_ELSIZE
35-
#define PyDataType_ELSIZE(d) ((d)->elsize)
36-
#endif
34+
#include <numpy/npy_common.h>
3735

38-
#ifndef PyDataType_TYPE_NUM
36+
#if NPY_ABI_VERSION < 0x02000000
37+
#define PyDataType_ELSIZE(d) ((d)->elsize)
3938
#define PyDataType_TYPE_NUM(d) ((d)->type_num)
4039
#endif
4140

0 commit comments

Comments
 (0)