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:
@@ -1003,9 +1003,9 @@ class TestTracebackCutting:
|
||||
with pytest.raises(pytest.skip.Exception) as excinfo:
|
||||
pytest.skip("xxx")
|
||||
assert excinfo.traceback[-1].frame.code.name == "skip"
|
||||
assert excinfo.traceback[-1].ishidden()
|
||||
assert excinfo.traceback[-1].ishidden(excinfo)
|
||||
assert excinfo.traceback[-2].frame.code.name == "test_skip_simple"
|
||||
assert not excinfo.traceback[-2].ishidden()
|
||||
assert not excinfo.traceback[-2].ishidden(excinfo)
|
||||
|
||||
def test_traceback_argsetup(self, pytester: Pytester) -> None:
|
||||
pytester.makeconftest(
|
||||
|
||||
Reference in New Issue
Block a user