aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/bugdir.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/bugdir.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/bugdir.py')
-rw-r--r--libbe/bugdir.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/libbe/bugdir.py b/libbe/bugdir.py
index c4f0f91..5324163 100644
--- a/libbe/bugdir.py
+++ b/libbe/bugdir.py
@@ -305,6 +305,7 @@ settings easy. Don't set this attribute. Set .vcs instead, and
self.root = self._find_root(root)
else:
if not os.path.exists(root):
+ self.root = None
raise NoRootEntry(root)
self.root = root
# get a temporary vcs until we've loaded settings
@@ -324,9 +325,6 @@ settings easy. Don't set this attribute. Set .vcs instead, and
self.vcs = vcs
self._setup_user_id(self.user_id)
- def __del__(self):
- self.cleanup()
-
def cleanup(self):
self.vcs.cleanup()
@@ -339,6 +337,7 @@ settings easy. Don't set this attribute. Set .vcs instead, and
then only if sink_to_existing_root == True.
"""
if not os.path.exists(path):
+ self.root = None
raise NoRootEntry(path)
versionfile=utility.search_parent_directories(path,
os.path.join(".be", "version"))
@@ -349,6 +348,7 @@ settings easy. Don't set this attribute. Set .vcs instead, and
else:
beroot = utility.search_parent_directories(path, ".be")
if beroot == None:
+ self.root = None
raise NoBugDir(path)
return beroot
@@ -671,7 +671,7 @@ class SimpleBugDir (BugDir):
assert_new_BugDir=assert_new_BugDir,
allow_vcs_init=vcs_init,
manipulate_encodings=False)
- if sync_with_disk == True: # postpone cleanup since dir.__del__() removes dir.
+ if sync_with_disk == True: # postpone cleanup since dir.cleanup() removes dir.
self._dir_ref = dir
bug_a = self.new_bug("a", summary="Bug A")
bug_a.creator = "John Doe <jdoe@example.com>"