Fix T85573: Building with Python 3.10a5 fails

Replace deprecated _PyUnicode_AsString{AndSize} usage.

T83626 still needs to be resolved before 3.10 is usable.
This commit is contained in:
2021-02-13 22:57:01 +11:00
parent 32660201ac
commit dae445d94a
25 changed files with 96 additions and 97 deletions

View File

@@ -267,7 +267,7 @@ static int py_imbuf_filepath_set(Py_ImBuf *self, PyObject *value, void *UNUSED(c
ImBuf *ibuf = self->ibuf;
const Py_ssize_t value_str_len_max = sizeof(ibuf->name);
Py_ssize_t value_str_len;
const char *value_str = _PyUnicode_AsStringAndSize(value, &value_str_len);
const char *value_str = PyUnicode_AsUTF8AndSize(value, &value_str_len);
if (value_str_len >= value_str_len_max) {
PyErr_Format(PyExc_TypeError, "filepath length over %zd", value_str_len_max - 1);
return -1;