bpo-43146: fix regression in traceback.print_exception(None) (GH-24463)
diff --git a/Lib/traceback.py b/Lib/traceback.py
index 090465a..dfb296c 100644
--- a/Lib/traceback.py
+++ b/Lib/traceback.py
@@ -528,7 +528,9 @@ def __init__(self, exc_type, exc_value, exc_traceback, *, limit=None,
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