From a406c15d93cf8b69f75a34dce5f24a4ea03045c6 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 11 Apr 2009 15:05:42 +0000 Subject: Python Api own error with refcounting and raise an error when bpy.types cant generate a subtype (though it shouldn't happen) --- source/blender/python/intern/bpy_panel_wrap.c | 2 +- source/blender/python/intern/bpy_rna.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'source/blender/python/intern') diff --git a/source/blender/python/intern/bpy_panel_wrap.c b/source/blender/python/intern/bpy_panel_wrap.c index 4a33c90f819..bc85e5bdced 100644 --- a/source/blender/python/intern/bpy_panel_wrap.c +++ b/source/blender/python/intern/bpy_panel_wrap.c @@ -79,7 +79,7 @@ static int PyPanel_generic(int mode, const bContext *C, Panel *pnl) ret = PyObject_Call(item, args, NULL); - Py_DECREF(args); + /* args is decref'd from item */ Py_DECREF(item); } diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 3f70d914801..c7c4a5ef489 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -1680,7 +1680,11 @@ static PyObject *pyrna_basetype_getattro( BPy_BaseTypeRNA * self, PyObject *pyna else PyErr_Clear(); if (RNA_property_collection_lookup_string(&self->ptr, self->prop, _PyUnicode_AsString(pyname), &newptr)) { - return pyrna_struct_Subtype(&newptr); + ret= pyrna_struct_Subtype(&newptr); + if (ret==NULL) { + PyErr_Format(PyExc_SystemError, "bpy.types.%s subtype could not be generated, this is a bug!", _PyUnicode_AsString(pyname)); + } + return ret; } else { /* Override the error */ PyErr_Format(PyExc_AttributeError, "bpy.types.%s not a valid RNA_Struct", _PyUnicode_AsString(pyname)); -- cgit v1.2.3