bpo-45614: Fix traceback display for exceptions with invalid module name (GH-29726) (GH-29826)

(cherry picked from commit 4dfae6f38e1720ddafcdd68043e476ecb41cb4d5)
4 files changed