fix for memory leak, use Key Errors for pyrna getitem access & idprops
[blender.git] / source / blender / python / generic / IDProp.c
index 6d71332b9ec1eaee76455fb3695cbf859b8a5651..2339350823d3bf5a65c1b61ecf0ecb1f7a5a7b05 100644 (file)
@@ -322,7 +322,7 @@ int BPy_Wrap_SetMapItem(IDProperty *prop, PyObject *key, PyObject *val)
                        MEM_freeN(pkey);
                        return 0;
                } else {
-                       PyErr_SetString( PyExc_RuntimeError, "property not found in group" );
+                       PyErr_SetString( PyExc_KeyError, "property not found in group" );
                        return -1;
                }
        }
@@ -336,7 +336,7 @@ int BPy_Wrap_SetMapItem(IDProperty *prop, PyObject *key, PyObject *val)
 
                err = BPy_IDProperty_Map_ValidateAndCreate(_PyUnicode_AsString(key), prop, val);
                if (err) {
-                       PyErr_SetString( PyExc_RuntimeError, err );
+                       PyErr_SetString( PyExc_KeyError, err );
                        return -1;
                }