import io
import pickle


def unpickle_buffer(buf):
    """Read pickled objects out of a buffer.

    Parameters
    ----------
    buf : bytes-like object
        The buffer to read the pickled objects from.

    Returns
    -------
    objs : list of objects
        List of pickled objects from the buffer.
    """
    reader = io.BytesIO(buf)
    objs = []
    while True:
        try:
            obj = pickle.load(reader)
            objs.append(obj)
        except EOFError:
            break
    return objs