From 1a23e8233e6c1cbc30b9ddee4df153c21f4b282b Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Tue, 31 Aug 2004 04:07:35 +0000 Subject: "" svn path=/trunk/; revision=1982 --- externals/grill/py/source/pyext.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'externals/grill/py/source/pyext.cpp') 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(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; } -- cgit v1.2.1