Skip to content

Commit 2f2876b

Browse files
jbrockmendeljreback
authored andcommitted
change types to Py_ssize_t to fix #21905 (#21923)
1 parent 272bbdc commit 2f2876b

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

pandas/_libs/tslibs/conversion.pyx

+3-3
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ cdef inline void localize_tso(_TSObject obj, tzinfo tz):
527527
cdef:
528528
ndarray[int64_t] trans, deltas
529529
int64_t delta, local_val
530-
Py_ssize_t posn
530+
Py_ssize_t pos
531531

532532
assert obj.tzinfo is None
533533

@@ -782,7 +782,6 @@ def tz_convert(ndarray[int64_t] vals, object tz1, object tz2):
782782
cdef:
783783
ndarray[int64_t] utc_dates, tt, result, trans, deltas
784784
Py_ssize_t i, j, pos, n = len(vals)
785-
ndarray[Py_ssize_t] posn
786785
int64_t v, offset, delta
787786
npy_datetimestruct dts
788787

@@ -1124,7 +1123,8 @@ cdef ndarray[int64_t] _normalize_local(ndarray[int64_t] stamps, object tz):
11241123
cdef:
11251124
Py_ssize_t n = len(stamps)
11261125
ndarray[int64_t] result = np.empty(n, dtype=np.int64)
1127-
ndarray[int64_t] trans, deltas, pos
1126+
ndarray[int64_t] trans, deltas
1127+
Py_ssize_t[:] pos
11281128
npy_datetimestruct dts
11291129

11301130
if is_utc(tz):

pandas/_libs/tslibs/period.pyx

+2-1
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,8 @@ cdef ndarray[int64_t] localize_dt64arr_to_period(ndarray[int64_t] stamps,
934934
cdef:
935935
Py_ssize_t n = len(stamps)
936936
ndarray[int64_t] result = np.empty(n, dtype=np.int64)
937-
ndarray[int64_t] trans, deltas, pos
937+
ndarray[int64_t] trans, deltas
938+
Py_ssize_t[:] pos
938939
npy_datetimestruct dts
939940
int64_t local_val
940941

pandas/_libs/tslibs/resolution.pyx

+2-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ cdef _reso_local(ndarray[int64_t] stamps, object tz):
7474
cdef:
7575
Py_ssize_t n = len(stamps)
7676
int reso = RESO_DAY, curr_reso
77-
ndarray[int64_t] trans, deltas, pos
77+
ndarray[int64_t] trans, deltas
78+
Py_ssize_t[:] pos
7879
npy_datetimestruct dts
7980
int64_t local_val
8081

0 commit comments

Comments
 (0)