[Scipy-tickets] [SciPy] #1351: _minpack._lmdif kills the current process when receiving a SystemExit exception

SciPy Trac scipy-tickets@scipy....
Tue Dec 21 10:15:55 CST 2010

#1351: _minpack._lmdif kills the current process when receiving a SystemExit
 Reporter:  japh44                   |       Owner:  somebody
     Type:  defect                   |      Status:  new     
 Priority:  normal                   |   Milestone:  0.9.0   
Component:  Other                    |     Version:  0.8.0   
 Keywords:  leastsq, lmdif, minpack  |  
 It seems that the function _minpack._lmdif abruptly terminates the current
 process when it receives a SystemExit exception instead of just aborting
 its execution and returning to Python. Maybe this behaviour is intended
 but I found it very unexpected. In my program I execute
 numpy.optimize.leastsq in a worker thread and in order to interrupt the
 execution of this thread from the main (GUI) thread I use the
 KillableThread pattern (http://code.activestate.com/recipes/496960-thread2
 -killable-threads/), which asynchronously sends a SystemExit exception to
 the worker thread. It seems that when _minpack._lmdif receives this
 exception it kills not only the current thread but the whole Python
 process. I my opinion this kind of behaviour is quite unexpected and
 should be avoided or at least documented.

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

More information about the Scipy-tickets mailing list