summaryrefslogtreecommitdiff
path: root/Python/modsupport.c
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-07-04 21:26:43 +0000
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-07-04 21:26:43 +0000
commit0aec9d52bb4ab5a6cba2521b05dbff592293bfb1 (patch)
tree649da39641ca06f5dd1016a64895e96001d40ba7 /Python/modsupport.c
parent6c235b77df7b79359fbf8da58a472f6d428f9007 (diff)
downloadcpython-0aec9d52bb4ab5a6cba2521b05dbff592293bfb1.tar.gz
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.
Diffstat (limited to 'Python/modsupport.c')
-rw-r--r--Python/modsupport.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/Python/modsupport.c b/Python/modsupport.c
index b88c1edff2..e39c315459 100644
--- a/Python/modsupport.c
+++ b/Python/modsupport.c
@@ -294,21 +294,12 @@ do_mkvalue(const char **p_format, va_list *p_va, int flags)
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':