
On Sat, May 29, 2021 at 3:25 PM Thomas Grainger <tagrain@gmail.com> wrote:
pytest uses __tracebackhide__
https://doc.pytest.org/en/latest/example/simple.html#writing-well-integrated...
Thanks for the reminder. Pytest takes care of traceback formatting for users. Individual projects can of course do that. But I want to do the reverse: I want to limit what users of my projects will see in a traceback, without having them specify something in their code. What I am interested in is having a project-agnostic standardised Python way to specify what to show to an end-user when an exception is raised.
Eg anyio sets __tracebackhide__ = __traceback_hide__ = True to remove internal frames from user Tracebacks
Do you have a specific link to this? I have looked in the documentation as well as in a few modules (_core/_exceptions.py in particular) without seeing any reference to this. I am not interested in custom formatting for testing, which is something comparatively easy to do.