[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24639] trunk/blender/source/blender: fix for memory leak, use Key Errors for pyrna getitem access & idprops
Campbell Barton
ideasman42 at gmail.com
Wed Nov 18 14:02:09 CET 2009
Revision: 24639
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24639
Author: campbellbarton
Date: 2009-11-18 14:02:09 +0100 (Wed, 18 Nov 2009)
Log Message:
-----------
fix for memory leak, use Key Errors for pyrna getitem access & idprops
Modified Paths:
--------------
trunk/blender/source/blender/makesrna/intern/rna_access.c
trunk/blender/source/blender/python/generic/IDProp.c
trunk/blender/source/blender/python/intern/bpy_rna.c
Modified: trunk/blender/source/blender/makesrna/intern/rna_access.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_access.c 2009-11-18 11:50:31 UTC (rev 24638)
+++ trunk/blender/source/blender/makesrna/intern/rna_access.c 2009-11-18 13:02:09 UTC (rev 24639)
@@ -2344,13 +2344,8 @@
if(use_id_prop) { /* look up property name in current struct */
IDProperty *group= RNA_struct_idproperties(ptr, 0);
- if(!group)
- return 0;
-
- if(rna_token_strip_quotes(token))
+ if(group && rna_token_strip_quotes(token))
prop= (PropertyRNA *)IDP_GetPropertyFromGroup(group, token+1);
- else
- prop= NULL;
}
else {
prop= RNA_struct_find_property(&curptr, token);
Modified: trunk/blender/source/blender/python/generic/IDProp.c
===================================================================
--- trunk/blender/source/blender/python/generic/IDProp.c 2009-11-18 11:50:31 UTC (rev 24638)
+++ trunk/blender/source/blender/python/generic/IDProp.c 2009-11-18 13:02:09 UTC (rev 24639)
@@ -322,7 +322,7 @@
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 @@
err = BPy_IDProperty_Map_ValidateAndCreate(_PyUnicode_AsString(key), prop, val);
if (err) {
- PyErr_SetString( PyExc_RuntimeError, err );
+ PyErr_SetString( PyExc_KeyError, err );
return -1;
}
Modified: trunk/blender/source/blender/python/intern/bpy_rna.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_rna.c 2009-11-18 11:50:31 UTC (rev 24638)
+++ trunk/blender/source/blender/python/intern/bpy_rna.c 2009-11-18 13:02:09 UTC (rev 24639)
@@ -1218,14 +1218,14 @@
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;
}
More information about the Bf-blender-cvs
mailing list