Re: [Numpy-discussion] Please test the SVN branch
Travis Oliphant wrote: I made some fixes to the asbuffer code which let me feel better about exposing it in NumPy (where it is now named int_asbuffer). This code takes a Python integer and a size and returns a buffer object that points to that memory. A little test is performed by trying to read (and possibly write if a writeable buffer is requested) to the first and last elements of the buffer. Any segfault is trapped and used to raise a Python error indicating you can't use that area of memory. It doesn't guarantee you won't shoot yourself, but it does make it more difficult to segfault Python. Previously a simple int_asbuffer(3423423, 5) would have segfaulted (unless by chance you the memory area 3423423 happens to be owned by Python). I have not tested the code on other platforms to make sure it works as expected, so please try and compiled it. -Travis - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion Numpy version 1.0.dev3315 Scipy version 0.5.2.dev2254 Works fine here. All tests passed ! x86_64 x86_64 x86_64 GNU/Linux Nils - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
Re: [Numpy-discussion] Please test the SVN branch
On Thu, Oct 12, 2006 at 12:38:51AM -0600, Travis Oliphant wrote: I made some fixes to the asbuffer code which let me feel better about exposing it in NumPy (where it is now named int_asbuffer). This code takes a Python integer and a size and returns a buffer object that points to that memory. A little test is performed by trying to read (and possibly write if a writeable buffer is requested) to the first and last elements of the buffer. Any segfault is trapped and used to raise a Python error indicating you can't use that area of memory. It doesn't guarantee you won't shoot yourself, but it does make it more difficult to segfault Python. Previously a simple int_asbuffer(3423423, 5) would have segfaulted (unless by chance you the memory area 3423423 happens to be owned by Python). Some argument checking and a docstring would be helpful. I guessed wrong the first time: In [1]: x = N.array([1,2,3]) In [4]: y = N.int_asbuffer(x.size,x.__array_interface__['data'][0]) In [5]: y[0] Segmentation fault Out of curiosity, why does the following outputs differ: In [39]: y = N.int_asbuffer(0L,x.size) --- exceptions.SystemError Traceback (most recent call last) /home/stefan/ipython console SystemError: error return without exception set In [40]: y = N.int_asbuffer(1L,x.size) --- exceptions.ValueErrorTraceback (most recent call last) /home/stefan/ipython console ValueError: cannot use memory location as a buffer. Thanks for your work on this. Cheers Stéfan - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
Re: [Numpy-discussion] Please test the SVN branch
Travis Oliphant wrote: I made some fixes to the asbuffer code which let me feel better about exposing it in NumPy (where it is now named int_asbuffer). This code takes a Python integer and a size and returns a buffer object that points to that memory. A little test is performed by trying to read (and possibly write if a writeable buffer is requested) to the first and last elements of the buffer. Any segfault is trapped and used to raise a Python error indicating you can't use that area of memory. It doesn't guarantee you won't shoot yourself, but it does make it more difficult to segfault Python. Previously a simple int_asbuffer(3423423, 5) would have segfaulted (unless by chance you the memory area 3423423 happens to be owned by Python). I have not tested the code on other platforms to make sure it works as expected, so please try and compiled it. FWIW, it compiles fine and passes all tests under Visual Studio and Python 2.4.3. I haven't tried to use it though. -tim -Travis - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
Re: [Numpy-discussion] Please test the SVN branch
Travis Oliphant wrote: I made some fixes to the asbuffer code which let me feel better about exposing it in NumPy (where it is now named int_asbuffer). This code takes a Python integer and a size and returns a buffer object that points to that memory. If I understand this correctly, maybe it should be called something like: int_asbuffer_pointer or something with pointer in it. I sure didn't expect that meaning from asbuffer or in-asbuffer Otherwise -- nice idea! -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/ORR/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [EMAIL PROTECTED] - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion