@@ -457,11 +457,8 @@ def __contains__(self, key):
457457 try :
458458 self .get_loc (key )
459459 return True
460- except (ValueError , TypeError , KeyError ):
460+ except (TypeError , KeyError ):
461461 # TypeError can be reached if we pass a tuple that is not hashable
462- # ValueError can be reached if pass a 2-tuple and parse_time_string
463- # raises with the wrong number of return values
464- # TODO: the latter is a bug in parse_time_string
465462 return False
466463
467464 @cache_readonly
@@ -608,7 +605,7 @@ def get_value(self, series, key):
608605 try :
609606 return com .maybe_box (self , super ().get_value (s , key ), series , key )
610607 except (KeyError , IndexError ):
611- try :
608+ if isinstance ( key , str ) :
612609 asdt , parsed , reso = parse_time_string (key , self .freq )
613610 grp = resolution .Resolution .get_freq_group (reso )
614611 freqn = resolution .get_freq_group (self .freq )
@@ -634,8 +631,6 @@ def get_value(self, series, key):
634631 )
635632 else :
636633 raise KeyError (key )
637- except TypeError :
638- pass
639634
640635 period = Period (key , self .freq )
641636 key = period .value if isna (period ) else period .ordinal
0 commit comments