Issue #28769: The result of PyUnicode_AsUTF8AndSize() and PyUnicode_AsUTF8()

is now of type "const char *" rather of "char *".
This commit is contained in:
Serhiy Storchaka 2017-01-22 23:07:07 +02:00
parent d528791096
commit 2a404b63d4
9 changed files with 26 additions and 13 deletions

View file

@ -890,10 +890,10 @@ PyObject_GetAttr(PyObject *v, PyObject *name)
if (tp->tp_getattro != NULL)
return (*tp->tp_getattro)(v, name);
if (tp->tp_getattr != NULL) {
char *name_str = PyUnicode_AsUTF8(name);
const char *name_str = PyUnicode_AsUTF8(name);
if (name_str == NULL)
return NULL;
return (*tp->tp_getattr)(v, name_str);
return (*tp->tp_getattr)(v, (char *)name_str);
}
PyErr_Format(PyExc_AttributeError,
"'%.50s' object has no attribute '%U'",
@ -934,10 +934,10 @@ PyObject_SetAttr(PyObject *v, PyObject *name, PyObject *value)
return err;
}
if (tp->tp_setattr != NULL) {
char *name_str = PyUnicode_AsUTF8(name);
const char *name_str = PyUnicode_AsUTF8(name);
if (name_str == NULL)
return -1;
err = (*tp->tp_setattr)(v, name_str, value);
err = (*tp->tp_setattr)(v, (char *)name_str, value);
Py_DECREF(name);
return err;
}