diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2021-11-29 10:07:24 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-29 10:07:24 +0000 |
commit | 4d2cc3ed46d2453bad92243128e237e7febca714 (patch) | |
tree | a95052cc836753e3364428617460471c7eba99c1 /Lib/traceback.py | |
parent | 305236e03a274850be8ed399ea3390ee71519ef4 (diff) | |
download | cpython-git-4d2cc3ed46d2453bad92243128e237e7febca714.tar.gz |
bpo-45614: Fix traceback display for exceptions with invalid module name (GH-29726) (GH-29826)
(cherry picked from commit 4dfae6f38e1720ddafcdd68043e476ecb41cb4d5)
Diffstat (limited to 'Lib/traceback.py')
-rw-r--r-- | Lib/traceback.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/traceback.py b/Lib/traceback.py index 901b99476a..d6a010f415 100644 --- a/Lib/traceback.py +++ b/Lib/traceback.py @@ -604,6 +604,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): |