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:
authorCampbell Barton <ideasman42@gmail.com>2007-06-16 16:24:41 +0400
committerCampbell Barton <ideasman42@gmail.com>2007-06-16 16:24:41 +0400
commit39a526a963e9e0a0f206556a8b740fab56ba2654 (patch)
tree69290c8f2186c5dbc4673da0a6de60a874e18ab2 /source/blender/python/api2_2x/logic.c
parent5135ed7b0e5c09c77a54e4359d7ff0b92003f4f0 (diff)
Python PyMethodDef supports single argument methods (METH_O) but was using METH_VARARGS everywhere and getting the single args from the tuple.
Use METH_O where applicable.
Diffstat (limited to 'source/blender/python/api2_2x/logic.c')
-rw-r--r--source/blender/python/api2_2x/logic.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/source/blender/python/api2_2x/logic.c b/source/blender/python/api2_2x/logic.c
index f7e8e27c2f5..8630dcaf4f2 100644
--- a/source/blender/python/api2_2x/logic.c
+++ b/source/blender/python/api2_2x/logic.c
@@ -38,7 +38,7 @@
//--------------- Python BPy_Property methods declarations:---------------
static PyObject *Property_getName( BPy_Property * self );
-static PyObject *Property_setName( BPy_Property * self, PyObject * args );
+static PyObject *Property_setName( BPy_Property * self, PyObject * value );
static PyObject *Property_getData( BPy_Property * self );
static PyObject *Property_setData( BPy_Property * self, PyObject * args );
static PyObject *Property_getType( BPy_Property * self );
@@ -46,7 +46,7 @@ static PyObject *Property_getType( BPy_Property * self );
static PyMethodDef BPy_Property_methods[] = {
{"getName", ( PyCFunction ) Property_getName, METH_NOARGS,
"() - return Property name"},
- {"setName", ( PyCFunction ) Property_setName, METH_VARARGS,
+ {"setName", ( PyCFunction ) Property_setName, METH_O,
"() - set the name of this Property"},
{"getData", ( PyCFunction ) Property_getData, METH_NOARGS,
"() - return Property data"},
@@ -203,25 +203,25 @@ static PyObject *Property_getAttr( BPy_Property * self, char *name )
static int
Property_setAttr( BPy_Property * self, char *name, PyObject * value )
{
- PyObject *valtuple;
PyObject *error = NULL;
checkValidData_ptr( self );
- valtuple = Py_BuildValue( "(O)", value );
- if( !valtuple )
- return EXPP_ReturnIntError( PyExc_MemoryError,
- "PropertySetAttr: couldn't create tuple" );
- if( strcmp( name, "name" ) == 0 )
- error = Property_setName( self, valtuple );
- else if( strcmp( name, "data" ) == 0 )
+ if( strcmp( name, "name" ) == 0 ) {
+ error = Property_setName( self, value );
+ } else if( strcmp( name, "data" ) == 0 ) {
+ PyObject *valtuple = Py_BuildValue( "(O)", value );
+ if( !valtuple )
+ return EXPP_ReturnIntError( PyExc_MemoryError,
+ "PropertySetAttr: couldn't create tuple" );
+
error = Property_setData( self, valtuple );
- else {
Py_DECREF( valtuple );
+ } else {
return ( EXPP_ReturnIntError
( PyExc_KeyError, "attribute not found" ) );
}
- Py_DECREF( valtuple );
+
if( error != Py_None )
return -1;
@@ -395,11 +395,11 @@ static PyObject *Property_getName( BPy_Property * self )
}
//--------------- BPy_Property.setName()----------------------------
-static PyObject *Property_setName( BPy_Property * self, PyObject * args )
+static PyObject *Property_setName( BPy_Property * self, PyObject * value )
{
- char *name;
+ char *name = PyString_AsString(value);
- if( !PyArg_ParseTuple( args, "s", &name ) )
+ if( !name )
return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
"expected string argument" ) );