From 35a59e7dbce7f5cd6fb8c26e40fc66dfd8384cce Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Mon, 18 Jul 2005 18:03:12 +0000 Subject: 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 --- externals/grill/py/source/pymeth.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'externals/grill/py/source/pymeth.cpp') 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"); -- cgit v1.2.1