Skip to content

Commit 90ed7c9

Browse files
committed
COMPAT: Adapt to Numpy 2.0 dtype changes
1 parent 15c21a2 commit 90ed7c9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pandas/_libs/src/vendored/numpy/datetime/np_datetime.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,5 +1070,10 @@ void pandas_timedelta_to_timedeltastruct(npy_timedelta td,
10701070
*/
10711071
PyArray_DatetimeMetaData
10721072
get_datetime_metadata_from_dtype(PyArray_Descr *dtype) {
1073+
#if NPY_ABI_VERSION >= 0x02000000
1074+
// we're compiling with numpy > 2.0
1075+
return PyDataType_C_METADATA(dtype)->meta;
1076+
#else
10731077
return (((PyArray_DatetimeDTypeMetaData *)dtype->c_metadata)->meta);
1078+
#endif
10741079
}

0 commit comments

Comments
 (0)