Protect __del__ from failure inside __init__ by setting inTransaction before

trying to create a transaction instance.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
This commit is contained in:
emellor@leeni.uk.xensource.com committed 2005-10-18 18:07:11 +01:00
1 parent ac6e05c769
commit a1190ad2e6
1 file changed
+3
@@ -14,6 +14,9 @@ from xen.xend.xenstore.xsutil import xshandle
class xstransact:
def __init__(self, path):
self.in_transaction = False # Set this temporarily -- if this
# constructor fails, then we need to
# protect __del__.
self.path = path.rstrip("/")
self.transaction = xshandle().transaction_start()
self.in_transaction = True
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.