From: Stefan Krah Date: Mon, 19 Jul 2010 18:06:46 +0000 (+0000) Subject: Sub-issue of #9036: Fix incorrect use of Py_CHARMASK. X-Git-Tag: v2.7.1rc1~582 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0b9201fa1cf87af559e8bbe38082df9d834ef353;p=python 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 8d524926b8..1151e867a4 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -394,6 +394,7 @@ class UnicodeTest( self.assertEqual(u'%c' % 0x1234, u'\u1234') self.assertRaises(OverflowError, u"%c".__mod__, (sys.maxunicode+1,)) + self.assertRaises(ValueError, u"%.1\u1032f".__mod__, (1.0/3)) for num in range(0x00,0x80): char = chr(num) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index b182927911..81b62e4fd8 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -8417,7 +8417,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) {