Commit 99212f61 authored by Stefan Krah's avatar Stefan Krah

Sub-issue of #9036: Fix incorrect use of Py_CHARMASK.

parent 9542cc6e
...@@ -757,6 +757,7 @@ class UnicodeTest(string_tests.CommonTest, ...@@ -757,6 +757,7 @@ class UnicodeTest(string_tests.CommonTest,
self.assertRaises(OverflowError, "%c".__mod__, (0x110000,)) self.assertRaises(OverflowError, "%c".__mod__, (0x110000,))
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))
# 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...')
......
...@@ -9242,7 +9242,7 @@ PyObject *PyUnicode_Format(PyObject *format, ...@@ -9242,7 +9242,7 @@ PyObject *PyUnicode_Format(PyObject *format,
else if (c >= '0' && c <= '9') { else if (c >= '0' && c <= '9') {
prec = c - '0'; prec = c - '0';
while (--fmtcnt >= 0) { while (--fmtcnt >= 0) {
c = Py_CHARMASK(*fmt++); c = *fmt++;
if (c < '0' || c > '9') if (c < '0' || c > '9')
break; break;
if ((prec*10) / 10 != prec) { if ((prec*10) / 10 != prec) {
......
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