For the records. I've just committed the revised package to 10.5 and 10.4 unstable.
Begin forwarded message: > Resent-From: Michael Wild <[EMAIL PROTECTED]> > From: Michael Wild <[EMAIL PROTECTED]> > Date: April 22, 2008 10:39:08 CEDT > Resent-To: [EMAIL PROTECTED] > To: [EMAIL PROTECTED] > Subject: Patch for the Fink Numarray package > > Hi > > Using the Python Numarray package I came across a bug which > apparently is fixed in CVS (see below conversation with the > developers). I created a patchfile for the numarray-py package and > adjusted the info file accordingly. You might want to adjust the > revision number, I just set it to 1.patched and not 2 in order to > get your update. > > Regards > > > Michael > > Begin forwarded message: >> From: Todd Miller <[EMAIL PROTECTED]> >> Date: 21April, 2008 21:14:43 GMT+02:00 >> To: [EMAIL PROTECTED], [EMAIL PROTECTED] >> Subject: Re: You have been assigned call CNSHD722278 regarding >> PyArray_FromDims in Numarray leaking Py_None by chanley its status >> is Assigned >> >> This is a known problem with no corresponding source release. The >> patch against 1.5.2 patches Src/libnumarray.ch and is: >> >> [EMAIL PROTECTED] Src]$ cvs diff -r 1.33 -r 1.34 libnumarray.ch >> Index: libnumarray.ch >> =================================================================== >> RCS file: /cvsroot/numpy/numarray/Src/libnumarray.ch,v >> retrieving revision 1.33 >> retrieving revision 1.34 >> diff -c -r1.33 -r1.34 >> *** libnumarray.ch 24 Aug 2006 18:39:45 -0000 1.33 >> --- libnumarray.ch 20 Nov 2006 17:35:31 -0000 1.34 >> *************** >> *** 877,882 **** >> --- 877,883 ---- >> if (!buf) return NULL; >> } else { >> buf = Py_None; >> + Py_INCREF(buf); >> } >> a = NA_NewAllFromBuffer( nd, dimensions, descr->type_num, buf, >> >> After patching, do: >> >> % python setup.py install --gencode --selftest >> >> Another alternative is to use the unofficial numarray-1.5.3 tarball >> (attached) which should work on at least linux and Mac OS-X. It is >> lightly tested with Python-2.5.2 but there are known self-test >> problems on Windows (numarray floating point Python version >> specific platform esoterica) or Mac OS-X (apparently in numpy). It >> appeared to fix your problem though. >> >> Regards, >> Todd >> >> [EMAIL PROTECTED] wrote: >>> You have been assigned call CNSHD722278 regarding PyArray_FromDims >>> in Numarray leaking Py_None by chanley its status is Assigned >>> >>> Request Log : 04/18/08 04:28:16 mcleskey >>> Request from [EMAIL PROTECTED] >>> To: [EMAIL PROTECTED] >>> Cc: This is an OpenPGP/MIME signed message (RFC >>> 2440 and 3156) >>> --Apple-Mail-20-418780118 >>> Content-Type: multipart/mixed; boundary=Apple-Mail-19-418780066 >>> --Apple-Mail-19-418780066 >>> Content-Type: text/plain; >>> charset=US-ASCII; >>> format=flowed; >>> delsp=yes >>> Content-Transfer-Encoding: 7bit >>> Hi >>> I know that Numarray is being phased out and one should >>> switch over to Numpy, but I encountered a problem with a >>> rather large code (cantera) which makes use of Numarray, so >>> I still direct this question to you. >>> The cantera code I use had the strange behavior of >>> crashing python with an error message stating "trying to >>> deallocate None". I tracked it down to PyArray_FromDims >>> being called very often, and found that after each call the >>> reference count of the Py_None object is decreased by 1. >>> This means, that after ~1500 calls to PyArray_FromDims, >>> python tries to deallocate Py_None, resulting in the crash. >>> First I thought it might be cantera "misusing" Numarray. >>> But then I modified the "dimsdata" example provided with >>> Numarray to use PyArray_FromDims, and the same behavior >>> shows. Strange enough, PyArray_FromDimsAndData works just >>> fine. >>> Is this a known issue? Is there a patch fixing this? I >>> hacked a quick solution by calling Py_INCREF(Py_None) after >>> each call to PyArray_FromDims in cantera. This fixed the >>> immediate symptoms, but I'm quite sure that this might make >>> things even worse (and am well aware that this doesn't fix >>> the actual cause of the problem). >>> I attached the modified dimsdata example with a python >>> driver script so you can try to reproduce the problem. To >>> do so, save the attached files and in a shell execute: >>> python setup.py build >>> ln -s <path/to/dimsdata.so> . >>> python test.py >>> You should see that the reported reference count >>> decreases by 1 after each call to PyArray_FromDims, but is >>> unchanged after the call to PyArray_FromDimsAndData. >>> Michael >>> My specs are: >>> MacBook Pro >>> Intel Core 2 Duo 2.33 GHz >>> 2GB of 667 MHz DDR2 SDRAM >>> Mac OS X 10.5.2 >>> Python 2.5.2 installed with fink >>> Numarray 1.5.2 installed with fink >>> The same thing happens on a Linux box: >>> AMD Athlon 64 X2 Dual Core Processor 3800+ >>> SuSE Linux 10.3, Kernel 2.6.16 >>> Python 2.4.2 >>> Numarray 1.5.2 >>> -- >>> Institute of Fluid Dynamics >>> ETH-Zentrum, ML H59 >>> CH-8092 Zurich >>> +41 44 632 8709 >>> --Apple-Mail-19-418780066 >>> Content-Disposition: attachment; >>> filename=dimsdata.c >>> Content-Type: application/octet-stream; >>> x-unix-mode=0644; >>> name="dimsdata.c" >>> Content-Transfer-Encoding: 7bit >>> /* This module shows how to turn a static C array into a >>> NumArray. */ >>> .#include "Python.h" >>> .#include "numarray/arrayobject.h" >>> .#include <stdio.h> >>> static double data[4][3] = {{1, 2, 3}, >>> {4, 5, 6}, >>> {7, 8, 9}, >>> {10, 11, 12}}; >>> static int shape[2] = { 4, 3 }; >>> static PyObject * >>> _getarray(PyObject *module, PyObject *args) >>> { >>> if (!PyArg_ParseTuple(args,":getarray")) >>> return NULL; >>> int num; >>> num = 100; >>> printf("before PyArray_FromDims: %d\n",(int)Py_None- >>> >ob_refcnt); >>> PyObject* a = >>> PyArray_FromDims(2, shape, PyArray_DOUBLE); >>> printf("after PyArray_FromDims: %d\n",(int)Py_None->ob_refcnt); >>> Py_DECREF(a); >>> printf("before PyArray_FromDimsAndData: %d\n",(int)Py_None- >>> >ob_refcnt); >>> PyObject* res = >>> PyArray_FromDimsAndData(2, shape, PyArray_DOUBLE, (char >>> *)data); >>> printf("after PyArray_FromDimsAndData: %d\n\n",(int)Py_None- >>> >ob_refcnt); >>> return res; >>> } >>> static PyMethodDef _dimsdata_functions[] = { >>> {"getarray", _getarray, METH_VARARGS, "getarray() >>> returns a static array cast as a numarray."}, >>> {NULL, NULL} /* Sentinel */ >>> }; >>> static char * _dimsdata_doc = "Example module for >>> PyArray_DimsAndData."; >>> void initdimsdata(void) >>> { >>> PyObject *m = Py_InitModule3("dimsdata", >>> _dimsdata_functions, >>> _dimsdata_doc); >>> if (m == NULL) return; >>> import_array(); >>> } >>> --Apple-Mail-19-418780066 >>> Content-Disposition: attachment; >>> filename=test.py >>> Content-Type: text/x-python-script; >>> x-unix-mode=0644; >>> name="test.py" >>> Content-Transfer-Encoding: 7bit >>> from dimsdata import * >>> for i in range(10): >>> getarray() >>> --Apple-Mail-19-418780066 >>> Content-Disposition: attachment; >>> filename=setup.py >>> Content-Type: text/x-python-script; >>> x-unix-mode=0644; >>> name="setup.py" >>> Content-Transfer-Encoding: 7bit >>> from distutils.core import Extension, setup >>> e = Extension(name="dimsdata", sources=["dimsdata.c"]) >>> setup(name="dimsdata", ext_modules=[e]) >>> --Apple-Mail-19-418780066-- >>> --Apple-Mail-20-418780118 >>> content-type: application/pgp-signature; x-mac-type=70674453; >>> name=PGP.sig >>> content-description: This is a digitally signed message part >>> content-disposition: inline; filename=PGP.sig >>> content-transfer-encoding: 7bit >>> -----BEGIN PGP SIGNATURE----- >>> Version: GnuPG v1.4.9 (Darwin) >>> iEYEARECAAYFAkgIWWoACgkQl7l0ufRsoXp0VACfc0lKwFDEKZrlINFQ/ >>> rMfiANz >>> wGEAnj7Fa7ld4rYgvtN0ijduQVGrDMAo >>> =dPKI >>> -----END PGP SIGNATURE----- >>> --Apple-Mail-20-418780118-- >>> 04/18/08 09:15:09 bshaw >>> bshaw changed platform to STSDAS >>> 04/21/08 09:40:08 chanley >>> chanley changed status to Assigned >>> chanley assigned call to jmiller ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ Fink-devel mailing list Fink-devel@lists.sourceforge.net http://news.gmane.org/gmane.os.apple.fink.devel