joerick/pyinstrument

ValueError on ShowAll in Speedscope Renderer

coneybeare opened this issue · 2 comments

        if show_all:
            for p in (
                processors.group_library_frames_processor,
                processors.remove_importlib,
                processors.remove_irrelevant_nodes,
                processors.remove_tracebackhide,
                # note: we're not removing these processors
                # processors.remove_unnecessary_self_time_nodes,
                #    (still hide the inner pyinstrument synthetic frames)
                # processors.remove_first_pyinstrument_frames_processor,
                #    (still hide the outer pyinstrument calling frames)
            ):
>               self.processors.remove(p)
E               ValueError: list.remove(x): x not in list

../../.pyenv/versions/3.11.3/lib/python3.11/site-packages/pyinstrument/renderers/base.py:96: ValueError

invoked with renderer = renderers.SpeedscopeRenderer(show_all=True)

putting a breakpoint there, p is remove_tracebackhide

(Pdb) locals()
{'self': <pyinstrument.renderers.speedscope.SpeedscopeRenderer object at 0x131c7cdd0>, 'show_all': True, 'timeline': False, 'processor_options': None, 'p': <function remove_tracebackhide at 0x123080720>, '__return__': None}

Is this something I can fix with config?

I think this is not fixable with config, looks like a bug. I don't really like how those processors are handled in the codebase actually, it's too DRY, I might look at refactoring that while i fix this.

Maybe just a check if processors has p before removing would work?