File tree 2 files changed +9
-3
lines changed
2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ This file is derived from NumPy 1.7. See NUMPY_LICENSE.txt
20
20
#include <Python.h>
21
21
22
22
#include "datetime.h"
23
+ /* Need to import_array for np_datetime.c (for NumPy 1.x support) */
24
+ #include "numpy/ndarrayobject.h"
23
25
#include "pandas/datetime/pd_datetime.h"
24
26
#include "pandas/portable.h"
25
27
@@ -255,5 +257,6 @@ static struct PyModuleDef pandas_datetimemodule = {
255
257
256
258
PyMODINIT_FUNC PyInit_pandas_datetime (void ) {
257
259
PyDateTime_IMPORT ;
260
+ import_array ();
258
261
return PyModuleDef_Init (& pandas_datetimemodule );
259
262
}
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ This file is derived from NumPy 1.7. See NUMPY_LICENSE.txt
16
16
17
17
// Licence at LICENSES/NUMPY_LICENSE
18
18
19
- #define NO_IMPORT
19
+ #define NO_IMPORT_ARRAY
20
20
21
21
#ifndef NPY_NO_DEPRECATED_API
22
22
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
@@ -25,7 +25,7 @@ This file is derived from NumPy 1.7. See NUMPY_LICENSE.txt
25
25
#include <Python.h>
26
26
27
27
#include "pandas/vendored/numpy/datetime/np_datetime.h"
28
- #include <numpy/ndarraytypes .h>
28
+ #include <numpy/ndarrayobject .h>
29
29
#include <numpy/npy_common.h>
30
30
31
31
#if defined(_WIN32 )
@@ -1070,5 +1070,8 @@ void pandas_timedelta_to_timedeltastruct(npy_timedelta td,
1070
1070
*/
1071
1071
PyArray_DatetimeMetaData
1072
1072
get_datetime_metadata_from_dtype (PyArray_Descr * dtype ) {
1073
- return (((PyArray_DatetimeDTypeMetaData * )dtype -> c_metadata )-> meta );
1073
+ #if NPY_ABI_VERSION < 0x02000000
1074
+ #define PyDataType_C_METADATA (dtype ) ((dtype)->c_metadata)
1075
+ #endif
1076
+ return ((PyArray_DatetimeDTypeMetaData * )PyDataType_C_METADATA (dtype ))-> meta ;
1074
1077
}
You can’t perform that action at this time.
0 commit comments