mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Fix segfault discovered by Ron Adam. Not checking for terminating right bracket in "'{0[}'.format(())". Fixed, and tests added.
This commit is contained in:
parent
f82d9b52fa
commit
4cb4e4e882
2 changed files with 12 additions and 4 deletions
|
@ -458,6 +458,7 @@ class UnicodeTest(
|
|||
# weird field names
|
||||
self.assertEqual("{0[foo-bar]}".format({'foo-bar':'baz'}), 'baz')
|
||||
self.assertEqual("{0[foo bar]}".format({'foo bar':'baz'}), 'baz')
|
||||
self.assertEqual("{0[ ]}".format({' ':3}), '3')
|
||||
|
||||
self.assertEqual('{foo._x}'.format(foo=C(20)), '20')
|
||||
self.assertEqual('{1}{0}'.format(D(10), D(20)), '2010')
|
||||
|
@ -551,6 +552,7 @@ class UnicodeTest(
|
|||
self.assertRaises(ValueError, "{0".format)
|
||||
self.assertRaises(ValueError, "{0.}".format)
|
||||
self.assertRaises(ValueError, "{0[}".format)
|
||||
self.assertRaises(ValueError, "{0[}".format, [])
|
||||
self.assertRaises(ValueError, "{0]}".format)
|
||||
self.assertRaises(ValueError, "{0.[]}".format)
|
||||
self.assertRaises(ValueError, "{0..foo}".format, 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue