aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/utility.py
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2009-10-05 21:00:34 -0400
committerW. Trevor King <wking@drexel.edu>2009-10-05 21:00:34 -0400
commitaa7546258e3f24bec3df2d8c4b203ed08e0acbce (patch)
treed93b3c47e74e62524238f6e7dea03acf735988de /libbe/utility.py
parente35ccf95ea89b6e622202caae30d3b8cca3f2473 (diff)
downloadbugseverywhere-aa7546258e3f24bec3df2d8c4b203ed08e0acbce.tar.gz
Moved from *.__del__() to exclusive use of *.cleanup().
*.__del__() is run some unspecified time after the refcount for an object is reduced to zero. Sometimes that means that the rest of the world has already been deallocated, which makes life difficult, especially when Python won't attempt to construct stack traces inside *.__del__(). We were always (hopefully ;) calling del(*) anyway, so we just replace those calls with *.cleanup()
Diffstat (limited to 'libbe/utility.py')
-rw-r--r--libbe/utility.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/libbe/utility.py b/libbe/utility.py
index aafbf8d..1e43516 100644
--- a/libbe/utility.py
+++ b/libbe/utility.py
@@ -58,13 +58,10 @@ class Dir (object):
"A temporary directory for testing use"
def __init__(self):
self.path = tempfile.mkdtemp(prefix="BEtest")
- self.rmtree = shutil.rmtree # save local reference for __del__
self.removed = False
- def __del__(self):
- self.cleanup()
def cleanup(self):
if self.removed == False:
- self.rmtree(self.path)
+ shutil.rmtree(self.path)
self.removed = True
def __call__(self):
return self.path