mirror of
https://github.com/python/cpython.git
synced 2025-10-24 15:36:26 +00:00
Undoing the UCS-4 patch addition which caused unichr() to return
surrogates for Unicode code points outside range(0x10000) on narrow Python builds.
This commit is contained in:
parent
4f1cd8bdcb
commit
ae21df59c3
1 changed files with 11 additions and 1 deletions
|
|
@ -313,11 +313,21 @@ builtin_unichr(PyObject *self, PyObject *args)
|
||||||
if (!PyArg_ParseTuple(args, "l:unichr", &x))
|
if (!PyArg_ParseTuple(args, "l:unichr", &x))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
#ifdef Py_UNICODE_WIDE
|
||||||
if (x < 0 || x > 0x10ffff) {
|
if (x < 0 || x > 0x10ffff) {
|
||||||
PyErr_SetString(PyExc_ValueError,
|
PyErr_SetString(PyExc_ValueError,
|
||||||
"unichr() arg not in range(0x110000)");
|
"unichr() arg not in range(0x110000) "
|
||||||
|
"(wide Python build)");
|
||||||
return NULL;
|
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) {
|
if (x <= 0xffff) {
|
||||||
/* UCS-2 character */
|
/* UCS-2 character */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue