=IDProperties Small Update=
authorJoseph Eagar <joeedh@gmail.com>
Mon, 4 Dec 2006 04:51:32 +0000 (04:51 +0000)
committerJoseph Eagar <joeedh@gmail.com>
Mon, 4 Dec 2006 04:51:32 +0000 (04:51 +0000)
BPy conventions were not being followed for PyObject_New;
now they are.  I still doubt the usefullness of doing this,
however its important to maintain module standards.

Which reminds me, anyone know where I can get that source code
prettier that was used on the api files?  It was kindof
hard following the coding style of bpy with it being so
different from normal blender, and also what with having
to write the IDProperty code from scratch. :)

source/blender/python/api2_2x/IDProp.c

index df4e1a009ec534664e45f14143e558825ea0e2f7..b03b7bc9818172fce40bf7b18db77141e59b7761 100644 (file)
@@ -83,6 +83,10 @@ PyObject *BPy_IDProperty_getattr(BPy_IDProperty *self, char *name)
                                        return self->data_wrap;
                                } else {
                                        BPy_IDProperty *group = PyObject_New(BPy_IDProperty, &IDGroup_Type);
+                                       if (!group)
+                                               return EXPP_ReturnPyObjError( PyExc_RuntimeError,
+                                                  "PyObject_New() failed" );
+                               
                                        group->id = self->id;
                                        group->data_wrap = NULL;
                                        group->prop = self->prop;
@@ -96,6 +100,10 @@ PyObject *BPy_IDProperty_getattr(BPy_IDProperty *self, char *name)
                                        return self->data_wrap;
                                } else {
                                        BPy_IDProperty *array = PyObject_New(BPy_IDProperty, &IDArray_Type);
+                                       if (!array)
+                                               return EXPP_ReturnPyObjError( PyExc_RuntimeError,
+                                                  "PyObject_New() failed" );
+                                                  
                                        array->id = self->id;
                                        array->data_wrap = NULL;
                                        array->prop = self->prop;
@@ -400,6 +408,11 @@ PyTypeObject IDProperty_Type = {
 PyObject *BPy_Wrap_IDProperty(ID *id, IDProperty *prop, IDProperty *parent)
 {
        BPy_IDProperty *wrap = PyObject_New(BPy_IDProperty, &IDProperty_Type);
+       
+       if (!wrap)
+               return EXPP_ReturnPyObjError( PyExc_RuntimeError,
+                  "PyObject_New() failed" );
+                                                  
        wrap->prop = prop;
        wrap->parent = parent;
        wrap->id = id;
@@ -733,6 +746,10 @@ PyObject *BPy_IDGroup_setattr(BPy_IDProperty *self, PyObject *val, char *name)
 PyObject *BPy_IDGroup_SpawnIterator(BPy_IDProperty *self)
 {
        BPy_IDGroup_Iter *iter = PyObject_New(BPy_IDGroup_Iter, &IDGroup_Iter_Type);
+       
+       if (!iter)
+               return EXPP_ReturnPyObjError( PyExc_RuntimeError,
+                  "PyObject_New() failed" );
        iter->group = self;
        iter->cur = self->prop->data.group.first;
        Py_XINCREF(iter);