From: Matt K. <mat...@ho...> - 2006-08-26 22:07:37
|
Hi there. I'm in the unfortunate situation of trying to track down a memory= error in someone elses code, and to make matters worse I don't really know= jack squat about C programming. The problem seems to arise when several nu= mpy arrays are created from C arrays in the C api and returned to python, a= nd then trying to print out or cast to a string the resulting array. I thin= k the problem may be happening due to the following chunk of code: { PyObject* temp =3D PyArray_SimpleNewFromData(1, &numobjs, typeNum, dbV= alues); PyObject* temp2 =3D PyArray_FromArray((PyArrayObject*)temp, ((P= yArrayObject*)temp)->descr, DEFAULT_FLAGS | ENSURECOPY); Py_DECREF(temp= ); PyDict_SetItemString(returnVal, "data", temp2); Py_DECREF(temp2)= ; } =20 Lets assume that all my other inputs up this point are fine and that numobj= s, typeNum, and dbValues are fine. Is their anything obviously wrong with t= he above chunk of code? or does it appear ok? Ultimately the dictionary "re= turnVal" is returned by the function this code came from, and everything el= se is discarded. Any help is very greatly appreciated. Thanks in advance, =20 - Matt Knox =20 _________________________________________________________________ Be one of the first to try Windows Live Mail. http://ideas.live.com/programpage.aspx?versionId=3D5d21c51a-b161-4314-9b0e-= 4911fb2b2e6d= |