aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/py/source/pyargs.cpp
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2004-08-31 04:07:35 +0000
committerThomas Grill <xovo@users.sourceforge.net>2004-08-31 04:07:35 +0000
commit1a23e8233e6c1cbc30b9ddee4df153c21f4b282b (patch)
tree1c79382a41ef857e5beeed6f27ca1c85c81ddac1 /externals/grill/py/source/pyargs.cpp
parentd28900c480f4ea568acdff80372f12383d463e8c (diff)
""
svn path=/trunk/; revision=1982
Diffstat (limited to 'externals/grill/py/source/pyargs.cpp')
-rw-r--r--externals/grill/py/source/pyargs.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/externals/grill/py/source/pyargs.cpp b/externals/grill/py/source/pyargs.cpp
index 1b204273..69e403b0 100644
--- a/externals/grill/py/source/pyargs.cpp
+++ b/externals/grill/py/source/pyargs.cpp
@@ -116,10 +116,10 @@ flext::AtomList *py::GetPyArgs(PyObject *pValue,PyObject **self)
for(I ix = 0; ix < rargc; ++ix) {
PyObject *arg;
- switch(tp) {
- case sequ: arg = PySequence_GetItem(pValue,ix); break;
- default: arg = pValue;
- }
+ if(tp == sequ)
+ arg = PySequence_GetItem(pValue,ix); // new reference
+ else
+ arg = pValue;
if(PyInt_Check(arg)) SetInt((*ret)[ix],PyInt_AsLong(arg));
else if(PyLong_Check(arg)) SetInt((*ret)[ix],PyLong_AsLong(arg));
@@ -127,6 +127,7 @@ flext::AtomList *py::GetPyArgs(PyObject *pValue,PyObject **self)
else if(PyString_Check(arg)) SetString((*ret)[ix],PyString_AsString(arg));
else if(ix == 0 && self && PyInstance_Check(arg)) {
// assumed to be self ... that should be checked _somehow_ !!!
+ Py_INCREF(arg);
*self = arg;
}
else {
@@ -139,7 +140,8 @@ flext::AtomList *py::GetPyArgs(PyObject *pValue,PyObject **self)
Py_XDECREF(tp);
ok = false;
}
- // No DECREF for arg -> borrowed from pValue!
+
+ if(tp == sequ) Py_DECREF(arg);
}
if(!ok) {