Forgot to change fmt string for build value as well

This commit is contained in:
Kovid Goyal 2019-02-21 10:24:56 +05:30
parent 405d52eedc
commit 482b24e888
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -633,10 +633,11 @@ bzz_decompress(PyObject *self, PyObject *args) {
PyObject *ans = NULL; PyObject *ans = NULL;
#if PY_MAJOR_VERSION >= 3 #if PY_MAJOR_VERSION >= 3
if (!PyArg_ParseTuple(args, "y#", &(state.raw), &input_len)) #define BYTES_FMT "y#"
#else #else
if (!PyArg_ParseTuple(args, "s#", &(state.raw), &input_len)) #define BYTES_FMT "s#"
#endif #endif
if (!PyArg_ParseTuple(args, BYTES_FMT, &(state.raw), &input_len))
return NULL; return NULL;
state.end = state.raw + input_len - 1; state.end = state.raw + input_len - 1;
@ -680,7 +681,7 @@ end:
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
buflen <<= 8; buflen += (uint8_t)buf[i]; buflen <<= 8; buflen += (uint8_t)buf[i];
} }
ans = Py_BuildValue("s#", buf + 3, MIN(buflen, pos - buf)); ans = Py_BuildValue(BYTES_FMT, buf + 3, MIN(buflen, pos - buf));
} }
if (buf != NULL) free(buf); if (buf != NULL) free(buf);
if (PyErr_Occurred()) return NULL; if (PyErr_Occurred()) return NULL;