Mercurial > cpython-lru_cache-weakref
diff Objects/unicodeobject.c @ 75170:8722f1b7dd95
PyUnicode_New() and unicode_putchar() check for MAX_UNICODE maximum (U+10FFFF)
| author | Victor Stinner <vstinner@wyplay.com> |
|---|---|
| date | Wed, 22 Feb 2012 13:36:20 +0100 |
| parents | e0d451e24c43 |
| children | 67d7f807adb4 |
line wrap: on
line diff
--- a/Objects/unicodeobject.c Wed Feb 22 11:53:09 2012 +0200 +++ b/Objects/unicodeobject.c Wed Feb 22 13:36:20 2012 +0100 @@ -998,6 +998,7 @@ is_sharing = 1; } else { + assert(maxchar <= MAX_UNICODE); kind_state = PyUnicode_4BYTE_KIND; char_size = 4; if (sizeof(wchar_t) == 4) @@ -1627,6 +1628,7 @@ unicode_putchar(PyObject **p_unicode, Py_ssize_t *pos, Py_UCS4 ch) { + assert(ch <= MAX_UNICODE); if (unicode_widen(p_unicode, ch) < 0) return -1; PyUnicode_WRITE(PyUnicode_KIND(*p_unicode),
