summaryrefslogtreecommitdiffstats
path: root/Lib/traceback.py
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2021-11-27 22:00:10 (GMT)
committerGitHub <noreply@github.com>2021-11-27 22:00:10 (GMT)
commit4dfae6f38e1720ddafcdd68043e476ecb41cb4d5 (patch)
treef4b3c2b296051e5f4ac3e4fdc9f4183758f65b4a /Lib/traceback.py
parente71c12efcddc1076d5367461a5b416092267aa77 (diff)
downloadcpython-4dfae6f38e1720ddafcdd68043e476ecb41cb4d5.zip
cpython-4dfae6f38e1720ddafcdd68043e476ecb41cb4d5.tar.gz
cpython-4dfae6f38e1720ddafcdd68043e476ecb41cb4d5.tar.bz2
bpo-45614: Fix traceback display for exceptions with invalid module name (GH-29726)
Diffstat (limited to 'Lib/traceback.py')
-rw-r--r--Lib/traceback.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/traceback.py b/Lib/traceback.py
index 97caa13..77f8590 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 = "<unknown>"
stype = smod + '.' + stype
if not issubclass(self.exc_type, SyntaxError):