diff --git a/pandas/_libs/tslibs/tzconversion.pyx b/pandas/_libs/tslibs/tzconversion.pyx index 030549f2528ed..575088b8ab2cc 100644 --- a/pandas/_libs/tslibs/tzconversion.pyx +++ b/pandas/_libs/tslibs/tzconversion.pyx @@ -557,30 +557,25 @@ cdef int64_t[:] _tz_convert_dst( ndarray[int64_t] trans int64_t[:] deltas int64_t v - bint tz_is_local - tz_is_local = is_tzlocal(tz) + # tz is assumed _not_ to be tzlocal; that should go + # through _tz_convert_tzlocal_utc - if not tz_is_local: - # get_dst_info cannot extract offsets from tzlocal because its - # dependent on a datetime - trans, deltas, _ = get_dst_info(tz) - if not to_utc: - # We add `offset` below instead of subtracting it - deltas = -1 * np.array(deltas, dtype='i8') + trans, deltas, _ = get_dst_info(tz) + if not to_utc: + # We add `offset` below instead of subtracting it + deltas = -1 * np.array(deltas, dtype='i8') - # Previously, this search was done pointwise to try and benefit - # from getting to skip searches for iNaTs. However, it seems call - # overhead dominates the search time so doing it once in bulk - # is substantially faster (GH#24603) - pos = trans.searchsorted(values, side='right') - 1 + # Previously, this search was done pointwise to try and benefit + # from getting to skip searches for iNaTs. However, it seems call + # overhead dominates the search time so doing it once in bulk + # is substantially faster (GH#24603) + pos = trans.searchsorted(values, side='right') - 1 for i in range(n): v = values[i] if v == NPY_NAT: result[i] = v - elif tz_is_local: - result[i] = _tz_convert_tzlocal_utc(v, tz, to_utc=to_utc) else: if pos[i] < 0: raise ValueError('First time before start of DST info')