From: Stefan Krah Date: Mon, 19 Jul 2010 18:01:13 +0000 (+0000) Subject: Merged revisions 82978 via svnmerge from X-Git-Tag: v3.1.3rc1~485 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=aebd6f4c298e4018f8ad3be98815be61f95ba10f;p=thirdparty%2FPython%2Fcpython.git Merged revisions 82978 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r82978 | stefan.krah | 2010-07-19 19:58:26 +0200 (Mon, 19 Jul 2010) | 3 lines Sub-issue of #9036: Fix incorrect use of Py_CHARMASK. ........ --- diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index d5b324203070..2ed9a451af26 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -763,6 +763,7 @@ class UnicodeTest( self.assertRaises(OverflowError, "%c".__mod__, (0x110000,)) self.assertEqual('%c' % '\U00021483', '\U00021483') self.assertRaises(TypeError, "%c".__mod__, "aa") + self.assertRaises(ValueError, "%.1\u1032f".__mod__, (1.0/3)) # 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 db77b8a1b03d..199f34ae562c 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -9304,7 +9304,7 @@ PyObject *PyUnicode_Format(PyObject *format, else if (c >= '0' && c <= '9') { prec = c - '0'; while (--fmtcnt >= 0) { - c = Py_CHARMASK(*fmt++); + c = *fmt++; if (c < '0' || c > '9') break; if ((prec*10) / 10 != prec) {