From 39ec82a7dc17e3581d66c0b13a840ac844dba390 Mon Sep 17 00:00:00 2001 From: Kris Jurka Date: Sun, 3 Oct 2021 16:40:22 -0700 Subject: [PATCH] Add a test to show problem/fix for exceptions without a traceback. --- tests/test_debug.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_debug.py b/tests/test_debug.py index d218c4e802..fbf2fff904 100644 --- a/tests/test_debug.py +++ b/tests/test_debug.py @@ -6,6 +6,7 @@ from werkzeug.debug import console from werkzeug.debug import DebuggedApplication +from werkzeug.debug import get_current_traceback from werkzeug.debug import get_machine_id from werkzeug.debug.console import HTMLStringO from werkzeug.debug.repr import debug_repr @@ -350,3 +351,12 @@ class MutableException(ValueError): except MutableException: # previously crashed: `TypeError: unhashable type 'MutableException'` Traceback(*sys.exc_info()) + + +def test_linked_exception_wo_traceback(): + try: + raise Exception("msg1") + except Exception as e: + e.__context__ = Exception("msg2") + # previously crashed: `IndexError: list index out of range` + get_current_traceback()