summaryrefslogtreecommitdiff
path: root/bindings/python
diff options
context:
space:
mode:
authorGregory Szorc <gregory.szorc@gmail.com>2012-03-10 21:01:14 +0000
committerGregory Szorc <gregory.szorc@gmail.com>2012-03-10 21:01:14 +0000
commitd3ac784fbb1e3cc31f9d8bd702fcda5a63d3ca8e (patch)
tree3ce661aba538633ccd700848315bdb714fe6cb12 /bindings/python
parent644f191d31d45d2c281dfa2a7bfba955f8928348 (diff)
downloadllvm-d3ac784fbb1e3cc31f9d8bd702fcda5a63d3ca8e.tar.gz
[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
Diffstat (limited to 'bindings/python')
-rw-r--r--bindings/python/llvm/common.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/bindings/python/llvm/common.py b/bindings/python/llvm/common.py
index 9911e694ba46..0c5fcd03d844 100644
--- a/bindings/python/llvm/common.py
+++ b/bindings/python/llvm/common.py
@@ -58,6 +58,9 @@ class LLVMObject(object):
return self._as_parameter_
def __del__(self):
+ if not hasattr(self, '_self_owned') or not hasattr(self, '_disposer'):
+ return
+
if self._self_owned and self._disposer:
self._disposer(self)