[Python-checkins] r72849 - in python/branches/release26-maint: Lib/test/test_str.py Lib/test/test_unicode.py Misc/NEWS Objects/stringlib/string_format.h
eric.smith
python-checkins at python.org
Sat May 23 16:04:33 CEST 2009
Author: eric.smith
Date: Sat May 23 16:04:31 2009
New Revision: 72849
Log:
Merged revisions 72848 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r72848 | eric.smith | 2009-05-23 09:56:13 -0400 (Sat, 23 May 2009) | 1 line
Issue 6089: str.format raises SystemError.
........
Modified:
python/branches/release26-maint/ (props changed)
python/branches/release26-maint/Lib/test/test_str.py
python/branches/release26-maint/Lib/test/test_unicode.py
python/branches/release26-maint/Misc/NEWS
python/branches/release26-maint/Objects/stringlib/string_format.h
Modified: python/branches/release26-maint/Lib/test/test_str.py
==============================================================================
--- python/branches/release26-maint/Lib/test/test_str.py (original)
+++ python/branches/release26-maint/Lib/test/test_str.py Sat May 23 16:04:31 2009
@@ -351,6 +351,10 @@
self.assertRaises(ValueError, "{:s}".format)
self.assertRaises(ValueError, "{}".format)
+ # issue 6089
+ self.assertRaises(ValueError, "{0[0]x}".format, [None])
+ self.assertRaises(ValueError, "{0[0](10)}".format, [None])
+
# can't have a replacement on the field name portion
self.assertRaises(TypeError, '{0[{1}]}'.format, 'abcdefg', 4)
Modified: python/branches/release26-maint/Lib/test/test_unicode.py
==============================================================================
--- python/branches/release26-maint/Lib/test/test_unicode.py (original)
+++ python/branches/release26-maint/Lib/test/test_unicode.py Sat May 23 16:04:31 2009
@@ -1091,6 +1091,10 @@
self.assertRaises(ValueError, u"{:s}".format)
self.assertRaises(ValueError, u"{}".format)
+ # issue 6089
+ self.assertRaises(ValueError, u"{0[0]x}".format, [None])
+ self.assertRaises(ValueError, u"{0[0](10)}".format, [None])
+
# can't have a replacement on the field name portion
self.assertRaises(TypeError, u'{0[{1}]}'.format, u'abcdefg', 4)
Modified: python/branches/release26-maint/Misc/NEWS
==============================================================================
--- python/branches/release26-maint/Misc/NEWS (original)
+++ python/branches/release26-maint/Misc/NEWS Sat May 23 16:04:31 2009
@@ -12,6 +12,9 @@
Core and Builtins
-----------------
+- Issue #6089: str.format can raise SystemError with certain invalid
+ field specifiers.
+
- Issue #5994: the marshal module now has docstrings.
- Issue #5981: Fix two minor inf/nan issues in float.fromhex: (1) inf
Modified: python/branches/release26-maint/Objects/stringlib/string_format.h
==============================================================================
--- python/branches/release26-maint/Objects/stringlib/string_format.h (original)
+++ python/branches/release26-maint/Objects/stringlib/string_format.h Sat May 23 16:04:31 2009
@@ -329,8 +329,9 @@
*name_idx = get_integer(name);
break;
default:
- /* interal error, can't get here */
- assert(0);
+ /* Invalid character follows ']' */
+ PyErr_SetString(PyExc_ValueError, "Only '.' or '[' may "
+ "follow ']' in format field specifier");
return 0;
}
More information about the Python-checkins
mailing list