]> 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 17:58:26 +0000 (17:58 +0000)
committerStefan Krah <stefan@bytereef.org>
Mon, 19 Jul 2010 17:58:26 +0000 (17:58 +0000)
Lib/test/test_unicode.py
Objects/unicodeobject.c

index ba66c8188fbac5a9036429725a66681fa6d9cb43..ab6c1537c12166ce1213bd5c65f5ec97d668c0c6 100644 (file)
@@ -757,6 +757,7 @@ class UnicodeTest(string_tests.CommonTest,
         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...')
index 6270e9bffcfbb6619d24b343ba7844376e2ded63..43c827f981bc07a4a437b56b333dac3e7aa5a576 100644 (file)
@@ -9242,7 +9242,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) {