From 31fbc3ae64d4f406953626303b859f7a240d0c90 Mon Sep 17 00:00:00 2001 From: Siu Kwan Lam Date: Thu, 10 Jan 2013 17:10:40 -0600 Subject: [PATCH] Module.link_in should not delete other.ptr and should prevent the other.ptr from being destroyed --- llvm/core.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/llvm/core.py b/llvm/core.py index 66d7fbc..e4c60a7 100644 --- a/llvm/core.py +++ b/llvm/core.py @@ -471,7 +471,9 @@ class Module(llvm.Ownable, llvm.Cacheable): raise llvm.LLVMException(result) if not preserve: # Prevent user from using the other module - del other.ptr + other.ptr = None + # Use a dummy owner to prevent other.ptr to be deleted + other._own(llvm.DummyOwner()) def get_type_named(self, name): """Return a Type object with the given name."""