44#![ allow( non_camel_case_types) ]
55
66use libc:: FILE ;
7+ use pyo3:: ffi:: vectorcallfunc;
78use pyo3:: ffi:: * ;
89use std:: os:: raw:: * ;
910
@@ -21,6 +22,12 @@ pub struct PyArrayObject {
2122 pub descr : * mut PyArray_Descr ,
2223 pub flags : c_int ,
2324 pub weakreflist : * mut PyObject ,
25+
26+ #[ cfg( Numpy_1_20 ) ]
27+ pub _buffer_info : * mut c_void ,
28+
29+ #[ cfg( Numpy_1_22 ) ]
30+ pub mem_handler : * mut PyObject ,
2431}
2532
2633#[ repr( C ) ]
@@ -32,6 +39,19 @@ pub struct PyArray_Descr {
3239 pub byteorder : c_char ,
3340 pub _former_flags : c_char ,
3441 pub type_num : c_int ,
42+
43+ #[ cfg( Numpy_2_0 ) ]
44+ pub flags : npy_uint64 ,
45+ #[ cfg( Numpy_2_0 ) ]
46+ pub elsize : npy_intp ,
47+ #[ cfg( Numpy_2_0 ) ]
48+ pub alignment : npy_intp ,
49+ #[ cfg( Numpy_2_0 ) ]
50+ pub metadata : * mut PyObject ,
51+ #[ cfg( Numpy_2_0 ) ]
52+ pub hash : npy_hash_t ,
53+ #[ cfg( Numpy_2_0 ) ]
54+ pub reserved_null : [ * mut c_void ; 2 ] ,
3555}
3656
3757#[ repr( C ) ]
@@ -365,11 +385,31 @@ pub struct PyUFuncObject {
365385 pub core_offsets : * mut c_int ,
366386 pub core_signature : * mut c_char ,
367387 pub type_resolver : PyUFunc_TypeResolutionFunc ,
368- pub legacy_inner_loop_selector : PyUFunc_LegacyInnerLoopSelectionFunc ,
369- pub reserved2 : * mut c_void ,
370- pub masked_inner_loop_selector : PyUFunc_MaskedInnerLoopSelectionFunc ,
388+ pub dict : * mut PyObject ,
389+
390+ #[ cfg( all( Py_3_8 , not( Py_LIMITED_API ) ) ) ]
391+ pub vectorcall : Option < vectorcallfunc > ,
392+ #[ cfg( any( not( Py_3_8 ) , Py_LIMITED_API ) ) ]
393+ pub vectorcall : * mut c_void ,
394+
395+ pub reserved3 : * mut c_void ,
371396 pub op_flags : * mut npy_uint32 ,
372397 pub iter_flags : npy_uint32 ,
398+
399+ #[ cfg( Numpy_1_16 ) ]
400+ pub core_dim_sizes : * mut npy_intp ,
401+ #[ cfg( Numpy_1_16 ) ]
402+ pub core_dim_flags : * mut npy_uint32 ,
403+ #[ cfg( Numpy_1_16 ) ]
404+ pub identity_value : * mut PyObject ,
405+
406+ #[ cfg( Numpy_1_22 ) ]
407+ pub _dispatch_cache : * mut c_void ,
408+ #[ cfg( Numpy_1_22 ) ]
409+ pub _loops : * mut PyObject ,
410+
411+ #[ cfg( Numpy_2_1 ) ]
412+ pub process_core_dims_func : PyUFunc_ProcessCoreDimsFunc ,
373413}
374414
375415pub type PyUFuncGenericFunction =
@@ -415,6 +455,9 @@ pub type PyUFunc_MaskedInnerLoopSelectionFunc = Option<
415455 ) -> c_int ,
416456> ;
417457
458+ pub type PyUFunc_ProcessCoreDimsFunc =
459+ Option < unsafe extern "C" fn ( * mut PyUFuncObject , * mut npy_intp ) -> c_int > ;
460+
418461#[ repr( C ) ]
419462#[ derive( Debug , Copy , Clone ) ]
420463pub struct NpyIter ( [ u8 ; 0 ] ) ;
0 commit comments