bpo-30978: str.format_map() now passes key lookup exceptions through. (#2790)

Previously any exception was replaced with a KeyError exception.
This commit is contained in:
Serhiy Storchaka 2017-08-03 11:45:23 +03:00 committed by GitHub
parent 25e4f779d7
commit 5075416b8f
4 changed files with 20 additions and 7 deletions

View file

@ -468,7 +468,7 @@ class ReTests(unittest.TestCase):
m[(0,)]
with self.assertRaisesRegex(IndexError, 'no such group'):
m[(0, 1)]
with self.assertRaisesRegex(KeyError, 'a2'):
with self.assertRaisesRegex(IndexError, 'no such group'):
'a1={a2}'.format_map(m)
m = pat.match('ac')