From 26f18b8540b49d592af66361f8df1a03953d1768 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Tue, 23 Feb 2021 14:58:47 +0000 Subject: bpo-43146: fix regression in traceback.print_exception(None) (GH-24463) --- Lib/traceback.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Lib/traceback.py') diff --git a/Lib/traceback.py b/Lib/traceback.py index 090465a3584..dfb296c5e7b 100644 --- a/Lib/traceback.py +++ b/Lib/traceback.py @@ -528,7 +528,9 @@ class TracebackException: cause = None if compact: - need_context = cause is None and not e.__suppress_context__ + need_context = (cause is None and + e is not None and + not e.__suppress_context__) else: need_context = True if (e and e.__context__ is not None -- cgit v1.2.3