File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 43
43
* and `PyArray_MultiIter_DIMS`.
44
44
*/
45
45
46
+ #define WORKAROUND_NEEDED (defined(NPY_2_0_API_VERSION) && (NPY_API_VERSION >= NPY_2_0_API_VERSION))
47
+
48
+ #if !WORKAROUND_NEEDED
46
49
typedef struct {
47
50
PyObject_HEAD
48
51
int numiter ;
@@ -52,27 +55,28 @@ typedef struct {
52
55
npy_intp dimensions [32 ];
53
56
void * * iters ;
54
57
} multi_iter_proxy_st ;
58
+ #endif
55
59
56
60
npy_intp workaround_PyArray_MultiIter_SIZE (PyArrayMultiIterObject * multi ) {
57
- #if defined( NPY_2_0_API_VERSION ) && ( NPY_API_VERSION >= NPY_2_0_API_VERSION )
61
+ #if WORKAROUND_NEEDED
58
62
return PyArray_MultiIter_SIZE (multi );
59
63
#else
60
64
return ((multi_iter_proxy_st * )(multi ))-> size ;
61
65
#endif
62
66
}
63
67
64
68
int workaround_PyArray_MultiIter_NDIM (PyArrayMultiIterObject * multi ) {
65
- #if defined( NPY_2_0_API_VERSION ) && ( NPY_API_VERSION >= NPY_2_0_API_VERSION )
69
+ #if WORKAROUND_NEEDED
66
70
return PyArray_MultiIter_NDIM (multi );
67
71
#else
68
72
return ((multi_iter_proxy_st * )(multi ))-> nd ;
69
73
#endif
70
74
}
71
75
72
76
npy_intp * workaround_PyArray_MultiIter_DIMS (PyArrayMultiIterObject * multi ) {
73
- #if defined( NPY_2_0_API_VERSION ) && ( NPY_API_VERSION >= NPY_2_0_API_VERSION )
77
+ #if WORKAROUND_NEEDED
74
78
return PyArray_MultiIter_DIMS (multi );
75
79
#else
76
80
return (((multi_iter_proxy_st * )(multi ))-> dimensions );
77
81
#endif
78
- }
82
+ }
You can’t perform that action at this time.
0 commit comments