Issue #15778: Coerce ImportError.args to a string when it isn't

already one.

Patch by Dave Malcolm.
This commit is contained in:
Brett Cannon 2012-08-24 13:05:09 -04:00
parent 491b1dc79e
commit 07c6e71689
3 changed files with 9 additions and 1 deletions

View file

@ -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():