fix for memory leak, use Key Errors for pyrna getitem access & idprops
[blender.git] / source / blender / python / intern / bpy_rna.c
index 024473f596a5b6753a42fcbc51d67745e14e9d22..ba268201b814982a196eb9a4e6530bced9a1478f 100644 (file)
@@ -1218,14 +1218,14 @@ static PyObject *pyrna_struct_subscript( BPy_StructRNA *self, PyObject *key )
        group= RNA_struct_idproperties(&self->ptr, 0);
 
        if(group==NULL) {
-               PyErr_Format( PyExc_TypeError, "key \"%s\" not found", name);
+               PyErr_Format( PyExc_KeyError, "key \"%s\" not found", name);
                return NULL;
        }
 
        idprop= IDP_GetPropertyFromGroup(group, name);
 
        if(idprop==NULL) {
-               PyErr_Format( PyExc_TypeError, "key \"%s\" not found", name);
+               PyErr_Format( PyExc_KeyError, "key \"%s\" not found", name);
                return NULL;
        }