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.
This commit is contained in:
2010-09-07 08:10:19 +00:00
parent 51d996ab36
commit ae0d99291f

View File

@@ -4147,7 +4147,6 @@ static void pyrna_subtype_set_rna(PyObject *newclass, StructRNA *srna)
{
PointerRNA ptr;
PyObject *item;
PyObject *newclass_dict= ((PyTypeObject *)newclass)->tp_dict;
Py_INCREF(newclass);
@@ -4165,9 +4164,10 @@ static void pyrna_subtype_set_rna(PyObject *newclass, StructRNA *srna)
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 */
}