summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_sys.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-09-03 16:56:05 (GMT)
committerGitHub <noreply@github.com>2021-09-03 16:56:05 (GMT)
commit41c23740243cc3a0699bc4d5dcfd47a0007ff039 (patch)
treeea37dd3bc3cbbcd779881d394a6120506e53b103 /Lib/test/test_sys.py
parent98eb40828af97760badfa7b8ff84bd4f7a079839 (diff)
downloadcpython-41c23740243cc3a0699bc4d5dcfd47a0007ff039.zip
cpython-41c23740243cc3a0699bc4d5dcfd47a0007ff039.tar.gz
cpython-41c23740243cc3a0699bc4d5dcfd47a0007ff039.tar.bz2
[3.9] bpo-45083: Include the exception class qualname when formatting an exception (GH-28119) (GH-28135)
* bpo-45083: Include the exception class qualname when formatting an exception (GH-28119) Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no> (cherry picked from commit b4b6342848ec0459182a992151099252434cc619) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Co-authored-by: Ɓukasz Langa <lukasz@langa.pl>
Diffstat (limited to 'Lib/test/test_sys.py')
-rw-r--r--Lib/test/test_sys.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index ed9b177..f277c92 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -1005,6 +1005,20 @@ class UnraisableHookTest(unittest.TestCase):
self.assertIn("del is broken", report)
self.assertTrue(report.endswith("\n"))
+ def test_original_unraisablehook_exception_qualname(self):
+ class A:
+ class B:
+ class X(Exception):
+ pass
+
+ with test.support.captured_stderr() as stderr, \
+ test.support.swap_attr(sys, 'unraisablehook',
+ sys.__unraisablehook__):
+ expected = self.write_unraisable_exc(
+ A.B.X(), "msg", "obj");
+ report = stderr.getvalue()
+ testName = 'test_original_unraisablehook_exception_qualname'
+ self.assertIn(f"{testName}.<locals>.A.B.X", report)
def test_original_unraisablehook_wrong_type(self):
exc = ValueError(42)