[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31552] trunk/blender/source/blender/ python/intern/bpy_rna.c: update to pyrna so deleting an attribute only fails if that attribute resolves to an RNA property .

Campbell Barton ideasman42 at gmail.com
Wed Aug 25 01:52:21 CEST 2010


Revision: 31552
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31552
Author:   campbellbarton
Date:     2010-08-25 01:52:20 +0200 (Wed, 25 Aug 2010)

Log Message:
-----------
update to pyrna so deleting an attribute only fails if that attribute resolves to an RNA property.

Modified Paths:
--------------
    trunk/blender/source/blender/python/intern/bpy_rna.c

Modified: trunk/blender/source/blender/python/intern/bpy_rna.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_rna.c	2010-08-24 19:50:31 UTC (rev 31551)
+++ trunk/blender/source/blender/python/intern/bpy_rna.c	2010-08-24 23:52:20 UTC (rev 31552)
@@ -2495,11 +2495,6 @@
 	char *name = _PyUnicode_AsString(pyname);
 	PropertyRNA *prop= NULL;
 
-	if(value == NULL) {
-		PyErr_SetString(PyExc_AttributeError, "bpy_struct: del not supported");
-		return -1;
-	}
-
 	if (name[0] != '_' && (prop= RNA_struct_find_property(&self->ptr, name))) {
 		if (!RNA_property_editable_flag(&self->ptr, prop)) {
 			PyErr_Format( PyExc_AttributeError, "bpy_struct: attribute \"%.200s\" from \"%.200s\" is read-only", RNA_property_identifier(prop), RNA_struct_identifier(self->ptr.type) );
@@ -2531,10 +2526,16 @@
 	}
 
 	/* pyrna_py_to_prop sets its own exceptions */
-	if(prop)
+	if(prop) {
+		if(value == NULL) {
+			PyErr_SetString(PyExc_AttributeError, "bpy_struct: del not supported");
+			return -1;
+		}
 		return pyrna_py_to_prop(&self->ptr, prop, NULL, NULL, value, "bpy_struct: item.attr = val:");
-	else
+	}
+	else {
 		return PyObject_GenericSetAttr((PyObject *)self, pyname, value);
+	}
 }
 
 static PyObject *pyrna_prop_dir(BPy_PropertyRNA *self)





More information about the Bf-blender-cvs mailing list