diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-11-18 16:02:09 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-11-18 16:02:09 +0300 |
commit | d3794d9f945d3d85394549e4570c38147a3283a1 (patch) | |
tree | f5f0d0ef602c41fced41874fec3d4b6c8b8c1eb2 /source/blender/python | |
parent | 49c47fbf300f1f6419d504d9ebe7ecd756dfe808 (diff) |
fix for memory leak, use Key Errors for pyrna getitem access & idprops
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/generic/IDProp.c | 4 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/python/generic/IDProp.c b/source/blender/python/generic/IDProp.c index 6d71332b9ec..2339350823d 100644 --- a/source/blender/python/generic/IDProp.c +++ b/source/blender/python/generic/IDProp.c @@ -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; } diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 024473f596a..ba268201b81 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -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; } |