From 4dfae6f38e1720ddafcdd68043e476ecb41cb4d5 Mon Sep 17 00:00:00 2001 From: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Date: Sat, 27 Nov 2021 22:00:10 +0000 Subject: bpo-45614: Fix traceback display for exceptions with invalid module name (GH-29726) --- Lib/traceback.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Lib/traceback.py') diff --git a/Lib/traceback.py b/Lib/traceback.py index 97caa1372f4..77f8590719e 100644 --- a/Lib/traceback.py +++ b/Lib/traceback.py @@ -808,6 +808,8 @@ class TracebackException: stype = self.exc_type.__qualname__ smod = self.exc_type.__module__ if smod not in ("__main__", "builtins"): + if not isinstance(smod, str): + smod = "" stype = smod + '.' + stype if not issubclass(self.exc_type, SyntaxError): -- cgit v1.2.3