[Bf-blender-cvs] [e1c0e2f7f17] temp-asset-representation: PyAPI: add invalid objects check for RNA struct keys()/values()/items()

Campbell Barton noreply at git.blender.org
Tue Nov 8 12:42:27 CET 2022


Commit: e1c0e2f7f17078194d0f95cf60bcd6eb8a2d84c8
Author: Campbell Barton
Date:   Tue Nov 8 17:17:30 2022 +1100
Branches: temp-asset-representation
https://developer.blender.org/rBe1c0e2f7f17078194d0f95cf60bcd6eb8a2d84c8

PyAPI: add invalid objects check for RNA struct keys()/values()/items()

===================================================================

M	source/blender/python/intern/bpy_rna.c

===================================================================

diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index ffcc210301c..3525e2459ef 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -3499,6 +3499,8 @@ PyDoc_STRVAR(pyrna_struct_keys_doc,
              "\n" BPY_DOC_ID_PROP_TYPE_NOTE);
 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;
@@ -3520,6 +3522,8 @@ PyDoc_STRVAR(pyrna_struct_items_doc,
              "\n" BPY_DOC_ID_PROP_TYPE_NOTE);
 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;
@@ -3541,6 +3545,8 @@ PyDoc_STRVAR(pyrna_struct_values_doc,
              "\n" BPY_DOC_ID_PROP_TYPE_NOTE);
 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");



More information about the Bf-blender-cvs mailing list