diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2006-04-13 06:06:08 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2006-04-13 06:06:08 (GMT) |
commit | 80d2e591d5c18e46cbb9e3d8c043ae7a32c1c8eb (patch) | |
tree | e638ebc693d554e0f4837f99cbe1177bf1f10234 | |
parent | 1ad9ec276e903914b0a7f3fea2a84f77598202a1 (diff) | |
download | cpython-80d2e591d5c18e46cbb9e3d8c043ae7a32c1c8eb.zip cpython-80d2e591d5c18e46cbb9e3d8c043ae7a32c1c8eb.tar.gz cpython-80d2e591d5c18e46cbb9e3d8c043ae7a32c1c8eb.tar.bz2 |
Revert 34153: Py_UNICODE should not be signed.
-rw-r--r-- | Objects/unicodeobject.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 30ae6f0..6d8f2e4 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -135,14 +135,9 @@ int unicode_resize(register PyUnicodeObject *unicode, /* Resizing shared object (unicode_empty or single character objects) in-place is not allowed. Use PyUnicode_Resize() instead ! */ - if (unicode == unicode_empty || - (unicode->length == 1 && - /* MvL said unicode->str[] may be signed. Python generally assumes - * an int contains at least 32 bits, and we don't use more than - * 32 bits even in a UCS4 build, so casting to unsigned int should - * be correct. - */ - (unsigned int)unicode->str[0] < 256U && + if (unicode == unicode_empty || + (unicode->length == 1 && + unicode->str[0] < 256U && unicode_latin1[unicode->str[0]] == unicode)) { PyErr_SetString(PyExc_SystemError, "can't resize shared unicode objects"); |