diff Python/bltinmodule.c @ 18836:03305602ba9b legacy-trunk

Undoing the UCS-4 patch addition which caused unichr() to return surrogates for Unicode code points outside range(0x10000) on narrow Python builds.
author Marc-André Lemburg <mal@egenix.com>
date Thu, 26 Jul 2001 16:29:25 +0000
parents fdb36a0c7e6e
children 22456d0ee737
line wrap: on
line diff
--- a/Python/bltinmodule.c	Thu Jul 26 13:41:06 2001 +0000
+++ b/Python/bltinmodule.c	Thu Jul 26 16:29:25 2001 +0000
@@ -313,11 +313,21 @@
 	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 */