Skip to content

Commit b5832bf

Browse files
authored
CLN: unreachable branch in tzconversion (#34505)
1 parent 756af13 commit b5832bf

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

pandas/_libs/tslibs/tzconversion.pyx

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -557,30 +557,25 @@ cdef int64_t[:] _tz_convert_dst(
557557
ndarray[int64_t] trans
558558
int64_t[:] deltas
559559
int64_t v
560-
bint tz_is_local
561560

562-
tz_is_local = is_tzlocal(tz)
561+
# tz is assumed _not_ to be tzlocal; that should go
562+
# through _tz_convert_tzlocal_utc
563563

564-
if not tz_is_local:
565-
# get_dst_info cannot extract offsets from tzlocal because its
566-
# dependent on a datetime
567-
trans, deltas, _ = get_dst_info(tz)
568-
if not to_utc:
569-
# We add `offset` below instead of subtracting it
570-
deltas = -1 * np.array(deltas, dtype='i8')
564+
trans, deltas, _ = get_dst_info(tz)
565+
if not to_utc:
566+
# We add `offset` below instead of subtracting it
567+
deltas = -1 * np.array(deltas, dtype='i8')
571568

572-
# Previously, this search was done pointwise to try and benefit
573-
# from getting to skip searches for iNaTs. However, it seems call
574-
# overhead dominates the search time so doing it once in bulk
575-
# is substantially faster (GH#24603)
576-
pos = trans.searchsorted(values, side='right') - 1
569+
# Previously, this search was done pointwise to try and benefit
570+
# from getting to skip searches for iNaTs. However, it seems call
571+
# overhead dominates the search time so doing it once in bulk
572+
# is substantially faster (GH#24603)
573+
pos = trans.searchsorted(values, side='right') - 1
577574

578575
for i in range(n):
579576
v = values[i]
580577
if v == NPY_NAT:
581578
result[i] = v
582-
elif tz_is_local:
583-
result[i] = _tz_convert_tzlocal_utc(v, tz, to_utc=to_utc)
584579
else:
585580
if pos[i] < 0:
586581
raise ValueError('First time before start of DST info')

0 commit comments

Comments
 (0)