Skip to content

Commit

Permalink
Change the invalid_char value to -1
Browse files Browse the repository at this point in the history
  • Loading branch information
srinivasreddy committed Dec 9, 2024
1 parent 504f4ed commit 7bab683
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Objects/bytesobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -2543,7 +2543,7 @@ _PyBytes_FromHex(PyObject *string, int use_bytearray)

/* Check if we have a second digit */
if (str >= end) {
invalid_char = -2;
invalid_char = -1;
goto error;
}

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

error:
if (invalid_char == -2) {
if (invalid_char == -1) {
PyErr_SetString(PyExc_ValueError,
"fromhex() arg must be of even length");
} else {
Expand Down

0 comments on commit 7bab683

Please sign in to comment.