diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -398,7 +398,8 @@ } else { assert(maxchar >= 0x10000); - assert(maxchar <= MAX_UNICODE); + /* FIXME: what about byte-swapped unicode data in numpy: */ + //assert(maxchar <= MAX_UNICODE); } assert(PyUnicode_READ(kind, data, ascii->length) == 0); } @@ -989,11 +990,13 @@ is_sharing = 1; } else { +#if 0 if (maxchar > MAX_UNICODE) { PyErr_SetString(PyExc_SystemError, "invalid maximum character passed to PyUnicode_New"); return NULL; } +#endif kind = PyUnicode_4BYTE_KIND; char_size = 4; if (sizeof(wchar_t) == 4) @@ -1357,12 +1360,14 @@ } if (ch > *maxchar) { *maxchar = ch; +#if 0 if (*maxchar > MAX_UNICODE) { PyErr_Format(PyExc_ValueError, "character U+%x is not in range [U+0000; U+10ffff]", ch); return -1; } +#endif } } return 0;