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/pybase.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/pybase.cpp')
-rw-r--r-- | externals/grill/py/source/pybase.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/externals/grill/py/source/pybase.cpp b/externals/grill/py/source/pybase.cpp index 3bc589de..65c4369d 100644 --- a/externals/grill/py/source/pybase.cpp +++ b/externals/grill/py/source/pybase.cpp @@ -568,7 +568,7 @@ bool pybase::gencall(PyObject *pmeth,PyObject *pargs) // Now call method
switch(detach) {
case 0:
- ret = callpy(pmeth,pargs);
+ ret = docall(pmeth,pargs);
Py_DECREF(pargs);
Py_DECREF(pmeth);
break;
@@ -591,6 +591,24 @@ bool pybase::gencall(PyObject *pmeth,PyObject *pargs) return ret;
}
+void pybase::exchandle()
+{
+#if 0
+ // want to use that, but exception keeps a reference to the object
+ PyErr_Print();
+#else
+ // must use that instead... clear the exception
+ PyObject *type,*value,*traceback;
+ PyErr_Fetch(&type,&value,&traceback);
+ PyErr_NormalizeException(&type,&value,&traceback);
+ PyErr_Display(type,value,traceback);
+
+ Py_XDECREF(type);
+ Py_XDECREF(value);
+ Py_XDECREF(traceback);
+#endif
+}
+
void pybase::work_wrapper(void *data)
{
FLEXT_ASSERT(data);
@@ -603,7 +621,7 @@ void pybase::work_wrapper(void *data) // call worker
work_data *w = (work_data *)data;
- callpy(w->fun,w->args);
+ docall(w->fun,w->args);
delete w;
PyUnlock(state);
@@ -634,7 +652,7 @@ void pybase::threadworker() while(el = qufifo.Get()) {
++thrcount;
state = PyLock(my);
- callpy(el->fun,el->args);
+ docall(el->fun,el->args);
Py_XDECREF(el->fun);
Py_XDECREF(el->args);
PyUnlock(state);
|