diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py index ef08b29c6d360d..2089050cadfc2c 100644 --- a/Lib/test/test_traceback.py +++ b/Lib/test/test_traceback.py @@ -1477,6 +1477,21 @@ def __str__(self): exp = "%s: %s\n" % (str_name, str_value) self.assertEqual(exp, err) + def test_exception_angle_bracketed_filename(self): + src = textwrap.dedent(""" + try: + raise ValueError(42) + except Exception as e: + exc = e + """) + + code = compile(src, "", "exec") + g, l = {}, {} + exec(code, g, l) + err = self.get_report(l['exc']) + exp = ' File "", line 3, in \nValueError: 42\n' + self.assertIn(exp, err) + def test_exception_modulename_not_unicode(self): class X(Exception): def __str__(self):