diff --git a/CHANGELOG.md b/CHANGELOG.md index 095a1cd3..10c68cfb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Table.add_row style argument now applies to entire line and not just cells - Added end_section parameter to Table.add_row to force a line underneath row +## Fixed + +- Fixed suppressed traceback context https://github.com/willmcgugan/rich/issues/468 + ## [9.3.0] - 2020-12-1 ### Added diff --git a/rich/traceback.py b/rich/traceback.py index 3d13becb..c2958198 100644 --- a/rich/traceback.py +++ b/rich/traceback.py @@ -261,6 +261,7 @@ class Traceback: stacks: List[Stack] = [] is_cause = False + while True: stack = Stack( exc_type=str(exc_type.__name__), @@ -310,7 +311,11 @@ class Traceback: continue cause = exc_value.__context__ - if cause and cause.__traceback__: + if ( + cause + and cause.__traceback__ + and not getattr(exc_value, "__suppress_context__", False) + ): exc_type = cause.__class__ exc_value = cause traceback = cause.__traceback__