Ticket #1104 (new defect)
Opened 7 months ago
Scipy breaks object deletion when imported from a method
| Reported by: | stephaned | Owned by: | somebody |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.8.0 |
| Component: | Other | Version: | 0.7.0 |
| Keywords: | Cc: |
Description
Hi,
With the following code:
class App:
def __init__(self):
import scipy
##scipy.pkgload.parent_frame = None
def __del__(self):
print "app deleted"
app = App()
print "Deleting app"
del app
print "Leaving Python"
Here is the output:
Deleting app Leaving Python app deleted <-- WRONG
The app object is not deleted by "del app" but when Python leaves.
This is because "app" has a refcount of 2.
Going further, I found that "scipy.pkgload.parent_frame = None" solves the issue.
I also tried to transform "scipy.pkgload.parent_frame" to a "weakref.proxy", but got "cannot create weak reference to 'frame' object".
Cheers. Stephane
Note: See
TracTickets for help on using
tickets.
