diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2005-07-18 18:03:12 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2005-07-18 18:03:12 +0000 |
commit | 35a59e7dbce7f5cd6fb8c26e40fc66dfd8384cce (patch) | |
tree | cb2d24e74f150aa72822e468338e077211012dbb /externals/grill/py/source/pymeth.cpp | |
parent | f29a360e5aaaeeb75ec191a4163905a8cf44212a (diff) |
python-like dotted module.function syntax
cleaned up float vs. int pyext tags
better definition of output values (atoms, lists, anythings)
multiply inlets for py (hot and cold inlets)
better exception handling and error message
fixes for atomic pyext._outlet messages
svn path=/trunk/; revision=3358
Diffstat (limited to 'externals/grill/py/source/pymeth.cpp')
-rw-r--r-- | externals/grill/py/source/pymeth.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/externals/grill/py/source/pymeth.cpp b/externals/grill/py/source/pymeth.cpp index 8c80bd43..e2278d1c 100644 --- a/externals/grill/py/source/pymeth.cpp +++ b/externals/grill/py/source/pymeth.cpp @@ -131,7 +131,7 @@ protected: private:
- virtual bool callpy(PyObject *fun,PyObject *args);
+ virtual void callpy(PyObject *fun,PyObject *args);
static void Setup(t_classid c);
@@ -360,19 +360,12 @@ void pymeth::Unload() SetFunction(NULL);
}
-bool pymeth::callpy(PyObject *fun,PyObject *args)
+void pymeth::callpy(PyObject *fun,PyObject *args)
{
PyObject *ret = PyObject_CallObject(fun,args);
- if(ret == NULL) {
- // function not found resp. arguments not matching
- PyErr_Print();
- return false;
- }
- else {
- if(ret != Py_None && !OutObject(this,0,ret) && PyErr_Occurred())
- PyErr_Print();
+ if(ret) {
+ OutObject(this,0,ret); // exception might be raised here
Py_DECREF(ret);
- return true;
}
}
@@ -421,7 +414,8 @@ bool pymeth::CbMethodResort(int n,const t_symbol *s,int argc,const t_atom *argv) PyTuple_SET_ITEM(pargs,i-1,objects[i]);
}
- ret = gencall(function,pargs); // references are stolen
+ gencall(function,pargs); // references are stolen
+ ret = true;
}
else
PyErr_SetString(PyExc_RuntimeError,"No function set");
|