import types
import typing


def _frames_from_traceback(tb: types.TracebackType) -> typing.List[types.FrameType]:
    """Extract frames from traceback object"""
    output = []
    current = tb
    while 1:
        output.append(current.tb_frame)
        if current.tb_next:
            current = current.tb_next
        else:
            break
    return output