]>
Commit | Line | Data |
---|---|---|
1 | From: Campbell Barton <ideasman42@gmail.com> | |
2 | Date: Mon, 22 Jun 2020 14:51:20 +1000 | |
3 | Subject: fix_FTBFS_with_python3.9 | |
4 | ||
5 | Resolves T78089, no functional changes. | |
6 | --- | |
7 | source/blender/python/mathutils/mathutils_Matrix.c | 16 +++++++++------- | |
8 | source/blender/python/mathutils/mathutils_Quaternion.c | 14 ++++++++------ | |
9 | source/blender/python/mathutils/mathutils_Vector.c | 6 +++--- | |
10 | 3 files changed, 20 insertions(+), 16 deletions(-) | |
11 | ||
12 | diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c | |
13 | index 7a3a92d..d380b61 100644 | |
14 | --- a/source/blender/python/mathutils/mathutils_Matrix.c | |
15 | +++ b/source/blender/python/mathutils/mathutils_Matrix.c | |
16 | @@ -42,7 +42,8 @@ static PyObject *Matrix_copy_notest(MatrixObject *self, const float *matrix); | |
17 | static PyObject *Matrix_copy(MatrixObject *self); | |
18 | static PyObject *Matrix_deepcopy(MatrixObject *self, PyObject *args); | |
19 | static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *value); | |
20 | -static PyObject *matrix__apply_to_copy(PyNoArgsFunction matrix_func, MatrixObject *self); | |
21 | +static PyObject *matrix__apply_to_copy(PyObject *(*matrix_func)(MatrixObject *), | |
22 | + MatrixObject *self); | |
23 | static PyObject *MatrixAccess_CreatePyObject(MatrixObject *matrix, const eMatrixAccess_t type); | |
24 | ||
25 | static int matrix_row_vector_check(MatrixObject *mat, VectorObject *vec, int row) | |
26 | @@ -395,14 +396,15 @@ static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds) | |
27 | return NULL; | |
28 | } | |
29 | ||
30 | -static PyObject *matrix__apply_to_copy(PyNoArgsFunction matrix_func, MatrixObject *self) | |
31 | +static PyObject *matrix__apply_to_copy(PyObject *(*matrix_func)(MatrixObject *), | |
32 | + MatrixObject *self) | |
33 | { | |
34 | PyObject *ret = Matrix_copy(self); | |
35 | if (ret) { | |
36 | - PyObject *ret_dummy = matrix_func(ret); | |
37 | + PyObject *ret_dummy = matrix_func((MatrixObject *)ret); | |
38 | if (ret_dummy) { | |
39 | Py_DECREF(ret_dummy); | |
40 | - return (PyObject *)ret; | |
41 | + return ret; | |
42 | } | |
43 | else { /* error */ | |
44 | Py_DECREF(ret); | |
45 | @@ -1737,7 +1739,7 @@ PyDoc_STRVAR( | |
46 | " .. note:: When the matrix cant be adjugated a :exc:`ValueError` exception is raised.\n"); | |
47 | static PyObject *Matrix_adjugated(MatrixObject *self) | |
48 | { | |
49 | - return matrix__apply_to_copy((PyNoArgsFunction)Matrix_adjugate, self); | |
50 | + return matrix__apply_to_copy(Matrix_adjugate, self); | |
51 | } | |
52 | ||
53 | PyDoc_STRVAR( | |
54 | @@ -1945,7 +1947,7 @@ PyDoc_STRVAR(Matrix_transposed_doc, | |
55 | " :rtype: :class:`Matrix`\n"); | |
56 | static PyObject *Matrix_transposed(MatrixObject *self) | |
57 | { | |
58 | - return matrix__apply_to_copy((PyNoArgsFunction)Matrix_transpose, self); | |
59 | + return matrix__apply_to_copy(Matrix_transpose, self); | |
60 | } | |
61 | ||
62 | /*---------------------------matrix.normalize() ------------------*/ | |
63 | @@ -1991,7 +1993,7 @@ PyDoc_STRVAR(Matrix_normalized_doc, | |
64 | " :rtype: :class:`Matrix`\n"); | |
65 | static PyObject *Matrix_normalized(MatrixObject *self) | |
66 | { | |
67 | - return matrix__apply_to_copy((PyNoArgsFunction)Matrix_normalize, self); | |
68 | + return matrix__apply_to_copy(Matrix_normalize, self); | |
69 | } | |
70 | ||
71 | /*---------------------------matrix.zero() -----------------------*/ | |
72 | diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c | |
73 | index 39d84c1..7ce0ea5 100644 | |
74 | --- a/source/blender/python/mathutils/mathutils_Quaternion.c | |
75 | +++ b/source/blender/python/mathutils/mathutils_Quaternion.c | |
76 | @@ -34,7 +34,8 @@ | |
77 | ||
78 | #define QUAT_SIZE 4 | |
79 | ||
80 | -static PyObject *quat__apply_to_copy(PyNoArgsFunction quat_func, QuaternionObject *self); | |
81 | +static PyObject *quat__apply_to_copy(PyObject *(*quat_func)(QuaternionObject *), | |
82 | + QuaternionObject *self); | |
83 | static void quat__axis_angle_sanitize(float axis[3], float *angle); | |
84 | static PyObject *Quaternion_copy(QuaternionObject *self); | |
85 | static PyObject *Quaternion_deepcopy(QuaternionObject *self, PyObject *args); | |
86 | @@ -463,7 +464,7 @@ PyDoc_STRVAR(Quaternion_normalized_doc, | |
87 | " :rtype: :class:`Quaternion`\n"); | |
88 | static PyObject *Quaternion_normalized(QuaternionObject *self) | |
89 | { | |
90 | - return quat__apply_to_copy((PyNoArgsFunction)Quaternion_normalize, self); | |
91 | + return quat__apply_to_copy(Quaternion_normalize, self); | |
92 | } | |
93 | ||
94 | PyDoc_STRVAR(Quaternion_invert_doc, | |
95 | @@ -490,7 +491,7 @@ PyDoc_STRVAR(Quaternion_inverted_doc, | |
96 | " :rtype: :class:`Quaternion`\n"); | |
97 | static PyObject *Quaternion_inverted(QuaternionObject *self) | |
98 | { | |
99 | - return quat__apply_to_copy((PyNoArgsFunction)Quaternion_invert, self); | |
100 | + return quat__apply_to_copy(Quaternion_invert, self); | |
101 | } | |
102 | ||
103 | PyDoc_STRVAR(Quaternion_identity_doc, | |
104 | @@ -553,7 +554,7 @@ PyDoc_STRVAR(Quaternion_conjugated_doc, | |
105 | " :rtype: :class:`Quaternion`\n"); | |
106 | static PyObject *Quaternion_conjugated(QuaternionObject *self) | |
107 | { | |
108 | - return quat__apply_to_copy((PyNoArgsFunction)Quaternion_conjugate, self); | |
109 | + return quat__apply_to_copy(Quaternion_conjugate, self); | |
110 | } | |
111 | ||
112 | PyDoc_STRVAR(Quaternion_copy_doc, | |
113 | @@ -1385,10 +1386,11 @@ static PyObject *Quaternion_new(PyTypeObject *type, PyObject *args, PyObject *kw | |
114 | return Quaternion_CreatePyObject(quat, type); | |
115 | } | |
116 | ||
117 | -static PyObject *quat__apply_to_copy(PyNoArgsFunction quat_func, QuaternionObject *self) | |
118 | +static PyObject *quat__apply_to_copy(PyObject *(*quat_func)(QuaternionObject *), | |
119 | + QuaternionObject *self) | |
120 | { | |
121 | PyObject *ret = Quaternion_copy(self); | |
122 | - PyObject *ret_dummy = quat_func(ret); | |
123 | + PyObject *ret_dummy = quat_func((QuaternionObject *)ret); | |
124 | if (ret_dummy) { | |
125 | Py_DECREF(ret_dummy); | |
126 | return ret; | |
127 | diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c | |
128 | index 6ea0dd5..c49cde8 100644 | |
129 | --- a/source/blender/python/mathutils/mathutils_Vector.c | |
130 | +++ b/source/blender/python/mathutils/mathutils_Vector.c | |
131 | @@ -96,10 +96,10 @@ static PyObject *Vector_new(PyTypeObject *type, PyObject *args, PyObject *kwds) | |
132 | return Vector_CreatePyObject_alloc(vec, size, type); | |
133 | } | |
134 | ||
135 | -static PyObject *vec__apply_to_copy(PyNoArgsFunction vec_func, VectorObject *self) | |
136 | +static PyObject *vec__apply_to_copy(PyObject *(*vec_func)(VectorObject *), VectorObject *self) | |
137 | { | |
138 | PyObject *ret = Vector_copy(self); | |
139 | - PyObject *ret_dummy = vec_func(ret); | |
140 | + PyObject *ret_dummy = vec_func((VectorObject *)ret); | |
141 | if (ret_dummy) { | |
142 | Py_DECREF(ret_dummy); | |
143 | return (PyObject *)ret; | |
144 | @@ -376,7 +376,7 @@ PyDoc_STRVAR(Vector_normalized_doc, | |
145 | " :rtype: :class:`Vector`\n"); | |
146 | static PyObject *Vector_normalized(VectorObject *self) | |
147 | { | |
148 | - return vec__apply_to_copy((PyNoArgsFunction)Vector_normalize, self); | |
149 | + return vec__apply_to_copy(Vector_normalize, self); | |
150 | } | |
151 | ||
152 | PyDoc_STRVAR(Vector_resize_doc, |