aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/py/source/pyext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'externals/grill/py/source/pyext.cpp')
-rw-r--r--externals/grill/py/source/pyext.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/externals/grill/py/source/pyext.cpp b/externals/grill/py/source/pyext.cpp
index b8763771..799de20a 100644
--- a/externals/grill/py/source/pyext.cpp
+++ b/externals/grill/py/source/pyext.cpp
@@ -2,7 +2,7 @@
py/pyext - python script object for PD and MaxMSP
-Copyright (c) 2002-2003 Thomas Grill (xovo@gmx.net)
+Copyright (c) 2002-2004 Thomas Grill (xovo@gmx.net)
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.
@@ -339,10 +339,19 @@ void pyext::m_set(int argc,const t_atom *argv)
post("%s - set: Python variable %s not found",thisName(),ch);
}
else {
- PyObject *pval = MakePyArgs(sym_list,AtomList(argc-1,argv+1),-1,false);
- if(!pval)
+ PyObject *pval = MakePyArgs(NULL,AtomList(argc-1,argv+1),-1,false);
+
+ if(!pval)
PyErr_Print();
else {
+ if(PySequence_Size(pval) == 1) {
+ // reduce lists of one element to element itself
+
+ PyObject *val1 = PySequence_GetItem(pval,0);
+ Py_DECREF(pval);
+ pval = val1;
+ }
+
PyObject_SetAttrString(pyobj,ch,pval);
Py_DECREF(pval);
}