Browse Source

Remove PyString and use PyUnicode

test_fixup
Jessica Hair 4 years ago
parent
commit
52b97691e0
2 changed files with 3 additions and 7 deletions
  1. +1
    -1
      libarchive/_libarchive.i
  2. +2
    -6
      libarchive/_libarchive_wrap.c

+ 1
- 1
libarchive/_libarchive.i View File

@@ -360,7 +360,7 @@ extern const char *archive_error_string(struct archive *);
%inline %{
PyObject *archive_read_data_into_str(struct archive *archive, int len) {
PyObject *str = NULL;
if (!(str = PyString_FromStringAndSize(NULL, len))) {
if (!(str = PyUnicode_FromStringAndSize(NULL, len))) {
PyErr_SetString(PyExc_MemoryError, "could not allocate string.");
return NULL;
}


+ 2
- 6
libarchive/_libarchive_wrap.c View File

@@ -3274,11 +3274,7 @@ SWIG_FromCharPtrAndSize(const char* carray, size_t size)
return pchar_descriptor ?
SWIG_InternalNewPointerObj((char *)(carray), pchar_descriptor, 0) : SWIG_Py_Void();
} else {
#if PY_VERSION_HEX >= 0x03000000
return PyUnicode_FromStringAndSize(carray, (int)(size));
#else
return PyString_FromStringAndSize(carray, (int)(size));
#endif
return PyUnicode_FromStringAndSize(carray, (int)(size));
}
} else {
return SWIG_Py_Void();
@@ -3342,7 +3338,7 @@ SWIG_AsVal_unsigned_SS_short (PyObject * obj, unsigned short *val)

PyObject *archive_read_data_into_str(struct archive *archive, int len) {
PyObject *str = NULL;
if (!(str = PyString_FromStringAndSize(NULL, len))) {
if (!(str = PyUnicode_FromStringAndSize(NULL, len))) {
PyErr_SetString(PyExc_MemoryError, "could not allocate string.");
return NULL;
}


Loading…
Cancel
Save