Mercurial > cpython-lru_cache-weakref
diff Objects/unicodeobject.c @ 38606:30605bf95ef8 2.4
Don't crash on Py_UNICODE values < 0. Fixes #1454485.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Mon, 05 Jun 2006 10:43:57 +0000 |
| parents | fea5d2fd9b8a |
| children | 2f6b42aead94 |
line wrap: on
line diff
--- a/Objects/unicodeobject.c Mon Jun 05 01:09:46 2006 +0000 +++ b/Objects/unicodeobject.c Mon Jun 05 10:43:57 2006 +0000 @@ -319,7 +319,9 @@ /* Single character Unicode objects in the Latin-1 range are shared when using this constructor */ - if (size == 1 && *u < 256) { + /* XXX In Python 2.4, Py_UNICODE can, unfortunately, be a signed + type. */ + if (size == 1 && *u >= 0 && *u < 256) { unicode = unicode_latin1[*u]; if (!unicode) { unicode = _PyUnicode_New(1);
