]> granicus.if.org Git - python/commitdiff
Sub-issue of #9036: Fix incorrect use of Py_CHARMASK.
authorStefan Krah <stefan@bytereef.org>
Mon, 19 Jul 2010 18:06:46 +0000 (18:06 +0000)
committerStefan Krah <stefan@bytereef.org>
Mon, 19 Jul 2010 18:06:46 +0000 (18:06 +0000)
Lib/test/test_unicode.py
Objects/unicodeobject.c

index 8d524926b89fd6707a0d060472a843b12a10749a..1151e867a4d667b470121e9ff3a6dcf3e12a8e76 100644 (file)
@@ -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)
index b18292791107def405fae8d53deb9a9a15f44b62..81b62e4fd84caecdb4c28e21d907efbe4dcefd42 100644 (file)
@@ -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) {