From 99212f61db1155c4d82b449078fe337cbd42a19f Mon Sep 17 00:00:00 2001 From: Stefan Krah Date: Mon, 19 Jul 2010 17:58:26 +0000 Subject: Sub-issue of #9036: Fix incorrect use of Py_CHARMASK. --- Lib/test/test_unicode.py | 1 + Objects/unicodeobject.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index ba66c81..ab6c153 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -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...') diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 6270e9b..43c827f 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -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) { -- cgit v0.12