File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
Expand file tree Collapse file tree 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
2020#include <Python.h>
2121
2222#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"
2326#include "pandas/datetime/pd_datetime.h"
2427#include "pandas/portable.h"
2528
@@ -255,5 +258,6 @@ static struct PyModuleDef pandas_datetimemodule = {
255258
256259PyMODINIT_FUNC PyInit_pandas_datetime (void ) {
257260 PyDateTime_IMPORT ;
261+ import_array ();
258262 return PyModuleDef_Init (& pandas_datetimemodule );
259263}
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
1616
1717// Licence at LICENSES/NUMPY_LICENSE
1818
19- #define NO_IMPORT
20-
2119#ifndef NPY_NO_DEPRECATED_API
2220#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
2321#endif // NPY_NO_DEPRECATED_API
2422
2523#include <Python.h>
2624
2725#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>
2930#include <numpy/npy_common.h>
3031
3132#if defined(_WIN32 )
@@ -1070,5 +1071,8 @@ void pandas_timedelta_to_timedeltastruct(npy_timedelta td,
10701071 */
10711072PyArray_DatetimeMetaData
10721073get_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 ;
10741078}
You can’t perform that action at this time.
0 commit comments