@@ -25,10 +25,6 @@ from cpython cimport (
25
25
)
26
26
27
27
28
- cdef extern from " headers/stdint.h" :
29
- enum : INT64_MAX
30
- enum : INT64_MIN
31
-
32
28
# Cython < 0.17 doesn't have this in cpython
33
29
cdef extern from " Python.h" :
34
30
cdef PyTypeObject * Py_TYPE(object )
@@ -42,7 +38,7 @@ from datetime cimport cmp_pandas_datetimestruct
42
38
from libc.stdlib cimport free
43
39
44
40
from util cimport (is_integer_object, is_float_object, is_datetime64_object,
45
- is_timedelta64_object)
41
+ is_timedelta64_object, INT64_MAX )
46
42
cimport util
47
43
48
44
from datetime cimport *
@@ -909,9 +905,12 @@ cpdef object get_value_box(ndarray arr, object loc):
909
905
910
906
911
907
# Add the min and max fields at the class level
912
- # INT64_MIN is reserved for NaT
913
- cdef int64_t _NS_LOWER_BOUND = INT64_MIN + 1
914
908
cdef int64_t _NS_UPPER_BOUND = INT64_MAX
909
+ # smallest value we could actually represent is
910
+ # INT64_MIN + 1 == -9223372036854775807
911
+ # but to allow overflow free conversion with a microsecond resolution
912
+ # use the smallest value with a 0 nanosecond unit
913
+ cdef int64_t _NS_LOWER_BOUND = - 9223285636854775000L L
915
914
916
915
cdef pandas_datetimestruct _NS_MIN_DTS, _NS_MAX_DTS
917
916
pandas_datetime_to_datetimestruct(_NS_LOWER_BOUND, PANDAS_FR_ns, & _NS_MIN_DTS)
0 commit comments