summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSenthil Kumaran <senthil@uthcode.com>2011-07-04 04:05:25 (GMT)
committerSenthil Kumaran <senthil@uthcode.com>2011-07-04 04:05:25 (GMT)
commitbc9d8f838b604565da23fba8ae97e0cd23aa7414 (patch)
treed30430823303393470c721e7bb35f4685a82a5a9
parent401d197657550f0ac155e96213b328a70724d2fa (diff)
parent9ebe08d2f6c3b8bca5148e909cc89efeb7a01ad1 (diff)
downloadcpython-bc9d8f838b604565da23fba8ae97e0cd23aa7414.zip
cpython-bc9d8f838b604565da23fba8ae97e0cd23aa7414.tar.gz
cpython-bc9d8f838b604565da23fba8ae97e0cd23aa7414.tar.bz2
merge from 3.2
-rw-r--r--Lib/test/test_unicode.py1
-rw-r--r--Objects/unicodeobject.c4
2 files changed, 2 insertions, 3 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py
index f35458a..2cb923f 100644
--- a/Lib/test/test_unicode.py
+++ b/Lib/test/test_unicode.py
@@ -788,6 +788,7 @@ class UnicodeTest(string_tests.CommonTest,
self.assertEqual('%c' % '\U00021483', '\U00021483')
self.assertRaises(TypeError, "%c".__mod__, "aa")
self.assertRaises(ValueError, "%.1\u1032f".__mod__, (1.0/3))
+ self.assertRaises(TypeError, "%i".__mod__, "aa")
# formatting jobs delegated from the string implementation:
self.assertEqual('...%(foo)s...' % {'foo':"abc"}, '...abc...')
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 4361908..7043599 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -9761,8 +9761,6 @@ PyUnicode_Format(PyObject *format, PyObject *args)
case 'o':
case 'x':
case 'X':
- if (c == 'i')
- c = 'd';
isnumok = 0;
if (PyNumber_Check(v)) {
PyObject *iobj=NULL;
@@ -9777,7 +9775,7 @@ PyUnicode_Format(PyObject *format, PyObject *args)
if (iobj!=NULL) {
if (PyLong_Check(iobj)) {
isnumok = 1;
- temp = formatlong(iobj, flags, prec, c);
+ temp = formatlong(iobj, flags, prec, (c == 'i'? 'd': c));
Py_DECREF(iobj);
if (!temp)
goto onError;