[Scipy-tickets] [SciPy] #1287: check_func() in minpack.py raises an AttributeError when a callable returns a bad shape but does not have a 'func_name' attribute

SciPy Trac scipy-tickets@scipy....
Sat Sep 25 21:43:07 CDT 2010


#1287: check_func() in minpack.py raises an AttributeError when a callable returns
a bad shape but does not have a 'func_name' attribute
---------------------------------------------+------------------------------
 Reporter:  warren.weckesser                 |       Owner:  somebody
     Type:  defect                           |      Status:  new     
 Priority:  normal                           |   Milestone:  0.9.0   
Component:  scipy.optimize                   |     Version:  0.7.0   
 Keywords:  leastsq, fsolve, AttributeError  |  
---------------------------------------------+------------------------------
 In optimize/minpack.py, the functions fsolve() and leastsq() use a utility
 function check_func() for checking that the functions provided by the user
 return arrays with the proper shape.  If an improper shape is detected,
 check_func() raises a TypeError.  However, it gets the name of the
 function (to include in the error message) by accessing the 'func_name'
 attribute of the function.  Not all callables have a 'func_name' attribute
 --in particular, functions in extension modules created with cython or
 ctypes do not have 'func_name'.  So instead of getting a helpful error
 message when such function returns an invalid shape, an AttributeError is
 raised in check_func().

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


More information about the Scipy-tickets mailing list