mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Issue #28769: The result of PyUnicode_AsUTF8AndSize() and PyUnicode_AsUTF8()
is now of type "const char *" rather of "char *".
This commit is contained in:
parent
d528791096
commit
2a404b63d4
9 changed files with 26 additions and 13 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue