diff --git a/Modules/_xxtestfuzz/fuzzer.c b/Modules/_xxtestfuzz/fuzzer.c index a04f1412eefda1..7eeee0b19af3ae 100644 --- a/Modules/_xxtestfuzz/fuzzer.c +++ b/Modules/_xxtestfuzz/fuzzer.c @@ -56,13 +56,11 @@ static int fuzz_builtin_int(const char* data, size_t size) { base = -base; } - PyObject* s = PyUnicode_FromStringAndSize(data, size); + PyObject* s = PyUnicode_DecodeUTF8(data, size, "replace"); if (s == NULL) { - if (PyErr_ExceptionMatches(PyExc_UnicodeDecodeError)) { - PyErr_Clear(); - } return 0; } + PyObject* l = PyLong_FromUnicodeObject(s, base); if (l == NULL && PyErr_ExceptionMatches(PyExc_ValueError)) { PyErr_Clear();