[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31805] trunk/blender/source/blender/ python/intern/bpy_rna.c: bugfix [#23656] Problems retrieving properties from inside runtime-created PointerProperties

Campbell Barton ideasman42 at gmail.com
Tue Sep 7 10:10:19 CEST 2010


Revision: 31805
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31805
Author:   campbellbarton
Date:     2010-09-07 10:10:19 +0200 (Tue, 07 Sep 2010)

Log Message:
-----------
bugfix [#23656] Problems retrieving properties from inside runtime-created PointerProperties
Setting the classes __dict__ member directly didnt update the types slots (python internal type stuff used with subclassing), so class.bl_rna was returning an incorrect value.

Set the value using typical python setattr command. 

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-09-07 05:47:34 UTC (rev 31804)
+++ trunk/blender/source/blender/python/intern/bpy_rna.c	2010-09-07 08:10:19 UTC (rev 31805)
@@ -4147,7 +4147,6 @@
 {
 	PointerRNA ptr;
 	PyObject *item;
-	PyObject *newclass_dict= ((PyTypeObject *)newclass)->tp_dict;
 	
 	Py_INCREF(newclass);
 
@@ -4165,9 +4164,10 @@
 	RNA_pointer_create(NULL, &RNA_Struct, srna, &ptr);
 	item = pyrna_struct_CreatePyObject(&ptr);
 
-	//item = PyCapsule_New(srna, NULL, NULL);
-	PyDict_SetItemString(newclass_dict, "bl_rna", item);
+	/* note, must set the class not the __dict__ else the internal slots are not updated correctly */
+	PyObject_SetAttrString(newclass, "bl_rna", item);
 	Py_DECREF(item);
+	
 	/* done with rna instance */
 }
 





More information about the Bf-blender-cvs mailing list