Skip to content

Commit 7bab683

Browse files
committed
Change the invalid_char value to -1
1 parent 504f4ed commit 7bab683

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Objects/bytesobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2543,7 +2543,7 @@ _PyBytes_FromHex(PyObject *string, int use_bytearray)
25432543

25442544
/* Check if we have a second digit */
25452545
if (str >= end) {
2546-
invalid_char = -2;
2546+
invalid_char = -1;
25472547
goto error;
25482548
}
25492549

@@ -2560,7 +2560,7 @@ _PyBytes_FromHex(PyObject *string, int use_bytearray)
25602560
return _PyBytesWriter_Finish(&writer, buf);
25612561

25622562
error:
2563-
if (invalid_char == -2) {
2563+
if (invalid_char == -1) {
25642564
PyErr_SetString(PyExc_ValueError,
25652565
"fromhex() arg must be of even length");
25662566
} else {

0 commit comments

Comments
 (0)