]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Undoing the UCS-4 patch addition which caused unichr() to return
authorMarc-André Lemburg <mal@egenix.com>
Thu, 26 Jul 2001 16:29:25 +0000 (16:29 +0000)
committerMarc-André Lemburg <mal@egenix.com>
Thu, 26 Jul 2001 16:29:25 +0000 (16:29 +0000)
surrogates for Unicode code points outside range(0x10000) on narrow
Python builds.

Python/bltinmodule.c

index fcc7d170b93fe5a85b61c2cc194d83ddd62753a3..6eb6acae56f1dd03735faa62f4ab413ee364c6d3 100644 (file)
@@ -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 */