Mercurial > cpython-lru_cache-weakref
diff Python/modsupport.c @ 48430:04817793b962
Issue #3280: like chr() already does, the "%c" format now accepts the full unicode range
even on "narrow Unicode" builds; the result is a pair of UTF-16 surrogates.
| author | Amaury Forgeot d'Arc <amauryfa@gmail.com> |
|---|---|
| date | Fri, 04 Jul 2008 21:26:43 +0000 |
| parents | 94f64f11fdd0 |
| children | f27206101ff9 |
line wrap: on
line diff
--- a/Python/modsupport.c Fri Jul 04 19:55:29 2008 +0000 +++ b/Python/modsupport.c Fri Jul 04 21:26:43 2008 +0000 @@ -294,21 +294,12 @@ case 'C': { int i = va_arg(*p_va, int); - Py_UNICODE c; if (i < 0 || i > PyUnicode_GetMax()) { -#ifdef Py_UNICODE_WIDE PyErr_SetString(PyExc_OverflowError, - "%c arg not in range(0x110000) " - "(wide Python build)"); -#else - PyErr_SetString(PyExc_OverflowError, - "%c arg not in range(0x10000) " - "(narrow Python build)"); -#endif + "%c arg not in range(0x110000)"; return NULL; } - c = i; - return PyUnicode_FromUnicode(&c, 1); + return PyUnicode_FromOrdinal(i); } case 's':
