diff options
Diffstat (limited to 'source/blender/python')
44 files changed, 365 insertions, 299 deletions
diff --git a/source/blender/python/bmesh/bmesh_py_api.c b/source/blender/python/bmesh/bmesh_py_api.c index 2e6d1698da9..cc413ad7924 100644 --- a/source/blender/python/bmesh/bmesh_py_api.c +++ b/source/blender/python/bmesh/bmesh_py_api.c @@ -156,14 +156,14 @@ PyDoc_STRVAR(BPy_BM_doc, ".. include:: include__bmesh.rst\n"); static struct PyModuleDef BPy_BM_module_def = { PyModuleDef_HEAD_INIT, - "bmesh", /* m_name */ - BPy_BM_doc, /* m_doc */ - 0, /* m_size */ - BPy_BM_methods, /* m_methods */ - NULL, /* m_slots */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL, /* m_free */ + /*m_name*/ "bmesh", + /*m_doc*/ BPy_BM_doc, + /*m_size*/ 0, + /*m_methods*/ BPy_BM_methods, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; PyObject *BPyInit_bmesh(void) diff --git a/source/blender/python/bmesh/bmesh_py_geometry.c b/source/blender/python/bmesh/bmesh_py_geometry.c index f2af8599807..aed197bc353 100644 --- a/source/blender/python/bmesh/bmesh_py_geometry.c +++ b/source/blender/python/bmesh/bmesh_py_geometry.c @@ -62,14 +62,14 @@ PyDoc_STRVAR(BPy_BM_utils_doc, "This module provides access to bmesh geometry evaluation functions."); static struct PyModuleDef BPy_BM_geometry_module_def = { PyModuleDef_HEAD_INIT, - "bmesh.geometry", /* m_name */ - BPy_BM_utils_doc, /* m_doc */ - 0, /* m_size */ - BPy_BM_geometry_methods, /* m_methods */ - NULL, /* m_slots */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL, /* m_free */ + /*m_name*/ "bmesh.geometry", + /*m_doc*/ BPy_BM_utils_doc, + /*m_size*/ 0, + /*m_methods*/ BPy_BM_geometry_methods, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; PyObject *BPyInit_bmesh_geometry(void) diff --git a/source/blender/python/bmesh/bmesh_py_ops.c b/source/blender/python/bmesh/bmesh_py_ops.c index 35f87172d78..e5ca170599f 100644 --- a/source/blender/python/bmesh/bmesh_py_ops.c +++ b/source/blender/python/bmesh/bmesh_py_ops.c @@ -235,14 +235,14 @@ static struct PyMethodDef BPy_BM_ops_methods[] = { PyDoc_STRVAR(BPy_BM_ops_doc, "Access to BMesh operators"); static struct PyModuleDef BPy_BM_ops_module_def = { PyModuleDef_HEAD_INIT, - "bmesh.ops", /* m_name */ - BPy_BM_ops_doc, /* m_doc */ - 0, /* m_size */ - BPy_BM_ops_methods, /* m_methods */ - NULL, /* m_slots */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL, /* m_free */ + /*m_name*/ "bmesh.ops", + /*m_doc*/ BPy_BM_ops_doc, + /*m_size*/ 0, + /*m_methods*/ BPy_BM_ops_methods, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; PyObject *BPyInit_bmesh_ops(void) diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c index cf20e1349ee..12267ef5b13 100644 --- a/source/blender/python/bmesh/bmesh_py_types.c +++ b/source/blender/python/bmesh/bmesh_py_types.c @@ -7,6 +7,7 @@ #include "BLI_math.h" #include "BLI_sort.h" +#include "BLI_string.h" #include "DNA_material_types.h" #include "DNA_mesh_types.h" @@ -3118,7 +3119,7 @@ static Py_ssize_t bpy_bmelemseq_length(BPy_BMElemSeq *self) } } -static PyObject *bpy_bmelemseq_subscript_int(BPy_BMElemSeq *self, int keynum) +static PyObject *bpy_bmelemseq_subscript_int(BPy_BMElemSeq *self, Py_ssize_t keynum) { BPY_BM_CHECK_OBJ(self); @@ -3735,14 +3736,14 @@ void BPy_BM_init_types(void) static struct PyModuleDef BPy_BM_types_module_def = { PyModuleDef_HEAD_INIT, - "bmesh.types", /* m_name */ - NULL, /* m_doc */ - 0, /* m_size */ - NULL, /* m_methods */ - NULL, /* m_slots */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL, /* m_free */ + /*m_name*/ "bmesh.types", + /*m_doc*/ NULL, + /*m_size*/ 0, + /*m_methods*/ NULL, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; PyObject *BPyInit_bmesh_types(void) @@ -4246,16 +4247,16 @@ char *BPy_BMElem_StringFromHType_ex(const char htype, char ret[32]) /* zero to ensure string is always NULL terminated */ char *ret_ptr = ret; if (htype & BM_VERT) { - ret_ptr += sprintf(ret_ptr, "/%s", BPy_BMVert_Type.tp_name); + ret_ptr += BLI_sprintf(ret_ptr, "/%s", BPy_BMVert_Type.tp_name); } if (htype & BM_EDGE) { - ret_ptr += sprintf(ret_ptr, "/%s", BPy_BMEdge_Type.tp_name); + ret_ptr += BLI_sprintf(ret_ptr, "/%s", BPy_BMEdge_Type.tp_name); } if (htype & BM_FACE) { - ret_ptr += sprintf(ret_ptr, "/%s", BPy_BMFace_Type.tp_name); + ret_ptr += BLI_sprintf(ret_ptr, "/%s", BPy_BMFace_Type.tp_name); } if (htype & BM_LOOP) { - ret_ptr += sprintf(ret_ptr, "/%s", BPy_BMLoop_Type.tp_name); + ret_ptr += BLI_sprintf(ret_ptr, "/%s", BPy_BMLoop_Type.tp_name); } ret[0] = '('; *ret_ptr++ = ')'; diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c b/source/blender/python/bmesh/bmesh_py_types_customdata.c index 2d0e31b9e3f..1288083f8e7 100644 --- a/source/blender/python/bmesh/bmesh_py_types_customdata.c +++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c @@ -740,7 +740,8 @@ static PyObject *bpy_bmlayercollection_subscript_str(BPy_BMLayerCollection *self return NULL; } -static PyObject *bpy_bmlayercollection_subscript_int(BPy_BMLayerCollection *self, int keynum) +static PyObject *bpy_bmlayercollection_subscript_int(BPy_BMLayerCollection *self, + Py_ssize_t keynum) { Py_ssize_t len; BPY_BM_CHECK_OBJ(self); diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c b/source/blender/python/bmesh/bmesh_py_types_meshdata.c index c58c9caf0a8..9bd98f2df53 100644 --- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c +++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c @@ -391,7 +391,7 @@ typedef struct BPy_BMDeformVert { /* Mapping Protocols * ================= */ -static int bpy_bmdeformvert_len(BPy_BMDeformVert *self) +static Py_ssize_t bpy_bmdeformvert_len(BPy_BMDeformVert *self) { return self->data->totweight; } diff --git a/source/blender/python/bmesh/bmesh_py_types_select.c b/source/blender/python/bmesh/bmesh_py_types_select.c index 20bf06e8016..ed25caee74d 100644 --- a/source/blender/python/bmesh/bmesh_py_types_select.c +++ b/source/blender/python/bmesh/bmesh_py_types_select.c @@ -163,7 +163,7 @@ static Py_ssize_t bpy_bmeditselseq_length(BPy_BMEditSelSeq *self) return BLI_listbase_count(&self->bm->selected); } -static PyObject *bpy_bmeditselseq_subscript_int(BPy_BMEditSelSeq *self, int keynum) +static PyObject *bpy_bmeditselseq_subscript_int(BPy_BMEditSelSeq *self, Py_ssize_t keynum) { BMEditSelection *ese; diff --git a/source/blender/python/bmesh/bmesh_py_utils.c b/source/blender/python/bmesh/bmesh_py_utils.c index 6630eb4924e..5eca6f854f6 100644 --- a/source/blender/python/bmesh/bmesh_py_utils.c +++ b/source/blender/python/bmesh/bmesh_py_utils.c @@ -818,14 +818,14 @@ static struct PyMethodDef BPy_BM_utils_methods[] = { PyDoc_STRVAR(BPy_BM_utils_doc, "This module provides access to blenders bmesh data structures."); static struct PyModuleDef BPy_BM_utils_module_def = { PyModuleDef_HEAD_INIT, - "bmesh.utils", /* m_name */ - BPy_BM_utils_doc, /* m_doc */ - 0, /* m_size */ - BPy_BM_utils_methods, /* m_methods */ - NULL, /* m_slots */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL, /* m_free */ + /*m_name*/ "bmesh.utils", + /*m_doc*/ BPy_BM_utils_doc, + /*m_size*/ 0, + /*m_methods*/ BPy_BM_utils_methods, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; PyObject *BPyInit_bmesh_utils(void) diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c index a03e0ab31eb..fe64b247d43 100644 --- a/source/blender/python/generic/bgl.c +++ b/source/blender/python/generic/bgl.c @@ -417,11 +417,11 @@ static PyObject *Method_ShaderSource(PyObject *self, PyObject *args); /* Buffer sequence methods */ -static int Buffer_len(Buffer *self); -static PyObject *Buffer_item(Buffer *self, int i); -static PyObject *Buffer_slice(Buffer *self, int begin, int end); -static int Buffer_ass_item(Buffer *self, int i, PyObject *v); -static int Buffer_ass_slice(Buffer *self, int begin, int end, PyObject *seq); +static Py_ssize_t Buffer_len(Buffer *self); +static PyObject *Buffer_item(Buffer *self, Py_ssize_t i); +static PyObject *Buffer_slice(Buffer *self, Py_ssize_t begin, Py_ssize_t end); +static int Buffer_ass_item(Buffer *self, Py_ssize_t i, PyObject *v); +static int Buffer_ass_slice(Buffer *self, Py_ssize_t begin, Py_ssize_t end, PyObject *seq); static PyObject *Buffer_subscript(Buffer *self, PyObject *item); static int Buffer_ass_subscript(Buffer *self, PyObject *item, PyObject *value); @@ -794,12 +794,12 @@ static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject /* Buffer sequence methods */ -static int Buffer_len(Buffer *self) +static Py_ssize_t Buffer_len(Buffer *self) { return self->dimensions[0]; } -static PyObject *Buffer_item(Buffer *self, int i) +static PyObject *Buffer_item(Buffer *self, Py_ssize_t i) { if (i >= self->dimensions[0] || i < 0) { PyErr_SetString(PyExc_IndexError, "array index out of range"); @@ -837,10 +837,9 @@ static PyObject *Buffer_item(Buffer *self, int i) return NULL; } -static PyObject *Buffer_slice(Buffer *self, int begin, int end) +static PyObject *Buffer_slice(Buffer *self, Py_ssize_t begin, Py_ssize_t end) { PyObject *list; - int count; if (begin < 0) { begin = 0; @@ -854,13 +853,13 @@ static PyObject *Buffer_slice(Buffer *self, int begin, int end) list = PyList_New(end - begin); - for (count = begin; count < end; count++) { + for (Py_ssize_t count = begin; count < end; count++) { PyList_SET_ITEM(list, count - begin, Buffer_item(self, count)); } return list; } -static int Buffer_ass_item(Buffer *self, int i, PyObject *v) +static int Buffer_ass_item(Buffer *self, Py_ssize_t i, PyObject *v) { if (i >= self->dimensions[0] || i < 0) { PyErr_SetString(PyExc_IndexError, "array assignment index out of range"); @@ -895,10 +894,11 @@ static int Buffer_ass_item(Buffer *self, int i, PyObject *v) } } -static int Buffer_ass_slice(Buffer *self, int begin, int end, PyObject *seq) +static int Buffer_ass_slice(Buffer *self, Py_ssize_t begin, Py_ssize_t end, PyObject *seq) { PyObject *item; - int count, err = 0; + int err = 0; + Py_ssize_t count; if (begin < 0) { begin = 0; @@ -918,7 +918,7 @@ static int Buffer_ass_slice(Buffer *self, int begin, int end, PyObject *seq) return -1; } - /* re-use count var */ + /* Re-use count variable. */ if ((count = PySequence_Size(seq)) != (end - begin)) { PyErr_Format(PyExc_TypeError, "buffer[:] = value, size mismatch in assignment. " @@ -1376,14 +1376,14 @@ BGL_Wrap(TexImage3DMultisample, static struct PyModuleDef BGL_module_def = { PyModuleDef_HEAD_INIT, - "bgl", /* m_name */ - NULL, /* m_doc */ - 0, /* m_size */ - NULL, /* m_methods */ - NULL, /* m_slots */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL, /* m_free */ + /*m_name*/ "bgl", + /*m_doc*/ NULL, + /*m_size*/ 0, + /*m_methods*/ NULL, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; static void py_module_dict_add_int(PyObject *dict, const char *name, int value) diff --git a/source/blender/python/generic/bl_math_py_api.c b/source/blender/python/generic/bl_math_py_api.c index 19958a99df9..47a1687d20b 100644 --- a/source/blender/python/generic/bl_math_py_api.c +++ b/source/blender/python/generic/bl_math_py_api.c @@ -129,14 +129,14 @@ static PyMethodDef M_bl_math_methods[] = { static struct PyModuleDef M_bl_math_module_def = { PyModuleDef_HEAD_INIT, - "bl_math", /* m_name */ - M_bl_math_doc, /* m_doc */ - 0, /* m_size */ - M_bl_math_methods, /* m_methods */ - NULL, /* m_slots */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL, /* m_free */ + /*m_name*/ "bl_math", + /*m_doc*/ M_bl_math_doc, + /*m_size*/ 0, + /*m_methods*/ M_bl_math_methods, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; PyMODINIT_FUNC BPyInit_bl_math(void) diff --git a/source/blender/python/generic/blf_py_api.c b/source/blender/python/generic/blf_py_api.c index 979a581463e..2b7c5ed7e55 100644 --- a/source/blender/python/generic/blf_py_api.c +++ b/source/blender/python/generic/blf_py_api.c @@ -466,14 +466,14 @@ static PyMethodDef BLF_methods[] = { PyDoc_STRVAR(BLF_doc, "This module provides access to Blender's text drawing functions."); static struct PyModuleDef BLF_module_def = { PyModuleDef_HEAD_INIT, - "blf", /* m_name */ - BLF_doc, /* m_doc */ - 0, /* m_size */ - BLF_methods, /* m_methods */ - NULL, /* m_slots */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL, /* m_free */ + /*m_name*/ "blf", + /*m_doc*/ BLF_doc, + /*m_size*/ 0, + /*m_methods*/ BLF_methods, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; PyObject *BPyInit_blf(void) diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c index a5599a3622e..9a6568355af 100644 --- a/source/blender/python/generic/idprop_py_api.c +++ b/source/blender/python/generic/idprop_py_api.c @@ -1695,12 +1695,12 @@ static PyMethodDef BPy_IDArray_methods[] = { {NULL, NULL, 0, NULL}, }; -static int BPy_IDArray_Len(BPy_IDArray *self) +static Py_ssize_t BPy_IDArray_Len(BPy_IDArray *self) { return self->prop->len; } -static PyObject *BPy_IDArray_GetItem(BPy_IDArray *self, int index) +static PyObject *BPy_IDArray_GetItem(BPy_IDArray *self, Py_ssize_t index) { if (index < 0 || index >= self->prop->len) { PyErr_SetString(PyExc_IndexError, "index out of range!"); @@ -1722,7 +1722,7 @@ static PyObject *BPy_IDArray_GetItem(BPy_IDArray *self, int index) return NULL; } -static int BPy_IDArray_SetItem(BPy_IDArray *self, int index, PyObject *value) +static int BPy_IDArray_SetItem(BPy_IDArray *self, Py_ssize_t index, PyObject *value) { if (index < 0 || index >= self->prop->len) { PyErr_SetString(PyExc_RuntimeError, "index out of range!"); @@ -2092,14 +2092,14 @@ static PyObject *BPy_IDGroup_ViewItems_CreatePyObject(BPy_IDProperty *group) static struct PyModuleDef IDProp_types_module_def = { PyModuleDef_HEAD_INIT, - "idprop.types", /* m_name */ - NULL, /* m_doc */ - 0, /* m_size */ - NULL, /* m_methods */ - NULL, /* m_slots */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL, /* m_free */ + /*m_name*/ "idprop.types", + /*m_doc*/ NULL, + /*m_size*/ 0, + /*m_methods*/ NULL, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; static PyObject *BPyInit_idprop_types(void) @@ -2141,14 +2141,14 @@ PyDoc_STRVAR(IDProp_module_doc, "This module provides access id property types (currently mainly for docs)."); static struct PyModuleDef IDProp_module_def = { PyModuleDef_HEAD_INIT, - "idprop", /* m_name */ - IDProp_module_doc, /* m_doc */ - 0, /* m_size */ - IDProp_methods, /* m_methods */ - NULL, /* m_slots */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL, /* m_free */ + /*m_name*/ "idprop", + /*m_doc*/ IDProp_module_doc, + /*m_size*/ 0, + /*m_methods*/ IDProp_methods, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; PyObject *BPyInit_idprop(void) diff --git a/source/blender/python/generic/imbuf_py_api.c b/source/blender/python/generic/imbuf_py_api.c index c6a817fa01c..77d450d496e 100644 --- a/source/blender/python/generic/imbuf_py_api.c +++ b/source/blender/python/generic/imbuf_py_api.c @@ -557,14 +557,14 @@ PyDoc_STRVAR(IMB_doc, ":class:`bpy.types.Image` data-block context.\n"); static struct PyModuleDef IMB_module_def = { PyModuleDef_HEAD_INIT, - "imbuf", /* m_name */ - IMB_doc, /* m_doc */ - 0, /* m_size */ - IMB_methods, /* m_methods */ - NULL, /* m_slots */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL, /* m_free */ + /*m_name*/ "imbuf", + /*m_doc*/ IMB_doc, + /*m_size*/ 0, + /*m_methods*/ IMB_methods, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; PyObject *BPyInit_imbuf(void) @@ -601,14 +601,14 @@ PyDoc_STRVAR(IMB_types_doc, static struct PyModuleDef IMB_types_module_def = { PyModuleDef_HEAD_INIT, - "imbuf.types", /* m_name */ - IMB_types_doc, /* m_doc */ - 0, /* m_size */ - NULL, /* m_methods */ - NULL, /* m_slots */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL, /* m_free */ + /*m_name*/ "imbuf.types", + /*m_doc*/ IMB_types_doc, + /*m_size*/ 0, + /*m_methods*/ NULL, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; PyObject *BPyInit_imbuf_types(void) diff --git a/source/blender/python/gpu/gpu_py_api.c b/source/blender/python/gpu/gpu_py_api.c index a2075566f31..8f5897be649 100644 --- a/source/blender/python/gpu/gpu_py_api.c +++ b/source/blender/python/gpu/gpu_py_api.c @@ -32,8 +32,14 @@ PyDoc_STRVAR(pygpu_doc, "Some higher level functions can be found in the `gpu_extras` module."); static struct PyModuleDef pygpu_module_def = { PyModuleDef_HEAD_INIT, - .m_name = "gpu", - .m_doc = pygpu_doc, + /*m_name*/ "gpu", + /*m_doc*/ pygpu_doc, + /*m_size*/ 0, + /*m_methods*/ NULL, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; PyObject *BPyInit_gpu(void) diff --git a/source/blender/python/gpu/gpu_py_buffer.c b/source/blender/python/gpu/gpu_py_buffer.c index 3dc141f400d..51bda9b4941 100644 --- a/source/blender/python/gpu/gpu_py_buffer.c +++ b/source/blender/python/gpu/gpu_py_buffer.c @@ -159,7 +159,7 @@ static BPyGPUBuffer *pygpu_buffer_make_from_data(PyObject *parent, return buffer; } -static PyObject *pygpu_buffer__sq_item(BPyGPUBuffer *self, int i) +static PyObject *pygpu_buffer__sq_item(BPyGPUBuffer *self, Py_ssize_t i) { if (i >= self->shape[0] || i < 0) { PyErr_SetString(PyExc_IndexError, "array index out of range"); @@ -200,10 +200,10 @@ static PyObject *pygpu_buffer__sq_item(BPyGPUBuffer *self, int i) static PyObject *pygpu_buffer_to_list(BPyGPUBuffer *self) { - int i, len = self->shape[0]; + const Py_ssize_t len = self->shape[0]; PyObject *list = PyList_New(len); - for (i = 0; i < len; i++) { + for (Py_ssize_t i = 0; i < len; i++) { PyList_SET_ITEM(list, i, pygpu_buffer__sq_item(self, i)); } @@ -313,7 +313,7 @@ static PyObject *pygpu_buffer__tp_repr(BPyGPUBuffer *self) return repr; } -static int pygpu_buffer__sq_ass_item(BPyGPUBuffer *self, int i, PyObject *v); +static int pygpu_buffer__sq_ass_item(BPyGPUBuffer *self, Py_ssize_t i, PyObject *v); static int pygpu_buffer_ass_slice(BPyGPUBuffer *self, Py_ssize_t begin, @@ -430,7 +430,7 @@ static int pygpu_buffer__tp_is_gc(BPyGPUBuffer *self) /* BPyGPUBuffer sequence methods */ -static int pygpu_buffer__sq_length(BPyGPUBuffer *self) +static Py_ssize_t pygpu_buffer__sq_length(BPyGPUBuffer *self) { return self->shape[0]; } @@ -458,7 +458,7 @@ static PyObject *pygpu_buffer_slice(BPyGPUBuffer *self, Py_ssize_t begin, Py_ssi return list; } -static int pygpu_buffer__sq_ass_item(BPyGPUBuffer *self, int i, PyObject *v) +static int pygpu_buffer__sq_ass_item(BPyGPUBuffer *self, Py_ssize_t i, PyObject *v) { if (i >= self->shape[0] || i < 0) { PyErr_SetString(PyExc_IndexError, "array assignment index out of range"); diff --git a/source/blender/python/gpu/gpu_py_capabilities.c b/source/blender/python/gpu/gpu_py_capabilities.c index dea057bf8e3..2345982eb42 100644 --- a/source/blender/python/gpu/gpu_py_capabilities.c +++ b/source/blender/python/gpu/gpu_py_capabilities.c @@ -301,9 +301,14 @@ static struct PyMethodDef pygpu_capabilities__tp_methods[] = { PyDoc_STRVAR(pygpu_capabilities__tp_doc, "This module provides access to the GPU capabilities."); static PyModuleDef pygpu_capabilities_module_def = { PyModuleDef_HEAD_INIT, - .m_name = "gpu.capabilities", - .m_doc = pygpu_capabilities__tp_doc, - .m_methods = pygpu_capabilities__tp_methods, + /*m_name*/ "gpu.capabilities", + /*m_doc*/ pygpu_capabilities__tp_doc, + /*m_size*/ 0, + /*m_methods*/ pygpu_capabilities__tp_methods, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; PyObject *bpygpu_capabilities_init(void) diff --git a/source/blender/python/gpu/gpu_py_matrix.c b/source/blender/python/gpu/gpu_py_matrix.c index 18925a101da..7d80f763162 100644 --- a/source/blender/python/gpu/gpu_py_matrix.c +++ b/source/blender/python/gpu/gpu_py_matrix.c @@ -528,9 +528,14 @@ static struct PyMethodDef pygpu_matrix__tp_methods[] = { PyDoc_STRVAR(pygpu_matrix__tp_doc, "This module provides access to the matrix stack."); static PyModuleDef pygpu_matrix_module_def = { PyModuleDef_HEAD_INIT, - .m_name = "gpu.matrix", - .m_doc = pygpu_matrix__tp_doc, - .m_methods = pygpu_matrix__tp_methods, + /*m_name*/ "gpu.matrix", + /*m_doc*/ pygpu_matrix__tp_doc, + /*m_size*/ 0, + /*m_methods*/ pygpu_matrix__tp_methods, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; PyObject *bpygpu_matrix_init(void) diff --git a/source/blender/python/gpu/gpu_py_platform.c b/source/blender/python/gpu/gpu_py_platform.c index c6e964405fa..5f9f653a3c4 100644 --- a/source/blender/python/gpu/gpu_py_platform.c +++ b/source/blender/python/gpu/gpu_py_platform.c @@ -141,9 +141,14 @@ static struct PyMethodDef pygpu_platform__tp_methods[] = { PyDoc_STRVAR(pygpu_platform__tp_doc, "This module provides access to GPU Platform definitions."); static PyModuleDef pygpu_platform_module_def = { PyModuleDef_HEAD_INIT, - .m_name = "gpu.platform", - .m_doc = pygpu_platform__tp_doc, - .m_methods = pygpu_platform__tp_methods, + /*m_name*/ "gpu.platform", + /*m_doc*/ pygpu_platform__tp_doc, + /*m_size*/ 0, + /*m_methods*/ pygpu_platform__tp_methods, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; PyObject *bpygpu_platform_init(void) diff --git a/source/blender/python/gpu/gpu_py_select.c b/source/blender/python/gpu/gpu_py_select.c index 6d11e94433e..02e06e0ffd5 100644 --- a/source/blender/python/gpu/gpu_py_select.c +++ b/source/blender/python/gpu/gpu_py_select.c @@ -58,9 +58,14 @@ static struct PyMethodDef pygpu_select__tp_methods[] = { PyDoc_STRVAR(pygpu_select__tp_doc, "This module provides access to selection."); static PyModuleDef pygpu_select_module_def = { PyModuleDef_HEAD_INIT, - .m_name = "gpu.select", - .m_doc = pygpu_select__tp_doc, - .m_methods = pygpu_select__tp_methods, + /*m_name*/ "gpu.select", + /*m_doc*/ pygpu_select__tp_doc, + /*m_size*/ 0, + /*m_methods*/ pygpu_select__tp_methods, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; PyObject *bpygpu_select_init(void) diff --git a/source/blender/python/gpu/gpu_py_shader.c b/source/blender/python/gpu/gpu_py_shader.c index a57b00e671e..7222cb1696a 100644 --- a/source/blender/python/gpu/gpu_py_shader.c +++ b/source/blender/python/gpu/gpu_py_shader.c @@ -923,9 +923,14 @@ PyDoc_STRVAR(pygpu_shader_module__tp_doc, "\n" PYDOC_BUILTIN_SHADER_DESCRIPTION); static PyModuleDef pygpu_shader_module_def = { PyModuleDef_HEAD_INIT, - .m_name = "gpu.shader", - .m_doc = pygpu_shader_module__tp_doc, - .m_methods = pygpu_shader_module__tp_methods, + /*m_name*/ "gpu.shader", + /*m_doc*/ pygpu_shader_module__tp_doc, + /*m_size*/ 0, + /*m_methods*/ pygpu_shader_module__tp_methods, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; /** \} */ diff --git a/source/blender/python/gpu/gpu_py_state.c b/source/blender/python/gpu/gpu_py_state.c index 35ecc2aff40..f17a3fecfdd 100644 --- a/source/blender/python/gpu/gpu_py_state.c +++ b/source/blender/python/gpu/gpu_py_state.c @@ -431,9 +431,14 @@ static struct PyMethodDef pygpu_state__tp_methods[] = { PyDoc_STRVAR(pygpu_state__tp_doc, "This module provides access to the gpu state."); static PyModuleDef pygpu_state_module_def = { PyModuleDef_HEAD_INIT, - .m_name = "gpu.state", - .m_doc = pygpu_state__tp_doc, - .m_methods = pygpu_state__tp_methods, + /*m_name*/ "gpu.state", + /*m_doc*/ pygpu_state__tp_doc, + /*m_size*/ 0, + /*m_methods*/ pygpu_state__tp_methods, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; PyObject *bpygpu_state_init(void) diff --git a/source/blender/python/gpu/gpu_py_texture.c b/source/blender/python/gpu/gpu_py_texture.c index ae004341304..11b44a2a35e 100644 --- a/source/blender/python/gpu/gpu_py_texture.c +++ b/source/blender/python/gpu/gpu_py_texture.c @@ -565,9 +565,14 @@ static struct PyMethodDef pygpu_texture__m_methods[] = { PyDoc_STRVAR(pygpu_texture__m_doc, "This module provides utils for textures."); static PyModuleDef pygpu_texture_module_def = { PyModuleDef_HEAD_INIT, - .m_name = "gpu.texture", - .m_doc = pygpu_texture__m_doc, - .m_methods = pygpu_texture__m_methods, + /*m_name*/ "gpu.texture", + /*m_doc*/ pygpu_texture__m_doc, + /*m_size*/ 0, + /*m_methods*/ pygpu_texture__m_methods, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; /** \} */ diff --git a/source/blender/python/gpu/gpu_py_types.c b/source/blender/python/gpu/gpu_py_types.c index eccbebbd8dd..b5cabd93b42 100644 --- a/source/blender/python/gpu/gpu_py_types.c +++ b/source/blender/python/gpu/gpu_py_types.c @@ -19,7 +19,14 @@ static struct PyModuleDef pygpu_types_module_def = { PyModuleDef_HEAD_INIT, - .m_name = "gpu.types", + /*m_name*/ "gpu.types", + /*m_doc*/ NULL, + /*m_size*/ 0, + /*m_methods*/ NULL, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; PyObject *bpygpu_types_init(void) diff --git a/source/blender/python/intern/bpy_app_icons.c b/source/blender/python/intern/bpy_app_icons.c index 918d96d9f44..65edbb597ca 100644 --- a/source/blender/python/intern/bpy_app_icons.c +++ b/source/blender/python/intern/bpy_app_icons.c @@ -162,14 +162,14 @@ static struct PyMethodDef M_AppIcons_methods[] = { static struct PyModuleDef M_AppIcons_module_def = { PyModuleDef_HEAD_INIT, - "bpy.app.icons", /* m_name */ - NULL, /* m_doc */ - 0, /* m_size */ - M_AppIcons_methods, /* m_methods */ - NULL, /* m_slots */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL, /* m_free */ + /*m_name*/ "bpy.app.icons", + /*m_doc*/ NULL, + /*m_size*/ 0, + /*m_methods*/ M_AppIcons_methods, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; PyObject *BPY_app_icons_module(void) diff --git a/source/blender/python/intern/bpy_app_timers.c b/source/blender/python/intern/bpy_app_timers.c index 4adc200357b..e5de5121e9e 100644 --- a/source/blender/python/intern/bpy_app_timers.c +++ b/source/blender/python/intern/bpy_app_timers.c @@ -164,14 +164,14 @@ static struct PyMethodDef M_AppTimers_methods[] = { static struct PyModuleDef M_AppTimers_module_def = { PyModuleDef_HEAD_INIT, - "bpy.app.timers", /* m_name */ - NULL, /* m_doc */ - 0, /* m_size */ - M_AppTimers_methods, /* m_methods */ - NULL, /* m_slots */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL, /* m_free */ + /*m_name*/ "bpy.app.timers", + /*m_doc*/ NULL, + /*m_size*/ 0, + /*m_methods*/ M_AppTimers_methods, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; PyObject *BPY_app_timers_module(void) diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 3a095f4b9f3..a83dc464e43 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -768,14 +768,14 @@ extern void main_python_exit(void); static struct PyModuleDef bpy_proxy_def = { PyModuleDef_HEAD_INIT, - "bpy", /* m_name */ - NULL, /* m_doc */ - 0, /* m_size */ - NULL, /* m_methods */ - NULL, /* m_slots */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - bpy_module_free, /* m_free */ + /*m_name*/ "bpy", + /*m_doc*/ NULL, + /*m_size*/ 0, + /*m_methods*/ NULL, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ bpy_module_free, }; typedef struct { diff --git a/source/blender/python/intern/bpy_msgbus.c b/source/blender/python/intern/bpy_msgbus.c index 4e41c44cab4..835ef8f7f1f 100644 --- a/source/blender/python/intern/bpy_msgbus.c +++ b/source/blender/python/intern/bpy_msgbus.c @@ -393,8 +393,14 @@ static struct PyMethodDef BPy_msgbus_methods[] = { static struct PyModuleDef _bpy_msgbus_def = { PyModuleDef_HEAD_INIT, - .m_name = "msgbus", - .m_methods = BPy_msgbus_methods, + /*m_name*/ "msgbus", + /*m_doc*/ NULL, + /*m_size*/ 0, + /*m_methods*/ BPy_msgbus_methods, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; PyObject *BPY_msgbus_module(void) diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c index 2db8c08cfd4..546e67a521f 100644 --- a/source/blender/python/intern/bpy_operator.c +++ b/source/blender/python/intern/bpy_operator.c @@ -493,14 +493,14 @@ static struct PyMethodDef bpy_ops_methods[] = { static struct PyModuleDef bpy_ops_module = { PyModuleDef_HEAD_INIT, - "_bpy.ops", - NULL, - -1, /* multiple "initialization" just copies the module dict. */ - bpy_ops_methods, - NULL, - NULL, - NULL, - NULL, + /*m_name*/ "_bpy.ops", + /*m_doc*/ NULL, + /*m_size*/ -1, /* multiple "initialization" just copies the module dict. */ + /*m_methods*/ bpy_ops_methods, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; PyObject *BPY_operator_module(void) diff --git a/source/blender/python/intern/bpy_path.c b/source/blender/python/intern/bpy_path.c index f3a1a7cb1df..6b9a09b636b 100644 --- a/source/blender/python/intern/bpy_path.c +++ b/source/blender/python/intern/bpy_path.c @@ -22,14 +22,14 @@ extern const char *imb_ext_audio[]; /*----------------------------MODULE INIT-------------------------*/ static struct PyModuleDef _bpy_path_module_def = { PyModuleDef_HEAD_INIT, - "_bpy_path", /* m_name */ - NULL, /* m_doc */ - 0, /* m_size */ - NULL, /* m_methods */ - NULL, /* m_slots */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL, /* m_free */ + /*m_name*/ "_bpy_path", + /*m_doc*/ NULL, + /*m_size*/ 0, + /*m_methods*/ NULL, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; PyObject *BPyInit__bpy_path(void) diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index b6c75f7a793..dec4c65e48d 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -4621,21 +4621,25 @@ static int props_clear(PyObject *UNUSED(self)) return 0; } -static struct PyModuleDef props_module = { - PyModuleDef_HEAD_INIT, - "bpy.props", +PyDoc_STRVAR( + props_module_doc, "This module defines properties to extend Blender's internal data. The result of these " "functions" " is used to assign properties to classes registered with Blender and can't be used " "directly.\n" "\n" - ".. note:: All parameters to these functions must be passed as keywords.\n", - -1, /* multiple "initialization" just copies the module dict. */ - props_methods, - NULL, - props_visit, - props_clear, - NULL, + ".. note:: All parameters to these functions must be passed as keywords.\n"); + +static struct PyModuleDef props_module = { + PyModuleDef_HEAD_INIT, + /*m_name*/ "bpy.props", + /*m_doc*/ props_module_doc, + /*m_size*/ -1, /* multiple "initialization" just copies the module dict. */ + /*m_methods*/ props_methods, + /*m_slots*/ NULL, + /*m_traverse*/ props_visit, + /*m_clear*/ props_clear, + /*m_free*/ NULL, }; PyObject *BPY_rna_props(void) diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 908c93388a9..c61cab5aa6f 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -993,7 +993,7 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self) } if (len != -1) { - sprintf(--c, "[%d]", len); + BLI_sprintf(--c, "[%d]", len); } /* If a pointer, try to print name of pointer target too. */ @@ -2328,7 +2328,7 @@ static int pyrna_prop_collection_ass_subscript_int(BPy_PropertyRNA *self, return 0; } -static PyObject *pyrna_prop_array_subscript_int(BPy_PropertyArrayRNA *self, int keynum) +static PyObject *pyrna_prop_array_subscript_int(BPy_PropertyArrayRNA *self, Py_ssize_t keynum) { int len; @@ -2883,7 +2883,7 @@ static PyObject *pyrna_prop_array_subscript(BPy_PropertyArrayRNA *self, PyObject if (key_slice->start == Py_None && key_slice->stop == Py_None) { /* NOTE: no significant advantage with optimizing [:] slice as with collections, * but include here for consistency with collection slice func */ - const Py_ssize_t len = (Py_ssize_t)pyrna_prop_array_length(self); + const Py_ssize_t len = pyrna_prop_array_length(self); return pyrna_prop_array_subscript_slice(self, &self->ptr, self->prop, 0, len, len); } @@ -3497,8 +3497,10 @@ PyDoc_STRVAR(pyrna_struct_keys_doc, " :return: custom property keys.\n" " :rtype: :class:`idprop.type.IDPropertyGroupViewKeys`\n" "\n" BPY_DOC_ID_PROP_TYPE_NOTE); -static PyObject *pyrna_struct_keys(BPy_PropertyRNA *self) +static PyObject *pyrna_struct_keys(BPy_StructRNA *self) { + PYRNA_STRUCT_CHECK_OBJ(self); + if (RNA_struct_idprops_check(self->ptr.type) == 0) { PyErr_SetString(PyExc_TypeError, "bpy_struct.keys(): this type doesn't support IDProperties"); return NULL; @@ -3518,8 +3520,10 @@ PyDoc_STRVAR(pyrna_struct_items_doc, " :return: custom property key, value pairs.\n" " :rtype: :class:`idprop.type.IDPropertyGroupViewItems`\n" "\n" BPY_DOC_ID_PROP_TYPE_NOTE); -static PyObject *pyrna_struct_items(BPy_PropertyRNA *self) +static PyObject *pyrna_struct_items(BPy_StructRNA *self) { + PYRNA_STRUCT_CHECK_OBJ(self); + if (RNA_struct_idprops_check(self->ptr.type) == 0) { PyErr_SetString(PyExc_TypeError, "bpy_struct.items(): this type doesn't support IDProperties"); return NULL; @@ -3539,8 +3543,10 @@ PyDoc_STRVAR(pyrna_struct_values_doc, " :return: custom property values.\n" " :rtype: :class:`idprop.type.IDPropertyGroupViewValues`\n" "\n" BPY_DOC_ID_PROP_TYPE_NOTE); -static PyObject *pyrna_struct_values(BPy_PropertyRNA *self) +static PyObject *pyrna_struct_values(BPy_StructRNA *self) { + PYRNA_STRUCT_CHECK_OBJ(self); + if (RNA_struct_idprops_check(self->ptr.type) == 0) { PyErr_SetString(PyExc_TypeError, "bpy_struct.values(): this type doesn't support IDProperties"); @@ -7672,14 +7678,14 @@ static struct PyMethodDef bpy_types_module_methods[] = { PyDoc_STRVAR(bpy_types_module_doc, "Access to internal Blender types"); static struct PyModuleDef bpy_types_module_def = { PyModuleDef_HEAD_INIT, - "bpy.types", /* m_name */ - bpy_types_module_doc, /* m_doc */ - sizeof(struct BPy_TypesModule_State), /* m_size */ - bpy_types_module_methods, /* m_methods */ - NULL, /* m_slots */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL, /* m_free */ + /*m_name*/ "bpy.types", + /*m_doc*/ bpy_types_module_doc, + /*m_size*/ sizeof(struct BPy_TypesModule_State), + /*m_methods*/ bpy_types_module_methods, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; PyObject *BPY_rna_types(void) diff --git a/source/blender/python/intern/bpy_utils_previews.c b/source/blender/python/intern/bpy_utils_previews.c index aa79ac56347..83e74816020 100644 --- a/source/blender/python/intern/bpy_utils_previews.c +++ b/source/blender/python/intern/bpy_utils_previews.c @@ -163,14 +163,14 @@ PyDoc_STRVAR( "(low-level API, not exposed to final users)."); static struct PyModuleDef bpy_utils_previews_module = { PyModuleDef_HEAD_INIT, - "bpy._utils_previews", - bpy_utils_previews_doc, - 0, - bpy_utils_previews_methods, - NULL, - NULL, - NULL, - NULL, + /*m_name*/ "bpy._utils_previews", + /*m_doc*/ bpy_utils_previews_doc, + /*m_size*/ 0, + /*m_methods*/ bpy_utils_previews_methods, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; PyObject *BPY_utils_previews_module(void) diff --git a/source/blender/python/intern/bpy_utils_units.c b/source/blender/python/intern/bpy_utils_units.c index 075a68f31f9..95d7f4f2eb7 100644 --- a/source/blender/python/intern/bpy_utils_units.c +++ b/source/blender/python/intern/bpy_utils_units.c @@ -336,14 +336,14 @@ PyDoc_STRVAR(bpyunits_doc, "This module contains some data/methods regarding uni static struct PyModuleDef bpyunits_module = { PyModuleDef_HEAD_INIT, - "bpy.utils.units", - bpyunits_doc, - -1, /* multiple "initialization" just copies the module dict. */ - bpyunits_methods, - NULL, - NULL, - NULL, - NULL, + /*m_name*/ "bpy.utils.units", + /*m_doc*/ bpyunits_doc, + /*m_size*/ -1, /* multiple "initialization" just copies the module dict. */ + /*m_methods*/ bpyunits_methods, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; PyObject *BPY_utils_units(void) diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c index c4c0659100b..ef5339c3aa3 100644 --- a/source/blender/python/mathutils/mathutils.c +++ b/source/blender/python/mathutils/mathutils.c @@ -766,14 +766,14 @@ static struct PyMethodDef M_Mathutils_methods[] = { static struct PyModuleDef M_Mathutils_module_def = { PyModuleDef_HEAD_INIT, - "mathutils", /* m_name */ - M_Mathutils_doc, /* m_doc */ - 0, /* m_size */ - M_Mathutils_methods, /* m_methods */ - NULL, /* m_slots */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL, /* m_free */ + /*m_name*/ "mathutils", + /*m_doc*/ M_Mathutils_doc, + /*m_size*/ 0, + /*m_methods*/ M_Mathutils_methods, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; /* submodules only */ diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c index e4f1ea87563..1a1ea1a2535 100644 --- a/source/blender/python/mathutils/mathutils_Color.c +++ b/source/blender/python/mathutils/mathutils_Color.c @@ -351,13 +351,13 @@ static Py_hash_t Color_hash(ColorObject *self) * \{ */ /** Sequence length: `len(object)`. */ -static int Color_len(ColorObject *UNUSED(self)) +static Py_ssize_t Color_len(ColorObject *UNUSED(self)) { return COLOR_SIZE; } /** Sequence accessor (get): `x = object[i]`. */ -static PyObject *Color_item(ColorObject *self, int i) +static PyObject *Color_item(ColorObject *self, Py_ssize_t i) { if (i < 0) { i = COLOR_SIZE - i; @@ -378,7 +378,7 @@ static PyObject *Color_item(ColorObject *self, int i) } /** Sequence accessor (set): `object[i] = x`. */ -static int Color_ass_item(ColorObject *self, int i, PyObject *value) +static int Color_ass_item(ColorObject *self, Py_ssize_t i, PyObject *value) { float f; diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c index d72ec5bbc77..551e5d6706d 100644 --- a/source/blender/python/mathutils/mathutils_Euler.c +++ b/source/blender/python/mathutils/mathutils_Euler.c @@ -434,13 +434,13 @@ static Py_hash_t Euler_hash(EulerObject *self) * \{ */ /** Sequence length: `len(object)`. */ -static int Euler_len(EulerObject *UNUSED(self)) +static Py_ssize_t Euler_len(EulerObject *UNUSED(self)) { return EULER_SIZE; } /** Sequence accessor (get): `x = object[i]`. */ -static PyObject *Euler_item(EulerObject *self, int i) +static PyObject *Euler_item(EulerObject *self, Py_ssize_t i) { if (i < 0) { i = EULER_SIZE - i; @@ -461,7 +461,7 @@ static PyObject *Euler_item(EulerObject *self, int i) } /** Sequence accessor (set): `object[i] = x`. */ -static int Euler_ass_item(EulerObject *self, int i, PyObject *value) +static int Euler_ass_item(EulerObject *self, Py_ssize_t i, PyObject *value) { float f; diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index 858b01b2a84..21ad79bc94d 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.c +++ b/source/blender/python/mathutils/mathutils_Matrix.c @@ -2379,7 +2379,7 @@ static Py_hash_t Matrix_hash(MatrixObject *self) * \{ */ /** Sequence length: `len(object)`. */ -static int Matrix_len(MatrixObject *self) +static Py_ssize_t Matrix_len(MatrixObject *self) { return self->row_num; } @@ -2388,7 +2388,7 @@ static int Matrix_len(MatrixObject *self) * Sequence accessor (get): `x = object[i]`. * \note the wrapped vector gives direct access to the matrix data. */ -static PyObject *Matrix_item_row(MatrixObject *self, int row) +static PyObject *Matrix_item_row(MatrixObject *self, Py_ssize_t row) { if (BaseMath_ReadCallback_ForWrite(self) == -1) { return NULL; @@ -2407,7 +2407,7 @@ static PyObject *Matrix_item_row(MatrixObject *self, int row) * Sequence accessor (get): `x = object.col[i]`. * \note the wrapped vector gives direct access to the matrix data. */ -static PyObject *Matrix_item_col(MatrixObject *self, int col) +static PyObject *Matrix_item_col(MatrixObject *self, Py_ssize_t col) { if (BaseMath_ReadCallback_ForWrite(self) == -1) { return NULL; @@ -3633,15 +3633,15 @@ static int MatrixAccess_len(MatrixAccessObject *self) return (self->type == MAT_ACCESS_ROW) ? self->matrix_user->row_num : self->matrix_user->col_num; } -static PyObject *MatrixAccess_slice(MatrixAccessObject *self, int begin, int end) +static PyObject *MatrixAccess_slice(MatrixAccessObject *self, Py_ssize_t begin, Py_ssize_t end) { PyObject *tuple; - int count; + Py_ssize_t count; /* row/col access */ MatrixObject *matrix_user = self->matrix_user; int matrix_access_len; - PyObject *(*Matrix_item_new)(MatrixObject *, int); + PyObject *(*Matrix_item_new)(MatrixObject *, Py_ssize_t); if (self->type == MAT_ACCESS_ROW) { matrix_access_len = matrix_user->row_num; diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c index 4c64746b764..f2348713433 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.c +++ b/source/blender/python/mathutils/mathutils_Quaternion.c @@ -881,13 +881,13 @@ static Py_hash_t Quaternion_hash(QuaternionObject *self) * \{ */ /** Sequence length: `len(object)`. */ -static int Quaternion_len(QuaternionObject *UNUSED(self)) +static Py_ssize_t Quaternion_len(QuaternionObject *UNUSED(self)) { return QUAT_SIZE; } /** Sequence accessor (get): `x = object[i]`. */ -static PyObject *Quaternion_item(QuaternionObject *self, int i) +static PyObject *Quaternion_item(QuaternionObject *self, Py_ssize_t i) { if (i < 0) { i = QUAT_SIZE - i; @@ -908,7 +908,7 @@ static PyObject *Quaternion_item(QuaternionObject *self, int i) } /** Sequence accessor (set): `object[i] = x`. */ -static int Quaternion_ass_item(QuaternionObject *self, int i, PyObject *ob) +static int Quaternion_ass_item(QuaternionObject *self, Py_ssize_t i, PyObject *ob) { float f; diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c index 0f534e76e73..c5a002a6058 100644 --- a/source/blender/python/mathutils/mathutils_Vector.c +++ b/source/blender/python/mathutils/mathutils_Vector.c @@ -1667,7 +1667,7 @@ static Py_hash_t Vector_hash(VectorObject *self) * \{ */ /** Sequence length: `len(object)`. */ -static int Vector_len(VectorObject *self) +static Py_ssize_t Vector_len(VectorObject *self) { return self->vec_num; } @@ -1699,7 +1699,7 @@ static PyObject *vector_item_internal(VectorObject *self, int i, const bool is_a } /** Sequence accessor (get): `x = object[i]`. */ -static PyObject *Vector_item(VectorObject *self, int i) +static PyObject *Vector_item(VectorObject *self, Py_ssize_t i) { return vector_item_internal(self, i, false); } @@ -1747,7 +1747,7 @@ static int vector_ass_item_internal(VectorObject *self, int i, PyObject *value, } /** Sequence accessor (set): `object[i] = x`. */ -static int Vector_ass_item(VectorObject *self, int i, PyObject *value) +static int Vector_ass_item(VectorObject *self, Py_ssize_t i, PyObject *value) { return vector_ass_item_internal(self, i, value, false); } diff --git a/source/blender/python/mathutils/mathutils_bvhtree.c b/source/blender/python/mathutils/mathutils_bvhtree.c index 11f8d57397e..7b6c444515b 100644 --- a/source/blender/python/mathutils/mathutils_bvhtree.c +++ b/source/blender/python/mathutils/mathutils_bvhtree.c @@ -1293,14 +1293,14 @@ PyDoc_STRVAR(py_bvhtree_doc, "BVH tree structures for proximity searches and ray casts on geometry."); static struct PyModuleDef bvhtree_moduledef = { PyModuleDef_HEAD_INIT, - "mathutils.bvhtree", /* m_name */ - py_bvhtree_doc, /* m_doc */ - 0, /* m_size */ - NULL, /* m_methods */ - NULL, /* m_slots */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL, /* m_free */ + /*m_name*/ "mathutils.bvhtree", + /*m_doc*/ py_bvhtree_doc, + /*m_size*/ 0, + /*m_methods*/ NULL, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; PyMODINIT_FUNC PyInit_mathutils_bvhtree(void) diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c index 52ea2a9ed31..59a3bc40b1c 100644 --- a/source/blender/python/mathutils/mathutils_geometry.c +++ b/source/blender/python/mathutils/mathutils_geometry.c @@ -1793,14 +1793,14 @@ static PyMethodDef M_Geometry_methods[] = { static struct PyModuleDef M_Geometry_module_def = { PyModuleDef_HEAD_INIT, - "mathutils.geometry", /* m_name */ - M_Geometry_doc, /* m_doc */ - 0, /* m_size */ - M_Geometry_methods, /* m_methods */ - NULL, /* m_slots */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL, /* m_free */ + /*m_name*/ "mathutils.geometry", + /*m_doc*/ M_Geometry_doc, + /*m_size*/ 0, + /*m_methods*/ M_Geometry_methods, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; /*----------------------------MODULE INIT-------------------------*/ diff --git a/source/blender/python/mathutils/mathutils_interpolate.c b/source/blender/python/mathutils/mathutils_interpolate.c index 10f42d9b070..76a0fc55774 100644 --- a/source/blender/python/mathutils/mathutils_interpolate.c +++ b/source/blender/python/mathutils/mathutils_interpolate.c @@ -89,14 +89,14 @@ static PyMethodDef M_Interpolate_methods[] = { static struct PyModuleDef M_Interpolate_module_def = { PyModuleDef_HEAD_INIT, - "mathutils.interpolate", /* m_name */ - M_Interpolate_doc, /* m_doc */ - 0, /* m_size */ - M_Interpolate_methods, /* m_methods */ - NULL, /* m_slots */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL, /* m_free */ + /*m_name*/ "mathutils.interpolate", + /*m_doc*/ M_Interpolate_doc, + /*m_size*/ 0, + /*m_methods*/ M_Interpolate_methods, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; /*----------------------------MODULE INIT-------------------------*/ diff --git a/source/blender/python/mathutils/mathutils_kdtree.c b/source/blender/python/mathutils/mathutils_kdtree.c index 02d9482b575..ace8ccdeb2a 100644 --- a/source/blender/python/mathutils/mathutils_kdtree.c +++ b/source/blender/python/mathutils/mathutils_kdtree.c @@ -428,14 +428,14 @@ PyTypeObject PyKDTree_Type = { PyDoc_STRVAR(py_kdtree_doc, "Generic 3-dimensional kd-tree to perform spatial searches."); static struct PyModuleDef kdtree_moduledef = { PyModuleDef_HEAD_INIT, - "mathutils.kdtree", /* m_name */ - py_kdtree_doc, /* m_doc */ - 0, /* m_size */ - NULL, /* m_methods */ - NULL, /* m_slots */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL, /* m_free */ + /*m_name*/ "mathutils.kdtree", + /*m_doc*/ py_kdtree_doc, + /*m_size*/ 0, + /*m_methods*/ NULL, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; PyMODINIT_FUNC PyInit_mathutils_kdtree(void) diff --git a/source/blender/python/mathutils/mathutils_noise.c b/source/blender/python/mathutils/mathutils_noise.c index 3c564142160..869201bbcfd 100644 --- a/source/blender/python/mathutils/mathutils_noise.c +++ b/source/blender/python/mathutils/mathutils_noise.c @@ -1085,14 +1085,14 @@ static PyMethodDef M_Noise_methods[] = { static struct PyModuleDef M_Noise_module_def = { PyModuleDef_HEAD_INIT, - "mathutils.noise", /* m_name */ - M_Noise_doc, /* m_doc */ - 0, /* m_size */ - M_Noise_methods, /* m_methods */ - NULL, /* m_slots */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL, /* m_free */ + /*m_name*/ "mathutils.noise", + /*m_doc*/ M_Noise_doc, + /*m_size*/ 0, + /*m_methods*/ M_Noise_methods, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; /*----------------------------MODULE INIT-------------------------*/ |