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:
@@ -670,7 +670,7 @@ static int Euler_order_set(EulerObject *self, PyObject *value, void *UNUSED(clos
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (((order_str = _PyUnicode_AsString(value)) == NULL) ||
|
||||
if (((order_str = PyUnicode_AsUTF8(value)) == NULL) ||
|
||||
((order = euler_order_from_string(order_str, "euler.order")) == -1)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -499,7 +499,7 @@ static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args)
|
||||
}
|
||||
|
||||
if (vec && PyUnicode_Check(vec)) {
|
||||
axis = _PyUnicode_AsString((PyObject *)vec);
|
||||
axis = PyUnicode_AsUTF8((PyObject *)vec);
|
||||
if (axis == NULL || axis[0] == '\0' || axis[1] != '\0' || axis[0] < 'X' || axis[0] > 'Z') {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
"Matrix.Rotation(): "
|
||||
@@ -768,7 +768,7 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args)
|
||||
|
||||
if (PyUnicode_Check(axis)) { /* ortho projection onto cardinal plane */
|
||||
Py_ssize_t plane_len;
|
||||
const char *plane = _PyUnicode_AsStringAndSize(axis, &plane_len);
|
||||
const char *plane = PyUnicode_AsUTF8AndSize(axis, &plane_len);
|
||||
if (matSize == 2) {
|
||||
if (plane_len == 1 && plane[0] == 'X') {
|
||||
mat[0] = 1.0f;
|
||||
|
||||
@@ -195,7 +195,7 @@ static PyObject *Quaternion_to_swing_twist(QuaternionObject *self, PyObject *axi
|
||||
int axis;
|
||||
|
||||
if (axis_arg && PyUnicode_Check(axis_arg)) {
|
||||
axis_str = _PyUnicode_AsString(axis_arg);
|
||||
axis_str = PyUnicode_AsUTF8(axis_arg);
|
||||
}
|
||||
|
||||
if (axis_str && axis_str[0] >= 'X' && axis_str[0] <= 'Z' && axis_str[1] == 0) {
|
||||
|
||||
Reference in New Issue
Block a user