From 07c6e7168919c275e47fa35c741413270d3d80fd Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Fri, 24 Aug 2012 13:05:09 -0400 Subject: Issue #15778: Coerce ImportError.args to a string when it isn't already one. Patch by Dave Malcolm. --- Lib/test/test_exceptions.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Lib/test/test_exceptions.py') diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py index 0b1fd1b8b9b..55e9db37803 100644 --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -937,6 +937,11 @@ class ImportErrorTests(unittest.TestCase): self.assertEqual(exc.name, 'somename') self.assertEqual(exc.path, 'somepath') + def test_non_str_argument(self): + # Issue #15778 + arg = b'abc' + exc = ImportError(arg) + self.assertEqual(str(arg), str(exc)) def test_main(): -- cgit v1.2.3