mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #15778: Coerce ImportError.args to a string when it isn't
already one. Patch by Dave Malcolm.
This commit is contained in:
parent
491b1dc79e
commit
07c6e71689
3 changed files with 9 additions and 1 deletions
|
@ -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():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue