[Scipy-tickets] [SciPy] #1679: scipy.weave.inline fails to convert numpy.double type

SciPy Trac scipy-tickets@scipy....
Tue Jun 19 02:01:37 CDT 2012


#1679: scipy.weave.inline fails to convert numpy.double type
--------------------------------------------------------+-------------------
 Reporter:  mforbes                                     |       Owner:  somebody   
     Type:  defect                                      |      Status:  new        
 Priority:  normal                                      |   Milestone:  Unscheduled
Component:  Other                                       |     Version:  0.10.0     
 Keywords:  scipy, weave, inline, types, float, double  |  
--------------------------------------------------------+-------------------
 I am having some problems using {{{np.double}}} with
 {{{sp.weave.inline}}}:


 {{{
 import scipy.weave
 import numpy

 code = r'''
 x += 2.0;
 '''
 x = numpy.double(1.2)
 scipy.weave.inline(code=code, arg_names=['x'], force=1)
 }}}

 For some reason, inline does not know to convert these types and generates
 the following code:

 {{{
    py::object x = convert_to_catchall(py_x,"x");
 }}}

 If one uses the native python {{{float}}} type or {{{numpy}}} arrays, then
 things work well, but this is a rather difficult bug to find at first
 since in many cases, the program will compile, but then segfault when x is
 used.

 This is on a 32 bit MacBook Pro running Leopard (10.5.8):
 {{{
 $ python
 Enthought Python Distribution -- www.enthought.com
 Version: 7.2-1 (32-bit)

 Python 2.7.2 |EPD 7.2-1 (32-bit)| (default, Sep  7 2011, 09:16:50)
 [GCC 4.0.1 (Apple Inc. build 5493)] on darwin
 Type "packages", "demo" or "enthought" for more information.
 >>> import numpy, scipy
 >>> numpy.__version__
 '1.6.1'
 >>> scipy.__version__
 '0.10.0'
 >>>

 $ gcc --version
 i686-apple-darwin9-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5577)
 Copyright (C) 2007 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
 PURPOSE.
 }}}

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/1679>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list