# Buggy code
def get_value(self, series, key):
    """
    Fast lookup of value from 1-dimensional ndarray. Only use this if you
    know what you're doing
    """
    try:
        k = com.values_from_object(key)
        k = self._convert_scalar_indexer(k, kind="getitem")
        indexer = self.get_loc(k)
        return series.iloc[indexer]
    except (KeyError, TypeError):
        pass

    # we might be a positional inexer
    return super().get_value(series, key)


# Traceback (AttributeError)
Python 3.6.3 (default, Oct  3 2017, 21:45:48)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
import pandas as pd
x = pd.Series([1, 2, 3], index=pd.CategoricalIndex(["A", "B", "C"]))
x.loc["A"]
1
x.at["A"]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/dist-packages/pandas/core/indexing.py", line 1869, in __getitem__
return self.obj._get_value(*key, takeable=self._takeable)
File "/usr/local/lib/python3.6/dist-packages/pandas/core/series.py", line 929, in _get_value
return self.index.get_value(self._values, label)
File "/usr/local/lib/python3.6/dist-packages/pandas/core/indexes/category.py", line 423, in get_value
return series.iloc[indexer]
AttributeError: 'numpy.ndarray' object has no attribute 'iloc'
x = pd.DataFrame([[1, 2], [3, 4], [5, 6]], index=pd.CategoricalIndex(["A", "B", "C"]))
x.loc["B", 1]
4
x.at["B", 1]
Traceback (most recent call last):
File "pandas/_libs/index.pyx", line 139, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/hashtable_class_helper.pxi", line 811, in pandas._libs.hashtable.Int64HashTable.get_item
TypeError: an integer is required

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/dist-packages/pandas/core/indexing.py", line 1869, in __getitem__
return self.obj._get_value(*key, takeable=self._takeable)
File "/usr/local/lib/python3.6/dist-packages/pandas/core/frame.py", line 1985, in _get_value
return engine.get_value(series._values, index)
File "pandas/_libs/index.pyx", line 83, in pandas._libs.index.IndexEngine.get_value
File "pandas/_libs/index.pyx", line 91, in pandas._libs.index.IndexEngine.get_value
File "pandas/_libs/index.pyx", line 141, in pandas._libs.index.IndexEngine.get_loc
KeyError: 'B'

# Fixed code
def get_value(self, series: AnyArrayLike, key: Any):
    """
    Fast lookup of value from 1-dimensional ndarray. Only use this if you
    know what you're doing

    Parameters
    ----------
    series : Series, ExtensionArray, Index, or ndarray
        1-dimensional array to take values from
    key: : scalar
        The value of this index at the position of the desired value,
        otherwise the positional index of the desired value

    Returns
    -------
    Any
        The element of the series at the position indicated by the key
    """
    try:
        k = com.values_from_object(key)
        k = self._convert_scalar_indexer(k, kind="getitem")
        indexer = self.get_loc(k)
        return series.take([indexer])[0]
    except (KeyError, TypeError):
        pass

    # we might be a positional inexer
    return super().get_value(series, key)