mirror of
https://github.com/python/cpython.git
synced 2024-11-23 18:04:37 +08:00
bpo-37388: Add PyUnicode_Decode(str, 0) fast-path (GH-14385)
Add a fast-path to PyUnicode_Decode() for size equals to 0.
This commit is contained in:
parent
22eb689cf3
commit
ed076ed467
@ -3354,6 +3354,10 @@ PyUnicode_Decode(const char *s,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (size == 0) {
|
||||
_Py_RETURN_UNICODE_EMPTY();
|
||||
}
|
||||
|
||||
if (encoding == NULL) {
|
||||
return PyUnicode_DecodeUTF8Stateful(s, size, errors, NULL);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user