[LLVMdev] Python bindings available.

Mahadevan R mdevan.foobar at gmail.com
Tue May 13 20:21:05 PDT 2008


On Tue, May 13, 2008 at 10:55 PM, Gordon Henriksen
<gordonhenriksen at mac.com> wrote:
> On May 13, 2008, at 07:31, Mahadevan R wrote:
>
>  > Um. Unfortunately in this case, Python will not collect an instance
>  > of Pet which owned by an Owner, because both objects in the
>  > reference cycle have finalizers (__del__). Python will just add both
>  > objects to a garbage list (and will not call any of the finalizers).
>
>  Actually, there's no reference cycle, which is what I presume is the
>  problem you're referring to:

Ah, that's true. My mistake.

Actually the self.ptr object is a PyCObject with "owned" semantics
right now -- that is, when self.ptr is finalized, a LLVMDisposeXXX() will
be called. This has to be changed (self.ptr finalization does nothing),
and the ownership maintained via Python finalizers (like you've done above).

-Mahadevan.



More information about the llvm-dev mailing list