@@ -27,10 +27,6 @@ This file is derived from NumPy 1.7. See NUMPY_LICENSE.txt
27
27
#include <numpy/ndarraytypes.h>
28
28
#include "np_datetime.h"
29
29
30
- #if PY_MAJOR_VERSION >= 3
31
- #define PyInt_AsLong PyLong_AsLong
32
- #endif // PyInt_AsLong
33
-
34
30
const npy_datetimestruct _NS_MIN_DTS = {
35
31
1677 , 9 , 21 , 0 , 12 , 43 , 145224 , 193000 , 0 };
36
32
const npy_datetimestruct _NS_MAX_DTS = {
@@ -330,9 +326,9 @@ int convert_pydatetime_to_datetimestruct(PyObject *dtobj,
330
326
out -> month = 1 ;
331
327
out -> day = 1 ;
332
328
333
- out -> year = PyInt_AsLong (PyObject_GetAttrString (obj , "year" ));
334
- out -> month = PyInt_AsLong (PyObject_GetAttrString (obj , "month" ));
335
- out -> day = PyInt_AsLong (PyObject_GetAttrString (obj , "day" ));
329
+ out -> year = PyLong_AsLong (PyObject_GetAttrString (obj , "year" ));
330
+ out -> month = PyLong_AsLong (PyObject_GetAttrString (obj , "month" ));
331
+ out -> day = PyLong_AsLong (PyObject_GetAttrString (obj , "day" ));
336
332
337
333
// TODO(anyone): If we can get PyDateTime_IMPORT to work, we could use
338
334
// PyDateTime_Check here, and less verbose attribute lookups.
@@ -345,10 +341,10 @@ int convert_pydatetime_to_datetimestruct(PyObject *dtobj,
345
341
return 0 ;
346
342
}
347
343
348
- out -> hour = PyInt_AsLong (PyObject_GetAttrString (obj , "hour" ));
349
- out -> min = PyInt_AsLong (PyObject_GetAttrString (obj , "minute" ));
350
- out -> sec = PyInt_AsLong (PyObject_GetAttrString (obj , "second" ));
351
- out -> us = PyInt_AsLong (PyObject_GetAttrString (obj , "microsecond" ));
344
+ out -> hour = PyLong_AsLong (PyObject_GetAttrString (obj , "hour" ));
345
+ out -> min = PyLong_AsLong (PyObject_GetAttrString (obj , "minute" ));
346
+ out -> sec = PyLong_AsLong (PyObject_GetAttrString (obj , "second" ));
347
+ out -> us = PyLong_AsLong (PyObject_GetAttrString (obj , "microsecond" ));
352
348
353
349
/* Apply the time zone offset if datetime obj is tz-aware */
354
350
if (PyObject_HasAttrString ((PyObject * )obj , "tzinfo" )) {
@@ -384,7 +380,7 @@ int convert_pydatetime_to_datetimestruct(PyObject *dtobj,
384
380
Py_DECREF (tmp );
385
381
return -1 ;
386
382
}
387
- seconds_offset = PyInt_AsLong (tmp_int );
383
+ seconds_offset = PyLong_AsLong (tmp_int );
388
384
if (seconds_offset == -1 && PyErr_Occurred ()) {
389
385
Py_DECREF (tmp_int );
390
386
Py_DECREF (tmp );
0 commit comments