[Numpy-tickets] [NumPy] #454: Importing numpy prevents decrementing references for local variables

NumPy numpy-tickets@scipy....
Fri Feb 16 13:54:57 CST 2007


#454: Importing numpy prevents decrementing references for local variables
------------------------+---------------------------------------------------
 Reporter:  goddard     |       Owner:  somebody
     Type:  defect      |      Status:  new     
 Priority:  normal      |   Milestone:          
Component:  numpy.core  |     Version:  1.0.1   
 Severity:  major       |    Keywords:          
------------------------+---------------------------------------------------
 If the first import of numpy is within a function it prevents that
 function's
 local variables and all locals in higher call frames that led to the
 import
 from being deleted.  This can prevent freeing up large numpy arrays.

 The problem is that numpy __init__.py imports numpy _import_tools.py
 and creates a PackageLoader object that saves the parent frame

        self.parent_frame = frame = sys._getframe(1)

 Saving the parent frame results in saving the entire call stack even after
 all those functions have returned.

 I've attached Python code illustrating the problem.

-- 
Ticket URL: <http://projects.scipy.org/scipy/numpy/ticket/454>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.


More information about the Numpy-tickets mailing list