[Scipy-tickets] [SciPy] #1026: scipy.weave.blitz bug using functions

SciPy Trac scipy-tickets@scipy....
Mon Nov 29 13:50:38 CST 2010


#1026: scipy.weave.blitz bug using functions
-------------------------+--------------------------------------------------
 Reporter:  schlesin     |       Owner:  somebody   
     Type:  defect       |      Status:  new        
 Priority:  normal       |   Milestone:  Unscheduled
Component:  scipy.weave  |     Version:  0.7.0      
 Keywords:  blitz        |  
-------------------------+--------------------------------------------------

Old description:

> is this a bug or am I doing something wrong?
>
> import scipy
> arr = scipy.random.rand(1000000)
> res = scipy.zeros_like(arr)
> blitz("""res = sin(2*sin(arr+1))""")
>
> ---------------------------------------------------------------------------
> NameError                                 Traceback (most recent call
> last)
>
> /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
> packages/scipy/weave/blitz_tools.pyc
> in blitz(expr, local_dict, global_dict, check_size, verbose, **kw)
>      32     #    of time.  It also can cause core-dumps if the sizes
> of the inputs
>      33     #    aren't compatible.
> ---> 34     if check_size and not
> size_check.check_expr(expr,local_dict,global_dict):
>      35         raise 'inputs failed to pass size check.'
>      36
>
> /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
> packages/scipy/weave/size_check.pyc
> in check_expr(expr, local_vars, global_vars)
>      49         if isnumeric(val):
>      50             values[var] = val
> ---> 51     exec(expr,values)
>      52     try:
>      53         exec(expr,values)
>
> NameError: name 'sin' is not defined
> ---------------------------------------------------------------------------------------------------------
>
> If I do
> blitz("""res = sin(2*sin(arr+1))""", check_size=0)
> it works. Seems to me the check_size code tries to check the size of
> the array 'sin', instead of recognizing it as a function.

New description:

 is this a bug or am I doing something wrong?
 {{{
 import scipy
 arr = scipy.random.rand(1000000)
 res = scipy.zeros_like(arr)
 blitz("""res = sin(2*sin(arr+1))""")

 ---------------------------------------------------------------------------
 NameError                                 Traceback (most recent call
 last)

 /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
 packages/scipy/weave/blitz_tools.pyc
 in blitz(expr, local_dict, global_dict, check_size, verbose, **kw)
      32     #    of time.  It also can cause core-dumps if the sizes
 of the inputs
      33     #    aren't compatible.
 ---> 34     if check_size and not
 size_check.check_expr(expr,local_dict,global_dict):
      35         raise 'inputs failed to pass size check.'
      36

 /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
 packages/scipy/weave/size_check.pyc
 in check_expr(expr, local_vars, global_vars)
      49         if isnumeric(val):
      50             values[var] = val
 ---> 51     exec(expr,values)
      52     try:
      53         exec(expr,values)

 NameError: name 'sin' is not defined
 ---------------------------------------------------------------------------------------------------------
 }}}
 If I do
 `blitz("""res = sin(2*sin(arr+1))""", check_size=0)`
 it works. Seems to me the check_size code tries to check the size of
 the array 'sin', instead of recognizing it as a function.

--

Comment(by warren.weckesser):

 Added markup to the description.

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


More information about the Scipy-tickets mailing list