diff options
Diffstat (limited to 'source/blender/python')
49 files changed, 2131 insertions, 2397 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 37e2b009f55..e5ca170599f 100644 --- a/source/blender/python/bmesh/bmesh_py_ops.c +++ b/source/blender/python/bmesh/bmesh_py_ops.c @@ -146,82 +146,54 @@ static PyGetSetDef bpy_bmesh_op_getseters[] = { * ===== */ static PyTypeObject bmesh_op_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "BMeshOpFunc", /* tp_name */ - sizeof(BPy_BMeshOpFunc), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - NULL, /* tp_dealloc */ - 0, /* tp_vectorcall_offset */ - NULL, /* getattrfunc tp_getattr; */ - NULL, /* setattrfunc tp_setattr; */ - NULL, - /* tp_compare */ /* DEPRECATED in python 3.0! */ - (reprfunc)bpy_bmesh_op_repr, /* tp_repr */ - - /* Method suites for standard classes */ - - NULL, /* PyNumberMethods *tp_as_number; */ - NULL, /* PySequenceMethods *tp_as_sequence; */ - NULL, /* PyMappingMethods *tp_as_mapping; */ - - /* More standard operations (here for binary compatibility) */ - - NULL, /* hashfunc tp_hash; */ - (ternaryfunc)BPy_BMO_call, /* ternaryfunc tp_call; */ - NULL, /* reprfunc tp_str; */ - - /* will only use these if this is a subtype of a py class */ - NULL, /* getattrofunc tp_getattro; */ - NULL, /* setattrofunc tp_setattro; */ - - /* Functions to access object as input/output buffer */ - NULL, /* PyBufferProcs *tp_as_buffer; */ - - /*** Flags to define presence of optional/expanded features ***/ - Py_TPFLAGS_DEFAULT, /* long tp_flags; */ - - NULL, /* char *tp_doc; Documentation string */ - /*** Assigned meaning in release 2.0 ***/ - /* call function for all accessible objects */ - NULL, /* traverseproc tp_traverse; */ - - /* delete references to contained objects */ - NULL, /* inquiry tp_clear; */ - - /*** Assigned meaning in release 2.1 ***/ - /*** rich comparisons ***/ - NULL, /* richcmpfunc tp_richcompare; */ - - /*** weak reference enabler ***/ - 0, - /*** Added in release 2.2 ***/ - /* Iterators */ - NULL, /* getiterfunc tp_iter; */ - NULL, /* iternextfunc tp_iternext; */ - - /*** Attribute descriptor and subclassing stuff ***/ - NULL, /* struct PyMethodDef *tp_methods; */ - NULL, /* struct PyMemberDef *tp_members; */ - bpy_bmesh_op_getseters, /* struct PyGetSetDef *tp_getset; */ - NULL, /* struct _typeobject *tp_base; */ - NULL, /* PyObject *tp_dict; */ - NULL, /* descrgetfunc tp_descr_get; */ - NULL, /* descrsetfunc tp_descr_set; */ - 0, /* long tp_dictoffset; */ - NULL, /* initproc tp_init; */ - NULL, /* allocfunc tp_alloc; */ - NULL, /* newfunc tp_new; */ - /* Low-level free-memory routine */ - NULL, /* freefunc tp_free; */ - /* For PyObject_IS_GC */ - NULL, /* inquiry tp_is_gc; */ - NULL, /* PyObject *tp_bases; */ - /* method resolution order */ - NULL, /* PyObject *tp_mro; */ - NULL, /* PyObject *tp_cache; */ - NULL, /* PyObject *tp_subclasses; */ - NULL, /* PyObject *tp_weaklist; */ - NULL, + /*tp_name*/ PyVarObject_HEAD_INIT(NULL, 0) "BMeshOpFunc", + /*tp_basicsize*/ sizeof(BPy_BMeshOpFunc), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ NULL, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ (reprfunc)bpy_bmesh_op_repr, + /*tp_as_number*/ NULL, + /*tp_as_sequence*/ NULL, + /*tp_as_mapping*/ NULL, + /*tp_hash*/ NULL, + /*tp_call*/ (ternaryfunc)BPy_BMO_call, + /*tp_str*/ NULL, + /*tp_getattro*/ NULL, + /*tp_setattro*/ NULL, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT, + /*tp_doc*/ NULL, + /*tp_traverse*/ NULL, + /*tp_clear*/ NULL, + /*tp_richcompare*/ NULL, + /*tp_weaklistoffset*/ 0, + /*tp_iter*/ NULL, + /*tp_iternext*/ NULL, + /*tp_methods*/ NULL, + /*tp_members*/ NULL, + /*tp_getset*/ bpy_bmesh_op_getseters, + /*tp_base*/ NULL, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ NULL, + /*tp_alloc*/ NULL, + /*tp_new*/ NULL, + /*tp_free*/ NULL, + /*tp_is_gc*/ NULL, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, }; /* bmesh module 'bmesh.ops' @@ -263,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 364adb5458b..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); @@ -3313,31 +3314,30 @@ static int bpy_bmelem_ass_subscript(BPy_BMElem *self, BPy_BMLayerItem *key, PyOb } static PySequenceMethods bpy_bmelemseq_as_sequence = { - (lenfunc)bpy_bmelemseq_length, /* sq_length */ - NULL, /* sq_concat */ - NULL, /* sq_repeat */ - (ssizeargfunc)bpy_bmelemseq_subscript_int, - /* sq_item */ /* Only set this so PySequence_Check() returns True */ - NULL, /* sq_slice */ - (ssizeobjargproc)NULL, /* sq_ass_item */ - NULL, /* *was* sq_ass_slice */ - (objobjproc)bpy_bmelemseq_contains, /* sq_contains */ - (binaryfunc)NULL, /* sq_inplace_concat */ - (ssizeargfunc)NULL, /* sq_inplace_repeat */ + /*sq_length*/ (lenfunc)bpy_bmelemseq_length, + /*sq_concat*/ NULL, + /*sq_repeat*/ NULL, + /* Only set this so `PySequence_Check()` returns True. */ + /*sq_item*/ (ssizeargfunc)bpy_bmelemseq_subscript_int, + /*was_sq_slice*/ NULL, + /*sq_ass_item*/ NULL, + /*was_sq_ass_slice*/ NULL, + /*sq_contains*/ (objobjproc)bpy_bmelemseq_contains, + /*sq_inplace_concat*/ NULL, + /*sq_inplace_repeat*/ NULL, }; static PyMappingMethods bpy_bmelemseq_as_mapping = { - (lenfunc)bpy_bmelemseq_length, /* mp_length */ - (binaryfunc)bpy_bmelemseq_subscript, /* mp_subscript */ - (objobjargproc)NULL, /* mp_ass_subscript */ + /*mp_len*/ (lenfunc)bpy_bmelemseq_length, + /*mp_subscript*/ (binaryfunc)bpy_bmelemseq_subscript, + /*mp_ass_subscript*/ (objobjargproc)NULL, }; /* for customdata access */ static PyMappingMethods bpy_bm_elem_as_mapping = { - (lenfunc)NULL, - /* mp_length */ /* keep this empty, messes up 'if elem: ...' test */ - (binaryfunc)bpy_bmelem_subscript, /* mp_subscript */ - (objobjargproc)bpy_bmelem_ass_subscript, /* mp_ass_subscript */ + /*mp_len*/ (lenfunc)NULL, /* Keep this empty, messes up `if elem: ...` test. */ + /*mp_subscript*/ (binaryfunc)bpy_bmelem_subscript, + /*mp_ass_subscript*/ (objobjargproc)bpy_bmelem_ass_subscript, }; /* Iterator @@ -3736,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) @@ -4247,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 58bfb922327..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); @@ -871,23 +872,23 @@ static int bpy_bmlayercollection_contains(BPy_BMLayerCollection *self, PyObject } static PySequenceMethods bpy_bmlayercollection_as_sequence = { - (lenfunc)bpy_bmlayercollection_length, /* sq_length */ - NULL, /* sq_concat */ - NULL, /* sq_repeat */ - (ssizeargfunc)bpy_bmlayercollection_subscript_int, - /* sq_item */ /* Only set this so PySequence_Check() returns True */ - NULL, /* sq_slice */ - (ssizeobjargproc)NULL, /* sq_ass_item */ - NULL, /* *was* sq_ass_slice */ - (objobjproc)bpy_bmlayercollection_contains, /* sq_contains */ - (binaryfunc)NULL, /* sq_inplace_concat */ - (ssizeargfunc)NULL, /* sq_inplace_repeat */ + /*sq_length*/ (lenfunc)bpy_bmlayercollection_length, + /*sq_concat*/ NULL, + /*sq_repeat*/ NULL, + /* Only set this so `PySequence_Check()` returns True. */ + /*sq_item*/ (ssizeargfunc)bpy_bmlayercollection_subscript_int, + /*was_sq_slice*/ NULL, /* DEPRECATED. */ + /*sq_ass_item*/ NULL, + /*was_sq_ass_slice*/ NULL, /* DEPRECATED. */ + /*sq_contains*/ (objobjproc)bpy_bmlayercollection_contains, + /*sq_inplace_concat*/ NULL, + /*sq_inplace_repeat*/ NULL, }; static PyMappingMethods bpy_bmlayercollection_as_mapping = { - (lenfunc)bpy_bmlayercollection_length, /* mp_length */ - (binaryfunc)bpy_bmlayercollection_subscript, /* mp_subscript */ - (objobjargproc)NULL, /* mp_ass_subscript */ + /*mp_len*/ (lenfunc)bpy_bmlayercollection_length, + /*mp_subscript*/ (binaryfunc)bpy_bmlayercollection_subscript, + /*mp_ass_subscript*/ (objobjargproc)NULL, }; /* Iterator diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c b/source/blender/python/bmesh/bmesh_py_types_meshdata.c index 9f200734786..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; } @@ -486,26 +486,24 @@ static int bpy_bmdeformvert_contains(BPy_BMDeformVert *self, PyObject *value) /* only defined for __contains__ */ static PySequenceMethods bpy_bmdeformvert_as_sequence = { - (lenfunc)bpy_bmdeformvert_len, /* sq_length */ - NULL, /* sq_concat */ - NULL, /* sq_repeat */ - + /*sq_length*/ (lenfunc)bpy_bmdeformvert_len, + /*sq_concat*/ NULL, + /*sq_repeat*/ NULL, /* NOTE: if this is set #PySequence_Check() returns True, * but in this case we don't want to be treated as a seq. */ - NULL, /* sq_item */ - - NULL, /* sq_slice */ - NULL, /* sq_ass_item */ - NULL, /* *was* sq_ass_slice */ - (objobjproc)bpy_bmdeformvert_contains, /* sq_contains */ - (binaryfunc)NULL, /* sq_inplace_concat */ - (ssizeargfunc)NULL, /* sq_inplace_repeat */ + /*sq_item*/ NULL, + /*was_sq_slice*/ NULL, /* DEPRECATED. */ + /*sq_ass_item*/ NULL, + /*was_sq_ass_slice*/ NULL, /* DEPRECATED. */ + /*sq_contains*/ (objobjproc)bpy_bmdeformvert_contains, + /*sq_inplace_concat*/ NULL, + /*sq_inplace_repeat*/ NULL, }; static PyMappingMethods bpy_bmdeformvert_as_mapping = { - (lenfunc)bpy_bmdeformvert_len, - (binaryfunc)bpy_bmdeformvert_subscript, - (objobjargproc)bpy_bmdeformvert_ass_subscript, + /*mp_len*/ (lenfunc)bpy_bmdeformvert_len, + /*mp_subscript*/ (binaryfunc)bpy_bmdeformvert_subscript, + /*mp_ass_subscript*/ (objobjargproc)bpy_bmdeformvert_ass_subscript, }; /* Methods diff --git a/source/blender/python/bmesh/bmesh_py_types_select.c b/source/blender/python/bmesh/bmesh_py_types_select.c index 93bce055b12..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; @@ -291,23 +291,23 @@ static int bpy_bmeditselseq_contains(BPy_BMEditSelSeq *self, PyObject *value) } static PySequenceMethods bpy_bmeditselseq_as_sequence = { - (lenfunc)bpy_bmeditselseq_length, /* sq_length */ - NULL, /* sq_concat */ - NULL, /* sq_repeat */ - (ssizeargfunc)bpy_bmeditselseq_subscript_int, - /* sq_item */ /* Only set this so PySequence_Check() returns True */ - NULL, /* sq_slice */ - (ssizeobjargproc)NULL, /* sq_ass_item */ - NULL, /* *was* sq_ass_slice */ - (objobjproc)bpy_bmeditselseq_contains, /* sq_contains */ - (binaryfunc)NULL, /* sq_inplace_concat */ - (ssizeargfunc)NULL, /* sq_inplace_repeat */ + /*sq_length*/ (lenfunc)bpy_bmeditselseq_length, + /*sq_concat*/ NULL, + /*sq_repeat*/ NULL, + /* Only set this so `PySequence_Check()` returns True. */ + /*sq_item*/ (ssizeargfunc)bpy_bmeditselseq_subscript_int, + /*sq_slice */ NULL, + /*sq_ass_item */ NULL, + /*was_sq_ass_slice*/ NULL, + /*sq_contains*/ (objobjproc)bpy_bmeditselseq_contains, + /*sq_inplace_concat*/ NULL, + /*sq_inplace_repeat*/ NULL, }; static PyMappingMethods bpy_bmeditselseq_as_mapping = { - (lenfunc)bpy_bmeditselseq_length, /* mp_length */ - (binaryfunc)bpy_bmeditselseq_subscript, /* mp_subscript */ - (objobjargproc)NULL, /* mp_ass_subscript */ + /*mp_len*/ (lenfunc)bpy_bmeditselseq_length, + /*mp_subscript*/ (binaryfunc)bpy_bmeditselseq_subscript, + /*mp_ass_subscript*/ (objobjargproc)NULL, }; /* Iterator 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 fd5f2e77672..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); @@ -491,22 +491,22 @@ static bool compare_dimensions(int ndim, const int *dim1, const Py_ssize_t *dim2 * \{ */ static PySequenceMethods Buffer_SeqMethods = { - (lenfunc)Buffer_len, /* sq_length */ - (binaryfunc)NULL, /* sq_concat */ - (ssizeargfunc)NULL, /* sq_repeat */ - (ssizeargfunc)Buffer_item, /* sq_item */ - (ssizessizeargfunc)NULL, /* sq_slice, deprecated, handled in Buffer_item */ - (ssizeobjargproc)Buffer_ass_item, /* sq_ass_item */ - (ssizessizeobjargproc)NULL, /* sq_ass_slice, deprecated handled in Buffer_ass_item */ - (objobjproc)NULL, /* sq_contains */ - (binaryfunc)NULL, /* sq_inplace_concat */ - (ssizeargfunc)NULL, /* sq_inplace_repeat */ + /*sq_length*/ (lenfunc)Buffer_len, + /*sq_concat*/ NULL, + /*sq_repeat*/ NULL, + /*sq_item*/ (ssizeargfunc)Buffer_item, + /*was_sq_slice*/ NULL, /* DEPRECATED. Handled by #Buffer_item. */ + /*sq_ass_item*/ (ssizeobjargproc)Buffer_ass_item, + /*was_sq_ass_slice*/ NULL, /* DEPRECATED. Handled by #Buffer_ass_item. */ + /*sq_contains*/ NULL, + /*sq_inplace_concat*/ NULL, + /*sq_inplace_repeat*/ NULL, }; static PyMappingMethods Buffer_AsMapping = { - (lenfunc)Buffer_len, - (binaryfunc)Buffer_subscript, - (objobjargproc)Buffer_ass_subscript, + /*mp_len*/ (lenfunc)Buffer_len, + /*mp_subscript*/ (binaryfunc)Buffer_subscript, + /*mp_ass_subscript*/ (objobjargproc)Buffer_ass_subscript, }; static void Buffer_dealloc(Buffer *self); @@ -568,72 +568,55 @@ static PyGetSetDef Buffer_getseters[] = { }; PyTypeObject BGL_bufferType = { - PyVarObject_HEAD_INIT(NULL, 0) "bgl.Buffer", /* tp_name */ - sizeof(Buffer), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)Buffer_dealloc, /* tp_dealloc */ - (printfunc)NULL, /* tp_print */ - NULL, /* tp_getattr */ - NULL, /* tp_setattr */ - NULL, /* tp_compare */ - (reprfunc)Buffer_repr, /* tp_repr */ - NULL, /* tp_as_number */ - &Buffer_SeqMethods, /* tp_as_sequence */ - &Buffer_AsMapping, /* PyMappingMethods *tp_as_mapping; */ - - /* More standard operations (here for binary compatibility) */ - - NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ - NULL, /* reprfunc tp_str; */ - NULL, /* getattrofunc tp_getattro; */ - NULL, /* setattrofunc tp_setattro; */ - - /* Functions to access object as input/output buffer */ - NULL, /* PyBufferProcs *tp_as_buffer; */ - - /*** Flags to define presence of optional/expanded features ***/ - Py_TPFLAGS_DEFAULT, /* long tp_flags; */ - - NULL, /* char *tp_doc; Documentation string */ - /*** Assigned meaning in release 2.0 ***/ - /* call function for all accessible objects */ - NULL, /* traverseproc tp_traverse; */ - - /* delete references to contained objects */ - NULL, /* inquiry tp_clear; */ - - /*** Assigned meaning in release 2.1 ***/ - /*** rich comparisons ***/ - NULL, /* richcmpfunc tp_richcompare; */ - - /*** weak reference enabler ***/ - 0, /* long tp_weaklistoffset; */ - - /*** Added in release 2.2 ***/ - /* Iterators */ - NULL, /* getiterfunc tp_iter; */ - NULL, /* iternextfunc tp_iternext; */ - /*** Attribute descriptor and subclassing stuff ***/ - Buffer_methods, /* struct PyMethodDef *tp_methods; */ - NULL, /* struct PyMemberDef *tp_members; */ - Buffer_getseters, /* struct PyGetSetDef *tp_getset; */ - NULL, /*tp_base*/ - NULL, /*tp_dict*/ - NULL, /*tp_descr_get*/ - NULL, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - NULL, /*tp_init*/ - NULL, /*tp_alloc*/ - Buffer_new, /*tp_new*/ - NULL, /*tp_free*/ - NULL, /*tp_is_gc*/ - NULL, /*tp_bases*/ - NULL, /*tp_mro*/ - NULL, /*tp_cache*/ - NULL, /*tp_subclasses*/ - NULL, /*tp_weaklist*/ - NULL, /*tp_del*/ + PyVarObject_HEAD_INIT(NULL, 0) + /*tp_name*/ "bgl.Buffer", + /*tp_basicsize*/ sizeof(Buffer), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ (destructor)Buffer_dealloc, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ (reprfunc)Buffer_repr, + /*tp_as_number*/ NULL, + /*tp_as_sequence*/ &Buffer_SeqMethods, + /*tp_as_mapping*/ &Buffer_AsMapping, + /*tp_hash*/ NULL, + /*tp_call*/ NULL, + /*tp_str*/ NULL, + /*tp_getattro*/ NULL, + /*tp_setattro*/ NULL, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT, + /*tp_doc*/ NULL, + /*tp_traverse*/ NULL, + /*tp_clear*/ NULL, + /*tp_richcompare*/ NULL, + /*tp_weaklistoffset*/ 0, + /*tp_iter*/ NULL, + /*tp_iternext*/ NULL, + /*tp_methods*/ Buffer_methods, + /*tp_members*/ NULL, + /*tp_getset*/ Buffer_getseters, + /*tp_base*/ NULL, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ NULL, + /*tp_alloc*/ NULL, + /*tp_new*/ Buffer_new, + /*tp_free*/ NULL, + /*tp_is_gc*/ NULL, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, }; static Buffer *BGL_MakeBuffer_FromData( @@ -811,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"); @@ -854,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; @@ -871,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"); @@ -912,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; @@ -935,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. " @@ -1393,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 3978f7f37cc..9a6568355af 100644 --- a/source/blender/python/generic/idprop_py_api.c +++ b/source/blender/python/generic/idprop_py_api.c @@ -1156,36 +1156,36 @@ static int BPy_Group_ViewItems_Contains(BPy_IDGroup_View *self, PyObject *value) } static PySequenceMethods BPy_IDGroup_ViewKeys_as_sequence = { - (lenfunc)BPy_Group_View_len, /* sq_length */ - 0, /* sq_concat */ - 0, /* sq_repeat */ - 0, /* sq_item */ - 0, /* sq_slice */ - 0, /* sq_ass_item */ - 0, /* sq_ass_slice */ - (objobjproc)BPy_Group_ViewKeys_Contains, /* sq_contains */ + /*sq_length*/ (lenfunc)BPy_Group_View_len, + /*sq_concat*/ NULL, + /*sq_repeat*/ NULL, + /*sq_item*/ NULL, + /*was_sq_slice*/ NULL, + /*sq_ass_item*/ NULL, + /*was_sq_ass_slice*/ NULL, + /*sq_contains*/ (objobjproc)BPy_Group_ViewKeys_Contains, }; static PySequenceMethods BPy_IDGroup_ViewValues_as_sequence = { - (lenfunc)BPy_Group_View_len, /* sq_length */ - 0, /* sq_concat */ - 0, /* sq_repeat */ - 0, /* sq_item */ - 0, /* sq_slice */ - 0, /* sq_ass_item */ - 0, /* sq_ass_slice */ - (objobjproc)BPy_Group_ViewValues_Contains, /* sq_contains */ + /*sq_length*/ (lenfunc)BPy_Group_View_len, + /*sq_concat*/ NULL, + /*sq_repeat*/ NULL, + /*sq_item*/ NULL, + /*was_sq_slice*/ NULL, + /*sq_ass_item*/ NULL, + /*was_sq_ass_slice*/ NULL, + /*sq_contains*/ (objobjproc)BPy_Group_ViewValues_Contains, }; static PySequenceMethods BPy_IDGroup_ViewItems_as_sequence = { - (lenfunc)BPy_Group_View_len, /* sq_length */ - 0, /* sq_concat */ - 0, /* sq_repeat */ - 0, /* sq_item */ - 0, /* sq_slice */ - 0, /* sq_ass_item */ - 0, /* sq_ass_slice */ - (objobjproc)BPy_Group_ViewItems_Contains, /* sq_contains */ + /*sq_length*/ (lenfunc)BPy_Group_View_len, + /*sq_concat*/ NULL, + /*sq_repeat*/ NULL, + /*sq_item*/ NULL, + /*was_sq_slice*/ NULL, + /*sq_ass_item*/ NULL, + /*was_sq_ass_slice*/ NULL, + /*sq_contains*/ (objobjproc)BPy_Group_ViewItems_Contains, }; /* Methods. */ @@ -1551,84 +1551,76 @@ static struct PyMethodDef BPy_IDGroup_methods[] = { * \{ */ static PySequenceMethods BPy_IDGroup_Seq = { - (lenfunc)BPy_IDGroup_Map_Len, /* lenfunc sq_length */ - NULL, /* binaryfunc sq_concat */ - NULL, /* ssizeargfunc sq_repeat */ - NULL, - /* ssizeargfunc sq_item */ /* TODO: setting this will allow PySequence_Check to return True. */ - NULL, /* intintargfunc ***was_sq_slice*** */ - NULL, /* intobjargproc sq_ass_item */ - NULL, /* ssizeobjargproc ***was_sq_ass_slice*** */ - (objobjproc)BPy_IDGroup_Contains, /* objobjproc sq_contains */ - NULL, /* binaryfunc sq_inplace_concat */ - NULL, /* ssizeargfunc sq_inplace_repeat */ + /*sq_length*/ (lenfunc)BPy_IDGroup_Map_Len, + /*sq_concat*/ NULL, + /*sq_repeat*/ NULL, + /* TODO: setting this will allow `PySequence_Check()` to return True. */ + /*sq_item*/ NULL, + /*was_sq_slice*/ NULL, /* DEPRECATED. */ + /*sq_ass_item*/ NULL, + /*was_sq_ass_slice*/ NULL, /* DEPRECATED. */ + /*sq_contains*/ (objobjproc)BPy_IDGroup_Contains, + /*sq_inplace_concat*/ NULL, + /*sq_inplace_repeat*/ NULL, }; static PyMappingMethods BPy_IDGroup_Mapping = { - (lenfunc)BPy_IDGroup_Map_Len, /* inquiry mp_length */ - (binaryfunc)BPy_IDGroup_Map_GetItem, /* binaryfunc mp_subscript */ - (objobjargproc)BPy_IDGroup_Map_SetItem, /* objobjargproc mp_ass_subscript */ + /*mp_len*/ (lenfunc)BPy_IDGroup_Map_Len, + /*mp_subscript*/ (binaryfunc)BPy_IDGroup_Map_GetItem, + /*mp_ass_subscript*/ (objobjargproc)BPy_IDGroup_Map_SetItem, }; PyTypeObject BPy_IDGroup_Type = { PyVarObject_HEAD_INIT(NULL, 0) - /* For printing, in format "<module>.<name>" */ - "IDPropertyGroup", /* char *tp_name; */ - sizeof(BPy_IDProperty), /* int tp_basicsize; */ - 0, /* tp_itemsize; For allocation */ - - /* Methods to implement standard operations */ - - NULL, /* destructor tp_dealloc; */ - 0, /* tp_vectorcall_offset */ - NULL, /* getattrfunc tp_getattr; */ - NULL, /* setattrfunc tp_setattr; */ - NULL, /* cmpfunc tp_compare; */ - (reprfunc)BPy_IDGroup_repr, /* reprfunc tp_repr; */ - - /* Method suites for standard classes */ - - NULL, /* PyNumberMethods *tp_as_number; */ - &BPy_IDGroup_Seq, /* PySequenceMethods *tp_as_sequence; */ - &BPy_IDGroup_Mapping, /* PyMappingMethods *tp_as_mapping; */ - - /* More standard operations (here for binary compatibility) */ - - (hashfunc)BPy_IDGroup_hash, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ - NULL, /* reprfunc tp_str; */ - NULL, /* getattrofunc tp_getattro; */ - NULL, /* setattrofunc tp_setattro; */ - - /* Functions to access object as input/output buffer */ - NULL, /* PyBufferProcs *tp_as_buffer; */ - - /*** Flags to define presence of optional/expanded features ***/ - Py_TPFLAGS_DEFAULT, /* long tp_flags; */ - - NULL, /* char *tp_doc; Documentation string */ - /*** Assigned meaning in release 2.0 ***/ - /* call function for all accessible objects */ - NULL, /* traverseproc tp_traverse; */ - - /* delete references to contained objects */ - NULL, /* inquiry tp_clear; */ - - /*** Assigned meaning in release 2.1 ***/ - /*** rich comparisons ***/ - NULL, /* richcmpfunc tp_richcompare; */ - - /*** weak reference enabler ***/ - 0, /* long tp_weaklistoffset; */ - - /*** Added in release 2.2 ***/ - /* Iterators */ - (getiterfunc)BPy_IDGroup_iter, /* getiterfunc tp_iter; */ - NULL, /* iternextfunc tp_iternext; */ - /*** Attribute descriptor and subclassing stuff ***/ - BPy_IDGroup_methods, /* struct PyMethodDef *tp_methods; */ - NULL, /* struct PyMemberDef *tp_members; */ - BPy_IDGroup_getseters, /* struct PyGetSetDef *tp_getset; */ + /* For printing, in format `<module>.<name>`. */ + /*tp_name*/ "IDPropertyGroup", + /*tp_basicsize*/ sizeof(BPy_IDProperty), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ NULL, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ (reprfunc)BPy_IDGroup_repr, + /*tp_as_number*/ NULL, + /*tp_as_sequence*/ &BPy_IDGroup_Seq, + /*tp_as_mapping*/ &BPy_IDGroup_Mapping, + /*tp_hash*/ (hashfunc)BPy_IDGroup_hash, + /*tp_call*/ NULL, + /*tp_str*/ NULL, + /*tp_getattro*/ NULL, + /*tp_setattro*/ NULL, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT, + /*tp_doc*/ NULL, + /*tp_traverse*/ NULL, + /*tp_clear*/ NULL, + /*tp_richcompare*/ NULL, + /*tp_weaklistoffset*/ 0, + /*tp_iter*/ (getiterfunc)BPy_IDGroup_iter, + /*tp_iternext*/ NULL, + /*tp_methods*/ BPy_IDGroup_methods, + /*tp_members*/ NULL, + /*tp_getset*/ BPy_IDGroup_getseters, + /*tp_base*/ NULL, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ NULL, + /*tp_alloc*/ NULL, + /*tp_new*/ NULL, + /*tp_free*/ NULL, + /*tp_is_gc*/ NULL, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, }; /** \} */ @@ -1703,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!"); @@ -1730,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!"); @@ -1768,17 +1760,16 @@ static int BPy_IDArray_SetItem(BPy_IDArray *self, int index, PyObject *value) } static PySequenceMethods BPy_IDArray_Seq = { - (lenfunc)BPy_IDArray_Len, /* inquiry sq_length */ - NULL, /* binaryfunc sq_concat */ - NULL, /* intargfunc sq_repeat */ - (ssizeargfunc)BPy_IDArray_GetItem, /* intargfunc sq_item */ - NULL, /* intintargfunc sq_slice */ - (ssizeobjargproc)BPy_IDArray_SetItem, /* intobjargproc sq_ass_item */ - NULL, /* intintobjargproc sq_ass_slice */ - NULL, /* objobjproc sq_contains */ - /* Added in release 2.0 */ - NULL, /* binaryfunc sq_inplace_concat */ - NULL, /* intargfunc sq_inplace_repeat */ + /*sq_length*/ (lenfunc)BPy_IDArray_Len, + /*sq_concat*/ NULL, + /*sq_repeat*/ NULL, + /*sq_item*/ (ssizeargfunc)BPy_IDArray_GetItem, + /*was_sq_slice*/ NULL, /* DEPRECATED. */ + /*sq_ass_item*/ (ssizeobjargproc)BPy_IDArray_SetItem, + /*was_sq_ass_slice*/ NULL, /* DEPRECATED. */ + /*sq_contains*/ NULL, + /*sq_inplace_concat*/ NULL, + /*sq_inplace_repeat*/ NULL, }; /* sequence slice (get): idparr[a:b] */ @@ -1926,9 +1917,9 @@ static int BPy_IDArray_ass_subscript(BPy_IDArray *self, PyObject *item, PyObject } static PyMappingMethods BPy_IDArray_AsMapping = { - (lenfunc)BPy_IDArray_Len, - (binaryfunc)BPy_IDArray_subscript, - (objobjargproc)BPy_IDArray_ass_subscript, + /*mp_len*/ (lenfunc)BPy_IDArray_Len, + /*mp_subscript*/ (binaryfunc)BPy_IDArray_subscript, + /*mp_ass_subscript*/ (objobjargproc)BPy_IDArray_ass_subscript, }; static int itemsize_by_idarray_type(int array_type) @@ -1971,8 +1962,8 @@ static void BPy_IDArray_releasebuffer(BPy_IDArray *UNUSED(self), Py_buffer *view } static PyBufferProcs BPy_IDArray_Buffer = { - (getbufferproc)BPy_IDArray_getbuffer, - (releasebufferproc)BPy_IDArray_releasebuffer, + /*bf_getbuffer*/ (getbufferproc)BPy_IDArray_getbuffer, + /*bf_releasebuffer*/ (releasebufferproc)BPy_IDArray_releasebuffer, }; /** \} */ @@ -1983,83 +1974,55 @@ static PyBufferProcs BPy_IDArray_Buffer = { PyTypeObject BPy_IDArray_Type = { PyVarObject_HEAD_INIT(NULL, 0) - /* For printing, in format "<module>.<name>" */ - "IDPropertyArray", /* char *tp_name; */ - sizeof(BPy_IDArray), /* int tp_basicsize; */ - 0, /* tp_itemsize; For allocation */ - - /* Methods to implement standard operations */ - - NULL, /* destructor tp_dealloc; */ - 0, /* tp_vectorcall_offset */ - NULL, /* getattrfunc tp_getattr; */ - NULL, /* setattrfunc tp_setattr; */ - NULL, /* cmpfunc tp_compare; */ - (reprfunc)BPy_IDArray_repr, /* reprfunc tp_repr; */ - - /* Method suites for standard classes */ - - NULL, /* PyNumberMethods *tp_as_number; */ - &BPy_IDArray_Seq, /* PySequenceMethods *tp_as_sequence; */ - &BPy_IDArray_AsMapping, /* PyMappingMethods *tp_as_mapping; */ - - /* More standard operations (here for binary compatibility) */ - - NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ - NULL, /* reprfunc tp_str; */ - NULL, /* getattrofunc tp_getattro; */ - NULL, /* setattrofunc tp_setattro; */ - - /* Functions to access object as input/output buffer */ - &BPy_IDArray_Buffer, /* PyBufferProcs *tp_as_buffer; */ - - /*** Flags to define presence of optional/expanded features ***/ - Py_TPFLAGS_DEFAULT, /* long tp_flags; */ - - NULL, /* char *tp_doc; Documentation string */ - /*** Assigned meaning in release 2.0 ***/ - /* call function for all accessible objects */ - NULL, /* traverseproc tp_traverse; */ - - /* delete references to contained objects */ - NULL, /* inquiry tp_clear; */ - - /*** Assigned meaning in release 2.1 ***/ - /*** rich comparisons ***/ - NULL, /* richcmpfunc tp_richcompare; */ - - /*** weak reference enabler ***/ - 0, /* long tp_weaklistoffset; */ - - /*** Added in release 2.2 ***/ - /* Iterators */ - NULL, /* getiterfunc tp_iter; */ - NULL, /* iternextfunc tp_iternext; */ - - /*** Attribute descriptor and subclassing stuff ***/ - BPy_IDArray_methods, /* struct PyMethodDef *tp_methods; */ - NULL, /* struct PyMemberDef *tp_members; */ - BPy_IDArray_getseters, /* struct PyGetSetDef *tp_getset; */ - NULL, /* struct _typeobject *tp_base; */ - NULL, /* PyObject *tp_dict; */ - NULL, /* descrgetfunc tp_descr_get; */ - NULL, /* descrsetfunc tp_descr_set; */ - 0, /* long tp_dictoffset; */ - NULL, /* initproc tp_init; */ - NULL, /* allocfunc tp_alloc; */ - NULL, /* newfunc tp_new; */ - /* Low-level free-memory routine */ - NULL, /* freefunc tp_free; */ - /* For PyObject_IS_GC */ - NULL, /* inquiry tp_is_gc; */ - NULL, /* PyObject *tp_bases; */ - /* method resolution order */ - NULL, /* PyObject *tp_mro; */ - NULL, /* PyObject *tp_cache; */ - NULL, /* PyObject *tp_subclasses; */ - NULL, /* PyObject *tp_weaklist; */ - NULL, + /* For printing, in format `<module>.<name>`. */ + /*tp_name*/ "IDPropertyArray", + /*tp_basicsize*/ sizeof(BPy_IDArray), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ NULL, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ (reprfunc)BPy_IDArray_repr, + /*tp_as_number*/ NULL, + /*tp_as_sequence*/ &BPy_IDArray_Seq, + /*tp_as_mapping*/ &BPy_IDArray_AsMapping, + /*tp_hash*/ NULL, + /*tp_call*/ NULL, + /*tp_str*/ NULL, + /*tp_getattro*/ NULL, + /*tp_setattro*/ NULL, + /*tp_as_buffer*/ &BPy_IDArray_Buffer, + /*tp_flags*/ Py_TPFLAGS_DEFAULT, + /*tp_doc*/ NULL, + /*tp_traverse*/ NULL, + /*tp_clear*/ NULL, + /*tp_richcompare*/ NULL, + /*tp_weaklistoffset*/ 0, + /*tp_iter*/ NULL, + /*tp_iternext*/ NULL, + /*tp_methods*/ BPy_IDArray_methods, + /*tp_members*/ NULL, + /*tp_getset*/ BPy_IDArray_getseters, + /*tp_base*/ NULL, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ NULL, + /*tp_alloc*/ NULL, + /*tp_new*/ NULL, + /*tp_free*/ NULL, + /*tp_is_gc*/ NULL, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, }; /** \} */ @@ -2129,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) @@ -2178,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/idprop_py_ui_api.c b/source/blender/python/generic/idprop_py_ui_api.c index 890ba997548..4487a885a6c 100644 --- a/source/blender/python/generic/idprop_py_ui_api.c +++ b/source/blender/python/generic/idprop_py_ui_api.c @@ -660,63 +660,55 @@ static Py_hash_t BPy_IDPropertyUIManager_hash(BPy_IDPropertyUIManager *self) PyTypeObject BPy_IDPropertyUIManager_Type = { PyVarObject_HEAD_INIT(NULL, 0) - /* For printing, in format "<module>.<name>" */ - "IDPropertyUIManager", /* char *tp_name; */ - sizeof(BPy_IDPropertyUIManager), /* int tp_basicsize; */ - 0, /* tp_itemsize; For allocation */ - - /* Methods to implement standard operations */ - - NULL, /* destructor tp_dealloc; */ - 0, /* tp_vectorcall_offset */ - NULL, /* getattrfunc tp_getattr; */ - NULL, /* setattrfunc tp_setattr; */ - NULL, /* cmpfunc tp_compare; */ - (reprfunc)BPy_IDPropertyUIManager_repr, /* reprfunc tp_repr; */ - - /* Method suites for standard classes */ - - NULL, /* PyNumberMethods *tp_as_number; */ - NULL, /* PySequenceMethods *tp_as_sequence; */ - NULL, /* PyMappingMethods *tp_as_mapping; */ - - /* More standard operations (here for binary compatibility) */ - - (hashfunc)BPy_IDPropertyUIManager_hash, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ - NULL, /* reprfunc tp_str; */ - NULL, /* getattrofunc tp_getattro; */ - NULL, /* setattrofunc tp_setattro; */ - - /* Functions to access object as input/output buffer */ - NULL, /* PyBufferProcs *tp_as_buffer; */ - - /*** Flags to define presence of optional/expanded features ***/ - Py_TPFLAGS_DEFAULT, /* long tp_flags; */ - - NULL, /* char *tp_doc; Documentation string */ - /*** Assigned meaning in release 2.0 ***/ - /* call function for all accessible objects */ - NULL, /* traverseproc tp_traverse; */ - - /* delete references to contained objects */ - NULL, /* inquiry tp_clear; */ - - /*** Assigned meaning in release 2.1 ***/ - /*** rich comparisons ***/ - NULL, /* richcmpfunc tp_richcompare; */ - - /*** weak reference enabler ***/ - 0, /* long tp_weaklistoffset; */ - - /*** Added in release 2.2 ***/ - /* Iterators */ - NULL, /* getiterfunc tp_iter; */ - NULL, /* iternextfunc tp_iternext; */ - /*** Attribute descriptor and subclassing stuff ***/ - BPy_IDPropertyUIManager_methods, /* struct PyMethodDef *tp_methods; */ - NULL, /* struct PyMemberDef *tp_members; */ - NULL, /* struct PyGetSetDef *tp_getset; */ + /* For printing, in format `<module>.<name>`. */ + /*tp_name*/ "IDPropertyUIManager", + /*tp_basicsize*/ sizeof(BPy_IDPropertyUIManager), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ NULL, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ (reprfunc)BPy_IDPropertyUIManager_repr, + /*tp_as_number*/ NULL, + /*tp_as_sequence*/ NULL, + /*tp_as_mapping*/ NULL, + /*tp_hash*/ (hashfunc)BPy_IDPropertyUIManager_hash, + /*tp_call*/ NULL, + /*tp_str*/ NULL, + /*tp_getattro*/ NULL, + /*tp_setattro*/ NULL, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT, + /*tp_doc*/ NULL, + /*tp_traverse*/ NULL, + /*tp_clear*/ NULL, + /*tp_richcompare*/ NULL, + /*tp_weaklistoffset*/ 0, + /*tp_iter*/ NULL, + /*tp_iternext*/ NULL, + /*tp_methods*/ BPy_IDPropertyUIManager_methods, + /*tp_members*/ NULL, + /*tp_getset*/ NULL, + /*tp_base*/ NULL, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ NULL, + /*tp_alloc*/ NULL, + /*tp_new*/ NULL, + /*tp_free*/ NULL, + /*tp_is_gc*/ NULL, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, }; void IDPropertyUIData_Init_Types() diff --git a/source/blender/python/generic/imbuf_py_api.c b/source/blender/python/generic/imbuf_py_api.c index 14f1958b71d..77d450d496e 100644 --- a/source/blender/python/generic/imbuf_py_api.c +++ b/source/blender/python/generic/imbuf_py_api.c @@ -348,63 +348,54 @@ static Py_hash_t py_imbuf_hash(Py_ImBuf *self) PyTypeObject Py_ImBuf_Type = { PyVarObject_HEAD_INIT(NULL, 0) - /* For printing, in format "<module>.<name>" */ - "ImBuf", /* tp_name */ - sizeof(Py_ImBuf), /* int tp_basicsize; */ - 0, /* tp_itemsize; For allocation */ - - /* Methods to implement standard operations */ - - (destructor)py_imbuf_dealloc, /* destructor tp_dealloc; */ - 0, /* tp_vectorcall_offset */ - NULL, /* getattrfunc tp_getattr; */ - NULL, /* setattrfunc tp_setattr; */ - NULL, /* cmpfunc tp_compare; */ - (reprfunc)py_imbuf_repr, /* reprfunc tp_repr; */ - - /* Method suites for standard classes */ - - NULL, /* PyNumberMethods *tp_as_number; */ - NULL, /* PySequenceMethods *tp_as_sequence; */ - NULL, /* PyMappingMethods *tp_as_mapping; */ - - /* More standard operations (here for binary compatibility) */ - - (hashfunc)py_imbuf_hash, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ - NULL, /* reprfunc tp_str; */ - NULL, /* getattrofunc tp_getattro; */ - NULL, /* setattrofunc tp_setattro; */ - - /* Functions to access object as input/output buffer */ - NULL, /* PyBufferProcs *tp_as_buffer; */ - - /*** Flags to define presence of optional/expanded features ***/ - Py_TPFLAGS_DEFAULT, /* long tp_flags; */ - - NULL, /* char *tp_doc; Documentation string */ - /*** Assigned meaning in release 2.0 ***/ - /* call function for all accessible objects */ - NULL, /* traverseproc tp_traverse; */ - - /* delete references to contained objects */ - NULL, /* inquiry tp_clear; */ - - /*** Assigned meaning in release 2.1 ***/ - /*** rich comparisons ***/ - NULL, /* richcmpfunc tp_richcompare; */ - - /*** weak reference enabler ***/ - 0, /* long tp_weaklistoffset; */ - - /*** Added in release 2.2 ***/ - /* Iterators */ - NULL, /* getiterfunc tp_iter; */ - NULL, /* iternextfunc tp_iternext; */ - /*** Attribute descriptor and subclassing stuff ***/ - Py_ImBuf_methods, /* struct PyMethodDef *tp_methods; */ - NULL, /* struct PyMemberDef *tp_members; */ - Py_ImBuf_getseters, /* struct PyGetSetDef *tp_getset; */ + /*tp_name*/ "ImBuf", + /*tp_basicsize*/ sizeof(Py_ImBuf), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ (destructor)py_imbuf_dealloc, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ (reprfunc)py_imbuf_repr, + /*tp_as_number*/ NULL, + /*tp_as_sequence*/ NULL, + /*tp_as_mapping*/ NULL, + /*tp_hash*/ (hashfunc)py_imbuf_hash, + /*tp_call*/ NULL, + /*tp_str*/ NULL, + /*tp_getattro*/ NULL, + /*tp_setattro*/ NULL, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT, + /*tp_doc*/ NULL, + /*tp_traverse*/ NULL, + /*tp_clear*/ NULL, + /*tp_richcompare*/ NULL, + /*tp_weaklistoffset*/ 0, + /*tp_iter*/ NULL, + /*tp_iternext*/ NULL, + /*tp_methods*/ Py_ImBuf_methods, + /*tp_members*/ NULL, + /*tp_getset*/ Py_ImBuf_getseters, + /*tp_base*/ NULL, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ NULL, + /*tp_alloc*/ NULL, + /*tp_new*/ NULL, + /*tp_free*/ NULL, + /*tp_is_gc*/ NULL, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, }; static PyObject *Py_ImBuf_CreatePyObject(ImBuf *ibuf) @@ -566,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) @@ -610,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 30a434f8667..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"); @@ -579,22 +579,22 @@ static PyGetSetDef pygpu_buffer_getseters[] = { }; static PySequenceMethods pygpu_buffer__tp_as_sequence = { - (lenfunc)pygpu_buffer__sq_length, /* sq_length */ - (binaryfunc)NULL, /* sq_concat */ - (ssizeargfunc)NULL, /* sq_repeat */ - (ssizeargfunc)pygpu_buffer__sq_item, /* sq_item */ - (ssizessizeargfunc)NULL, /* sq_slice, deprecated, handled in pygpu_buffer__sq_item */ - (ssizeobjargproc)pygpu_buffer__sq_ass_item, /* sq_ass_item */ - (ssizessizeobjargproc)NULL, /* sq_ass_slice, deprecated handled in pygpu_buffer__sq_ass_item */ - (objobjproc)NULL, /* sq_contains */ - (binaryfunc)NULL, /* sq_inplace_concat */ - (ssizeargfunc)NULL, /* sq_inplace_repeat */ + /*sq_length*/ (lenfunc)pygpu_buffer__sq_length, + /*sq_concat*/ NULL, + /*sq_repeat*/ NULL, + /*sq_item*/ (ssizeargfunc)pygpu_buffer__sq_item, + /*was_sq_slice*/ NULL, /* DEPRECATED. Handled by #pygpu_buffer__sq_item. */ + /*sq_ass_item*/ (ssizeobjargproc)pygpu_buffer__sq_ass_item, + /*was_sq_ass_slice*/ NULL, /* DEPRECATED. Handled by #pygpu_buffer__sq_ass_item. */ + /*sq_contains*/ NULL, + /*sq_inplace_concat*/ NULL, + /*sq_inplace_repeat*/ NULL, }; static PyMappingMethods pygpu_buffer__tp_as_mapping = { - (lenfunc)pygpu_buffer__sq_length, - (binaryfunc)pygpu_buffer__mp_subscript, - (objobjargproc)pygpu_buffer__mp_ass_subscript, + /*mp_len*/ (lenfunc)pygpu_buffer__sq_length, + /*mp_subscript*/ (binaryfunc)pygpu_buffer__mp_subscript, + /*mp_ass_subscript*/ (objobjargproc)pygpu_buffer__mp_ass_subscript, }; #ifdef PYGPU_BUFFER_PROTOCOL @@ -648,8 +648,8 @@ static void pygpu_buffer__bf_releasebuffer(PyObject *UNUSED(exporter), Py_buffer } static PyBufferProcs pygpu_buffer__tp_as_buffer = { - (getbufferproc)pygpu_buffer__bf_getbuffer, - (releasebufferproc)pygpu_buffer__bf_releasebuffer, + /*bf_getbuffer*/ (getbufferproc)pygpu_buffer__bf_getbuffer, + /*bf_releasebuffer*/ (releasebufferproc)pygpu_buffer__bf_releasebuffer, }; #endif 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_handlers.c b/source/blender/python/intern/bpy_app_handlers.c index 8c5fb22eab1..3580481941d 100644 --- a/source/blender/python/intern/bpy_app_handlers.c +++ b/source/blender/python/intern/bpy_app_handlers.c @@ -132,7 +132,7 @@ static PyObject *bpy_app_handlers_persistent_new(PyTypeObject *UNUSED(type), return NULL; } -/* dummy type because decorators can't be PyCFunctions */ +/** Dummy type because decorators can't be a #PyCFunction. */ static PyTypeObject BPyPersistent_Type = { #if defined(_MSC_VER) @@ -140,46 +140,54 @@ static PyTypeObject BPyPersistent_Type = { #else PyVarObject_HEAD_INIT(&PyType_Type, 0) #endif - - "persistent", /* tp_name */ - 0, /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - 0, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - bpy_app_handlers_persistent_new, /* tp_new */ - 0, /* tp_free */ + /*tp_name*/ "persistent", + /*tp_basicsize*/ 0, + /*tp_itemsize*/ 0, + /*tp_dealloc*/ NULL, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ NULL, + /*tp_as_number*/ NULL, + /*tp_as_sequence*/ NULL, + /*tp_as_mapping*/ NULL, + /*tp_hash*/ NULL, + /*tp_call*/ NULL, + /*tp_str*/ NULL, + /*tp_getattro*/ NULL, + /*tp_setattro*/ NULL, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, + /*tp_doc*/ NULL, + /*tp_traverse*/ NULL, + /*tp_clear*/ NULL, + /*tp_richcompare*/ NULL, + /*tp_weaklistoffset*/ 0, + /*tp_iter*/ NULL, + /*tp_iternext*/ NULL, + /*tp_methods*/ NULL, + /*tp_members*/ NULL, + /*tp_getset*/ NULL, + /*tp_base*/ NULL, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ NULL, + /*tp_alloc*/ NULL, + /*tp_new*/ bpy_app_handlers_persistent_new, + /*tp_free*/ NULL, + /*tp_is_gc*/ NULL, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, }; static PyObject *py_cb_array[BKE_CB_EVT_TOT] = {NULL}; 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_app_translations.c b/source/blender/python/intern/bpy_app_translations.c index 7627d498774..1f5565eb0a7 100644 --- a/source/blender/python/intern/bpy_app_translations.c +++ b/source/blender/python/intern/bpy_app_translations.c @@ -773,84 +773,54 @@ PyDoc_STRVAR(app_translations_doc, "\n"); static PyTypeObject BlenderAppTranslationsType = { PyVarObject_HEAD_INIT(NULL, 0) - /* tp_name */ - "bpy.app._translations_type", - /* tp_basicsize */ - sizeof(BlenderAppTranslations), - 0, /* tp_itemsize */ - /* methods */ - /* No destructor, this is a singleton! */ - NULL, /* tp_dealloc */ - 0, /* tp_vectorcall_offset */ - NULL, /* getattrfunc tp_getattr; */ - NULL, /* setattrfunc tp_setattr; */ - NULL, - /* tp_compare */ /* DEPRECATED in python 3.0! */ - NULL, /* tp_repr */ - - /* Method suites for standard classes */ - NULL, /* PyNumberMethods *tp_as_number; */ - NULL, /* PySequenceMethods *tp_as_sequence; */ - NULL, /* PyMappingMethods *tp_as_mapping; */ - - /* More standard operations (here for binary compatibility) */ - NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ - NULL, /* reprfunc tp_str; */ - NULL, /* getattrofunc tp_getattro; */ - NULL, /* setattrofunc tp_setattro; */ - - /* Functions to access object as input/output buffer */ - NULL, /* PyBufferProcs *tp_as_buffer; */ - - /*** Flags to define presence of optional/expanded features ***/ - Py_TPFLAGS_DEFAULT, /* long tp_flags; */ - - app_translations_doc, /* char *tp_doc; Documentation string */ - - /*** Assigned meaning in release 2.0 ***/ - /* call function for all accessible objects */ - NULL, /* traverseproc tp_traverse; */ - - /* delete references to contained objects */ - NULL, /* inquiry tp_clear; */ - - /*** Assigned meaning in release 2.1 ***/ - /*** rich comparisons ***/ - NULL, /* richcmpfunc tp_richcompare; */ - - /*** weak reference enabler ***/ - 0, /* long tp_weaklistoffset */ - - /*** Added in release 2.2 ***/ - /* Iterators */ - NULL, /* getiterfunc tp_iter; */ - NULL, /* iternextfunc tp_iternext; */ - - /*** Attribute descriptor and subclassing stuff ***/ - app_translations_methods, /* struct PyMethodDef *tp_methods; */ - app_translations_members, /* struct PyMemberDef *tp_members; */ - app_translations_getseters, /* struct PyGetSetDef *tp_getset; */ - NULL, /* struct _typeobject *tp_base; */ - NULL, /* PyObject *tp_dict; */ - NULL, /* descrgetfunc tp_descr_get; */ - NULL, /* descrsetfunc tp_descr_set; */ - 0, /* long tp_dictoffset; */ - NULL, /* initproc tp_init; */ - NULL, /* allocfunc tp_alloc; */ - /* newfunc tp_new; */ - (newfunc)app_translations_new, - /* Low-level free-memory routine */ - app_translations_free, /* freefunc tp_free; */ - /* For PyObject_IS_GC */ - NULL, /* inquiry tp_is_gc; */ - NULL, /* PyObject *tp_bases; */ - /* method resolution order */ - NULL, /* PyObject *tp_mro; */ - NULL, /* PyObject *tp_cache; */ - NULL, /* PyObject *tp_subclasses; */ - NULL, /* PyObject *tp_weaklist; */ - NULL, + /*tp_name*/ "bpy.app._translations_type", + /*tp_basicsize*/ sizeof(BlenderAppTranslations), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ NULL, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ NULL, + /*tp_as_number*/ NULL, + /*tp_as_sequence*/ NULL, + /*tp_as_mapping*/ NULL, + /*tp_hash*/ NULL, + /*tp_call*/ NULL, + /*tp_str*/ NULL, + /*tp_getattro*/ NULL, + /*tp_setattro*/ NULL, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT, + /*tp_doc*/ app_translations_doc, + /*tp_traverse*/ NULL, + /*tp_clear*/ NULL, + /*tp_richcompare*/ NULL, + /*tp_weaklistoffset*/ 0, + /*tp_iter*/ NULL, + /*tp_iternext*/ NULL, + /*tp_methods*/ app_translations_methods, + /*tp_members*/ app_translations_members, + /*tp_getset*/ app_translations_getseters, + /*tp_base*/ NULL, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ NULL, + /*tp_alloc*/ NULL, + /*tp_new*/ (newfunc)app_translations_new, + /*tp_free*/ app_translations_free, + /*tp_is_gc*/ NULL, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, }; PyObject *BPY_app_translations_struct(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_library_load.c b/source/blender/python/intern/bpy_library_load.c index f29a8d34359..acc6e2cf448 100644 --- a/source/blender/python/intern/bpy_library_load.c +++ b/source/blender/python/intern/bpy_library_load.c @@ -84,82 +84,55 @@ static void bpy_lib_dealloc(BPy_Library *self) } static PyTypeObject bpy_lib_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "bpy_lib", /* tp_name */ - sizeof(BPy_Library), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)bpy_lib_dealloc, /* tp_dealloc */ - 0, /* tp_vectorcall_offset */ - NULL, /* getattrfunc tp_getattr; */ - NULL, /* setattrfunc tp_setattr; */ - NULL, - /* tp_compare */ /* DEPRECATED in python 3.0! */ - NULL, /* tp_repr */ - - /* Method suites for standard classes */ - - NULL, /* PyNumberMethods *tp_as_number; */ - NULL, /* PySequenceMethods *tp_as_sequence; */ - NULL, /* PyMappingMethods *tp_as_mapping; */ - - /* More standard operations (here for binary compatibility) */ - - NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ - NULL, /* reprfunc tp_str; */ - - /* Will only use these if this is a sub-type of a Python class. */ - PyObject_GenericGetAttr, /* getattrofunc tp_getattro; */ - NULL, /* setattrofunc tp_setattro; */ - - /* Functions to access object as input/output buffer */ - NULL, /* PyBufferProcs *tp_as_buffer; */ - - /*** Flags to define presence of optional/expanded features ***/ - Py_TPFLAGS_DEFAULT, /* long tp_flags; */ - - NULL, /* char *tp_doc; Documentation string */ - /*** Assigned meaning in release 2.0 ***/ - /* call function for all accessible objects */ - NULL, /* traverseproc tp_traverse; */ - - /* delete references to contained objects */ - NULL, /* inquiry tp_clear; */ - - /*** Assigned meaning in release 2.1 ***/ - /*** rich comparisons (subclassed) ***/ - NULL, /* richcmpfunc tp_richcompare; */ - - /*** weak reference enabler ***/ - 0, - /*** Added in release 2.2 ***/ - /* Iterators */ - NULL, /* getiterfunc tp_iter; */ - NULL, /* iternextfunc tp_iternext; */ - - /*** Attribute descriptor and subclassing stuff ***/ - bpy_lib_methods, /* struct PyMethodDef *tp_methods; */ - NULL, /* struct PyMemberDef *tp_members; */ - NULL, /* struct PyGetSetDef *tp_getset; */ - NULL, /* struct _typeobject *tp_base; */ - NULL, /* PyObject *tp_dict; */ - NULL, /* descrgetfunc tp_descr_get; */ - NULL, /* descrsetfunc tp_descr_set; */ - offsetof(BPy_Library, dict), /* long tp_dictoffset; */ - NULL, /* initproc tp_init; */ - NULL, /* allocfunc tp_alloc; */ - NULL, /* newfunc tp_new; */ - /* Low-level free-memory routine */ - NULL, /* freefunc tp_free; */ - /* For PyObject_IS_GC */ - NULL, /* inquiry tp_is_gc; */ - NULL, /* PyObject *tp_bases; */ - /* method resolution order */ - NULL, /* PyObject *tp_mro; */ - NULL, /* PyObject *tp_cache; */ - NULL, /* PyObject *tp_subclasses; */ - NULL, /* PyObject *tp_weaklist; */ - NULL, + PyVarObject_HEAD_INIT(NULL, 0) + /*tp_name*/ "bpy_lib", + /*tp_basicsize*/ sizeof(BPy_Library), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ (destructor)bpy_lib_dealloc, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ NULL, + /*tp_as_number*/ NULL, + /*tp_as_sequence*/ NULL, + /*tp_as_mapping*/ NULL, + /*tp_hash*/ NULL, + /*tp_call*/ NULL, + /*tp_str*/ NULL, + /*tp_getattro*/ PyObject_GenericGetAttr, + /*tp_setattro*/ NULL, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT, + /*tp_doc*/ NULL, + /*tp_traverse*/ NULL, + /*tp_clear*/ NULL, + /*tp_richcompare*/ NULL, + /*tp_weaklistoffset*/ 0, + /*tp_iter*/ NULL, + /*tp_iternext*/ NULL, + /*tp_methods*/ bpy_lib_methods, + /*tp_members*/ NULL, + /*tp_getset*/ NULL, + /*tp_base*/ NULL, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ offsetof(BPy_Library, dict), + /*tp_init*/ NULL, + /*tp_alloc*/ NULL, + /*tp_new*/ NULL, + /*tp_free*/ NULL, + /*tp_is_gc*/ NULL, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, }; PyDoc_STRVAR( 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 02f7e16e805..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); } @@ -3251,41 +3251,67 @@ static int pyrna_prop_array_ass_subscript(BPy_PropertyArrayRNA *self, /* For slice only. */ static PyMappingMethods pyrna_prop_array_as_mapping = { - (lenfunc)pyrna_prop_array_length, /* mp_length */ - (binaryfunc)pyrna_prop_array_subscript, /* mp_subscript */ - (objobjargproc)pyrna_prop_array_ass_subscript, /* mp_ass_subscript */ + /*mp_len*/ (lenfunc)pyrna_prop_array_length, + /*mp_subscript*/ (binaryfunc)pyrna_prop_array_subscript, + /*mp_ass_subscript*/ (objobjargproc)pyrna_prop_array_ass_subscript, }; static PyMappingMethods pyrna_prop_collection_as_mapping = { - (lenfunc)pyrna_prop_collection_length, /* mp_length */ - (binaryfunc)pyrna_prop_collection_subscript, /* mp_subscript */ - (objobjargproc)pyrna_prop_collection_ass_subscript, /* mp_ass_subscript */ + /*mp_len*/ (lenfunc)pyrna_prop_collection_length, + /*mp_subscript*/ (binaryfunc)pyrna_prop_collection_subscript, + /*mp_ass_subscript*/ (objobjargproc)pyrna_prop_collection_ass_subscript, }; /* Only for fast bool's, large structs, assign nb_bool on init. */ static PyNumberMethods pyrna_prop_array_as_number = { - NULL, /* nb_add */ - NULL, /* nb_subtract */ - NULL, /* nb_multiply */ - NULL, /* nb_remainder */ - NULL, /* nb_divmod */ - NULL, /* nb_power */ - NULL, /* nb_negative */ - NULL, /* nb_positive */ - NULL, /* nb_absolute */ - (inquiry)pyrna_prop_array_bool, /* nb_bool */ + /*nb_add*/ NULL, + /*nb_subtract*/ NULL, + /*nb_multiply*/ NULL, + /*nb_remainder*/ NULL, + /*nb_divmod*/ NULL, + /*nb_power*/ NULL, + /*nb_negative*/ NULL, + /*nb_positive*/ NULL, + /*nb_absolute*/ NULL, + /*nb_bool*/ (inquiry)pyrna_prop_array_bool, }; static PyNumberMethods pyrna_prop_collection_as_number = { - NULL, /* nb_add */ - NULL, /* nb_subtract */ - NULL, /* nb_multiply */ - NULL, /* nb_remainder */ - NULL, /* nb_divmod */ - NULL, /* nb_power */ - NULL, /* nb_negative */ - NULL, /* nb_positive */ - NULL, /* nb_absolute */ - (inquiry)pyrna_prop_collection_bool, /* nb_bool */ + /*nb_add*/ NULL, + /*nb_subtract*/ NULL, + /*nb_multiply*/ NULL, + /*nb_remainder*/ NULL, + /*nb_divmod*/ NULL, + /*nb_power*/ NULL, + /*nb_negative*/ NULL, + /*nb_positive*/ NULL, + /*nb_absolute*/ NULL, + /*nb_bool*/ (inquiry)pyrna_prop_collection_bool, + /*nb_invert*/ NULL, + /*nb_lshift*/ NULL, + /*nb_rshift*/ NULL, + /*nb_and*/ NULL, + /*nb_xor*/ NULL, + /*nb_or*/ NULL, + /*nb_int*/ NULL, + /*nb_reserved*/ NULL, + /*nb_float*/ NULL, + /*nb_inplace_add*/ NULL, + /*nb_inplace_subtract*/ NULL, + /*nb_inplace_multiply*/ NULL, + /*nb_inplace_remainder*/ NULL, + /*nb_inplace_power*/ NULL, + /*nb_inplace_lshift*/ NULL, + /*nb_inplace_rshift*/ NULL, + /*nb_inplace_and*/ NULL, + /*nb_inplace_xor*/ NULL, + /*nb_inplace_or*/ NULL, + /*nb_floor_divide*/ NULL, + /*nb_true_divide*/ NULL, + /*nb_inplace_floor_divide*/ NULL, + /*nb_inplace_true_divide*/ NULL, + /*nb_index*/ NULL, + /*nb_matrix_multiply*/ NULL, + /*nb_inplace_matrix_multiply*/ NULL, }; static int pyrna_prop_array_contains(BPy_PropertyRNA *self, PyObject *value) @@ -3345,46 +3371,46 @@ static int pyrna_struct_contains(BPy_StructRNA *self, PyObject *value) } static PySequenceMethods pyrna_prop_array_as_sequence = { - (lenfunc)pyrna_prop_array_length, - NULL, /* sq_concat */ - NULL, /* sq_repeat */ - (ssizeargfunc)pyrna_prop_array_subscript_int, - /* sq_item */ /* Only set this so PySequence_Check() returns True */ - NULL, /* sq_slice */ - (ssizeobjargproc)prop_subscript_ass_array_int, /* sq_ass_item */ - NULL, /* *was* sq_ass_slice */ - (objobjproc)pyrna_prop_array_contains, /* sq_contains */ - (binaryfunc)NULL, /* sq_inplace_concat */ - (ssizeargfunc)NULL, /* sq_inplace_repeat */ + /*sq_length*/ (lenfunc)pyrna_prop_array_length, + /*sq_concat*/ NULL, + /*sq_repeat*/ NULL, + /* Only set this so `PySequence_Check()` returns True. */ + /*sq_item*/ (ssizeargfunc)pyrna_prop_array_subscript_int, + /*sq_slice*/ NULL, + /*sq_ass_item*/ (ssizeobjargproc)prop_subscript_ass_array_int, + /* was_sq_ass_slice */ NULL, /* DEPRECATED. */ + /*sq_contains*/ (objobjproc)pyrna_prop_array_contains, + /*sq_inplace_concat*/ NULL, + /*sq_inplace_repeat*/ NULL, }; static PySequenceMethods pyrna_prop_collection_as_sequence = { - (lenfunc)pyrna_prop_collection_length, - NULL, /* sq_concat */ - NULL, /* sq_repeat */ - (ssizeargfunc)pyrna_prop_collection_subscript_int, - /* sq_item */ /* Only set this so PySequence_Check() returns True */ - NULL, /* *was* sq_slice */ - (ssizeobjargproc) /* pyrna_prop_collection_ass_subscript_int */ - NULL /* let mapping take this one */, /* sq_ass_item */ - NULL, /* *was* sq_ass_slice */ - (objobjproc)pyrna_prop_collection_contains, /* sq_contains */ - (binaryfunc)NULL, /* sq_inplace_concat */ - (ssizeargfunc)NULL, /* sq_inplace_repeat */ + /*sq_length*/ (lenfunc)pyrna_prop_collection_length, + /*sq_concat*/ NULL, + /*sq_repeat*/ NULL, + /* Only set this so PySequence_Check() returns True */ + /*sq_item*/ (ssizeargfunc)pyrna_prop_collection_subscript_int, + /*was_sq_slice*/ NULL, /* DEPRECATED. */ + /* Let mapping take this one: #pyrna_prop_collection_ass_subscript_int */ + /*sq_ass_item*/ NULL, + /*was_sq_ass_slice*/ NULL, /* DEPRECATED. */ + /*sq_contains*/ (objobjproc)pyrna_prop_collection_contains, + /*sq_inplace_concat*/ NULL, + /*sq_inplace_repeat*/ NULL, }; static PySequenceMethods pyrna_struct_as_sequence = { - NULL, /* Can't set the len otherwise it can evaluate as false */ - NULL, /* sq_concat */ - NULL, /* sq_repeat */ - NULL, - /* sq_item */ /* Only set this so PySequence_Check() returns True */ - NULL, /* *was* sq_slice */ - NULL, /* sq_ass_item */ - NULL, /* *was* sq_ass_slice */ - (objobjproc)pyrna_struct_contains, /* sq_contains */ - (binaryfunc)NULL, /* sq_inplace_concat */ - (ssizeargfunc)NULL, /* sq_inplace_repeat */ + /*sq_length*/ NULL, /* Can't set the len otherwise it can evaluate as false */ + /*sq_concat*/ NULL, + /*sq_repeat*/ NULL, + /* Only set this so `PySequence_Check()` returns True. */ + /*sq_item*/ NULL, + /*was_sq_slice*/ NULL, /* DEPRECATED. */ + /*sq_ass_item */ NULL, + /*was_sq_ass_slice*/ NULL, /* DEPRECATED. */ + /*sq_contains*/ (objobjproc)pyrna_struct_contains, + /*sq_inplace_concat*/ NULL, + /*sq_inplace_repeat*/ NULL, }; static PyObject *pyrna_struct_subscript(BPy_StructRNA *self, PyObject *key) @@ -3457,9 +3483,9 @@ static int pyrna_struct_ass_subscript(BPy_StructRNA *self, PyObject *key, PyObje } static PyMappingMethods pyrna_struct_as_mapping = { - (lenfunc)NULL, /* mp_length */ - (binaryfunc)pyrna_struct_subscript, /* mp_subscript */ - (objobjargproc)pyrna_struct_ass_subscript, /* mp_ass_subscript */ + /*mp_length*/ (lenfunc)NULL, + /*mp_subscript*/ (binaryfunc)pyrna_struct_subscript, + /*mp_ass_subscript*/ (objobjargproc)pyrna_struct_ass_subscript, }; PyDoc_STRVAR(pyrna_struct_keys_doc, @@ -3471,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; @@ -3492,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; @@ -3513,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"); @@ -6483,606 +6515,415 @@ static PyObject *pyrna_func_doc_get(BPy_FunctionRNA *self, void *UNUSED(closure) return ret; } -/* Subclasses of pyrna_struct_Type which support idprop definitions use this as a metaclass. */ -/* NOTE: tp_base member is set to &PyType_Type on init. */ +/** + * Sub-classes of #pyrna_struct_Type which support idprop definitions use this as a meta-class. + * \note tp_base member is set to `&PyType_Type` on initialization. + */ PyTypeObject pyrna_struct_meta_idprop_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "bpy_struct_meta_idprop", /* tp_name */ - - /* NOTE: would be PyTypeObject, but sub-types of Type must be PyHeapTypeObject's. */ - sizeof(PyHeapTypeObject), /* tp_basicsize */ - - 0, /* tp_itemsize */ - /* methods */ - NULL, /* tp_dealloc */ - 0, /* tp_vectorcall_offset */ - NULL, /* getattrfunc tp_getattr; */ - NULL, /* setattrfunc tp_setattr; */ - NULL, - /* tp_compare */ /* deprecated in Python 3.0! */ - NULL, /* tp_repr */ - - /* Method suites for standard classes */ - NULL, /* PyNumberMethods *tp_as_number; */ - NULL, /* PySequenceMethods *tp_as_sequence; */ - NULL, /* PyMappingMethods *tp_as_mapping; */ - - /* More standard operations (here for binary compatibility) */ - NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ - NULL, /* reprfunc tp_str; */ - NULL /* (getattrofunc) pyrna_struct_meta_idprop_getattro */, /* getattrofunc tp_getattro; */ - (setattrofunc)pyrna_struct_meta_idprop_setattro, /* setattrofunc tp_setattro; */ - - /* Functions to access object as input/output buffer */ - NULL, /* PyBufferProcs *tp_as_buffer; */ - - /*** Flags to define presence of optional/expanded features ***/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* long tp_flags; */ - - NULL, /* char *tp_doc; Documentation string */ - /*** Assigned meaning in release 2.0 ***/ - /* call function for all accessible objects */ - NULL, /* traverseproc tp_traverse; */ - - /* delete references to contained objects */ - NULL, /* inquiry tp_clear; */ - - /*** Assigned meaning in release 2.1 ***/ - /*** rich comparisons ***/ - NULL, /* richcmpfunc tp_richcompare; */ - - /*** weak reference enabler ***/ - 0, /* long tp_weaklistoffset; */ - - /*** Added in release 2.2 ***/ - /* Iterators */ - NULL, /* getiterfunc tp_iter; */ - NULL, /* iternextfunc tp_iternext; */ - - /*** Attribute descriptor and subclassing stuff ***/ - NULL, /* struct PyMethodDef *tp_methods; */ - NULL, /* struct PyMemberDef *tp_members; */ - NULL, /* struct PyGetSetDef *tp_getset; */ + PyVarObject_HEAD_INIT(NULL, 0) + /*tp_name*/ "bpy_struct_meta_idprop", + /* NOTE: would be `sizeof(PyTypeObject)`, + * but sub-types of Type must be #PyHeapTypeObject's. */ + /*tp_basicsize*/ sizeof(PyHeapTypeObject), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ NULL, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ NULL, + /*tp_as_number*/ NULL, + /*tp_as_sequence*/ NULL, + /*tp_as_mapping*/ NULL, + /*tp_hash*/ NULL, + /*tp_call*/ NULL, + /*tp_str*/ NULL, + /*tp_getattro*/ NULL, /* Sub-classed: #pyrna_struct_meta_idprop_getattro. */ + /*tp_setattro*/ (setattrofunc)pyrna_struct_meta_idprop_setattro, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, + /*tp_doc*/ NULL, + /*tp_traverse*/ NULL, + /*tp_clear*/ NULL, + /*tp_richcompare*/ NULL, + /*tp_weaklistoffset*/ 0, + /*tp_iter*/ NULL, + /*tp_iternext*/ NULL, + /*tp_methods*/ NULL, + /*tp_members*/ NULL, + /*tp_getset*/ NULL, #if defined(_MSC_VER) - NULL, /* defer assignment */ + /*tp_base*/ NULL, /* Defer assignment. */ #else - &PyType_Type, /* struct _typeobject *tp_base; */ + /*tp_base*/ &PyType_Type, #endif - NULL, /* PyObject *tp_dict; */ - NULL, /* descrgetfunc tp_descr_get; */ - NULL, /* descrsetfunc tp_descr_set; */ - 0, /* long tp_dictoffset; */ - NULL, /* initproc tp_init; */ - NULL, /* allocfunc tp_alloc; */ - NULL, /* newfunc tp_new; */ - /* Low-level free-memory routine */ - NULL, /* freefunc tp_free; */ - /* For PyObject_IS_GC */ - NULL, /* inquiry tp_is_gc; */ - NULL, /* PyObject *tp_bases; */ - /* method resolution order */ - NULL, /* PyObject *tp_mro; */ - NULL, /* PyObject *tp_cache; */ - NULL, /* PyObject *tp_subclasses; */ - NULL, /* PyObject *tp_weaklist; */ - NULL, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ NULL, + /*tp_alloc*/ NULL, + /*tp_new*/ NULL, + /*tp_free*/ NULL, + /*tp_is_gc*/ NULL, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, }; /*-----------------------BPy_StructRNA method def------------------------------*/ PyTypeObject pyrna_struct_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "bpy_struct", /* tp_name */ - sizeof(BPy_StructRNA), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)pyrna_struct_dealloc, /* tp_dealloc */ - 0, /* tp_vectorcall_offset */ - NULL, /* getattrfunc tp_getattr; */ - NULL, /* setattrfunc tp_setattr; */ - NULL, - /* tp_compare */ /* DEPRECATED in Python 3.0! */ - (reprfunc)pyrna_struct_repr, /* tp_repr */ - - /* Method suites for standard classes */ - - NULL, /* PyNumberMethods *tp_as_number; */ - &pyrna_struct_as_sequence, /* PySequenceMethods *tp_as_sequence; */ - &pyrna_struct_as_mapping, /* PyMappingMethods *tp_as_mapping; */ - - /* More standard operations (here for binary compatibility) */ - - (hashfunc)pyrna_struct_hash, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ - (reprfunc)pyrna_struct_str, /* reprfunc tp_str; */ - (getattrofunc)pyrna_struct_getattro, /* getattrofunc tp_getattro; */ - (setattrofunc)pyrna_struct_setattro, /* setattrofunc tp_setattro; */ - - /* Functions to access object as input/output buffer */ - NULL, /* PyBufferProcs *tp_as_buffer; */ - - /*** Flags to define presence of optional/expanded features ***/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE + PyVarObject_HEAD_INIT(NULL, 0) + /*tp_name*/ "bpy_struct", + /*tp_basicsize*/ sizeof(BPy_StructRNA), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ (destructor)pyrna_struct_dealloc, + /*tp_vectorcall_offset */ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ (reprfunc)pyrna_struct_repr, + /*tp_as_number*/ NULL, + /*tp_as_sequence*/ &pyrna_struct_as_sequence, + /*tp_as_mapping*/ &pyrna_struct_as_mapping, + /*tp_hash*/ (hashfunc)pyrna_struct_hash, + /*tp_call*/ NULL, + /*tp_str*/ (reprfunc)pyrna_struct_str, + /*tp_getattro*/ (getattrofunc)pyrna_struct_getattro, + /*tp_setattro*/ (setattrofunc)pyrna_struct_setattro, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE #ifdef USE_PYRNA_STRUCT_REFERENCE | Py_TPFLAGS_HAVE_GC #endif - , /* long tp_flags; */ - - NULL, /* char *tp_doc; Documentation string */ -/*** Assigned meaning in release 2.0 ***/ -/* call function for all accessible objects */ + , + /*tp_doc*/ NULL, #ifdef USE_PYRNA_STRUCT_REFERENCE - (traverseproc)pyrna_struct_traverse, /* traverseproc tp_traverse; */ - - /* delete references to contained objects */ - (inquiry)pyrna_struct_clear, /* inquiry tp_clear; */ + /*tp_traverse*/ (traverseproc)pyrna_struct_traverse, + /*tp_clear*/ (inquiry)pyrna_struct_clear, #else - NULL, /* traverseproc tp_traverse; */ - - /* delete references to contained objects */ - NULL, /* inquiry tp_clear; */ + /*tp_traverse*/ NULL, + /*tp_clear*/ NULL, #endif /* !USE_PYRNA_STRUCT_REFERENCE */ - - /*** Assigned meaning in release 2.1 ***/ - /*** rich comparisons ***/ - (richcmpfunc)pyrna_struct_richcmp, /* richcmpfunc tp_richcompare; */ - -/*** weak reference enabler ***/ + /*tp_richcompare*/ (richcmpfunc)pyrna_struct_richcmp, #ifdef USE_WEAKREFS - offsetof(BPy_StructRNA, in_weakreflist), /* long tp_weaklistoffset; */ + /*tp_weaklistoffset*/ offsetof(BPy_StructRNA, in_weakreflist), #else 0, #endif - /*** Added in release 2.2 ***/ - /* Iterators */ - NULL, /* getiterfunc tp_iter; */ - NULL, /* iternextfunc tp_iternext; */ - - /*** Attribute descriptor and subclassing stuff ***/ - pyrna_struct_methods, /* struct PyMethodDef *tp_methods; */ - NULL, /* struct PyMemberDef *tp_members; */ - pyrna_struct_getseters, /* struct PyGetSetDef *tp_getset; */ - NULL, /* struct _typeobject *tp_base; */ - NULL, /* PyObject *tp_dict; */ - NULL, /* descrgetfunc tp_descr_get; */ - NULL, /* descrsetfunc tp_descr_set; */ - 0, /* long tp_dictoffset; */ - NULL, /* initproc tp_init; */ - NULL, /* allocfunc tp_alloc; */ - pyrna_struct_new, /* newfunc tp_new; */ - /* Low-level free-memory routine */ - NULL, /* freefunc tp_free; */ - /* For PyObject_IS_GC */ - NULL, /* inquiry tp_is_gc; */ - NULL, /* PyObject *tp_bases; */ - /* method resolution order */ - NULL, /* PyObject *tp_mro; */ - NULL, /* PyObject *tp_cache; */ - NULL, /* PyObject *tp_subclasses; */ - NULL, /* PyObject *tp_weaklist; */ - NULL, + /*tp_iter*/ NULL, + /*tp_iternext*/ NULL, + /*tp_methods*/ pyrna_struct_methods, + /*tp_members*/ NULL, + /*tp_getset*/ pyrna_struct_getseters, + /*tp_base*/ NULL, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ NULL, + /*tp_alloc*/ NULL, + /*tp_new*/ pyrna_struct_new, + /*tp_free*/ NULL, + /*tp_is_gc*/ NULL, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, }; /*-----------------------BPy_PropertyRNA method def------------------------------*/ PyTypeObject pyrna_prop_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "bpy_prop", /* tp_name */ - sizeof(BPy_PropertyRNA), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)pyrna_prop_dealloc, /* tp_dealloc */ - 0, /* tp_vectorcall_offset */ - NULL, /* getattrfunc tp_getattr; */ - NULL, /* setattrfunc tp_setattr; */ - NULL, - /* tp_compare */ /* DEPRECATED in Python 3.0! */ - (reprfunc)pyrna_prop_repr, /* tp_repr */ - - /* Method suites for standard classes */ - - NULL, /* PyNumberMethods *tp_as_number; */ - NULL, /* PySequenceMethods *tp_as_sequence; */ - NULL, /* PyMappingMethods *tp_as_mapping; */ - - /* More standard operations (here for binary compatibility) */ - - (hashfunc)pyrna_prop_hash, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ - (reprfunc)pyrna_prop_str, /* reprfunc tp_str; */ - - /* will only use these if this is a subtype of a py class */ - NULL, /* getattrofunc tp_getattro; */ - NULL, /* setattrofunc tp_setattro; */ - - /* Functions to access object as input/output buffer */ - NULL, /* PyBufferProcs *tp_as_buffer; */ - - /*** Flags to define presence of optional/expanded features ***/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* long tp_flags; */ - - NULL, /* char *tp_doc; Documentation string */ - /*** Assigned meaning in release 2.0 ***/ - /* call function for all accessible objects */ - NULL, /* traverseproc tp_traverse; */ - - /* delete references to contained objects */ - NULL, /* inquiry tp_clear; */ - - /*** Assigned meaning in release 2.1 ***/ - /*** rich comparisons ***/ - (richcmpfunc)pyrna_prop_richcmp, /* richcmpfunc tp_richcompare; */ - -/*** weak reference enabler ***/ + PyVarObject_HEAD_INIT(NULL, 0) + /*tp_name*/ "bpy_prop", + /*tp_basicsize*/ sizeof(BPy_PropertyRNA), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ (destructor)pyrna_prop_dealloc, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ (reprfunc)pyrna_prop_repr, + /*tp_as_number*/ NULL, + /*tp_as_sequence*/ NULL, + /*tp_as_mapping*/ NULL, + /*tp_hash*/ (hashfunc)pyrna_prop_hash, + /*tp_call*/ NULL, + /*tp_str*/ (reprfunc)pyrna_prop_str, + /*tp_getattro*/ NULL, + /*tp_setattro*/ NULL, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, + /*tp_doc*/ NULL, + /*tp_traverse*/ NULL, + /*tp_clear*/ NULL, + /*tp_richcompare*/ (richcmpfunc)pyrna_prop_richcmp, #ifdef USE_WEAKREFS - offsetof(BPy_PropertyRNA, in_weakreflist), /* long tp_weaklistoffset; */ + /*tp_weaklistoffset*/ offsetof(BPy_PropertyRNA, in_weakreflist), #else - 0, + /*tp_weaklistoffset*/ 0, #endif - - /*** Added in release 2.2 ***/ - /* Iterators */ - NULL, /* getiterfunc tp_iter; */ - NULL, /* iternextfunc tp_iternext; */ - - /*** Attribute descriptor and subclassing stuff ***/ - pyrna_prop_methods, /* struct PyMethodDef *tp_methods; */ - NULL, /* struct PyMemberDef *tp_members; */ - pyrna_prop_getseters, /* struct PyGetSetDef *tp_getset; */ - NULL, /* struct _typeobject *tp_base; */ - NULL, /* PyObject *tp_dict; */ - NULL, /* descrgetfunc tp_descr_get; */ - NULL, /* descrsetfunc tp_descr_set; */ - 0, /* long tp_dictoffset; */ - NULL, /* initproc tp_init; */ - NULL, /* allocfunc tp_alloc; */ - pyrna_prop_new, /* newfunc tp_new; */ - /* Low-level free-memory routine */ - NULL, /* freefunc tp_free; */ - /* For PyObject_IS_GC */ - NULL, /* inquiry tp_is_gc; */ - NULL, /* PyObject *tp_bases; */ - /* method resolution order */ - NULL, /* PyObject *tp_mro; */ - NULL, /* PyObject *tp_cache; */ - NULL, /* PyObject *tp_subclasses; */ - NULL, /* PyObject *tp_weaklist; */ - NULL, + /*tp_iter*/ NULL, + /*tp_iternext*/ NULL, + /*tp_methods*/ pyrna_prop_methods, + /*tp_members*/ NULL, + /*tp_getset*/ pyrna_prop_getseters, + /*tp_base*/ NULL, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ NULL, + /*tp_alloc*/ NULL, + /*tp_new*/ pyrna_prop_new, + /*tp_free*/ NULL, + /*tp_is_gc*/ NULL, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, }; PyTypeObject pyrna_prop_array_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "bpy_prop_array", /* tp_name */ - sizeof(BPy_PropertyArrayRNA), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)pyrna_prop_array_dealloc, /* tp_dealloc */ - 0, /* tp_vectorcall_offset */ - NULL, /* getattrfunc tp_getattr; */ - NULL, /* setattrfunc tp_setattr; */ - NULL, - /* tp_compare */ /* DEPRECATED in Python 3.0! */ - (reprfunc)pyrna_prop_array_repr, /* tp_repr */ - - /* Method suites for standard classes */ - - &pyrna_prop_array_as_number, /* PyNumberMethods *tp_as_number; */ - &pyrna_prop_array_as_sequence, /* PySequenceMethods *tp_as_sequence; */ - &pyrna_prop_array_as_mapping, /* PyMappingMethods *tp_as_mapping; */ - - /* More standard operations (here for binary compatibility) */ - - NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ - NULL, /* reprfunc tp_str; */ - - /* will only use these if this is a subtype of a py class */ - (getattrofunc)pyrna_prop_array_getattro, /* getattrofunc tp_getattro; */ - NULL, /* setattrofunc tp_setattro; */ - - /* Functions to access object as input/output buffer */ - NULL, /* PyBufferProcs *tp_as_buffer; */ - - /*** Flags to define presence of optional/expanded features ***/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* long tp_flags; */ - - NULL, /* char *tp_doc; Documentation string */ - /*** Assigned meaning in release 2.0 ***/ - /* call function for all accessible objects */ - NULL, /* traverseproc tp_traverse; */ - - /* delete references to contained objects */ - NULL, /* inquiry tp_clear; */ - - /*** Assigned meaning in release 2.1 ***/ - /*** rich comparisons (subclassed) ***/ - NULL, /* richcmpfunc tp_richcompare; */ - -/*** weak reference enabler ***/ + PyVarObject_HEAD_INIT(NULL, 0) + /*tp_name*/ "bpy_prop_array", + /*tp_basicsize*/ sizeof(BPy_PropertyArrayRNA), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ (destructor)pyrna_prop_array_dealloc, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ (reprfunc)pyrna_prop_array_repr, + /*tp_as_number*/ &pyrna_prop_array_as_number, + /*tp_as_sequence*/ &pyrna_prop_array_as_sequence, + /*tp_as_mapping*/ &pyrna_prop_array_as_mapping, + /*tp_hash*/ NULL, + /*tp_call*/ NULL, + /*tp_str*/ NULL, + /*tp_getattro*/ (getattrofunc)pyrna_prop_array_getattro, + /*tp_setattro*/ NULL, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, + /*tp_doc*/ NULL, + /*tp_traverse*/ NULL, + /*tp_clear*/ NULL, + /*tp_richcompare*/ NULL, #ifdef USE_WEAKREFS - offsetof(BPy_PropertyArrayRNA, in_weakreflist), /* long tp_weaklistoffset; */ + /*tp_weaklistoffset*/ offsetof(BPy_PropertyArrayRNA, in_weakreflist), #else - 0, + /*tp_weaklistoffset*/ 0, #endif - /*** Added in release 2.2 ***/ - /* Iterators */ - (getiterfunc)pyrna_prop_array_iter, /* getiterfunc tp_iter; */ - NULL, /* iternextfunc tp_iternext; */ - - /*** Attribute descriptor and subclassing stuff ***/ - pyrna_prop_array_methods, /* struct PyMethodDef *tp_methods; */ - NULL, /* struct PyMemberDef *tp_members; */ - NULL /*pyrna_prop_getseters*/, /* struct PyGetSetDef *tp_getset; */ - &pyrna_prop_Type, /* struct _typeobject *tp_base; */ - NULL, /* PyObject *tp_dict; */ - NULL, /* descrgetfunc tp_descr_get; */ - NULL, /* descrsetfunc tp_descr_set; */ - 0, /* long tp_dictoffset; */ - NULL, /* initproc tp_init; */ - NULL, /* allocfunc tp_alloc; */ - NULL, /* newfunc tp_new; */ - /* Low-level free-memory routine */ - NULL, /* freefunc tp_free; */ - /* For PyObject_IS_GC */ - NULL, /* inquiry tp_is_gc; */ - NULL, /* PyObject *tp_bases; */ - /* method resolution order */ - NULL, /* PyObject *tp_mro; */ - NULL, /* PyObject *tp_cache; */ - NULL, /* PyObject *tp_subclasses; */ - NULL, /* PyObject *tp_weaklist; */ - NULL, + /*tp_iter*/ (getiterfunc)pyrna_prop_array_iter, + /*tp_iternext*/ NULL, + /*tp_methods*/ pyrna_prop_array_methods, + /*tp_members*/ NULL, + /*tp_getset*/ NULL /* Sub-classed: #pyrna_prop_getseters. */, + /*tp_base*/ &pyrna_prop_Type, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ NULL, + /*tp_alloc*/ NULL, + /*tp_new*/ NULL, + /*tp_free*/ NULL, + /*tp_is_gc*/ NULL, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, }; PyTypeObject pyrna_prop_collection_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "bpy_prop_collection", /* tp_name */ - sizeof(BPy_PropertyRNA), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)pyrna_prop_dealloc, /* tp_dealloc */ - 0, /* tp_vectorcall_offset */ - NULL, /* getattrfunc tp_getattr; */ - NULL, /* setattrfunc tp_setattr; */ - NULL, - /* tp_compare */ /* DEPRECATED in Python 3.0! */ - NULL, - /* subclassed */ /* tp_repr */ - - /* Method suites for standard classes */ - - &pyrna_prop_collection_as_number, /* PyNumberMethods *tp_as_number; */ - &pyrna_prop_collection_as_sequence, /* PySequenceMethods *tp_as_sequence; */ - &pyrna_prop_collection_as_mapping, /* PyMappingMethods *tp_as_mapping; */ - - /* More standard operations (here for binary compatibility) */ - - NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ - NULL, /* reprfunc tp_str; */ - - /* will only use these if this is a subtype of a py class */ - (getattrofunc)pyrna_prop_collection_getattro, /* getattrofunc tp_getattro; */ - (setattrofunc)pyrna_prop_collection_setattro, /* setattrofunc tp_setattro; */ - - /* Functions to access object as input/output buffer */ - NULL, /* PyBufferProcs *tp_as_buffer; */ - - /*** Flags to define presence of optional/expanded features ***/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* long tp_flags; */ - - NULL, /* char *tp_doc; Documentation string */ - /*** Assigned meaning in release 2.0 ***/ - /* call function for all accessible objects */ - NULL, /* traverseproc tp_traverse; */ - - /* delete references to contained objects */ - NULL, /* inquiry tp_clear; */ - - /*** Assigned meaning in release 2.1 ***/ - /*** rich comparisons (subclassed) ***/ - NULL, /* richcmpfunc tp_richcompare; */ - -/*** weak reference enabler ***/ + PyVarObject_HEAD_INIT(NULL, 0) + /*tp_name*/ "bpy_prop_collection", + /*tp_basicsize*/ sizeof(BPy_PropertyRNA), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ (destructor)pyrna_prop_dealloc, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ NULL, /* Sub-classed, no need to define. */ + /*tp_as_number*/ &pyrna_prop_collection_as_number, + /*tp_as_sequence*/ &pyrna_prop_collection_as_sequence, + /*tp_as_mapping*/ &pyrna_prop_collection_as_mapping, + /*tp_hash*/ NULL, + /*tp_call*/ NULL, + /*tp_str*/ NULL, + /*tp_getattro*/ (getattrofunc)pyrna_prop_collection_getattro, + /*tp_setattro*/ (setattrofunc)pyrna_prop_collection_setattro, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, + /*tp_doc*/ NULL, + /*tp_traverse*/ NULL, + /*tp_clear*/ NULL, + /*tp_richcompare*/ NULL, #ifdef USE_WEAKREFS - offsetof(BPy_PropertyRNA, in_weakreflist), /* long tp_weaklistoffset; */ + /*tp_weaklistoffset*/ offsetof(BPy_PropertyRNA, in_weakreflist), #else - 0, + /*tp_weaklistoffset*/ 0, #endif - - /*** Added in release 2.2 ***/ - /* Iterators */ - (getiterfunc)pyrna_prop_collection_iter, /* getiterfunc tp_iter; */ - NULL, /* iternextfunc tp_iternext; */ - - /*** Attribute descriptor and subclassing stuff ***/ - pyrna_prop_collection_methods, /* struct PyMethodDef *tp_methods; */ - NULL, /* struct PyMemberDef *tp_members; */ - NULL /*pyrna_prop_getseters*/, /* struct PyGetSetDef *tp_getset; */ - &pyrna_prop_Type, /* struct _typeobject *tp_base; */ - NULL, /* PyObject *tp_dict; */ - NULL, /* descrgetfunc tp_descr_get; */ - NULL, /* descrsetfunc tp_descr_set; */ - 0, /* long tp_dictoffset; */ - NULL, /* initproc tp_init; */ - NULL, /* allocfunc tp_alloc; */ - NULL, /* newfunc tp_new; */ - /* Low-level free-memory routine */ - NULL, /* freefunc tp_free; */ - /* For PyObject_IS_GC */ - NULL, /* inquiry tp_is_gc; */ - NULL, /* PyObject *tp_bases; */ - /* method resolution order */ - NULL, /* PyObject *tp_mro; */ - NULL, /* PyObject *tp_cache; */ - NULL, /* PyObject *tp_subclasses; */ - NULL, /* PyObject *tp_weaklist; */ - NULL, + /*tp_iter*/ (getiterfunc)pyrna_prop_collection_iter, + /*tp_iternext*/ NULL, + /*tp_methods*/ pyrna_prop_collection_methods, + /*tp_members*/ NULL, + /*tp_getset*/ NULL /*Sub-classed: see #pyrna_prop_getseters. */, + /*tp_base*/ &pyrna_prop_Type, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ NULL, + /*tp_alloc*/ NULL, + /*tp_new*/ NULL, + /*tp_free*/ NULL, + /*tp_is_gc*/ NULL, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, }; /* only for add/remove/move methods */ static PyTypeObject pyrna_prop_collection_idprop_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "bpy_prop_collection_idprop", /* tp_name */ - sizeof(BPy_PropertyRNA), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)pyrna_prop_dealloc, /* tp_dealloc */ - 0, /* tp_vectorcall_offset */ - NULL, /* getattrfunc tp_getattr; */ - NULL, /* setattrfunc tp_setattr; */ - NULL, - /* tp_compare */ /* DEPRECATED in Python 3.0! */ - NULL, - /* subclassed */ /* tp_repr */ - - /* Method suites for standard classes */ - - NULL, /* PyNumberMethods *tp_as_number; */ - NULL, /* PySequenceMethods *tp_as_sequence; */ - NULL, /* PyMappingMethods *tp_as_mapping; */ - - /* More standard operations (here for binary compatibility) */ - - NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ - NULL, /* reprfunc tp_str; */ - - /* will only use these if this is a subtype of a py class */ - NULL, /* getattrofunc tp_getattro; */ - NULL, /* setattrofunc tp_setattro; */ - - /* Functions to access object as input/output buffer */ - NULL, /* PyBufferProcs *tp_as_buffer; */ - - /*** Flags to define presence of optional/expanded features ***/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* long tp_flags; */ - - NULL, /* char *tp_doc; Documentation string */ - /*** Assigned meaning in release 2.0 ***/ - /* call function for all accessible objects */ - NULL, /* traverseproc tp_traverse; */ - - /* delete references to contained objects */ - NULL, /* inquiry tp_clear; */ - - /*** Assigned meaning in release 2.1 ***/ - /*** rich comparisons (subclassed) ***/ - NULL, /* richcmpfunc tp_richcompare; */ - -/*** weak reference enabler ***/ + PyVarObject_HEAD_INIT(NULL, 0) + /*tp_name*/ "bpy_prop_collection_idprop", + /*tp_basicsize*/ sizeof(BPy_PropertyRNA), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ (destructor)pyrna_prop_dealloc, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_compare*/ NULL, /* DEPRECATED. */ + /*tp_repr*/ NULL, /* Sub-classed, no need to define. */ + /*tp_as_number*/ NULL, + /*tp_as_sequence*/ NULL, + /*tp_as_mapping*/ NULL, + /*tp_hash*/ NULL, + /*tp_call*/ NULL, + /*tp_str*/ NULL, + /*tp_getattro*/ NULL, + /*tp_setattro*/ NULL, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, + /*tp_doc*/ NULL, + /*tp_traverse*/ NULL, + /*tp_clear*/ NULL, + /*tp_richcompare*/ NULL, #ifdef USE_WEAKREFS - offsetof(BPy_PropertyRNA, in_weakreflist), /* long tp_weaklistoffset; */ + /*tp_weaklistoffset*/ offsetof(BPy_PropertyRNA, in_weakreflist), #else - 0, + /*tp_weaklistoffset*/ 0, #endif - - /*** Added in release 2.2 ***/ - /* Iterators */ - NULL, /* getiterfunc tp_iter; */ - NULL, /* iternextfunc tp_iternext; */ - - /*** Attribute descriptor and subclassing stuff ***/ - pyrna_prop_collection_idprop_methods, /* struct PyMethodDef *tp_methods; */ - NULL, /* struct PyMemberDef *tp_members; */ - NULL /*pyrna_prop_getseters*/, /* struct PyGetSetDef *tp_getset; */ - &pyrna_prop_collection_Type, /* struct _typeobject *tp_base; */ - NULL, /* PyObject *tp_dict; */ - NULL, /* descrgetfunc tp_descr_get; */ - NULL, /* descrsetfunc tp_descr_set; */ - 0, /* long tp_dictoffset; */ - NULL, /* initproc tp_init; */ - NULL, /* allocfunc tp_alloc; */ - NULL, /* newfunc tp_new; */ - /* Low-level free-memory routine */ - NULL, /* freefunc tp_free; */ - /* For PyObject_IS_GC */ - NULL, /* inquiry tp_is_gc; */ - NULL, /* PyObject *tp_bases; */ - /* method resolution order */ - NULL, /* PyObject *tp_mro; */ - NULL, /* PyObject *tp_cache; */ - NULL, /* PyObject *tp_subclasses; */ - NULL, /* PyObject *tp_weaklist; */ - NULL, + /*tp_iter*/ NULL, + /*tp_iternext*/ NULL, + /*tp_methods*/ pyrna_prop_collection_idprop_methods, + /*tp_members*/ NULL, + /*tp_getset*/ NULL /* Sub-classed: #pyrna_prop_getseters. */, + /*tp_base*/ &pyrna_prop_collection_Type, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ NULL, + /*tp_alloc*/ NULL, + /*tp_new*/ NULL, + /*tp_free*/ NULL, + /*tp_is_gc*/ NULL, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, }; /*-----------------------BPy_PropertyRNA method def------------------------------*/ PyTypeObject pyrna_func_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "bpy_func", /* tp_name */ - sizeof(BPy_FunctionRNA), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - NULL, /* tp_dealloc */ - 0, /* tp_vectorcall_offset */ - NULL, /* getattrfunc tp_getattr; */ - NULL, /* setattrfunc tp_setattr; */ - NULL, - /* tp_compare */ /* DEPRECATED in Python 3.0! */ - (reprfunc)pyrna_func_repr, /* tp_repr */ - - /* Method suites for standard classes */ - - NULL, /* PyNumberMethods *tp_as_number; */ - NULL, /* PySequenceMethods *tp_as_sequence; */ - NULL, /* PyMappingMethods *tp_as_mapping; */ - - /* More standard operations (here for binary compatibility) */ - - NULL, /* hashfunc tp_hash; */ - (ternaryfunc)pyrna_func_call, /* ternaryfunc tp_call; */ - NULL, /* reprfunc tp_str; */ - - /* will only use these if this is a subtype of a py class */ - NULL, /* getattrofunc tp_getattro; */ - NULL, /* setattrofunc tp_setattro; */ - - /* Functions to access object as input/output buffer */ - NULL, /* PyBufferProcs *tp_as_buffer; */ - - /*** Flags to define presence of optional/expanded features ***/ - Py_TPFLAGS_DEFAULT, /* long tp_flags; */ - - NULL, /* char *tp_doc; Documentation string */ - /*** Assigned meaning in release 2.0 ***/ - /* call function for all accessible objects */ - NULL, /* traverseproc tp_traverse; */ - - /* delete references to contained objects */ - NULL, /* inquiry tp_clear; */ - - /*** Assigned meaning in release 2.1 ***/ - /*** rich comparisons ***/ - NULL, /* richcmpfunc tp_richcompare; */ - -/*** weak reference enabler ***/ + PyVarObject_HEAD_INIT(NULL, 0) + /*tp_name*/ "bpy_func", + /*tp_basicsize*/ sizeof(BPy_FunctionRNA), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ NULL, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ (reprfunc)pyrna_func_repr, + /*tp_as_number*/ NULL, + /*tp_as_sequence*/ NULL, + /*tp_as_mapping*/ NULL, + /*tp_hash*/ NULL, + /*tp_call*/ (ternaryfunc)pyrna_func_call, + /*tp_str*/ NULL, + /*tp_getattro*/ NULL, + /*tp_setattro*/ NULL, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT, + /*tp_doc*/ NULL, + /*tp_traverse*/ NULL, + /*tp_clear*/ NULL, + /*tp_richcompare*/ NULL, #ifdef USE_WEAKREFS - offsetof(BPy_PropertyRNA, in_weakreflist), /* long tp_weaklistoffset; */ + /*tp_weaklistoffset*/ offsetof(BPy_PropertyRNA, in_weakreflist), #else - 0, + /*tp_weaklistoffset*/ 0, #endif - - /*** Added in release 2.2 ***/ - /* Iterators */ - NULL, /* getiterfunc tp_iter; */ - NULL, /* iternextfunc tp_iternext; */ - - /*** Attribute descriptor and subclassing stuff ***/ - NULL, /* struct PyMethodDef *tp_methods; */ - NULL, /* struct PyMemberDef *tp_members; */ - pyrna_func_getseters, /* struct PyGetSetDef *tp_getset; */ - NULL, /* struct _typeobject *tp_base; */ - NULL, /* PyObject *tp_dict; */ - NULL, /* descrgetfunc tp_descr_get; */ - NULL, /* descrsetfunc tp_descr_set; */ - 0, /* long tp_dictoffset; */ - NULL, /* initproc tp_init; */ - NULL, /* allocfunc tp_alloc; */ - NULL, /* newfunc tp_new; */ - /* Low-level free-memory routine */ - NULL, /* freefunc tp_free; */ - /* For PyObject_IS_GC */ - NULL, /* inquiry tp_is_gc; */ - NULL, /* PyObject *tp_bases; */ - /* method resolution order */ - NULL, /* PyObject *tp_mro; */ - NULL, /* PyObject *tp_cache; */ - NULL, /* PyObject *tp_subclasses; */ - NULL, /* PyObject *tp_weaklist; */ - NULL, + /*tp_iter*/ NULL, + /*tp_iternext*/ NULL, + /*tp_methods*/ NULL, + /*tp_members*/ NULL, + /*tp_getset*/ pyrna_func_getseters, + /*tp_base*/ NULL, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ NULL, + /*tp_alloc*/ NULL, + /*tp_new*/ NULL, + /*tp_free*/ NULL, + /*tp_is_gc*/ NULL, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, }; #ifdef USE_PYRNA_ITER @@ -7098,87 +6939,59 @@ static void pyrna_prop_collection_iter_dealloc(BPy_PropertyCollectionIterRNA *se static PyObject *pyrna_prop_collection_iter_next(BPy_PropertyCollectionIterRNA *self); static PyTypeObject pyrna_prop_collection_iter_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "bpy_prop_collection_iter", /* tp_name */ - sizeof(BPy_PropertyCollectionIterRNA), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)pyrna_prop_collection_iter_dealloc, /* tp_dealloc */ - 0, /* tp_vectorcall_offset */ - NULL, /* getattrfunc tp_getattr; */ - NULL, /* setattrfunc tp_setattr; */ - NULL, - /* tp_compare */ /* DEPRECATED in Python 3.0! */ - NULL, - /* subclassed */ /* tp_repr */ - - /* Method suites for standard classes */ - - NULL, /* PyNumberMethods *tp_as_number; */ - NULL, /* PySequenceMethods *tp_as_sequence; */ - NULL, /* PyMappingMethods *tp_as_mapping; */ - - /* More standard operations (here for binary compatibility) */ - - NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ - NULL, /* reprfunc tp_str; */ - - /* will only use these if this is a subtype of a py class */ - PyObject_GenericGetAttr, /* getattrofunc tp_getattro; */ - NULL, /* setattrofunc tp_setattro; */ - - /* Functions to access object as input/output buffer */ - NULL, /* PyBufferProcs *tp_as_buffer; */ - - /*** Flags to define presence of optional/expanded features ***/ - Py_TPFLAGS_DEFAULT, /* long tp_flags; */ - - NULL, /* char *tp_doc; Documentation string */ - /*** Assigned meaning in release 2.0 ***/ - /* call function for all accessible objects */ - NULL, /* traverseproc tp_traverse; */ - - /* delete references to contained objects */ - NULL, /* inquiry tp_clear; */ - - /*** Assigned meaning in release 2.1 ***/ - /*** rich comparisons (subclassed) ***/ - NULL, /* richcmpfunc tp_richcompare; */ - -/*** weak reference enabler ***/ + PyVarObject_HEAD_INIT(NULL, 0) + /*tp_name*/ "bpy_prop_collection_iter", + /*tp_basicsize*/ sizeof(BPy_PropertyCollectionIterRNA), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ (destructor)pyrna_prop_collection_iter_dealloc, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ NULL, /* No need to define, sub-classed. */ + /*tp_as_number*/ NULL, + /*tp_as_sequence*/ NULL, + /*tp_as_mapping*/ NULL, + /*tp_hash*/ NULL, + /*tp_call*/ NULL, + /*tp_str*/ NULL, + /*tp_getattro*/ PyObject_GenericGetAttr, + /*tp_setattro*/ NULL, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT, + /*tp_doc*/ NULL, + /*tp_traverse*/ NULL, + /*tp_clear*/ NULL, + /*tp_richcompare*/ NULL, # ifdef USE_WEAKREFS - offsetof(BPy_PropertyCollectionIterRNA, in_weakreflist), /* long tp_weaklistoffset; */ + /*tp_weaklistoffset*/ offsetof(BPy_PropertyCollectionIterRNA, in_weakreflist), # else - 0, + /*tp_weaklistoffset*/ 0, # endif - /*** Added in release 2.2 ***/ - /* Iterators */ - PyObject_SelfIter, /* getiterfunc tp_iter; */ - (iternextfunc)pyrna_prop_collection_iter_next, /* iternextfunc tp_iternext; */ - - /*** Attribute descriptor and subclassing stuff ***/ - NULL, /* struct PyMethodDef *tp_methods; */ - NULL, /* struct PyMemberDef *tp_members; */ - NULL, /* struct PyGetSetDef *tp_getset; */ - NULL, /* struct _typeobject *tp_base; */ - NULL, /* PyObject *tp_dict; */ - NULL, /* descrgetfunc tp_descr_get; */ - NULL, /* descrsetfunc tp_descr_set; */ - 0, /* long tp_dictoffset; */ - NULL, /* initproc tp_init; */ - NULL, /* allocfunc tp_alloc; */ - NULL, /* newfunc tp_new; */ - /* Low-level free-memory routine */ - NULL, /* freefunc tp_free; */ - /* For PyObject_IS_GC */ - NULL, /* inquiry tp_is_gc; */ - NULL, /* PyObject *tp_bases; */ - /* method resolution order */ - NULL, /* PyObject *tp_mro; */ - NULL, /* PyObject *tp_cache; */ - NULL, /* PyObject *tp_subclasses; */ - NULL, /* PyObject *tp_weaklist; */ - NULL, + /*tp_iter*/ PyObject_SelfIter, + /*tp_iternext*/ (iternextfunc)pyrna_prop_collection_iter_next, + /*tp_methods*/ NULL, + /*tp_members*/ NULL, + /*tp_getset*/ NULL, + /*tp_base*/ NULL, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ NULL, + /*tp_alloc*/ NULL, + /*tp_new*/ NULL, + /*tp_free*/ NULL, + /*tp_is_gc*/ NULL, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, }; static PyObject *pyrna_prop_collection_iter_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop) @@ -7865,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_rna_data.c b/source/blender/python/intern/bpy_rna_data.c index 3c7ec3bddc3..2dc0b8dc999 100644 --- a/source/blender/python/intern/bpy_rna_data.c +++ b/source/blender/python/intern/bpy_rna_data.c @@ -60,84 +60,56 @@ static void bpy_rna_data_context_dealloc(BPy_DataContext *self) Py_CLEAR(self->data_rna); PyObject_GC_Del(self); } - static PyTypeObject bpy_rna_data_context_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "bpy_rna_data_context", /* tp_name */ - sizeof(BPy_DataContext), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)bpy_rna_data_context_dealloc, /* tp_dealloc */ - 0, /* tp_vectorcall_offset */ - NULL, /* getattrfunc tp_getattr; */ - NULL, /* setattrfunc tp_setattr; */ - NULL, - /* tp_compare */ /* DEPRECATED in python 3.0! */ - NULL, /* tp_repr */ - - /* Method suites for standard classes */ - - NULL, /* PyNumberMethods *tp_as_number; */ - NULL, /* PySequenceMethods *tp_as_sequence; */ - NULL, /* PyMappingMethods *tp_as_mapping; */ - - /* More standard operations (here for binary compatibility) */ - - NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ - NULL, /* reprfunc tp_str; */ - - /* Will only use these if this is a sub-type of a Python class. */ - NULL, /* getattrofunc tp_getattro; */ - NULL, /* setattrofunc tp_setattro; */ - - /* Functions to access object as input/output buffer */ - NULL, /* PyBufferProcs *tp_as_buffer; */ - - /*** Flags to define presence of optional/expanded features ***/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* long tp_flags; */ - - NULL, /* char *tp_doc; Documentation string */ - /*** Assigned meaning in release 2.0 ***/ - /* call function for all accessible objects */ - (traverseproc)bpy_rna_data_context_traverse, /* traverseproc tp_traverse; */ - - /* delete references to contained objects */ - (inquiry)bpy_rna_data_context_clear, /* inquiry tp_clear; */ - - /*** Assigned meaning in release 2.1 ***/ - /*** rich comparisons (subclassed) ***/ - NULL, /* richcmpfunc tp_richcompare; */ - - /*** weak reference enabler ***/ - 0, - /*** Added in release 2.2 ***/ - /* Iterators */ - NULL, /* getiterfunc tp_iter; */ - NULL, /* iternextfunc tp_iternext; */ - - /*** Attribute descriptor and subclassing stuff ***/ - bpy_rna_data_context_methods, /* struct PyMethodDef *tp_methods; */ - NULL, /* struct PyMemberDef *tp_members; */ - NULL, /* struct PyGetSetDef *tp_getset; */ - NULL, /* struct _typeobject *tp_base; */ - NULL, /* PyObject *tp_dict; */ - NULL, /* descrgetfunc tp_descr_get; */ - NULL, /* descrsetfunc tp_descr_set; */ - 0, /* long tp_dictoffset; */ - NULL, /* initproc tp_init; */ - NULL, /* allocfunc tp_alloc; */ - NULL, /* newfunc tp_new; */ - /* Low-level free-memory routine */ - NULL, /* freefunc tp_free; */ - /* For PyObject_IS_GC */ - NULL, /* inquiry tp_is_gc; */ - NULL, /* PyObject *tp_bases; */ - /* method resolution order */ - NULL, /* PyObject *tp_mro; */ - NULL, /* PyObject *tp_cache; */ - NULL, /* PyObject *tp_subclasses; */ - NULL, /* PyObject *tp_weaklist; */ - NULL, + PyVarObject_HEAD_INIT(NULL, 0) + /*tp_name*/ "bpy_rna_data_context", + /*tp_basicsize*/ sizeof(BPy_DataContext), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ (destructor)bpy_rna_data_context_dealloc, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ NULL, + /*tp_as_number*/ NULL, + /*tp_as_sequence*/ NULL, + /*tp_as_mapping*/ NULL, + /*tp_hash*/ NULL, + /*tp_call*/ NULL, + /*tp_str*/ NULL, + /*tp_getattro*/ NULL, + /*tp_setattro*/ NULL, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, + /*tp_doc*/ NULL, + /*tp_traverse*/ (traverseproc)bpy_rna_data_context_traverse, + /*tp_clear*/ (inquiry)bpy_rna_data_context_clear, + /*tp_richcompare*/ NULL, + /*tp_weaklistoffset*/ 0, + /*tp_iter*/ NULL, + /*tp_iternext*/ NULL, + /*tp_methods*/ bpy_rna_data_context_methods, + /*tp_members*/ NULL, + /*tp_getset*/ NULL, + /*tp_base*/ NULL, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ NULL, + /*tp_alloc*/ NULL, + /*tp_new*/ NULL, + /*tp_free*/ NULL, + /*tp_is_gc*/ NULL, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, }; PyDoc_STRVAR(bpy_rna_data_context_load_doc, 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 5218ea68f7b..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; @@ -825,59 +825,61 @@ static PyObject *Color_neg(ColorObject *self) * \{ */ static PySequenceMethods Color_SeqMethods = { - (lenfunc)Color_len, /*sq_length*/ - (binaryfunc)NULL, /*sq_concat*/ - (ssizeargfunc)NULL, /*sq_repeat*/ - (ssizeargfunc)Color_item, /*sq_item*/ - NULL, /*sq_slice(DEPRECATED)*/ - (ssizeobjargproc)Color_ass_item, /*sq_ass_item*/ - NULL, /*sq_ass_slice(DEPRECATED)*/ - (objobjproc)NULL, /*sq_contains*/ - (binaryfunc)NULL, /*sq_inplace_concat*/ - (ssizeargfunc)NULL, /*sq_inplace_repeat*/ + /*sq_length*/ (lenfunc)Color_len, + /*sq_concat*/ NULL, + /*sq_repeat*/ NULL, + /*sq_item*/ (ssizeargfunc)Color_item, + /*was_sq_slice*/ NULL, /* DEPRECATED. */ + /*sq_ass_item*/ (ssizeobjargproc)Color_ass_item, + /*was_sq_ass_slice*/ NULL, /* DEPRECATED. */ + /*sq_contains*/ NULL, + /*sq_inplace_concat*/ NULL, + /*sq_inplace_repeat*/ NULL, }; static PyMappingMethods Color_AsMapping = { - (lenfunc)Color_len, - (binaryfunc)Color_subscript, - (objobjargproc)Color_ass_subscript, + /*mp_len*/ (lenfunc)Color_len, + /*mp_subscript*/ (binaryfunc)Color_subscript, + /*mp_ass_subscript*/ (objobjargproc)Color_ass_subscript, }; static PyNumberMethods Color_NumMethods = { - (binaryfunc)Color_add, /*nb_add*/ - (binaryfunc)Color_sub, /*nb_subtract*/ - (binaryfunc)Color_mul, /*nb_multiply*/ - NULL, /*nb_remainder*/ - NULL, /*nb_divmod*/ - NULL, /*nb_power*/ - (unaryfunc)Color_neg, /*nb_negative*/ - (unaryfunc)Color_copy, /*tp_positive*/ - (unaryfunc)NULL, /*tp_absolute*/ - (inquiry)NULL, /*tp_bool*/ - (unaryfunc)NULL, /*nb_invert*/ - NULL, /*nb_lshift*/ - (binaryfunc)NULL, /*nb_rshift*/ - NULL, /*nb_and*/ - NULL, /*nb_xor*/ - NULL, /*nb_or*/ - NULL, /*nb_int*/ - NULL, /*nb_reserved*/ - NULL, /*nb_float*/ - Color_iadd, /*nb_inplace_add*/ - Color_isub, /*nb_inplace_subtract*/ - Color_imul, /*nb_inplace_multiply*/ - NULL, /*nb_inplace_remainder*/ - NULL, /*nb_inplace_power*/ - NULL, /*nb_inplace_lshift*/ - NULL, /*nb_inplace_rshift*/ - NULL, /*nb_inplace_and*/ - NULL, /*nb_inplace_xor*/ - NULL, /*nb_inplace_or*/ - NULL, /*nb_floor_divide*/ - Color_div, /*nb_true_divide*/ - NULL, /*nb_inplace_floor_divide*/ - Color_idiv, /*nb_inplace_true_divide*/ - NULL, /*nb_index*/ + /*nb_add*/ (binaryfunc)Color_add, + /*nb_subtract*/ (binaryfunc)Color_sub, + /*nb_multiply*/ (binaryfunc)Color_mul, + /*nb_remainder*/ NULL, + /*nb_divmod*/ NULL, + /*nb_power*/ NULL, + /*nb_negative*/ (unaryfunc)Color_neg, + /*tp_positive*/ (unaryfunc)Color_copy, + /*tp_absolute*/ NULL, + /*tp_bool*/ NULL, + /*nb_invert*/ NULL, + /*nb_lshift*/ NULL, + /*nb_rshift*/ NULL, + /*nb_and*/ NULL, + /*nb_xor*/ NULL, + /*nb_or*/ NULL, + /*nb_int*/ NULL, + /*nb_reserved*/ NULL, + /*nb_float*/ NULL, + /*nb_inplace_add*/ Color_iadd, + /*nb_inplace_subtract*/ Color_isub, + /*nb_inplace_multiply*/ Color_imul, + /*nb_inplace_remainder*/ NULL, + /*nb_inplace_power*/ NULL, + /*nb_inplace_lshift*/ NULL, + /*nb_inplace_rshift*/ NULL, + /*nb_inplace_and*/ NULL, + /*nb_inplace_xor*/ NULL, + /*nb_inplace_or*/ NULL, + /*nb_floor_divide*/ NULL, + /*nb_true_divide*/ Color_div, + /*nb_inplace_floor_divide*/ NULL, + /*nb_inplace_true_divide*/ Color_idiv, + /*nb_index*/ NULL, + /*nb_matrix_multiply*/ NULL, + /*nb_inplace_matrix_multiply*/ NULL, }; /** \} */ @@ -1100,6 +1102,10 @@ static struct PyMethodDef Color_methods[] = { /** \name Color Type: Python Object Definition * \{ */ +#ifdef MATH_STANDALONE +# define Color_str NULL +#endif + PyDoc_STRVAR( color_doc, ".. class:: Color(rgb)\n" @@ -1113,57 +1119,61 @@ PyDoc_STRVAR( " :arg rgb: (r, g, b) color values\n" " :type rgb: 3d vector\n"); PyTypeObject color_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "Color", /* tp_name */ - sizeof(ColorObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)BaseMathObject_dealloc, /* tp_dealloc */ - (printfunc)NULL, /* tp_print */ - NULL, /* tp_getattr */ - NULL, /* tp_setattr */ - NULL, /* tp_compare */ - (reprfunc)Color_repr, /* tp_repr */ - &Color_NumMethods, /* tp_as_number */ - &Color_SeqMethods, /* tp_as_sequence */ - &Color_AsMapping, /* tp_as_mapping */ - (hashfunc)Color_hash, /* tp_hash */ - NULL, /* tp_call */ -#ifndef MATH_STANDALONE - (reprfunc)Color_str, /* tp_str */ -#else - NULL, /* tp_str */ -#endif - NULL, /* tp_getattro */ - NULL, /* tp_setattro */ - NULL, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags */ - color_doc, /* tp_doc */ - (traverseproc)BaseMathObject_traverse, /* tp_traverse */ - (inquiry)BaseMathObject_clear, /* tp_clear */ - (richcmpfunc)Color_richcmpr, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - NULL, /* tp_iter */ - NULL, /* tp_iternext */ - Color_methods, /* tp_methods */ - NULL, /* tp_members */ - Color_getseters, /* tp_getset */ - NULL, /* tp_base */ - NULL, /* tp_dict */ - NULL, /* tp_descr_get */ - NULL, /* tp_descr_set */ - 0, /* tp_dictoffset */ - NULL, /* tp_init */ - NULL, /* tp_alloc */ - Color_new, /* tp_new */ - NULL, /* tp_free */ - (inquiry)BaseMathObject_is_gc, /* tp_is_gc */ - NULL, /* tp_bases */ - NULL, /* tp_mro */ - NULL, /* tp_cache */ - NULL, /* tp_subclasses */ - NULL, /* tp_weaklist */ - NULL, /* tp_del */ + PyVarObject_HEAD_INIT(NULL, 0) + /*tp_name*/ "Color", + /*tp_basicsize*/ sizeof(ColorObject), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ (destructor)BaseMathObject_dealloc, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ (reprfunc)Color_repr, + /*tp_as_number*/ &Color_NumMethods, + /*tp_as_sequence*/ &Color_SeqMethods, + /*tp_as_mapping*/ &Color_AsMapping, + /*tp_hash*/ (hashfunc)Color_hash, + /*tp_call*/ NULL, + /*tp_str*/ (reprfunc)Color_str, + /*tp_getattro*/ NULL, + /*tp_setattro*/ NULL, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, + /*tp_doc*/ color_doc, + /*tp_traverse*/ (traverseproc)BaseMathObject_traverse, + /*tp_clear*/ (inquiry)BaseMathObject_clear, + /*tp_richcompare*/ (richcmpfunc)Color_richcmpr, + /*tp_weaklistoffset*/ 0, + /*tp_iter*/ NULL, + /*tp_iternext*/ NULL, + /*tp_methods*/ Color_methods, + /*tp_members*/ NULL, + /*tp_getset*/ Color_getseters, + /*tp_base*/ NULL, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ NULL, + /*tp_alloc*/ NULL, + /*tp_new*/ Color_new, + /*tp_free*/ NULL, + /*tp_is_gc*/ (inquiry)BaseMathObject_is_gc, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, }; +#ifdef MATH_STANDALONE +# define Color_str +#endif + /** \} */ /* -------------------------------------------------------------------- */ diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c index ddc0f115742..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; @@ -636,22 +636,22 @@ static int Euler_ass_subscript(EulerObject *self, PyObject *item, PyObject *valu * \{ */ static PySequenceMethods Euler_SeqMethods = { - (lenfunc)Euler_len, /*sq_length*/ - (binaryfunc)NULL, /*sq_concat*/ - (ssizeargfunc)NULL, /*sq_repeat*/ - (ssizeargfunc)Euler_item, /*sq_item*/ - (ssizessizeargfunc)NULL, /*sq_slice(DEPRECATED)*/ - (ssizeobjargproc)Euler_ass_item, /*sq_ass_item*/ - (ssizessizeobjargproc)NULL, /*sq_ass_slice(DEPRECATED)*/ - (objobjproc)NULL, /*sq_contains*/ - (binaryfunc)NULL, /*sq_inplace_concat*/ - (ssizeargfunc)NULL, /*sq_inplace_repeat*/ + /*sq_length*/ (lenfunc)Euler_len, + /*sq_concat*/ NULL, + /*sq_repeat*/ NULL, + /*sq_item*/ (ssizeargfunc)Euler_item, + /*was_sq_slice*/ NULL, /* DEPRECATED. */ + /*sq_ass_item*/ (ssizeobjargproc)Euler_ass_item, + /*was_sq_ass_slice*/ NULL, /* DEPRECATED. */ + /*sq_contains*/ NULL, + /*sq_inplace_concat*/ NULL, + /*sq_inplace_repeat*/ NULL, }; static PyMappingMethods Euler_AsMapping = { - (lenfunc)Euler_len, - (binaryfunc)Euler_subscript, - (objobjargproc)Euler_ass_subscript, + /*mp_len*/ (lenfunc)Euler_len, + /*mp_subscript*/ (binaryfunc)Euler_subscript, + /*mp_ass_subscript*/ (objobjargproc)Euler_ass_subscript, }; /** \} */ @@ -766,6 +766,10 @@ static struct PyMethodDef Euler_methods[] = { /** \name Euler Type: Python Object Definition * \{ */ +#ifdef MATH_STANDALONE +# define Euler_str NULL +#endif + PyDoc_STRVAR( euler_doc, ".. class:: Euler(angles, order='XYZ')\n" @@ -779,57 +783,61 @@ PyDoc_STRVAR( " :arg order: Optional order of the angles, a permutation of ``XYZ``.\n" " :type order: str\n"); PyTypeObject euler_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "Euler", /* tp_name */ - sizeof(EulerObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)BaseMathObject_dealloc, /* tp_dealloc */ - (printfunc)NULL, /* tp_print */ - NULL, /* tp_getattr */ - NULL, /* tp_setattr */ - NULL, /* tp_compare */ - (reprfunc)Euler_repr, /* tp_repr */ - NULL, /* tp_as_number */ - &Euler_SeqMethods, /* tp_as_sequence */ - &Euler_AsMapping, /* tp_as_mapping */ - (hashfunc)Euler_hash, /* tp_hash */ - NULL, /* tp_call */ -#ifndef MATH_STANDALONE - (reprfunc)Euler_str, /* tp_str */ -#else - NULL, /* tp_str */ -#endif - NULL, /* tp_getattro */ - NULL, /* tp_setattro */ - NULL, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags */ - euler_doc, /* tp_doc */ - (traverseproc)BaseMathObject_traverse, /* tp_traverse */ - (inquiry)BaseMathObject_clear, /* tp_clear */ - (richcmpfunc)Euler_richcmpr, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - NULL, /* tp_iter */ - NULL, /* tp_iternext */ - Euler_methods, /* tp_methods */ - NULL, /* tp_members */ - Euler_getseters, /* tp_getset */ - NULL, /* tp_base */ - NULL, /* tp_dict */ - NULL, /* tp_descr_get */ - NULL, /* tp_descr_set */ - 0, /* tp_dictoffset */ - NULL, /* tp_init */ - NULL, /* tp_alloc */ - Euler_new, /* tp_new */ - NULL, /* tp_free */ - (inquiry)BaseMathObject_is_gc, /* tp_is_gc */ - NULL, /* tp_bases */ - NULL, /* tp_mro */ - NULL, /* tp_cache */ - NULL, /* tp_subclasses */ - NULL, /* tp_weaklist */ - NULL, /* tp_del */ + PyVarObject_HEAD_INIT(NULL, 0) + /*tp_name*/ "Euler", + /*tp_basicsize*/ sizeof(EulerObject), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ (destructor)BaseMathObject_dealloc, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ (reprfunc)Euler_repr, + /*tp_as_number*/ NULL, + /*tp_as_sequence*/ &Euler_SeqMethods, + /*tp_as_mapping*/ &Euler_AsMapping, + /*tp_hash*/ (hashfunc)Euler_hash, + /*tp_call*/ NULL, + /*tp_str*/ (reprfunc)Euler_str, + /*tp_getattro*/ NULL, + /*tp_setattro*/ NULL, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, + /*tp_doc*/ euler_doc, + /*tp_traverse*/ (traverseproc)BaseMathObject_traverse, + /*tp_clear*/ (inquiry)BaseMathObject_clear, + /*tp_richcompare*/ (richcmpfunc)Euler_richcmpr, + /*tp_weaklistoffset*/ 0, + /*tp_iter*/ NULL, + /*tp_iternext*/ NULL, + /*tp_methods*/ Euler_methods, + /*tp_members*/ NULL, + /*tp_getset*/ Euler_getseters, + /*tp_base*/ NULL, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ NULL, + /*tp_alloc*/ NULL, + /*tp_new*/ Euler_new, + /*tp_free*/ NULL, + /*tp_is_gc*/ (inquiry)BaseMathObject_is_gc, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, }; +#ifdef MATH_STANDALONE +# undef Euler_str +#endif + /** \} */ /* -------------------------------------------------------------------- */ diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index a44f42bc337..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; @@ -2964,61 +2964,61 @@ static PyObject *Matrix_imatmul(PyObject *m1, PyObject *m2) * \{ */ static PySequenceMethods Matrix_SeqMethods = { - (lenfunc)Matrix_len, /*sq_length*/ - (binaryfunc)NULL, /*sq_concat*/ - (ssizeargfunc)NULL, /*sq_repeat*/ - (ssizeargfunc)Matrix_item_row, /*sq_item*/ - (ssizessizeargfunc)NULL, /*sq_slice(DEPRECATED)*/ - (ssizeobjargproc)Matrix_ass_item_row, /*sq_ass_item*/ - (ssizessizeobjargproc)NULL, /*sq_ass_slice(DEPRECATED)*/ - (objobjproc)NULL, /*sq_contains*/ - (binaryfunc)NULL, /*sq_inplace_concat*/ - (ssizeargfunc)NULL, /*sq_inplace_repeat*/ + /*sq_length*/ (lenfunc)Matrix_len, + /*sq_concat*/ NULL, + /*sq_repeat*/ NULL, + /*sq_item*/ (ssizeargfunc)Matrix_item_row, + /*was_sq_slice*/ NULL, /* DEPRECATED. */ + /*sq_ass_item*/ (ssizeobjargproc)Matrix_ass_item_row, + /*was_sq_ass_slice*/ NULL, /* DEPRECATED. */ + /*sq_contains*/ NULL, + /*sq_inplace_concat*/ NULL, + /*sq_inplace_repeat*/ NULL, }; static PyMappingMethods Matrix_AsMapping = { - (lenfunc)Matrix_len, - (binaryfunc)Matrix_subscript, - (objobjargproc)Matrix_ass_subscript, + /*mp_len*/ (lenfunc)Matrix_len, + /*mp_subscript*/ (binaryfunc)Matrix_subscript, + /*mp_ass_subscript*/ (objobjargproc)Matrix_ass_subscript, }; static PyNumberMethods Matrix_NumMethods = { - (binaryfunc)Matrix_add, /*nb_add*/ - (binaryfunc)Matrix_sub, /*nb_subtract*/ - (binaryfunc)Matrix_mul, /*nb_multiply*/ - NULL, /*nb_remainder*/ - NULL, /*nb_divmod*/ - NULL, /*nb_power*/ - (unaryfunc)0, /*nb_negative*/ - (unaryfunc)0, /*tp_positive*/ - (unaryfunc)0, /*tp_absolute*/ - (inquiry)0, /*tp_bool*/ - (unaryfunc)Matrix_inverted_noargs, /*nb_invert*/ - NULL, /*nb_lshift*/ - (binaryfunc)0, /*nb_rshift*/ - NULL, /*nb_and*/ - NULL, /*nb_xor*/ - NULL, /*nb_or*/ - NULL, /*nb_int*/ - NULL, /*nb_reserved*/ - NULL, /*nb_float*/ - NULL, /*nb_inplace_add*/ - NULL, /*nb_inplace_subtract*/ - (binaryfunc)Matrix_imul, /*nb_inplace_multiply*/ - NULL, /*nb_inplace_remainder*/ - NULL, /*nb_inplace_power*/ - NULL, /*nb_inplace_lshift*/ - NULL, /*nb_inplace_rshift*/ - NULL, /*nb_inplace_and*/ - NULL, /*nb_inplace_xor*/ - NULL, /*nb_inplace_or*/ - NULL, /*nb_floor_divide*/ - NULL, /*nb_true_divide*/ - NULL, /*nb_inplace_floor_divide*/ - NULL, /*nb_inplace_true_divide*/ - NULL, /*nb_index*/ - (binaryfunc)Matrix_matmul, /*nb_matrix_multiply*/ - (binaryfunc)Matrix_imatmul, /*nb_inplace_matrix_multiply*/ + /*nb_add*/ (binaryfunc)Matrix_add, + /*nb_subtract*/ (binaryfunc)Matrix_sub, + /*nb_multiply*/ (binaryfunc)Matrix_mul, + /*nb_remainder*/ NULL, + /*nb_divmod*/ NULL, + /*nb_power*/ NULL, + /*nb_negative*/ NULL, + /*tp_positive*/ NULL, + /*tp_absolute*/ NULL, + /*tp_bool*/ NULL, + /*nb_invert*/ (unaryfunc)Matrix_inverted_noargs, + /*nb_lshift*/ NULL, + /*nb_rshift*/ NULL, + /*nb_and*/ NULL, + /*nb_xor*/ NULL, + /*nb_or*/ NULL, + /*nb_int*/ NULL, + /*nb_reserved*/ NULL, + /*nb_float*/ NULL, + /*nb_inplace_add*/ NULL, + /*nb_inplace_subtract*/ NULL, + /*nb_inplace_multiply*/ (binaryfunc)Matrix_imul, + /*nb_inplace_remainder*/ NULL, + /*nb_inplace_power*/ NULL, + /*nb_inplace_lshift*/ NULL, + /*nb_inplace_rshift*/ NULL, + /*nb_inplace_and*/ NULL, + /*nb_inplace_xor*/ NULL, + /*nb_inplace_or*/ NULL, + /*nb_floor_divide*/ NULL, + /*nb_true_divide*/ NULL, + /*nb_inplace_floor_divide*/ NULL, + /*nb_inplace_true_divide*/ NULL, + /*nb_index*/ NULL, + /*nb_matrix_multiply*/ (binaryfunc)Matrix_matmul, + /*nb_inplace_matrix_multiply*/ (binaryfunc)Matrix_imatmul, }; /** \} */ @@ -3314,6 +3314,10 @@ static struct PyMethodDef Matrix_methods[] = { /** \name Matrix Type: Python Object Definition * \{ */ +#ifdef MATH_STANDALONE +# define Matrix_str NULL +#endif + PyDoc_STRVAR( matrix_doc, ".. class:: Matrix([rows])\n" @@ -3324,57 +3328,61 @@ PyDoc_STRVAR( " :arg rows: Sequence of rows. When omitted, a 4x4 identity matrix is constructed.\n" " :type rows: 2d number sequence\n"); PyTypeObject matrix_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "Matrix", /*tp_name*/ - sizeof(MatrixObject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)BaseMathObject_dealloc, /*tp_dealloc*/ - (printfunc)NULL, /*tp_print*/ - NULL, /*tp_getattr*/ - NULL, /*tp_setattr*/ - NULL, /*tp_compare*/ - (reprfunc)Matrix_repr, /*tp_repr*/ - &Matrix_NumMethods, /*tp_as_number*/ - &Matrix_SeqMethods, /*tp_as_sequence*/ - &Matrix_AsMapping, /*tp_as_mapping*/ - (hashfunc)Matrix_hash, /*tp_hash*/ - NULL, /*tp_call*/ -#ifndef MATH_STANDALONE - (reprfunc)Matrix_str, /*tp_str*/ -#else - NULL, /*tp_str*/ -#endif - NULL, /*tp_getattro*/ - NULL, /*tp_setattro*/ - NULL, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - matrix_doc, /*tp_doc*/ - (traverseproc)BaseMathObject_traverse, /* tp_traverse */ - (inquiry)BaseMathObject_clear, /*tp_clear*/ - (richcmpfunc)Matrix_richcmpr, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - NULL, /*tp_iter*/ - NULL, /*tp_iternext*/ - Matrix_methods, /*tp_methods*/ - NULL, /*tp_members*/ - Matrix_getseters, /*tp_getset*/ - NULL, /*tp_base*/ - NULL, /*tp_dict*/ - NULL, /*tp_descr_get*/ - NULL, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - NULL, /*tp_init*/ - NULL, /*tp_alloc*/ - Matrix_new, /*tp_new*/ - NULL, /*tp_free*/ - (inquiry)BaseMathObject_is_gc, /*tp_is_gc*/ - NULL, /*tp_bases*/ - NULL, /*tp_mro*/ - NULL, /*tp_cache*/ - NULL, /*tp_subclasses*/ - NULL, /*tp_weaklist*/ - NULL, /*tp_del*/ + PyVarObject_HEAD_INIT(NULL, 0) + /*tp_name*/ "Matrix", + /*tp_basicsize*/ sizeof(MatrixObject), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ (destructor)BaseMathObject_dealloc, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ (reprfunc)Matrix_repr, + /*tp_as_number*/ &Matrix_NumMethods, + /*tp_as_sequence*/ &Matrix_SeqMethods, + /*tp_as_mapping*/ &Matrix_AsMapping, + /*tp_hash*/ (hashfunc)Matrix_hash, + /*tp_call*/ NULL, + /*tp_str*/ (reprfunc)Matrix_str, + /*tp_getattro*/ NULL, + /*tp_setattro*/ NULL, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, + /*tp_doc*/ matrix_doc, + /*tp_traverse*/ (traverseproc)BaseMathObject_traverse, + /*tp_clear*/ (inquiry)BaseMathObject_clear, + /*tp_richcompare*/ (richcmpfunc)Matrix_richcmpr, + /*tp_weaklistoffset*/ 0, + /*tp_iter*/ NULL, + /*tp_iternext*/ NULL, + /*tp_methods*/ Matrix_methods, + /*tp_members*/ NULL, + /*tp_getset*/ Matrix_getseters, + /*tp_base*/ NULL, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ NULL, + /*tp_alloc*/ NULL, + /*tp_new*/ Matrix_new, + /*tp_free*/ NULL, + /*tp_is_gc*/ (inquiry)BaseMathObject_is_gc, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, }; +#ifdef MATH_STANDALONE +# undef Matrix_str +#endif + /** \} */ /* -------------------------------------------------------------------- */ @@ -3625,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; @@ -3752,9 +3760,9 @@ static PyObject *MatrixAccess_iter(MatrixAccessObject *self) } static PyMappingMethods MatrixAccess_AsMapping = { - (lenfunc)MatrixAccess_len, - (binaryfunc)MatrixAccess_subscript, - (objobjargproc)MatrixAccess_ass_subscript, + /*mp_len*/ (lenfunc)MatrixAccess_len, + /*mp_subscript*/ (binaryfunc)MatrixAccess_subscript, + /*mp_ass_subscript*/ (objobjargproc)MatrixAccess_ass_subscript, }; /** \} */ @@ -3764,31 +3772,55 @@ static PyMappingMethods MatrixAccess_AsMapping = { * \{ */ PyTypeObject matrix_access_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "MatrixAccess", /*tp_name*/ - sizeof(MatrixAccessObject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)MatrixAccess_dealloc, /*tp_dealloc*/ - (printfunc)NULL, /*tp_print*/ - NULL, /*tp_getattr*/ - NULL, /*tp_setattr*/ - NULL, /*tp_compare*/ - NULL, /*tp_repr*/ - NULL, /*tp_as_number*/ - NULL /* &MatrixAccess_SeqMethods */ /* TODO */, /*tp_as_sequence*/ - &MatrixAccess_AsMapping, /*tp_as_mapping*/ - NULL, /*tp_hash*/ - NULL, /*tp_call*/ - NULL, /*tp_str*/ - NULL, /*tp_getattro*/ - NULL, /*tp_setattro*/ - NULL, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - NULL, /*tp_doc*/ - (traverseproc)MatrixAccess_traverse, /*tp_traverse*/ - (inquiry)MatrixAccess_clear, /*tp_clear*/ - NULL /* (richcmpfunc)MatrixAccess_richcmpr */ /* TODO*/, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - (getiterfunc)MatrixAccess_iter, /* getiterfunc tp_iter; */ + PyVarObject_HEAD_INIT(NULL, 0) + /*tp_name*/ "MatrixAccess", + /*tp_basicsize*/ sizeof(MatrixAccessObject), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ (destructor)MatrixAccess_dealloc, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ NULL, + /*tp_as_number*/ NULL, + /*tp_as_sequence*/ NULL /* &MatrixAccess_SeqMethods */ /* TODO */, + /*tp_as_mapping*/ &MatrixAccess_AsMapping, + /*tp_hash*/ NULL, + /*tp_call*/ NULL, + /*tp_str*/ NULL, + /*tp_getattro*/ NULL, + /*tp_setattro*/ NULL, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, + /*tp_doc*/ NULL, + /*tp_traverse*/ (traverseproc)MatrixAccess_traverse, + /*tp_clear*/ (inquiry)MatrixAccess_clear, + /*tp_richcompare*/ NULL /* MatrixAccess_richcmpr */ /* TODO*/, + /*tp_weaklistoffset*/ 0, + /*tp_iter*/ (getiterfunc)MatrixAccess_iter, + /*tp_iternext*/ NULL, + /*tp_methods*/ NULL, + /*tp_members*/ NULL, + /*tp_getset*/ NULL, + /*tp_base*/ NULL, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ NULL, + /*tp_alloc*/ NULL, + /*tp_new*/ NULL, + /*tp_free*/ NULL, + /*tp_is_gc*/ NULL, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, }; /** \} */ diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c index 976c1da1916..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; @@ -1342,61 +1342,61 @@ static PyObject *Quaternion_neg(QuaternionObject *self) * \{ */ static PySequenceMethods Quaternion_SeqMethods = { - (lenfunc)Quaternion_len, /*sq_length*/ - (binaryfunc)NULL, /*sq_concat*/ - (ssizeargfunc)NULL, /*sq_repeat*/ - (ssizeargfunc)Quaternion_item, /*sq_item*/ - (ssizessizeargfunc)NULL, /*sq_slice(deprecated)*/ - (ssizeobjargproc)Quaternion_ass_item, /*sq_ass_item*/ - (ssizessizeobjargproc)NULL, /*sq_ass_slice(deprecated)*/ - (objobjproc)NULL, /*sq_contains*/ - (binaryfunc)NULL, /*sq_inplace_concat*/ - (ssizeargfunc)NULL, /*sq_inplace_repeat*/ + /*sq_length*/ (lenfunc)Quaternion_len, + /*sq_concat*/ NULL, + /*sq_repeat*/ NULL, + /*sq_item*/ (ssizeargfunc)Quaternion_item, + /*was_sq_slice*/ NULL, /* DEPRECATED. */ + /*sq_ass_item*/ (ssizeobjargproc)Quaternion_ass_item, + /*was_sq_ass_slice*/ NULL, /* DEPRECATED. */ + /*sq_contains*/ NULL, + /*sq_inplace_concat*/ NULL, + /*sq_inplace_repeat*/ NULL, }; static PyMappingMethods Quaternion_AsMapping = { - (lenfunc)Quaternion_len, - (binaryfunc)Quaternion_subscript, - (objobjargproc)Quaternion_ass_subscript, + /*mp_len*/ (lenfunc)Quaternion_len, + /*mp_subscript*/ (binaryfunc)Quaternion_subscript, + /*mp_ass_subscript*/ (objobjargproc)Quaternion_ass_subscript, }; static PyNumberMethods Quaternion_NumMethods = { - (binaryfunc)Quaternion_add, /*nb_add*/ - (binaryfunc)Quaternion_sub, /*nb_subtract*/ - (binaryfunc)Quaternion_mul, /*nb_multiply*/ - NULL, /*nb_remainder*/ - NULL, /*nb_divmod*/ - NULL, /*nb_power*/ - (unaryfunc)Quaternion_neg, /*nb_negative*/ - (unaryfunc)Quaternion_copy, /*tp_positive*/ - (unaryfunc)0, /*tp_absolute*/ - (inquiry)0, /*tp_bool*/ - (unaryfunc)0, /*nb_invert*/ - NULL, /*nb_lshift*/ - (binaryfunc)0, /*nb_rshift*/ - NULL, /*nb_and*/ - NULL, /*nb_xor*/ - NULL, /*nb_or*/ - NULL, /*nb_int*/ - NULL, /*nb_reserved*/ - NULL, /*nb_float*/ - NULL, /*nb_inplace_add*/ - NULL, /*nb_inplace_subtract*/ - (binaryfunc)Quaternion_imul, /*nb_inplace_multiply*/ - NULL, /*nb_inplace_remainder*/ - NULL, /*nb_inplace_power*/ - NULL, /*nb_inplace_lshift*/ - NULL, /*nb_inplace_rshift*/ - NULL, /*nb_inplace_and*/ - NULL, /*nb_inplace_xor*/ - NULL, /*nb_inplace_or*/ - NULL, /*nb_floor_divide*/ - NULL, /*nb_true_divide*/ - NULL, /*nb_inplace_floor_divide*/ - NULL, /*nb_inplace_true_divide*/ - NULL, /*nb_index*/ - (binaryfunc)Quaternion_matmul, /*nb_matrix_multiply*/ - (binaryfunc)Quaternion_imatmul, /*nb_inplace_matrix_multiply*/ + /*nb_add*/ (binaryfunc)Quaternion_add, + /*nb_subtract*/ (binaryfunc)Quaternion_sub, + /*nb_multiply*/ (binaryfunc)Quaternion_mul, + /*nb_remainder*/ NULL, + /*nb_divmod*/ NULL, + /*nb_power*/ NULL, + /*nb_negative*/ (unaryfunc)Quaternion_neg, + /*tp_positive*/ (unaryfunc)Quaternion_copy, + /*tp_absolute*/ NULL, + /*tp_bool*/ NULL, + /*nb_invert*/ NULL, + /*nb_lshift*/ NULL, + /*nb_rshift*/ NULL, + /*nb_and*/ NULL, + /*nb_xor*/ NULL, + /*nb_or*/ NULL, + /*nb_int*/ NULL, + /*nb_reserved*/ NULL, + /*nb_float*/ NULL, + /*nb_inplace_add*/ NULL, + /*nb_inplace_subtract*/ NULL, + /*nb_inplace_multiply*/ (binaryfunc)Quaternion_imul, + /*nb_inplace_remainder*/ NULL, + /*nb_inplace_power*/ NULL, + /*nb_inplace_lshift*/ NULL, + /*nb_inplace_rshift*/ NULL, + /*nb_inplace_and*/ NULL, + /*nb_inplace_xor*/ NULL, + /*nb_inplace_or*/ NULL, + /*nb_floor_divide*/ NULL, + /*nb_true_divide*/ NULL, + /*nb_inplace_floor_divide*/ NULL, + /*nb_inplace_true_divide*/ NULL, + /*nb_index*/ NULL, + /*nb_matrix_multiply*/ (binaryfunc)Quaternion_matmul, + /*nb_inplace_matrix_multiply*/ (binaryfunc)Quaternion_imatmul, }; /** \} */ @@ -1657,6 +1657,10 @@ static struct PyMethodDef Quaternion_methods[] = { /** \name Quaternion Type: Python Object Definition * \{ */ +#ifdef MATH_STANDALONE +# define Quaternion_str NULL +#endif + PyDoc_STRVAR(quaternion_doc, ".. class:: Quaternion([seq, [angle]])\n" "\n" @@ -1682,57 +1686,61 @@ PyDoc_STRVAR(quaternion_doc, "\n" " .. seealso:: :meth:`to_axis_angle`\n"); PyTypeObject quaternion_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "Quaternion", /* tp_name */ - sizeof(QuaternionObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)BaseMathObject_dealloc, /* tp_dealloc */ - (printfunc)NULL, /* tp_print */ - NULL, /* tp_getattr */ - NULL, /* tp_setattr */ - NULL, /* tp_compare */ - (reprfunc)Quaternion_repr, /* tp_repr */ - &Quaternion_NumMethods, /* tp_as_number */ - &Quaternion_SeqMethods, /* tp_as_sequence */ - &Quaternion_AsMapping, /* tp_as_mapping */ - (hashfunc)Quaternion_hash, /* tp_hash */ - NULL, /* tp_call */ -#ifndef MATH_STANDALONE - (reprfunc)Quaternion_str, /* tp_str */ -#else - NULL, /* tp_str */ -#endif - NULL, /* tp_getattro */ - NULL, /* tp_setattro */ - NULL, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags */ - quaternion_doc, /* tp_doc */ - (traverseproc)BaseMathObject_traverse, /* tp_traverse */ - (inquiry)BaseMathObject_clear, /* tp_clear */ - (richcmpfunc)Quaternion_richcmpr, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - NULL, /* tp_iter */ - NULL, /* tp_iternext */ - Quaternion_methods, /* tp_methods */ - NULL, /* tp_members */ - Quaternion_getseters, /* tp_getset */ - NULL, /* tp_base */ - NULL, /* tp_dict */ - NULL, /* tp_descr_get */ - NULL, /* tp_descr_set */ - 0, /* tp_dictoffset */ - NULL, /* tp_init */ - NULL, /* tp_alloc */ - Quaternion_new, /* tp_new */ - NULL, /* tp_free */ - (inquiry)BaseMathObject_is_gc, /* tp_is_gc */ - NULL, /* tp_bases */ - NULL, /* tp_mro */ - NULL, /* tp_cache */ - NULL, /* tp_subclasses */ - NULL, /* tp_weaklist */ - NULL, /* tp_del */ + PyVarObject_HEAD_INIT(NULL, 0) + /*tp_name*/ "Quaternion", + /*tp_basicsize*/ sizeof(QuaternionObject), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ (destructor)BaseMathObject_dealloc, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ (reprfunc)Quaternion_repr, + /*tp_as_number*/ &Quaternion_NumMethods, + /*tp_as_sequence*/ &Quaternion_SeqMethods, + /*tp_as_mapping*/ &Quaternion_AsMapping, + /*tp_hash*/ (hashfunc)Quaternion_hash, + /*tp_call*/ NULL, + /*tp_str*/ (reprfunc)Quaternion_str, + /*tp_getattro*/ NULL, + /*tp_setattro*/ NULL, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, + /*tp_doc*/ quaternion_doc, + /*tp_traverse*/ (traverseproc)BaseMathObject_traverse, + /*tp_clear*/ (inquiry)BaseMathObject_clear, + /*tp_richcompare*/ (richcmpfunc)Quaternion_richcmpr, + /*tp_weaklistoffset*/ 0, + /*tp_iter*/ NULL, + /*tp_iternext*/ NULL, + /*tp_methods*/ Quaternion_methods, + /*tp_members*/ NULL, + /*tp_getset*/ Quaternion_getseters, + /*tp_base*/ NULL, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ NULL, + /*tp_alloc*/ NULL, + /*tp_new*/ Quaternion_new, + /*tp_free*/ NULL, + /*tp_is_gc*/ (inquiry)BaseMathObject_is_gc, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, }; +#ifdef MATH_STANDALONE +# undef Quaternion_str +#endif + /** \} */ /* -------------------------------------------------------------------- */ diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c index 290be771c90..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); } @@ -2387,61 +2387,61 @@ static PyObject *Vector_neg(VectorObject *self) * \{ */ static PySequenceMethods Vector_SeqMethods = { - (lenfunc)Vector_len, /*sq_length*/ - (binaryfunc)NULL, /*sq_concat*/ - (ssizeargfunc)NULL, /*sq_repeat*/ - (ssizeargfunc)Vector_item, /*sq_item*/ - NULL, /*sq_slice(DEPRECATED)*/ - (ssizeobjargproc)Vector_ass_item, /*sq_ass_item*/ - NULL, /*sq_ass_slice(DEPRECATED)*/ - (objobjproc)NULL, /*sq_contains*/ - (binaryfunc)NULL, /*sq_inplace_concat */ - (ssizeargfunc)NULL, /*sq_inplace_repeat */ + /*sq_length*/ (lenfunc)Vector_len, + /*sq_concat*/ NULL, + /*sq_repeat*/ NULL, + /*sq_item*/ (ssizeargfunc)Vector_item, + /*was_sq_slice*/ NULL, /* DEPRECATED. */ + /*sq_ass_item*/ (ssizeobjargproc)Vector_ass_item, + /*was_sq_ass_slice*/ NULL, /* DEPRECATED. */ + /*sq_contains*/ NULL, + /*sq_inplace_concat */ NULL, + /*sq_inplace_repeat */ NULL, }; static PyMappingMethods Vector_AsMapping = { - (lenfunc)Vector_len, - (binaryfunc)Vector_subscript, - (objobjargproc)Vector_ass_subscript, + /*mp_len*/ (lenfunc)Vector_len, + /*mp_subscript*/ (binaryfunc)Vector_subscript, + /*mp_ass_subscript*/ (objobjargproc)Vector_ass_subscript, }; static PyNumberMethods Vector_NumMethods = { - (binaryfunc)Vector_add, /*nb_add*/ - (binaryfunc)Vector_sub, /*nb_subtract*/ - (binaryfunc)Vector_mul, /*nb_multiply*/ - NULL, /*nb_remainder*/ - NULL, /*nb_divmod*/ - NULL, /*nb_power*/ - (unaryfunc)Vector_neg, /*nb_negative*/ - (unaryfunc)Vector_copy, /*tp_positive*/ - (unaryfunc)NULL, /*tp_absolute*/ - (inquiry)NULL, /*tp_bool*/ - (unaryfunc)NULL, /*nb_invert*/ - NULL, /*nb_lshift*/ - (binaryfunc)NULL, /*nb_rshift*/ - NULL, /*nb_and*/ - NULL, /*nb_xor*/ - NULL, /*nb_or*/ - NULL, /*nb_int*/ - NULL, /*nb_reserved*/ - NULL, /*nb_float*/ - Vector_iadd, /*nb_inplace_add*/ - Vector_isub, /*nb_inplace_subtract*/ - Vector_imul, /*nb_inplace_multiply*/ - NULL, /*nb_inplace_remainder*/ - NULL, /*nb_inplace_power*/ - NULL, /*nb_inplace_lshift*/ - NULL, /*nb_inplace_rshift*/ - NULL, /*nb_inplace_and*/ - NULL, /*nb_inplace_xor*/ - NULL, /*nb_inplace_or*/ - NULL, /*nb_floor_divide*/ - Vector_div, /*nb_true_divide*/ - NULL, /*nb_inplace_floor_divide*/ - Vector_idiv, /*nb_inplace_true_divide*/ - NULL, /*nb_index*/ - (binaryfunc)Vector_matmul, /*nb_matrix_multiply*/ - (binaryfunc)Vector_imatmul, /*nb_inplace_matrix_multiply*/ + /*nb_add*/ (binaryfunc)Vector_add, + /*nb_subtract*/ (binaryfunc)Vector_sub, + /*nb_multiply*/ (binaryfunc)Vector_mul, + /*nb_remainder*/ NULL, + /*nb_divmod*/ NULL, + /*nb_power*/ NULL, + /*nb_negative*/ (unaryfunc)Vector_neg, + /*tp_positive*/ (unaryfunc)Vector_copy, + /*tp_absolute*/ NULL, + /*tp_bool*/ NULL, + /*nb_invert*/ NULL, + /*nb_lshift*/ NULL, + /*nb_rshift*/ NULL, + /*nb_and*/ NULL, + /*nb_xor*/ NULL, + /*nb_or*/ NULL, + /*nb_int*/ NULL, + /*nb_reserved*/ NULL, + /*nb_float*/ NULL, + /*nb_inplace_add*/ Vector_iadd, + /*nb_inplace_subtract*/ Vector_isub, + /*nb_inplace_multiply*/ Vector_imul, + /*nb_inplace_remainder*/ NULL, + /*nb_inplace_power*/ NULL, + /*nb_inplace_lshift*/ NULL, + /*nb_inplace_rshift*/ NULL, + /*nb_inplace_and*/ NULL, + /*nb_inplace_xor*/ NULL, + /*nb_inplace_or*/ NULL, + /*nb_floor_divide*/ NULL, + /*nb_true_divide*/ Vector_div, + /*nb_inplace_floor_divide*/ NULL, + /*nb_inplace_true_divide*/ Vector_idiv, + /*nb_index*/ NULL, + /*nb_matrix_multiply*/ (binaryfunc)Vector_matmul, + /*nb_inplace_matrix_multiply*/ (binaryfunc)Vector_imatmul, }; /** \} */ @@ -3183,6 +3183,10 @@ static struct PyMethodDef Vector_methods[] = { * both get sent to Vector_mul and it needs to sort out the order * \{ */ +#ifdef MATH_STANDALONE +# define Vector_str NULL +#endif + PyDoc_STRVAR(vector_doc, ".. class:: Vector(seq)\n" "\n" @@ -3192,88 +3196,59 @@ PyDoc_STRVAR(vector_doc, " :type seq: sequence of numbers\n"); PyTypeObject vector_Type = { PyVarObject_HEAD_INIT(NULL, 0) - /* For printing, in format "<module>.<name>" */ - "Vector", /* char *tp_name; */ - sizeof(VectorObject), /* int tp_basicsize; */ - 0, /* tp_itemsize; For allocation */ - - /* Methods to implement standard operations */ - - (destructor)BaseMathObject_dealloc, /* destructor tp_dealloc; */ - 0, /* tp_vectorcall_offset */ - NULL, /* getattrfunc tp_getattr; */ - NULL, /* setattrfunc tp_setattr; */ - NULL, /* cmpfunc tp_compare; */ - (reprfunc)Vector_repr, /* reprfunc tp_repr; */ - - /* Method suites for standard classes */ - - &Vector_NumMethods, /* PyNumberMethods *tp_as_number; */ - &Vector_SeqMethods, /* PySequenceMethods *tp_as_sequence; */ - &Vector_AsMapping, /* PyMappingMethods *tp_as_mapping; */ - - /* More standard operations (here for binary compatibility) */ + /*tp_name*/ "Vector", + /*tp_basicsize*/ sizeof(VectorObject), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ (destructor)BaseMathObject_dealloc, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ (reprfunc)Vector_repr, + /*tp_as_number*/ &Vector_NumMethods, + /*tp_as_sequence*/ &Vector_SeqMethods, + /*tp_as_mapping*/ &Vector_AsMapping, + /*tp_hash*/ (hashfunc)Vector_hash, + /*tp_call*/ NULL, + /*tp_str*/ (reprfunc)Vector_str, + /*tp_getattro*/ NULL, + /*tp_setattro*/ NULL, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, + /*tp_doc*/ vector_doc, + /*tp_traverse*/ (traverseproc)BaseMathObject_traverse, + /*tp_clear*/ (inquiry)BaseMathObject_clear, + /*tp_richcompare*/ (richcmpfunc)Vector_richcmpr, + /*tp_weaklistoffset*/ 0, + /*tp_iter*/ NULL, + /*tp_iternext*/ NULL, + /*tp_methods*/ Vector_methods, + /*tp_members*/ NULL, + /*tp_getset*/ Vector_getseters, + /*tp_base*/ NULL, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ NULL, + /*tp_alloc*/ NULL, + /*tp_new*/ Vector_new, + /*tp_free*/ NULL, + /*tp_is_gc*/ (inquiry)BaseMathObject_is_gc, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, +}; - (hashfunc)Vector_hash, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ -#ifndef MATH_STANDALONE - (reprfunc)Vector_str, /* reprfunc tp_str; */ -#else - NULL, /* reprfunc tp_str; */ +#ifdef MATH_STANDALONE +# undef Vector_str NULL #endif - NULL, /* getattrofunc tp_getattro; */ - NULL, /* setattrofunc tp_setattro; */ - - /* Functions to access object as input/output buffer */ - NULL, /* PyBufferProcs *tp_as_buffer; */ - - /*** Flags to define presence of optional/expanded features ***/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, - vector_doc, /* char *tp_doc; Documentation string */ - /*** Assigned meaning in release 2.0 ***/ - - /* call function for all accessible objects */ - (traverseproc)BaseMathObject_traverse, /* tp_traverse */ - - /* delete references to contained objects */ - (inquiry)BaseMathObject_clear, /* tp_clear */ - - /*** Assigned meaning in release 2.1 ***/ - /*** rich comparisons ***/ - (richcmpfunc)Vector_richcmpr, /* richcmpfunc tp_richcompare; */ - - /*** weak reference enabler ***/ - 0, /* long tp_weaklistoffset; */ - - /*** Added in release 2.2 ***/ - /* Iterators */ - NULL, /* getiterfunc tp_iter; */ - NULL, /* iternextfunc tp_iternext; */ - - /*** Attribute descriptor and subclassing stuff ***/ - Vector_methods, /* struct PyMethodDef *tp_methods; */ - NULL, /* struct PyMemberDef *tp_members; */ - Vector_getseters, /* struct PyGetSetDef *tp_getset; */ - NULL, /* struct _typeobject *tp_base; */ - NULL, /* PyObject *tp_dict; */ - NULL, /* descrgetfunc tp_descr_get; */ - NULL, /* descrsetfunc tp_descr_set; */ - 0, /* long tp_dictoffset; */ - NULL, /* initproc tp_init; */ - NULL, /* allocfunc tp_alloc; */ - Vector_new, /* newfunc tp_new; */ - /* Low-level free-memory routine */ - NULL, /* freefunc tp_free; */ - /* For PyObject_IS_GC */ - (inquiry)BaseMathObject_is_gc, /* inquiry tp_is_gc; */ - NULL, /* PyObject *tp_bases; */ - /* method resolution order */ - NULL, /* PyObject *tp_mro; */ - NULL, /* PyObject *tp_cache; */ - NULL, /* PyObject *tp_subclasses; */ - NULL, /* PyObject *tp_weaklist; */ - NULL, -}; /** \} */ diff --git a/source/blender/python/mathutils/mathutils_bvhtree.c b/source/blender/python/mathutils/mathutils_bvhtree.c index 4bdb1adcdde..7b6c444515b 100644 --- a/source/blender/python/mathutils/mathutils_bvhtree.c +++ b/source/blender/python/mathutils/mathutils_bvhtree.c @@ -1235,52 +1235,55 @@ static PyMethodDef py_bvhtree_methods[] = { }; PyTypeObject PyBVHTree_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "BVHTree", /* tp_name */ - sizeof(PyBVHTree), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)py_bvhtree__tp_dealloc, /* tp_dealloc */ - (printfunc)NULL, /* tp_print */ - NULL, /* tp_getattr */ - NULL, /* tp_setattr */ - NULL, /* tp_compare */ - NULL, /* tp_repr */ - NULL, /* tp_as_number */ - NULL, /* tp_as_sequence */ - NULL, /* tp_as_mapping */ - NULL, /* tp_hash */ - NULL, /* tp_call */ - NULL, /* tp_str */ - NULL, /* tp_getattro */ - NULL, /* tp_setattro */ - NULL, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - NULL, /* Documentation string */ - NULL, /* tp_traverse */ - NULL, /* tp_clear */ - NULL, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - NULL, /* tp_iter */ - NULL, /* tp_iternext */ - py_bvhtree_methods, /* tp_methods */ - NULL, /* tp_members */ - NULL, /* tp_getset */ - NULL, /* tp_base */ - NULL, /* tp_dict */ - NULL, /* tp_descr_get */ - NULL, /* tp_descr_set */ - 0, /* tp_dictoffset */ - NULL, /* tp_init */ - (allocfunc)PyType_GenericAlloc, /* tp_alloc */ - (newfunc)PyType_GenericNew, /* tp_new */ - (freefunc)0, /* tp_free */ - NULL, /* tp_is_gc */ - NULL, /* tp_bases */ - NULL, /* tp_mro */ - NULL, /* tp_cache */ - NULL, /* tp_subclasses */ - NULL, /* tp_weaklist */ - (destructor)NULL, /* tp_del */ + PyVarObject_HEAD_INIT(NULL, 0) + /*tp_name*/ "BVHTree", + /*tp_basicsize*/ sizeof(PyBVHTree), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ (destructor)py_bvhtree__tp_dealloc, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ NULL, + /*tp_as_number*/ NULL, + /*tp_as_sequence*/ NULL, + /*tp_as_mapping*/ NULL, + /*tp_hash*/ NULL, + /*tp_call*/ NULL, + /*tp_str*/ NULL, + /*tp_getattro*/ NULL, + /*tp_setattro*/ NULL, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT, + /*tp_doc*/ NULL, + /*tp_traverse*/ NULL, + /*tp_clear*/ NULL, + /*tp_richcompare*/ NULL, + /*tp_weaklistoffset*/ 0, + /*tp_iter*/ NULL, + /*tp_iternext*/ NULL, + /*tp_methods*/ py_bvhtree_methods, + /*tp_members*/ NULL, + /*tp_getset*/ NULL, + /*tp_base*/ NULL, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ NULL, + /*tp_alloc*/ (allocfunc)PyType_GenericAlloc, + /*tp_new*/ (newfunc)PyType_GenericNew, + /*tp_free*/ (freefunc)0, + /*tp_is_gc*/ NULL, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ (destructor)NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, }; /* -------------------------------------------------------------------- */ @@ -1290,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 f5a27c6f90f..ace8ccdeb2a 100644 --- a/source/blender/python/mathutils/mathutils_kdtree.c +++ b/source/blender/python/mathutils/mathutils_kdtree.c @@ -372,66 +372,70 @@ PyDoc_STRVAR(py_KDtree_doc, "\n" " :class:`KDTree.balance` must have been called before using any of the ``find`` " "methods.\n"); + PyTypeObject PyKDTree_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "KDTree", /* tp_name */ - sizeof(PyKDTree), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)PyKDTree__tp_dealloc, /* tp_dealloc */ - (printfunc)NULL, /* tp_print */ - NULL, /* tp_getattr */ - NULL, /* tp_setattr */ - NULL, /* tp_compare */ - NULL, /* tp_repr */ - NULL, /* tp_as_number */ - NULL, /* tp_as_sequence */ - NULL, /* tp_as_mapping */ - NULL, /* tp_hash */ - NULL, /* tp_call */ - NULL, /* tp_str */ - NULL, /* tp_getattro */ - NULL, /* tp_setattro */ - NULL, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - py_KDtree_doc, /* Documentation string */ - NULL, /* tp_traverse */ - NULL, /* tp_clear */ - NULL, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - NULL, /* tp_iter */ - NULL, /* tp_iternext */ - (struct PyMethodDef *)PyKDTree_methods, /* tp_methods */ - NULL, /* tp_members */ - NULL, /* tp_getset */ - NULL, /* tp_base */ - NULL, /* tp_dict */ - NULL, /* tp_descr_get */ - NULL, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)PyKDTree__tp_init, /* tp_init */ - (allocfunc)PyType_GenericAlloc, /* tp_alloc */ - (newfunc)PyType_GenericNew, /* tp_new */ - (freefunc)0, /* tp_free */ - NULL, /* tp_is_gc */ - NULL, /* tp_bases */ - NULL, /* tp_mro */ - NULL, /* tp_cache */ - NULL, /* tp_subclasses */ - NULL, /* tp_weaklist */ - (destructor)NULL, /* tp_del */ + PyVarObject_HEAD_INIT(NULL, 0) + /*tp_name*/ "KDTree", + /*tp_basicsize*/ sizeof(PyKDTree), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ (destructor)PyKDTree__tp_dealloc, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ NULL, + /*tp_as_number*/ NULL, + /*tp_as_sequence*/ NULL, + /*tp_as_mapping*/ NULL, + /*tp_hash*/ NULL, + /*tp_call*/ NULL, + /*tp_str*/ NULL, + /*tp_getattro*/ NULL, + /*tp_setattro*/ NULL, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT, + /*Documentation string*/ py_KDtree_doc, + /*tp_traverse*/ NULL, + /*tp_clear*/ NULL, + /*tp_richcompare*/ NULL, + /*tp_weaklistoffset*/ 0, + /*tp_iter*/ NULL, + /*tp_iternext*/ NULL, + /*tp_methods*/ (struct PyMethodDef *)PyKDTree_methods, + /*tp_members*/ NULL, + /*tp_getset*/ NULL, + /*tp_base*/ NULL, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ (initproc)PyKDTree__tp_init, + /*tp_alloc*/ (allocfunc)PyType_GenericAlloc, + /*tp_new*/ (newfunc)PyType_GenericNew, + /*tp_free*/ (freefunc)0, + /*tp_is_gc*/ NULL, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ (destructor)NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, }; 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-------------------------*/ |