Issue #28927: bytes.fromhex() and bytearray.fromhex() now ignore all ASCII

whitespace, not only spaces.  Patch by Robert Xiao.
This commit is contained in:
Serhiy Storchaka 2016-12-19 18:51:37 +02:00
parent f76df27806
commit dd1da7f74a
5 changed files with 27 additions and 4 deletions

View file

@ -2378,10 +2378,10 @@ _PyBytes_FromHex(PyObject *string, int use_bytearray)
end = str + hexlen;
while (str < end) {
/* skip over spaces in the input */
if (*str == ' ') {
if (Py_ISSPACE(*str)) {
do {
str++;
} while (*str == ' ');
} while (Py_ISSPACE(*str));
if (str >= end)
break;
}