[Scipy-tickets] [SciPy] #541: interpolate.fitpack.bisplrep crashes trying to look-up a status message

SciPy scipy-tickets@scipy....
Wed Nov 21 10:05:10 CST 2007


#541: interpolate.fitpack.bisplrep crashes trying to look-up a status message
-------------------------------+--------------------------------------------
 Reporter:  bamford            |       Owner:  somebody
     Type:  defect             |      Status:  new     
 Priority:  normal             |   Milestone:  0.7     
Component:  scipy.interpolate  |     Version:          
 Severity:  normal             |    Keywords:          
-------------------------------+--------------------------------------------
 The function bisplrep in fitpack.py crashes in the (fairly rare)
 circumstance that quiet=1 and the fitting system is "rank deficient".  In
 this case the return value ier < -2, and the corresponding message is
 looked-up in the dictionary _iermess2.  The correct message has key -3,
 but ier can be < -3, in which case the function crashes with a !KeyError.
 This is actually fixed in the line below, creating a new variable from ier
 with limited the range (ierm=min(11,max(-3,ier))) for future uses with
 _iermess2.  This line just needs to be moved above the first potential
 access of _iermess2, and ier changed to ierm:

 Current (rev. 3559, last changed 3526):
 {{{
     tck=[tx,ty,c,kx,ky]
     if ier<=0 and not quiet:
         print _iermess2[ier][0]
         print "\tkx,ky=%d,%d nx,ny=%d,%d m=%d fp=%f s=%f"%(kx,ky,len(tx),
                                                            len(ty),m,fp,s)
     ierm=min(11,max(-3,ier))
     if ierm>0 and not full_output:
 }}}

 Change to:
 {{{
     tck=[tx,ty,c,kx,ky]
     ierm=min(11,max(-3,ier))
     if ierm<=0 and not quiet:
         print _iermess2[ierm][0]
         print "\tkx,ky=%d,%d nx,ny=%d,%d m=%d fp=%f s=%f"%(kx,ky,len(tx),
                                                            len(ty),m,fp,s)
     if ierm>0 and not full_output:
 }}}

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


More information about the Scipy-tickets mailing list