Commit bc9d8f83 authored by Senthil Kumaran's avatar Senthil Kumaran

merge from 3.2

parents 401d1976 9ebe08d2
...@@ -788,6 +788,7 @@ class UnicodeTest(string_tests.CommonTest, ...@@ -788,6 +788,7 @@ class UnicodeTest(string_tests.CommonTest,
self.assertEqual('%c' % '\U00021483', '\U00021483') self.assertEqual('%c' % '\U00021483', '\U00021483')
self.assertRaises(TypeError, "%c".__mod__, "aa") self.assertRaises(TypeError, "%c".__mod__, "aa")
self.assertRaises(ValueError, "%.1\u1032f".__mod__, (1.0/3)) self.assertRaises(ValueError, "%.1\u1032f".__mod__, (1.0/3))
self.assertRaises(TypeError, "%i".__mod__, "aa")
# formatting jobs delegated from the string implementation: # formatting jobs delegated from the string implementation:
self.assertEqual('...%(foo)s...' % {'foo':"abc"}, '...abc...') self.assertEqual('...%(foo)s...' % {'foo':"abc"}, '...abc...')
......
...@@ -9761,8 +9761,6 @@ PyUnicode_Format(PyObject *format, PyObject *args) ...@@ -9761,8 +9761,6 @@ PyUnicode_Format(PyObject *format, PyObject *args)
case 'o': case 'o':
case 'x': case 'x':
case 'X': case 'X':
if (c == 'i')
c = 'd';
isnumok = 0; isnumok = 0;
if (PyNumber_Check(v)) { if (PyNumber_Check(v)) {
PyObject *iobj=NULL; PyObject *iobj=NULL;
...@@ -9777,7 +9775,7 @@ PyUnicode_Format(PyObject *format, PyObject *args) ...@@ -9777,7 +9775,7 @@ PyUnicode_Format(PyObject *format, PyObject *args)
if (iobj!=NULL) { if (iobj!=NULL) {
if (PyLong_Check(iobj)) { if (PyLong_Check(iobj)) {
isnumok = 1; isnumok = 1;
temp = formatlong(iobj, flags, prec, c); temp = formatlong(iobj, flags, prec, (c == 'i'? 'd': c));
Py_DECREF(iobj); Py_DECREF(iobj);
if (!temp) if (!temp)
goto onError; goto onError;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment