Commit ed076ed4 authored by Victor Stinner's avatar Victor Stinner Committed by GitHub

bpo-37388: Add PyUnicode_Decode(str, 0) fast-path (GH-14385)

Add a fast-path to PyUnicode_Decode() for size equals to 0.
parent 22eb689c
......@@ -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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment