aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/py/source/bound.cpp
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2005-09-21 10:52:33 +0000
committerThomas Grill <xovo@users.sourceforge.net>2005-09-21 10:52:33 +0000
commit2b91966061ead3c4aa260033e95cfc4adb396496 (patch)
treecd8b0d9196dd9f49a389427ad56349d22bde2476 /externals/grill/py/source/bound.cpp
parent45da6684cbe9bd2fe199b0fd75a40f1c219b6341 (diff)
__str__ method for pyext, to enable print self calls
python-like dotted module.function syntax multiply inlets for py (hot and cold inlets) enable symbol binding for all callables (not only functions and methods) enable optimization of Python code in reease build _isthreaded is now a data member instead of a method compiler flag to exclude DSP objects some ASSERTs for explicitly created pyext classes (should be runtime checks i guess) cleaned up float vs. int pyext tags more safety for calls where association python-pd has already been removed open editor for module file on "edit" message (or click) let _inlets and _outlets default to 0 svn path=/trunk/; revision=3610
Diffstat (limited to 'externals/grill/py/source/bound.cpp')
-rw-r--r--externals/grill/py/source/bound.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/externals/grill/py/source/bound.cpp b/externals/grill/py/source/bound.cpp
index 4c57f65f..3e7bc386 100644
--- a/externals/grill/py/source/bound.cpp
+++ b/externals/grill/py/source/bound.cpp
@@ -46,7 +46,7 @@ public:
if(PyMethod_Check(b))
return true;
else
- // both are functions
+ // both are non-method callables
return a < b;
}
};
@@ -88,12 +88,15 @@ PyObject *pyext::pyext_bind(PyObject *,PyObject *args)
PyObject *self,*meth,*name;
if(!PyArg_ParseTuple(args, "OOO:pyext_bind", &self,&name,&meth)) // borrowed references
post("py/pyext - Wrong arguments!");
- else if(!PyInstance_Check(self) || !(PyMethod_Check(meth) || PyFunction_Check(meth))) {
+ else if(!PyInstance_Check(self) || !PyCallable_Check(meth)) {
post("py/pyext - Wrong argument types!");
}
else {
pyext *th = GetThis(self);
- FLEXT_ASSERT(th);
+ if(!th) {
+ PyErr_SetString(PyExc_RuntimeError,"pyext - _bind: instance not associated with pd object");
+ return NULL;
+ }
const t_symbol *recv = pyObject_AsSymbol(name);
@@ -130,12 +133,15 @@ PyObject *pyext::pyext_unbind(PyObject *,PyObject *args)
PyObject *self,*meth,*name;
if(!PyArg_ParseTuple(args, "OOO:pyext_bind", &self,&name,&meth)) // borrowed references
post("py/pyext - Wrong arguments!");
- else if(!PyInstance_Check(self) || !(PyMethod_Check(meth) || PyFunction_Check(meth))) {
+ else if(!PyInstance_Check(self) || !PyCallable_Check(meth)) {
post("py/pyext - Wrong argument types!");
}
else {
pyext *th = GetThis(self);
- FLEXT_ASSERT(th);
+ if(!th) {
+ PyErr_SetString(PyExc_RuntimeError,"pyext - _unbind: instance not associated with pd object");
+ return NULL;
+ }
const t_symbol *recv = pyObject_AsSymbol(name);
@@ -175,7 +181,7 @@ void pyext::ClearBinding()
if(!pyobj) return;
pyext *th = GetThis(pyobj);
- FLEXT_ASSERT(th);
+ if(!th) return;
void *data = NULL;
const t_symbol *sym = NULL;