# Buggy code
def get_loc(self, key, method=None, tolerance=None):
    """
    Get integer location for requested label.

    Parameters
    ----------
    key : Period, NaT, str, or datetime
        String or datetime key must be parsable as Period.

    Returns
    -------
    loc : int or ndarray[int64]

    Raises
    ------
    KeyError
        Key is not present in the index.
    TypeError
        If key is listlike or otherwise not hashable.
    """
    orig_key = key

    if not is_scalar(key):
        raise InvalidIndexError(key)

    if isinstance(key, str):
        try:
            loc = self._get_string_slice(key)
            return loc
        except (TypeError, ValueError):
            pass

        try:
            asdt, reso = parse_time_string(key, self.freq)
        except DateParseError as err:
            # A string with invalid format
            raise KeyError(f"Cannot interpret '{key}' as period") from err

        reso = Resolution.from_attrname(reso)
        grp = reso.freq_group
        freqn = self.dtype.freq_group

        # _get_string_slice will handle cases where grp < freqn
        assert grp >= freqn

        # BusinessDay is a bit strange. It has a *lower* code, but we never parse
        # a string as "BusinessDay" resolution, just Day.
        if grp == freqn or (
            reso == Resolution.RESO_DAY and self.dtype.freq.name == "B"
        ):
            key = Period(asdt, freq=self.freq)
            loc = self.get_loc(key, method=method, tolerance=tolerance)
            return loc
        elif method is None:
            raise KeyError(key)
        else:
            key = asdt

    elif is_integer(key):
        # Period constructor will cast to string, which we dont want
        raise KeyError(key)

    try:
        key = Period(key, freq=self.freq)
    except ValueError as err:
        # we cannot construct the Period
        raise KeyError(orig_key) from err

    try:
        return Index.get_loc(self, key, method, tolerance)
    except KeyError as err:
        raise KeyError(orig_key) from err


# Traceback (ValueError)
In [11]: s = pd.Series([1, 2, 3], index=pd.period_range('2000', periods=3, name='A'))

In [12]: s.index.get_loc('A')
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-12-3a472f211c46> in <module>
----> 1 s.index.get_loc('A')

~/sandbox/pandas/pandas/core/indexes/period.py in get_loc(self, key, method, tolerance)
501
502             try:
--> 503                 asdt, reso = parse_time_string(key, self.freq)
504             except DateParseError as err:
505                 # A string with invalid format

~/sandbox/pandas/pandas/_libs/tslibs/parsing.pyx in pandas._libs.tslibs.parsing.parse_time_string()

~/sandbox/pandas/pandas/_libs/tslibs/parsing.pyx in pandas._libs.tslibs.parsing.parse_datetime_string_with_reso()

ValueError: Given date string not likely a datetime.

# Fixed code
def get_loc(self, key, method=None, tolerance=None):
    """
    Get integer location for requested label.

    Parameters
    ----------
    key : Period, NaT, str, or datetime
        String or datetime key must be parsable as Period.

    Returns
    -------
    loc : int or ndarray[int64]

    Raises
    ------
    KeyError
        Key is not present in the index.
    TypeError
        If key is listlike or otherwise not hashable.
    """
    orig_key = key

    if not is_scalar(key):
        raise InvalidIndexError(key)

    if isinstance(key, str):
        try:
            loc = self._get_string_slice(key)
            return loc
        except (TypeError, ValueError):
            pass

        try:
            asdt, reso = parse_time_string(key, self.freq)
        except (ValueError, DateParseError) as err:
            # A string with invalid format
            raise KeyError(f"Cannot interpret '{key}' as period") from err

        reso = Resolution.from_attrname(reso)
        grp = reso.freq_group
        freqn = self.dtype.freq_group

        # _get_string_slice will handle cases where grp < freqn
        assert grp >= freqn

        # BusinessDay is a bit strange. It has a *lower* code, but we never parse
        # a string as "BusinessDay" resolution, just Day.
        if grp == freqn or (
            reso == Resolution.RESO_DAY and self.dtype.freq.name == "B"
        ):
            key = Period(asdt, freq=self.freq)
            loc = self.get_loc(key, method=method, tolerance=tolerance)
            return loc
        elif method is None:
            raise KeyError(key)
        else:
            key = asdt

    elif is_integer(key):
        # Period constructor will cast to string, which we dont want
        raise KeyError(key)

    try:
        key = Period(key, freq=self.freq)
    except ValueError as err:
        # we cannot construct the Period
        raise KeyError(orig_key) from err

    try:
        return Index.get_loc(self, key, method, tolerance)
    except KeyError as err:
        raise KeyError(orig_key) from err