@@ -524,11 +524,11 @@ extern const char *archive_error_string(struct archive *); | |||||
PyObject *archive_read_data_into_str(struct archive *archive, int len) { | PyObject *archive_read_data_into_str(struct archive *archive, int len) { | ||||
PyObject *str = NULL; | PyObject *str = NULL; | ||||
if (!(str = PyUnicode_FromStringAndSize(NULL, len))) { | |||||
if (!(str = PyBytes_FromStringAndSize(NULL, len))) { | |||||
PyErr_SetString(PyExc_MemoryError, "could not allocate string."); | PyErr_SetString(PyExc_MemoryError, "could not allocate string."); | ||||
return NULL; | return NULL; | ||||
} | } | ||||
if (len != archive_read_data(archive, PyUnicode_AS_DATA(str), len)) { | |||||
if (len != archive_read_data(archive, PyBytes_AS_STRING(str), len)) { | |||||
PyErr_SetString(PyExc_RuntimeError, "could not read requested data."); | PyErr_SetString(PyExc_RuntimeError, "could not read requested data."); | ||||
return NULL; | return NULL; | ||||
} | } | ||||
@@ -3196,11 +3196,11 @@ SWIG_AsVal_unsigned_SS_short (PyObject * obj, unsigned short *val) | |||||
PyObject *archive_read_data_into_str(struct archive *archive, int len) { | PyObject *archive_read_data_into_str(struct archive *archive, int len) { | ||||
PyObject *str = NULL; | PyObject *str = NULL; | ||||
if (!(str = PyUnicode_FromStringAndSize(NULL, len))) { | |||||
if (!(str = PyBytes_FromStringAndSize(NULL, len))) { | |||||
PyErr_SetString(PyExc_MemoryError, "could not allocate string."); | PyErr_SetString(PyExc_MemoryError, "could not allocate string."); | ||||
return NULL; | return NULL; | ||||
} | } | ||||
if (len != archive_read_data(archive, PyUnicode_AS_DATA(str), len)) { | |||||
if (len != archive_read_data(archive, PyBytes_AS_STRING(str), len)) { | |||||
PyErr_SetString(PyExc_RuntimeError, "could not read requested data."); | PyErr_SetString(PyExc_RuntimeError, "could not read requested data."); | ||||
return NULL; | return NULL; | ||||
} | } | ||||