Browse Source

Attempt to fix API for 3.10 compatibility

test_fixup
Richard Young 3 years ago
parent
commit
a5f43e4a58
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      libarchive/_libarchive_wrap.c

+ 3
- 3
libarchive/_libarchive_wrap.c View File

@@ -760,7 +760,7 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
#define PyString_Size(str) PyBytes_Size(str)
#define PyString_InternFromString(key) PyUnicode_InternFromString(key)
#define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE
#define PyString_AS_STRING(x) PyUnicode_AS_STRING(x)
#define PyString_AS_STRING(x) PyUnicode_AsUTF8(x)
#define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x)

#endif
@@ -3199,7 +3199,7 @@ PyObject *archive_read_data_into_str(struct archive *archive, int len) {
PyErr_SetString(PyExc_MemoryError, "could not allocate string.");
return NULL;
}
if (len != archive_read_data(archive, PyString_AS_STRING(str), len)) {
if (len != archive_read_data(archive, (void*)PyString_AS_STRING(str), len)) {
PyErr_SetString(PyExc_RuntimeError, "could not read requested data.");
return NULL;
}
@@ -3208,7 +3208,7 @@ PyObject *archive_read_data_into_str(struct archive *archive, int len) {

PyObject *archive_write_data_from_str(struct archive *archive, PyObject *str) {
int len = PyString_Size(str);
if (!archive_write_data(archive, PyString_AS_STRING(str), len)) {
if (!archive_write_data(archive, (const void *)PyString_AS_STRING(str), len)) {
PyErr_SetString(PyExc_RuntimeError, "could not write requested data.");
return NULL;
}


Loading…
Cancel
Save