projects
/
python
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
22eb689
)
bpo-37388: Add PyUnicode_Decode(str, 0) fast-path (GH-14385)
author
Victor Stinner
<vstinner@redhat.com>
Tue, 25 Jun 2019 23:49:32 +0000
(
01:49
+0200)
committer
GitHub
<noreply@github.com>
Tue, 25 Jun 2019 23:49:32 +0000
(
01:49
+0200)
Add a fast-path to PyUnicode_Decode() for size equals to 0.
Objects/unicodeobject.c
patch
|
blob
|
history
diff --git
a/Objects/unicodeobject.c
b/Objects/unicodeobject.c
index b6f3d8f18c4c52c241d83bfe8eea3be12e303dca..51d314b61a52c4d299b502500ba97be8e5d669e3 100644
(file)
--- a/
Objects/unicodeobject.c
+++ b/
Objects/unicodeobject.c
@@
-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);
}