mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Special case normalization of empty strings. Fixes #924361.
Backported to 2.3.
This commit is contained in:
parent
e5fced781b
commit
61e40bd897
2 changed files with 8 additions and 0 deletions
|
@ -515,6 +515,13 @@ unicodedata_normalize(PyObject *self, PyObject *args)
|
|||
&form, &PyUnicode_Type, &input))
|
||||
return NULL;
|
||||
|
||||
if (PyUnicode_GetSize(input) == 0) {
|
||||
/* Special case empty input strings, since resizing
|
||||
them later would cause internal errors. */
|
||||
Py_INCREF(input);
|
||||
return input;
|
||||
}
|
||||
|
||||
if (strcmp(form, "NFC") == 0)
|
||||
return nfc_nfkc(input, 0);
|
||||
if (strcmp(form, "NFKC") == 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue