Kaydet (Commit) 2c4a0724 authored tarafından Christian Heimes's avatar Christian Heimes

Fixed issue #1973: bytes.fromhex('') raises SystemError

üst c04dac08
......@@ -2772,7 +2772,7 @@ string_fromhex(PyObject *cls, PyObject *args)
}
buf[j++] = (top << 4) + bot;
}
if (_PyString_Resize(&newstring, j) < 0)
if (j != byteslen && _PyString_Resize(&newstring, j) < 0)
goto error;
return newstring;
......@@ -2788,7 +2788,7 @@ string_getnewargs(PyStringObject *v)
return Py_BuildValue("(s#)", v->ob_sval, Py_SIZE(v));
}
static PyMethodDef
string_methods[] = {
{"__getnewargs__", (PyCFunction)string_getnewargs, METH_NOARGS},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment