File tree 2 files changed +12
-4
lines changed
2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,9 @@ 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 only) */
24
+ #define PY_ARRAY_UNIQUE_SYMBOL PANDAS_DATETIME_NUMPY
25
+ #include "numpy/ndarrayobject.h"
23
26
#include "pandas/datetime/pd_datetime.h"
24
27
#include "pandas/portable.h"
25
28
@@ -255,5 +258,6 @@ static struct PyModuleDef pandas_datetimemodule = {
255
258
256
259
PyMODINIT_FUNC PyInit_pandas_datetime (void ) {
257
260
PyDateTime_IMPORT ;
261
+ import_array ();
258
262
return PyModuleDef_Init (& pandas_datetimemodule );
259
263
}
Original file line number Diff line number Diff line change @@ -16,16 +16,17 @@ 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
20
-
21
19
#ifndef NPY_NO_DEPRECATED_API
22
20
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
23
21
#endif // NPY_NO_DEPRECATED_API
24
22
25
23
#include <Python.h>
26
24
27
25
#include "pandas/vendored/numpy/datetime/np_datetime.h"
28
- #include <numpy/ndarraytypes.h>
26
+
27
+ #define NO_IMPORT_ARRAY
28
+ #define PY_ARRAY_UNIQUE_SYMBOL PANDAS_DATETIME_NUMPY
29
+ #include <numpy/ndarrayobject.h>
29
30
#include <numpy/npy_common.h>
30
31
31
32
#if defined(_WIN32 )
@@ -1070,5 +1071,8 @@ void pandas_timedelta_to_timedeltastruct(npy_timedelta td,
1070
1071
*/
1071
1072
PyArray_DatetimeMetaData
1072
1073
get_datetime_metadata_from_dtype (PyArray_Descr * dtype ) {
1073
- return (((PyArray_DatetimeDTypeMetaData * )dtype -> c_metadata )-> meta );
1074
+ #if NPY_ABI_VERSION < 0x02000000
1075
+ #define PyDataType_C_METADATA (dtype ) ((dtype)->c_metadata)
1076
+ #endif
1077
+ return ((PyArray_DatetimeDTypeMetaData * )PyDataType_C_METADATA (dtype ))-> meta ;
1074
1078
}
You can’t perform that action at this time.
0 commit comments