From 6ee976e9c374c1253401bdd023e62d3c7f773d0a Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Fri, 11 Dec 2020 16:08:46 +0000 Subject: [PATCH] fix raise from None --- CHANGELOG.md | 4 ++++ rich/traceback.py | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f16bf810..56b44565 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__