Re: Embedding Python - Deleting a class instance

2005-06-22 Thread Andreas Kostyrka
On Tue, Jun 21, 2005 at 12:06:47PM +, Bue Krogh Vedel-Larsen wrote: > How do I delete a class instance created using PyInstance_New? I've tried > calling Py_CLEAR on the instance, but __del__ isn't called. I've also tried > calling PyObject_Del, but this gives an access violation in > _PyObj

Re: Embedding Python - Deleting a class instance

2005-06-21 Thread Bue Krogh Vedel-Larsen
Jeff Epler <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > > Unless there's a cycle and GC gets involved, all there is to deleting > *anything* in Python is correctly managing the refcount. On the other > hand, you can never free an object while it is still reachable. Some > local name

Re: Embedding Python - Deleting a class instance

2005-06-21 Thread Jeff Epler
I wrote the following module to test the behavior of PyInstance_New. I called it something like this: import vedel class k: def __del__(self): print "deleted" vedel.g(k) I get output like: after creation, x->refcnt = 1 doing decref deleted after decref Unles

Re: Embedding Python - Deleting a class instance

2005-06-21 Thread Denis S. Otkidach
On Tue, 21 Jun 2005 12:06:47 GMT "Bue Krogh Vedel-Larsen" <[EMAIL PROTECTED]> wrote: > How do I delete a class instance created using PyInstance_New? I've tried > calling Py_CLEAR on the instance, but __del__ isn't called. I've also tried > calling PyObject_Del, but this gives an access violatio