[llvm.py] Make LLVMObject.__del__ work if called during __init__

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152505 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Gregory Szorc 2012-03-10 21:01:14 +00:00
parent 644f191d31
commit d3ac784fbb

View File

@ -58,6 +58,9 @@ class LLVMObject(object):
return self._as_parameter_ return self._as_parameter_
def __del__(self): def __del__(self):
if not hasattr(self, '_self_owned') or not hasattr(self, '_disposer'):
return
if self._self_owned and self._disposer: if self._self_owned and self._disposer:
self._disposer(self) self._disposer(self)