diff --git a/bindings/python/llvm/common.py b/bindings/python/llvm/common.py index 9911e694ba4..0c5fcd03d84 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)