File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
Expand file tree Collapse file tree 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
2020#include <Python.h>
2121
2222#include "datetime.h"
23+ /* Need to import_array for np_datetime.c (for NumPy 1.x support) */
24+ #include "numpy/ndarrayobject.h"
2325#include "pandas/datetime/pd_datetime.h"
2426#include "pandas/portable.h"
2527
@@ -255,5 +257,6 @@ static struct PyModuleDef pandas_datetimemodule = {
255257
256258PyMODINIT_FUNC PyInit_pandas_datetime (void ) {
257259 PyDateTime_IMPORT ;
260+ import_array ();
258261 return PyModuleDef_Init (& pandas_datetimemodule );
259262}
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
1616
1717// Licence at LICENSES/NUMPY_LICENSE
1818
19- #define NO_IMPORT
19+ #define NO_IMPORT_ARRAY
2020
2121#ifndef NPY_NO_DEPRECATED_API
2222#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
2525#include <Python.h>
2626
2727#include "pandas/vendored/numpy/datetime/np_datetime.h"
28- #include <numpy/ndarraytypes .h>
28+ #include <numpy/ndarrayobject .h>
2929#include <numpy/npy_common.h>
3030
3131#if defined(_WIN32 )
@@ -1070,5 +1070,8 @@ void pandas_timedelta_to_timedeltastruct(npy_timedelta td,
10701070 */
10711071PyArray_DatetimeMetaData
10721072get_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 ;
10741077}
You can’t perform that action at this time.
0 commit comments