summaryrefslogtreecommitdiffstats
path: root/Python/bltinmodule.c
diff options
context:
space:
mode:
authorMarc-André Lemburg <mal@egenix.com>2001-07-26 16:29:25 (GMT)
committerMarc-André Lemburg <mal@egenix.com>2001-07-26 16:29:25 (GMT)
commitae21df59c372dd73307b3cb7178567a930d478c2 (patch)
treeb4a99e423ff3e6cec101b56a4b92274bd000172c /Python/bltinmodule.c
parent4f1cd8bdcbd20bb0acdbe9e240f28c09dd38370f (diff)
downloadcpython-ae21df59c372dd73307b3cb7178567a930d478c2.zip
cpython-ae21df59c372dd73307b3cb7178567a930d478c2.tar.gz
cpython-ae21df59c372dd73307b3cb7178567a930d478c2.tar.bz2
Undoing the UCS-4 patch addition which caused unichr() to return
surrogates for Unicode code points outside range(0x10000) on narrow Python builds.
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r--Python/bltinmodule.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index fcc7d17..6eb6aca 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -313,11 +313,21 @@ builtin_unichr(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "l:unichr", &x))
return NULL;
+#ifdef Py_UNICODE_WIDE
if (x < 0 || x > 0x10ffff) {
PyErr_SetString(PyExc_ValueError,
- "unichr() arg not in range(0x110000)");
+ "unichr() arg not in range(0x110000) "
+ "(wide Python build)");
return NULL;
}
+#else
+ if (x < 0 || x > 0xffff) {
+ PyErr_SetString(PyExc_ValueError,
+ "unichr() arg not in range(0x10000) "
+ "(narrow Python build)");
+ return NULL;
+ }
+#endif
if (x <= 0xffff) {
/* UCS-2 character */