diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2005-12-12 00:18:42 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2005-12-12 00:18:42 +0000 |
commit | 8ac2ac31abb94663c66596ae2ceb55a6c778b972 (patch) | |
tree | 8006dcf30cffa60c0a4f4429c8f772ec055ffba9 /externals/grill/py/source/modmeth.cpp | |
parent | d1297bad7d860014ff6a4aa3ce66002125c7d0ac (diff) |
__str__ method for pyext, to enable print self calls
added message bundle functionality (pyext.Bundle class)
enable symbol binding for all callables (not only functions and methods)
small optimizations and fixes
enable optimization of Python code in reease build
_isthreaded is now a data member instead of a method
more safety for calls where association python-pd has already been removed
fixes for pthreads V2
svn path=/trunk/; revision=4190
Diffstat (limited to 'externals/grill/py/source/modmeth.cpp')
-rw-r--r-- | externals/grill/py/source/modmeth.cpp | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/externals/grill/py/source/modmeth.cpp b/externals/grill/py/source/modmeth.cpp index 44299b0c..a611690f 100644 --- a/externals/grill/py/source/modmeth.cpp +++ b/externals/grill/py/source/modmeth.cpp @@ -118,6 +118,7 @@ PyObject *pybase::py_send(PyObject *,PyObject *args) ) { PyObject *val; +#if 0 bool tp = sz == 2 && PySequence_Check( @@ -126,28 +127,47 @@ PyObject *pybase::py_send(PyObject *,PyObject *args) if(!tp) val = PySequence_GetSlice(args,1,sz); // new ref +#else + if(sz == 2) { + val = PyTuple_GET_ITEM(args,1); // borrow reference + Py_INCREF(val); + } + else + val = PySequence_GetSlice(args,1,sz); // new ref +#endif AtomListStatic<16> lst; const t_symbol *sym = GetPyArgs(lst,val); + Py_DECREF(val); + if(sym) { bool ok = Forward(recv,sym,lst.Count(),lst.Atoms()); #ifdef FLEXT_DEBUG if(!ok) post("py/pyext - Receiver doesn't exist"); #endif + Py_INCREF(Py_None); + return Py_None; } - else if(PyErr_Occurred()) +/* + else if(PyErr_Occurred()) PyErr_Print(); else post("py/pyext - No data to send"); - - if(!tp) Py_DECREF(val); +*/ + else { + FLEXT_ASSERT(PyErr_Occurred()); + return NULL; + } } +/* else post("py/pyext - Send name is invalid"); - - Py_INCREF(Py_None); - return Py_None; +*/ + else { + PyErr_SetString(PyExc_ValueError,"py/pyext - Send name is invalid"); + return NULL; + } } #ifdef FLEXT_THREADS |