diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-06-16 16:24:41 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-06-16 16:24:41 +0400 |
commit | 39a526a963e9e0a0f206556a8b740fab56ba2654 (patch) | |
tree | 69290c8f2186c5dbc4673da0a6de60a874e18ab2 /source/blender/python/api2_2x/IDProp.c | |
parent | 5135ed7b0e5c09c77a54e4359d7ff0b92003f4f0 (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/IDProp.c')
-rw-r--r-- | source/blender/python/api2_2x/IDProp.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/source/blender/python/api2_2x/IDProp.c b/source/blender/python/api2_2x/IDProp.c index 5372e569d41..4f2fa82b21e 100644 --- a/source/blender/python/api2_2x/IDProp.c +++ b/source/blender/python/api2_2x/IDProp.c @@ -384,14 +384,13 @@ PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop) "eek!! a property exists with a bad type code!!!" ); } -PyObject *BPy_IDGroup_Pop(BPy_IDProperty *self, PyObject *vars) +PyObject *BPy_IDGroup_Pop(BPy_IDProperty *self, PyObject *value) { IDProperty *loop; PyObject *pyform; - char *name; - int ok = PyArg_ParseTuple(vars, "s", &name); + char *name = PyString_AsString(value); - if (!ok) { + if (!name) { return EXPP_ReturnPyObjError( PyExc_TypeError, "pop expected at least 1 arguments, got 0" ); } @@ -463,12 +462,12 @@ PyObject *BPy_IDGroup_GetValues(BPy_IDProperty *self) return seq; } -PyObject *BPy_IDGroup_HasKey(BPy_IDProperty *self, PyObject *vars) +PyObject *BPy_IDGroup_HasKey(BPy_IDProperty *self, PyObject *value) { IDProperty *loop; - char *name; + char *name = PyString_AsString(value); - if (!PyArg_ParseTuple(vars, "s", &name)) + if (!name) return EXPP_ReturnPyObjError( PyExc_TypeError, "expected a string"); @@ -507,7 +506,7 @@ PyObject *BPy_IDGroup_ConvertToPy(BPy_IDProperty *self) } static struct PyMethodDef BPy_IDGroup_methods[] = { - {"pop", (PyCFunction)BPy_IDGroup_Pop, METH_VARARGS, + {"pop", (PyCFunction)BPy_IDGroup_Pop, METH_O, "pop an item from the group; raises KeyError if the item doesn't exist."}, {"iteritems", (PyCFunction)BPy_IDGroup_IterItems, METH_NOARGS, "iterate through the items in the dict; behaves like dictionary method iteritems."}, @@ -515,7 +514,7 @@ static struct PyMethodDef BPy_IDGroup_methods[] = { "get the keys associated with this group as a list of strings."}, {"values", (PyCFunction)BPy_IDGroup_GetValues, METH_NOARGS, "get the values associated with this group."}, - {"has_key", (PyCFunction)BPy_IDGroup_HasKey, METH_VARARGS, + {"has_key", (PyCFunction)BPy_IDGroup_HasKey, METH_O, "returns true if the group contains a key, false if not."}, {"update", (PyCFunction)BPy_IDGroup_Update, METH_VARARGS, "updates the values in the group with the values of another or a dict."}, |