diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2004-08-31 04:07:35 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2004-08-31 04:07:35 +0000 |
commit | 1a23e8233e6c1cbc30b9ddee4df153c21f4b282b (patch) | |
tree | 1c79382a41ef857e5beeed6f27ca1c85c81ddac1 /externals/grill/py/source/pyext.cpp | |
parent | d28900c480f4ea568acdff80372f12383d463e8c (diff) |
""
svn path=/trunk/; revision=1982
Diffstat (limited to 'externals/grill/py/source/pyext.cpp')
-rw-r--r-- | externals/grill/py/source/pyext.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/externals/grill/py/source/pyext.cpp b/externals/grill/py/source/pyext.cpp index 7ce0995c..adaacc0e 100644 --- a/externals/grill/py/source/pyext.cpp +++ b/externals/grill/py/source/pyext.cpp @@ -76,10 +76,15 @@ V pyext::Setup(t_classid c) pyext *pyext::GetThis(PyObject *self) { PyObject *th = PyObject_GetAttrString(self,"_this"); - pyext *ret = th?(pyext *)PyLong_AsVoidPtr(th):NULL; - PyErr_Clear(); - Py_XDECREF(th); - return ret; + if(th) { + pyext *ret = static_cast<pyext *>(PyLong_AsVoidPtr(th)); + Py_DECREF(th); + return ret; + } + else { + PyErr_Clear(); + return NULL; + } } @@ -385,7 +390,7 @@ void pyext::m_set(int argc,const t_atom *argv) if(PySequence_Size(pval) == 1) { // reduce lists of one element to element itself - PyObject *val1 = PySequence_GetItem(pval,0); + PyObject *val1 = PySequence_GetItem(pval,0); // new reference Py_DECREF(pval); pval = val1; } |