code: stop storing weakref to ExceptionInfo on Traceback and TracebackEntry

TracebackEntry needs the excinfo for the `__tracebackhide__ = callback`
functionality, where `callback` accepts the excinfo.

Currently it achieves this by storing a weakref to the excinfo which
created it. I think this is not great, mixing layers and bloating the
objects.

Instead, have `ishidden` (and transitively, `Traceback.filter()`) take
the excinfo as a parameter.
This commit is contained in:
Ran Benita
2023-04-12 23:17:54 +03:00
parent 11965d1c27
commit cc23ec91d0
6 changed files with 46 additions and 41 deletions

View File

@@ -1814,7 +1814,7 @@ class Function(PyobjMixin, nodes.Item):
if not ntraceback:
ntraceback = traceback
excinfo.traceback = ntraceback.filter()
excinfo.traceback = ntraceback.filter(excinfo)
# issue364: mark all but first and last frames to
# only show a single-line message for each frame.
if self.config.getoption("tbstyle", "auto") == "auto":