@@ -589,6 +589,8 @@ def _parsed_string_to_bounds(
589589 return start , end
590590
591591 def _parse_with_reso (self , label : str ) -> tuple [Timestamp , Resolution ]:
592+ parsed , reso = super ()._parse_with_reso (label )
593+
592594 # GH#58302 - Deprecate non-ISO string formats in .loc indexing
593595 if isinstance (label , str ) and not _is_iso_format_string (label ):
594596 msg = (
@@ -598,8 +600,6 @@ def _parse_with_reso(self, label: str) -> tuple[Timestamp, Resolution]:
598600 )
599601 warnings .warn (msg , Pandas4Warning , stacklevel = find_stack_level ())
600602
601- parsed , reso = super ()._parse_with_reso (label )
602-
603603 parsed = Timestamp (parsed )
604604
605605 if self .tz is not None and parsed .tzinfo is None :
@@ -733,6 +733,8 @@ def check_str_or_none(point) -> bool:
733733 mask = np .array (True )
734734 in_index = True
735735 if start is not None :
736+ start_casted = self ._maybe_cast_slice_bound (start , "left" )
737+
736738 # GH#58302 - Deprecate non-ISO string formats in .loc indexing
737739 if isinstance (start , str ) and not _is_iso_format_string (start ):
738740 msg = (
@@ -742,11 +744,12 @@ def check_str_or_none(point) -> bool:
742744 )
743745 warnings .warn (msg , Pandas4Warning , stacklevel = find_stack_level ())
744746
745- start_casted = self ._maybe_cast_slice_bound (start , "left" )
746747 mask = start_casted <= self
747748 in_index &= (start_casted == self ).any ()
748749
749750 if end is not None :
751+ end_casted = self ._maybe_cast_slice_bound (end , "right" )
752+
750753 # GH#58302 - Deprecate non-ISO string formats in .loc indexing
751754 if isinstance (end , str ) and not _is_iso_format_string (end ):
752755 msg = (
@@ -756,7 +759,6 @@ def check_str_or_none(point) -> bool:
756759 )
757760 warnings .warn (msg , Pandas4Warning , stacklevel = find_stack_level ())
758761
759- end_casted = self ._maybe_cast_slice_bound (end , "right" )
760762 mask = (self <= end_casted ) & mask
761763 in_index &= (end_casted == self ).any ()
762764
0 commit comments