Verified Commit 6aa425ac authored by Karel Koci's avatar Karel Koci 🤘

Fix string conversion for python 2

parent d19c6da9
......@@ -196,7 +196,10 @@ static PyObject *pyuci_set(uci_object *self, PyObject *args) {
PyErr_SetNone(PyExc_NotImplementedError);
return NULL;
} else if (PyUnicode_Check(data)) {
ptr.value = PyUnicode_AsUTF8(data);
PyObject *str_val = PyUnicode_AsUTF8String(data);
if (!str_val)
return NULL;
ptr.value = PyByteArray_AsString(str_val);
if (uci_set(self->ctx, &ptr))
return pyuci_error(self, UciException);
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment