Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillian Padovani Germano <wpgermano@gmail.com>2003-05-23 08:34:55 +0400
committerWillian Padovani Germano <wpgermano@gmail.com>2003-05-23 08:34:55 +0400
commit9edf1c08a6cfdf77e484478143c5ac9e947d25d2 (patch)
treed68525abbe1773f49060b96536931512e60216e2 /source/blender/python/api2_2x/constant.c
parent0773536829482ac79032efc6926be6a2e5da8813 (diff)
* Fixed bug in BPY_interface.c (exppython):
Found that syntax errors in scripts were giving SIGSEGV, my mistake. * Added new helper type: rgbTuple. This is used to represent and deal with rgb color triplets in modules like Material and Lamp. Updated Lamp module to use it.
Diffstat (limited to 'source/blender/python/api2_2x/constant.c')
-rw-r--r--source/blender/python/api2_2x/constant.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/source/blender/python/api2_2x/constant.c b/source/blender/python/api2_2x/constant.c
index 30c020ed61e..7640940903d 100644
--- a/source/blender/python/api2_2x/constant.c
+++ b/source/blender/python/api2_2x/constant.c
@@ -102,16 +102,12 @@ static PyObject *new_const(void)
constant = (C_constant *)PyObject_NEW(C_constant, &constant_Type);
if (constant == NULL)
- {
return (PythonReturnErrorObject (PyExc_MemoryError,
"couldn't create constant object"));
- }
if ((constant->dict = PyDict_New()) == NULL)
- {
return (PythonReturnErrorObject (PyExc_MemoryError,
"couldn't create constant object's dictionary"));
- }
return (PyObject *)constant;
}
@@ -122,9 +118,7 @@ static PyObject *new_const(void)
void constant_insert(C_constant *self, char *key, PyObject *value)
{
if (self->dict)
- {
PyDict_SetItemString(self->dict, key, value);
- }
}
/*****************************************************************************/
@@ -144,23 +138,21 @@ static void constantDeAlloc (C_constant *self)
/* the function that accesses C_constant member variables and */
/* methods. */
/*****************************************************************************/
-static PyObject* constantGetAttr (C_constant *self, char *name)
+static PyObject *constantGetAttr (C_constant *self, char *name)
{
if (self->dict)
{
PyObject *v;
if (!strcmp(name, "__members__"))
- {
return PyDict_Keys(self->dict);
- }
v = PyDict_GetItemString(self->dict, name);
- if (v)
- {
+ if (v) {
Py_INCREF(v); /* was a borrowed ref */
return v;
}
+
return (PythonReturnErrorObject (PyExc_AttributeError,
"attribute not found"));
}
@@ -180,11 +172,10 @@ static int constantLength(C_constant *self)
static PyObject *constantSubscript(C_constant *self, PyObject *key)
{
- if (self->dict)
- {
+ if (self->dict) {
PyObject *v = PyDict_GetItem(self->dict, key);
- if (v)
- {
+
+ if (v) {
Py_INCREF(v);
return v;
}