diff options
author | Eric Smith <eric@trueblade.com> | 2007-09-03 08:40:29 (GMT) |
---|---|---|
committer | Eric Smith <eric@trueblade.com> | 2007-09-03 08:40:29 (GMT) |
commit | 4cb4e4e882dcff50ffd2f5478ae63522657d7ce3 (patch) | |
tree | 0eeb9eaa7311e6c51c3686b7500fc69e1f6fda11 /Lib | |
parent | f82d9b52fae475a132a21d1b7174730f17b735de (diff) | |
download | cpython-4cb4e4e882dcff50ffd2f5478ae63522657d7ce3.zip cpython-4cb4e4e882dcff50ffd2f5478ae63522657d7ce3.tar.gz cpython-4cb4e4e882dcff50ffd2f5478ae63522657d7ce3.tar.bz2 |
Fix segfault discovered by Ron Adam. Not checking for terminating right bracket in "'{0[}'.format(())". Fixed, and tests added.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_unicode.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index 6773f2a..52b7b4f 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -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) |