def test_no_recursion_index_on_recursion_error():
    """
    Ensure that we don't break in case we can't find the recursion index
    during a recursion error (#2486).
    """

    class RecursionDepthError:
        def __getattr__(self, attr):
            return getattr(self, "_" + attr)

    with pytest.raises(RuntimeError) as excinfo:
        _ = RecursionDepthError().trigger
    assert "maximum recursion" in str(excinfo.getrepr())

    Ensure that we don't break in case we can't find the recursion index
    during a recursion error (#2486).
    
testing/code/test_excinfo.py