Skip to content

Commit

Permalink
creso_changed->creso_ever_changed
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrockmendel committed Nov 1, 2023
1 parent c8829f4 commit 926ab65
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pandas/_libs/tslibs/strptime.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ cdef class DatetimeParseState:
cdef:
bint found_tz
bint found_naive
bint creso_changed
bint creso_ever_changed
NPY_DATETIMEUNIT creso

cdef tzinfo process_datetime(self, datetime dt, tzinfo tz, bint utc_convert)
Expand Down
6 changes: 3 additions & 3 deletions pandas/_libs/tslibs/strptime.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,15 @@ cdef class DatetimeParseState:
self.found_tz = False
self.found_naive = False
self.creso = creso
self.creso_changed = False
self.creso_ever_changed = False

cdef bint update_creso(self, NPY_DATETIMEUNIT item_reso) noexcept:
# Return a bool indicating whether we bumped to a higher resolution
if self.creso == NPY_DATETIMEUNIT.NPY_FR_GENERIC:
self.creso = item_reso
elif item_reso > self.creso:
self.creso = item_reso
self.creso_changed = True
self.creso_ever_changed = True
return True
return False

Expand Down Expand Up @@ -446,7 +446,7 @@ def array_strptime(
return values, []

if infer_reso:
if state.creso_changed:
if state.creso_ever_changed:
# We encountered mismatched resolutions, need to re-parse with
# the correct one.
return array_strptime(
Expand Down

0 comments on commit 926ab65

Please sign in to comment.