Skip to content

Commit ee7947a

Browse files
committed
Fix a bug in logic
1 parent a3ba0e7 commit ee7947a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Objects/bytesobject.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2540,8 +2540,13 @@ _PyBytes_FromHex(PyObject *string, int use_bytearray)
25402540
}
25412541
str++;
25422542

2543+
/* Skip spaces after first digit */
2544+
while (str < end && Py_ISSPACE(*str)) {
2545+
str++;
2546+
}
2547+
25432548
/* Check if we have a second digit*/
2544-
if (str >= end || Py_ISSPACE(*str)) {
2549+
if (str >= end) {
25452550
PyErr_SetString(PyExc_ValueError,
25462551
"fromhex() arg must be of even length");
25472552
_PyBytesWriter_Dealloc(&writer);

0 commit comments

Comments
 (0)